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
._shlibloader
.uno
;
21 import com
.sun
.star
.lang
.XMultiServiceFactory
;
22 import com
.sun
.star
.uno
.XInterface
;
23 import java
.io
.PrintWriter
;
24 import lib
.StatusException
;
26 import lib
.TestEnvironment
;
27 import lib
.TestParameters
;
31 * Test for <code>com.sun.star.comp.stoc.DLLComponentLoader</code> service <p>
32 * Files which are used :
34 * <li> <code>XImpReg.dll</code> : DLL which will be loaded in
35 * <code>XImplementationLoader</code> interface test. </li>
37 * Multithread testing compilant.
38 * @see com.sun.star.loader.XImplementationLoader
39 * @see com.sun.star.lang.XServiceInfo
40 * @see ifc.loader._XImplementationLoader
41 * @see ifc.lang._XServiceInfo
43 public class DLLComponentLoader
extends TestCase
{
48 protected void initialize ( TestParameters Param
, PrintWriter log
) {
53 * Creating a Testenvironment for the interfaces to be tested.
54 * Creates <code>com.sun.star.comp.stoc.DLLComponentLoader</code>
56 * The following object relations created :
58 * <li> <code>'ImplementationLoader'</code> : service which is
59 * responsible for loading DLL implementations. </li>
60 * <li> <code>'ImplementationUrl'</code> : DLL file location. </li>
61 * <li> <code>'ImplementationName'</code> : Name of the implementation.</li>
64 protected TestEnvironment createTestEnvironment
65 (TestParameters Param
, PrintWriter log
) {
66 XInterface oObj
= null;
67 Object oInterface
= null;
68 XMultiServiceFactory xMSF
= null;
71 xMSF
= (XMultiServiceFactory
)Param
.getMSF();
72 oInterface
= xMSF
.createInstance
73 ( "com.sun.star.comp.stoc.DLLComponentLoader" );
75 catch( Exception e
) {
76 log
.println("DLLComponentLoader Service not available" );
79 oObj
= (XInterface
) oInterface
;
81 log
.println( " creating a new environment for DLLComponentLoader object" );
82 TestEnvironment tEnv
= new TestEnvironment( oObj
);
84 // adding object relation for XImplementationLoader ifc test
85 tEnv
.addObjRelation("ImplementationLoader",
86 "com.sun.star.loader.SharedLibrary") ;
87 //String fs = System.getProperty("file.separator");
88 String os
= (String
) Param
.get("OS");
89 if (os
== null || os
== "")
90 throw new StatusException(
91 "Couldn't determine operating system for naming convention.",
92 new NullPointerException());
93 String name
= "javaloader.uno";
94 if (!os
.equals("wntmsci"))
98 String implURL
= utils
.getOfficeURL(xMSF
)+"/"+name
;
99 tEnv
.addObjRelation("ImplementationUrl", implURL
) ;
100 log
.println("looking for shared lib: " + implURL
);
101 tEnv
.addObjRelation("ImplementationName",
102 "com.sun.star.comp.stoc.JavaComponentLoader") ;
105 } // finish method getTestEnvironment
107 } // finish class DLLComponentLoader