1 19 20 package org.netbeans.modules.websvc.jaxws; 21 22 import java.io.File ; 23 import org.netbeans.junit.NbTestCase; 24 import org.netbeans.modules.websvc.jaxws.api.JAXWSSupport; 25 import org.netbeans.modules.websvc.jaxws.spi.JAXWSSupportProvider; 26 import org.openide.filesystems.FileObject; 27 import org.openide.filesystems.FileUtil; 28 import org.openide.filesystems.LocalFileSystem; 29 import org.openide.filesystems.Repository; 30 import org.openide.util.Lookup; 31 32 36 public class CustomJAXWSSupportProviderTest extends NbTestCase { 37 38 private FileObject datadir; 39 private FileObject ws; 40 private FileObject nows; 41 42 static { 43 CustomJAXWSSupportProviderTest.class.getClassLoader().setDefaultAssertionStatus(true); 44 } 45 46 47 public CustomJAXWSSupportProviderTest(String name) { 48 super(name); 49 } 50 51 protected void setUp() throws Exception { 52 super.setUp(); 53 File f = getWorkDir(); 54 assertTrue("work dir exists", f.exists()); 55 LocalFileSystem lfs = new LocalFileSystem (); 56 lfs.setRootDirectory (f); 57 Repository.getDefault ().addFileSystem (lfs); 58 datadir = FileUtil.toFileObject(f); 59 assertNotNull("no FileObject", datadir); 60 ws = datadir.createData("custom", "ws"); 61 assertNotNull("no ws FileObject", ws); 62 nows = datadir.createData("custom", "nows"); 63 assertNotNull("no ws FileObject", nows); 64 } 65 66 protected void tearDown() throws Exception { 67 super.tearDown(); 68 ws.delete(); 69 nows.delete(); 70 } 71 72 public void testProviders() throws Exception { 73 Lookup.Result<JAXWSSupportProvider> res = Lookup.getDefault().lookup(new Lookup.Template<JAXWSSupportProvider>(JAXWSSupportProvider.class)); 74 assertEquals("there should be 2 instances - one from websvc/jaxwsapi and one from tests", 2, res.allInstances ().size ()); 75 } 76 77 public void testGetJAXWSSupport() throws Exception { 78 JAXWSSupport ws1 = JAXWSSupport.getJAXWSSupport(ws); 79 assertNotNull("found ws support", ws1); 80 JAXWSSupport ws2 = JAXWSSupport.getJAXWSSupport(nows); 81 assertNull("not found ws support", ws2); 82 } 83 } 84 | Popular Tags |