ws-scout-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r591877 [1/2] - in /webservices/scout/trunk: ./ scout/src/test/java/org/apache/ws/scout/ scout/src/test/java/org/apache/ws/scout/registry/ scout/src/test/java/org/apache/ws/scout/registry/Delete/ scout/src/test/java/org/apache/ws/scout/regi...
Date Mon, 05 Nov 2007 04:58:40 GMT
Author: kstam
Date: Sun Nov  4 20:58:36 2007
New Revision: 591877

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

Added:
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Creator.java   (with props)
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Finder.java   (with props)
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Printer.java   (with props)
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Remover.java   (with props)
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/package.html
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/AConnectionTest.java   (with props)
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java   (with props)
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java
      - copied, changed from r588719, webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerImplTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/infomodel/package.html
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/package.html
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/
      - copied from r591870, webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR005ClassificationSchemeTest.java
      - copied, changed from r588719, webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishClassificationSchemeTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java   (with props)
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java
      - copied, changed from r588719, webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishConceptTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java
      - copied, changed from r588719, webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteAssociationsTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR040ServiceTest.java   (with props)
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java   (with props)
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXRRegistryUnitTest.java   (with props)
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/package.html
Removed:
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/JAXR00ConnectionTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/JAXR01PublishOrgTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/JAXR02QueryOrgTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/JAXR03DeleteOrgTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/JAXRQueryTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/JaxrPublishOrgTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerImplTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/Delete/
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR01PublishClassificationSchemeTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR01PublishConceptTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR02DeleteClassificationSchemeTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR02DeleteConceptTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXRPublishAndDeleteAssociationsTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXRPublishAndDeleteServiceBindingTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXRPublishAndDeleteServiceTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/query/
Modified:
    webservices/scout/trunk/pom.xml
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/BaseTestCase.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/JAXRLocaleTest.java
    webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java
    webservices/scout/trunk/scout/src/test/resources/juddi.properties
    webservices/scout/trunk/scout/src/test/resources/log4j.properties

Modified: webservices/scout/trunk/pom.xml
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/pom.xml?rev=591877&r1=591876&r2=591877&view=diff
==============================================================================
--- webservices/scout/trunk/pom.xml (original)
+++ webservices/scout/trunk/pom.xml Sun Nov  4 20:58:36 2007
@@ -328,7 +328,7 @@
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>3.8.1</version>
+      <version>4.1</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -347,6 +347,12 @@
       <artifactId>derby</artifactId>
       <version>10.1.2.1</version>
       <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.13</version>
+      <scope>test</scope>
     </dependency>
   </dependencies>
   <reporting>

Modified: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/BaseTestCase.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/BaseTestCase.java?rev=591877&r1=591876&r2=591877&view=diff
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/BaseTestCase.java (original)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/BaseTestCase.java Sun Nov  4 20:58:36 2007
@@ -21,12 +21,12 @@
 import java.util.Properties;
 import java.util.Set;
 
+import javax.xml.registry.BusinessLifeCycleManager;
+import javax.xml.registry.BusinessQueryManager;
 import javax.xml.registry.Connection;
 import javax.xml.registry.ConnectionFactory;
 import javax.xml.registry.JAXRException;
 
-import junit.framework.TestCase;
-
 /**
  * Test to check Jaxr Publish
  * Open source UDDI Browser  <http://www.uddibrowser.org>
@@ -34,18 +34,21 @@
  * @author <mailto:kurt.stam@jboss.com>Kurt Stam
  * @since Sept 21, 2006
  */
-public class BaseTestCase extends TestCase
+public class BaseTestCase
 {
-    protected Connection connection = null;
-
-    protected String userid = System.getProperty("uddi.test.uid") == null ? 
-    						"jdoe" : 
-    						System.getProperty("uddi.test.uid");
-
-    protected String passwd = System.getProperty("uddi.test.pass") == null ? 
-							"password" : 
-							System.getProperty("uddi.test.pass");
+    protected Connection connection;
+    protected BusinessLifeCycleManager blm;
+    protected BusinessQueryManager bqm;
+
+    //Set some default values
+    protected String userid = System.getProperty("uddi.test.uid")  == null ? "jdoe"     : System.getProperty("uddi.test.uid");
+    protected String passwd = System.getProperty("uddi.test.pass") == null ? "password" : System.getProperty("uddi.test.pass");
+    protected int maxRows   = 100;
 
+    /**
+     * Reads scout properties, and creates a connection using these properties.
+     *
+     */
     public void setUp()
     {
         System.out.println("************************************************************");
@@ -76,19 +79,15 @@
             				System.getProperty("javax.xml.registry.queryManagerURL") == null ? 
             				INQUERY_URI :
             				System.getProperty("javax.xml.registry.queryManagerURL"));
-    
             props.setProperty("javax.xml.registry.lifeCycleManagerURL",
             				System.getProperty("javax.xml.registry.lifeCycleManagerURL") == null ? 
             				PUBLISH_URI :
             				System.getProperty("javax.xml.registry.lifeCycleManagerURL"));
-    
-            props.setProperty("javax.xml.registry.factoryClass",
-                    "org.apache.ws.scout.registry.ConnectionFactoryImpl");
-            
-            
+            props.setProperty("javax.xml.registry.factoryFactoryClass",
+                    "org.apache.ws.scout.? it isregistry.ConnectionFactoryImpl");
             props.setProperty("scout.proxy.transportClass", TRANSPORT_CLASS);
-            //System.setProperty("scout.proxy.transportClass", TRANSPORT_CLASS);
-
+            props.setProperty("javax.xml.registry.uddi.maxRows", String.valueOf(maxRows));
+       
        
             // Create the connection, passing it the configuration properties
             ConnectionFactory factory = ConnectionFactory.newInstance();
@@ -99,7 +98,10 @@
             e.printStackTrace();
         }
     }
-
+    /**
+     * Closes down the connection to the registry.
+     *
+     */
     public void tearDown()
     {
         try
@@ -131,5 +133,7 @@
             e.printStackTrace();
         }
     }
+    
+   
 
 }

