Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / ucb / _XFileIdentifierConverter.java
blobfb947ffb6540b76202c7ff29ca1b0ae249a0e52e
1 /*
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 ifc.ucb;
21 import lib.MultiMethodTest;
23 import com.sun.star.ucb.XFileIdentifierConverter;
25 /**
26 * Testing <code>com.sun.star.ucb.XFileIdentifierConverter</code>
27 * interface methods :
28 * <ul>
29 * <li><code> getFileProviderLocality()</code></li>
30 * <li><code> getFileURLFromSystemPath()</code></li>
31 * <li><code> getSystemPathFromFileURL()</code></li>
32 * </ul> <p>
33 * Test is <b> NOT </b> multithread compliant. <p>
34 * @see com.sun.star.ucb.XFileIdentifierConverter
36 public class _XFileIdentifierConverter extends MultiMethodTest {
38 /**
39 * Contains the tested object.
41 public XFileIdentifierConverter oObj;
43 /**
44 * Gets the locality for SOffice temporary directory. <p>
45 * Has <b> OK </b> status if the method returns value greater
46 * than 0 (as office temp directory is supposed to be in the
47 * same location). <p>
49 public void _getFileProviderLocality() {
50 String baseURL = util.utils.getOfficeTemp(tParam.getMSF());
51 log.println("Using: "+baseURL);
52 int loc = oObj.getFileProviderLocality(baseURL);
53 log.println("Getting: "+loc);
54 tRes.tested("getFileProviderLocality()",loc > 0);
57 /**
58 * Tries to convert URL of SOffice temp directory to system
59 * dependent path. <p>
60 * Has <b> OK </b> status if the method returns system dependent
61 * representation of the URL passed. <p>
63 public void _getSystemPathFromFileURL() {
64 String baseURL = util.utils.getOfficeTemp(tParam.getMSF());
65 log.println("Using (Base): "+baseURL);
66 String sysURL = util.utils.getOfficeTempDirSys(tParam.getMSF());
67 log.println("Using (System): "+sysURL);
68 String get = oObj.getSystemPathFromFileURL(baseURL);
69 log.println("Getting: "+get);
70 //sysURL = sysURL.substring(0,sysURL.length()-1);
71 tRes.tested("getSystemPathFromFileURL()",get.equals(sysURL));
74 /**
75 * Tries to convert system dependent path of SOffice temp
76 * directory to URL representation. <p>
77 * Has <b> OK </b> status if the method returns URL representation
78 * of the system dependent path passed. <p>
80 public void _getFileURLFromSystemPath() {
81 String baseURL = util.utils.getOfficeTemp(tParam.getMSF());
82 log.println("Using (Base): "+baseURL);
83 String sysURL = util.utils.getOfficeTempDirSys(tParam.getMSF());
84 log.println("Using (System): "+sysURL);
85 String get = oObj.getFileURLFromSystemPath(sysURL,sysURL);
86 log.println("Getting: "+get);
87 tRes.tested("getFileURLFromSystemPath()",get.equals(baseURL));