KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > retriever > RetrieverTest


1 /*
2  * RetrieverTest.java
3  * JUnit based test
4  *
5  * Created on August 16, 2006, 5:02 PM
6  */

7
8 package org.netbeans.modules.xml.retriever;
9
10 import junit.framework.*;
11 import java.io.IOException JavaDoc;
12 import java.net.URI JavaDoc;
13 import java.net.URISyntaxException JavaDoc;
14 import java.net.UnknownHostException JavaDoc;
15 import org.netbeans.modules.xml.retriever.catalog.Utilities;
16 import org.openide.filesystems.FileObject;
17 import org.openide.filesystems.FileUtil;
18
19 /**
20  *
21  * @author girix
22  */

23 public class RetrieverTest extends TestCase {
24     
25     public RetrieverTest(String JavaDoc testName) {
26         super(testName);
27     }
28     
29     protected void setUp() throws Exception JavaDoc {
30     }
31     
32     protected void tearDown() throws Exception JavaDoc {
33     }
34     
35     public static Test suite() {
36         TestSuite suite = new TestSuite(RetrieverTest.class);
37         
38         return suite;
39     }
40     
41     /**
42      * Test of getDefault method, of class org.netbeans.modules.xml.retriever.Retriever.
43      */

44     public void testGetDefault() throws URISyntaxException JavaDoc, UnknownHostException JavaDoc, IOException JavaDoc {
45         System.out.println("getDefault");
46         
47         Retriever expResult = null;
48         Retriever result = Retriever.getDefault();
49         //uncomment the following to test the retriever method
50
/*File destFolder = new File(System.getProperty("java.io.tmpdir")+File.separator+"RetrieverTest");
51         if(destFolder.isDirectory())
52             destFolder.renameTo(new File(destFolder.toString()+System.currentTimeMillis()));
53         destFolder.mkdirs();
54         URI catFileURI = null;
55         catFileURI = new URI(destFolder.toURI().toString() + "/catalogfile.xml");
56         FileObject dstFO = FileUtil.toFileObject(FileUtil.normalizeFile(destFolder));
57         
58         result.retrieveResource(dstFO, catFileURI, new URI("http://localhost:8084/grt/maindoc/UBL-Order-1.0"));
59          **/

60     }
61     
62     /**
63      * Test of getDefault method, of class org.netbeans.modules.xml.retriever.Retriever.
64      */

65     public void testRelativize() throws Exception JavaDoc {
66         System.out.println("getDefault");
67         URI JavaDoc masterURI = new URI JavaDoc("A/B/C");
68         URI JavaDoc slaveURI = new URI JavaDoc("A/B/C/D/E");
69         String JavaDoc result = Utilities.relativize(masterURI, slaveURI);
70         assert(result.equals("D/E"));
71     }
72     
73     
74 }
75
Popular Tags