merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / tests / java / mod / _cfgmgr2 / MultiStratumBackend.java
blob19ff5fd368929263c546d609ebe11e1e6e6e84d5
1 /*
2 * MultiStratumBackend.java
4 * Created on 24. March 2004, 13:48
5 */
7 package mod._cfgmgr2;
9 import com.sun.star.lang.XMultiServiceFactory;
10 import com.sun.star.uno.UnoRuntime;
11 import com.sun.star.uno.XInterface;
12 import com.sun.star.util.XStringSubstitution;
13 import java.io.PrintWriter;
14 import lib.TestCase;
15 import lib.TestEnvironment;
16 import lib.TestParameters;
18 public class MultiStratumBackend extends TestCase {
20 protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
21 XInterface oObj = null;
23 Object[] args = new Object[1];
24 String AdminURL = "";
26 try {
27 XStringSubstitution sts = createStringSubstitution(
28 (XMultiServiceFactory) tParam.getMSF());
29 AdminURL = sts.getSubstituteVariableValue("$(inst)") +
30 "/share/registry";
31 args[0] = ((XMultiServiceFactory)tParam.getMSF())
32 .createInstance("com.sun.star.configuration.bootstrap.BootstrapContext");
33 oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF())
34 .createInstanceWithArguments("com.sun.star.comp.configuration.backend.MultiStratumBackend",args);
36 } catch (com.sun.star.uno.Exception e) {
39 log.println("Implementation name: "+ util.utils.getImplName(oObj));
41 TestEnvironment tEnv = new TestEnvironment(oObj);
43 //objRelation for XInitialization
44 tEnv.addObjRelation("XInitialization.args", args);
46 //objRelation for XBackendEntities
47 tEnv.addObjRelation("NoAdmin", AdminURL);
48 tEnv.addObjRelation("MSB", Boolean.TRUE);
50 return tEnv;
53 public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF) {
54 Object xPathSubst = null;
56 try {
57 xPathSubst = xMSF.createInstance(
58 "com.sun.star.util.PathSubstitution");
59 } catch (com.sun.star.uno.Exception e) {
60 e.printStackTrace();
63 if (xPathSubst != null) {
64 return (XStringSubstitution) UnoRuntime.queryInterface(
65 XStringSubstitution.class, xPathSubst);
66 } else {
67 return null;