merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / mod / _cfgmgr2 / LocalHierarchyBrowser.java
blobe7abdd1781d3181af2684a6dbff0c8b6c5d9afda
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: LocalHierarchyBrowser.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 com.sun.star.beans.NamedValue;
34 import com.sun.star.lang.XMultiServiceFactory;
35 import com.sun.star.uno.XInterface;
36 import java.io.PrintWriter;
37 import lib.TestCase;
38 import lib.TestEnvironment;
39 import lib.TestParameters;
41 public class LocalHierarchyBrowser extends TestCase {
44 /** Called to create an instance of <code>TestEnvironment</code> with an
45 * object to test and related objects. Subclasses should implement this
46 * method to provide the implementation and related objects. The method is
47 * called from <code>getTestEnvironment()</code>.
49 * @param tParam test parameters
50 * @param log writer to log information while testing
52 * @see TestEnvironment
53 * @see #getTestEnvironment()
56 protected TestEnvironment createTestEnvironment(TestParameters tParam,
57 PrintWriter log) {
58 XInterface oObj = null;
60 try {
61 oObj = (XInterface) ((XMultiServiceFactory) tParam.getMSF()).createInstance(
62 "com.sun.star.comp.configuration.backend.LocalHierarchyBrowser");
63 } catch (com.sun.star.uno.Exception e) {
66 String filename = util.utils.getOfficeURL(
67 (XMultiServiceFactory) tParam.getMSF()) +
68 "/../share/registry/data/org/openoffice";
70 String filename2 = util.utils.getOfficeURL(
71 (XMultiServiceFactory) tParam.getMSF()) +
72 "/../share/registry/schema/org/openoffice/";
74 Object[] vXJobArgs = new Object[2];
75 NamedValue[] vXJobArg0 = new NamedValue[1];
76 vXJobArg0[0] = new NamedValue("LayerDataUrl", filename);
77 NamedValue[] vXJobArg1 = new NamedValue[1];
78 vXJobArg1[0] = new NamedValue("SchemaDataUrl", filename2);
79 vXJobArgs[0] = vXJobArg0;
80 vXJobArgs[1] = vXJobArg1;
83 log.println("Implementation name: " + util.utils.getImplName(oObj));
85 TestEnvironment tEnv = new TestEnvironment(oObj);
86 tEnv.addObjRelation("XJobArgs", vXJobArgs);
88 return tEnv;