SCOUT-52 refactoring unittests

git-svn-id: https://svn.apache.org/repos/asf/webservices/scout/trunk@591877 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/pom.xml b/pom.xml
index a47d4a5..91dc860 100644
--- a/pom.xml
+++ b/pom.xml
@@ -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>
diff --git a/scout/src/test/java/org/apache/ws/scout/BaseTestCase.java b/scout/src/test/java/org/apache/ws/scout/BaseTestCase.java
index 4481fb8..4a0f94f 100644
--- a/scout/src/test/java/org/apache/ws/scout/BaseTestCase.java
+++ b/scout/src/test/java/org/apache/ws/scout/BaseTestCase.java
@@ -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 Connection connection;
+    protected BusinessLifeCycleManager blm;
+    protected BusinessQueryManager bqm;
 
-    protected String userid = System.getProperty("uddi.test.uid") == null ? 
-    						"jdoe" : 
-    						System.getProperty("uddi.test.uid");
+    //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;
 
-    protected String passwd = System.getProperty("uddi.test.pass") == null ? 
-							"password" : 
-							System.getProperty("uddi.test.pass");
-
+    /**
+     * 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();
         }
     }
+    
+   
 
 }
diff --git a/scout/src/test/java/org/apache/ws/scout/Creator.java b/scout/src/test/java/org/apache/ws/scout/Creator.java
new file mode 100644
index 0000000..01aac65
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/Creator.java
@@ -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());
+        }
+    }
+}
+    
+    
+
+   
+}
diff --git a/scout/src/test/java/org/apache/ws/scout/Finder.java b/scout/src/test/java/org/apache/ws/scout/Finder.java
new file mode 100644
index 0000000..62ca1b6
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/Finder.java
@@ -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;
+    }
+
+}
diff --git a/scout/src/test/java/org/apache/ws/scout/JAXR01PublishOrgTest.java b/scout/src/test/java/org/apache/ws/scout/JAXR01PublishOrgTest.java
deleted file mode 100644
index b19381e..0000000
--- a/scout/src/test/java/org/apache/ws/scout/JAXR01PublishOrgTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- *
- * 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.RegistryService;
-import javax.xml.registry.infomodel.Classification;
-import javax.xml.registry.infomodel.ClassificationScheme;
-import javax.xml.registry.infomodel.EmailAddress;
-import javax.xml.registry.infomodel.ExternalIdentifier;
-import javax.xml.registry.infomodel.InternationalString;
-import javax.xml.registry.infomodel.Key;
-import javax.xml.registry.infomodel.Organization;
-import javax.xml.registry.infomodel.PersonName;
-import javax.xml.registry.infomodel.PostalAddress;
-import javax.xml.registry.infomodel.Service;
-import javax.xml.registry.infomodel.ServiceBinding;
-import javax.xml.registry.infomodel.TelephoneNumber;
-import javax.xml.registry.infomodel.User;
-
-/**
- * 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 JAXR01PublishOrgTest extends BaseTestCase
-{
-
-    private BusinessLifeCycleManager blm = null;
-
-    public void setUp()
-    {
-        super.setUp();
-    }
-
-    public void tearDown()
-    {
-      super.tearDown();
-    }
-
-    public void testPublish()
-    {
-        BulkResponse response = null;
-        login();
-        try
-        {
-            RegistryService rs = connection.getRegistryService();
-
-            blm = rs.getBusinessLifeCycleManager();
-            Collection<Organization> orgs = new ArrayList<Organization>();
-            Organization org = createOrganization();
-
-            orgs.add(org);
-            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());
-                }
-            }
-            
-            BusinessQueryManager bqm = rs.getBusinessQueryManager();
-            System.out.println("We have the Business Query Manager");
-
-            // 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("%Kurt%");
-
-            // Find based upon qualifier type and values
-            System.out.println("\n-- searching the registry --\n");
-            response =
-                    bqm.findOrganizations(findQualifiers,
-                            namePatterns,
-                            null,
-                            null,
-                            null,
-                            null);
-            
-        } catch (JAXRException e) {
-            e.printStackTrace();
-			fail(e.getMessage());
-        }
-        assertNotNull(response);
-    }
-
-    /**
-     * Creates a Jaxr Organization with 1 or more services
-     * @return
-     * @throws JAXRException
-     */
-    private Organization createOrganization()
-            throws JAXRException
-    {
-        Organization org = blm.createOrganization(getIString("Kurt SCOUT TEST"));
-        org.setDescription(getIString("Apache Software Foundation"));
-        Service service = blm.createService(getIString("Apache JAXR Service with Binding"));
-        service.setDescription(getIString("Services of UDDI Registry"));
-        
-        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");
-	    service.addServiceBinding(serviceBinding);
-        
-        User user = blm.createUser();
-        org.setPrimaryContact(user);
-        PersonName personName = blm.createPersonName("Anil S");
-        TelephoneNumber telephoneNumber = blm.createTelephoneNumber();
-        telephoneNumber.setNumber("410-666-7777");
-        telephoneNumber.setType(null);
-        PostalAddress address
-                = blm.createPostalAddress("1901",
-                        "Munsey Drive", "Forest Hill",
-                        "MD", "USA", "21050-2747", "");
-        Collection<PostalAddress> postalAddresses = new ArrayList<PostalAddress>();
-        postalAddresses.add(address);
-        Collection<EmailAddress> emailAddresses = new ArrayList<EmailAddress>();
-        EmailAddress emailAddress = blm.createEmailAddress("anil@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);
-
-        ClassificationScheme cScheme = getClassificationScheme("ntis-gov:naics", "");
-        Key cKey = blm.createKey("uuid:C0B9FE13-324F-413D-5A5B-2004DB8E5CC2");
-        cScheme.setKey(cKey);
-        Classification classification = blm.createClassification(cScheme,
-                "Computer Systems Design and Related Services",
-                "5415");
-        org.addClassification(classification);
-        ClassificationScheme cScheme1 = getClassificationScheme("D-U-N-S", "");
-        Key cKey1 = blm.createKey("uuid:3367C81E-FF1F-4D5A-B202-3EB13AD02423");
-        cScheme1.setKey(cKey1);
-        ExternalIdentifier ei =
-                blm.createExternalIdentifier(cScheme1, "D-U-N-S number",
-                        "08-146-6849");
-        org.addExternalIdentifier(ei);
-        org.addService(service);
-        return org;
-    }
-
-    
-
-    private InternationalString getIString(String str)
-            throws JAXRException
-    {
-        return blm.createInternationalString(str);
-    }
-
-    private ClassificationScheme getClassificationScheme(String str1, String str2)
-            throws JAXRException
-    {
-        ClassificationScheme cs = blm.createClassificationScheme(getIString(str1),
-                getIString(str2));
-        return cs;
-    }
-
-}
diff --git a/scout/src/test/java/org/apache/ws/scout/JAXR02QueryOrgTest.java b/scout/src/test/java/org/apache/ws/scout/JAXR02QueryOrgTest.java
deleted file mode 100644
index 352c73c..0000000
--- a/scout/src/test/java/org/apache/ws/scout/JAXR02QueryOrgTest.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/**

- *

- * 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.BusinessQueryManager;

-import javax.xml.registry.FindQualifier;

-import javax.xml.registry.JAXRException;

-import javax.xml.registry.RegistryService;

-import javax.xml.registry.infomodel.Classification;

-import javax.xml.registry.infomodel.EmailAddress;

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

-

-/**

- * Testcase for JaxrQuery

- * @author <mailto:dims@yahoo.com>Davanum Srinivas

- * @author <mailto:anil@apache.org>Anil Saldhana

- */

