1 22 package org.jboss.test.jaxr.scout.query; 23 24 28 29 import java.util.ArrayList ; 30 import java.util.Collection ; 31 import java.util.Iterator ; 32 33 import org.jboss.test.jaxr.scout.JaxrBaseTestCase; 34 35 import javax.xml.registry.BulkResponse ; 36 import javax.xml.registry.JAXRException ; 37 import javax.xml.registry.JAXRResponse ; 38 import javax.xml.registry.infomodel.Key ; 39 import javax.xml.registry.infomodel.Organization ; 40 41 public class JaxrBusinessQueryTestCase extends JaxrBaseTestCase 42 { 43 protected String querystr = "JBOSS"; 44 45 private Key orgKey = null; 46 47 protected void setUp() throws Exception 48 { 49 super.setUp(); 50 String keyid = ""; 51 login(); 52 try 53 { 54 getJAXREssentials(); 55 Collection orgs = new ArrayList (); 56 Organization org = createOrganization("JBOSS"); 57 58 orgs.add(org); 59 BulkResponse br = blm.saveOrganizations(orgs); 60 if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) 61 { 62 Collection coll = br.getCollection(); 63 Iterator iter = coll.iterator(); 64 while (iter.hasNext()) 65 { 66 Key key = (Key ) iter.next(); 67 keyid = key.getId(); 68 assertNotNull(keyid); 69 orgKey = key; 70 } } else 72 { 73 Collection exceptions = br.getExceptions(); 74 Iterator iter = exceptions.iterator(); 75 while (iter.hasNext()) 76 { 77 Exception e = (Exception ) iter.next(); 78 fail(e.toString()); 79 } 80 } 81 } catch (JAXRException e) 82 { 83 e.printStackTrace(); 84 fail(e.getMessage()); 85 } 86 } 87 88 protected void tearDown() throws Exception 89 { 90 if(orgKey != null) 91 this.deleteOrganization(this.orgKey); 92 super.tearDown(); 93 } 94 95 public void testBusinessQuery() throws JAXRException 96 { 97 searchBusiness(querystr); 98 } 99 } 100 | Popular Tags |