Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / ucb / _XFileIdentifierConverter.java
blobef50db7cec7ee617d7254e3d08231df4847bbd5e
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XFileIdentifierConverter.java,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package ifc.ucb;
33 import lib.MultiMethodTest;
35 import com.sun.star.lang.XMultiServiceFactory;
36 import com.sun.star.ucb.XFileIdentifierConverter;
38 /**
39 * Testing <code>com.sun.star.ucb.XFileIdentifierConverter</code>
40 * interface methods :
41 * <ul>
42 * <li><code> getFileProviderLocality()</code></li>
43 * <li><code> getFileURLFromSystemPath()</code></li>
44 * <li><code> getSystemPathFromFileURL()</code></li>
45 * </ul> <p>
46 * Test is <b> NOT </b> multithread compilant. <p>
47 * @see com.sun.star.ucb.XFileIdentifierConverter
49 public class _XFileIdentifierConverter extends MultiMethodTest {
51 /**
52 * Contains the tested object.
54 public XFileIdentifierConverter oObj;
56 /**
57 * Gets the locality for SOffice temporary directory. <p>
58 * Has <b> OK </b> status if the method returns value greater
59 * than 0 (as office temp directory is supposed to be in the
60 * same location). <p>
62 public void _getFileProviderLocality() {
63 String baseURL = util.utils.getOfficeTemp((XMultiServiceFactory)tParam.getMSF());
64 log.println("Using: "+baseURL);
65 int loc = oObj.getFileProviderLocality(baseURL);
66 log.println("Getting: "+loc);
67 tRes.tested("getFileProviderLocality()",loc > 0);
70 /**
71 * Tries to convert URL of SOffice temp directory to system
72 * dependent path. <p>
73 * Has <b> OK </b> status if the method returns system dependent
74 * representation of the URL passed. <p>
76 public void _getSystemPathFromFileURL() {
77 String baseURL = util.utils.getOfficeTemp((XMultiServiceFactory)tParam.getMSF());
78 log.println("Using (Base): "+baseURL);
79 String sysURL = util.utils.getOfficeTempDirSys((XMultiServiceFactory)tParam.getMSF());
80 log.println("Using (System): "+sysURL);
81 String get = oObj.getSystemPathFromFileURL(baseURL);
82 log.println("Getting: "+get);
83 //sysURL = sysURL.substring(0,sysURL.length()-1);
84 tRes.tested("getSystemPathFromFileURL()",get.equals(sysURL));
87 /**
88 * Tries to convert system dependent path of SOffice temp
89 * directory to URL representation. <p>
90 * Has <b> OK </b> status if the method returns URL representation
91 * of the system dependent path passed. <p>
93 public void _getFileURLFromSystemPath() {
94 String baseURL = util.utils.getOfficeTemp((XMultiServiceFactory)tParam.getMSF());
95 log.println("Using (Base): "+baseURL);
96 String sysURL = util.utils.getOfficeTempDirSys((XMultiServiceFactory)tParam.getMSF());
97 log.println("Using (System): "+sysURL);
98 String get = oObj.getFileURLFromSystemPath(sysURL,sysURL);
99 log.println("Getting: "+get);
100 tRes.tested("getFileURLFromSystemPath()",get.equals(baseURL));