1 19 20 26 27 package org.netbeans.modules.xml.wsdl.ui.property.model; 28 29 import javax.xml.namespace.QName ; 30 import junit.framework.*; 31 import org.netbeans.modules.xml.wsdl.ui.TestLookup; 32 import org.openide.filesystems.XMLFileSystem; 33 import org.openide.util.Lookup; 34 35 36 40 public class PropertyModelFactoryTest extends TestCase { 41 42 static { 43 try { 44 System.setProperty("org.openide.util.Lookup", TestLookup.class.getName()); 45 Lookup l = Lookup.getDefault(); 46 if(l instanceof TestLookup) { 47 XMLFileSystem x = new XMLFileSystem(PropertyModelFactoryTest.class.getResource("/org/netbeans/modules/wsdlextensions/jms/resources/layer.xml")); 48 49 ((TestLookup) l).setup(x); 50 } 51 } catch(Exception ex) { 52 ex.printStackTrace(); 53 } 54 } 55 56 public PropertyModelFactoryTest(String testName) { 57 super(testName); 58 } 59 60 protected void setUp() throws Exception { 61 } 62 63 protected void tearDown() throws Exception { 64 } 65 66 public void testGetInstance() throws Exception { 67 PropertyModelFactory instance = PropertyModelFactory.getInstance(); 68 assertNotNull(instance); 69 } 70 71 public void testGetElementProperties() throws Exception { 72 PropertyModelFactory instance = PropertyModelFactory.getInstance(); 73 74 QName messageQName = new QName ("http://schemas.sun.com/jbi/wsdl-extensions/jms/", "message"); 75 ElementProperties ep = instance.getElementProperties(messageQName); 76 assertNotNull(ep); 77 78 PropertyGroup[] pg = ep.getPropertyGroup(); 79 assertNotNull(pg); 80 assertTrue(pg.length == 2); 81 assertTrue(pg[0].getName().equals("basic")); 82 assertTrue(pg[0].getGroupOrder() == 1); 83 assertTrue(pg[1].getName().equals("advance")); 84 assertTrue(pg[1].getGroupOrder() == 2); 85 86 87 Property[] p = ep.getProperty(); 88 assertNotNull(p); 89 assertTrue(p.length == 1); 90 assertTrue(p[0].getAttributeName().equals("correlationIdPart")); 91 assertTrue(p[0].getGroupName().equals("basic")); 92 assertTrue(p[0].getPropertyOrder() == 1); 93 94 95 } 96 } 97 | Popular Tags |