[jboss-cvs] jbosstest/src/main/org/jboss/test/jaxr/scout/publish ...

Anil Saldhana anil.saldhana at jboss.com
Mon Jul 24 17:45:05 EDT 2006


  User: asaldhana
  Date: 06/07/24 17:45:05

  Modified:    src/main/org/jboss/test/jaxr/scout/publish  
                        JaxrDeleteOrganizationTestCase.java
                        JaxrSaveOrganizationTestCase.java
  Log:
  JBAS-2621: Cleanup jaxr tests
  
  Revision  Changes    Path
  1.3       +40 -35    jbosstest/src/main/org/jboss/test/jaxr/scout/publish/JaxrDeleteOrganizationTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: JaxrDeleteOrganizationTestCase.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/jaxr/scout/publish/JaxrDeleteOrganizationTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- JaxrDeleteOrganizationTestCase.java	29 Oct 2005 23:41:53 -0000	1.2
  +++ JaxrDeleteOrganizationTestCase.java	24 Jul 2006 21:45:05 -0000	1.3
  @@ -1,39 +1,43 @@
   /*
  -  * JBoss, Home of Professional Open Source
  -  * Copyright 2005, 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.
  -  */
  +* JBoss, Home of Professional Open Source
  +* Copyright 2005, 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.jboss.test.jaxr.scout.publish;
   
  -import junit.framework.TestCase;
  +import org.jboss.test.jaxr.scout.JaxrBaseTestCase;
   
  -import javax.xml.registry.RegistryService;
   import javax.xml.registry.BulkResponse;
  -import javax.xml.registry.JAXRResponse;
   import javax.xml.registry.JAXRException;
  -import javax.xml.registry.infomodel.Organization;
  +import javax.xml.registry.JAXRResponse;
   import javax.xml.registry.infomodel.Key;
  -import java.util.Collection;
  +import javax.xml.registry.infomodel.Organization;
   import java.util.ArrayList;
  +import java.util.Collection;
   import java.util.Iterator;
   
  -import org.jboss.test.jaxr.scout.JaxrBaseTestCase;
  +/**
  + * Checks Deletion of Organization
  + *
  + * @author <mailto:Anil.Saldhana at jboss.org>Anil Saldhana
  + * @since Jan 3, 2005
  + */
   
   public class JaxrDeleteOrganizationTestCase extends JaxrBaseTestCase
   {
  @@ -44,8 +48,7 @@
           login();
           try
           {
  -            rs = connection.getRegistryService();
  -            blm = rs.getBusinessLifeCycleManager();
  +            getJAXREssentials();
               Collection orgs = new ArrayList();
               Organization org = createOrganization("JBOSS");
   
  @@ -53,6 +56,7 @@
               BulkResponse br = blm.saveOrganizations(orgs);
               if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
               {
  +                if ("true".equalsIgnoreCase(debugProp))
                   System.out.println("Organization Saved");
                   Collection coll = br.getCollection();
                   Iterator iter = coll.iterator();
  @@ -60,6 +64,7 @@
                   {
                       Key key = (Key) iter.next();
                       keyid = key.getId();
  +                    if ("true".equalsIgnoreCase(debugProp))
                       System.out.println("Saved Key=" + key.getId());
                       assertNotNull(keyid);
                   }//end while
  
  
  
  1.3       +54 -45    jbosstest/src/main/org/jboss/test/jaxr/scout/publish/JaxrSaveOrganizationTestCase.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: JaxrSaveOrganizationTestCase.java
  ===================================================================
  RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/jaxr/scout/publish/JaxrSaveOrganizationTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- JaxrSaveOrganizationTestCase.java	29 Oct 2005 23:41:53 -0000	1.2
  +++ JaxrSaveOrganizationTestCase.java	24 Jul 2006 21:45:05 -0000	1.3
  @@ -1,65 +1,56 @@
   /*
  -  * JBoss, Home of Professional Open Source
  -  * Copyright 2005, 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.
  -  */
  +* JBoss, Home of Professional Open Source
  +* Copyright 2005, 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.jboss.test.jaxr.scout.publish;
   
   
  -
   import org.jboss.test.jaxr.scout.JaxrBaseTestCase;
   
   import javax.xml.registry.BulkResponse;
   import javax.xml.registry.JAXRException;
   import javax.xml.registry.JAXRResponse;
  -import javax.xml.registry.RegistryService;
  -import javax.xml.registry.BusinessLifeCycleManager;
  -import javax.xml.registry.FindQualifier;
  -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.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;
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Iterator;
   
  -/** Tests Jaxr Save Organization
  +/**
  + * Tests Jaxr Save Organization
  + *
    *  @author <mailto:Anil.Saldhana at jboss.org>Anil Saldhana
    *  @since  Dec 29, 2004
    */
   
   public class JaxrSaveOrganizationTestCase extends JaxrBaseTestCase
   {
  +   private Key orgKey = null;
  +   
       public void testSaveOrg() throws JAXRException
       {
           String keyid = "";
           login();
           try
           {
  -            RegistryService rs = connection.getRegistryService();
  +            rs = connection.getRegistryService();
   
               blm = rs.getBusinessLifeCycleManager();
               Collection orgs = new ArrayList();
  @@ -69,6 +60,7 @@
               BulkResponse br = blm.saveOrganizations(orgs);
               if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
               {
  +                if ("true".equalsIgnoreCase(debugProp))
                   System.out.println("Organization Saved");
                   Collection coll = br.getCollection();
                   Iterator iter = coll.iterator();
  @@ -76,6 +68,7 @@
                   {
                       Key key = (Key) iter.next();
                       keyid = key.getId();
  +                    if ("true".equalsIgnoreCase(debugProp))
                       System.out.println("Saved Key=" + key.getId());
                       assertNotNull(keyid);
                   }//end while
  @@ -97,14 +90,30 @@
               e.printStackTrace();
               fail(e.getMessage());
           }
  -        checBusinessExists(keyid);
  +        checkBusinessExists("JBOSS"); 
       }
   
  -    private void checBusinessExists(String keyid)
  +    private void checkBusinessExists(String bizname)
       {
  -        //TODO:Given a key of a business, query it
  -
  +        String request = "<find_business generic='2.0' xmlns='urn:uddi-org:api_v2'>" +
  +                "<name xml:lang='en'>" + bizname + "</name></find_business>";
  +        String response = null;
  +        try
  +        {
  +            response = rs.makeRegistrySpecificRequest(request);
  +        } catch (Exception e)
  +        {
  +            fail(e.getLocalizedMessage());
       }
  +        if (response == null || "".equals(response))
  +            fail("Find Business failed");
   
  +    }
   
  +    protected void tearDown() throws Exception
  +    {
  +       super.tearDown();
  +       if(this.orgKey != null)
  +          this.deleteOrganization(orgKey);
  +    }
   }
  \ No newline at end of file
  
  
  



More information about the jboss-cvs-commits mailing list