-public class JAXR02QueryOrgTest extends BaseTestCase

-{

-    String queryString = "USA";

-    

-    public void setUp() {

-    	super.setUp();

-    }

-    

-    public void tearDown() {

-    	super.tearDown();

-    }

-

-    public void testQuery() throws Exception

-    {

-

-        try

-        {

-            // Get registry service and business query manager

-            RegistryService rs = connection.getRegistryService();

-            BusinessQueryManager bqm = rs.getBusinessQueryManager();

-            System.out.println("We have the Business Query Manager");

-

-            // 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("%" + queryString + "%");

-

-            // 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);

-

-            // check how many organisation we have matched

-            Collection orgs = response.getCollection();

-            if (orgs == null)

-            {

-                System.out.println("\n-- Matched 0 orgs");

-

-            } else

-            {

-                System.out.println("\n-- Matched " + orgs.size() + " organisations --\n");

-

-                // then step through them

-                for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)

-                {

-                    Organization org = (Organization) orgIter.next();

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

-                    // Print spacer between organizations

-                    System.out.println(" --- ");

-                }

-            }//end else

-        } catch (JAXRException e)

-        {

-            e.printStackTrace();

-			fail(e.getMessage());

-        } 

-    }

-

-    private static 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());

-            }

-        }

-    }

-

-    private static 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());

-            }

-        }

-    }

-

-    private static String getName(RegistryObject ro) throws JAXRException

-    {

-        if (ro != null && ro.getName() != null)

-        {

-            return ro.getName().getValue();

-        }

-        return "";

-    }

-

-    private static String getDescription(RegistryObject ro) throws JAXRException

-    {

-        if (ro != null && ro.getDescription() != null)

-        {

-            return ro.getDescription().getValue();

-        }

-        return "";

-    }

-

-    private static String getKey(RegistryObject ro) throws JAXRException

-    {

-        if (ro != null && ro.getKey() != null)

-        {

-            return ro.getKey().getId();

-        }

-        return "";

-    }

-

-    private static 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());

-    	}

-    }

-}

diff --git a/scout/src/test/java/org/apache/ws/scout/JAXR03DeleteOrgTest.java b/scout/src/test/java/org/apache/ws/scout/JAXR03DeleteOrgTest.java
deleted file mode 100644
index 7ac79f8..0000000
--- a/scout/src/test/java/org/apache/ws/scout/JAXR03DeleteOrgTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/**

- *

- * 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.RegistryService;

-import javax.xml.registry.infomodel.Key;

-import javax.xml.registry.infomodel.Organization;

-

-/**

- * Testcase for Delete organization.

- * 

- * 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 JAXR03DeleteOrgTest extends BaseTestCase

-{

-    

-    String queryString = "USA -- APACHE SCOUT TEST";

-

-    BusinessQueryManager bqm = null;

-    BusinessLifeCycleManager blm = null;

-    

-    @Override

-    public void setUp() {

-    	// TODO Auto-generated method stub

-    	super.setUp();

-    }

-    

-    @Override

-    public void tearDown() {

-    	// TODO Auto-generated method stub

-    	super.tearDown();

-    }

-

-	public void testDelete() throws Exception

-    {

-		login();

-        try

-        {

-            // Get registry service and business query manager

-            RegistryService rs = connection.getRegistryService();

-            bqm = rs.getBusinessQueryManager();

-            blm = rs.getBusinessLifeCycleManager();

-            System.out.println("We have the Business Query Manager");

-

-            Collection orgs = findOrganizationsByName(queryString);

-

-            if (orgs == null)

-            {

-                System.out.println("\n-- Matched 0 orgs");

-

-            } else

-            {

-            	for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)

-            	{

-            		Organization org = (Organization) orgIter.next();

-            		deleteOrgnanization(org);

-            	}

-            }//end else

-        } catch (JAXRException e)

-        {

-            e.printStackTrace();

-			fail(e.getMessage());

-        }

-

-    }

-

-    private 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 + "%");

-    	

-    	BulkResponse response;

-    	

-    	// Find based upon qualifier type and values

-    	System.out.println("\n-- searching the registry --\n");

-    	response =

-    		bqm.findOrganizations(findQualifiers,

-    				namePatterns,

-    				null,

-    				null,

-    				null,

-    				null);

-    	

-    	return response.getCollection();

-    }

-    

-    private void deleteOrgnanization(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);

-    		}

-    	}

-    }

-

-}

diff --git a/scout/src/test/java/org/apache/ws/scout/JAXRQueryTest.java b/scout/src/test/java/org/apache/ws/scout/JAXRQueryTest.java
deleted file mode 100644
index 443c053..0000000
--- a/scout/src/test/java/org/apache/ws/scout/JAXRQueryTest.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/**

- *

- * 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.BusinessQueryManager;

-import javax.xml.registry.FindQualifier;

-import javax.xml.registry.JAXRException;

-import javax.xml.registry.RegistryService;

-import javax.xml.registry.infomodel.EmailAddress;

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

-

-/**

- * Testcase for JaxrQuery

- * @author <mailto:dims@yahoo.com>Davanum Srinivas

- * @author <mailto:anil@apache.org>Anil Saldhana

- */

-public class JAXRQueryTest extends BaseTestCase

