Package javax.xml.registry.infomodel

Examples of javax.xml.registry.infomodel.Key


                    System.out.println("Organization Saved");
                Collection coll = br.getCollection();
                Iterator iter = coll.iterator();
                while (iter.hasNext())
                {
                    Key key = (Key) iter.next();
                    keyid = key.getId();
                    if ("true".equalsIgnoreCase(debugProp))
                        System.out.println("Saved Key=" + key.getId());
                    assertNotNull(keyid);
                }//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());
                }
            }
            checkBusinessExists("JBOSS");
        } catch (JAXRException e)
        {
            log.error("Exception:",e);
            fail(e.getMessage());
        }
        finally
        {
           if(org != null)
           {
              try
              {
                 Key orgkey = org.getKey();
                 if(orgkey != null)
                   this.deleteOrganization(org.getKey());
              }
              catch(Exception e)
              {
View Full Code Here


        String conceptName = "jbosstest concept";
        Collection sbKeys = null;
        Collection serviceKeys = null;
        Collection orgKeys = null;
        Collection conceptKeys = null;
        Key conceptKey = null;
        Key serviceKey = null;
        Key orgKey = null;

        String accessURI = "http://myhost/jaxrTest.jsp";
        login();


        try
        {
            getJAXREssentials();
            String orgname = "Jaxr Org";
            Organization org = blm.createOrganization(getIString(orgname));
            Collection orgs = new ArrayList();
            orgs.add(org);
            BulkResponse br = blm.saveOrganizations(orgs);
            if (br.getExceptions() != null)
            {
                fail("Save Organizations failed ");
            }
            orgKeys = br.getCollection();
            Iterator iter = orgKeys.iterator();
            while (iter.hasNext())
            {
                orgKey = (Key) iter.next();
            }


            org = (Organization) bqm.getRegistryObject(orgKey.getId(), LifeCycleManager.ORGANIZATION);

            Service service = blm.createService(serviceName);
            org.addService(service);
            Collection services = new ArrayList();
            services.add(service);
View Full Code Here

    public void testConfirmAssociation() throws JAXRException
    {
        String orgTarget = "Target Organization2";
        String orgSource = "Source Organization2";
        String type = "Implements";
        Key savekey = null;

        Collection associationKeys = null;
        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>();
                   keyList.add(asskey);
                   blm.deleteAssociations(keyList);
                }
            } catch (JAXRException je)
View Full Code Here

     *
     * @throws JAXRException
     */
    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");
                       }
                    }
                }
              
View Full Code Here

                    System.out.println("Organization Saved");
                Collection coll = br.getCollection();
                Iterator iter = coll.iterator();
                while (iter.hasNext())
                {
                    Key key = (Key) iter.next();
                    keyid = key.getId();
                    if ("true".equalsIgnoreCase(debugProp))
                        System.out.println("Saved Key=" + key.getId());
                    assertNotNull(keyid);
                }//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();
                    log.error("Exception:",e);
                    fail(e.toString());
                }
            }
        } catch (JAXRException e)
        {
            log.error("Exception:",e);
            fail(e.getMessage());
        }
        finally
        {
           if(org != null)
           {
              try
              {
                 Key orgkey = org.getKey();
                 if(orgkey != null)
                   this.deleteOrganization(org.getKey());
              }
              catch(Exception e)
              {
View Full Code Here

    public void testDeleteOrgs() throws Exception
    {
        String keyid = this.saveOrg("DELETEORG");
        assertNotNull(keyid);
        Key key = blm.createKey(keyid);
        this.deleteOrganization(key);
    }
View Full Code Here

      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;
View Full Code Here

         log.debug("Organization Saved");
         Collection coll = br.getCollection();
         Iterator iter = coll.iterator();
         while (iter.hasNext())
         {
            Key key = (Key)iter.next();
            keyid = key.getId();
            log.debug("Saved Key=" + key.getId());
            assertNotNull(keyid);
         }//end while
      }
      else
      {
View Full Code Here

         log.debug("Organization Saved");
         Collection coll = br.getCollection();
         Iterator iter = coll.iterator();
         while (iter.hasNext())
         {
            Key key = (Key)iter.next();
            keyid = key.getId();
            log.debug("Saved Key=" + key.getId());
            assertNotNull(keyid);
         }//end while
      }
      else
      {
View Full Code Here

   public void testDeleteOrgs() throws Exception
   {
      String keyid = this.saveOrg("DELETEORG");
      assertNotNull(keyid);
      Key key = blm.createKey(keyid);
      this.deleteOrganization(key);
   }
View Full Code Here

TOP

Related Classes of javax.xml.registry.infomodel.Key

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.