Package javax.xml.registry

Examples of javax.xml.registry.BusinessLifeCycleManager


        Collection sourceKeys = null;
        Collection targetKeys = null;
        String targetId = null;
        String sourceId = null;
        BusinessQueryManager bqm2 = null;
        BusinessLifeCycleManager blm2 = null;
        Association association = null;

        try
        {
            login();
            getJAXREssentials();

            // second user.
            Connection con2 = loginSecondUser();
            RegistryService rs2 = con2.getRegistryService();
            blm2 = rs2.getBusinessLifeCycleManager();
            bqm2 = rs2.getBusinessQueryManager();

            Organization target = blm2.createOrganization(blm.createInternationalString(orgTarget));
            Organization source = blm.createOrganization(blm.createInternationalString(orgSource));

            Collection orgs = new ArrayList();
            orgs.add(source);
            br = blm.saveOrganizations(orgs);
            if (br.getExceptions() != null)
            {
                fail(" Source:Save Orgs failed");
            }

            sourceKeys = br.getCollection();
            Iterator iter = sourceKeys.iterator();
            while (iter.hasNext())
            {
                savekey = (Key) iter.next();
            }
            sourceId = savekey.getId();

            String objectType = LifeCycleManager.ORGANIZATION;
            Organization pubSource = (Organization) bqm.getRegistryObject(sourceId, objectType);
            assertNotNull("Source retrieved: ", pubSource.getName().getValue());

            orgs.clear();
            orgs.add(target);
            br = blm2.saveOrganizations(orgs);
            if (br.getExceptions() != null)
            {
                fail("Target:Save Orgs failed");
            }
            targetKeys = br.getCollection();
            iter = targetKeys.iterator();
            while (iter.hasNext())
            {
                savekey = (Key) iter.next();
            }
            targetId = savekey.getId();

            Organization pubTarget = (Organization) bqm2.getRegistryObject(targetId, objectType);
            assertNotNull("Target: ", pubTarget.getName().getValue());

            Concept associationType = getAssociationConcept(type);
            if (associationType == null)
                fail(" getAssociationConcept returned null");

            association = blm.createAssociation(pubTarget, associationType);
            association.setSourceObject(pubSource);

            blm2.confirmAssociation(association);

            Collection associations = new ArrayList();
            associations.add(association);
            br = blm2.saveAssociations(associations, false);
            if (br.getExceptions() != null)
            {
                fail(" Save Association did not complete due to errors");
            }

            associationKeys = br.getCollection();
            iter = associationKeys.iterator();

            Collection associationTypes = new ArrayList();
            associationTypes.add(associationType);
            //confirmedByCaller = false, confirmedByOtherParty = true.
            br = bqm.findCallerAssociations(null,
                    new Boolean(false),
                    new Boolean(true), associationTypes);
            if (br.getExceptions() != null)
            {
                fail(" Find Caller Association failed");
            }
            associations = br.getCollection();
            if (associations.size() == 0)
            {
                fail(" Retrieving Associations failed");
            }
            iter = associations.iterator();
            while (iter.hasNext())
            {
                association = (Association) iter.next();
            }

            assertNotNull("Association type:", association.getAssociationType().getValue());
            if (association.isConfirmed())
            {
                fail("FAIL: isConfirmed returned true  ");
            }
            if (association.isConfirmedBySourceOwner())
            {
                fail("FAIL: isConfirmedBySourceOwner returned true  ");
            }

            blm.confirmAssociation(association);
            br = blm.saveAssociations(associations, false);
            if (br.getExceptions() != null)
            {
                fail("Error:  saveAssociations failed  ");
            }


            br = bqm.findCallerAssociations(null, new Boolean(true), new Boolean(true), associationTypes);

            if (br.getExceptions() != null)
            {
                fail("Error:  findCallerAssociations failed  ");
            }

            associations = br.getCollection();
            iter = associations.iterator();
            while (iter.hasNext())
            {
                association = (Association) iter.next();
            }

            if (!(association.isConfirmed()))
            {
                fail("FAIL: isConfirmed incorrectly returned false ");
            }

            if (!(association.isConfirmedBySourceOwner()))
            {
                fail("FAIL: isConfirmedBySourceOwner incorrectly returned false ");
            }
        } catch (Exception e)
        {
            e.printStackTrace();
            fail("Caught unexpected exception: " + e.getMessage());
        } finally
        {
            // Clean up
            try
            {
                blm2.deleteOrganizations(targetKeys);
                blm.deleteOrganizations(sourceKeys);
                if(association != null)
                {
                   Key asskey = association.getKey();
                   List<Key> keyList = new ArrayList<Key>();
View Full Code Here


    public void testDeleteAssociations() throws JAXRException
    {
        Key savekey = null;
        Key assockey = null;
        BusinessQueryManager bqm2 = null;
        BusinessLifeCycleManager blm2 = null;
        Collection sourceKeys = null;
        Collection targetKeys = null;


        try
        {
            login();
            getJAXREssentials();
            // second user.
            Connection con2 = loginSecondUser();
            RegistryService rs2 = con2.getRegistryService();
            blm2 = rs2.getBusinessLifeCycleManager();
            bqm2 = rs2.getBusinessQueryManager();
            String orgTarget = "Target Organization";
            String orgSource = "Source Organization";

            Organization target = blm2.createOrganization(blm.createInternationalString(orgTarget));
            Organization source = blm.createOrganization(blm.createInternationalString(orgSource));

            Collection orgs = new ArrayList();
            orgs.add(source);
            br = blm.saveOrganizations(orgs);
            if (br.getExceptions() != null)
            {
                fail(" Source::Save Organizations failed");
            }
            log.debug("Saved Source Organization");
           
            sourceKeys = br.getCollection();
            Iterator iter = sourceKeys.iterator();
            while (iter.hasNext())
            {
                savekey = (Key) iter.next();
            }
            String sourceid = savekey.getId();
            String objectType = LifeCycleManager.ORGANIZATION;

            Organization pubSource = (Organization) bqm.getRegistryObject(sourceid, objectType);
            assertNotNull("Source Org", pubSource.getName().getValue());

            orgs.clear();
            orgs.add(target);
            br = blm2.saveOrganizations(orgs);
            if (br.getExceptions() != null)
            {
                fail("Target:: Save Organizations failed");
            }
            targetKeys = br.getCollection();
            iter = targetKeys.iterator();
            while (iter.hasNext())
            {
                savekey = (Key) iter.next();
            }
            String targetid = savekey.getId();
            Organization targetOrg = (Organization) bqm2.getRegistryObject(targetid, objectType);
            assertNotNull("Target Org", targetOrg.getName().getValue());

            Concept associationType = getAssociationConcept("Implements");
            assertNotNull("AssociationType", associationType);

            Association a = blm.createAssociation(targetOrg, associationType);
            a.setSourceObject(pubSource);
            a.setTargetObject(targetOrg);

            blm.confirmAssociation(a);
            blm2.confirmAssociation(a);

            log.debug("Confirmed the association");
           
            // publish the Association
            Collection associations = new ArrayList();
            associations.add(a);
            br = blm2.saveAssociations(associations, false);

            if (br.getExceptions() != null)
            {
                fail("Second User :save Association failed");
            }

            log.debug("Second User: saved the association");
           
            br = bqm.findCallerAssociations(null,
                    new Boolean(true),
                    new Boolean(true),
                    null);

            if (br.getExceptions() == null)
            {
                Collection results = br.getCollection();
                assertTrue("Result is 1",results.size() == 1);
                if (results.size() > 0)
                {
                    iter = results.iterator();
                    while (iter.hasNext())
                    {
                        Association a1 = (Association) iter.next();
                        assockey = a1.getKey();
                        ScoutUtil.validateAssociation(a1, orgSource);
                    }
                }
            }
            if (assockey != null)
            {
                Collection keys = new ArrayList();
                keys.add(assockey);
                br = blm.deleteAssociations(keys);
               
                if(br.getExceptions() != null)
                   fail("Deletion of Associations failed");

                System.out.println("JBAS-7129 needs to be fixed");
               
               
                BulkResponse brq = bqm.findCallerAssociations(null, Boolean.TRUE, Boolean.TRUE, null);
                if (brq.getExceptions() == null)
                {
                    Collection retAssocs = brq.getCollection();
                    if (retAssocs.size() == 0)
                    {
                        //Pass
                    } else
                    {
                       Iterator iterAss = retAssocs.iterator();
                       while(iterAss.hasNext())
                       {
                          Association assc = (Association) iterAss.next();
                          if(assc.getKey().getId().equals(assockey.getId()))
                             fail("Deleted Association found");
                       }
                    }
                }
              
            }

        } catch (Exception e)
        {
           log.error("Exception::",e);
           fail(" failed with :" + e.getMessage());
        } finally
        {
            // Clean up
            try
            {
                blm2.deleteOrganizations(targetKeys);
                blm.deleteOrganizations(sourceKeys);
            } catch (JAXRException je)
            {
                System.out.println("Error: Clean Up Failed");
            }
View Full Code Here

    Connection connection = jaxrConnectionFactory.getConnection();
        try {
      final Concept jbossTModel = registry.getJBossESBTModel(connection);

      RegistryService rs = connection.getRegistryService();
            BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
            BusinessQueryManager bqm = rs.getBusinessQueryManager();
            ServiceBinding serviceBinding = blm.createServiceBinding();
            String xml = EPRHelper.toXMLString(epr);
            serviceBinding.setAccessURI(xml);
           
            ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
            SpecificationLink sl = new SpecificationLinkImpl(blm);
            sl.setSpecificationObject(jbossTModel);
            serviceBinding.getSpecificationLinks().add(sl);
            if ("3.0".equals(Configuration.getRegistryUDDIVersion())) {
               if ((eprDescription == null) || ("".equals(eprDescription))) {
                   serviceBinding.setDescription(blm.createInternationalString(JAXRRegistryImpl.REGISTERED_BY_JBOSSESB));
               }
            } else {
               serviceBinding.setDescription(blm.createInternationalString(eprDescription));
            }
            serviceBindings.add(serviceBinding);
           
            service.addServiceBindings(serviceBindings);
            ClassificationScheme cScheme = registry.getClassificationScheme(bqm, blm);
            Classification classification = blm.createClassification(cScheme, "category", TEST_SERVICE_CATEGORY);
            service.addClassification(classification);
           
            registry.saveRegistryObject(serviceBinding, jaxrConnectionFactory);
        } catch (JAXRException je) {
            throw new RegistryException(je.getLocalizedMessage(), je);
View Full Code Here

     
      final Concept jbossTModel = registry.getJBossESBTModel(connection);
      // Get registry service and business query manager
      RegistryService rs = connection.getRegistryService();
      BusinessQueryManager bqm = rs.getBusinessQueryManager();
            BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
            final ClassificationScheme cScheme = registry.getClassificationScheme(bqm, blm) ;
            Collection<Classification> classifications = new ArrayList<Classification>();
            Classification classification =
                blm.createClassification(
                  cScheme,
                  "category", category);
            classifications.add(classification);
      Collection<String> namePatterns = new ArrayList<String>();
      namePatterns.add(name);
View Full Code Here

        Connection connection = jaxrConnectionFactory.getConnection();
    try {
      // Get registry service and business query manager
      RegistryService rs = connection.getRegistryService();
      BusinessQueryManager bqm = rs.getBusinessQueryManager();
      BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
      ClassificationScheme classificationScheme = bqm.findClassificationSchemeByName(null, "uddi-org:general_keywords");
      Classification classification = blm.createClassification(classificationScheme,
          "Test transformation service", "transformation");
      Collection<Classification> classifications = new ArrayList<Classification>();
      classifications.add(classification);
      //Here I'd like to test filtering by this classification, but scout ignored the classification
      String name=classificationScheme.getName().getValue();
View Full Code Here

    Organization organization = getJBossESBOrganization();
    Connection connection = JAXRConnectionSingleton.getConnection(jaxrConnectionFactory);
    try {
      RegistryService rs = connection.getRegistryService();
            BusinessQueryManager bqm = rs.getBusinessQueryManager();
      BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
        //Adding the category as prefix for the name
      service = blm.createService(blm.createInternationalString(serviceName));
      if (isV3 && ((serviceDescription == null) || ("".equals(serviceDescription)))) {
        service.setDescription(blm.createInternationalString(SERVICE_DESCRIPTION));
      } else {
        service.setDescription(blm.createInternationalString(serviceDescription));
      }
      ClassificationScheme cScheme = getClassificationScheme(bqm, blm);
            Classification classification = blm.createClassification(cScheme, "category", category);
      service.addClassification(classification);
      organization.addService(service);
      saveRegistryObject(service, jaxrConnectionFactory);
    } finally {
      JAXRConnectionSingleton.recycleConnection(jaxrConnectionFactory, connection);
View Full Code Here

            service = findService(category, serviceName);
            if (service==null) {
                throw new ServiceNotFoundException("No such EPR found for service with name = " + serviceName);
            }
            RegistryService rs = connection.getRegistryService();
            BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
            Collection<Key> serviceKeys = new ArrayList<Key>();
            serviceKeys.add(service.getKey());
            blm.deleteServices(serviceKeys);
        } catch (JAXRException je) {
            throw new RegistryException(je.getLocalizedMessage(), je);
        } finally {
      JAXRConnectionSingleton.recycleConnection(jaxrConnectionFactory, connection);
        }
View Full Code Here

                logger.log(Level.DEBUG, "Service " + serviceName + " does not yet exist, creating now..");
                service = registerService(category, serviceName, serviceDescription);
            }

            RegistryService rs = connection.getRegistryService();
            BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
            BusinessQueryManager bqm = rs.getBusinessQueryManager();
            ServiceBinding serviceBinding = blm.createServiceBinding();
            String xml = EPRHelper.toXMLString(epr);
            serviceBinding.setAccessURI(xml);
           
            ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
            SpecificationLink sl = new SpecificationLinkImpl(blm);
            sl.setSpecificationObject(jbossTModel);
            serviceBinding.getSpecificationLinks().add(sl);
            if (isV3 && ((eprDescription == null) || ("".equals(eprDescription)))) {
               serviceBinding.setDescription(blm.createInternationalString(REGISTERED_BY_JBOSSESB));
            } else {
               serviceBinding.setDescription(blm.createInternationalString(eprDescription));
            }
            serviceBindings.add(serviceBinding);
           
            service.addServiceBindings(serviceBindings);
            ClassificationScheme cScheme = getClassificationScheme(bqm, blm);
            Classification classification = blm.createClassification(cScheme, "category", category);
            service.addClassification(classification);
           
            saveRegistryObject(serviceBinding, jaxrConnectionFactory);
        } catch (JAXRException je) {
            throw new RegistryException(je.getLocalizedMessage(), je);
View Full Code Here

                        logger.error(ue.getMessage(), ue);
                    }
                }
                if (eprXML.equals(toBeDeletedEPRXml)) {
                    RegistryService rs = connection.getRegistryService();
                    BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
                    Collection<Key> serviceBindingKeys = new ArrayList<Key>();
                    serviceBindingKeys.add(serviceBinding.getKey());
                    blm.deleteServiceBindings(serviceBindingKeys);
                    return;
                }
            }
            throw new RegistryException("No such EPR found for service with name = "
                    + serviceName + " and EPR=" + toBeDeletedEPR);
View Full Code Here

    try {
      final Concept jbossTModel = getJBossESBTModel(connection);
      // Get registry service and business query manager
      RegistryService rs = connection.getRegistryService();
      BusinessQueryManager bqm = rs.getBusinessQueryManager();
            BusinessLifeCycleManager blm = rs.getBusinessLifeCycleManager();
            final ClassificationScheme cScheme = getClassificationScheme(bqm, blm) ;
            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);
View Full Code Here

TOP

Related Classes of javax.xml.registry.BusinessLifeCycleManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.