1 7 8 package org.netbeans.modules.xml.wsdl.model.spi; 9 10 import java.util.Map ; 11 import javax.xml.namespace.QName ; 12 import junit.framework.*; 13 import org.netbeans.modules.xml.wsdl.model.Definitions; 14 import org.netbeans.modules.xml.wsdl.model.TestCatalogModel; 15 import org.netbeans.modules.xml.wsdl.model.Types; 16 import org.netbeans.modules.xml.wsdl.model.Util; 17 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 18 19 23 public class WSDLComponentBaseTest extends TestCase { 24 25 public WSDLComponentBaseTest(String testName) { 26 super(testName); 27 } 28 29 protected void setUp() throws Exception { 30 } 31 32 protected void tearDown() throws Exception { 33 TestCatalogModel.getDefault().clearDocumentPool(); 34 } 35 36 public static Test suite() { 37 TestSuite suite = new TestSuite(WSDLComponentBaseTest.class); 38 39 return suite; 40 } 41 42 public void testRemoveDocumentation() throws Exception { 43 WSDLModel model = Util.loadWSDLModel("resources/HelloService.wsdl"); 44 Definitions definitions = model.getDefinitions(); 45 Types types = definitions.getTypes(); 46 assertEquals("testing remove documentation", types.getDocumentation().getContentFragment()); 47 model.startTransaction(); 48 types.setDocumentation(null); 49 model.endTransaction(); 50 assertNull(types.getDocumentation()); 51 } 52 53 public void testGetAttributeMap() throws Exception { 54 WSDLModel model = Util.loadWSDLModel("resources/HelloService.wsdl"); 55 Definitions definitions = model.getDefinitions(); 56 57 Map <QName ,String > map = definitions.getAttributeMap(); 58 assertEquals(2, map.keySet().size()); 59 assertEquals( "HelloService", map.get(new QName ("name"))); 60 assertEquals("urn:HelloService/wsdl", map.get(new QName ("targetNamespace"))); 61 } 62 } 63 | Popular Tags |