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 compliant.
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
{
49 protected void initialize ( TestParameters Param
, PrintWriter log
) {
54 * Creating a Testenvironment for the interfaces to be tested.
55 * Creates <code>com.sun.star.comp.stoc.DLLComponentLoader</code>
57 * The following object relations created :
59 * <li> <code>'ImplementationLoader'</code> : service which is
60 * responsible for loading DLL implementations. </li>
61 * <li> <code>'ImplementationUrl'</code> : DLL file location. </li>
62 * <li> <code>'ImplementationName'</code> : Name of the implementation.</li>
66 protected TestEnvironment createTestEnvironment
67 (TestParameters Param
, PrintWriter log
) {
68 XInterface oObj
= null;
69 Object oInterface
= null;
70 XMultiServiceFactory xMSF
= null;
73 xMSF
= Param
.getMSF();
74 oInterface
= xMSF
.createInstance
75 ( "com.sun.star.comp.stoc.DLLComponentLoader" );
77 catch( Exception e
) {
78 log
.println("DLLComponentLoader Service not available" );
81 oObj
= (XInterface
) oInterface
;
83 log
.println( " creating a new environment for DLLComponentLoader object" );
84 TestEnvironment tEnv
= new TestEnvironment( oObj
);
86 // adding object relation for XImplementationLoader ifc test
87 tEnv
.addObjRelation("ImplementationLoader",
88 "com.sun.star.loader.SharedLibrary") ;
89 String os
= (String
) Param
.get("OS");
90 if (os
== null || os
.equals(""))
91 throw new StatusException(
92 "Couldn't determine operating system for naming convention.",
93 new NullPointerException());
94 String name
= "javaloader.uno";
95 if (!os
.equals("wntmsci"))
99 String implURL
= utils
.getOfficeURL(xMSF
)+"/"+name
;
100 tEnv
.addObjRelation("ImplementationUrl", implURL
) ;
101 log
.println("looking for shared lib: " + implURL
);
102 tEnv
.addObjRelation("ImplementationName",
103 "com.sun.star.comp.stoc.JavaComponentLoader") ;
106 } // finish method getTestEnvironment
108 } // finish class DLLComponentLoader