-{

-	@Override

-	public void setUp() {

-		// TODO Auto-generated method stub

-		super.setUp();

-	}

-	

-	@Override

-	public void tearDown() {

-		// TODO Auto-generated method stub

-		super.tearDown();

-	}

-    public void testQuery() throws Exception

-    {

-        String queryString = "juddi";

-

-        try

-        {

-            // Get registry service and business query manager

-            RegistryService rs = connection.getRegistryService();

-            BusinessQueryManager bqm = rs.getBusinessQueryManager();

-            System.out.println("We have the Business Query Manager");

-

-            // 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("%" + queryString + "%");

-

-            // 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);

-

-            // check how many organisation we have matched

-            Collection orgs = response.getCollection();

-            if (orgs == null)

-            {

-                System.out.println("\n-- Matched 0 orgs");

-

-            } else

-            {

-                System.out.println("\n-- Matched " + orgs.size() + " organisations --\n");

-

-                // then step through them

-                for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)

-                {

-                    Organization org = (Organization) orgIter.next();

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

-                    // Print spacer between organizations

-                    System.out.println(" --- ");

-                }

-            }//end else

-        } catch (JAXRException e)

-        {

-            e.printStackTrace();

-        } finally

-        {

-            connection.close();

-        }

-

-    }

-

-    private static 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());

-            }

-        }

-    }

-

-    private static 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());

-            }

-        }

-    }

-

-    private static String getName(RegistryObject ro) throws JAXRException

-    {

-        if (ro != null && ro.getName() != null)

-        {

-            return ro.getName().getValue();

-        }

-        return "";

-    }

-

-    private static String getDescription(RegistryObject ro) throws JAXRException

-    {

-        if (ro != null && ro.getDescription() != null)

-        {

-            return ro.getDescription().getValue();

-        }

-        return "";

-    }

-

-    private static String getKey(RegistryObject ro) throws JAXRException

-    {

-        if (ro != null && ro.getKey() != null)

-        {

-            return ro.getKey().getId();

-        }

-        return "";

-    }

-}

diff --git a/scout/src/test/java/org/apache/ws/scout/JaxrPublishOrgTest.java b/scout/src/test/java/org/apache/ws/scout/JaxrPublishOrgTest.java
deleted file mode 100644
index 4dc4130..0000000
--- a/scout/src/test/java/org/apache/ws/scout/JaxrPublishOrgTest.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- *
- * 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.JAXRResponse;
-import javax.xml.registry.RegistryService;
-import javax.xml.registry.infomodel.Classification;
-import javax.xml.registry.infomodel.ClassificationScheme;
-import javax.xml.registry.infomodel.EmailAddress;
-import javax.xml.registry.infomodel.ExternalIdentifier;
-import javax.xml.registry.infomodel.InternationalString;
-import javax.xml.registry.infomodel.Key;
-import javax.xml.registry.infomodel.Organization;
-import javax.xml.registry.infomodel.PersonName;
-import javax.xml.registry.infomodel.PostalAddress;
-import javax.xml.registry.infomodel.Service;
-import javax.xml.registry.infomodel.TelephoneNumber;
-import javax.xml.registry.infomodel.User;
-
-/**
- * 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 JaxrPublishOrgTest extends BaseTestCase
-{
-    //Tested on a local jboss instance
-    //private String userid = "jboss";
-    //private String passwd = "jboss";
-    private BusinessLifeCycleManager blm = null;
-
-    public void setUp()
-    {
-    	super.setUp();
-    }
-
-    public void tearDown()
-    {
-        super.tearDown();
-    }
-
-    public void testPublish()
-    {
-        login();
-        try
-        {
-            RegistryService rs = connection.getRegistryService();
-
-            blm = rs.getBusinessLifeCycleManager();
-            Collection<Organization> orgs = new ArrayList<Organization>();
-            Organization org = createOrganization();
-
-            orgs.add(org);
-            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();
-        }
-    }
-
-    /**
-     * Creates a Jaxr Organization with 1 or more services
-     * @return
-     * @throws JAXRException
-     */
-    private Organization createOrganization()
-            throws JAXRException
-    {
-        Organization org = blm.createOrganization(getIString("USA"));
-        org.setDescription(getIString("Apache Software Foundation"));
-        Service service = blm.createService(getIString("Apache JAXR Service"));
-        service.setDescription(getIString("Services of UDDI Registry"));
-        User user = blm.createUser();
-        org.setPrimaryContact(user);
-        PersonName personName = blm.createPersonName("Anil S");
-        TelephoneNumber telephoneNumber = blm.createTelephoneNumber();
-        telephoneNumber.setNumber("410-666-7777");
-        telephoneNumber.setType(null);
-        PostalAddress address
-                = blm.createPostalAddress("1901",
-                        "Munsey Drive", "Forest Hill",
-                        "MD", "USA", "21050-2747", "");
-        Collection<PostalAddress> postalAddresses = new ArrayList<PostalAddress>();
-        postalAddresses.add(address);
-        Collection<EmailAddress> emailAddresses = new ArrayList<EmailAddress>();
-        EmailAddress emailAddress = blm.createEmailAddress("anil@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);
-
-        ClassificationScheme cScheme = getClassificationScheme("ntis-gov:naics", "");
-        Key cKey = blm.createKey("uuid:C0B9FE13-324F-413D-5A5B-2004DB8E5CC2");
-        cScheme.setKey(cKey);
-        Classification classification = blm.createClassification(cScheme,
-                "Computer Systems Design and Related Services",
-                "5415");
-        org.addClassification(classification);
-        ClassificationScheme cScheme1 = getClassificationScheme("D-U-N-S", "");
-        Key cKey1 = blm.createKey("uuid:3367C81E-FF1F-4D5A-B202-3EB13AD02423");
-        cScheme1.setKey(cKey1);
-        ExternalIdentifier ei =
-                blm.createExternalIdentifier(cScheme1, "D-U-N-S number",
-                        "08-146-6849");
-        org.addExternalIdentifier(ei);
-        org.addService(service);
-        return org;
-    }
-
-    private InternationalString getIString(String str)
-            throws JAXRException
-    {
-        return blm.createInternationalString(str);
-    }
-
-    private ClassificationScheme getClassificationScheme(String str1, String str2)
-            throws JAXRException
-    {
-        ClassificationScheme cs = blm.createClassificationScheme(getIString(str1),
-                getIString(str2));
-        return cs;
-    }
-
-}
diff --git a/scout/src/test/java/org/apache/ws/scout/Printer.java b/scout/src/test/java/org/apache/ws/scout/Printer.java
new file mode 100644
index 0000000..91269fe
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/Printer.java
@@ -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());
+    	}
+    }
+    
+}
diff --git a/scout/src/test/java/org/apache/ws/scout/Remover.java b/scout/src/test/java/org/apache/ws/scout/Remover.java
new file mode 100644
index 0000000..9a0de3d
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/Remover.java
@@ -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");
+            }
+        }
+    }
+
+ 
+
+}
diff --git a/scout/src/test/java/org/apache/ws/scout/package.html b/scout/src/test/java/org/apache/ws/scout/package.html
new file mode 100644
index 0000000..09fef45
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/package.html
@@ -0,0 +1,5 @@
+<html>

