KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > extensibility > model > WSDLExtensibilityElementsFactoryTest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xml.wsdl.ui.extensibility.model;
21 import java.util.List JavaDoc;
22 import javax.xml.namespace.QName JavaDoc;
23 import junit.framework.*;
24 import org.netbeans.modules.xml.wsdl.ui.TestLookup;
25 import org.netbeans.modules.xml.wsdl.ui.extensibility.model.impl.WSDLExtensibilityElementsFactoryImpl;
26 import org.openide.filesystems.Repository;
27 import org.openide.filesystems.XMLFileSystem;
28 import org.openide.modules.ModuleInfo;
29 import org.openide.util.Lookup;
30 import org.openide.util.NbBundle;
31 /*
32  * WSDLExtensibilityElementsFactoryTest.java
33  * JUnit based test
34  *
35  * Created on January 22, 2007, 11:58 AM
36  */

37
38 /**
39  *
40  * @author radval
41  */

42 public class WSDLExtensibilityElementsFactoryTest extends TestCase {
43     
44     static {
45         try {
46            System.setProperty("org.openide.util.Lookup", TestLookup.class.getName());
47            Lookup l = Lookup.getDefault();
48            if(l instanceof TestLookup) {
49                XMLFileSystem x = new XMLFileSystem(WSDLExtensibilityElementsFactoryTest.class.getResource("/org/netbeans/modules/wsdlextensions/dummy/resources/layer.xml"));
50               
51                ((TestLookup) l).setup(x);
52            }
53         } catch(Exception JavaDoc ex) {
54             ex.printStackTrace();
55         }
56     }
57
58     public WSDLExtensibilityElementsFactoryTest(String JavaDoc testName) {
59         super(testName);
60     }
61
62     protected void setUp() throws Exception JavaDoc {
63     }
64
65     protected void tearDown() throws Exception JavaDoc {
66     }
67
68     /**
69      * Test of getInstance method, of class org.netbeans.modules.xml.wsdl.ui.extensibility.model.WSDLExtensibilityElementsFactory.
70      */

71     public void testGetInstance() throws Exception JavaDoc {
72         System.out.println("getInstance");
73         
74         WSDLExtensibilityElementsFactory result = WSDLExtensibilityElementsFactory.getInstance();
75         assertNotNull(result);
76
77     }
78
79     /**
80      * Test of getWSDLExtensibilityElements method, of class org.netbeans.modules.xml.wsdl.ui.extensibility.model.WSDLExtensibilityElementsFactory.
81      */

82     public void testGetWSDLExtensibilityElements() throws Exception JavaDoc {
83         System.out.println("getWSDLExtensibilityElements");
84         
85         WSDLExtensibilityElementsFactory instance = WSDLExtensibilityElementsFactory.getInstance();
86         WSDLExtensibilityElements result = instance.getWSDLExtensibilityElements();
87         assertNotNull(result);
88         
89         assertNotNull(result.getAllExtensionSchemas());
90         assertNotNull(result.getAllExtensionSchemas().length == 0);
91     }
92     
93     public void testBinding() throws Exception JavaDoc {
94         WSDLExtensibilityElementsFactory instance = WSDLExtensibilityElementsFactory.getInstance();
95         WSDLExtensibilityElements result = instance.getWSDLExtensibilityElements();
96         
97         //binding
98
WSDLExtensibilityElement bindingElement = result.getWSDLExtensibilityElement(WSDLExtensibilityElements.ELEMENT_BINDING);
99         assertNull(bindingElement);
100     }
101     
102     public void testBindingOperation() throws Exception JavaDoc {
103         WSDLExtensibilityElementsFactory instance = WSDLExtensibilityElementsFactory.getInstance();
104         WSDLExtensibilityElements result = instance.getWSDLExtensibilityElements();
105         
106         //binding operation
107
WSDLExtensibilityElement bindingOperationElement = result.getWSDLExtensibilityElement(WSDLExtensibilityElements.ELEMENT_BINDING_OPERATION);
108         assertNull(bindingOperationElement);
109     }
110     
111     public void testBindingOpearationInput() throws Exception JavaDoc {
112         WSDLExtensibilityElementsFactory instance = WSDLExtensibilityElementsFactory.getInstance();
113         WSDLExtensibilityElements result = instance.getWSDLExtensibilityElements();
114         
115         //binding operation input
116
WSDLExtensibilityElement bindingOperationInputElement = result.getWSDLExtensibilityElement(WSDLExtensibilityElements.ELEMENT_BINDING_OPERATION_INPUT);
117         assertNull(bindingOperationInputElement);
118     }
119     
120     public void testBindingOperationOutput() throws Exception JavaDoc {
121         WSDLExtensibilityElementsFactory instance = WSDLExtensibilityElementsFactory.getInstance();
122         WSDLExtensibilityElements result = instance.getWSDLExtensibilityElements();
123         
124         //binding operation output
125
WSDLExtensibilityElement bindingOperationOutputElement = result.getWSDLExtensibilityElement(WSDLExtensibilityElements.ELEMENT_BINDING_OPERATION_OUTPUT);
126         assertNull(bindingOperationOutputElement);
127     }
128     
129     public void testBindingOperationFault() throws Exception JavaDoc {
130         WSDLExtensibilityElementsFactory instance = WSDLExtensibilityElementsFactory.getInstance();
131         WSDLExtensibilityElements result = instance.getWSDLExtensibilityElements();
132         
133         //binding operation fault
134
WSDLExtensibilityElement bindingOperationFaultElement = result.getWSDLExtensibilityElement(WSDLExtensibilityElements.ELEMENT_BINDING_OPERATION_FAULT);
135         assertNull(bindingOperationFaultElement);
136
137     }
138     
139     public void testServicePort() throws Exception JavaDoc {
140         WSDLExtensibilityElementsFactory instance = WSDLExtensibilityElementsFactory.getInstance();
141         WSDLExtensibilityElements result = instance.getWSDLExtensibilityElements();
142         
143         //binding operation output
144
WSDLExtensibilityElement servicePortElement = result.getWSDLExtensibilityElement(WSDLExtensibilityElements.ELEMENT_SERVICE_PORT);
145         assertNull(servicePortElement);
146         
147     }
148 }
149
Popular Tags