1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 package ifc.ucb;
29 
30 import lib.MultiMethodTest;
31 
32 import com.sun.star.lang.XMultiServiceFactory;
33 import com.sun.star.ucb.XContentProviderManager;
34 import com.sun.star.ucb.XRemoteContentProviderAcceptor;
35 import com.sun.star.ucb.XRemoteContentProviderActivator;
36 
37 /**
38  * Testing <code>com.sun.star.ucb.XRemoteContentProviderActivator</code>
39  * interface methods :
40  * <ul>
41  *  <li><code> activateRemoteContentProviders()</code></li>
42  * </ul> <p>
43  * This test needs the following object relations :
44  * <ul>
45  *  <li> <code>'RCPA'</code>
46  *   (of type <code>XRemoteContentProviderAcceptor</code>):
47  *   this acceptor is used to add a provider first before
48  *   its activation. </li>
49  * <ul> <p>
50  * Test is <b> NOT </b> multithread compilant. <p>
51  * @see com.sun.star.ucb.XRemoteContentProviderActivator
52  */
53 public class _XRemoteContentProviderActivator extends MultiMethodTest {
54 
55     public XRemoteContentProviderActivator oObj = null;
56 
57     /**
58      * First the relation is retrieved and a remote provider is
59      * added to the acceptor. Then it is activated and
60      * removed. <p>
61      * Has <b> OK </b> status if <code>activateRemoteContentProviders</code>
62      * method returns not <code>null</code> value. <p>
63      */
64     public void _activateRemoteContentProviders() {
65         boolean res = false;
66 
67         XRemoteContentProviderAcceptor xRCPA = (XRemoteContentProviderAcceptor)
68                                                     tEnv.getObjRelation("RCPA");
69         String[] template = new String[]{"file"};
70         xRCPA.addRemoteContentProvider("ContentID",(XMultiServiceFactory)tParam.getMSF(),template,null);
71         XContentProviderManager CPM = oObj.activateRemoteContentProviders();
72         res = (CPM != null);
73         xRCPA.removeRemoteContentProvider("ContentID");
74 
75         tRes.tested("activateRemoteContentProviders()",res);
76     }
77 
78 }
79 
80