+<body>

+Some base funtionality to make unit testing easier.

+</body>

+</html>
\ No newline at end of file
diff --git a/scout/src/test/java/org/apache/ws/scout/JAXR00ConnectionTest.java b/scout/src/test/java/org/apache/ws/scout/registry/AConnectionTest.java
similarity index 70%
rename from scout/src/test/java/org/apache/ws/scout/JAXR00ConnectionTest.java
rename to scout/src/test/java/org/apache/ws/scout/registry/AConnectionTest.java
index 5c1baf9..da73e66 100644
--- a/scout/src/test/java/org/apache/ws/scout/JAXR00ConnectionTest.java
+++ b/scout/src/test/java/org/apache/ws/scout/registry/AConnectionTest.java
@@ -14,7 +14,10 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.ws.scout;
+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;
@@ -22,25 +25,35 @@
 
 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 Jaxr Publish
+ * Test to check Connection
  * Open source UDDI Browser  <http://www.uddibrowser.org>
  * can be used to check your results
- * @author <mailto:anil@apache.org>Anil Saldhana
+ * @author <mailto:kstam@apache.org>Kurt Stam
  * @since Nov 20, 2004
  */
-public class JAXR00ConnectionTest extends BaseTestCase
+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,
@@ -48,15 +61,18 @@
         Set<PasswordAuthentication> creds = new HashSet<PasswordAuthentication>();
         creds.add(passwdAuth);
 
-        try
-        {
+        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);
     }
 }
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java b/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java
new file mode 100644
index 0000000..ee31547
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/registry/BusinessLifeCyleManagerlTest.java
@@ -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);
+    }
+
+}
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerImplTest.java b/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java
similarity index 95%
rename from scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerImplTest.java
rename to scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java
index 2605017..aca48fb 100644
--- a/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerImplTest.java
+++ b/scout/src/test/java/org/apache/ws/scout/registry/BusinessQueryManagerTest.java
@@ -9,7 +9,7 @@
 /**
  *  Tests the BusinessLifecycleManagerImpl class
  */
-public class BusinessQueryManagerImplTest extends TestCase {
+public class BusinessQueryManagerTest extends TestCase {
 
     public void testFindClassificationSchemeByName() throws JAXRException {
 
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/JAXRLocaleTest.java b/scout/src/test/java/org/apache/ws/scout/registry/JAXRLocaleTest.java
index 9be0a6b..139ed74 100644
--- a/scout/src/test/java/org/apache/ws/scout/registry/JAXRLocaleTest.java
+++ b/scout/src/test/java/org/apache/ws/scout/registry/JAXRLocaleTest.java
@@ -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 {
@@ -192,5 +216,9 @@
     {
         return blm.createInternationalString(locale, str);
     }
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(JAXRLocaleTest.class);
+    }
 
 }
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java b/scout/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java
index 1da4f64..0df976a 100644
--- a/scout/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java
+++ b/scout/src/test/java/org/apache/ws/scout/registry/RegistryServiceTest.java
@@ -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);

     }

+

+   

 }

