1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ConfigurationProviderWrapper.java,v $
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 ************************************************************************/
34 import java
.io
.PrintWriter
;
35 import java
.util
.Vector
;
38 import lib
.TestEnvironment
;
39 import lib
.TestParameters
;
41 import com
.sun
.star
.beans
.PropertyState
;
42 import com
.sun
.star
.beans
.PropertyValue
;
43 import com
.sun
.star
.lang
.XMultiServiceFactory
;
44 import com
.sun
.star
.uno
.XInterface
;
46 public class ConfigurationProviderWrapper
extends TestCase
{
48 /** Called to create an instance of <code>TestEnvironment</code> with an
49 * object to test and related objects. Subclasses should implement this
50 * method to provide the implementation and related objects. The method is
51 * called from <code>getTestEnvironment()</code>.
53 * @param tParam test parameters
54 * @param log writer to log information while testing
56 * @see TestEnvironment
57 * @see #getTestEnvironment()
60 protected TestEnvironment
createTestEnvironment(TestParameters tParam
, PrintWriter log
) {
62 XInterface oObj
= null;
65 PropertyValue
[] cArgs
= new PropertyValue
[2];
66 cArgs
[0] = new PropertyValue();
67 cArgs
[0].Name
= "Locale";
68 cArgs
[0].Value
= "DE";
69 cArgs
[1] = new PropertyValue();
70 cArgs
[1].Name
= "EnableAsync";
71 cArgs
[1].Value
= new Boolean(true);
73 oObj
= (XInterface
) ((XMultiServiceFactory
)tParam
.getMSF())
74 .createInstanceWithArguments("com.sun.star.comp.configuration.ConfigurationProvider",cArgs
);
75 } catch (com
.sun
.star
.uno
.Exception e
) {
78 log
.println("Implementation name: "+ util
.utils
.getImplName(oObj
));
80 PropertyValue
[] nodeArgs
= new PropertyValue
[1];
81 PropertyValue nodepath
= new PropertyValue();
82 nodepath
.Name
= "nodepath";
83 nodepath
.Value
= "org.openoffice.Setup";
85 nodepath
.State
= PropertyState
.DEFAULT_VALUE
;
86 nodeArgs
[0] = nodepath
;
88 Vector args
= new Vector();
90 args
.add(0, nodeArgs
);
91 args
.add(0, nodeArgs
);
92 args
.add(0, nodeArgs
);
93 args
.add(0, nodeArgs
);
94 args
.add(0, nodeArgs
);
95 args
.add(0, nodeArgs
);
96 args
.add(0, nodeArgs
);
99 TestEnvironment tEnv
= new TestEnvironment(oObj
);
101 tEnv
.addObjRelation("XMSF.Args",
102 args
.toArray(new Object
[args
.size()][]));
103 tEnv
.addObjRelation("needArgs", "ConfigurationProvider");