merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / mod / _cfgmgr2 / ConfigurationProvider.java
blob38a18641e1fc76d02e4c3a5c35ecf83a4858427f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ConfigurationProvider.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package mod._cfgmgr2;
33 import java.io.PrintWriter;
34 import java.util.Vector;
36 import lib.TestCase;
37 import lib.TestEnvironment;
38 import lib.TestParameters;
40 import com.sun.star.beans.PropertyState;
41 import com.sun.star.beans.PropertyValue;
42 import com.sun.star.lang.XMultiServiceFactory;
43 import com.sun.star.uno.XInterface;
46 public class ConfigurationProvider extends TestCase {
48 /** Called to create an instance of <code>TestEnvironment</code> with an
49 * object to test and related objects.
51 * For this an instance of com.sun.star.comp.configuration.ConfigurationProvider
52 * is created at the MultiServiceFactory of the Office
54 * @param tParam test parameters
55 * @param log writer to log information while testing
57 * @see TestEnvironment
58 * @see #getTestEnvironment()
61 protected TestEnvironment createTestEnvironment(TestParameters tParam,
62 PrintWriter log) {
63 XInterface oObj = null;
65 try {
66 oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF())
67 .createInstance("com.sun.star.comp.configuration.ConfigurationProvider");
68 } catch (com.sun.star.uno.Exception e) {
71 util.dbg.printInterfaces(oObj);
73 PropertyValue[] nodeArgs = new PropertyValue[1];
74 PropertyValue nodepath = new PropertyValue();
75 nodepath.Name = "nodepath";
76 nodepath.Value = "org.openoffice.Setup";
77 nodepath.Handle = -1;
78 nodepath.State = PropertyState.DEFAULT_VALUE;
79 nodeArgs[0] = nodepath;
81 Vector args = new Vector();
83 args.add(0, nodeArgs);
84 args.add(0, nodeArgs);
85 args.add(0, nodeArgs);
86 args.add(0, nodeArgs);
87 args.add(0, nodeArgs);
88 args.add(0, nodeArgs);
89 args.add(0, nodeArgs);
91 TestEnvironment tEnv = new TestEnvironment(oObj);
93 tEnv.addObjRelation("XMSF.Args",
94 args.toArray(new Object[args.size()][]));
95 tEnv.addObjRelation("needArgs", "ConfigurationProvider");
97 return tEnv;