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 .
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.DLLComponentLoader</code> service <p>
34 * Files which are used :
36 * <li> <code>XImpReg.dll</code> : DLL 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 DLLComponentLoader
extends TestCase
{
48 * Creating a TestEnvironment for the interfaces to be tested.
49 * Creates <code>com.sun.star.comp.stoc.DLLComponentLoader</code>
51 * The following object relations created :
53 * <li> <code>'ImplementationLoader'</code> : service which is
54 * responsible for loading DLL implementations. </li>
55 * <li> <code>'ImplementationUrl'</code> : DLL file location. </li>
56 * <li> <code>'ImplementationName'</code> : Name of the implementation.</li>
60 protected TestEnvironment createTestEnvironment
61 (TestParameters Param
, PrintWriter log
) throws Exception
{
63 XMultiServiceFactory xMSF
= Param
.getMSF();
64 Object oInterface
= xMSF
.createInstance
65 ( "com.sun.star.comp.stoc.DLLComponentLoader" );
66 XInterface oObj
= (XInterface
) oInterface
;
68 log
.println( " creating a new environment for DLLComponentLoader object" );
69 TestEnvironment tEnv
= new TestEnvironment( oObj
);
71 // adding object relation for XImplementationLoader ifc test
72 tEnv
.addObjRelation("ImplementationLoader",
73 "com.sun.star.loader.SharedLibrary") ;
74 String os
= (String
) Param
.get("OS");
75 if (os
== null || os
.equals(""))
76 throw new StatusException(
77 "Couldn't determine operating system for naming convention.",
78 new NullPointerException());
79 String name
= "javaloader";
80 if (!os
.equals("wntmsci"))
81 name
= "lib" + name
+ ".so";
84 String implURL
= utils
.getFullTestURL(os
+ "/" + name
);
85 tEnv
.addObjRelation("ImplementationUrl", implURL
) ;
86 log
.println("looking for shared lib: " + implURL
);
87 tEnv
.addObjRelation("ImplementationName",
88 "com.sun.star.comp.stoc.JavaComponentLoader") ;
91 } // finish method getTestEnvironment
93 } // finish class DLLComponentLoader