1 22 package org.jboss.test.jaxr.scout.publish; 23 24 import org.jboss.test.jaxr.scout.JaxrBaseTestCase; 25 26 import javax.xml.registry.BulkResponse ; 27 import javax.xml.registry.JAXRException ; 28 import javax.xml.registry.JAXRResponse ; 29 import javax.xml.registry.infomodel.Key ; 30 import javax.xml.registry.infomodel.Organization ; 31 import java.util.ArrayList ; 32 import java.util.Collection ; 33 import java.util.Iterator ; 34 35 41 42 public class JaxrDeleteOrganizationTestCase extends JaxrBaseTestCase 43 { 44 45 public String saveOrg(String orgname) 46 { 47 String keyid = ""; 48 login(); 49 try 50 { 51 getJAXREssentials(); 52 Collection orgs = new ArrayList (); 53 Organization org = createOrganization("JBOSS"); 54 55 orgs.add(org); 56 BulkResponse br = blm.saveOrganizations(orgs); 57 if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) 58 { 59 if ("true".equalsIgnoreCase(debugProp)) 60 System.out.println("Organization Saved"); 61 Collection coll = br.getCollection(); 62 Iterator iter = coll.iterator(); 63 while (iter.hasNext()) 64 { 65 Key key = (Key ) iter.next(); 66 keyid = key.getId(); 67 if ("true".equalsIgnoreCase(debugProp)) 68 System.out.println("Saved Key=" + key.getId()); 69 assertNotNull(keyid); 70 } } else 72 { 73 System.err.println("JAXRExceptions " + 74 "occurred during save:"); 75 Collection exceptions = br.getExceptions(); 76 Iterator iter = exceptions.iterator(); 77 while (iter.hasNext()) 78 { 79 Exception e = (Exception ) iter.next(); 80 System.err.println(e.toString()); 81 fail(e.toString()); 82 } 83 } 84 } catch (JAXRException e) 85 { 86 e.printStackTrace(); 87 fail(e.getMessage()); 88 } 89 return keyid; 90 } 91 92 public void testDeleteOrgs() throws Exception 93 { 94 String keyid = this.saveOrg("DELETEORG"); 95 assertNotNull(keyid); 96 Key key = blm.createKey(keyid); 97 this.deleteOrganization(key); 98 } 99 } 100 | Popular Tags |