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
;
24 import lib
.TestEnvironment
;
25 import lib
.TestParameters
;
27 import com
.sun
.star
.lang
.XMultiServiceFactory
;
28 import com
.sun
.star
.ucb
.XContentIdentifierFactory
;
29 import com
.sun
.star
.uno
.UnoRuntime
;
30 import com
.sun
.star
.uno
.XInterface
;
33 * Test for object which is represented by service
34 * <code>com.sun.star.ucb.RemoteAccessContentProvider</code>. <p>
35 * Object implements the following interfaces :
37 * <li> <code>com::sun::star::ucb::XContentProvider</code></li>
38 * <li> <code>com::sun::star::ucb::XFileIdentifierConverter</code></li>
39 * <li> <code>com::sun::star::ucb::XContentIdentifierFactory</code></li>
40 * <li> <code>com::sun::star::ucb::XParameterizedContentProvider</code></li>
42 * This object test <b> is NOT </b> designed to be run in several
43 * threads concurrently.
44 * @see com.sun.star.ucb.XContentProvider
45 * @see com.sun.star.ucb.XFileIdentifierConverter
46 * @see com.sun.star.ucb.XContentIdentifierFactory
47 * @see com.sun.star.ucb.XParameterizedContentProvider
48 * @see ifc.ucb._XContentProvider
49 * @see ifc.ucb._XFileIdentifierConverter
50 * @see ifc.ucb._XContentIdentifierFactory
51 * @see ifc.ucb._XParameterizedContentProvider
53 public class ContentProvider
extends TestCase
{
56 * Creating a TestEnvironment for the interfaces to be tested.
57 * Creates an instance of the service
58 * <code>com.sun.star.ucprmt.ContentProvider</code>. <p>
59 * Object relations created :
61 * <li> <code>'FACTORY'</code> for
62 * {@link ifc.ucb._XContentProvider} factory for
63 * content identifiers. Here it is
64 * <code>UniversalContentBroker</code> service.</li>
65 * <li> <code>'CONTENT1'</code> for
66 * {@link ifc.ucb._XContentProvider}: suitable
67 * content URL for this provider </li>
68 * <li> <code>'CONTENT2'</code> for
69 * {@link ifc.ucb._XContentProvider}: another suitable
70 * content URL for this provider </li>
74 public TestEnvironment createTestEnvironment
75 (TestParameters Param
, PrintWriter log
) throws Exception
{
76 XInterface oObj
= null;
77 XMultiServiceFactory xMSF
= Param
.getMSF();
78 XContentIdentifierFactory cntIDFac
= null ;
80 oObj
= (XInterface
) xMSF
.createInstance
81 ("com.sun.star.ucb.RemoteAccessContentProvider");
82 cntIDFac
= UnoRuntime
.queryInterface
83 (XContentIdentifierFactory
.class, oObj
) ;
85 TestEnvironment tEnv
= new TestEnvironment( oObj
);
87 // adding relation for XContentProvider
88 tEnv
.addObjRelation("FACTORY", cntIDFac
) ;
89 tEnv
.addObjRelation("CONTENT1","vnd.sun.star.wfs:///user/work");
90 tEnv
.addObjRelation("CONTENT2","vnd.sun.star.wfs:///user/config");
93 } // finish method getTestEnvironment