Added: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Creator.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Creator.java?rev=591877&view=auto
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Creator.java (added)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Creator.java Sun Nov  4 20:58:36 2007
@@ -0,0 +1,176 @@
+package org.apache.ws.scout;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessLifeCycleManager;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.JAXRResponse;
+import javax.xml.registry.infomodel.Association;
+import javax.xml.registry.infomodel.Classification;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.EmailAddress;
+import javax.xml.registry.infomodel.InternationalString;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.PersonName;
+import javax.xml.registry.infomodel.PostalAddress;
+import javax.xml.registry.infomodel.RegistryObject;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
+import javax.xml.registry.infomodel.TelephoneNumber;
+import javax.xml.registry.infomodel.User;
+
+/**
+ * Creator for JAXR Registry Objects to faciliate the writing of unittests.
+ * 
+ * @author kstam
+ *
+ */
+public class Creator {
+    
+    BusinessLifeCycleManager blm;
+    public static String ORGANIZATION_NAME = "TestOrganization";
+    
+    public Creator(BusinessLifeCycleManager blm) {
+        super();
+        this.blm = blm;
+    }
+    /**
+     * Creates a JAXR Organization.
+     * 
+     * @return JAXR Organization
+     * @throws JAXRException
+     */
+    protected InternationalString getIString(String str)
+    throws JAXRException
+    {
+        return blm.createInternationalString(str);
+    }
+    /**
+     * Creates an dummy organization.
+     * 
+     * @return JAXR Organization
+     * @throws JAXRException
+     */
+    public Organization createOrganization(String name) throws JAXRException
+    {
+        Organization org = blm.createOrganization(getIString(name));
+        org.setDescription(getIString(name + ":description"));
+        User user = blm.createUser();
+        org.setPrimaryContact(user);
+        PersonName personName = blm.createPersonName("John AXel Rose");
+        TelephoneNumber telephoneNumber = blm.createTelephoneNumber();
+        telephoneNumber.setNumber("111-222-333");
+        telephoneNumber.setType(null);
+        PostalAddress address = blm.createPostalAddress("1",
+            "UDDI Drive", "Apache Town","OS", "USA", "00000-1111", "");
+        
+        Collection<PostalAddress> postalAddresses = new ArrayList<PostalAddress>();
+        postalAddresses.add(address);
+        Collection<EmailAddress> emailAddresses = new ArrayList<EmailAddress>();
+        EmailAddress emailAddress = blm.createEmailAddress("jaxr@apache.org");
+        emailAddresses.add(emailAddress);
+        
+        Collection<TelephoneNumber> numbers = new ArrayList<TelephoneNumber>();
+        numbers.add(telephoneNumber);
+        user.setPersonName(personName);
+        user.setPostalAddresses(postalAddresses);
+        user.setEmailAddresses(emailAddresses);
+        user.setTelephoneNumbers(numbers);
+        
+        return org;
+    }
+    /**
+     * Creates a dummy Service.
+     * 
+     * @return JAXR Service
+     * @throws JAXRException
+     */
+    public Service createService() throws JAXRException
+    {
+        Service service = blm.createService(getIString("JAXRTestService"));
+        service.setDescription(getIString("Test Services of UDDI Registry"));
+        return service;
+    }
+    /**
+     * Creates a dummy ServiceBinding.
+     * 
+     * @return JAXR ServiceBinding
+     * @throws JAXRException
+     */
+    public ServiceBinding createServiceBinding() throws JAXRException 
+    {
+        ServiceBinding serviceBinding = blm.createServiceBinding();
+        serviceBinding.setName(blm.createInternationalString("JBossESB Test ServiceBinding"));
+        serviceBinding.setDescription(blm.createInternationalString("Binding Description"));
+        serviceBinding.setAccessURI("http://www.jboss.com/services/TestService");
+        return serviceBinding;
+    }
+    /**
+     * Creates a dummy Classification Scheme.
+     * 
+     * @return JAXR ClassificationScheme
+     * @throws JAXRException
+     */
+    public ClassificationScheme createClassificationScheme() throws JAXRException
+    {
+        ClassificationScheme cs = blm.createClassificationScheme(getIString("apache-org:scout"),
+                getIString(""));
+        //Key cKey = blm.createKey("uuid:C0B9FE13-324F-413D-5A5B-2004DB8E5CC2");
+        //cs.setKey(cKey);
+        return cs;
+    }
+    /**
+     * Creates a Classficiation for the default dummy classificationScheme.
+     * 
+     * @param classificationScheme
+     * @return
+     * @throws JAXRException
+     */
+    public Classification createClassification() throws JAXRException
+    {
+        ClassificationScheme classificationScheme = createClassificationScheme();
+        Classification classification = blm.createClassification(classificationScheme,
+                "Java Api for Xml Registries Services","1234");
+        return classification;
+    }
+    /**
+     * Creates an association.
+     * @param type association type
+     * @param registryObject to which the association is built
+     * @throws JAXRException
+     */
+    public void createAssociation(Concept type, RegistryObject registryObject)
+    throws JAXRException 
+    {
+    Association association = blm.createAssociation(registryObject, type);
+    
+    ArrayList<Association> associations = new ArrayList<Association>();
+    associations.add(association);
+    
+    BulkResponse br = blm.saveAssociations(associations, true);
+    if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) {
+        System.out.println("Association Saved");
+        Collection coll = br.getCollection();
+        Iterator iter = coll.iterator();
+        while (iter.hasNext()) {
+            System.out.println("Saved Key=" + iter.next());
+        }// end while
+    } else {
+        System.err.println("JAXRExceptions " + "occurred during save:");
+        Collection exceptions = br.getExceptions();
+        Iterator iter = exceptions.iterator();
+        while (iter.hasNext()) {
+            Exception e = (Exception) iter.next();
+            System.err.println(e.toString());
+        }
+    }
+}
+    
+    
+
+   
+}

Propchange: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Creator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Finder.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Finder.java?rev=591877&view=auto
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Finder.java (added)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Finder.java Sun Nov  4 20:58:36 2007
@@ -0,0 +1,144 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ws.scout;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessLifeCycleManager;
+import javax.xml.registry.BusinessQueryManager;
+import javax.xml.registry.FindQualifier;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.JAXRResponse;
+import javax.xml.registry.infomodel.Classification;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Key;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
+
+/**
+ * Find RegistryObjects
+ * 
+ * @author <a href="mailto:kstam@apache.org">Kurt Stam</a>
+ * 
+ */
+public class Finder
+{
+    private BusinessQueryManager bqm;
+    
+    public Finder(BusinessQueryManager bqm) {
+        super();
+        this.bqm = bqm;
+    }
+
+    public Collection findOrganizationsByName(String queryStr) throws JAXRException {
+    	// Define find qualifiers and name patterns
+    	Collection<String> findQualifiers = new ArrayList<String>();
+    	findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
+    	Collection<String> namePatterns = new ArrayList<String>();
+    	namePatterns.add("%" + queryStr + "%");
+    	
+    	// Find based upon qualifier type and values
+    	System.out.println("\n-- searching the registry --\n");
+        BulkResponse response =
+    		bqm.findOrganizations(findQualifiers,
+    				namePatterns,
+    				null,
+    				null,
+    				null,
+    				null);
+    	
+    	return response.getCollection();
+    }
+    
+    public Collection findClassificationSchemesByName(String queryStr) throws JAXRException {
+        // Define find qualifiers and name patterns
+        Collection<String> findQualifiers = new ArrayList<String>();
+        findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
+        Collection<String> namePatterns = new ArrayList<String>();
+        namePatterns.add("%" + queryStr + "%");
+        
+        // Find based upon qualifier type and values
+        System.out.println("\n-- searching the registry --\n");
+        BulkResponse response =
+            bqm.findClassificationSchemes(findQualifiers,
+                    namePatterns,
+                    null,
+                    null);
+        
+        return response.getCollection();
+    }
+    /**
+     * Search a service, by matching the name and the classification.
+     * 
+     * @param category - name of the category classification
+     * @param serviceName - name of the service
+     * @param blm
+     * @return JAXR Service
+     * @throws JAXRException
+     */
+    public Service findService(String category, String serviceName, BusinessLifeCycleManager blm) throws JAXRException
+    {
+        if (category==null) {
+            category="";
+        }
+        if (serviceName==null) {
+            serviceName="";
+        }  
+        // Define find qualifiers and name patterns
+        Collection<String> findQualifiers = new ArrayList<String>();
+        findQualifiers.add(FindQualifier.AND_ALL_KEYS);
+        findQualifiers.add(FindQualifier.EXACT_NAME_MATCH);
+        findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
+        ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, "org.jboss.soa.esb.:category");
+        Collection<Classification> classifications = new ArrayList<Classification>();
+        Classification classification = 
+            blm.createClassification( 
+              cScheme, 
+              "category", category );
+        classifications.add(classification);
+        Collection<String> namePatterns = new ArrayList<String>();
+        namePatterns.add(serviceName);
+        //Find based upon qualifier type and values
+        BulkResponse response = bqm.findServices(null, findQualifiers,
+                namePatterns, classifications, null);
+        if (response.getStatus()==JAXRResponse.STATUS_SUCCESS) {
+            for (Iterator servIter = response.getCollection().iterator(); servIter.hasNext();) 
+            {
+                Service service = (Service) servIter.next();
+                return service;
+            }
+        }
+        return null;
+    }
+    
+    @SuppressWarnings("unchecked")
+    public Collection<ServiceBinding> findServiceBindings(Key serviceKey) throws JAXRException
+    {
+        Collection<ServiceBinding> serviceBindings=null;
+        Collection<String> findQualifiers = new ArrayList<String>();
+        findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
+        BulkResponse bulkResponse = bqm.findServiceBindings(serviceKey,findQualifiers,null,null);
+        if (bulkResponse.getStatus()==JAXRResponse.STATUS_SUCCESS){
+            serviceBindings = (Collection<ServiceBinding>) bulkResponse.getCollection();
+        }
+        return serviceBindings;
+    }
+
+}

