diff options
Diffstat (limited to 'qadevOOo/tests/java/mod/_cfgmgr2')
32 files changed, 3764 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/AdministrationProvider.java b/qadevOOo/tests/java/mod/_cfgmgr2/AdministrationProvider.java new file mode 100644 index 000000000000..1cb89f66ae78 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/AdministrationProvider.java @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AdministrationProvider.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package mod._cfgmgr2; + +import java.io.PrintWriter; +import java.util.Vector; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; + + +public class AdministrationProvider extends TestCase { + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. + * + * For this an instance of com.sun.star.comp.configuration.AdministrationProvider + * is created at the MultiServiceFactory of the Office + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.AdministrationProvider"); + } catch (com.sun.star.uno.Exception e) { + } + + util.dbg.printInterfaces(oObj); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Setup"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + Vector args = new Vector(); + + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("XMSF.Args", + args.toArray(new Object[args.size()][])); + tEnv.addObjRelation("needArgs", "AdministrationProvider"); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/BootstrapContext.java b/qadevOOo/tests/java/mod/_cfgmgr2/BootstrapContext.java new file mode 100644 index 000000000000..d3feca56f374 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/BootstrapContext.java @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: BootstrapContext.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; + +public class BootstrapContext extends TestCase { + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. Subclasses should implement this + * method to provide the implementation and related objects. The method is + * called from <code>getTestEnvironment()</code>. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.bootstrap.BootstrapContext"); + } catch (com.sun.star.uno.Exception e) { + } + + System.out.println("Implementation name: "+ util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + return tEnv; + + } + +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/ConfigurationProvider.java b/qadevOOo/tests/java/mod/_cfgmgr2/ConfigurationProvider.java new file mode 100644 index 000000000000..2a099ae7b9bb --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/ConfigurationProvider.java @@ -0,0 +1,99 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ConfigurationProvider.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package mod._cfgmgr2; + +import java.io.PrintWriter; +import java.util.Vector; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; + + +public class ConfigurationProvider extends TestCase { + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. + * + * For this an instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + } catch (com.sun.star.uno.Exception e) { + } + + util.dbg.printInterfaces(oObj); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Setup"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + Vector args = new Vector(); + + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("XMSF.Args", + args.toArray(new Object[args.size()][])); + tEnv.addObjRelation("needArgs", "ConfigurationProvider"); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/ConfigurationProviderWrapper.java b/qadevOOo/tests/java/mod/_cfgmgr2/ConfigurationProviderWrapper.java new file mode 100644 index 000000000000..088c4873b208 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/ConfigurationProviderWrapper.java @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ConfigurationProviderWrapper.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package mod._cfgmgr2; + +import java.io.PrintWriter; +import java.util.Vector; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; + +public class ConfigurationProviderWrapper extends TestCase { + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. Subclasses should implement this + * method to provide the implementation and related objects. The method is + * called from <code>getTestEnvironment()</code>. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + + try { + PropertyValue[] cArgs = new PropertyValue[2]; + cArgs[0] = new PropertyValue(); + cArgs[0].Name = "Locale"; + cArgs[0].Value = "DE"; + cArgs[1] = new PropertyValue(); + cArgs[1].Name = "EnableAsync"; + cArgs[1].Value = new Boolean(true); + + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstanceWithArguments("com.sun.star.comp.configuration.ConfigurationProvider",cArgs); + } catch (com.sun.star.uno.Exception e) { + } + + log.println("Implementation name: "+ util.utils.getImplName(oObj)); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Setup"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + Vector args = new Vector(); + + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + args.add(0, nodeArgs); + + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("XMSF.Args", + args.toArray(new Object[args.size()][])); + tEnv.addObjRelation("needArgs", "ConfigurationProvider"); + + return tEnv; + + } + +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/CopyImporter.java b/qadevOOo/tests/java/mod/_cfgmgr2/CopyImporter.java new file mode 100644 index 000000000000..d9dd0ccac426 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/CopyImporter.java @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: CopyImporter.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; + +public class CopyImporter extends TestCase { + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. Subclasses should implement this + * method to provide the implementation and related objects. The method is + * called from <code>getTestEnvironment()</code>. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.backend.CopyImporter"); + } catch (com.sun.star.uno.Exception e) { + } + + log.println("Implementation name: "+ util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + return tEnv; + + } + +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/LayerParser.java b/qadevOOo/tests/java/mod/_cfgmgr2/LayerParser.java new file mode 100644 index 000000000000..048825cc6c1a --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/LayerParser.java @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: LayerParser.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package mod._cfgmgr2; + +import com.sun.star.io.XActiveDataSink; +import com.sun.star.io.XInputStream; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.ucb.XSimpleFileAccess; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import java.io.PrintWriter; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +/** + * + * @author sw93809 + */ +public class LayerParser extends TestCase { + + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. Subclasses should implement this + * method to provide the implementation and related objects. The method is + * called from <code>getTestEnvironment()</code>. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + XInterface oObj = null; + Object Pipe = null; + XSimpleFileAccess simpleAccess = null; + XInputStream xStream = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.backend.xml.LayerParser"); + Object fileacc = ((XMultiServiceFactory)tParam.getMSF()).createInstance("com.sun.star.comp.ucb.SimpleFileAccess"); + simpleAccess = (XSimpleFileAccess) + UnoRuntime.queryInterface(XSimpleFileAccess.class,fileacc); + String filename = util.utils.getOfficeURL((XMultiServiceFactory)tParam.getMSF())+"/../share/registry/data/org/openoffice/Setup.xcu"; + log.println("Going to parse: "+filename); + xStream = simpleAccess.openFileRead(filename); + } catch (com.sun.star.uno.Exception e) { + } + + log.println("Implementation name: "+ util.utils.getImplName(oObj)); + + XActiveDataSink xSink = (XActiveDataSink) UnoRuntime.queryInterface(XActiveDataSink.class, oObj); + xSink.setInputStream(xStream); + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("InputStream", xStream); + + return tEnv; + } + +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/LayerUpdateMerger.java b/qadevOOo/tests/java/mod/_cfgmgr2/LayerUpdateMerger.java new file mode 100644 index 000000000000..be75685026ba --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/LayerUpdateMerger.java @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: LayerUpdateMerger.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import com.sun.star.configuration.backend.XLayer; +import com.sun.star.configuration.backend.XLayerHandler; +import com.sun.star.lang.XInitialization; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import java.io.PrintWriter; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.XLayerHandlerImpl; +import util.XLayerImpl; + +public class LayerUpdateMerger extends TestCase { + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. Subclasses should implement this + * method to provide the implementation and related objects. The method is + * called from <code>getTestEnvironment()</code>. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + XLayerHandler xLayerHandler = null; + XLayer xLayer = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory) tParam.getMSF()).createInstance( + "com.sun.star.comp.configuration.backend.LayerUpdateMerger"); + + XInitialization xInit = (XInitialization) UnoRuntime.queryInterface( + XInitialization.class, oObj); + xLayerHandler = new XLayerHandlerImpl(); + xLayer = new XLayerImpl(); + + xInit.initialize(new Object[] { xLayerHandler,xLayer }); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("Implementation name: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("LayerHandler", xLayerHandler); + tEnv.addObjRelation("Layer", xLayer); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/LayerWriter.java b/qadevOOo/tests/java/mod/_cfgmgr2/LayerWriter.java new file mode 100644 index 000000000000..aedaa8625640 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/LayerWriter.java @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: LayerWriter.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import com.sun.star.io.XActiveDataSource; +import com.sun.star.io.XOutputStream; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.ucb.XSimpleFileAccess; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + + +public class LayerWriter extends TestCase { + public XOutputStream xStream = null; + + /** + * Just clears flag which indicates that port is free now. + */ + public synchronized void disposeTestEnvironment(TestEnvironment tEnv, + TestParameters tParam) { + + + try { + xStream.closeOutput(); + } catch (com.sun.star.io.NotConnectedException e) { + } catch (com.sun.star.io.BufferSizeExceededException e) { + } catch (com.sun.star.io.IOException e) { + } + } + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. Subclasses should implement this + * method to provide the implementation and related objects. The method is + * called from <code>getTestEnvironment()</code>. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + XSimpleFileAccess simpleAccess = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory) tParam.getMSF()).createInstance( + "com.sun.star.comp.configuration.backend.xml.LayerWriter"); + + Object fileacc = ((XMultiServiceFactory) tParam.getMSF()).createInstance( + "com.sun.star.comp.ucb.SimpleFileAccess"); + simpleAccess = (XSimpleFileAccess) UnoRuntime.queryInterface( + XSimpleFileAccess.class, fileacc); + + String filename = util.utils.getOfficeTemp( + (XMultiServiceFactory) tParam.getMSF()) + + "LayerWriter.xcu"; + log.println("Going to parse: " + filename); + + xStream = simpleAccess.openFileWrite(filename); + } catch (com.sun.star.uno.Exception e) { + } + + log.println("Implementation name: " + util.utils.getImplName(oObj)); + + XActiveDataSource xSource = (XActiveDataSource) UnoRuntime.queryInterface( + XActiveDataSource.class, oObj); + xSource.setOutputStream(xStream); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("OutputStream", xStream); + + return tEnv; + } +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/LocalDataImporter.java b/qadevOOo/tests/java/mod/_cfgmgr2/LocalDataImporter.java new file mode 100644 index 000000000000..8a1cc43b669b --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/LocalDataImporter.java @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: LocalDataImporter.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import com.sun.star.beans.NamedValue; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + + +public class LocalDataImporter extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. Subclasses should implement this + * method to provide the implementation and related objects. The method is + * called from <code>getTestEnvironment()</code>. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory) tParam.getMSF()).createInstance( + "com.sun.star.comp.configuration.backend.LocalDataImporter"); + } catch (com.sun.star.uno.Exception e) { + } + + String filename = util.utils.getOfficeURL( + (XMultiServiceFactory) tParam.getMSF()) + + "/../share/registry/data/org/openoffice/Setup.xcs"; + + Object[] vXJobArgs = new Object[1]; + NamedValue[] vXJobArg0 = new NamedValue[1]; + vXJobArg0[0] = new NamedValue("LayerDataUrl", filename); + vXJobArgs[0] = vXJobArg0; + + log.println("Implementation name: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + tEnv.addObjRelation("XJobArgs", vXJobArgs); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/LocalHierarchyBrowser.java b/qadevOOo/tests/java/mod/_cfgmgr2/LocalHierarchyBrowser.java new file mode 100644 index 000000000000..26506466c114 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/LocalHierarchyBrowser.java @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: LocalHierarchyBrowser.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package mod._cfgmgr2; + +import com.sun.star.beans.NamedValue; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; +import java.io.PrintWriter; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +public class LocalHierarchyBrowser extends TestCase { + + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. Subclasses should implement this + * method to provide the implementation and related objects. The method is + * called from <code>getTestEnvironment()</code>. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory) tParam.getMSF()).createInstance( + "com.sun.star.comp.configuration.backend.LocalHierarchyBrowser"); + } catch (com.sun.star.uno.Exception e) { + } + + String filename = util.utils.getOfficeURL( + (XMultiServiceFactory) tParam.getMSF()) + + "/../share/registry/data/org/openoffice"; + + String filename2 = util.utils.getOfficeURL( + (XMultiServiceFactory) tParam.getMSF()) + + "/../share/registry/schema/org/openoffice/"; + + Object[] vXJobArgs = new Object[2]; + NamedValue[] vXJobArg0 = new NamedValue[1]; + vXJobArg0[0] = new NamedValue("LayerDataUrl", filename); + NamedValue[] vXJobArg1 = new NamedValue[1]; + vXJobArg1[0] = new NamedValue("SchemaDataUrl", filename2); + vXJobArgs[0] = vXJobArg0; + vXJobArgs[1] = vXJobArg1; + + + log.println("Implementation name: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + tEnv.addObjRelation("XJobArgs", vXJobArgs); + + return tEnv; + } + +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/LocalSchemaSupplier.java b/qadevOOo/tests/java/mod/_cfgmgr2/LocalSchemaSupplier.java new file mode 100644 index 000000000000..228f43f0f1fd --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/LocalSchemaSupplier.java @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: LocalSchemaSupplier.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package mod._cfgmgr2; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; +import java.io.PrintWriter; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +public class LocalSchemaSupplier extends TestCase { + + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + XInterface oObj = null; + + try { + Object[] args = new Object[1]; + args[0] = ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.configuration.bootstrap.BootstrapContext"); + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstanceWithArguments("com.sun.star.comp.configuration.backend.LocalSchemaSupplier",args); + + } catch (com.sun.star.uno.Exception e) { + } + + log.println("Implementation name: "+ util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + return tEnv; + } + +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/LocalSingleBackend.java b/qadevOOo/tests/java/mod/_cfgmgr2/LocalSingleBackend.java new file mode 100644 index 000000000000..df557862ac53 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/LocalSingleBackend.java @@ -0,0 +1,64 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: LocalSingleBackend.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package mod._cfgmgr2; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; +import java.io.PrintWriter; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +public class LocalSingleBackend extends TestCase { + + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + XInterface oObj = null; + + try { + Object[] args = new Object[1]; + args[0] = ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.configuration.bootstrap.BootstrapContext"); + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstanceWithArguments("com.sun.star.comp.configuration.backend.LocalSingleBackend",args); + + } catch (com.sun.star.uno.Exception e) { + } + + log.println("Implementation name: "+ util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + return tEnv; + } + + +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/LocalSingleStratum.java b/qadevOOo/tests/java/mod/_cfgmgr2/LocalSingleStratum.java new file mode 100644 index 000000000000..2bed499ae584 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/LocalSingleStratum.java @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: LocalSingleStratum.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XStringSubstitution; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + + +public class LocalSingleStratum extends TestCase { + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + String AdminURL = ""; + + try { + Object[] args = new Object[1]; + XStringSubstitution sts = createStringSubstitution( + (XMultiServiceFactory) tParam.getMSF()); + String userURL = sts.getSubstituteVariableValue("$(user)"); + args[0] = userURL + "/registry"; + AdminURL = sts.getSubstituteVariableValue("$(inst)") + + "/share/registry"; + log.println("Using: " + args[0]); + oObj = (XInterface) ((XMultiServiceFactory) tParam.getMSF()).createInstanceWithArguments( + "com.sun.star.comp.configuration.backend.LocalSingleStratum", + args); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("Implementation name: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("NoAdmin", AdminURL); + + return tEnv; + } + + public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF) { + Object xPathSubst = null; + + try { + xPathSubst = xMSF.createInstance( + "com.sun.star.util.PathSubstitution"); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + if (xPathSubst != null) { + return (XStringSubstitution) UnoRuntime.queryInterface( + XStringSubstitution.class, xPathSubst); + } else { + return null; + } + } +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/MergeImporter.java b/qadevOOo/tests/java/mod/_cfgmgr2/MergeImporter.java new file mode 100644 index 000000000000..0619376c9b56 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/MergeImporter.java @@ -0,0 +1,72 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: MergeImporter.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package mod._cfgmgr2; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; +import java.io.PrintWriter; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +public class MergeImporter extends TestCase { + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. Subclasses should implement this + * method to provide the implementation and related objects. The method is + * called from <code>getTestEnvironment()</code>. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory) tParam.getMSF()).createInstance( + "com.sun.star.comp.configuration.backend.MergeImporter"); + + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("Implementation name: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + return tEnv; + } + +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/MultiStratumBackend.java b/qadevOOo/tests/java/mod/_cfgmgr2/MultiStratumBackend.java new file mode 100644 index 000000000000..737a08145974 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/MultiStratumBackend.java @@ -0,0 +1,70 @@ +/* + * MultiStratumBackend.java + * + * Created on 24. March 2004, 13:48 + */ + +package mod._cfgmgr2; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XStringSubstitution; +import java.io.PrintWriter; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +public class MultiStratumBackend extends TestCase { + + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + XInterface oObj = null; + + Object[] args = new Object[1]; + String AdminURL = ""; + + try { + XStringSubstitution sts = createStringSubstitution( + (XMultiServiceFactory) tParam.getMSF()); + AdminURL = sts.getSubstituteVariableValue("$(inst)") + + "/share/registry"; + args[0] = ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.configuration.bootstrap.BootstrapContext"); + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstanceWithArguments("com.sun.star.comp.configuration.backend.MultiStratumBackend",args); + + } catch (com.sun.star.uno.Exception e) { + } + + log.println("Implementation name: "+ util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + //objRelation for XInitialization + tEnv.addObjRelation("XInitialization.args", args); + + //objRelation for XBackendEntities + tEnv.addObjRelation("NoAdmin", AdminURL); + tEnv.addObjRelation("MSB", Boolean.TRUE); + + return tEnv; + } + + public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF) { + Object xPathSubst = null; + + try { + xPathSubst = xMSF.createInstance( + "com.sun.star.util.PathSubstitution"); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + if (xPathSubst != null) { + return (XStringSubstitution) UnoRuntime.queryInterface( + XStringSubstitution.class, xPathSubst); + } else { + return null; + } + } +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/OConfigurationRegistry.java b/qadevOOo/tests/java/mod/_cfgmgr2/OConfigurationRegistry.java new file mode 100644 index 000000000000..83e8444212bb --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/OConfigurationRegistry.java @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OConfigurationRegistry.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.XInterface; + + +public class OConfigurationRegistry extends TestCase { + protected static int uniq = 0; + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. + * + * For this an instance of com.sun.star.configuration.ConfigurationRegistry + * is created at the MultiServiceFactory of the Office + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.configuration.ConfigurationRegistry"); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + System.out.println("IName: " + util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("XSimpleRegistry.open", "org.openoffice.Setup") ; + tEnv.addObjRelation("XSimpleRegistry.merge", "org.openoffice.Inet") ; + tEnv.addObjRelation("XSimpleRegistry.destroy", "org.openoffice.Setup") ; + + tEnv.addObjRelation("configuration", new Boolean(true)); + + return tEnv; + } + +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/OInnerGroupInfoAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/OInnerGroupInfoAccess.java new file mode 100644 index 000000000000..0fe0f56643c7 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/OInnerGroupInfoAccess.java @@ -0,0 +1,145 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OInnerGroupInfoAccess.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameReplace; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + + +public class OInnerGroupInfoAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Common"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + XNameReplace updateAccess = null; + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + XNameAccess names = (XNameAccess) UnoRuntime.queryInterface( + XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", + nodeArgs)); + oObj = (XInterface) names.getByName(names.getElementNames()[0]); + + names = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + oObj); + + String[] theNames = names.getElementNames(); + + log.println("Contains " + theNames.length + " elements"); + + // create a changeable view on the element for XContainer interface + names = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", nodeArgs)); + updateAccess = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, + names.getByName(names.getElementNames()[0])); + + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + String[] pNames = new String[] { + "AutoDetectSystemHC", "HelpTipSeconds", "IsAllowAnimatedGraphics", + "IsAllowAnimatedText", "IsAutomaticFontColor", "IsForPagePreviews", + "IsHelpTipsDisappear", "IsSelectionInReadonly", "IsSystemFont" + }; + + String[] pTypes = new String[] { + "Boolean", "Short", "Boolean", "Boolean", "Boolean", "Boolean", + "Boolean", "Boolean", "Boolean" + }; + + tEnv.addObjRelation("PropertyNames", pNames); + tEnv.addObjRelation("PropertyTypes", pTypes); + + tEnv.addObjRelation("XContainer.Container", updateAccess); + // create an unlikely value for "HelpTipSeconds" + tEnv.addObjRelation("XContainer.NewValue", new Short((short)300000)); + tEnv.addObjRelation("XContainer.ElementName", pNames[1]); + + tEnv.addObjRelation("ElementName", "AutoDetectSystemHC"); + + tEnv.addObjRelation("cannotSwitchParent", + "configmgr: BasicElement::setParent: cannot move Entry"); + + tEnv.addObjRelation("allReadOnly", + "all Properties of OInnerGroupInfoAccess are read Only"); + + tEnv.addObjRelation("expectedName", "IsSelectionInReadonly"); + tEnv.addObjRelation("HierachicalName", "/org.openoffice.Office"); + tEnv.addObjRelation("NoSetName", "OInnerGroupInfoAccess"); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/OInnerGroupUpdateAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/OInnerGroupUpdateAccess.java new file mode 100644 index 000000000000..a518104079aa --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/OInnerGroupUpdateAccess.java @@ -0,0 +1,137 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OInnerGroupUpdateAccess.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameReplace; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + + +public class OInnerGroupUpdateAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Common"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + XNameAccess names = (XNameAccess) UnoRuntime.queryInterface( + XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + oObj = (XInterface) names.getByName(names.getElementNames()[0]); + + names = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + oObj); + + String[] theNames = names.getElementNames(); + + log.println("Contains " + theNames.length + " elements"); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + String[] pNames = new String[] { + "AutoDetectSystemHC", "HelpTipSeconds", "IsAllowAnimatedGraphics", + "IsAllowAnimatedText", "IsAutomaticFontColor", "IsForPagePreviews", + "IsHelpTipsDisappear", "IsSelectionInReadonly", "IsSystemFont" + }; + + String[] pTypes = new String[] { + "Boolean", "Short", "Boolean", "Boolean", "Boolean", "Boolean", + "Boolean", "Boolean", "Boolean" + }; + + tEnv.addObjRelation("PropertyNames", pNames); + tEnv.addObjRelation("PropertyTypes", pTypes); + + tEnv.addObjRelation("ElementName", "AutoDetectSystemHC"); + + tEnv.addObjRelation("cannotSwitchParent", + "configmgr: BasicElement::setParent: cannot move Entry"); + + tEnv.addObjRelation("expectedName", "IsSelectionInReadonly"); + tEnv.addObjRelation("HierachicalName", "/org.openoffice.Office"); + + Short val = new Short((short)3); + tEnv.addObjRelation("INSTANCE1", val); + tEnv.addObjRelation("NAMEREPLACE", pNames[1]); + tEnv.addObjRelation("XContainer.NewValue", val); + tEnv.addObjRelation("XContainer.ElementName", pNames[1]); + tEnv.addObjRelation("XContainer.Container", (XNameReplace) + UnoRuntime.queryInterface(XNameReplace.class, oObj)); + tEnv.addObjRelation("NoSetName", "OInnerGroupInfoAccess"); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/OInnerSetInfoAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/OInnerSetInfoAccess.java new file mode 100644 index 000000000000..923bda9f4185 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/OInnerSetInfoAccess.java @@ -0,0 +1,133 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OInnerSetInfoAccess.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XHierarchicalNameAccess; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameReplace; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + + +public class OInnerSetInfoAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + Object instance = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Jobs"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + XNameReplace updateAccess = null; + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + XHierarchicalNameAccess names = (XHierarchicalNameAccess) UnoRuntime.queryInterface( + XHierarchicalNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", + nodeArgs)); + oObj = (XInterface) names.getByHierarchicalName("Jobs"); + + // create a changeable view on the element for XContainer interface + XNameAccess access = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", nodeArgs)); + updateAccess = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, access.getByName("Jobs")); + + XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface( + XSingleServiceFactory.class, + updateAccess); + instance = jobsFac.createInstance(); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + XNameAccess names = (XNameAccess) UnoRuntime.queryInterface( + XNameAccess.class, oObj); + + String[] pNames = names.getElementNames(); + + tEnv.addObjRelation("ElementName", pNames[0]); + + tEnv.addObjRelation("cannotSwitchParent", + "configmgr: BasicElement::setParent: cannot move Entry"); + + tEnv.addObjRelation("XContainer.Container", updateAccess) ; + tEnv.addObjRelation("XContainer.NewValue", instance); + tEnv.addObjRelation("XContainer.ElementName", pNames[0]); + + tEnv.addObjRelation("expectedName", pNames[0]); + tEnv.addObjRelation("HierachicalName", "/org.openoffice.Office"); + tEnv.addObjRelation("NoSetName", "OInnerTreeSetInfoAccess"); + tEnv.addObjRelation("TemplateName", "org.openoffice.Office.Jobs/Job"); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/OInnerTreeSetUpdateAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/OInnerTreeSetUpdateAccess.java new file mode 100644 index 000000000000..d20ad7fe9b40 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/OInnerTreeSetUpdateAccess.java @@ -0,0 +1,129 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OInnerTreeSetUpdateAccess.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XHierarchicalNameAccess; +import com.sun.star.container.XNameAccess; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + + +public class OInnerTreeSetUpdateAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + Object instance = null; + Object instance1 = null; + Object instance2 = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Jobs"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + XHierarchicalNameAccess names = (XHierarchicalNameAccess) UnoRuntime.queryInterface( + XHierarchicalNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + oObj = (XInterface) names.getByHierarchicalName("Jobs"); + + XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface( + XSingleServiceFactory.class, + oObj); + instance = jobsFac.createInstance(); + instance1 = jobsFac.createInstance(); + instance2 = jobsFac.createInstance(); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + XNameAccess names = (XNameAccess) UnoRuntime.queryInterface( + XNameAccess.class, oObj); + + String[] pNames = names.getElementNames(); + + tEnv.addObjRelation("ElementName", pNames[0]); + + tEnv.addObjRelation("cannotSwitchParent", + "configmgr: BasicElement::setParent: cannot move Entry"); + + tEnv.addObjRelation("expectedName", pNames[0]); + tEnv.addObjRelation("HierachicalName", "/org.openoffice.Office"); + tEnv.addObjRelation("INSTANCE", instance); + tEnv.addObjRelation("INSTANCE1", instance1); + tEnv.addObjRelation("INSTANCE2", instance1); + tEnv.addObjRelation("NAMEREPLACE", pNames[0]); + tEnv.addObjRelation("NoSetName", "OInnerTreeSetInfoAccess"); + tEnv.addObjRelation("TemplateName", "org.openoffice.Office.Jobs/Job"); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/OInnerValueSetUpdateAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/OInnerValueSetUpdateAccess.java new file mode 100644 index 000000000000..00c17f50b08e --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/OInnerValueSetUpdateAccess.java @@ -0,0 +1,219 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OInnerValueSetUpdateAccess.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameContainer; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XChangesBatch; + + +public class OInnerValueSetUpdateAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + + log.println("creating the Environment"); + + // create some entries for testing, use the ORootElementValueSetUpdateAccess + // service for this: see cfgmgr2.ORootElementValueSetUpdateAccess + createSomeEntries((XMultiServiceFactory)tParam.getMSF()); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "/org.openoffice.Office.Common"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + XNameAccess names = (XNameAccess) UnoRuntime.queryInterface( + XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + + oObj = (XInterface) names.getByName("ExternalApps"); + + names = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + oObj); + + String[] theNames = names.getElementNames(); + + log.println("Contains " + theNames.length + " elements"); + +// for (int k = 0; k < theNames.length; k++) { +// System.out.println("child " + theNames[k]); +// } + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + String[] pNames = new String[] { + "file", "ftp", "http", "https", "mailto" + }; + + String[] pTypes = new String[] { + "String", "String", "String", "String", "String" + }; + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("cannotSwitchParent", + "configmgr: BasicElement::setParent: cannot move Entry"); + + String overwriteString = "NewOne"; + tEnv.addObjRelation("INSTANCE1", overwriteString); + tEnv.addObjRelation("NAMEREPLACE", pNames[1]); + // for XContainer + tEnv.addObjRelation("INSTANCE", overwriteString); + + tEnv.addObjRelation("HierachicalName", "/org.openoffice.Office"); + tEnv.addObjRelation("ElementName", "file"); + tEnv.addObjRelation("NoSetName", "OInnerValueSetInfoAccess"); + tEnv.addObjRelation("TemplateName", "cfg:value/cfg:any"); + tEnv.addObjRelation("expectedName", "file"); + + return tEnv; + } + + /** + * Create entries in the ExternalApps layer, so there is something to test + * @param oObj The test object: used to create some entries. + */ + private void createSomeEntries(XMultiServiceFactory xMSF) { + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Common/ExternalApps"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + Object oObj = null; + try { + XInterface Provider = (XInterface) xMSF.createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + oObj = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + XNameContainer xCont = (XNameContainer)UnoRuntime.queryInterface(XNameContainer.class, oObj); + insertOrUpdate(xCont, "file", "just"); + insertOrUpdate(xCont, "ftp", "some"); + insertOrUpdate(xCont, "dummy", "arbitrary"); + insertOrUpdate(xCont, "http", "value"); + // write the changes into the user layer. + XChangesBatch xBatch = (XChangesBatch)UnoRuntime.queryInterface(XChangesBatch.class, oObj); + try { + xBatch.commitChanges(); + } + catch(com.sun.star.lang.WrappedTargetException e) { + // ignore: bug will be found with the interface test + } + } + + /** + * Insert a value in a name container or else update it + * @param xCont The name conationer to insert or update. + * @param name The name of the value. + * @param value The value itself. + */ + private void insertOrUpdate(XNameContainer xCont, String name, String value) { + boolean update = false; + try { + xCont.insertByName(name, value); + System.out.println("##### No Exception!"); + } + catch(com.sun.star.lang.IllegalArgumentException e) { + // ignore: bug will be found with the interface test + } + catch(com.sun.star.lang.WrappedTargetException e) { + // ignore: bug will be found with the interface test + } + catch(com.sun.star.container.ElementExistException e) { + update = true; + } + try { + if (update) + xCont.replaceByName(name, value); + } + catch(com.sun.star.lang.IllegalArgumentException e) { + // ignore: bug will be found with the interface test + } + catch(com.sun.star.container.NoSuchElementException e) { + // ignore: bug will be found with the interface test + } + catch(com.sun.star.lang.WrappedTargetException e) { + // ignore: bug will be found with the interface test + } + } + +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementGroupInfoAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementGroupInfoAccess.java new file mode 100644 index 000000000000..30760e62613b --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementGroupInfoAccess.java @@ -0,0 +1,179 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ORootElementGroupInfoAccess.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.XPropertySet; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameReplace; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XChangesBatch; + + +public class ORootElementGroupInfoAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Common"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + XInterface changeView = null; + XInterface alternateObject = null; + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + oObj = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", + nodeArgs)); + // create a view on a different object that can change something, so listeners can be triggered. + // this is done for XContainer test + nodepath.Value = "org.openoffice.Office.Common/Internal"; + changeView = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + alternateObject = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", + nodeArgs)); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet.class, oObj); + util.dbg.printPropertiesNames(prop); + + String[] pNames = new String[] { + "Accessibility", "AddXMLToStorage", "AsianLayout", "AutoCorrect", + "Cache", "DateFormat", "ExternalApps", "ExternalMailer", "Filter", + "Font", "Gallery", "Help", "History", "I18N", "Image", "Internal", + "InternalMSExport", "Java", "Load", "Menus", "Misc", + "OfficeObjects", "Passwords", "Path", "Print", "Save", + "SearchOptions", "Security", "Setup", "Startup", "Undo", + "Vectorize", "View", "WorkingSet", "_3D_Engine" + }; + + String[] pTypes = new String[36]; + + for (int k = 0; k < pTypes.length; k++) { + pTypes[k] = "XInterface"; + } + + tEnv.addObjRelation("PropertyNames", pNames); + tEnv.addObjRelation("PropertyTypes", pTypes); + + tEnv.addObjRelation("ElementName", "Accessibility"); + + tEnv.addObjRelation("XLocalizable.ReadOnly", "Locale of ORootElementGroupInfoAccess is read Only"); + tEnv.addObjRelation("allReadOnly", + "all Properties of ORootElementGroupInfoAccess are read Only"); + + tEnv.addObjRelation("XContainer.NewValue", "SenselessString"); + tEnv.addObjRelation("XContainer.ElementName", "CurrentTempURL"); + tEnv.addObjRelation("XContainer.Container", changeView); + tEnv.addObjRelation("XContainer.AlternateObject", alternateObject); + + tEnv.addObjRelation("XChangesNotifier.ChangesBatch", (XChangesBatch)UnoRuntime.queryInterface( + XChangesBatch.class, changeView)); + + // set a new temp directory: use java.io.tmpdir as substitute, for XChangesNotifier test + // get a XPropertySet from the sub element + XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, changeView); + String newTempURL = util.utils.getFullURL(util.utils.getUsersTempDir()); + String curTempURL = ""; + try { + curTempURL = (String)xProp.getPropertyValue("CurrentTempURL"); + } + catch(Exception e) { + log.println("Cannot get property for XChangesNotifier test: this test is bound to fail."); + e.printStackTrace((PrintWriter)log); + } + // fallback 1: get user home + if (newTempURL.equalsIgnoreCase(curTempURL)) { + newTempURL = util.utils.getFullURL(System.getProperty("user.home")); + // fallback 2: get user dir + if (newTempURL.equalsIgnoreCase(curTempURL)) { + newTempURL = util.utils.getFullURL(System.getProperty("user.dir")); + } + } + tEnv.addObjRelation("XChangesNotifier.ChangeElement", newTempURL); + tEnv.addObjRelation("XChangesNotifier.OriginalElement", curTempURL); + tEnv.addObjRelation("XChangesNotifier.PropertyName", "CurrentTempURL"); + tEnv.addObjRelation("XChangesNotifier.PropertySet", xProp); + + tEnv.addObjRelation("expectedName", "OfficeObjects"); + tEnv.addObjRelation("HierachicalName", "/org.openoffice"); + + tEnv.addObjRelation("NoSetName", "ORootElementGroupInfoAccess"); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementGroupUpdateAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementGroupUpdateAccess.java new file mode 100644 index 000000000000..699996b4d917 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementGroupUpdateAccess.java @@ -0,0 +1,183 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ORootElementGroupUpdateAccess.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.beans.XPropertySet; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameReplace; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XChangesBatch; + + +public class ORootElementGroupUpdateAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Common/Internal"; + + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + oObj = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + +/* helper.ConfigurationRead read = new helper.ConfigurationRead(pMSF, "org.openoffice.Office.Common"); + String[] subs = read.getRootNodeNames(); + for (int i=0; i<subs.length; i++) + System.out.println("Rootnodes " + subs[i]); + subs = read.getSubNodeNames("Internal"); + for (int i=0; i<subs.length; i++) + System.out.println("Rootnodes " + subs[i]); + Object subNode = read.getByHierarchicalName("Internal/RecoveryList"); + util.dbg.getSuppServices(subNode); */ + + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + XPropertySet prop = (XPropertySet) UnoRuntime.queryInterface( + XPropertySet.class, oObj); + + Object instance = null; + + String[] pNames = new String[] { + "CurrentTempURL", + "DevelopmentChart", + "SendCrashMail", + "Slot", + "UseMailUI"//, "RecoveryList" + }; + + String[] pTypes = new String[]{ + "String", + "Boolean", + "Boolean", + "Boolean", + "Boolean" + }; + + tEnv.addObjRelation("PropertyNames", pNames); + tEnv.addObjRelation("PropertyTypes", pTypes); + + // for XHierarchicalNameAccess + tEnv.addObjRelation("ElementName", "Slot"); + + tEnv.addObjRelation("XLocalizable.ReadOnly", "Localization is final and can't be changed"); + + tEnv.addObjRelation("XChangesNotifier.ChangesBatch", (XChangesBatch)UnoRuntime.queryInterface(XChangesBatch.class, oObj)); + + // set a new temp directory: use java.io.tmpdir as substitute + String newTempURL = util.utils.getFullURL(util.utils.getUsersTempDir()); + String curTempURL = ""; + try { + curTempURL = (String)prop.getPropertyValue("CurrentTempURL"); + } + catch(Exception e) { + log.println("Cannot get property for XChangesBatch test: this test is bound to fail."); + e.printStackTrace((PrintWriter)log); + } + // fallback 1: get user home + if (newTempURL.equalsIgnoreCase(curTempURL)) { + newTempURL = util.utils.getFullURL(System.getProperty("user.home")); + // fallback 2: get user dir + if (newTempURL.equalsIgnoreCase(curTempURL)) { + newTempURL = util.utils.getFullURL(System.getProperty("user.dir")); + } + } + + tEnv.addObjRelation("XChangesBatch.ChangeElement", newTempURL); + tEnv.addObjRelation("XChangesBatch.OriginalElement", curTempURL); + tEnv.addObjRelation("XChangesBatch.PropertyName", "CurrentTempURL"); + tEnv.addObjRelation("XChangesBatch.PropertySet", prop); + tEnv.addObjRelation("XChangesNotifier.ChangeElement", newTempURL); + tEnv.addObjRelation("XChangesNotifier.OriginalElement", curTempURL); + tEnv.addObjRelation("XChangesNotifier.PropertyName", "CurrentTempURL"); + tEnv.addObjRelation("XChangesNotifier.PropertySet", prop); + + tEnv.addObjRelation("expectedName", "RecoveryList"); + tEnv.addObjRelation("HierachicalName", "/org.openoffice"); + + String overwriteString = new String("ThisIsSenselessForSure"); + tEnv.addObjRelation("INSTANCE1", overwriteString); + tEnv.addObjRelation("NAMEREPLACE", pNames[0]); + + tEnv.addObjRelation("XContainer.NewValue", overwriteString); + tEnv.addObjRelation("XContainer.ElementName", pNames[0]); + tEnv.addObjRelation("XContainer.Container", (XNameReplace)UnoRuntime.queryInterface(XNameReplace.class, oObj)); + + tEnv.addObjRelation("NoSetName", "ORootElementGroupInfoAccess"); + + return tEnv; + } +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementSetInfoAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementSetInfoAccess.java new file mode 100644 index 000000000000..814d688fc84f --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementSetInfoAccess.java @@ -0,0 +1,130 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ORootElementSetInfoAccess.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameReplace; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XChangesBatch; + + +public class ORootElementSetInfoAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Jobs/Jobs"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + XInterface changeView = null; + Object instance = null; + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + oObj = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", + nodeArgs)); + changeView = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface( + XSingleServiceFactory.class, + changeView); + instance = jobsFac.createInstance(); + + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + log.println("ChangeView: " + utils.getImplName(changeView)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + XNameReplace container = (XNameReplace)UnoRuntime.queryInterface(XNameReplace.class, changeView); + tEnv.addObjRelation("XContainer.NewValue", instance); + tEnv.addObjRelation("XContainer.ElementName", "RegistrationRequest"); + tEnv.addObjRelation("XContainer.Container", container); + + tEnv.addObjRelation("XChangesNotifier.ChangesBatch", (XChangesBatch)UnoRuntime.queryInterface(XChangesBatch.class, changeView)); + tEnv.addObjRelation("XChangesNotifier.ChangeElement", instance); + tEnv.addObjRelation("XChangesNotifier.PropertyName", "RegistrationRequest"); + tEnv.addObjRelation("XChangesNotifier.NameReplace", container); + + tEnv.addObjRelation("XLocalizable.ReadOnly", "Locale of ORootElementSetInfoAccess is read Only"); + tEnv.addObjRelation("allReadOnly", + "all Properties of ORootElementSetInfoAccess are read Only"); + tEnv.addObjRelation("NoSetName", "ORootElementSetInfoAccess"); + tEnv.addObjRelation("TemplateName", "org.openoffice.Office.Jobs/Job"); + tEnv.addObjRelation("HierachicalName", "/org.openoffice"); + tEnv.addObjRelation("ElementName", "RegistrationRequest"); + tEnv.addObjRelation("expectedName", "RegistrationRequest"); + + return tEnv; + } +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementTreeSetUpdateAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementTreeSetUpdateAccess.java new file mode 100644 index 000000000000..da804a5993ab --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementTreeSetUpdateAccess.java @@ -0,0 +1,131 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ORootElementTreeSetUpdateAccess.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameReplace; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XChangesBatch; + + +public class ORootElementTreeSetUpdateAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + Object instance = null; + Object instance1 = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Jobs/Jobs"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + oObj = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + + XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface( + XSingleServiceFactory.class, + oObj); + instance = jobsFac.createInstance(); + instance1 = jobsFac.createInstance(); + + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("NAMEREPLACE","RegistrationRequest"); + tEnv.addObjRelation("INSTANCE", instance); + tEnv.addObjRelation("INSTANCE1", instance1); + tEnv.addObjRelation("INSTANCE2", instance1); + + tEnv.addObjRelation("XChangesBatch.ChangeElement", instance); + tEnv.addObjRelation("XChangesBatch.PropertyName", "RegistrationRequest"); + tEnv.addObjRelation("XChangesBatch.NameReplace", (XNameReplace)UnoRuntime.queryInterface(XNameReplace.class, oObj)); + + tEnv.addObjRelation("XChangesNotifier.ChangeElement", instance); + tEnv.addObjRelation("XChangesNotifier.PropertyName", "RegistrationRequest"); + tEnv.addObjRelation("XChangesNotifier.NameReplace", (XNameReplace)UnoRuntime.queryInterface(XNameReplace.class, oObj)); + tEnv.addObjRelation("XChangesNotifier.ChangesBatch", (XChangesBatch)UnoRuntime.queryInterface(XChangesBatch.class, oObj)); + + tEnv.addObjRelation("XLocalizable.ReadOnly", "Locale of ORootElementTreeSetUpdateAccess is read Only"); + tEnv.addObjRelation("NoSetName", "ORootElementTreeSetUpdateAccess"); + + tEnv.addObjRelation("HierachicalName", "/org.openoffice.Office"); + tEnv.addObjRelation("ElementName","RegistrationRequest"); + tEnv.addObjRelation("TemplateName", "org.openoffice.Office.Jobs/Job"); + + tEnv.addObjRelation("expectedName","RegistrationRequest"); + return tEnv; + } + +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementValueSetUpdateAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementValueSetUpdateAccess.java new file mode 100644 index 000000000000..cc6c4710f8a8 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/ORootElementValueSetUpdateAccess.java @@ -0,0 +1,196 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: ORootElementValueSetUpdateAccess.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameContainer; +import com.sun.star.container.XNameReplace; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XChangesBatch; + +/** + * Check the ORootElementValueSetUpdateAccess service. + * For this, the ExternalApss layer is used. Since this layer is empty (since + * cws cfgapi), some own values are created and written to the current user + * layer. The tests are then executed on these values. + */ +public class ORootElementValueSetUpdateAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + Object instance = null; + Object instance1 = null; + Object instance2 = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Common/ExternalApps"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + oObj = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + String[] pNames = new String[] { + "file", "ftp", "dummy", "http" + }; + + String[] pTypes = new String[] { + "String", "String", "String", "String" + }; + + createSomeEntries(oObj); + + tEnv.addObjRelation("INSTANCE1", "NewOne1"); + tEnv.addObjRelation("NAMEREPLACE", pNames[0]); + + // for XContainer + tEnv.addObjRelation("INSTANCE", "NewOne2"); + + tEnv.addObjRelation("XChangesBatch.PropertyName", pNames[0]); + tEnv.addObjRelation("XChangesBatch.ChangeElement", "NewOne3"); + tEnv.addObjRelation("XChangesBatch.NameReplace", (XNameReplace)UnoRuntime.queryInterface(XNameReplace.class, oObj)); + + tEnv.addObjRelation("XChangesNotifier.PropertyName", pNames[0]); + tEnv.addObjRelation("XChangesNotifier.ChangeElement", "NewOne4"); + tEnv.addObjRelation("XChangesNotifier.ChangesBatch" , (XChangesBatch)UnoRuntime.queryInterface(XChangesBatch.class, oObj)); + tEnv.addObjRelation("XChangesNotifier.NameReplace", (XNameReplace)UnoRuntime.queryInterface(XNameReplace.class, oObj)); + + tEnv.addObjRelation("XLocalizable.ReadOnly", "Locale of ORootElementValueSetUpdateAccess is read Only"); + tEnv.addObjRelation("NoSetName", "ORootElementValueSetUpdateAccess"); + + tEnv.addObjRelation("HierachicalName", "/org.openoffice.Office"); + tEnv.addObjRelation("ElementName","http"); + tEnv.addObjRelation("TemplateName", "cfg:value/cfg:any"); + + tEnv.addObjRelation("expectedName","http"); + return tEnv; + } + + /** + * Create entries in the ExternalApps layer, so there is something to test + * @param oObj The test object: used to create some entries. + */ + private void createSomeEntries(XInterface oObj) { + XNameContainer xCont = (XNameContainer)UnoRuntime.queryInterface(XNameContainer.class, oObj); + insertOrUpdate(xCont, "file", "just"); + insertOrUpdate(xCont, "ftp", "some"); + insertOrUpdate(xCont, "dummy", "arbitrary"); + insertOrUpdate(xCont, "http", "value"); + // write the changes into the user layer. + XChangesBatch xBatch = (XChangesBatch)UnoRuntime.queryInterface(XChangesBatch.class, oObj); + try { + xBatch.commitChanges(); + } + catch(com.sun.star.lang.WrappedTargetException e) { + // ignore: bug will be found with the interface test + } + } + + /** + * Insert a value in a name container or else update it + * @param xCont The name conationer to insert or update. + * @param name The name of the value. + * @param value The value itself. + */ + private void insertOrUpdate(XNameContainer xCont, String name, String value) { + boolean update = false; + try { + xCont.insertByName(name, value); + } + catch(com.sun.star.lang.IllegalArgumentException e) { + // ignore: bug will be found with the interface test + } + catch(com.sun.star.lang.WrappedTargetException e) { + // ignore: bug will be found with the interface test + } + catch(com.sun.star.container.ElementExistException e) { + update = true; + } + try { + if (update) + xCont.replaceByName(name, value); + } + catch(com.sun.star.lang.IllegalArgumentException e) { + // ignore: bug will be found with the interface test + } + catch(com.sun.star.container.NoSuchElementException e) { + // ignore: bug will be found with the interface test + } + catch(com.sun.star.lang.WrappedTargetException e) { + // ignore: bug will be found with the interface test + } + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementGroupInfoAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementGroupInfoAccess.java new file mode 100644 index 000000000000..edff5174d05f --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementGroupInfoAccess.java @@ -0,0 +1,237 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OSetElementGroupInfoAccess.java,v $ + * $Revision: 1.6 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameContainer; +import com.sun.star.container.XNameReplace; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import com.sun.star.util.XChangesBatch; + + +public class OSetElementGroupInfoAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Common/Menus"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + XNameAccess xHierachNameAccess = null; + XNameReplace xChangeView = null; + XComponent xDisposeComponent = null; + + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + + xHierachNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", nodeArgs)); + + XInterface oInnerSetInfoAccess = (XInterface) xHierachNameAccess.getByName("New"); + + XNameAccess names = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + oInnerSetInfoAccess); + + String[] theNames = names.getElementNames(); + + log.println("Contains " + theNames.length + " elements"); + + xDisposeComponent = (XComponent) + UnoRuntime.queryInterface(XComponent.class, xHierachNameAccess); + + String[] elnames = names.getElementNames(); + + log.println("use node 'm0'"); + oObj = (XInterface) names.getByName("m0"); + + + + log.println("create ConfigurationUpdateAccess to modify the object..."); + + xHierachNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + + oInnerSetInfoAccess = (XInterface) xHierachNameAccess.getByName("New"); + + names = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, + oInnerSetInfoAccess); + + log.println("use node 'm0'"); + + XInterface xInt = (XInterface) names.getByName("m0"); + xChangeView = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, + xInt); + + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + String[] pNames = new String[] { "ImageIdentifier", "Title", "URL", "TargetName" }; + + String[] pTypes = new String[] { "String", "String", "String", "String" }; + + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("cannotSwitchParent", + "configmgr: BasicElement::setParent: cannot move Entry"); + + tEnv.addObjRelation("HierachicalName", "/org.openoffice.Office"); + tEnv.addObjRelation("ElementName", "Title"); + tEnv.addObjRelation("NoSetName", "OInnerValueSetInfoAccess"); + tEnv.addObjRelation("TemplateName", "cfg:value/cfg:any"); + tEnv.addObjRelation("expectedName", "ImageIdentifier"); + + tEnv.addObjRelation("XContainer.NewValue", "aValue"); + tEnv.addObjRelation("XContainer.ElementName", "TargetName"); + tEnv.addObjRelation("XContainer.Container", xChangeView); + + // dispose the owner of the test object + tEnv.addObjRelation("XComponent.DisposeThis", xDisposeComponent); + + tEnv.addObjRelation("PropertyNames", pNames); + tEnv.addObjRelation("PropertyTypes", pTypes); + tEnv.addObjRelation("allReadOnly", + "all Properties of OSetElementGroupInfoAccess are read Only"); + + tEnv.addObjRelation("TemplateInstance", "org.openoffice.Office.Common/MenuType"); + + return tEnv; + } + /** + * Create entries in the ExternalApps layer, so there is something to test + * @param oObj The test object: used to create some entries. + */ + private void createSomeEntries(XInterface xObj) { + XNameContainer xCont = (XNameContainer)UnoRuntime.queryInterface(XNameContainer.class, xObj); + insertOrUpdate(xCont, "file", xObj); +// insertOrUpdate(xCont, "ftp", "some"); +// insertOrUpdate(xCont, "dummy", "arbitrary"); +// insertOrUpdate(xCont, "http", "value"); + // write the changes into the user layer. + XChangesBatch xBatch = (XChangesBatch)UnoRuntime.queryInterface(XChangesBatch.class, xObj); + try { + xBatch.commitChanges(); + } + catch(com.sun.star.lang.WrappedTargetException e) { + // ignore: bug will be found with the interface test + } + } + + /** + * Insert a value in a name container or else update it + * @param xCont The name conationer to insert or update. + * @param name The name of the value. + * @param value The value itself. + */ + private void insertOrUpdate(XNameContainer xCont, String name, XInterface value) { + boolean update = false; + XSingleServiceFactory xFac = (XSingleServiceFactory) UnoRuntime.queryInterface( + XSingleServiceFactory.class, + value); + + try { + xCont.insertByName(name, xFac.createInstance()); + } + catch(com.sun.star.lang.IllegalArgumentException e) { + log.println("ERROR: " + e.toString()); + // ignore: bug will be found with the interface test + } + catch(com.sun.star.lang.WrappedTargetException e) { + log.println("ERROR: " + e.toString()); + // ignore: bug will be found with the interface test + } + catch(com.sun.star.container.ElementExistException e) { + update = true; + } + catch(com.sun.star.uno.Exception e) { + log.println("could not create Instance: " + e.toString()); + } + + try { + if (update) + xCont.replaceByName(name, xFac.createInstance()); + } + catch(com.sun.star.lang.IllegalArgumentException e) { + // ignore: bug will be found with the interface test + } + catch(com.sun.star.container.NoSuchElementException e) { + // ignore: bug will be found with the interface test + } + catch(com.sun.star.lang.WrappedTargetException e) { + // ignore: bug will be found with the interface test + } + catch(com.sun.star.uno.Exception e) { + log.println("could not create Instance: " + e.toString()); + } + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementGroupUpdateAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementGroupUpdateAccess.java new file mode 100644 index 000000000000..c93667de6261 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementGroupUpdateAccess.java @@ -0,0 +1,135 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OSetElementGroupUpdateAccess.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XHierarchicalNameAccess; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameReplace; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + + +public class OSetElementGroupUpdateAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Jobs"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + XHierarchicalNameAccess names = (XHierarchicalNameAccess) UnoRuntime.queryInterface( + XHierarchicalNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + + XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface( + XSingleServiceFactory.class, + names.getByHierarchicalName("Jobs")); + oObj = (XInterface) jobsFac.createInstance(); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + XNameAccess names = (XNameAccess) UnoRuntime.queryInterface( + XNameAccess.class, oObj); + + String[] pNames = names.getElementNames(); + String[] pTypes = new String[pNames.length]; + + for (int k=0;k<pNames.length;k++) { + pTypes[k] = "boolean"; + } + + + tEnv.addObjRelation("ElementName", pNames[0]); + + tEnv.addObjRelation("PropertyNames", pNames); + tEnv.addObjRelation("PropertyTypes", pTypes); + + tEnv.addObjRelation("cannotSwitchParent", + "configmgr: BasicElement::setParent: cannot move Entry"); + + tEnv.addObjRelation("expectedName", pNames[0]); + tEnv.addObjRelation("INSTANCE1", "newValue"); + tEnv.addObjRelation("HierachicalName", "//Job"); + tEnv.addObjRelation("NoSetName", "OSetElementGroupUpdateAccess"); + + tEnv.addObjRelation("XContainer.NewValue", "aValue"); + tEnv.addObjRelation("XContainer.ElementName", pNames[0]); + tEnv.addObjRelation("XContainer.Container", (XNameReplace) + UnoRuntime.queryInterface(XNameReplace.class, oObj)); + + tEnv.addObjRelation("TemplateInstance", (String)nodepath.Value + "/Job"); + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementSetInfoAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementSetInfoAccess.java new file mode 100644 index 000000000000..6892886f0b92 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementSetInfoAccess.java @@ -0,0 +1,148 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OSetElementSetInfoAccess.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XHierarchicalNameAccess; +import com.sun.star.container.XNameAccess; +import com.sun.star.container.XNameContainer; +import com.sun.star.container.XNameReplace; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + + +public class OSetElementSetInfoAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + Object instance = null; + Object instance1 = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Labels/Manufacturer"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + String hierarchicalElementName = "Labels['Avery A4']"; + String elementName = "Avery A4"; + + XNameReplace xChangeView = null; + XNameContainer xContainer = null; + XHierarchicalNameAccess xHierachNameAccess = null; + try { + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + xHierachNameAccess = (XHierarchicalNameAccess) UnoRuntime.queryInterface( + XHierarchicalNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationAccess", + nodeArgs)); + + oObj = (XInterface) xHierachNameAccess.getByHierarchicalName(hierarchicalElementName); + + // craete a changeable view. + XHierarchicalNameAccess changeableNames = (XHierarchicalNameAccess) UnoRuntime.queryInterface(XHierarchicalNameAccess.class, + pMSF.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", nodeArgs)); + + XInterface xInt = (XInterface) changeableNames.getByHierarchicalName(hierarchicalElementName); + xChangeView = (XNameReplace)UnoRuntime.queryInterface(XNameReplace.class, xInt); + XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface( + XSingleServiceFactory.class, xChangeView); + instance1 = jobsFac.createInstance(); + + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface( + XNameAccess.class, oObj); + + String[] pNames = xNameAccess.getElementNames(); + + tEnv.addObjRelation("ElementName", pNames[0]); + + tEnv.addObjRelation("cannotSwitchParent", + "configmgr: BasicElement::setParent: cannot move Entry"); + + tEnv.addObjRelation("XContainer.NewValue", instance1); + tEnv.addObjRelation("XContainer.ElementName", "L0"); + tEnv.addObjRelation("XContainer.Container", xChangeView); + + // dispose the owner of the test object + tEnv.addObjRelation("XComponent.DisposeThis", (XComponent) + UnoRuntime.queryInterface(XComponent.class, xHierachNameAccess)); + + tEnv.addObjRelation("expectedName", pNames[0]); + tEnv.addObjRelation("HierachicalName", "/org.openoffice.Office"); + tEnv.addObjRelation("NAMEREPLACE", pNames[0]); + tEnv.addObjRelation("NoSetName", "OInnerTreeSetInfoAccess"); + tEnv.addObjRelation("TemplateName", "org.openoffice.Office.Labels/LabelType"); + tEnv.addObjRelation("TemplateInstance", "org.openoffice.Office.Labels/Labels"); + + return tEnv; + } +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementTreeSetUpdateAccess.java b/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementTreeSetUpdateAccess.java new file mode 100644 index 000000000000..0376593fb223 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/OSetElementTreeSetUpdateAccess.java @@ -0,0 +1,138 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: OSetElementTreeSetUpdateAccess.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +package mod._cfgmgr2; + +import java.io.PrintWriter; + +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; +import util.utils; + +import com.sun.star.beans.PropertyState; +import com.sun.star.beans.PropertyValue; +import com.sun.star.container.XHierarchicalNameAccess; +import com.sun.star.container.XNameAccess; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.lang.XSingleServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; + + +public class OSetElementTreeSetUpdateAccess extends TestCase { + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. <br> + * + * An instance of com.sun.star.comp.configuration.ConfigurationProvider + * is created at the MultiServiceFactory of the Office<br> + * At this an instance of com.sun.star.configuration.ConfigurationAccess is created + * and from the resulting XNameAccess the first element is taken. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, + PrintWriter log) { + XInterface oObj = null; + Object instance = null; + Object instance1 = null; + Object instance2 = null; + log.println("creating the Environment"); + + PropertyValue[] nodeArgs = new PropertyValue[1]; + PropertyValue nodepath = new PropertyValue(); + nodepath.Name = "nodepath"; + nodepath.Value = "org.openoffice.Office.Labels/Manufacturer"; + nodepath.Handle = -1; + nodepath.State = PropertyState.DEFAULT_VALUE; + nodeArgs[0] = nodepath; + + XHierarchicalNameAccess xHierachNameAccess = null; + try { + + XInterface Provider = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.ConfigurationProvider"); + XMultiServiceFactory pMSF = (XMultiServiceFactory) UnoRuntime.queryInterface( + XMultiServiceFactory.class, + Provider); + xHierachNameAccess = (XHierarchicalNameAccess) UnoRuntime.queryInterface( + XHierarchicalNameAccess.class, + pMSF.createInstanceWithArguments( + "com.sun.star.configuration.ConfigurationUpdateAccess", + nodeArgs)); + + oObj = (XInterface) xHierachNameAccess.getByHierarchicalName("Labels['Avery A4']"); + + XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface( + XSingleServiceFactory.class, + oObj); + instance = jobsFac.createInstance(); + instance1 = jobsFac.createInstance(); + instance2 = jobsFac.createInstance(); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("ImplementationName: " + utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + XNameAccess names = (XNameAccess) UnoRuntime.queryInterface( + XNameAccess.class, oObj); + + String[] pNames = names.getElementNames(); + + tEnv.addObjRelation("ElementName", pNames[0]); + + tEnv.addObjRelation("cannotSwitchParent", + "configmgr: BasicElement::setParent: cannot move Entry"); + + // dispose the owner of the test object + tEnv.addObjRelation("XComponent.DisposeThis", (XComponent) + UnoRuntime.queryInterface(XComponent.class, xHierachNameAccess)); + + tEnv.addObjRelation("expectedName", pNames[0]); + tEnv.addObjRelation("HierachicalName", "/org.openoffice.Office"); + tEnv.addObjRelation("INSTANCE", instance); + tEnv.addObjRelation("INSTANCE1", instance1); + tEnv.addObjRelation("INSTANCE2", instance1); + tEnv.addObjRelation("NAMEREPLACE", pNames[0]); + tEnv.addObjRelation("NoSetName", "OSetElementTreeSetUpdateAccess"); + tEnv.addObjRelation("TemplateName", "org.openoffice.Office.Labels/LabelType"); + tEnv.addObjRelation("TemplateInstance", "org.openoffice.Office.Labels/Labels"); + + return tEnv; + } +}
\ No newline at end of file diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/SchemaParser.java b/qadevOOo/tests/java/mod/_cfgmgr2/SchemaParser.java new file mode 100644 index 000000000000..dddd0037ba5a --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/SchemaParser.java @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: SchemaParser.java,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +package mod._cfgmgr2; + +import com.sun.star.io.XActiveDataSink; +import com.sun.star.io.XInputStream; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.ucb.XSimpleFileAccess; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import java.io.PrintWriter; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +public class SchemaParser extends TestCase { + + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + + XInterface oObj = null; + XSimpleFileAccess simpleAccess = null; + XInputStream xStream = null; + String filename = null; + + try { + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.backend.xml.SchemaParser"); + Object fileacc = ((XMultiServiceFactory)tParam.getMSF()).createInstance("com.sun.star.comp.ucb.SimpleFileAccess"); + simpleAccess = (XSimpleFileAccess) + UnoRuntime.queryInterface(XSimpleFileAccess.class,fileacc); + filename = util.utils.getOfficeURL((XMultiServiceFactory)tParam.getMSF())+"/../share/registry/schema/org/openoffice/Setup.xcs"; + + log.println("Going to parse: "+filename); + xStream = simpleAccess.openFileRead(filename); + } catch (com.sun.star.uno.Exception e) { + } + + log.println("Implementation name: "+ util.utils.getImplName(oObj)); + + XActiveDataSink xSink = (XActiveDataSink) UnoRuntime.queryInterface(XActiveDataSink.class, oObj); + xSink.setInputStream(xStream); + TestEnvironment tEnv = new TestEnvironment(oObj); + + tEnv.addObjRelation("InputStream", xStream); + tEnv.addObjRelation("ParsedFileName", filename); + return tEnv; + } + +} diff --git a/qadevOOo/tests/java/mod/_cfgmgr2/SingleBackendAdapter.java b/qadevOOo/tests/java/mod/_cfgmgr2/SingleBackendAdapter.java new file mode 100644 index 000000000000..fae899b268c1 --- /dev/null +++ b/qadevOOo/tests/java/mod/_cfgmgr2/SingleBackendAdapter.java @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: SingleBackendAdapter.java,v $ + * $Revision: 1.4 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +package mod._cfgmgr2; + +import com.sun.star.lang.XInitialization; +import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XInterface; +import java.io.PrintWriter; +import lib.TestCase; +import lib.TestEnvironment; +import lib.TestParameters; + +public class SingleBackendAdapter extends TestCase { + + /** Called to create an instance of <code>TestEnvironment</code> with an + * object to test and related objects. Subclasses should implement this + * method to provide the implementation and related objects. The method is + * called from <code>getTestEnvironment()</code>. + * + * @param tParam test parameters + * @param log writer to log information while testing + * + * @see TestEnvironment + * @see #getTestEnvironment() + * + */ + protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) { + XInterface oObj = null; + XInterface backend = null; + + try { + Object[] args = new Object[1]; + args[0] = ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.configuration.bootstrap.BootstrapContext"); + backend = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstanceWithArguments("com.sun.star.comp.configuration.backend.LocalSingleBackend",args); + oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()) + .createInstance("com.sun.star.comp.configuration.backend.SingleBackendAdapter"); + XInitialization xInit = (XInitialization) UnoRuntime.queryInterface( + XInitialization.class, oObj); + + xInit.initialize(new Object[] { backend }); + } catch (com.sun.star.uno.Exception e) { + e.printStackTrace(); + } + + log.println("Implementation name: "+ util.utils.getImplName(oObj)); + + TestEnvironment tEnv = new TestEnvironment(oObj); + + return tEnv; + } + +} |