diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /framework/qa/complex/api_internal | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | framework/qa/complex/api_internal/CheckAPI.java | 180 | ||||
-rw-r--r-- | framework/qa/complex/api_internal/api.lst | 266 | ||||
-rw-r--r-- | framework/qa/complex/api_internal/tests.sce | 2 | ||||
-rw-r--r-- | framework/qa/complex/api_internal/worksforme.sce | 54 |
4 files changed, 502 insertions, 0 deletions
diff --git a/framework/qa/complex/api_internal/CheckAPI.java b/framework/qa/complex/api_internal/CheckAPI.java new file mode 100644 index 000000000..cd17f4a69 --- /dev/null +++ b/framework/qa/complex/api_internal/CheckAPI.java @@ -0,0 +1,180 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +package complex.api_internal; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import helper.OfficeProvider; +import helper.ProcessHandler; + +import java.io.UnsupportedEncodingException; +import java.util.StringTokenizer; +import lib.TestParameters; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.openoffice.test.OfficeConnection; + +import com.sun.star.beans.NamedValue; +import com.sun.star.beans.PropertyValue; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.task.XJob; +import com.sun.star.uno.UnoRuntime; + +/** + * This test executes the API tests internally in LibreOffice. Prerequisite is + * that an OOoRunner.jar is registered inside of LibreOffice. Adjust the joblist + * inside of the CheckAPI.props to determine which tests will be executed. + */ +public class CheckAPI { + + /** + * The test parameters + */ + private TestParameters param = null; + + /** + * + */ + @Before public void before() + { + param = new TestParameters(); + } + /** + * Execute the API tests inside of the Office. If the Office crashes, it + * will be restarted and the job will continue after the one that caused the crash. + */ + @Test public void checkAPI() { + System.out.println("Start with test"); + // if test is idle for 5 minutes, assume that it hangs and kill it. + XMultiServiceFactory xMSF = getMSF(); + Object oObj = null; + try { + oObj = xMSF.createInstance("org.openoffice.RunnerService"); + } + catch(com.sun.star.uno.Exception e) { + fail("Could not create Instance of 'org.openoffice.RunnerService'"); + } + assertNotNull("Cannot create 'org.openoffice.RunnerService'", oObj); + + // get the parameters for the internal test + final NamedValue[] internalParams = new NamedValue[3]; + internalParams[0] = new NamedValue(); + internalParams[0].Name = "-OutProducer"; + internalParams[0].Value = "stats.SimpleFileOutProducer"; + internalParams[1] = new NamedValue(); + internalParams[1].Name = "-OutputPath"; + internalParams[1].Value = "/dev/null"; + + // do we have test jobs? + final PropertyValue[] props = new PropertyValue[1]; + props[0] = new PropertyValue(); + props[0].Value = "sw.SwXTextTable"; + + System.out.println("Props length: "+ props.length); + for (int i=0; i<props.length; i++) { + XJob xJob = UnoRuntime.queryInterface(XJob.class, oObj); + internalParams[2] = new NamedValue(); + internalParams[2].Name = "-o"; + internalParams[2].Value = props[i].Value; + System.out.println("Executing: " + (String)props[i].Value); + + String erg = null; + + try { + erg = (String)xJob.execute(internalParams); + } + catch(Throwable t) { + // restart and go on with test!! + t.printStackTrace(); + fail("Test run '" + (String)props[i].Value +"' could not be executed: Office crashed and is killed!"); + xMSF = null; + ProcessHandler handler = (ProcessHandler)param.get("AppProvider"); + handler.kill(); + util.utils.pause(10000); + OfficeProvider op = new OfficeProvider(); + try { + xMSF = (XMultiServiceFactory)op.getManager(param); + param.put("ServiceFactory",xMSF); + + oObj = xMSF.createInstance("org.openoffice.RunnerService"); + } + catch(com.sun.star.uno.Exception e) { + fail("Could not create Instance of 'org.openoffice.RunnerService'"); + } + catch (UnsupportedEncodingException e) { + fail("Could not get Manager'"); + } + } + System.out.println(erg); + String processedErg = parseResult(erg); + assertTrue("Run '" + (String)props[i].Value + "' has result '" + processedErg + "'", processedErg == null); + } + } + + private String parseResult(String erg) { + String lineFeed = System.getProperty("line.separator"); + String processedErg = null; + if (erg != null) { + StringTokenizer token = new StringTokenizer(erg, lineFeed); + String previousLine = null; + while ( token.hasMoreTokens() ) { + String line = token.nextToken(); + // got a failure! + if ( line.indexOf("FAILED") != -1 ) { + processedErg = (processedErg == null)?"":processedErg + ";"; + processedErg += previousLine + ":" + line; + } + if ( line.startsWith("Execute:") ) { + previousLine = line; + } + else { + previousLine += " " + line; + } + } + } + return processedErg; + } + + + private XMultiServiceFactory getMSF() + { + return UnoRuntime.queryInterface(XMultiServiceFactory.class, connection.getComponentContext().getServiceManager()); + } + + // setup and close connections + @BeforeClass public static void setUpConnection() throws Exception { + System.out.println("setUpConnection()"); + connection.setUp(); + } + + @AfterClass public static void tearDownConnection() + throws InterruptedException, com.sun.star.uno.Exception + { + System.out.println("tearDownConnection()"); + connection.tearDown(); + } + + private static final OfficeConnection connection = new OfficeConnection(); + +} + + diff --git a/framework/qa/complex/api_internal/api.lst b/framework/qa/complex/api_internal/api.lst new file mode 100644 index 000000000..f19edba01 --- /dev/null +++ b/framework/qa/complex/api_internal/api.lst @@ -0,0 +1,266 @@ +job1=cached.CachedContentResultSetFactory +job2=cached.CachedContentResultSetStubFactory +job3=cached.CachedDynamicResultSetFactory +job4=cached.CachedDynamicResultSetStubFactory +job5=cmdmail.SimpleCommandMail +job6=corereflection.uno.CoreReflection +job7=dbaccess.DBContentLoader +job8=dbaccess.OCommandDefinition +job9=dbaccess.ODatabaseContext +job10=dbaccess.ODatabaseSource +job11=dbaccess.ODatasourceAdministrationDialog +job12=dbaccess.OInteractionHandler +job13=dbaccess.OQueryDesign +job14=dbaccess.OSQLMessageDialog +job15=dbaccess.SbaXGridControl +job16=fileacc.SimpleFileAccess +job17=fop.FolderPicker +job18=forms.OButtonControl +job19=forms.OCheckBoxControl +job20=forms.OCheckBoxModel +job21=forms.OComboBoxControl +job22=forms.OComboBoxModel +job23=forms.OCurrencyControl +job24=forms.OCurrencyModel +job25=forms.ODateControl +job26=forms.ODateModel +job27=forms.OEditControl +job28=forms.OFileControlModel +job29=forms.OFixedTextModel +job30=forms.OFormattedControl +job31=forms.OFormattedFieldWrapper +job32=forms.OGroupBoxControl +job33=forms.OGroupBoxModel +job34=forms.OHiddenModel +job35=forms.OImageButtonControl +job36=forms.OImageButtonModel +job37=forms.OImageControlControl +job38=forms.OImageControlModel +job39=forms.OListBoxControl +job40=forms.OListBoxModel +job41=forms.ONumericControl +job42=forms.ONumericModel +job43=forms.OPatternControl +job44=forms.OPatternModel +job45=forms.ORadioButtonControl +job46=forms.ORadioButtonModel +job47=forms.OTimeControl +job48=forms.OTimeModel +job49=fwk.MailToDispatcher +job50=fwk.ServiceHandler +job51=fwl.PathSettings +job52=i18n.ChapterCollator +job53=i18n.Collator +job54=i18n.LocaleData +job55=i18n.NumberFormatCodeMapper +job56=i18n.TextSearch +job57=implreg.uno.ImplementationRegistration +job58=introspection.uno.Introspection +job59=invocadapt.uno.InvocationAdapterFactory +job60=invocation.uno.Invocation +job61=javavm.uno.JavaVirtualMachine +job62=lng.LinguProps +job63=mcnttype.MimeContentTypeFactory +job64=namingservice.uno.NamingService +job65=nestedreg.uno.NestedRegistry +job66=proxyfac.uno.ProxyFactory +job68=regtypeprov.uno.RegistryTypeDescriptionProvider +job69=remotebridge.uno.various +job70=sc.AccessibleEditableTextPara_HeaderFooter +job71=sc.ScAccessibleCell +job72=sc.ScAccessiblePageHeader +job73=sc.ScAccessiblePreviewTable +job74=sc.ScAccessibleSpreadsheet +job78=sc.ScAutoFormatFieldObj +job81=sc.ScCellFieldObj +job88=sc.ScDatabaseRangeObj +job98=sc.ScHeaderFieldObj +job99=sc.ScHeaderFieldsObj +job126=sc.ScSheetLinkObj +job132=sc.ScStyleObj +job140=sc.XMLContentExporter +job141=sc.XMLContentImporter +job142=sc.XMLImporter +job143=sc.XMLMetaExporter +job144=sc.XMLMetaImporter +job145=sc.XMLSettingsExporter +job146=sc.XMLSettingsImporter +job147=sc.XMLStylesExporter +job148=sc.XMLStylesImporter +job149=sd.AccessibleDrawDocumentView +job150=sd.AccessibleOutlineView +job151=sd.AccessibleSlideView +job152=sd.SdDocLinkTargets +job153=sd.SdDrawPagesAccess +job154=sd.SdLayer +job155=sd.SdLayerManager +job156=sd.SdMasterPagesAccess +job157=sd.SdXCustomPresentation +job158=sd.SdXPresentation +job159=servicemgr.uno.OServiceManager +job160=sfx.SfxMacroLoader +job161=simplereg.uno.SimpleRegistry +job162=sm.SmEditAccessible +job163=sm.SmModel +job164=sm.XMLExporter +job165=sm.XMLMetaExporter +job166=sm.XMLSettingsExporter +job167=sm.XMLSettingsImporter +job168=srtrs.SortedDynamicResultSetFactory +job169=streams.uno.DataInputStream +job170=streams.uno.DataOutputStream +job171=streams.uno.MarkableInputStream +job172=streams.uno.MarkableOutputStream +job173=streams.uno.ObjectInputStream +job174=streams.uno.ObjectOutputStream +job175=streams.uno.Pipe +job176=streams.uno.Pump +job177=svtools.AccessibleBrowseBoxHeaderBar +job178=svtools.AccessibleBrowseBoxHeaderCell +job179=svtools.AccessibleBrowseBoxTable +job180=svtools.AccessibleBrowseBoxTableCell +job181=svtools.AccessibleTabBar +job182=svtools.AccessibleTabBarPageList +job183=svx.AccessibleControlShape +job184=svx.AccessibleGraphicShape +job185=svx.AccessiblePresentationGraphicShape +job186=svx.AccessiblePresentationShape +job187=svx.AccessibleShape +job188=svx.SvxShapeCollection +job189=svx.SvxUnoTextContent +job190=svx.SvxUnoTextContentEnum +job191=svx.SvxUnoTextField +job192=svx.SvxUnoTextRangeEnumeration +job193=sw.SwAccessibleDocumentPageView +job194=sw.SwAccessibleDocumentView +job195=sw.SwAccessibleEndnoteView +job196=sw.SwAccessibleFooterView +job197=sw.SwAccessibleFootnoteView +job198=sw.SwAccessibleHeaderView +job199=sw.SwAccessibleParagraphView +job200=sw.SwAccessibleTableCellView +job201=sw.SwAccessibleTextFrameView +job202=sw.SwAccessibleTextGraphicObject +job203=sw.SwXBodyText +job204=sw.SwXBookmark +job205=sw.SwXBookmarks +job206=sw.SwXCell +job207=sw.SwXDocumentIndexes +job208=sw.SwXDocumentIndexMark +job209=sw.SwXEndnoteProperties +job210=sw.SwXFieldEnumeration +job211=sw.SwXFieldMaster +job212=sw.SwXFootnote +job213=sw.SwXFootnoteProperties +job214=sw.SwXFootnotes +job215=sw.SwXFootnoteText +job216=sw.SwXFrames +job217=sw.SwXHeadFootText +job218=sw.SwXLineNumberingProperties +job219=sw.SwXModule +job220=sw.SwXParagraphEnumeration +job221=sw.SwXPrintSettings +job222=sw.SwXPropertySet +job223=sw.SwXPropertySetInfo +job224=sw.SwXReferenceMark +job225=sw.SwXReferenceMarks +job226=sw.SwXStyle +job227=sw.SwXStyleFamilies +job228=sw.SwXStyleFamily +job229=sw.SwXTableCellText +job230=sw.SwXTableRows +job231=sw.SwXTextColumns +job232=sw.SwXTextDefaults +job233=sw.SwXTextEmbeddedObjects +job234=sw.SwXTextField +job235=sw.SwXTextFieldMasters +job236=sw.SwXTextFieldTypes +job237=sw.SwXTextFrameText +job238=sw.SwXTextGraphicObjects +job239=sw.SwXTextPortionEnumeration +job240=sw.SwXTextRanges +job241=sw.SwXTextSearch +job242=sw.SwXTextSection +job243=sw.SwXTextSections +job244=sw.SwXTextTableRow +job245=sw.SwXTextTables +job246=sw.SwXViewSettings +job247=sw.XMLContentExporter +job248=sw.XMLExporter +job249=sw.XMLImporter +job250=sw.XMLMetaExporter +job251=sw.XMLSettingsExporter +job252=sw.XMLSettingsImporter +job253=sw.XMLStylesExporter +job254=sysdtrans.SystemClipboard +job255=syssh.SystemShellExecute +job256=text.DefaultNumberingProvider +job257=toolkit.AccessibleComboBox +job258=toolkit.AccessibleList +job259=toolkit.AccessibleListBox +job260=toolkit.AccessibleMenuSeparator +job261=toolkit.AccessibleStatusBar +job262=toolkit.AccessibleTabControl +job263=toolkit.AccessibleWindow +job264=toolkit.TabControllerModel +job265=toolkit.UnoControlCheckBox +job266=toolkit.UnoControlCheckBoxModel +job267=toolkit.UnoControlComboBox +job268=toolkit.UnoControlComboBoxModel +job269=toolkit.UnoControlContainerModel +job270=toolkit.UnoControlCurrencyField +job271=toolkit.UnoControlCurrencyFieldModel +job272=toolkit.UnoControlDateField +job273=toolkit.UnoControlDateFieldModel +job274=toolkit.UnoControlEdit +job275=toolkit.UnoControlEditModel +job276=toolkit.UnoControlFileControlModel +job277=toolkit.UnoControlFixedText +job278=toolkit.UnoControlFixedTextModel +job279=toolkit.UnoControlFormattedField +job280=toolkit.UnoControlFormattedFieldModel +job281=toolkit.UnoControlGroupBox +job282=toolkit.UnoControlGroupBoxModel +job283=toolkit.UnoControlImageControl +job284=toolkit.UnoControlImageControlModel +job285=toolkit.UnoControlListBox +job286=toolkit.UnoControlListBoxModel +job287=toolkit.UnoControlNumericFieldModel +job288=toolkit.UnoControlPatternField +job289=toolkit.UnoControlPatternFieldModel +job290=toolkit.UnoControlProgressBarModel +job291=toolkit.UnoControlRadioButton +job292=toolkit.UnoControlRadioButtonModel +job293=toolkit.UnoControlScrollBarModel +job294=toolkit.UnoControlTimeField +job295=toolkit.UnoControlTimeFieldModel +job296=typeconverter.uno.TypeConverter +job297=typemgr.uno.TypeDescriptionManager +job298=ucb.UcbContentProviderProxyFactory +job299=ucb.UcbPropertiesManager +job300=ucb.UcbStore +job301=ucb.UniversalContentBroker +job302=ucpchelp.CHelpContentProvider +job303=ucpdav.WebDAVContentProvider +job304=ucpfile.FileProvider +job305=ucpftp.FTPContentProvider +job306=ucphier.HierarchyContentProvider +job307=ucphier.HierarchyDataSource +job308=ucppkg.PackageContentProvider +job309=uui.UUIInteractionHandler +job310=xmloff.Draw.XMLContentExporter +job311=xmloff.Draw.XMLExporter +job312=xmloff.Draw.XMLMetaExporter +job313=xmloff.Draw.XMLSettingsExporter +job314=xmloff.Draw.XMLSettingsImporter +job315=xmloff.Draw.XMLStylesExporter +job316=xmloff.Impress.XMLContentExporter +job317=xmloff.Impress.XMLExporter +job318=xmloff.Impress.XMLMetaExporter +job319=xmloff.Impress.XMLSettingsExporter +job320=xmloff.Impress.XMLSettingsImporter +job321=xmloff.Impress.XMLStylesExporter +job322=cfgmgr2.AdministrationProvider +job323=cfgmgr2.ConfigurationProvider +job324=cfgmgr2.ConfigurationProviderWrapper +job325=cfgmgr2.OConfigurationRegistry diff --git a/framework/qa/complex/api_internal/tests.sce b/framework/qa/complex/api_internal/tests.sce new file mode 100644 index 000000000..adc5db8fb --- /dev/null +++ b/framework/qa/complex/api_internal/tests.sce @@ -0,0 +1,2 @@ +job1=cfgmgr2.AdministrationProvider +job3=sw.SwXBodyText diff --git a/framework/qa/complex/api_internal/worksforme.sce b/framework/qa/complex/api_internal/worksforme.sce new file mode 100644 index 000000000..e764cbd93 --- /dev/null +++ b/framework/qa/complex/api_internal/worksforme.sce @@ -0,0 +1,54 @@ +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# +job=cmdmail.SimpleCommandMail +job=fileacc.SimpleFileAccess +job=sc.ScCellFieldObj +job=sc.XMLImporter +job=sc.XMLMetaExporter +job=sd.SdDocLinkTargets +job=sd.SdDrawPage +job=sd.SdMasterPagesAccess +job=sd.SdXCustomPresentation +job=sd.SdXPresentation +job=servicemgr.uno.OServiceManager +job=sfx.SfxMacroLoader +job=simplereg.uno.SimpleRegistry +job=sm.XMLSettingsExporter +job=sm.XMLSettingsImporter +job=srtrs.SortedDynamicResultSetFactory +job=svx.SvxShapeCollection +job=svx.SvxUnoTextRangeEnumeration +job=sw.SwXBodyText +job=sw.XMLExporter +job=sw.XMLImporter +job=sw.XMLMetaExporter +job=sw.XMLSettingsExporter +job=sw.XMLSettingsImporter +job=sw.XMLStylesExporter +job=sysdtrans.SystemClipboard +job=syssh.SystemShellExecute +job=text.DefaultNumberingProvider +job=toolkit.TabControllerModel +job=toolkit.UnoControlCheckBox +job=toolkit.UnoControlTimeField +job=toolkit.UnoControlTimeFieldModel +job=typeconverter.uno.TypeConverter +job=typemgr.uno.TypeDescriptionManager +job=ucb.UcbContentProviderProxyFactory +job=ucb.UcbPropertiesManager +job=ucb.UcbStore |