1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package ifc.ucb;
25 
26 import lib.MultiMethodTest;
27 import util.utils;
28 
29 import com.sun.star.lang.XMultiServiceFactory;
30 import com.sun.star.ucb.XContentIdentifier;
31 import com.sun.star.ucb.XContentIdentifierFactory;
32 
33 /**
34 * Testing <code>com.sun.star.ucb.XContentIdentifierFactory</code>
35 * interface methods :
36 * <ul>
37 *  <li><code> createContentIdentifier()</code></li>
38 * </ul> <p>
39 * Test is <b> NOT </b> multithread compilant. <p>
40 * After test completion object environment has to be recreated.
41 * @see com.sun.star.ucb.XContentIdentifierFactory
42 */
43 public class _XContentIdentifierFactory extends MultiMethodTest {
44     /**
45      * Contains the tested object.
46      */
47     public XContentIdentifierFactory oObj;
48 
49     /**
50      * Calls the tested method with a file url and
51      * gets an identifier. <p>
52      * Has <b> OK </b> status if content identifier an provider sheme are
53      * proper. <p>
54      */
_createContentIdentifier()55     public void _createContentIdentifier() {
56         // creating a content identifier string - tmp url
57         String tmpDir = utils.getOfficeTemp((XMultiServiceFactory)tParam.getMSF());
58 
59         String contentId = utils.getFullURL(tmpDir);
60 
61         // the scheme is file
62         String scheme = "file";
63 
64         XContentIdentifier identifier = oObj.createContentIdentifier(contentId);
65 
66         // verifying results
67         String resId = identifier.getContentIdentifier();
68         String resScheme = identifier.getContentProviderScheme();
69 
70         tRes.tested("createContentIdentifier()", contentId.equals(resId)
71                 && scheme.equals(resScheme));
72     }
73 }
74