diff --git a/scout/src/test/java/org/apache/ws/scout/registry/infomodel/package.html b/scout/src/test/java/org/apache/ws/scout/registry/infomodel/package.html
new file mode 100644
index 0000000..2ce222e
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/registry/infomodel/package.html
@@ -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
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/package.html b/scout/src/test/java/org/apache/ws/scout/registry/package.html
new file mode 100644
index 0000000..1ea7e4c
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/registry/package.html
@@ -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
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishConceptTest.java b/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishConceptTest.java
deleted file mode 100644
index 9740046..0000000
--- a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishConceptTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- *
- * 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.publish;
-
-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;
-import javax.xml.registry.RegistryService;
-import javax.xml.registry.infomodel.Classification;
-import javax.xml.registry.infomodel.ClassificationScheme;
-import javax.xml.registry.infomodel.Concept;
-import javax.xml.registry.infomodel.ExternalLink;
-import javax.xml.registry.infomodel.InternationalString;
-import javax.xml.registry.infomodel.Key;
-
-import org.apache.ws.scout.BaseTestCase;
-
-/**
- * Tests publish concepts.
- * 
- * Open source UDDI Browser  <http://www.uddibrowser.org>
- * to check your 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 JAXR01PublishConceptTest extends BaseTestCase
-{
-    private BusinessLifeCycleManager blm = null;
-
-    public void setUp()
-    {
-       super.setUp();
-    }
-
-    public void tearDown()
-    {
-        super.tearDown();
-    }
-
-    public void testPublishConcept()
-    {
-        login();
-        try
-        {
-            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.setDescription(is);
-
-
-            //Lets provide a link to juddi registry
-            ExternalLink wslink =
-                    blm.createExternalLink("http://to-rhaps4.toronto.redhat.com:9000/juddi",
-                            "juddi");
-            concept.addExternalLink(wslink);
-            Classification cl = createClassificationForUDDI(bqm);
-
-            concept.addClassification(cl);
-
-            Collection<Concept> concepts = new ArrayList<Concept>();
-            concepts.add(concept);
-
-            BulkResponse br = blm.saveConcepts(concepts);
-            if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
-            {
-                System.out.println("Concept 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());
-                }
-            }
-        } catch (JAXRException e)
-        {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
-    }
-
-    private Classification createClassificationForUDDI(BusinessQueryManager bqm)
-            throws JAXRException
-    {
-        //Scheme which maps onto uddi tmodel
-        ClassificationScheme udditmodel = bqm.findClassificationSchemeByName(null, "uddi-org:types");
-
-        Classification cl = blm.createClassification(udditmodel, "wsdl", "wsdl");
-        return cl;
-    }
-
-    private InternationalString getIString(String str)
-            throws JAXRException
-    {
-        return blm.createInternationalString(str);
-    }
-
-}
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR02DeleteClassificationSchemeTest.java b/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR02DeleteClassificationSchemeTest.java
deleted file mode 100644
index 368bdea..0000000
--- a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR02DeleteClassificationSchemeTest.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- *
- * 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.publish;
-
-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.RegistryService;
-import javax.xml.registry.infomodel.ClassificationScheme;
-import javax.xml.registry.infomodel.Key;
-
-import org.apache.ws.scout.BaseTestCase;
-
-/**
- * Tests delete (and indirectly, find) classification schemes.
- * 
- * Open source UDDI Browser  <http://www.uddibrowser.org>
- * to check your 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 JAXR02DeleteClassificationSchemeTest extends BaseTestCase
-{
-    String queryString = "testScheme -- APACHE SCOUT TEST";
-
-    private BusinessLifeCycleManager blm = null;
-
-    public void setUp()
-    {
-        super.setUp();
-    }
-
-    public void tearDown()
-    {
-        super.tearDown();
-    }
-
-    public void testDeleteClassificationScheme()
-    {
-        login();
-        try
-        {
-            RegistryService rs = connection.getRegistryService();
-            BusinessQueryManager bqm = rs.getBusinessQueryManager();
-            blm = rs.getBusinessLifeCycleManager();
-
-            Collection<String> findQualifiers = new ArrayList<String>();
-            findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
-            Collection<String> namePatterns = new ArrayList<String>();
-            namePatterns.add("%" + queryString + "%");
-
-            BulkResponse br = bqm.findClassificationSchemes(findQualifiers, namePatterns, null, null);
-
-//          check how many organisation we have matched
-            Collection classificationSchemes = br.getCollection();
-
-            if (classificationSchemes == null)
-            {
-                System.out.println("\n-- Matched 0 orgs");
-
-            } else
-            {
-                System.out.println("\n-- Matched " + classificationSchemes.size() + " concepts --\n");
-
-                // then step through them
-                for (Iterator conceptIter = classificationSchemes.iterator(); conceptIter.hasNext();)
-                {
-                	ClassificationScheme cs = (ClassificationScheme) conceptIter.next();
-                    
-                    System.out.println("Id: " + cs.getKey().getId());
-                    System.out.println("Name: " + cs.getName().getValue());
-
-                    // Print spacer between messages
-                    System.out.println(" --- ");
-                    
-                    deleteClassificationScheme(cs);
-
-                    System.out.println(" === ");
-                }
-            }//end else
-        } catch (JAXRException e)
-        {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
-    }
-
-    private void deleteClassificationScheme(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");
-    		}
-    	}
-    }
-}
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR02DeleteConceptTest.java b/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR02DeleteConceptTest.java
deleted file mode 100644
index 78a2809..0000000
--- a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR02DeleteConceptTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/**
- *
- * 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.publish;
-
-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.RegistryService;
-import javax.xml.registry.infomodel.Concept;
-import javax.xml.registry.infomodel.ExternalLink;
-import javax.xml.registry.infomodel.Key;
-
-import org.apache.ws.scout.BaseTestCase;
-
-/**
- * Tests delete (and indirectly, find) concepts.
- * 
- * Open source UDDI Browser  <http://www.uddibrowser.org>
- * to check your 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 JAXR02DeleteConceptTest extends BaseTestCase
-{
-    String queryString = "Apache Scout Concept -- APACHE SCOUT TEST";
-
-    private BusinessLifeCycleManager blm = null;
-
-    public void setUp()
-    {
-        super.setUp();
-    }
-
-    public void tearDown()
-    {
-        super.tearDown();
-    }
-
-    public void testDeleteConcept()
-    {
-        login();
-        try
-        {
-            RegistryService rs = connection.getRegistryService();
-            BusinessQueryManager bqm = rs.getBusinessQueryManager();
-            blm = rs.getBusinessLifeCycleManager();
-
-            Collection<String> findQualifiers = new ArrayList<String>();
-            findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
-            Collection<String> namePatterns = new ArrayList<String>();
-            namePatterns.add("%" + queryString + "%");
-
-            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 
-                    printExternalLinks(c);
-
-                    // Print spacer between messages
-                    System.out.println(" --- ");
-                    
-                    deleteConcept(c);
-                    
-                    System.out.println(" === ");
-                }
-            }//end else
-        } catch (JAXRException e)
-        {
-            e.printStackTrace();
-            fail(e.getMessage());
-        }
-    }
-
-    private void deleteConcept(Concept c)
-    throws JAXRException
-    {
-    	Key key = c.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");
-    		}
-    	}
-    }
-
-    private void printExternalLinks(Concept c)
-    throws JAXRException
-    {
-    	Collection links = c.getExternalLinks();
-    	for (Iterator lnkIter = links.iterator(); lnkIter.hasNext();)
-    	{
-    		 System.out.println("Link: " + ((ExternalLink) lnkIter.next()).getExternalURI().charAt(0));
-    	}
-    }
-}
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishClassificationSchemeTest.java b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR005ClassificationSchemeTest.java
similarity index 84%
rename from scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishClassificationSchemeTest.java
rename to scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR005ClassificationSchemeTest.java
index fc30d65..2d2343c 100644
--- a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXR01PublishClassificationSchemeTest.java
+++ b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR005ClassificationSchemeTest.java
@@ -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();
@@ -119,5 +129,9 @@
         Classification cl = blm.createClassification(udditmodel, "wsdl", "wsdl");
         return cl;
     }
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(JAXR005ClassificationSchemeTest.class);
+    }
 
 }
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java
new file mode 100644
index 0000000..e03b400
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java
@@ -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);
+    }
+}
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java
new file mode 100644
index 0000000..8dfc7c5
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR020PublishConceptTest.java
@@ -0,0 +1,211 @@
+/**
+ *
+ * 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.LifeCycleManager;
+import javax.xml.registry.RegistryService;
+import javax.xml.registry.infomodel.Classification;
+import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.ExternalLink;
+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.
+ * 
+ * Open source UDDI Browser  <http://www.uddibrowser.org>
+ * to check your 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 JAXR020PublishConceptTest extends BaseTestCase
+{
+    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();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            BusinessQueryManager bqm = rs.getBusinessQueryManager();
+            blm = rs.getBusinessLifeCycleManager();
+           
+            Concept concept = blm.createConcept(null, CONCEPT_NAME, "");
+            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",
+                            "juddi");
+            concept.addExternalLink(wslink);
+            Classification cl = createClassificationForUDDI(bqm);
+
+            concept.addClassification(cl);
+
+            Collection<Concept> concepts = new ArrayList<Concept>();
+            concepts.add(concept);
+
+            Key key=null;
+            BulkResponse br = blm.saveConcepts(concepts);
+            if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
+            {
+                System.out.println("Concept Saved");
+                Collection coll = br.getCollection();
+                Iterator iter = coll.iterator();
+                while (iter.hasNext())
+                {
+                    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());
+                }
+            }
+            
+            Concept savedConcept = (Concept)bqm.getRegistryObject(key.getId(),LifeCycleManager.CONCEPT);
+            System.out.println("Save concept=" + savedConcept);
+            
+        } catch (JAXRException e)
+        {
+            e.printStackTrace();
+            fail(e.getMessage());
+        }
+    }
+
+    private Classification createClassificationForUDDI(BusinessQueryManager bqm)
+            throws JAXRException
+    {
+        //Scheme which maps onto uddi tmodel
+        ClassificationScheme udditmodel = bqm.findClassificationSchemeByName(null, "uddi-org:types");
+
+        Classification cl = blm.createClassification(udditmodel, "wsdl", "wsdl");
+        return cl;
+    }
+    
+    public void testDeleteConcept()
+    {
+        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);
+    }
+
+}
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteAssociationsTest.java b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java
similarity index 82%
rename from scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteAssociationsTest.java
rename to scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java
index 76ce557..ae5a61d 100644
--- a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteAssociationsTest.java
+++ b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java
@@ -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);
+    }
 }
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteServiceTest.java b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR040ServiceTest.java
similarity index 94%
rename from scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteServiceTest.java
rename to scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR040ServiceTest.java
index eaf1f61..ef6ba3e 100644
--- a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteServiceTest.java
+++ b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR040ServiceTest.java
@@ -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;
@@ -32,7 +33,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;
 
 /**
  * Tests Publish, Delete (and indirectly, find) for service bindings.
@@ -49,20 +55,20 @@
  *
  * @since Sep 27, 2005
  */