Propchange: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Finder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Printer.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Printer.java?rev=591877&view=auto
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Printer.java (added)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Printer.java Sun Nov  4 20:58:36 2007
@@ -0,0 +1,144 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ws.scout;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.infomodel.Classification;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.EmailAddress;
+import javax.xml.registry.infomodel.ExternalLink;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.PersonName;
+import javax.xml.registry.infomodel.RegistryObject;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
+import javax.xml.registry.infomodel.TelephoneNumber;
+import javax.xml.registry.infomodel.User;
+
+/**
+ * Print out code for Registry Objects
+ * @author <mailto:kstam@apache.org>Kurt Stam
+ */
+public class Printer
+{
+   
+    public void printOrganisation(Organization org) throws JAXRException
+    {
+        System.out.println("Org name: " + getName(org));
+        System.out.println("Org description: " + getDescription(org));
+        System.out.println("Org key id: " + getKey(org));
+        printUser(org);
+        printServices(org);
+        printClassifications(org);
+    }         
+
+    public void printServices(Organization org)
+            throws JAXRException
+    {
+        // Display service and binding information
+        Collection services = org.getServices();
+        for (Iterator svcIter = services.iterator(); svcIter.hasNext();)
+        {
+            Service svc = (Service) svcIter.next();
+            System.out.println(" Service name: " + getName(svc));
+            System.out.println(" Service description: " + getDescription(svc));
+            Collection serviceBindings = svc.getServiceBindings();
+            for (Iterator sbIter = serviceBindings.iterator(); sbIter.hasNext();)
+            {
+                ServiceBinding sb = (ServiceBinding) sbIter.next();
+                System.out.println("  Binding Description: " + getDescription(sb));
+                System.out.println("  Access URI: " + sb.getAccessURI());
+            }
+        }
+    }
+
+    public void printUser(Organization org)
+    throws JAXRException
+    {
+        // Display primary contact information
+        User pc = org.getPrimaryContact();
+        if (pc != null)
+        {
+            PersonName pcName = pc.getPersonName();
+            System.out.println(" Contact name: " + pcName.getFullName());
+            Collection phNums = pc.getTelephoneNumbers(pc.getType());
+            for (Iterator phIter = phNums.iterator(); phIter.hasNext();)
+            {
+                TelephoneNumber num = (TelephoneNumber) phIter.next();
+                System.out.println("  Phone number: " + num.getNumber());
+            }
+            Collection eAddrs = pc.getEmailAddresses();
+            for (Iterator eaIter = eAddrs.iterator(); eaIter.hasNext();)
+            {
+                System.out.println("  Email Address: " + (EmailAddress) eaIter.next());
+            }
+        }
+    }
+    
+    public void printExternalLinks(Concept concept)
+    throws JAXRException
+    {
+        Collection links = concept.getExternalLinks();
+        for (Iterator lnkIter = links.iterator(); lnkIter.hasNext();)
+        {
+             System.out.println("Link: " + ((ExternalLink) lnkIter.next()).getExternalURI().charAt(0));
+        }
+    }
+
+    public String getName(RegistryObject ro) throws JAXRException
+    {
+        if (ro != null && ro.getName() != null)
+        {
+            return ro.getName().getValue();
+        }
+        return "";
+    }
+
+    public String getDescription(RegistryObject ro) throws JAXRException
+    {
+        if (ro != null && ro.getDescription() != null)
+        {
+            return ro.getDescription().getValue();
+        }
+        return "";
+    }
+
+    public String getKey(RegistryObject ro) throws JAXRException
+    {
+        if (ro != null && ro.getKey() != null)
+        {
+            return ro.getKey().getId();
+        }
+        return "";
+    }
+
+    public void printClassifications(Organization ro) throws JAXRException
+    {
+    	Collection c = ro.getClassifications();
+    	Iterator i = c.iterator();
+
+    	System.out.println("Classification: " + ro.getClassifications());
+    	while (i.hasNext()) {
+    		Classification cl = (Classification)i.next();
+    		System.out.println("Classification: " + cl.getName());
+    	}
+    }
+    
+}

Propchange: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Printer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Remover.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Remover.java?rev=591877&view=auto
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Remover.java (added)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Remover.java Sun Nov  4 20:58:36 2007
@@ -0,0 +1,176 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ws.scout;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessLifeCycleManager;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.Key;
+import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.Service;
+import javax.xml.registry.infomodel.ServiceBinding;
+
+/**
+ * Remove Registry Objects
+ * 
+ */
+public class Remover extends BaseTestCase
+{
+    BusinessLifeCycleManager blm = null;
+    
+    public Remover(BusinessLifeCycleManager blm) {
+        super();
+        this.blm = blm;
+    }
+    
+    public void removeOrganization(Organization org) throws JAXRException {
+
+    	Key key = org.getKey();
+    	
+    	String id = key.getId();
+    	System.out.println("Deleting organization with id " + id);
+    	Collection<Key> keys = new ArrayList<Key>();
+    	keys.add(key);
+    	BulkResponse response = blm.deleteOrganizations(keys);
+    	Collection exceptions = response.getExceptions();
+    	if (exceptions == null) {
+    		System.out.println("Organization deleted");
+    		Collection retKeys = response.getCollection();
+    		Iterator keyIter = retKeys.iterator();
+    		javax.xml.registry.infomodel.Key orgKey = null;
+    		if (keyIter.hasNext()) {
+    			orgKey = 
+    				(javax.xml.registry.infomodel.Key) keyIter.next();
+    			id = orgKey.getId();
+    			System.out.println("Organization key was " + id);
+    		}
+    	}
+    }
+    
+    public void removeClassificationScheme(ClassificationScheme cs)
+    throws JAXRException
+    {
+        Key key = cs.getKey();
+        String id = key.getId();
+
+        System.out.println("Deleting concept with id " + id);
+
+        Collection<Key> keys = new ArrayList<Key>();
+        keys.add(key);
+        BulkResponse response = blm.deleteConcepts(keys);
+        
+        Collection exceptions = response.getExceptions();
+        if (exceptions == null) {
+            Collection retKeys = response.getCollection();
+            Iterator keyIter = retKeys.iterator();
+            javax.xml.registry.infomodel.Key orgKey = null;
+            if (keyIter.hasNext()) {
+                orgKey = 
+                    (javax.xml.registry.infomodel.Key) keyIter.next();
+                id = orgKey.getId();
+                System.out.println("Concept with ID=" + id + " was deleted");
+            }
+        }
+    }
+    
+    public void removeConcept(Concept concept)
+    throws JAXRException
+    {
+        Key key = concept.getKey();
+        String id = key.getId();
+
+        System.out.println("Deleting concept with id " + id);
+
+        Collection<Key> keys = new ArrayList<Key>();
+        keys.add(key);
+        BulkResponse response = blm.deleteConcepts(keys);
+        
+        Collection exceptions = response.getExceptions();
+        if (exceptions == null) {
+            Collection retKeys = response.getCollection();
+            Iterator keyIter = retKeys.iterator();
+            javax.xml.registry.infomodel.Key orgKey = null;
+            if (keyIter.hasNext()) {
+                orgKey = 
+                    (javax.xml.registry.infomodel.Key) keyIter.next();
+                id = orgKey.getId();
+                System.out.println("Concept with ID=" + id + " was deleted");
+            }
+        }
+    }
+    
+    public void removeService(Service service)
+    throws JAXRException
+    {
+        Key key = service.getKey();
+        String id = key.getId();
+
+        System.out.println("Deleting service with id " + id);
+
+        Collection<Key> keys = new ArrayList<Key>();
+        keys.add(key);
+        BulkResponse response = blm.deleteConcepts(keys);
+        
+        Collection exceptions = response.getExceptions();
+        if (exceptions == null) {
+            Collection retKeys = response.getCollection();
+            Iterator keyIter = retKeys.iterator();
+            javax.xml.registry.infomodel.Key orgKey = null;
+            if (keyIter.hasNext()) {
+                orgKey = 
+                    (javax.xml.registry.infomodel.Key) keyIter.next();
+                id = orgKey.getId();
+                System.out.println("Service with ID=" + id + " was deleted");
+            }
+        }
+    }
+    
+    public void removeServiceBinding(ServiceBinding serviceBinding)
+    throws JAXRException
+    {
+        Key key = serviceBinding.getKey();
+        String id = key.getId();
+
+        System.out.println("Deleting serviceBinding with id " + id);
+
+        Collection<Key> keys = new ArrayList<Key>();
+        keys.add(key);
+        BulkResponse response = blm.deleteConcepts(keys);
+        
+        Collection exceptions = response.getExceptions();
+        if (exceptions == null) {
+            Collection retKeys = response.getCollection();
+            Iterator keyIter = retKeys.iterator();
+            javax.xml.registry.infomodel.Key orgKey = null;
+            if (keyIter.hasNext()) {
+                orgKey = 
+                    (javax.xml.registry.infomodel.Key) keyIter.next();
+                id = orgKey.getId();
+                System.out.println("ServiceBinding with ID=" + id + " was deleted");
+            }
+        }
+    }
+
+ 
+
+}

