01: /*
02: * BEGIN_HEADER - DO NOT EDIT
03: *
04: * The contents of this file are subject to the terms
05: * of the Common Development and Distribution License
06: * (the "License"). You may not use this file except
07: * in compliance with the License.
08: *
09: * You can obtain a copy of the license at
10: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
11: * See the License for the specific language governing
12: * permissions and limitations under the License.
13: *
14: * When distributing Covered Code, include this CDDL
15: * HEADER in each file and include the License file at
16: * https://open-esb.dev.java.net/public/CDDLv1.0.html.
17: * If applicable add the following below this CDDL HEADER,
18: * with the fields enclosed by brackets "[]" replaced with
19: * your own identifying information: Portions Copyright
20: * [year] [name of copyright owner]
21: */
22:
23: /*
24: * @(#)TestDirectoryUtil.java
25: * Copyright 2004-2007 Sun Microsystems, Inc. All Rights Reserved.
26: *
27: * END_HEADER - DO NOT EDIT
28: */
29: package com.sun.jbi.management.internal.support;
30:
31: import com.sun.jbi.management.util.FileHelper;
32:
33: import java.io.File;
34: import java.io.FileInputStream;
35:
36: public class TestJarFactory extends junit.framework.TestCase {
37: private final static String TEST_ROOT = System
38: .getProperty("junit.srcroot")
39: + "/runtime/manage/bld/test-classes/jar-tmp";
40:
41: private final static String SRC_JAR = System
42: .getProperty("junit.srcroot")
43: + "/runtime/manage/regress/testdata/jmsbinding.jar";
44:
45: private final static String DST_JAR = TEST_ROOT + File.separator
46: + "\u4e2d\u6587\u76ee\u5f55.jar";
47:
48: private File mTestRoot;
49:
50: public TestJarFactory(String aTestName) throws Exception {
51: super (aTestName);
52: mTestRoot = new File(TEST_ROOT);
53:
54: if (!mTestRoot.exists()) {
55: mTestRoot.mkdir();
56: }
57:
58: }
59:
60: public void setUp() throws Exception {
61: super .setUp();
62:
63: // -- Copy the service assembly zip to the test root and
64: // rename it to "\u4e2d\u6587\u76ee\u5f55.jar"
65: FileHelper.fileCopy(SRC_JAR, DST_JAR, true);
66:
67: }
68:
69: public void tearDown() throws Exception {
70: // Cleanup the test folder
71: FileHelper.cleanDirectory(mTestRoot);
72: }
73:
74: /**
75: * Test extracting an archive which has ideographic characters in its name.
76: */
77: public void testUnJar() throws Exception {
78: JarFactory jf = new JarFactory(TEST_ROOT);
79: //String fileName = "D:\\nikita\\dev\\jsr208\\jbinew\\open-esb\\install\\as8\\domains\\CAS\\jbi\\service-assemblies\\CompositeApp1\\CompositeApp1-\u4e2d\u6587\u76ee\u5f55\\\u4e2d\u6587\u76ee\u5f55.jar";
80: File file = new File(DST_JAR);
81: jf.unJar(file);
82:
83: // Verify
84: File descrFile = new File(TEST_ROOT + "/META-INF/jbi.xml");
85: assertTrue(descrFile.exists());
86: }
87:
88: }
|