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
;
25 import lib
.TestEnvironment
;
26 import lib
.TestParameters
;
29 import com
.sun
.star
.lang
.XMultiServiceFactory
;
30 import com
.sun
.star
.uno
.XInterface
;
33 * Test for <code>com.sun.star.comp.stoc.Java2</code> service <p>
34 * Files which are used :
36 * <li> <code>MyPersistObjectImpl.jar</code> : jar which will be loaded in
37 * <code>XImplementationLoader</code> interface test. </li>
39 * Multithread testing compliant.
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
{
48 * Creating a Testenvironment for the interfaces to be tested.
49 * Creates <code>com.sun.star.comp.stoc.Java2</code>
51 * The following object relations created :
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>
60 public TestEnvironment
createTestEnvironment( TestParameters Param
,
62 throws StatusException
{
63 XInterface oObj
= null;
64 Object oInterface
= null;
67 XMultiServiceFactory xMSF
= Param
.getMSF();
68 oInterface
= xMSF
.createInstance(
69 "com.sun.star.comp.stoc.JavaComponentLoader" );
71 catch( Exception e
) {
72 log
.println("JavaComponentLoader Service not available" );
75 oObj
= (XInterface
) oInterface
;
77 log
.println( " creating a new environment for JavaComponentLoader object" );
78 TestEnvironment tEnv
= new TestEnvironment( oObj
);
80 // adding object relation for XImplementationLoader ifc test
81 tEnv
.addObjRelation("ImplementationLoader",
82 "com.sun.star.loader.JavaComponentLoader") ;
84 String implURL
= utils
.getFullTestURL("qadevlibs/MyPersistObjectImpl.jar");
85 tEnv
.addObjRelation("ImplementationUrl", implURL
) ;
86 log
.println("looking for shared lib: " + implURL
);
87 tEnv
.addObjRelation("ImplementationName",
88 "com.sun.star.cmp.MyPersistObject") ;
91 } // finish method createTestEnvironment