Propchange: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/Remover.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/package.html
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/package.html?rev=591877&view=auto
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/package.html (added)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/package.html Sun Nov  4 20:58:36 2007
@@ -0,0 +1,5 @@
+<html>
+<body>
+Some base funtionality to make unit testing easier.
+</body>
+</html>
\ No newline at end of file

Added: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/AConnectionTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/AConnectionTest.java?rev=591877&view=auto
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/AConnectionTest.java (added)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/AConnectionTest.java Sun Nov  4 20:58:36 2007
@@ -0,0 +1,78 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ws.scout.registry;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import java.net.PasswordAuthentication;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.xml.registry.JAXRException;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.ws.scout.BaseTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test to check Connection
+ * Open source UDDI Browser  <http://www.uddibrowser.org>
+ * can be used to check your results
+ * @author <mailto:kstam@apache.org>Kurt Stam
+ * @since Nov 20, 2004
+ */
+public class AConnectionTest extends BaseTestCase
+{
+    @Before
+    public void setUp()
+    {
+        super.setUp();
+    }
+    
+    @After
+    public void tearDown()
+    {
+      super.tearDown();
+    }
+    
+    @Test
+    public void testConnection()
+    {
+        PasswordAuthentication passwdAuth = new PasswordAuthentication(userid,
+                passwd.toCharArray());
+        Set<PasswordAuthentication> creds = new HashSet<PasswordAuthentication>();
+        creds.add(passwdAuth);
+
+        try {
+            connection.setCredentials(creds);
+            assertNotNull(connection);
+            connection.close();
+            
+        } catch (JAXRException e) {
+            fail(e.getMessage());
+            e.printStackTrace();
+        }
+    }
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(AConnectionTest.class);
+    }
+}

Propchange: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/AConnectionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=591877&view=auto
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java (added)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java Sun Nov  4 20:58:36 2007
@@ -0,0 +1,103 @@
+package org.apache.ws.scout.registry;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.JAXRResponse;
+import javax.xml.registry.RegistryService;
+import javax.xml.registry.infomodel.Key;
+import javax.xml.registry.infomodel.Organization;
+
+import junit.framework.JUnit4TestAdapter;
+
+import org.apache.ws.scout.BaseTestCase;
+import org.apache.ws.scout.Creator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *  Tests the BusinessLifecycleManagerImpl class
+ */
+public class BusinessLifeCyleManagerlTest extends BaseTestCase 
+{
+    @Before
+    public void setUp()
+    {
+        super.setUp();
+    }
+    
+    @After
+    public void tearDown()
+    {
+      super.tearDown();
+    }
+    
+    @SuppressWarnings("unchecked")
+    @Test
+    public void saveDeleteOrganizations() 
+    {
+        login();
+        Collection<Key> orgKeys = new ArrayList<Key>();
+        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);
+
+            //Now save the Organization along with a Service, ServiceBinding and Classification
+            BulkResponse br = blm.saveOrganizations(orgs);
+            assertEquals(JAXRResponse.STATUS_SUCCESS, br.getStatus());
+            orgKeys = (Collection<Key>) br.getCollection();
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+        
+        try {
+            RegistryService rs = connection.getRegistryService();
+            blm = rs.getBusinessLifeCycleManager();
+            BulkResponse br = blm.deleteOrganizations(orgKeys);
+            assertEquals(JAXRResponse.STATUS_SUCCESS, br.getStatus());
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+    //TODO cover these methods
+    
+//    BulkResponse deleteAssociations(Collection<Key> associationKeys) throws JAXRException;
+//
+//    BulkResponse deleteClassificationSchemes(Collection<Key> schemeKeys) throws JAXRException;
+//
+//    BulkResponse deleteConcepts(Collection<Key> conceptKeys) throws JAXRException;
+//
+//    BulkResponse deleteServiceBindings(Collection<Key> bindingKeys) throws JAXRException;
+//
+//    BulkResponse deleteServices(Collection<Key> serviceKeys) throws JAXRException;
+//
+//    BulkResponse saveAssociations(Collection<Association> associations, boolean replace) throws JAXRException;
+//
+//    BulkResponse saveClassificationSchemes(Collection<ClassificationScheme> schemes) throws JAXRException;
+//
+//    BulkResponse saveConcepts(Collection<Concept> concepts) throws JAXRException;
+//
+      
+//
+//    BulkResponse saveServiceBindings(Collection<ServiceBinding> bindings) throws JAXRException;
+//
+//    BulkResponse saveServices(Collection<Service> services) throws JAXRException;
+//
+//    void unConfirmAssociation(Association assoc) throws JAXRException, InvalidRequestException;
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(BusinessLifeCyleManagerlTest.class);
+    }
+
+}

Propchange: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java (from r588719, webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerImplTest.java)
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java?p2=webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java&p1=webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerImplTest.java&r1=588719&r2=591877&rev=591877&view=diff
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerImplTest.java (original)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java Sun Nov  4 20:58:36 2007
@@ -9,7 +9,7 @@
 /**
  *  Tests the BusinessLifecycleManagerImpl class
  */