-public class JAXRPublishAndDeleteServiceTest extends BaseTestCase
+public class JAXR040ServiceTest extends BaseTestCase
 {
-
-	private BusinessLifeCycleManager blm = null;
     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();
@@ -76,6 +82,7 @@
 	 * uses getMethods() to gather test methods, and getMethods() does not
 	 * guarantee order.
 	 */
+    @Test
     public void testPublishFindAndDeleteService()
     {
         login();
@@ -103,11 +110,6 @@
         }
     }
 
-    private InternationalString getIString(String str)
-            throws JAXRException
-    {
-        return blm.createInternationalString(str);
-    }
     
     private void createService(Organization org) throws JAXRException {
         Service service = blm.createService(getIString(serviceName));
@@ -258,4 +260,14 @@
     		}
     	}
     }
+    
+    private InternationalString getIString(String str)
+    throws JAXRException
+    {
+        return blm.createInternationalString(str);
+    }
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(JAXR040ServiceTest.class);
+    }
 }
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteServiceBindingTest.java b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java
similarity index 87%
rename from scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteServiceBindingTest.java
rename to scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java
index 0d6a609..e1ca40a 100644
--- a/scout/src/test/java/org/apache/ws/scout/registry/publish/JAXRPublishAndDeleteServiceBindingTest.java
+++ b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXR050ServiceBindingTest.java
@@ -14,7 +14,9 @@
  *  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;
@@ -25,13 +27,21 @@
 import javax.xml.registry.JAXRException;
 import javax.xml.registry.JAXRResponse;
 import javax.xml.registry.RegistryService;
+import javax.xml.registry.infomodel.Concept;
+import javax.xml.registry.infomodel.ExternalLink;
 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 javax.xml.registry.infomodel.SpecificationLink;
+
+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.
@@ -48,20 +58,19 @@
  *
  * @since Sep 27, 2005
  */
-public class JAXRPublishAndDeleteServiceBindingTest extends BaseTestCase
+public class JAXR050ServiceBindingTest extends BaseTestCase
 {
-
-	private BusinessLifeCycleManager blm = null;
     
     String serviceBindingName = "Apache JAXR Service Binding -- APACHE SCOUT TEST";
     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();
@@ -75,7 +84,7 @@
 	 * uses getMethods() to gather test methods, and getMethods() does not
 	 * guarantee order.
 	 */
-
+    @Test
     public void testPublishFindAndDeleteServiceBinding()
     {
         login();
@@ -110,11 +119,6 @@
         }
     }
 
-    private InternationalString getIString(String str)
-            throws JAXRException
-    {
-        return blm.createInternationalString(str);
-    }
 
     private Key createServiceBinding(Service tmpSvc) throws JAXRException {
     	Key key = null;
@@ -122,7 +126,20 @@
         serviceBinding.setName(getIString(serviceBindingName));
         serviceBinding.setDescription(getIString("UDDI service binding"));
         tmpSvc.addServiceBinding(serviceBinding);
-
+        
+        SpecificationLink specLink = blm.createSpecificationLink();
+        ExternalLink externalLink = blm.createExternalLink("http://localhost:8080/jmx-console", "Scout test");
+        Collection<ExternalLink> externalLinks = new ArrayList<ExternalLink>();
+        externalLinks.add(externalLink);
+        specLink.setExternalLinks(externalLinks);
+        
+        RegistryService rs = connection.getRegistryService();
+        bqm = rs.getBusinessQueryManager();
+        Concept concept = (Concept)bqm.getRegistryObject("uuid:AD61DE98-4DB8-31B2-A299-A2373DC97212",BusinessLifeCycleManager.CONCEPT);
+        specLink.setSpecificationObject(concept);
+        
+        serviceBinding.addSpecificationLink(specLink);
+        
         ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
         serviceBindings.add(serviceBinding);
 
@@ -289,4 +306,14 @@
     		}
     	}
     }
