1 19 20 package org.netbeans.modules.websvc.api; 21 22 import java.io.File ; 23 import org.netbeans.junit.NbTestCase; 24 import org.netbeans.modules.websvc.api.client.WebServicesClientView; 25 import org.netbeans.modules.websvc.spi.client.WebServicesClientViewProvider; 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 CustomWebServicesClientViewProviderTest extends NbTestCase { 37 38 private FileObject datadir; 39 private FileObject ws; 40 private FileObject nows; 41 42 static { 43 CustomWebServicesClientViewProviderTest.class.getClassLoader().setDefaultAssertionStatus(true); 44 } 45 46 47 public CustomWebServicesClientViewProviderTest(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 res = Lookup.getDefault().lookup(new Lookup.Template(WebServicesClientViewProvider.class)); 74 assertEquals("there should be 1 instance - from websvc/clientapi", 1, res.allInstances().size()); 75 } 76 77 public void testGetWebServicesClientView() { 78 WebServicesClientView view = WebServicesClientView.getWebServicesClientView(ws); 79 assertNotNull("found view support", view); 80 WebServicesClientView view2 = WebServicesClientView.getWebServicesClientView(nows); 81 assertNull("no found view support", view2); 82 } 83 84 } 85 | Popular Tags |