bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / tests / java / mod / _javaloader / JavaComponentLoader.java
blobdf4aaaa7ba4442d04b72373e3b0a512936b4eae0
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package mod._javaloader;
21 import java.io.PrintWriter;
23 import lib.StatusException;
24 import lib.TestCase;
25 import lib.TestEnvironment;
26 import lib.TestParameters;
27 import util.utils;
29 import com.sun.star.lang.XMultiServiceFactory;
30 import com.sun.star.uno.XInterface;
32 /**
33 * Test for <code>com.sun.star.comp.stoc.Java2</code> service <p>
34 * Files which are used :
35 * <ul>
36 * <li> <code>MyPersistObjectImpl.jar</code> : jar which will be loaded in
37 * <code>XImplementationLoader</code> interface test. </li>
38 * <ul>
39 * Multithread testing compilant.
40 * @see com.sun.star.loader.XImplementationLoader
41 * @see com.sun.star.lang.XServiceInfo
42 * @see ifc.loader._XImplementationLoader
43 * @see ifc.lang._XServiceInfo
45 public class JavaComponentLoader extends TestCase {
47 /**
48 * Creating a Testenvironment for the interfaces to be tested.
49 * Creates <code>com.sun.star.comp.stoc.Java2</code>
50 * service. <p>
51 * The following object relations created :
52 * <ul>
53 * <li> <code>'ImplementationLoader'</code> : service which is
54 * responsible for loading jar implementations. </li>
55 * <li> <code>'ImplementationUrl'</code> : jar file location. </li>
56 * <li> <code>'ImplementationName'</code> : Name of the implementation.</li>
57 * </ul>
59 public TestEnvironment createTestEnvironment( TestParameters Param,
60 PrintWriter log )
61 throws StatusException {
62 XInterface oObj = null;
63 Object oInterface = null;
65 try {
66 XMultiServiceFactory xMSF = (XMultiServiceFactory)Param.getMSF();
67 oInterface = xMSF.createInstance(
68 "com.sun.star.comp.stoc.JavaComponentLoader" );
70 catch( Exception e ) {
71 log.println("JavaComponentLoader Service not available" );
74 oObj = (XInterface) oInterface;
76 log.println( " creating a new environment for JavaComponentLoader object" );
77 TestEnvironment tEnv = new TestEnvironment( oObj );
79 // adding object relation for XImplementationLoader ifc test
80 tEnv.addObjRelation("ImplementationLoader",
81 "com.sun.star.loader.JavaComponentLoader") ;
83 String implURL = utils.getFullTestURL("qadevlibs/MyPersistObjectImpl.jar");
84 tEnv.addObjRelation("ImplementationUrl", implURL) ;
85 log.println("looking for shared lib: " + implURL);
86 tEnv.addObjRelation("ImplementationName",
87 "com.sun.star.cmp.MyPersistObject") ;
89 return tEnv;
90 } // finish method createTestEnvironment