+    
+    private InternationalString getIString(String str)
+    throws JAXRException
+    {
+        return blm.createInternationalString(str);
+    }
+    
+    public static junit.framework.Test suite() {
+        return new JUnit4TestAdapter(JAXR050ServiceBindingTest.class);
+    }
 }
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXRRegistryUnitTest.java b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXRRegistryUnitTest.java
new file mode 100644
index 0000000..a409615
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/registry/qa/JAXRRegistryUnitTest.java
@@ -0,0 +1,345 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.apache.ws.scout.registry.qa;
+
+import static org.junit.Assert.assertEquals;
+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.FindQualifier;
+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 javax.xml.registry.infomodel.User;
+
+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.Remover;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Testing the registry.
+ * 
+ * @author kstam
+ *
+ */
+public class JAXRRegistryUnitTest extends BaseTestCase
+{
+    @Before
+    public void setUp() {
+        super.setUp();
+    }
+
+    @After
+    public void tearDown() {
+        super.tearDown();
+    }
+    
+    @Test
+    public void publishClassificationScheme()
+    {
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            blm = rs.getBusinessLifeCycleManager();
+            ClassificationScheme cScheme = blm.createClassificationScheme("org.jboss.soa.esb.:category", "JBossESB Classification Scheme");
+            ArrayList<ClassificationScheme> cSchemes = new ArrayList<ClassificationScheme>();
+            cSchemes.add(cScheme);
+            BulkResponse br = blm.saveClassificationSchemes(cSchemes);
+            assertEquals(JAXRResponse.STATUS_SUCCESS, br.getStatus());
+        } catch (JAXRException je) {
+            fail(je.getMessage());
+        }
+    }
+   
+	/**
+	 * Tests the successful creation of the RED HAT/JBossESB Organization.
+	 */
+	@Test
+	public void publishOrganization() 
+	{
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            blm = rs.getBusinessLifeCycleManager();
+            Creator creator = new Creator(blm);
+            
+            Collection<Organization> organizations = new ArrayList<Organization>();
+            Organization organization = creator.createOrganization("Red Hat/JBossESB");
+            organizations.add(organization);
+            BulkResponse br = blm.saveOrganizations(organizations);
+			assertEquals(BulkResponse.STATUS_SUCCESS, br.getStatus());
+		} catch (JAXRException je) {
+			je.printStackTrace();
+			assertTrue(false);
+		}
+	}
+	@SuppressWarnings("unchecked")
+    @Test
+	public void findOrganization() 
+	{
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            Finder finder = new Finder(bqm);
+			Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB");
+			Organization org = orgs.iterator().next();
+			assertEquals("Red Hat/JBossESB", org.getName().getValue());
+		} catch (JAXRException je) {
+			fail(je.getMessage());
+		}
+		try {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            Finder finder = new Finder(bqm);
+            Collection<Organization> orgs = finder.findOrganizationsByName("Not Existing Org");
+			assertEquals(0, orgs.size());
+		} catch (JAXRException je) {
+			fail(je.getMessage());
+		}
+	}
+	/**
+	 * Tests the successful registration of a Service.
+	 *
+	 */
+	@SuppressWarnings("unchecked")
+    @Test
+	public void publishService()
+	{
+        login();
+		try {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            Finder finder = new Finder(bqm);
+            Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB");
+            Organization organization = orgs.iterator().next();
+            
+            blm = rs.getBusinessLifeCycleManager();
+            //Adding the category as prefix for the name
+            Service service = blm.createService(blm.createInternationalString("Registry Test ServiceName"));
+            service.setDescription(blm.createInternationalString("Registry Test Service Description"));
+            Collection<String> findQualifiers = new ArrayList<String>();
+            findQualifiers.add(FindQualifier.AND_ALL_KEYS);
+            findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
+            ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, "org.jboss.soa.esb.:category");
+            Classification classification = blm.createClassification(cScheme, "category", "registry");
+            service.addClassification(classification);
+            organization.addService(service);
+            Collection<Service> services = new ArrayList<Service>();
+            services.add(service);
+            BulkResponse br = blm.saveServices(services);
+            assertEquals(BulkResponse.STATUS_SUCCESS, br.getStatus());
+		} catch (JAXRException je) {
+			fail(je.getMessage());
+		}
+	}
+    
+    @Test
+    public void findServicesByClassification()
+    {
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            blm = rs.getBusinessLifeCycleManager();
+            Finder finder = new Finder(bqm);
+            //Find the service
+            Service service = finder.findService("registry","Registry Test ServiceName", blm);
+            assertEquals("Registry Test ServiceName", service.getName().getValue());
+        } catch (JAXRException je) {
+            fail(je.getMessage());
+        }
+    }
+     
+	@Test
+	public void publishServiceBinding()
+	{
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            blm = rs.getBusinessLifeCycleManager();
+            Finder finder = new Finder(bqm);
+            //Find the service
+            Service service = finder.findService("registry","Registry Test ServiceName", blm);
+            
+            ServiceBinding serviceBinding = blm.createServiceBinding();
+            serviceBinding.setDescription(blm.createInternationalString("eprDescription"));
+            String xml = "<epr>epr uri</epr>";
+            serviceBinding.setAccessURI(xml);
+        
+            ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
+            serviceBindings.add(serviceBinding);
+            service.addServiceBindings(serviceBindings);
+            Collection<String> findQualifiers = new ArrayList<String>();
+            findQualifiers.add(FindQualifier.AND_ALL_KEYS);
+            findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
+            ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, "org.jboss.soa.esb.:category");
+            Classification classification = blm.createClassification(cScheme, "category", "registry");
+            service.addClassification(classification);
+           
+            BulkResponse br  = blm.saveServiceBindings(serviceBindings);
+            assertEquals(BulkResponse.STATUS_SUCCESS, br.getStatus());
+            BulkResponse br2  = blm.saveServiceBindings(serviceBindings); //Save one more
+            assertEquals(BulkResponse.STATUS_SUCCESS, br2.getStatus());
+           
+            //Delete one binding
+            Collection<ServiceBinding> serviceBindings2 = finder.findServiceBindings(service.getKey());
+            ServiceBinding serviceBinding2 = serviceBindings2.iterator().next();
+            Remover remover = new Remover(blm);
+            remover.removeServiceBinding(serviceBinding2);
+            
+		} catch (JAXRException re) {
+			fail(re.getMessage());
+		}
+	}
+	/**
+	 * Queries the newly added information
+	 * @throws Exception
+	 */
+	@SuppressWarnings("unchecked")
+    @Test
+	public void findServicesForAnOrganization()
+    {
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            Finder finder = new Finder(bqm);
+			Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB");
+            Organization org = orgs.iterator().next();
+			//Listing out the services and their Bindings
+			System.out.println("-------------------------------------------------");
+            System.out.println("Organization name: " + org.getName().getValue());
+            System.out.println("Description: " + org.getDescription().getValue());
+            System.out.println("Key id: " + org.getKey().getId());
+			User primaryContact = org.getPrimaryContact();
+            System.out.println("Primary Contact: " + primaryContact.getPersonName().getFullName());
+			Collection services = org.getServices();
+			for (Iterator serviceIter = services.iterator();serviceIter.hasNext();) {
+				Service service = (Service) serviceIter.next();
+                System.out.println("- Service Name: " + service.getName().getValue());
+                System.out.println("  Service Key : " + service.getKey().getId());
+				Collection serviceBindings = service.getServiceBindings();
+				for (Iterator serviceBindingIter = serviceBindings.iterator();serviceBindingIter.hasNext();){
+					ServiceBinding serviceBinding = (ServiceBinding) serviceBindingIter.next();
+                    System.out.println("  ServiceBinding Description: " + serviceBinding.getDescription().getValue());
+					String xml = serviceBinding.getAccessURI();
+                    System.out.println("  ServiceBinding URI: " + xml);
+					assertEquals("<epr>epr uri</epr>",xml);
+				}
+			}
+            System.out.println("-------------------------------------------------");
+	    } catch (Exception je) {
+	    	fail(je.getMessage());
+		}
+    }
+    
+    @Test
+    public void deleteService()
+    {
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            blm = rs.getBusinessLifeCycleManager();
+            Finder finder = new Finder(bqm);
+            //Find the service
+            Service service = finder.findService("registry","Registry Test ServiceName", blm);
+            Remover remover = new Remover(blm);
+            remover.removeService(service);
+        } catch (JAXRException je) {
+            fail(je.getMessage());
+        }
+    }
+    @SuppressWarnings("unchecked")
+    @Test
+    public void deleteOrganization()
+    {
+        login();
+        try
+        {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            blm = rs.getBusinessLifeCycleManager();
+            Finder finder = new Finder(bqm);
+            Collection<Organization> orgs = finder.findOrganizationsByName("Red Hat/JBossESB");
+            Organization org = orgs.iterator().next();
+            Remover remover = new Remover(blm);
+            remover.removeOrganization(org);
+        } catch (JAXRException je) {
+            fail(je.getMessage());
+        }
+    }
+    
+    @Test
+    public void deleteClassificationScheme()
+    {
+        login();
+        try {
+            RegistryService rs = connection.getRegistryService();
+            bqm = rs.getBusinessQueryManager();
+            blm = rs.getBusinessLifeCycleManager();
+            Collection<String> findQualifiers = new ArrayList<String>();
+            findQualifiers.add(FindQualifier.AND_ALL_KEYS);
+            findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
+            ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, "org.jboss.soa.esb.:category");
+            Remover remover = new Remover(blm);
+            remover.removeClassificationScheme(cScheme);
+        } catch (JAXRException je) {
+            fail(je.getMessage());
+        }
+    }
+	
+   
+	
+
+	public static junit.framework.Test suite() {
+		return new JUnit4TestAdapter(JAXRRegistryUnitTest.class);
+	}
+
+}
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/qa/package.html b/scout/src/test/java/org/apache/ws/scout/registry/qa/package.html
new file mode 100644
index 0000000..07b045a
--- /dev/null
+++ b/scout/src/test/java/org/apache/ws/scout/registry/qa/package.html
@@ -0,0 +1,5 @@
+<html>

