01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05:
06: package com.sun.portal.search.db;
07:
08: import java.io.File;
09: import java.security.*;
10:
11: public class TestDbUtil {
12:
13: public static void main(String agrs[]) throws Exception {
14: System.out.println(DbUtil.absolute_path("/a/c"));
15: System.out.println(DbUtil.absolute_path("/a/c/"));
16: System.out.println(DbUtil.absolute_path("/"));
17: System.out.println(DbUtil.absolute_path("d:/a/c"));
18: System.out.println(DbUtil.absolute_path("d:/a/c/"));
19: System.out.println(DbUtil.absolute_path("d:/"));
20: System.out.println(DbUtil.absolute_path("d:\\a\\c"));
21: System.out.println(DbUtil.absolute_path("d:\\a\\c\\"));
22: System.out.println(DbUtil.absolute_path("d:\\"));
23: System.out.println(DbUtil.absolute_path("d:a\\c"));
24: System.out.println(DbUtil.absolute_path("d:a\\c\\"));
25: System.out.println(DbUtil.absolute_path("d:"));
26: System.out.println(DbUtil.absolute_path("d:a/b"));
27: System.out.println(DbUtil.absolute_path("c:a/b"));
28: System.out.println(DbUtil.path2directory("/a/c"));
29: System.out.println(DbUtil.path2directory("/a/c/"));
30: System.out.println(DbUtil.path2directory("/"));
31: System.out.println(DbUtil.path2directory("d:/a/c"));
32: System.out.println(DbUtil.path2directory("d:/a/c/"));
33: System.out.println(DbUtil.path2directory("d:/"));
34: System.out.println(DbUtil.path2directory("d:\\a\\c"));
35: System.out.println(DbUtil.path2directory("d:\\a\\c\\"));
36: System.out.println(DbUtil.path2directory("d:\\"));
37: System.out.println(DbUtil.path2directory("d:a\\c"));
38: System.out.println(DbUtil.path2directory("d:a\\c\\"));
39: System.out.println(DbUtil.path2directory("d:"));
40: System.out.println(DbUtil.path2directory("d:a/b"));
41: System.out.println(DbUtil.path2directory("c:a/b"));
42: System.out.println(DbUtil.path2directory("c:/a/b/c/xx"));
43: System.out.println(new File("d:\\a", "b"));
44: System.out.println(new File("d:\\a", "c:\\b"));
45: System.out.println(new File("d:\\a", "c\\b"));
46: System.out.println(new File("d:\\a", "\\c\\b"));
47: System.out.println("\nrelative_path");
48: System.out.println(DbUtil.relative_path("d:\\a", "b"));
49: System.out.println(DbUtil.relative_path("d:\\a", "c:\\b"));
50: System.out.println(DbUtil.relative_path("d:/a", "c\\b"));
51: System.out.println(DbUtil.relative_path("d:\\a", "\\c\\b"));
52: System.out.println(DbUtil.relative_path("\\a", "b"));
53: System.out.println(DbUtil.relative_path("\\a", "c:\\b"));
54: System.out.println(DbUtil.relative_path("\\a", "c\\b"));
55: System.out.println(DbUtil.relative_path("\\a", "\\c\\b"));
56: System.out.println(DbUtil.relative_path("a", "c\\b"));
57: System.out.println(DbUtil.relative_path("a", "\\c\\b"));
58: System.out.println("\nabsolute_path");
59: System.out.println(DbUtil.absolute_path("d:\\a", "b"));
60: System.out.println(DbUtil.absolute_path("d:\\a", "c:\\b"));
61: System.out.println(DbUtil.absolute_path("d:/a", "c\\b"));
62: System.out.println(DbUtil.absolute_path("d:\\a", "\\c\\b"));
63: System.out.println(DbUtil.absolute_path("\\a", "b"));
64: System.out.println(DbUtil.absolute_path("\\a", "c:\\b"));
65: System.out.println(DbUtil.absolute_path("\\a", "c\\b"));
66: System.out.println(DbUtil.absolute_path("\\a", "\\c\\b"));
67: System.out.println(DbUtil.absolute_path("/a", "c:\\b"));
68: System.out.println(DbUtil.absolute_path("/a", "c:/b"));
69: System.out.println(DbUtil.absolute_path("\\a", "c/b"));
70: System.out.println(DbUtil.absolute_path("/a/", "/c\\b"));
71: System.out.println(DbUtil.absolute_path("a", "c/b"));
72: System.out.println(DbUtil.absolute_path("a", "/c\\b"));
73: System.out.println(DbUtil.absolute_path("a", "\\c\\b"));
74: System.out.println(DbUtil.absolute_path("", "/c\\b"));
75: System.out.println(new File("/c\\b").isAbsolute());
76: File f = new File("\\c\\b");
77: System.out.println(new File("\\c\\b").isAbsolute());
78: //System.out.println(absolute_path(null, "/c\\b"));
79: }
80:
81: }
|