-public class BusinessQueryManagerImplTest extends TestCase {
+public class BusinessQueryManagerTest extends TestCase {
 
     public void testFindClassificationSchemeByName() throws JAXRException {
 

Modified: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/JAXRLocaleTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/JAXRLocaleTest.java?rev=591877&r1=591876&r2=591877&view=diff
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/JAXRLocaleTest.java (original)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/JAXRLocaleTest.java Sun Nov  4 20:58:36 2007
@@ -16,6 +16,9 @@
  */
 package org.apache.ws.scout.registry;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -34,7 +37,12 @@
 import javax.xml.registry.infomodel.Organization;
 import javax.xml.registry.infomodel.Service;
 
+import junit.framework.JUnit4TestAdapter;
+
 import org.apache.ws.scout.BaseTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  */
@@ -42,16 +50,19 @@
 {
     private BusinessLifeCycleManager blm = null;
 
+    @Before
     public void setUp()
     {
        super.setUp();
     }
 
+    @After
     public void tearDown()
     {
         super.tearDown();
     }
 
+    @Test
     public void testPublishOrganizationAndService() throws Exception {
         login();
 
@@ -121,6 +132,14 @@
         assertEquals(service.getDescription().getValue(locale), 
                      service1.getDescription().getValue(locale));
         
+        //Cleanup
+        Collection<Key> serviceKeys = new ArrayList<Key>();
+        serviceKeys.add(key);
+        blm.deleteServices(serviceKeys);
+        
+        Collection<Key> orgKeys = new ArrayList<Key>();
+        orgKeys.add(organization1.getKey());
+        blm.deleteOrganizations(orgKeys); 
     }
     
     public void testPublishConcept() throws Exception {
@@ -159,6 +178,11 @@
 
         assertEquals(concept.getDescription().getValue(locale), 
                      concept1.getDescription().getValue(locale));
+        
+        //cleanup
+        Collection<Key> conceptKeys = new ArrayList<Key>();
+        conceptKeys.add(concept1.getKey());
+        blm.deleteOrganizations(conceptKeys);
     }
 
     private void checkResponse(BulkResponse br) throws JAXRException {
@@ -191,6 +215,10 @@
             throws JAXRException
     {
         return blm.createInternationalString(locale, str);
+    }
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(JAXRLocaleTest.class);
     }
 
 }

Modified: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java?rev=591877&r1=591876&r2=591877&view=diff
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java (original)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java Sun Nov  4 20:58:36 2007
@@ -16,25 +16,38 @@
  */
 package org.apache.ws.scout.registry;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import javax.xml.registry.CapabilityProfile;
 import javax.xml.registry.JAXRException;
 import javax.xml.registry.RegistryService;
 import javax.xml.registry.UnsupportedCapabilityException;
 
-import junit.framework.TestCase;
+import junit.framework.JUnit4TestAdapter;
+
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * @version $Revision$ $Date$
  */
-public class RegistryServiceTest extends TestCase {
+public class RegistryServiceTest {
     private RegistryService registry;
 
+    @Before
+    public void setUp() throws Exception {
+        registry = new RegistryServiceImpl(null, null, -1);
+    }
+    
+    @Test
     public void testCapabilityProfile() throws JAXRException {
         CapabilityProfile profile = registry.getCapabilityProfile();
         assertNotNull(profile);
         assertEquals(0, profile.getCapabilityLevel());
     }
 
+    @Test
     public void testDeclarativeQueryManager() throws JAXRException {
         try {
             registry.getDeclarativeQueryManager();
@@ -42,9 +55,10 @@
             // ok
         }
     }
-
-    protected void setUp() throws Exception {
-        super.setUp();
-        registry = new RegistryServiceImpl(null, null, -1);
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(RegistryServiceTest.class);
     }
+
+   
 }

Added: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/infomodel/package.html
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/infomodel/package.html?rev=591877&view=auto
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/infomodel/package.html (added)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/infomodel/package.html Sun Nov  4 20:58:36 2007
@@ -0,0 +1,5 @@
+<html>
+<body>
+Tests the API of the org.apache.ws.scout.registry.infomodel package.
+</body>
+</html>
\ No newline at end of file

Added: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/package.html
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/package.html?rev=591877&view=auto
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/package.html (added)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/package.html Sun Nov  4 20:58:36 2007
@@ -0,0 +1,5 @@
+<html>
+<body>
+Tests the API of the org.apache.ws.scout.registry package.
+</body>
+</html>
\ No newline at end of file

Copied: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR005ClassificationSchemeTest.java (from r588719, webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishClassificationSchemeTest.java)
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR005ClassificationSchemeTest.java?p2=webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR005ClassificationSchemeTest.java&p1=webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishClassificationSchemeTest.java&r1=588719&r2=591877&rev=591877&view=diff
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishClassificationSchemeTest.java (original)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR005ClassificationSchemeTest.java Sun Nov  4 20:58:36 2007
@@ -14,14 +14,15 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.ws.scout.registry.publish;
+package org.apache.ws.scout.registry.qa;
+
+import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 
 import javax.xml.registry.BulkResponse;
-import javax.xml.registry.BusinessLifeCycleManager;
 import javax.xml.registry.BusinessQueryManager;
 import javax.xml.registry.JAXRException;
 import javax.xml.registry.JAXRResponse;
@@ -30,7 +31,13 @@
 import javax.xml.registry.infomodel.ClassificationScheme;
 import javax.xml.registry.infomodel.Key;
 
+import junit.framework.JUnit4TestAdapter;
+
 import org.apache.ws.scout.BaseTestCase;
+import org.apache.ws.scout.Remover;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Tests publish classification schemes.
@@ -43,24 +50,25 @@
  *
  * @author <a href="mailto:dbhole@redhat.com">Deepak Bhole</a>
  * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
+ * @author <a href="mailto:kstam@apache.org">Kurt Stam</a>
  * 
  * @since Sep 27, 2005
  */
-public class JAXR01PublishClassificationSchemeTest extends BaseTestCase
+public class JAXR005ClassificationSchemeTest extends BaseTestCase
 {
-
-    private BusinessLifeCycleManager blm = null;
-
+    @Before
     public void setUp()
     {
         super.setUp();
     }
 
+    @After
     public void tearDown()
     {
         super.tearDown();
     }
 
+    @Test
     public void testPublishClassificationScheme()
     {
         login();
@@ -69,6 +77,7 @@
             RegistryService rs = connection.getRegistryService();
             BusinessQueryManager bqm = rs.getBusinessQueryManager();
             blm = rs.getBusinessLifeCycleManager();
+            Remover remover = new Remover(blm);
 
             ClassificationScheme cScheme = blm.createClassificationScheme("testScheme -- APACHE SCOUT TEST", "Sample Classification Scheme");
             Classification classification = createClassificationForUDDI(bqm);
@@ -87,9 +96,10 @@
                 {
                     Key key = (Key) iter.next();
                     System.out.println("Saved Key=" + key.getId());
+                    cScheme.setKey(key);
+                    remover.removeClassificationScheme(cScheme);
                 }//end while
-            } else
-            {
+            } else {
                 System.err.println("JAXRExceptions " +
                         "occurred during save:");
                 Collection exceptions = br.getExceptions();
@@ -118,6 +128,10 @@
 
         Classification cl = blm.createClassification(udditmodel, "wsdl", "wsdl");
         return cl;
+    }
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(JAXR005ClassificationSchemeTest.class);
     }
 
 }

Added: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java?rev=591877&view=auto
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java (added)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java Sun Nov  4 20:58:36 2007
@@ -0,0 +1,239 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ws.scout.registry.qa;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.JAXRResponse;
+import javax.xml.registry.RegistryService;
+import javax.xml.registry.infomodel.Classification;
+import javax.xml.registry.infomodel.ClassificationScheme;
+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;
+
+import org.apache.ws.scout.BaseTestCase;
+import org.apache.ws.scout.Creator;
+import org.apache.ws.scout.Finder;
+import org.apache.ws.scout.Printer;
+import org.apache.ws.scout.Remover;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test to check Jaxr Publish
+ * Open source UDDI Browser  <http://www.uddibrowser.org>
+ * can be used to check your results
+ * @author <mailto:anil@apache.org>Anil Saldhana
+ * @since Nov 20, 2004
+ */
+public class JAXR010OrganizationTest extends BaseTestCase
+{
+    @Before
+    public void setUp()
+    {
+        super.setUp();
+    }
+    
+    @After
+    public void tearDown()
+    {
+      super.tearDown();
+    }
+    
+    @Test 
+    public void publishClassificationScheme()
+    {
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            blm = rs.getBusinessLifeCycleManager();
+            Creator creator = new Creator(blm);
+            
+            Collection<ClassificationScheme> schemes = new ArrayList<ClassificationScheme>();
+            ClassificationScheme classificationScheme = creator.createClassificationScheme();
+            schemes.add(classificationScheme);
+            
+            BulkResponse bulkResponse = blm.saveClassificationSchemes(schemes);
+            assertEquals(JAXRResponse.STATUS_SUCCESS,bulkResponse.getStatus());
+            
+            
+        } catch (JAXRException e) {
+            e.printStackTrace();
+            assertTrue(false);
+        }   
+    }
+    
+    @Test
+    public void publishOrganization()
+    {
+        BulkResponse response = null;
+        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());
+//          Add a Service
+            Service service = creator.createService();
+            ServiceBinding serviceBinding = creator.createServiceBinding();
+            service.addServiceBinding(serviceBinding);
+            organization.addService(service);
+            //Add a classification
+            Classification classification = creator.createClassification();
+            organization.addClassification(classification);
+            
+            orgs.add(organization);
+
+            //Now save the Organization along with a Service, ServiceBinding and Classification
+            BulkResponse br = blm.saveOrganizations(orgs);
+            if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
+            {
+                System.out.println("Organization Saved");
+                Collection coll = br.getCollection();
+                Iterator iter = coll.iterator();
+                while (iter.hasNext())
+                {
+                    Key key = (Key) iter.next();
+                    System.out.println("Saved Key=" + key.getId());
+                }//end while
+            } else
+            {
+                System.err.println("JAXRExceptions " +
+                        "occurred during save:");
+                Collection exceptions = br.getExceptions();
+                Iterator iter = exceptions.iterator();
+                while (iter.hasNext())
+                {
+                    Exception e = (Exception) iter.next();
+                    System.err.println(e.toString());
+                }
+            }
+            
+        } catch (JAXRException e) {
+            e.printStackTrace();
+			assertTrue(false);
+        }
+        assertNull(response);
+    }
+    
+    @Test
+    public void queryOrganization()
+    {
+        try
+        {
+            // Get registry service and business query manager
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            System.out.println("We have the Business Query Manager");
+            Printer printer = new Printer();
+            Finder finder = new Finder(bqm);
+
+            Collection orgs = finder.findOrganizationsByName(this.getClass().getName());
+            if (orgs == null) {
+                fail("Only Expecting 1 Organization");
+            } else {
+                assertEquals(1,orgs.size());
+                // then step through them
+                for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)
+                {
+                    Organization org = (Organization) orgIter.next();
+                    System.out.println("Org name: " + printer.getName(org));
+                    System.out.println("Org description: " + printer.getDescription(org));
+                    System.out.println("Org key id: " + printer.getKey(org));
+
+                    printer.printUser(org);
+                    printer.printServices(org);
+                    printer.printClassifications(org);
+                }
+            }//end else
+        } catch (JAXRException e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        } 
+    }
+    
+    @Test
+    public void deleteOrganization()
+    {
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            blm = rs.getBusinessLifeCycleManager();
+    //      Get registry service and business query manager
+            bqm = rs.getBusinessQueryManager();
+            System.out.println("We have the Business Query Manager");
+            Finder finder = new Finder(bqm);
+            Remover remover = new Remover(blm);
+            Collection orgs = finder.findOrganizationsByName(this.getClass().getName());
+            for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)
+            {
+                Organization org = (Organization) orgIter.next();
+                remover.removeOrganization(org);
+            }
+            
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+    
+    @Test
+    public void deleteClassificationScheme()
+    {
+        try {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            blm = rs.getBusinessLifeCycleManager();
+            System.out.println("We have the Business Query Manager");
+            Finder finder = new Finder(bqm);
+            Remover remover = new Remover(blm);
+            Collection schemes = finder.findClassificationSchemesByName(this.getClass().getName());
+            for (Iterator iter = schemes.iterator(); iter.hasNext();)
+            {
+                ClassificationScheme scheme = (ClassificationScheme) iter.next();
+                remover.removeClassificationScheme(scheme);
+            }
+            
+        } catch (Exception e) {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(JAXR010OrganizationTest.class);
+    }
+}

