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 lib
.MultiMethodTest
;
23 import com
.sun
.star
.lang
.XMultiServiceFactory
;
24 import com
.sun
.star
.ucb
.XFileIdentifierConverter
;
27 * Testing <code>com.sun.star.ucb.XFileIdentifierConverter</code>
30 * <li><code> getFileProviderLocality()</code></li>
31 * <li><code> getFileURLFromSystemPath()</code></li>
32 * <li><code> getSystemPathFromFileURL()</code></li>
34 * Test is <b> NOT </b> multithread compilant. <p>
35 * @see com.sun.star.ucb.XFileIdentifierConverter
37 public class _XFileIdentifierConverter
extends MultiMethodTest
{
40 * Contains the tested object.
42 public XFileIdentifierConverter oObj
;
45 * Gets the locality for SOffice temporary directory. <p>
46 * Has <b> OK </b> status if the method returns value greater
47 * than 0 (as office temp directory is supposed to be in the
50 public void _getFileProviderLocality() {
51 String baseURL
= util
.utils
.getOfficeTemp((XMultiServiceFactory
)tParam
.getMSF());
52 log
.println("Using: "+baseURL
);
53 int loc
= oObj
.getFileProviderLocality(baseURL
);
54 log
.println("Getting: "+loc
);
55 tRes
.tested("getFileProviderLocality()",loc
> 0);
59 * Tries to convert URL of SOffice temp directory to system
61 * Has <b> OK </b> status if the method returns system dependent
62 * representation of the URL passed. <p>
64 public void _getSystemPathFromFileURL() {
65 String baseURL
= util
.utils
.getOfficeTemp((XMultiServiceFactory
)tParam
.getMSF());
66 log
.println("Using (Base): "+baseURL
);
67 String sysURL
= util
.utils
.getOfficeTempDirSys((XMultiServiceFactory
)tParam
.getMSF());
68 log
.println("Using (System): "+sysURL
);
69 String get
= oObj
.getSystemPathFromFileURL(baseURL
);
70 log
.println("Getting: "+get
);
71 //sysURL = sysURL.substring(0,sysURL.length()-1);
72 tRes
.tested("getSystemPathFromFileURL()",get
.equals(sysURL
));
76 * Tries to convert system dependent path of SOffice temp
77 * directory to URL representation. <p>
78 * Has <b> OK </b> status if the method returns URL representation
79 * of the system dependent path passed. <p>
81 public void _getFileURLFromSystemPath() {
82 String baseURL
= util
.utils
.getOfficeTemp((XMultiServiceFactory
)tParam
.getMSF());
83 log
.println("Using (Base): "+baseURL
);
84 String sysURL
= util
.utils
.getOfficeTempDirSys((XMultiServiceFactory
)tParam
.getMSF());
85 log
.println("Using (System): "+sysURL
);
86 String get
= oObj
.getFileURLFromSystemPath(sysURL
,sysURL
);
87 log
.println("Getting: "+get
);
88 tRes
.tested("getFileURLFromSystemPath()",get
.equals(baseURL
));