+<body>

+More complex QA tests

+</body>

+</html>
\ No newline at end of file
diff --git a/scout/src/test/java/org/apache/ws/scout/registry/query/JAXRQueryTest.java b/scout/src/test/java/org/apache/ws/scout/registry/query/JAXRQueryTest.java
deleted file mode 100644
index 5b9ba88..0000000
--- a/scout/src/test/java/org/apache/ws/scout/registry/query/JAXRQueryTest.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/**

- *

- * 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.query;

-

-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.RegistryService;

-import javax.xml.registry.infomodel.EmailAddress;

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

-

-import org.apache.ws.scout.BaseTestCase;

-

-/**

- * Testcase for JaxrQuery

- * @author <mailto:dims@yahoo.com>Davanum Srinivas

- * @author <mailto:anil@apache.org>Anil Saldhana

- */

-public class JAXRQueryTest extends BaseTestCase

-{

-	@Override

-	public void setUp() {

-		// TODO Auto-generated method stub

-		super.setUp();

-	}

-	

-	@Override

-	public void tearDown() {

-		// TODO Auto-generated method stub

-		super.tearDown();

-	}

-	

-    public void testQuery() throws Exception

-    {

-        String queryString = "IBM";

-

-        try

-        {

-            // Get registry service and business query manager

-            RegistryService rs = connection.getRegistryService();

-            BusinessQueryManager bqm = rs.getBusinessQueryManager();

-            System.out.println("We have the Business Query Manager");

-

-            // 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("%" + queryString + "%");

-

-            // 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);

-

-            // check how many organisation we have matched

-            Collection orgs = response.getCollection();

-            if (orgs == null)

-            {

-                System.out.println("\n-- Matched 0 orgs");

-

-            } else

-            {

-                System.out.println("\n-- Matched " + orgs.size() + " organisations --\n");

-

-                // then step through them

-                for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)

-                {

-                    Organization org = (Organization) orgIter.next();

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

-                    // Print spacer between organizations

-                    System.out.println(" --- ");

-                }

-            }//end else

-        } catch (JAXRException e)

-        {

-            e.printStackTrace();

-            fail(e.getMessage());

-        } finally

-        {

-            connection.close();

-        }

-

-    }

-

-    private static 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());

-            }

-        }

-    }

-

-    private static 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());

-            }

-        }

-    }

-

-    private static String getName(RegistryObject ro) throws JAXRException

-    {

-        if (ro != null && ro.getName() != null)

-        {

-            return ro.getName().getValue();

-        }

-        return "";

-    }

-

-    private static String getDescription(RegistryObject ro) throws JAXRException

-    {

-        if (ro != null && ro.getDescription() != null)

-        {

-            return ro.getDescription().getValue();

-        }

-        return "";

-    }

-

-    private static String getKey(RegistryObject ro) throws JAXRException

-    {

-        if (ro != null && ro.getKey() != null)

-        {

-            return ro.getKey().getId();

-        }

-        return "";

-    }

-}

diff --git a/scout/src/test/resources/juddi.properties b/scout/src/test/resources/juddi.properties
index 8f9c519..28c383c 100644
--- a/scout/src/test/resources/juddi.properties
+++ b/scout/src/test/resources/juddi.properties
@@ -50,9 +50,9 @@
 # jUDDI DataSource to use

 juddi.dataSource=java:comp/env/jdbc/juddiDB

 # jUDDI database creation 

-juddi.createDatabase=true

+juddi.isCreateDatabase=true

 juddi.databaseExistsSql=select * from BUSINESS_ENTITY

-juddi.sqlFiles=sql/derby/create_database.sql,sql/insert_publishers.sql

+juddi.sqlFiles=juddi-sql/derby/create_database.sql,juddi-sql/insert_publishers.sql

 

 # jUDDI UUIDGen implementation to use

 juddi.uuidgen = org.apache.juddi.uuidgen.DefaultUUIDGen

diff --git a/scout/src/test/resources/log4j.properties b/scout/src/test/resources/log4j.properties
index bba35ca..44e54ff 100644
--- a/scout/src/test/resources/log4j.properties
+++ b/scout/src/test/resources/log4j.properties
@@ -17,7 +17,7 @@
 log4j.appender.LOGFILE.File=scout.log

 

 # Set root category priority to DEBUG and its appender to LOGFILE.

-log4j.rootCategory=WARN, LOGFILE

+log4j.rootCategory=DEBUG, LOGFILE

 

 # Set the Axis enterprise logger category to FATAL and its only appender to CONSOLE.

 log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE
\ No newline at end of file