Propchange: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java (from r588719, webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishConceptTest.java)
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java?p2=webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java&p1=webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishConceptTest.java&r1=588719&r2=591877&rev=591877&view=diff
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishConceptTest.java (original)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java Sun Nov  4 20:58:36 2007
@@ -14,17 +14,20 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.ws.scout.registry.publish;
+package org.apache.ws.scout.registry.qa;
+
+import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 
 import javax.xml.registry.BulkResponse;
-import javax.xml.registry.BusinessLifeCycleManager;
 import javax.xml.registry.BusinessQueryManager;
+import javax.xml.registry.FindQualifier;
 import javax.xml.registry.JAXRException;
 import javax.xml.registry.JAXRResponse;
+import javax.xml.registry.LifeCycleManager;
 import javax.xml.registry.RegistryService;
 import javax.xml.registry.infomodel.Classification;
 import javax.xml.registry.infomodel.ClassificationScheme;
@@ -33,7 +36,14 @@
 import javax.xml.registry.infomodel.InternationalString;
 import javax.xml.registry.infomodel.Key;
 
+import junit.framework.JUnit4TestAdapter;
+
 import org.apache.ws.scout.BaseTestCase;
+import org.apache.ws.scout.Printer;
+import org.apache.ws.scout.Remover;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * Tests publish concepts.
@@ -49,20 +59,23 @@
  * 
  * @since Sep 27, 2005
  */
-public class JAXR01PublishConceptTest extends BaseTestCase
+public class JAXR020PublishConceptTest extends BaseTestCase
 {
-    private BusinessLifeCycleManager blm = null;
-
+    private static String CONCEPT_NAME = "Apache Scout Concept -- APACHE SCOUT TEST";
+    
+    @Before
     public void setUp()
     {
        super.setUp();
     }
 
+    @After
     public void tearDown()
     {
         super.tearDown();
     }
 
+    @Test
     public void testPublishConcept()
     {
         login();
@@ -71,9 +84,9 @@
             RegistryService rs = connection.getRegistryService();
             BusinessQueryManager bqm = rs.getBusinessQueryManager();
             blm = rs.getBusinessLifeCycleManager();
-
-            Concept concept = blm.createConcept(null, "Apache Scout Concept -- APACHE SCOUT TEST", "");
-            InternationalString is = getIString("This is the concept for Apache Scout Test");
+           
+            Concept concept = blm.createConcept(null, CONCEPT_NAME, "");
+            InternationalString is = blm.createInternationalString("This is the concept for Apache Scout Test");
             concept.setDescription(is);
 
 
@@ -89,6 +102,7 @@
             Collection<Concept> concepts = new ArrayList<Concept>();
             concepts.add(concept);
 
+            Key key=null;
             BulkResponse br = blm.saveConcepts(concepts);
             if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
             {
@@ -97,7 +111,7 @@
                 Iterator iter = coll.iterator();
                 while (iter.hasNext())
                 {
-                    Key key = (Key) iter.next();
+                    key = (Key) iter.next();
                     System.out.println("Saved Key=" + key.getId());
                 }//end while
             } else
@@ -113,6 +127,10 @@
                     fail(e.toString());
                 }
             }
