Package javax.xml.registry

Examples of javax.xml.registry.BulkResponse


    }
  }
 
    @Test
  public void testFindCallerAssociations() {
        BulkResponse br = null;
      try {
          // Are there any associations so far?
            try {
              br = bqm.findCallerAssociations(null,
                new Boolean(true),
                new Boolean(true),
                null);
              if (br.getCollection().size() != 0) {
                fail("Should not reach here - no associations created yet.");
              }
          } catch (Exception e) {
            }

            String orgOne = "Organization One";
            String orgTwo = "Organization Two";
            Organization source = blm.createOrganization(blm.createInternationalString(orgOne));
            Organization target = blm2.createOrganization(blm2.createInternationalString(orgTwo));
             
      Collection orgs = new ArrayList();
      orgs.add(source);
      br = blm.saveOrganizations(orgs);
      if (br.getExceptions() != null)
      {
        fail("Save Organization failed");
      }
     
      Collection sourceKeys = br.getCollection();
      Iterator iter = sourceKeys.iterator();
      Key savekey = null;
      while (iter.hasNext())
      {
        savekey = (Key) iter.next();
      }
      String sourceid  = savekey.getId();
      Organization queried = (Organization) bqm.getRegistryObject(sourceid, LifeCycleManager.ORGANIZATION);
      assertNotNull("Source Org", queried.getName().getValue());
           
      Collection orgstwo = new ArrayList();
      orgstwo.add(target);
            br = blm2.saveOrganizations(orgstwo);
            if (br.getExceptions() != null)
      {
              fail("Save Organizations failed");
            }
            Collection targetKeys = br.getCollection();
            iter = targetKeys.iterator();
            while (iter.hasNext())
            {
              savekey = (Key) iter.next();
            }
           
            String targetid = savekey.getId();
            Organization targetOrg = (Organization) bqm2.getRegistryObject(targetid, LifeCycleManager.ORGANIZATION);
            assertNotNull("Target Org", targetOrg.getName().getValue());

            Concept associationType = null;           
            ClassificationScheme associationTypes =
                bqm.findClassificationSchemeByName(null, "AssociationType");
            Collection types = associationTypes.getChildrenConcepts();
            iter = types.iterator();
            Concept concept = null;
            while (iter.hasNext())
            {
              concept = (Concept) iter.next();
              if (concept.getName().getValue().equals("Implements"))
              {
                associationType = concept;
              }
            }
           
            Association a = blm.createAssociation(targetOrg, associationType);
            a.setSourceObject(queried);
            blm2.confirmAssociation(a);

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

            if (br.getExceptions() != null)
            {
                fail("Save association failed");
            }

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

            Collection aTypes = new ArrayList();
            aTypes.add(associationType);
           
View Full Code Here


          namePatterns.add("%foo%");
         
          ArrayList classifications = new ArrayList();
          classifications.add(type);

          @SuppressWarnings("unused")
      BulkResponse br = bqm.findRegistryPackages(null, namePatterns, classifications, null);
          fail("findRegistryPackages is currently unsupported");
         
//          assertEquals(null, br.getExceptions());
//          assertEquals(br.getCollection().size(), 0);
View Full Code Here

       
        serviceBinding.addSpecificationLink(specLink);
        ArrayList<ServiceBinding> serviceBindings = new ArrayList<ServiceBinding>();
        serviceBindings.add(serviceBinding);

        BulkResponse br = blm.saveServiceBindings(serviceBindings);
        if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
        {
            System.out.println("Service Binding Saved");
            key = (Key) br.getCollection().iterator().next();
            System.out.println("Saved Key=" + key.getId());
        } 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());
View Full Code Here

      System.out.println("\nDeleting service binding with id " + id + "\n");

      Collection<Key> keys = new ArrayList<Key>();
      keys.add(key);
      BulkResponse response = blm.deleteServiceBindings(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();
View Full Code Here

        service.setProvidingOrganization(tmpOrg);

        ArrayList<Service> services = new ArrayList<Service>();
        services.add(service);

        BulkResponse br = blm.saveServices(services);
        if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
        {
            System.out.println("Service Saved");
            Key key = (Key) br.getCollection().iterator().next();
            System.out.println("Saved Key=" + key.getId());
            service.setKey(key);
        } 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());
View Full Code Here

      System.out.println("\nDeleting service with id " + id + "\n");

      Collection<Key> keys = new ArrayList<Key>();
      keys.add(key);
      BulkResponse response = blm.deleteServices(keys);

      Collection exceptions = response.getExceptions();
      if (exceptions == null) {
        Collection retKeys = response.getCollection();
        Iterator keyIter = retKeys.iterator();
        javax.xml.registry.infomodel.Key orgKey = null;
        if (keyIter.hasNext()) {
          orgKey =
            (javax.xml.registry.infomodel.Key) keyIter.next();
View Full Code Here

        Organization org = blm.createOrganization(getIString(tempOrgName));
        org.setDescription(getIString("Temporary organization to test saveService()"));

        Collection<Organization> orgs = new ArrayList<Organization>();
        orgs.add(org);
        BulkResponse br = blm.saveOrganizations(orgs);
       
        if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
        {
          orgKey = (Key) br.getCollection().iterator().next();
            System.out.println("Temporary Organization Created with id=" + orgKey.getId());
            org.setKey(orgKey);
        else
        {
            System.err.println("JAXRExceptions " +
                    "occurred during creation of temporary organization:");
           
            Iterator iter = br.getCollection().iterator();
           
            while (iter.hasNext()) {
              Exception e = (Exception) iter.next();
              System.err.println(e.toString());
            }
View Full Code Here

      System.out.println("\nDeleting temporary organization with id " + id + "\n");

      Collection<Key> keys = new ArrayList<Key>();
      keys.add(key);
      BulkResponse response = blm.deleteOrganizations(keys);

      Collection exceptions = response.getExceptions();
      if (exceptions == null) {
        Collection retKeys = response.getCollection();
        Iterator keyIter = retKeys.iterator();
        Key orgKey = null;
        if (keyIter.hasNext()) {
          orgKey =
            (javax.xml.registry.infomodel.Key) keyIter.next();
View Full Code Here

        Organization org = blm.createOrganization(getIString(tempOrgName));
        org.setDescription(getIString("Temporary organization to test saveService()"));

        Collection<Organization> orgs = new ArrayList<Organization>();
        orgs.add(org);
        BulkResponse br = blm.saveOrganizations(orgs);

        if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
        {
            orgKey = (Key) br.getCollection().iterator().next();
            System.out.println("Temporary Organization Created with id=" + orgKey.getId());
            org.setKey(orgKey);
        else
        {
            System.err.println("JAXRExceptions " +
                    "occurred during creation of temporary organization:");

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

            while (iter.hasNext()) {
                Exception e = (Exception) iter.next();
                System.err.println(e.toString());
            }
View Full Code Here

        System.out.println("\nDeleting temporary organization with id " + id + "\n");

        Collection<Key> keys = new ArrayList<Key>();
        keys.add(key);
        BulkResponse response = blm.deleteOrganizations(keys);

        Collection exceptions = response.getExceptions();
        if (exceptions == null) {
                Collection retKeys = response.getCollection();
                Iterator keyIter = retKeys.iterator();
                Key orgKey = null;
                if (keyIter.hasNext()) {
                        orgKey =
                                (javax.xml.registry.infomodel.Key) keyIter.next();
View Full Code Here

TOP

Related Classes of javax.xml.registry.BulkResponse

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.