1 /* 2 * $Header: /cvsroot/ebxmlrr/ebxmlrr/test/com/sun/ebxml/registry/conformance/SetConformanceTests.java,v 1.9 2002/12/27 13:32:54 ritzmann Exp $ 3 */ 4 package com.sun.ebxml.registry.conformance; 5 6 import junit.framework.*; 7 import com.sun.ebxml.registry.interfaces.soap.*; 8 import javax.xml.soap.*; 9 import java.io.*; 10 11 /*** 12 * Set of Preliminary OASIS/ebXML Registry Test Plan and Test Requirements 13 * 14 * PHASE I: Test setup and initialisation 15 * 16 * Use following properties to configure parameters: 17 * 18 * jaxr.sample.dir = directory of NIST test files 19 * jaxr.sample.result = directory where result files will be stored 20 * 21 * 22 * @author Michal Zaremba 23 */ 24 public class SetConformanceTests extends TestCase { 25 26 private static String url = null; 27 28 private SOAPSender sender; 29 private SOAPMessage reply; 30 private TestSupport supportMethods; 31 32 /*** 33 * Constructs a SetNISTTest with the specified name 34 * 35 * @param name Test case name 36 */ 37 public SetConformanceTests(String name) { 38 super(name); 39 supportMethods = new TestSupport(); 40 // Delete old raport 41 supportMethods.deleteRaport("raport.txt"); 42 try { 43 sender = supportMethods.connectRegistry(url); 44 } catch (Exception e) { 45 e.printStackTrace(); 46 fail("Tests failed during Set up phase"); 47 } 48 } 49 50 /*** 51 * Sets up the text fixture. 52 * 53 * Called before every test case method. 54 */ 55 56 protected void tearDown() throws Exception { 57 System.gc(); 58 } 59 60 /*** 61 * TEST I 62 * 63 * 2.3 REGISTRATION AUTHORITY 64 * 65 * Creation of a Registration Authority for the Registry 66 * 67 * Submision one XML Organisation element and exactly one XML User 68 * 69 */ 70 public void testSubmitRA() { 71 try { 72 supportMethods.printMessage("SUBMIT REGISTRATION AUTHORITY"); 73 supportMethods.submitFileToRegistry(sender, "SubmitRA.xml"); 74 } catch(Exception e) { 75 e.printStackTrace(); 76 fail("Exception has been thrown in 2.3 durign Registration Authority"); 77 } 78 } 79 80 /*** 81 * TEST II 82 * 83 * 2.4 SUBMITTING ORGANISATIONS 84 * 85 * Create two submitting organisations with the names: 86 * 87 * SubmitOrgFrequent and SubmitOrgParent 88 * 89 */ 90 public void testSubmitOrg() { 91 try { 92 /*** 93 * Submit First Organisation - SubmitOrgFrequent 94 */ 95 supportMethods.printMessage("SUBMIT ORGANISATION - SubmitOrgFrequent"); 96 supportMethods.submitFileToRegistry(sender, "SubmitSOF.xml"); 97 /*** 98 * Submit Second Organisation - SubmitOrgParent 99 */ 100 supportMethods.printMessage("SUBMIT ORGANISATION - SubmitOrgParent"); 101 supportMethods.submitFileToRegistry(sender, "SubmitSOP.xml"); 102 } catch(Exception e) { 103 e.printStackTrace(); 104 fail("Exception has been thrown in 2.4 during Submitting Organisations"); 105 } 106 } 107 108 /*** 109 * TEST III 110 * 111 * 2.5 CHILD ORGANISATION 112 * 113 * Create a new organisation that reference an existing organisation as its parent 114 * 115 * Determine 128 bit UUID for SubmitOrgParent and after SubmitSOC 116 * 117 */ 118 public void testChildOrganisation() { 119 try { 120 /* 121 * Determine 128 bit UUID generated by the Registry 122 * for SubmitOrgParent 123 */ 124 supportMethods.printMessage("DETERMINE UUID FROM SubmitOrgParent"); 125 reply = supportMethods.submitFileToRegistry(sender, "FindSOP128bitUUID.xml"); 126 String UUID = supportMethods.getAttributeValue(reply, "ObjectRef", "id"); 127 supportMethods.setUUIDInFile(UUID, "SOP128bitUUID", "SubmitSOC.xml"); 128 /*** 129 * Submit Child Organisation - SubmitOrgChild 130 * New file New_SubmitSOC.xml will be submitted to registry 131 */ 132 supportMethods.printMessage("SUBMIT CHILD ORGANISATION - SubmitOrgChild"); 133 supportMethods.submitFileToRegistry(sender, "SubmitSOC_new.xml"); 134 /*** 135 * Delete temporary file New_SubmitSOC.xml from the hard drive 136 */ 137 //File file = new File(conforDir + sysSeparator + "SubmitSOC_new.xml"); 138 //file.delete(); 139 } catch(IOException ioe) { 140 ioe.printStackTrace(); 141 fail("IOException in testChildOrganisation Test"); 142 143 } catch(Exception e) { 144 e.printStackTrace(); 145 fail("Exception has been thrown in 2.5 during submitting Child organisation"); 146 } 147 } 148 149 /*** 150 * TEST IV 151 * 152 * 2.6 RESPONSIBLE ORGANISATIONS 153 * 154 * Submit ResponsibleOrg 155 * 156 */ 157 public void testSubmitResponsibleOrg() { 158 try { 159 supportMethods.printMessage("SUBMIT RESPONSIBLE ORGANISATION - ResponsibleOrg"); 160 supportMethods.submitFileToRegistry(sender, "SubmitRORG.xml"); 161 } catch(Exception e) { 162 e.printStackTrace(); 163 fail("Exception has been thrown in 2.6 during Submitting Responsible Organisation"); 164 } 165 } 166 167 /*** 168 * TEST V 169 * 170 * 2.7 ADDITIONAL USERS 171 * 172 * 173 * Determine 128 bit UUID for SubmitOrgFrequent and after SubmitSOC2nd 174 * 175 */ 176 public void testAdditionalUsers() { 177 try { 178 /* 179 * Determine 128 bit UUID generated by the Registry 180 * for SubmitOrgFrequent and set it in file SubmitSOF2nd.xml 181 */ 182 supportMethods.printMessage("DETERMINE UUID FROM SubmitOrgFrequent"); 183 reply = supportMethods.submitFileToRegistry(sender, "FindSOF128bitUUID.xml"); 184 String UUID = supportMethods.getAttributeValue(reply, "ObjectRef", "id"); 185 supportMethods.setUUIDInFile(UUID, "SOF128bitUUID", "SubmitSOF2nd.xml"); 186 /*** 187 * Create a second user for SubmitOrgFrequent 188 * File New_SubmitSOF2nd.xml will be submitted to registry 189 */ 190 supportMethods.printMessage("CREATE A SECOND USER FOR SubmitOrgFrequent"); 191 supportMethods.submitFileToRegistry(sender, "SubmitSOF2nd_new.xml"); 192 /*** 193 * Delete temporary file New_SubmitSOF2nd.xml from the hard drive 194 */ 195 //File file = new File(conforDir + sysSeparator + "SubmitSOF2nd_new.xml"); 196 //file.delete(); 197 } catch(IOException ioe) { 198 ioe.printStackTrace(); 199 fail("IOException in testAdditionalUser Test"); 200 } catch(Exception e) { 201 e.printStackTrace(); 202 fail("Exception has been thrown in 2.7 during submitting additional users"); 203 } 204 } 205 206 /* public void testRemoveObjects() { 207 try { 208 submitFileToRegistry("FindUUIDStandard.xml"); 209 System.out.println(supportMethods.getAttributeValue(reply, "ObjectRef", "id")); 210 submitFileToRegistry("RemoveObject.xml"); 211 } catch(Exception e) { 212 e.printStackTrace(); 213 fail("Exception has been thrown during removing old objects from registry"); 214 } 215 }*/ 216 217 /*** 218 * Add tests to the suite 219 */ 220 public static Test suite() { 221 TestSuite suite = new TestSuite(); 222 suite.addTest(new SetConformanceTests("testSubmitRA")); 223 suite.addTest(new SetConformanceTests("testSubmitOrg")); 224 suite.addTest(new SetConformanceTests("testChildOrganisation")); 225 suite.addTest(new SetConformanceTests("testSubmitResponsibleOrg")); 226 suite.addTest(new SetConformanceTests("testAdditionalUsers")); 227 // suite.addTest(new SetConformanceTests("testRemoveObjects")); 228 return suite; 229 } 230 231 public void runMyTests() { 232 TestSuite suite = new TestSuite(); 233 suite.addTest(suite()); 234 TestResult result = new TestResult(); 235 suite.run(result); 236 supportMethods.processResults("Test Setup and initialisation", result); 237 } 238 239 public static void main(String[] args) { 240 SetConformanceTests test = new SetConformanceTests("SetConformanceTests"); 241 url = TestSupport.getURL(args); 242 test.runMyTests(); 243 } 244 }

This page was automatically generated by Maven