KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > model > spi > WSDLComponentBaseTest


1 /*
2  * WSDLComponentBaseTest.java
3  * JUnit based test
4  *
5  * Created on March 25, 2006, 5:23 AM
6  */

7
8 package org.netbeans.modules.xml.wsdl.model.spi;
9
10 import java.util.Map JavaDoc;
11 import javax.xml.namespace.QName JavaDoc;
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 /**
20  *
21  * @author nn136682
22  */

23 public class WSDLComponentBaseTest extends TestCase {
24     
25     public WSDLComponentBaseTest(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         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 JavaDoc {
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 JavaDoc {
54         WSDLModel model = Util.loadWSDLModel("resources/HelloService.wsdl");
55         Definitions definitions = model.getDefinitions();
56         
57         Map JavaDoc<QName JavaDoc,String JavaDoc> map = definitions.getAttributeMap();
58         assertEquals(2, map.keySet().size());
59         assertEquals( "HelloService", map.get(new QName JavaDoc("name")));
60         assertEquals("urn:HelloService/wsdl", map.get(new QName JavaDoc("targetNamespace")));
61     }
62 }
63
Popular Tags