+            
+            Concept savedConcept = (Concept)bqm.getRegistryObject(key.getId(),LifeCycleManager.CONCEPT);
+            System.out.println("Save concept=" + savedConcept);
+            
         } catch (JAXRException e)
         {
             e.printStackTrace();
@@ -129,11 +147,65 @@
         Classification cl = blm.createClassification(udditmodel, "wsdl", "wsdl");
         return cl;
     }
-
-    private InternationalString getIString(String str)
-            throws JAXRException
+    
+    public void testDeleteConcept()
     {
-        return blm.createInternationalString(str);
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            BusinessQueryManager bqm = rs.getBusinessQueryManager();
+            blm = rs.getBusinessLifeCycleManager();
+            Printer printer = new Printer();
+            Remover remover = new Remover(blm);
+
+            Collection<String> findQualifiers = new ArrayList<String>();
+            findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
+            Collection<String> namePatterns = new ArrayList<String>();
+            namePatterns.add("%" + CONCEPT_NAME + "%");
+
+            BulkResponse br = bqm.findConcepts(findQualifiers, namePatterns, null, null, null);
+
+//          check how many organisation we have matched
+            Collection concepts = br.getCollection();
+
+            if (concepts == null)
+            {
+                System.out.println("\n-- Matched 0 orgs");
+
+            } else
+            {
+                System.out.println("\n-- Matched " + concepts.size() + " concepts --\n");
+
+                // then step through them
+                for (Iterator conceptIter = concepts.iterator(); conceptIter.hasNext();)
+                {
+                    Concept c = (Concept) conceptIter.next();
+                    
+                    System.out.println("Id: " + c.getKey().getId());
+                    System.out.println("Name: " + c.getName().getValue());
+
+                    // Links are not yet implemented in scout -- so concepts 
+                    // created via scout won't have links 
+                    printer.printExternalLinks(c);
+
+                    // Print spacer between messages
+                    System.out.println(" --- ");
+                    
+                    remover.removeConcept(c);
+                    
+                    System.out.println(" === ");
+                }
+            }//end else
+        } catch (JAXRException e)
+        {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(JAXR020PublishConceptTest.class);
     }
 
 }

Copied: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java (from r588719, webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteAssociationsTest.java)
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java?p2=webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java&p1=webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteAssociationsTest.java&r1=588719&r2=591877&rev=591877&view=diff
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteAssociationsTest.java (original)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java Sun Nov  4 20:58:36 2007
@@ -14,14 +14,15 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.ws.scout.registry.publish;
+package org.apache.ws.scout.registry.qa;
+
+import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
 
 import javax.xml.registry.BulkResponse;
-import javax.xml.registry.BusinessLifeCycleManager;
 import javax.xml.registry.BusinessQueryManager;
 import javax.xml.registry.FindQualifier;
 import javax.xml.registry.JAXRException;
@@ -29,12 +30,17 @@
 import javax.xml.registry.RegistryService;
 import javax.xml.registry.infomodel.Association;
 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.RegistryObject;
 
+import junit.framework.JUnit4TestAdapter;
+
 import org.apache.ws.scout.BaseTestCase;
+import org.apache.ws.scout.Creator;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 
 
 /**
@@ -51,21 +57,22 @@
  * 
  * @since Sep 27, 2005
  */
-public class JAXRPublishAndDeleteAssociationsTest extends BaseTestCase {
+public class JAXR030AssociationsTest extends BaseTestCase {
 
-	private BusinessLifeCycleManager blm = null;
 	private BusinessQueryManager bqm = null;
 
 	String associationType = "/AssociationType/RelatedTo";
-	String tempSrcOrgName = "Apache Source Org -- APACHE SCOUT TEST";
-	String tempTgtOrgName = "Apache Target Org -- APACHE SCOUT TEST";
+	private static String tempSrcOrgName = "Apache Source Org -- APACHE SCOUT TEST";
+	private static String tempTgtOrgName = "Apache Target Org -- APACHE SCOUT TEST";
 
 	Organization sOrg, tOrg;
 
+    @Before
 	public void setUp() {
 		super.setUp();
 	}
 
+    @After
 	public void tearDown() {
 		super.tearDown();
 	}
@@ -78,25 +85,33 @@
 	 * uses getMethods() to gather test methods, and getMethods() does not
 	 * guarantee order.
 	 */
-
+    @Test
 	public void testPublishFindAndDeleteAssociation() {
 		login();
 		try {
 			RegistryService rs = connection.getRegistryService();
 			bqm = rs.getBusinessQueryManager();
 			blm = rs.getBusinessLifeCycleManager();
+            Creator creator = new Creator(blm);
 
-			System.out.println("\nCreating temporary organization...\n");
-			createTempOrgs();
+			System.out.println("\nCreating temporary organizations...\n");
+            Organization org1 = creator.createOrganization(tempSrcOrgName);
+            Organization org2 = creator.createOrganization(tempTgtOrgName);
+            Collection<Organization> organizations = new ArrayList<Organization>();
+            organizations.add(org1);
+            organizations.add(org2);
+            blm.saveOrganizations(organizations);
+            
 
-			System.out
-					.println("\nSearching for newly created organizations...\n");
+			System.out.println("\nSearching for newly created organizations...\n");
 			ArrayList<Organization> orgs = findTempOrgs();
 
 			sOrg = orgs.get(0);
 			tOrg = orgs.get(1);
 
 			System.out.println("\nCreating association...\n");
+            
+            //TODO this does not actually succeed!
 			createAssociation(sOrg, tOrg);
 
 			// All created ... now try to delete.
@@ -109,11 +124,7 @@
 
 		}
 	}
-
-	private InternationalString getIString(String str) throws JAXRException {
-		return blm.createInternationalString(str);
-	}
-
+    
 	private void createAssociation(Organization sOrg, Organization tOrg)
 			throws JAXRException {
 
@@ -139,8 +150,8 @@
 			while (iter.hasNext()) {
 				Exception e = (Exception) iter.next();
 				System.err.println(e.toString());
-				deleteTempOrgs();
 			}
+            deleteTempOrgs();
 		}
 	}
 
@@ -209,42 +220,6 @@
 		}
 	}
 
-	private void createTempOrgs() throws JAXRException {
-
-		Key orgKey = null;
-		Organization sOrg = blm.createOrganization(getIString(tempSrcOrgName));
-		Organization tOrg = blm.createOrganization(getIString(tempTgtOrgName));
-		sOrg
-				.setDescription(getIString("Temporary source organization to test saveAssociations()"));
-		tOrg
-				.setDescription(getIString("Temporary target organization to test saveAssociations()"));
-
-		Collection<Organization> orgs = new ArrayList<Organization>();
-		orgs.add(sOrg);
-		orgs.add(tOrg);
-		BulkResponse br = blm.saveOrganizations(orgs);
-
-		if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) {
-			Iterator iter = br.getCollection().iterator();
-
-			while (iter.hasNext()) {
-				orgKey = (Key) iter.next();
-				System.out.println("Temporary Organization Created with id="
-						+ orgKey.getId());
-			}
-		} else {
-			System.err.println("JAXRExceptions "
-					+ "occurred during creation of temporary organization:");
-
-			Iterator iter = br.getCollection().iterator();
-
-			while (iter.hasNext()) {
-				Exception e = (Exception) iter.next();
-				System.err.println(e.toString());
-			}
-		}
-	}
-
 	private ArrayList<Organization> findTempOrgs() throws JAXRException {
 
 		ArrayList<Organization> toReturn = new ArrayList<Organization>(2);
@@ -347,4 +322,8 @@
 		}
 		return "";
 	}
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(JAXR030AssociationsTest.class);
+    }
 }

