ws-scout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r592155 - in /webservices/scout/trunk/scout/src: main/java/org/apache/ws/scout/registry/ test/java/org/apache/ws/scout/registry/ test/java/org/apache/ws/scout/registry/qa/
Date Mon, 05 Nov 2007 21:17:45 GMT
Author: kstam
Date: Mon Nov  5 13:17:41 2007
New Revision: 592155

URL: http://svn.apache.org/viewvc?rev=592155&view=rev
Log:
SCOUT-52 refactoring and adding unittests

Added:
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020ConceptTest.java
      - copied, changed from r591877, webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java
Removed:
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java
Modified:
    webservices/scout/trunk/scout/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java

Modified: webservices/scout/trunk/scout/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java?rev=592155&r1=592154&r2=592155&view=diff
==============================================================================
--- webservices/scout/trunk/scout/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
(original)
+++ webservices/scout/trunk/scout/src/main/java/org/apache/ws/scout/registry/BusinessLifeCycleManagerImpl.java
Mon Nov  5 13:17:41 2007
@@ -253,7 +253,7 @@
             bd = (PublisherAssertions) executeOperation(sarr, "SAVE_ASSOCIATION");
         }
         catch (RegistryException e) {
-            exceptions.add(new SaveException(e.getLocalizedMessage()));
+            exceptions.add(new SaveException(e));
             bulk.setExceptions(exceptions);
             bulk.setStatus(JAXRResponse.STATUS_FAILURE);
             return bulk;

Modified: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java?rev=592155&r1=592154&r2=592155&view=diff
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java
(original)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java
Mon Nov  5 13:17:41 2007
@@ -10,10 +10,14 @@
 import javax.xml.registry.JAXRException;
 import javax.xml.registry.JAXRResponse;
 import javax.xml.registry.RegistryService;
+import javax.xml.registry.infomodel.Association;
 import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.InternationalString;
 import javax.xml.registry.infomodel.Key;
 import javax.xml.registry.infomodel.Organization;
 import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
 
 import junit.framework.JUnit4TestAdapter;
 
@@ -134,6 +138,100 @@
             fail(je.getMessage());
         }
     }
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    public void saveDeleteServiceBindings() 
+    {
+        login();
+       
+        try {
+            RegistryService rs = connection.getRegistryService();
+            blm = rs.getBusinessLifeCycleManager();
+            Creator creator = new Creator(blm);
+            Collection<Organization> orgs = new ArrayList<Organization>();
+            Organization organization = creator.createOrganization(this.getClass().getName());
+            orgs.add(organization);
+//          save the Organization
+            BulkResponse br = blm.saveOrganizations(orgs);
+            assertEquals(JAXRResponse.STATUS_SUCCESS, br.getStatus());
+            organization.setKey((Key)br.getCollection().iterator().next());
+            
+            Service service = creator.createService(this.getClass().getName());
+            ArrayList<Service> services = new ArrayList<Service>();
+            organization.addService(service);
+            services.add(service);
+            //save service
+            BulkResponse br2 = blm.saveServices(services);
+            assertEquals(BulkResponse.STATUS_SUCCESS, br2.getStatus());
+            
+            service.setKey((Key)br2.getCollection().iterator().next());
+            
+            //save serviceBinding
+            ServiceBinding serviceBinding = creator.createServiceBinding();
+            service.addServiceBinding(serviceBinding);
+            ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
+            serviceBindings.add(serviceBinding);
+            BulkResponse br5 = blm.saveServiceBindings(serviceBindings);
+            assertEquals(BulkResponse.STATUS_SUCCESS, br5.getStatus());
+            
+            //remove serviceBindings
+            BulkResponse br6 = blm.deleteServiceBindings((Collection<Key>)br5.getCollection());
+            assertEquals(BulkResponse.STATUS_SUCCESS, br6.getStatus());
+            
+            //remove service
+            BulkResponse br3 = blm.deleteServices((Collection<Key>)br2.getCollection());
+            assertEquals(BulkResponse.STATUS_SUCCESS, br3.getStatus());
+            //remove organization
+            BulkResponse br4 = blm.deleteOrganizations((Collection<Key>)br.getCollection());
+            assertEquals(JAXRResponse.STATUS_SUCCESS, br4.getStatus());
+        } catch (JAXRException je) {
+            fail(je.getMessage());
+        }
+    }
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    public void saveDeleteConcepts() 
+    {
+        login();
+        try {
+            RegistryService rs = connection.getRegistryService();
+            blm = rs.getBusinessLifeCycleManager();
+            Collection<Concept> concepts = new ArrayList<Concept>();
+            Concept concept = blm.createConcept(null, "TestConcept", "");
+            InternationalString is = blm.createInternationalString("This is the concept for
Apache Scout Test");
+            concept.setDescription(is);
+            concepts.add(concept);
+
+            BulkResponse br = blm.saveConcepts(concepts);
+            assertEquals(BulkResponse.STATUS_SUCCESS, br.getStatus());
+            
+            BulkResponse br2 = blm.deleteConcepts((Collection<Key>)br.getCollection());
+            assertEquals(BulkResponse.STATUS_SUCCESS, br2.getStatus());
+        } catch (JAXRException je) {
+            fail(je.getMessage());
+        }
+    }
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    public void saveDeleteAssociations() 
+    {
+        login();
+        try {
+            RegistryService rs = connection.getRegistryService();
+            blm = rs.getBusinessLifeCycleManager();
+            Collection<Association> associations = new ArrayList<Association>();
+            //Association association = blm.createAssociation(targetObject, Association.);
+            
+        } catch (JAXRException je) {
+            fail(je.getMessage());
+        }
+    }
+    
+    
+        
         
             
             
@@ -141,15 +239,7 @@
     
 //    BulkResponse deleteAssociations(Collection<Key> associationKeys) throws JAXRException;
 //
-//    BulkResponse deleteConcepts(Collection<Key> conceptKeys) throws JAXRException;
-//
-//    BulkResponse deleteServiceBindings(Collection<Key> bindingKeys) throws JAXRException;
-//
 //    BulkResponse saveAssociations(Collection<Association> associations, boolean replace)
throws JAXRException;
-//
-//    BulkResponse saveConcepts(Collection<Concept> concepts) throws JAXRException;
 
-//
-//    BulkResponse saveServiceBindings(Collection<ServiceBinding> bindings) throws
JAXRException;
 //
 //    void unConfirmAssociation(Association assoc) throws JAXRException, InvalidRequestException;
     

Copied: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020ConceptTest.java
(from r591877, webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java)
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020ConceptTest.java?p2=webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020ConceptTest.java&p1=webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java&r1=591877&r2=592155&rev=592155&view=diff
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java
(original)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020ConceptTest.java
Mon Nov  5 13:17:41 2007
@@ -59,7 +59,7 @@
  * 
  * @since Sep 27, 2005
  */
-public class JAXR020PublishConceptTest extends BaseTestCase
+public class JAXR020ConceptTest extends BaseTestCase
 {
     private static String CONCEPT_NAME = "Apache Scout Concept -- APACHE SCOUT TEST";
     
@@ -89,7 +89,6 @@
             InternationalString is = blm.createInternationalString("This is the concept for
Apache Scout Test");
             concept.setDescription(is);
 
-
             //Lets provide a link to juddi registry
             ExternalLink wslink =
                     blm.createExternalLink("http://to-rhaps4.toronto.redhat.com:9000/juddi",
@@ -205,7 +204,7 @@
     }
     
     public static junit.framework.Test suite() {
-        return new JUnit4TestAdapter(JAXR020PublishConceptTest.class);
+        return new JUnit4TestAdapter(JAXR020ConceptTest.class);
     }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: scout-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: scout-dev-help@ws.apache.org


Mime
View raw message