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: JavaComponentLoader.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 ************************************************************************/
31 package mod
._javaloader
;
33 import java
.io
.PrintWriter
;
35 import lib
.StatusException
;
37 import lib
.TestEnvironment
;
38 import lib
.TestParameters
;
41 import com
.sun
.star
.lang
.XMultiServiceFactory
;
42 import com
.sun
.star
.uno
.XInterface
;
45 * Test for <code>com.sun.star.comp.stoc.Java2</code> service <p>
46 * Files which are used :
48 * <li> <code>MyPersistObjectImpl.jar</code> : jar which will be loaded in
49 * <code>XImplementationLoader</code> interface test. </li>
51 * Multithread testing compilant.
52 * @see com.sun.star.loader.XImplementationLoader
53 * @see com.sun.star.lang.XServiceInfo
54 * @see ifc.loader._XImplementationLoader
55 * @see ifc.lang._XServiceInfo
57 public class JavaComponentLoader
extends TestCase
{
60 * Creating a Testenvironment for the interfaces to be tested.
61 * Creates <code>com.sun.star.comp.stoc.Java2</code>
63 * The following object relations created :
65 * <li> <code>'ImplementationLoader'</code> : service which is
66 * responsible for loading jar implementations. </li>
67 * <li> <code>'ImplementationUrl'</code> : jar file location. </li>
68 * <li> <code>'ImplementationName'</code> : Name of the implementation.</li>
71 public TestEnvironment
createTestEnvironment( TestParameters Param
,
73 throws StatusException
{
74 XInterface oObj
= null;
75 Object oInterface
= null;
78 XMultiServiceFactory xMSF
= (XMultiServiceFactory
)Param
.getMSF();
79 oInterface
= xMSF
.createInstance(
80 "com.sun.star.comp.stoc.JavaComponentLoader" );
82 catch( Exception e
) {
83 log
.println("JavaComponentLoader Service not available" );
86 oObj
= (XInterface
) oInterface
;
88 log
.println( " creating a new environment for JavaComponentLoader object" );
89 TestEnvironment tEnv
= new TestEnvironment( oObj
);
91 // adding object relation for XImplementationLoader ifc test
92 tEnv
.addObjRelation("ImplementationLoader",
93 "com.sun.star.loader.JavaComponentLoader") ;
95 String implURL
= utils
.getFullTestURL("qadevlibs/MyPersistObjectImpl.jar");
96 tEnv
.addObjRelation("ImplementationUrl", implURL
) ;
97 log
.println("looking for shared lib: " + implURL
);
98 tEnv
.addObjRelation("ImplementationName",
99 "com.sun.star.cmp.MyPersistObject") ;
102 } // finish method createTestEnvironment