Added: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR040ServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR040ServiceTest.java?rev=591877&view=auto
==============================================================================
--- webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR040ServiceTest.java (added)
+++ webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR040ServiceTest.java Sun Nov  4 20:58:36 2007
@@ -0,0 +1,273 @@
+/**
+ *
+ * Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.ws.scout.registry.qa;
+
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.xml.registry.BulkResponse;
+import javax.xml.registry.BusinessQueryManager;
+import javax.xml.registry.FindQualifier;
+import javax.xml.registry.JAXRException;
+import javax.xml.registry.JAXRResponse;
+import javax.xml.registry.RegistryService;
+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 junit.framework.JUnit4TestAdapter;
+
+import org.apache.ws.scout.BaseTestCase;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests Publish, Delete (and indirectly, find) for service bindings.
+ * 
+ * You can comment out the deletion portion and use 
+ * Open source UDDI Browser  <http://www.uddibrowser.org>
+ * to check your intermediate results.
+ *
+ * Based on query/publish tests written by 
+ * <a href="mailto:anil@apache.org">Anil Saldhana</a>.
+ *
+ * @author <a href="mailto:dbhole@redhat.com">Deepak Bhole</a>
+ * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
+ *
+ * @since Sep 27, 2005
+ */
+public class JAXR040ServiceTest extends BaseTestCase
+{
+    private BusinessQueryManager bqm = null;
+    
+    String serviceName = "Apache JAXR Service -- APACHE SCOUT TEST";
+	String tempOrgName = "Apache JAXR Service Org -- APACHE SCOUT TEST";
+
+    @Before
+    public void setUp()
+    {
+    	super.setUp();
+    }
+
+    @After
+    public void tearDown()
+    {
+        super.tearDown();
+    }
+
+	/**
+	 * Tests publishing and deleting of services.
+	 * 
+	 * Do not break this into testPublish(), testDelete(), etc. Order is
+	 * important, and not all jvms can guarantee order since the JUnit framework
+	 * uses getMethods() to gather test methods, and getMethods() does not
+	 * guarantee order.
+	 */
+    @Test
+    public void testPublishFindAndDeleteService()
+    {
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            blm = rs.getBusinessLifeCycleManager();
+
+            System.out.println("\nCreating temporary organization...\n");
+            Organization org = createTempOrg();
+            
+            System.out.println("\nCreating service...\n");
+            createService(org);
+            
+            // All created ... now try to delete.
+            
+            findAndDeleteService(org.getKey());
+            deleteTempOrg(org.getKey());
+            
+        } catch (JAXRException e)
+        {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    
+    private void createService(Organization org) throws JAXRException {
+        Service service = blm.createService(getIString(serviceName));
+        service.setDescription(getIString("Services in UDDI Registry"));
+        service.setProvidingOrganization(org);
+
+        ArrayList<Service> services = new ArrayList<Service>();
+        services.add(service);
+
+        BulkResponse br = blm.saveServices(services);
+        if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
+        {
+            System.out.println("Service Saved");
+            Collection coll = br.getCollection();
+            Iterator iter = coll.iterator();
+            while (iter.hasNext())
+            {
+                Key key = (Key) iter.next();
+                System.out.println("Saved Key=" + key.getId());
+            }//end while
+        } else
+        {
+            System.err.println("JAXRExceptions " +
+                    "occurred during save:");
+            Collection exceptions = br.getExceptions();
+            Iterator iter = exceptions.iterator();
+            while (iter.hasNext())
+            {
+                Exception e = (Exception) iter.next();
+                System.err.println(e.toString());
+                fail(e.toString());
+            }
+        }
+    }
+    
+    private void findAndDeleteService(Key orgKey) throws JAXRException {
+    	Collection<String> findQualifiers = new ArrayList<String>();
+        findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
+        Collection<String> namePatterns = new ArrayList<String>();
+        namePatterns.add("%" + serviceName + "%");
+        
+        BulkResponse br = bqm.findServices(orgKey, findQualifiers, namePatterns, null, null);
+        Collection services = br.getCollection();
+
+        if (services == null)
+        {
+            System.out.println("\n-- Matched 0 orgs");
+
+        } else
+        {
+            System.out.println("\n-- Matched " + services.size() + " services --\n");
+
+            // then step through them
+            for (Iterator conceptIter = services.iterator(); conceptIter.hasNext();)
+            {
+            	Service s = (Service) conceptIter.next();
+                
+                System.out.println("Id: " + s.getKey().getId());
+                System.out.println("Name: " + s.getName().getValue());
+
+                // Print spacer between messages
+                System.out.println(" --- ");
+                
+                deleteService(s.getKey());
+
+                System.out.println("\n ============================== \n");
+            }
+        }
+    }
+    
+    private void deleteService(Key key) throws JAXRException {
+
+    	String id = key.getId();
+
+    	System.out.println("\nDeleting service with id " + id + "\n");
+
+    	Collection<Key> keys = new ArrayList<Key>();
+    	keys.add(key);
+    	BulkResponse response = blm.deleteServices(keys);
+
+    	Collection exceptions = response.getExceptions();
+    	if (exceptions == null) {
+    		Collection retKeys = response.getCollection();
+    		Iterator keyIter = retKeys.iterator();
+    		javax.xml.registry.infomodel.Key orgKey = null;
+    		if (keyIter.hasNext()) {
+    			orgKey = 
+    				(javax.xml.registry.infomodel.Key) keyIter.next();
+    			id = orgKey.getId();
+    			System.out.println("Service with ID=" + id + " was deleted");
+    		}
+    	}
+    }
+    
+    private Organization createTempOrg() throws JAXRException {
+
+        Key orgKey = null;
+        Organization org = blm.createOrganization(getIString(tempOrgName));
+        org.setDescription(getIString("Temporary organization to test saveService()"));
+
+        Collection<Organization> orgs = new ArrayList<Organization>();
+        orgs.add(org);
+        BulkResponse br = blm.saveOrganizations(orgs);
+        
+        if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
+        {
+        	orgKey = (Key) br.getCollection().iterator().next();
+            System.out.println("Temporary Organization Created with id=" + orgKey.getId());
+            org.setKey(orgKey);
+        }  else
+        {
+            System.err.println("JAXRExceptions " +
+                    "occurred during creation of temporary organization:");
+            
+            Iterator iter = br.getCollection().iterator();
+            
+            while (iter.hasNext()) {
+            	Exception e = (Exception) iter.next();
+            	System.err.println(e.toString());
+            }
+            
+            fail();
+        }
+        
+        return org;
+    }
+    
+    private void deleteTempOrg(Key orgKey) throws JAXRException {
+
+    	String id = orgKey.getId();
+
+    	System.out.println("\nDeleting temporary organization with id " + id + "\n");
+
+    	Collection<Key> keys = new ArrayList<Key>();
+    	keys.add(orgKey);
+    	BulkResponse response = blm.deleteOrganizations(keys);
+
+    	Collection exceptions = response.getExceptions();
+    	if (exceptions == null) {
+    		Collection retKeys = response.getCollection();
+    		Iterator keyIter = retKeys.iterator();
+    		orgKey = null;
+    		if (keyIter.hasNext()) {
+    			orgKey = 
+    				(javax.xml.registry.infomodel.Key) keyIter.next();
+    			id = orgKey.getId();
+    			System.out.println("Organization with ID=" + id + " was deleted");
+    		}
+    	}
+    }
+    
+    private InternationalString getIString(String str)
+    throws JAXRException
+    {
+        return blm.createInternationalString(str);
+    }
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(JAXR040ServiceTest.class);
+    }
+}

Propchange: webservices/scout/trunk/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR040ServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
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