summaryrefslogtreecommitdiffstats
path: root/qadevOOo/tests/java/ifc/lang
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/ifc/lang')
-rw-r--r--qadevOOo/tests/java/ifc/lang/_ServiceManager.java51
-rw-r--r--qadevOOo/tests/java/ifc/lang/_XComponent.java168
-rw-r--r--qadevOOo/tests/java/ifc/lang/_XEventListener.java53
-rw-r--r--qadevOOo/tests/java/ifc/lang/_XInitialization.java102
-rw-r--r--qadevOOo/tests/java/ifc/lang/_XLocalizable.java63
-rw-r--r--qadevOOo/tests/java/ifc/lang/_XMain.java63
-rw-r--r--qadevOOo/tests/java/ifc/lang/_XMultiComponentFactory.java122
-rw-r--r--qadevOOo/tests/java/ifc/lang/_XMultiServiceFactory.java188
-rw-r--r--qadevOOo/tests/java/ifc/lang/_XServiceDisplayName.java50
-rw-r--r--qadevOOo/tests/java/ifc/lang/_XServiceInfo.java88
-rw-r--r--qadevOOo/tests/java/ifc/lang/_XSingleServiceFactory.java160
-rw-r--r--qadevOOo/tests/java/ifc/lang/_XTypeProvider.java82
12 files changed, 1190 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/ifc/lang/_ServiceManager.java b/qadevOOo/tests/java/ifc/lang/_ServiceManager.java
new file mode 100644
index 000000000..6ccf2b06e
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_ServiceManager.java
@@ -0,0 +1,51 @@
+/*
+ * 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 ifc.lang;
+
+import lib.MultiPropertyTest;
+
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.XComponentContext;
+
+public class _ServiceManager extends MultiPropertyTest {
+
+ public void _DefaultContext() {
+ XComponentContext get = null;
+ boolean res = false;
+ try {
+ get = (XComponentContext)AnyConverter.toObject(new Type(XComponentContext.class), oObj.getPropertyValue("DefaultContext"));
+ res = get != null;
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ log.println("Illegal Argument Exception");
+ res = false;
+ } catch (com.sun.star.beans.UnknownPropertyException upe) {
+ log.println("Property is optional and not supported");
+ res = true;
+ } catch (com.sun.star.lang.WrappedTargetException wte) {
+ log.println("Unexpected Exception");
+ wte.printStackTrace(log);
+ res = false;
+ }
+ tRes.tested("DefaultContext", res);
+
+ }
+
+} // EOF _ServiceManager
+
diff --git a/qadevOOo/tests/java/ifc/lang/_XComponent.java b/qadevOOo/tests/java/ifc/lang/_XComponent.java
new file mode 100644
index 000000000..b1c8399f6
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_XComponent.java
@@ -0,0 +1,168 @@
+/*
+ * 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 ifc.lang;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.frame.XDesktop;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XEventListener;
+
+/**
+* Testing <code>com.sun.star.lang.XComponent</code>
+* interface methods :
+* <ul>
+* <li><code> dispose()</code></li>
+* <li><code> addEventListener()</code></li>
+* <li><code> removeEventListener()</code></li>
+* </ul>
+* After this interface test object <b>must be recreated</b>. <p>
+* Multithreaded test ability <b>not implemented</b> yet.
+* @see com.sun.star.lang.XComponent
+*/
+public class _XComponent extends MultiMethodTest {
+
+ public static XComponent oObj = null;
+ private XComponent altDispose = null;
+
+ boolean listenerDisposed[] = new boolean[2];
+ String[] Loutput = new String[2];
+
+ /**
+ * Listener which added but not removed, and its method must be called
+ * on <code>dispose</code> call.
+ */
+ public class MyEventListener implements XEventListener {
+ public void disposing ( EventObject oEvent ) {
+ Loutput[0] = Thread.currentThread() + " is DISPOSING EV1" + this;
+ listenerDisposed[0] = true;
+ }
+ }
+
+ /**
+ * Listener which added and then removed, and its method must <b>not</b>
+ * be called on <code>dispose</code> call.
+ */
+ public class MyEventListener2 implements XEventListener {
+ public void disposing ( EventObject oEvent ) {
+ Loutput[0] = Thread.currentThread() + " is DISPOSING EV2" + this;
+ listenerDisposed[1] = true;
+ }
+ }
+
+ XEventListener listener1 = new MyEventListener();
+ XEventListener listener2 = new MyEventListener2();
+
+ /**
+ * For the (no longer existing) cfgmgr2.OSetElement tests: dispose the owner
+ * element. TODO: Is this needed for anything else, too, or should it be
+ * removed?
+ */
+ @Override
+ protected void before() {
+ // do not dispose this component, but parent instead
+ altDispose = (XComponent)tEnv.getObjRelation("XComponent.DisposeThis");
+
+ }
+
+ /**
+ * Adds two listeners. <p>
+ * Has OK status if then the first listener will receive an event
+ * on <code>dispose</code> method call.
+ */
+ public void _addEventListener() {
+
+ listenerDisposed[0] = false;
+ listenerDisposed[1] = false;
+
+ oObj.addEventListener( listener1 );
+ oObj.addEventListener( listener2 );
+ } // finished _addEventListener()
+
+ /**
+ * Removes the second of two added listeners. <p>
+ * Method tests to be completed successfully :
+ * <ul>
+ * <li> <code>addEventListener</code> : method must add two listeners. </li>
+ * </ul> <p>
+ * Has OK status if no events will be sent to the second listener on
+ * <code>dispose</code> method call.
+ */
+ public void _removeEventListener() {
+ executeMethod("addEventListener()");
+ if (disposed) return;
+ // the second listener should not be called
+ oObj.removeEventListener( listener2 );
+ log.println(Thread.currentThread() + " is removing EL " + listener2);
+ } // finished _removeEventListener()
+
+ boolean disposed = false;
+
+ /**
+ * Disposes the object and then check appropriate listeners were
+ * called or not. <p>
+ * Method tests to be completed successfully :
+ * <ul>
+ * <li> <code>removeEventListener</code> : method must remove one of two
+ * listeners. </li>
+ * </ul> <p>
+ * Has OK status if liseter removed wasn't called and other listener
+ * was.
+ */
+ public void _dispose() {
+ disposed = false;
+ executeMethod("removeEventListener()");
+
+ log.println( "begin dispose in thread " + Thread.currentThread());
+ XDesktop oDesk = (XDesktop) tEnv.getObjRelation("Desktop");
+ if (oDesk !=null) {
+ oDesk.terminate();
+ }
+ else {
+ if (altDispose == null)
+ oObj.dispose();
+ else
+ altDispose.dispose();
+ }
+
+ util.utils.shortWait();
+ if (Loutput[0]!=null) log.println(Loutput[0]);
+ if (Loutput[1]!=null) log.println(Loutput[1]);
+ log.println( "end dispose" + Thread.currentThread());
+ disposed = true;
+
+ // check that dispose() works OK.
+ tRes.tested("addEventListener()", listenerDisposed[0]);
+ tRes.tested("removeEventListener()", !listenerDisposed[1]);
+ tRes.tested("dispose()", listenerDisposed[0] && !listenerDisposed[1]);
+
+ } // finished _dispose()
+
+ /**
+ * Forces object recreation.
+ */
+ @Override
+ protected void after() {
+ disposeEnvironment();
+ }
+
+} // finished class _XComponent
+
+
diff --git a/qadevOOo/tests/java/ifc/lang/_XEventListener.java b/qadevOOo/tests/java/ifc/lang/_XEventListener.java
new file mode 100644
index 000000000..2401e7d24
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_XEventListener.java
@@ -0,0 +1,53 @@
+/*
+ * 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 ifc.lang;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.XEventListener;
+
+/**
+* Testing <code>com.sun.star.lang.XEventListener</code>
+* interface methods :
+* <ul>
+* <li><code> disposing()</code></li>
+* </ul> <p>
+* Tests nothing, all methods has <b>OK</b> status.
+* @see com.sun.star.lang.XEventListener
+*/
+public class _XEventListener extends MultiMethodTest {
+
+ public XEventListener oObj = null;
+
+ /**
+ * Nothing to test. Always has <b>OK</b> status.
+ */
+ public void _disposing() {
+ log.println("The method 'disposing'");
+ log.println("gets called when the broadcaster is about to be"+
+ " disposed.") ;
+ log.println("All listeners and all other objects which reference "+
+ "the broadcaster should release the references.");
+ log.println("So there is nothing to test here");
+ tRes.tested("disposing()",true);
+
+ }
+
+} //EOF of XEventListener
+
diff --git a/qadevOOo/tests/java/ifc/lang/_XInitialization.java b/qadevOOo/tests/java/ifc/lang/_XInitialization.java
new file mode 100644
index 000000000..5566aef0c
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_XInitialization.java
@@ -0,0 +1,102 @@
+/*
+ * 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 ifc.lang;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.XInitialization;
+
+/**
+* Testing <code>com.sun.star.lang.XInitialization</code>
+* interface methods. <p>
+* This test needs the following object relations :
+* <ul>
+* <li> <code>'XInitialization.args'</code> (of type <code>Object[]</code>):
+* (<b>Optional</b>) : argument for <code>initialize</code>
+* method. If omitted zero length array is used. </li>
+* <ul> <p>
+* Test is multithread compliant. <p>
+* Till the present time there was no need to recreate environment
+* after this test completion.
+*/
+public class _XInitialization extends MultiMethodTest {
+
+ public static XInitialization oObj = null;
+
+ /**
+ * Test calls the method with 0 length array and checks that
+ * no exceptions were thrown. <p>
+ * Has <b> OK </b> status if no exceptions were thrown. <p>
+ */
+ public void _initialize() {
+ boolean result = true ;
+
+ try {
+ XInitialization xInit = (XInitialization) tEnv.getObjRelation("XInitialization.xIni");
+ if (xInit == null) xInit = oObj;
+
+ log.println("calling method with valid arguments...");
+ Object[] args = (Object[]) tEnv.getObjRelation("XInitialization.args");
+ if (args==null) {
+ System.out.println("Using new Object[0] as Argument");
+ xInit.initialize(new Object[0]);
+ } else {
+ xInit.initialize(args);
+ }
+
+ // try to call the method with invalid parameters
+ Object[] ExArgs = (Object[]) tEnv.getObjRelation("XInitialization.ExceptionArgs");
+ if (ExArgs !=null) {
+ log.println("calling method with in-valid arguments...");
+ try{
+ result = false;
+ xInit.initialize(ExArgs);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Expected Exception 'com.sun.star.uno.Exception' occurred -> OK") ;
+ result = true ;
+ } catch (com.sun.star.uno.RuntimeException e) {
+ log.println("Expected Exception 'com.sun.star.uno.RuntimeException' occurred -> OK") ;
+ result = true ;
+ } catch (Exception e) {
+ log.println("Un-Expected Exception occurred -> FALSE") ;
+ log.println(e.toString());
+ e.printStackTrace();
+ }
+ }
+
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Exception occurred while method calling.") ;
+ log.println(e) ;
+ result = false ;
+ }
+
+ tRes.tested("initialize()", result) ;
+ } // finished _initialize()
+
+ /**
+ * Disposes object environment.
+ */
+ @Override
+ public void after() {
+ disposeEnvironment() ;
+ }
+
+} // finished class _XInitialization
+
+
diff --git a/qadevOOo/tests/java/ifc/lang/_XLocalizable.java b/qadevOOo/tests/java/ifc/lang/_XLocalizable.java
new file mode 100644
index 000000000..9a758032b
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_XLocalizable.java
@@ -0,0 +1,63 @@
+/*
+ * 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 ifc.lang;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.XLocalizable;
+import lib.Status;
+
+
+public class _XLocalizable extends MultiMethodTest {
+
+ public XLocalizable oObj;
+ protected Locale initialLocale;
+
+ public void _getLocale() {
+ initialLocale = oObj.getLocale();
+ tRes.tested("getLocale()", initialLocale != null);
+ }
+
+ public void _setLocale() {
+ requiredMethod("getLocale()");
+
+ String ro = (String) tEnv.getObjRelation("XLocalizable.ReadOnly");
+ if (ro != null) {
+ log.println(ro);
+ tRes.tested("setLocale()", Status.skipped(true));
+ return;
+ }
+ Locale newLocale = new Locale("de", "DE", "");
+ oObj.setLocale(newLocale);
+
+ Locale getLocale = oObj.getLocale();
+ boolean res = ((getLocale.Country.equals(newLocale.Country)) &&
+ (getLocale.Language.equals(newLocale.Language)));
+
+ if (!res) {
+ log.println("Expected Language " + newLocale.Language +
+ " and Country " + newLocale.Country);
+ log.println("Getting Language " + getLocale.Language +
+ " and Country " + getLocale.Country);
+ }
+
+ oObj.setLocale(initialLocale);
+ tRes.tested("setLocale()", res);
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/lang/_XMain.java b/qadevOOo/tests/java/ifc/lang/_XMain.java
new file mode 100644
index 000000000..b50186fe0
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_XMain.java
@@ -0,0 +1,63 @@
+/*
+ * 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 ifc.lang;
+
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.XMain;
+
+
+/**
+ * Testing <code>com.sun.star.lang.XMain</code>
+ * interface methods :
+ * <ul>
+ * <li><code> run()</code></li>
+ * </ul> <p>
+ *
+ * This test needs the following object relations :
+ * <ul>
+ * <li> <code>'ARGS'</code> (of type <code>String[]</code>):
+ * used as argument for <code>run</code> method. </li>
+ * <ul> <p>
+ *
+ * @see com.sun.star.lang.XMain
+ */
+public class _XMain extends MultiMethodTest{
+
+ public static XMain oObj = null;
+
+ /**
+ * Just calls the method. <p>
+ *
+ * Has <b> OK </b> status if no runtime exceptions occurred.
+ */
+ public void _run() {
+ String[] args = (String[])tEnv.getObjRelation("ARGS");
+
+ log.println("Running with arguments:");
+ for (int i=0; i< args.length; i++)
+ log.println("#" + i + ": " + args[i]);
+
+ oObj.run(args);
+
+ tRes.tested("run()", true);
+ }
+
+}
diff --git a/qadevOOo/tests/java/ifc/lang/_XMultiComponentFactory.java b/qadevOOo/tests/java/ifc/lang/_XMultiComponentFactory.java
new file mode 100644
index 000000000..424e3d576
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_XMultiComponentFactory.java
@@ -0,0 +1,122 @@
+/*
+ * 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 ifc.lang;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.uno.XInterface;
+
+/**
+* Testing <code>com.sun.star.lang.XMultiComponentFactory</code>
+* interface methods :
+* <ul>
+* <li><code> createInstanceWithContext()</code></li>
+* <li><code> createInstanceWithArgumentsAndContext()</code></li>
+* <li><code> getAvailableServiceNames()</code></li>
+* </ul> <p>
+* Test is <b> NOT </b> multithread compliant. <p>
+* @see com.sun.star.lang.XMultiComponentFactory
+*/
+public class _XMultiComponentFactory extends MultiMethodTest {
+ public XMultiComponentFactory oObj = null;
+
+ public XComponentContext xContext = null;
+ private String[] availableServiceNames = null;
+
+ @Override
+ public void before(){
+ xContext = (XComponentContext)tEnv.getObjRelation("DC");
+ availableServiceNames = (String[])tEnv.getObjRelation("XMultiComponentFactory.ServiceNames");
+ }
+
+ /**
+ * Calls the method with one of the available service names
+ * obtained by method getAvailableServiceNames. <p>
+ * Has <b> OK </b> status if no runtime exceptions occurred
+ * and returned value is not null.
+ */
+ public void _createInstanceWithContext() {
+ requiredMethod("getAvailableServiceNames()");
+ boolean result = true;
+
+ try {
+ XInterface component = (XInterface)
+ oObj.createInstanceWithContext(
+ availableServiceNames[0], xContext);
+ result = (component != null);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't create instance " + availableServiceNames[0]);
+ result = false;
+ }
+
+ tRes.tested("createInstanceWithContext()", result);
+ }
+
+ /**
+ * Calls the method with one of the available service names
+ * obtained by method getAvailableServiceNames. <p>
+ * Has <b> OK </b> status if no runtime exceptions occurred
+ * and returned value is not null.
+ */
+ public void _createInstanceWithArgumentsAndContext() {
+ requiredMethod("getAvailableServiceNames()");
+ boolean result = true;
+ XInterface component = null;
+
+ try {
+ component = (XInterface)oObj.createInstanceWithArgumentsAndContext(
+ availableServiceNames[0], new Object[0], xContext);
+ result = (component != null);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't create instance " + availableServiceNames[0]);
+ result = false;
+ }
+
+ tRes.tested("createInstanceWithArgumentsAndContext()", result);
+ }
+
+ /**
+ * Just calls the method. <p>
+ * Has <b> OK </b> status if no runtime exceptions occurred
+ * and returned value is not null.
+ */
+ public void _getAvailableServiceNames() {
+ boolean result = true;
+ if (availableServiceNames == null) {
+ availableServiceNames = oObj.getAvailableServiceNames();
+ result = (availableServiceNames != null);
+ }
+ else { // if service names are given, ignore result
+ String[]erg = oObj.getAvailableServiceNames();
+ result = (erg != null);
+ }
+
+ log.println("Available service names:");
+ if (availableServiceNames != null) {
+ for(int i = 0; i < availableServiceNames.length; i++) {
+ log.println(" " + availableServiceNames[i]);
+ }
+ }
+
+ tRes.tested("getAvailableServiceNames()", result);
+ }
+}
+
diff --git a/qadevOOo/tests/java/ifc/lang/_XMultiServiceFactory.java b/qadevOOo/tests/java/ifc/lang/_XMultiServiceFactory.java
new file mode 100644
index 000000000..ac5898edb
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_XMultiServiceFactory.java
@@ -0,0 +1,188 @@
+/*
+ * 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 ifc.lang;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.XMultiServiceFactory;
+
+
+/**
+* Testing <code>com.sun.star.lang.XMultiServiceFactory</code>
+* interface methods:
+* <ul>
+* <li><code>createInstance()</code></li>
+* <li><code>createInstanceWithArguments()</code></li>
+* <li><code>getAvailableServiceNames()</code></li>
+* </ul> <p>
+*
+* This test needs the following object relations :
+* <ul>
+* <li> <code>'XMSF.serviceNames'</code> (of type <code>String[]</code>)
+* <b>optional</b>:
+* the relation used when service names are obtained the way
+* other than calling <code>getAvailableServiceNames()</code>
+* method.
+* </li>
+* <li> <code>'XMSF.serviceNamesWithArgs'</code> (of type <code>String[]</code>)
+* <b>optional</b>:
+* the relation used when service names are obtained the way
+* other than calling <code>getAvailableServiceNames()</code>
+* method for testing <code>createInstanceWithArguments</code> method.
+* </li>
+* <li> <code>'XMSF.Args'</code> (of type <code>Object[][]</code>)
+* <b>optional</b>:
+* if this relation exists than the method
+* <code>createInstanceWithArguments</code> is tested. This relation
+* supplies arguments for creating instances. If the relation
+* <code>'XMSF.serviceNamesWithArgs'</code> is also specified
+* then for each service name from that relation appropriate arguments
+* are used from arguments array. If not than arguments with index
+* 0 are used for services creation obtained by
+* <code>getAvailableServiceNames</code> method.
+* </li>
+* </ul> <p>
+*
+* @see com.sun.star.lang.XMultiServiceFactory
+*/
+public class _XMultiServiceFactory extends MultiMethodTest {
+ public XMultiServiceFactory oObj = null;
+ public String[] services = null;
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value isn't null. <p>
+ */
+ public void _getAvailableServiceNames() {
+ services = oObj.getAvailableServiceNames();
+
+ for (int i = 0; i < services.length; i++) {
+ log.println("Service" + i + ": " + services[i]);
+ }
+
+ tRes.tested("getAvailableServiceNames()", true);
+ }
+
+ /**
+ * Test creates instance of the first service from names array
+ * get by <code>getAvailableServiceNames()</code>. If the array
+ * is empty than test looks for names from relation. <p>
+ *
+ * Has <b> OK </b> status if created instance isn't null. <p>
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getAvailableServiceNames() </code> : to have list of
+ * supported services </li>
+ * </ul>
+ */
+ public void _createInstance() {
+ requiredMethod("getAvailableServiceNames()");
+
+ if (services.length == 0) {
+ services = (String[]) tEnv.getObjRelation("XMSF.serviceNames");
+
+ if (services == null) {
+ log.println("No service to create.");
+ tRes.tested("createInstance()", true);
+
+ return;
+ }
+ }
+
+ String needArgs = (String) tEnv.getObjRelation("needArgs");
+
+ if (needArgs != null) {
+ log.println("The " + needArgs +
+ " doesn't support createInstance without arguments");
+ tRes.tested("createInstance()", true);
+
+ return;
+ }
+
+ boolean res = true;
+
+ for (int k = 0; k < services.length; k++) {
+ try {
+ log.println("Creating Instance: " + services[k]);
+
+ Object Inst = oObj.createInstance(services[k]);
+ res = (Inst != null);
+ } catch (com.sun.star.uno.Exception ex) {
+ log.println("Exception occurred during createInstance()");
+ ex.printStackTrace(log);
+ res = false;
+ }
+ }
+
+ tRes.tested("createInstance()", res);
+ }
+
+ /**
+ * If the relation with arguments is not specified test does nothing.
+ * In other case it tries to create instance by its name from
+ * relation of from array <code>getAvailableServiceNames()</code>
+ * method supplied. <p>
+ *
+ * Has <b> OK </b> status if the created instance is not null. <p>
+ *
+ * The following method tests are to be completed successfully before :
+ * <ul>
+ * <li> <code> getAvailableServiceNames() </code> : to have list of
+ * supported services </li>
+ * </ul>
+ */
+ public void _createInstanceWithArguments() {
+ requiredMethod("getAvailableServiceNames()");
+
+ Object[][] args = (Object[][]) tEnv.getObjRelation("XMSF.Args");
+ String[] sNames = (String[]) tEnv.getObjRelation(
+ "XMSF.serviceNamesWithArgs");
+
+ if (args == null) {
+ log.println("Relation 'XMSF.serviceNamesWithArgs' not found");
+ log.println("The component assumed not support " +
+ "createInstanceWithArguments()");
+ tRes.tested("createInstanceWithArguments()", true);
+ } else {
+ if (sNames == null) {
+ sNames = services;
+ }
+
+ boolean res = true;
+
+ for (int k = 0; k < sNames.length; k++) {
+ log.println("Creating service '" + sNames[k] +
+ "' with arguments");
+
+ try {
+ Object Inst = oObj.createInstanceWithArguments(sNames[k],
+ args[k]);
+ res &= (Inst != null);
+ } catch (com.sun.star.uno.Exception ex) {
+ log.println(
+ "Exception occurred during createInstanceWithArguments()");
+ ex.printStackTrace(log);
+ res = false;
+ }
+ }
+
+ tRes.tested("createInstanceWithArguments()", res);
+ }
+ }
+} // finish class _XMultiServiceFactory
diff --git a/qadevOOo/tests/java/ifc/lang/_XServiceDisplayName.java b/qadevOOo/tests/java/ifc/lang/_XServiceDisplayName.java
new file mode 100644
index 000000000..f726f4ec8
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_XServiceDisplayName.java
@@ -0,0 +1,50 @@
+/*
+ * 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 ifc.lang;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.Locale;
+import com.sun.star.lang.XServiceDisplayName;
+
+/**
+* Testing <code>com.sun.star.lang.XServiceDisplayName</code>
+* interface methods:
+* <ul>
+* <li><code>getServiceDisplayName()</code></li>
+* </ul> <p>
+* @see com.sun.star.lang.XServiceDisplayName
+*/
+public class _XServiceDisplayName extends MultiMethodTest {
+
+ public XServiceDisplayName oObj = null;
+
+ /**
+ * Test calls the method and checks returned value. <p>
+ * Has <b> OK </b> status if returned value isn't null. <p>
+ */
+ public void _getServiceDisplayName() {
+ String dn = oObj.getServiceDisplayName(new Locale("de","DE",""));
+
+ tRes.tested("getServiceDisplayName()", dn != null);
+ }
+
+} // finish class MTest
+
+
diff --git a/qadevOOo/tests/java/ifc/lang/_XServiceInfo.java b/qadevOOo/tests/java/ifc/lang/_XServiceInfo.java
new file mode 100644
index 000000000..e1f2e0da3
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_XServiceInfo.java
@@ -0,0 +1,88 @@
+/*
+ * 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 ifc.lang;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.XServiceInfo;
+
+/**
+* Testing <code>com.sun.star.lang.XServiceInfo</code>
+* interface methods :
+* <ul>
+* <li><code> getImplementationName()</code></li>
+* <li><code> supportsService()</code></li>
+* <li><code> getSupportedServiceNames()</code></li>
+* </ul> <p>
+* Test is multithread compliant. <p>
+* @see com.sun.star.lang.XServiceInfo
+*/
+public class _XServiceInfo extends MultiMethodTest {
+ public static XServiceInfo oObj = null;
+ public static String[] names = null;
+
+ /**
+ * Just calls the method.<p>
+ * Has <b>OK</b> status if no runtime exceptions occurred.
+ */
+ public void _getImplementationName() {
+ boolean result = true;
+ log.println("testing getImplementationName() ... ");
+
+ log.println("The ImplementationName is "+oObj.getImplementationName());
+ result=true;
+
+ tRes.tested("getImplementationName()", result);
+
+ } // end getImplementationName()
+
+
+ /**
+ * Just calls the method.<p>
+ * Has <b>OK</b> status if no runtime exceptions occurred.
+ */
+ public void _getSupportedServiceNames() {
+ boolean result = true;
+ log.println("getting supported Services...");
+ names = oObj.getSupportedServiceNames();
+ for (int i=0;i<names.length;i++) {
+ int k = i+1;
+ log.println(k+". Supported Service is "+names[i]);
+ }
+ result=true;
+
+ tRes.tested("getSupportedServiceNames()", result);
+
+ } // end getSupportedServiceNames()
+
+ /**
+ * Gets one of the service names returned by
+ * <code>getSupportedServiceNames</code> method and
+ * calls the <code>supportsService</code> method with this
+ * name. <p>
+ * Has <b>OK</b> status if <code>true</code> value is
+ * returned.
+ */
+ public void _supportsService() {
+ log.println("testing supportsService");
+ names = oObj.getSupportedServiceNames();
+ tRes.tested("supportsService()", oObj.supportsService(names[0]));
+ } // end supportsService()
+}
+
diff --git a/qadevOOo/tests/java/ifc/lang/_XSingleServiceFactory.java b/qadevOOo/tests/java/ifc/lang/_XSingleServiceFactory.java
new file mode 100644
index 000000000..da039308c
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_XSingleServiceFactory.java
@@ -0,0 +1,160 @@
+/*
+ * 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 ifc.lang;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+
+
+/**
+/**
+* Testing <code>com.sun.star.</code>
+* interface methods :lang.XSingleServiceFactory
+* <ul>
+* <li><code> createInstance()</code></li>
+* <li><code> createInstanceWithArguments()</code></li>
+* </ul> <p>
+* This test needs the following object relations :
+* <ul>
+* <li> <code>'XSingleServiceFactory.createInstance.negative'</code> :
+* <code>String</code> relation; If its value 'true' then
+* <code>createInstance</code> method for the object isn't
+* supported. </li>
+* <li> <code>'XSingleServiceFactory.arguments'</code> <b>(optional)</b>:
+* has <code>Object[]</code> type. This relation is used as
+* a parameter for <code>createInstanceWithArguments</code>
+* method call. If this relation doesn't exist test pass
+* zero length array as argument. </li>
+* <li> <code>'XSingleServiceFactory.MustSupport'</code> <b>(optional)</b>:
+* of type <code>java.lang.Class[]</code>. This is an array of UNO
+* interface classes which must be supported by created instance.
+* </li>
+* <ul> <p>
+* Test is <b> NOT </b> multithread compliant. <p>
+* After test completion object environment has to be recreated.
+* @see com.sun.star.lang.XSingleServiceFactory
+*/
+public class _XSingleServiceFactory extends MultiMethodTest {
+
+ public XSingleServiceFactory oObj = null;
+ private Class<?>[] mustSupport = null ;
+
+ @Override
+ public void before() {
+ mustSupport = (Class[]) tEnv.getObjRelation
+ ("XSingleServiceFactory.MustSupport") ;
+ }
+
+ /**
+ * Just calls the method and check the value returned. <p>
+ *
+ * Has <b>OK</b> status in case if this method is supported
+ * by object and non null value is returned, or if
+ * this method isn't supported then the method call must
+ * rise an exception or return <code>null</code> value.
+ * If the relation exists which specifies required interfaces
+ * supported by created instance then status is <b>OK</b>
+ * if all these interfaces are supported.
+ */
+ public void _createInstance() {
+ // for some objects the method should fail.
+ // If this is required the property is set to true.
+ String negStr = (String)tEnv.getObjRelation(
+ "XSingleServiceFactory.createInstance.negative");
+ boolean negative = (negStr != null && negStr.equalsIgnoreCase("true"));
+
+ if (negative) {
+ log.println("Negative test: createInstance should fail");
+ }
+
+ try {
+ log.println("Creating Instance: ");
+ Object Inst = oObj.createInstance();
+ boolean bOK = Inst != null ;
+
+ if (mustSupport != null && bOK) {
+ for (int i = 0; i < mustSupport.length; i++) {
+ Object ifc = UnoRuntime.queryInterface(mustSupport[i], Inst) ;
+ if (ifc == null) {
+ log.println(" !!! Created instance doesn't support " +
+ mustSupport[i].toString()) ;
+ }
+ bOK &= ifc != null ;
+ }
+ }
+
+ tRes.tested("createInstance()",
+ (negative && Inst == null) || (!negative && bOK));
+ } catch (com.sun.star.uno.Exception ex) {
+ log.println("Exception occurred during createInstance()");
+ if (negative) {
+ ex.printStackTrace(log);
+ }
+ tRes.tested("createInstance()", negative);
+ }
+ }
+
+ /**
+ * Calls the method and checks the value returned. If relation
+ * with method argument doesn't exist new zero length array
+ * is created. <p>
+ * Has <b>OK</b> status if non null value is returned.
+ * If the relation exists which specifies required interfaces
+ * supported by created instance then status is <b>OK</b>
+ * if all these interfaces are supported.
+ */
+ public void _createInstanceWithArguments() {
+ Object[] arg = (Object[])tEnv.getObjRelation(
+ "XSingleServiceFactory.arguments");
+
+ if (arg == null) {
+ arg = new Object[0];
+ }
+
+ try {
+ boolean bOK = true ;
+ log.println("Creating Instance with Argument");
+ Object Inst = oObj.createInstanceWithArguments(arg);
+ bOK &= Inst != null ;
+
+ if (mustSupport != null) {
+ for (int i = 0; i < mustSupport.length; i++) {
+ Object ifc = UnoRuntime.queryInterface(mustSupport[i], Inst) ;
+ if (ifc == null) {
+ log.println(" !!! Created instance doesn't support " +
+ mustSupport[i].toString()) ;
+ }
+ bOK &= ifc != null ;
+ }
+ }
+
+ tRes.tested("createInstanceWithArguments()", bOK);
+ }
+ catch (com.sun.star.uno.Exception ex) {
+ log.println("Exception occurred during createInstanceWithArguments()");
+ ex.printStackTrace(log);
+ tRes.tested("createInstanceWithArguments()",false);
+ }
+ }
+
+} // finish class _XSingleServiceFactory
+
+
diff --git a/qadevOOo/tests/java/ifc/lang/_XTypeProvider.java b/qadevOOo/tests/java/ifc/lang/_XTypeProvider.java
new file mode 100644
index 000000000..1d13d9f28
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/lang/_XTypeProvider.java
@@ -0,0 +1,82 @@
+/*
+ * 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 ifc.lang;
+
+import lib.MultiMethodTest;
+
+import com.sun.star.lang.XTypeProvider;
+import com.sun.star.uno.Type;
+
+/**
+* Testing <code>com.sun.star.lang.XTypeProvider</code>
+* interface methods :
+* <ul>
+* <li><code> getTypes()</code></li>
+* <li><code> getImplementationId()</code></li>
+* </ul> <p>
+* Test is <b> NOT </b> multithread compliant. <p>
+* @see com.sun.star.lang.XTypeProvider
+*/
+public class _XTypeProvider extends MultiMethodTest {
+
+ public static XTypeProvider oObj = null;
+ public static Type[] types = null;
+
+ /**
+ * Just calls the method.<p>
+ * Has <b>OK</b> status if no runtime exceptions occurred.
+ */
+ public void _getImplementationId() {
+ log.println("testing getImplementationId() ... ");
+
+ boolean result = oObj.getImplementationId().length > 0;
+
+ tRes.tested("getImplementationId()", result);
+
+ } // end getImplementationId()
+
+
+ /**
+ * Calls the method and checks the return value.<p>
+ * Has <b>OK</b> status if one of the return value equals to the
+ * type <code>com.sun.star.lang.XTypeProvider</code>.
+ */
+ public void _getTypes() {
+ boolean result = false;
+ log.println("getting Types...");
+ types = oObj.getTypes();
+ for (int i=0;i<types.length;i++) {
+ int k = i+1;
+ log.println(k+". Type is "+types[i].toString());
+ if (types[i].toString().equals
+ ("Type[com.sun.star.lang.XTypeProvider]")) {
+ result = true;
+ }
+ }
+ if (!result) {
+ log.println("Component must provide Type "
+ +"<com.sun.star.lang.XTypeProvider>");
+ }
+
+ tRes.tested("getTypes()", result);
+
+ } // end getTypes()
+
+}
+