Package org.apache.qpid.client.messaging.address

Examples of org.apache.qpid.client.messaging.address.Link$Subscription


     * If there are none, a zero-length array is returned.
     */
    public Subscription[] getSubscriptions() {

        synchronized (subscriptions) {
            Subscription results[] = new Subscription[subscriptions.size()];
            return ((Subscription[]) subscriptions.values().toArray(results));
        }

    }
View Full Code Here


  public void getSamSyndicatorSubscriptionResultsWithChunkingOnFind(String authInfoSam) {   
    try {
      GetSubscriptionResults getSubResultsIn = (GetSubscriptionResults)EntityCreator.buildFromDoc(SAM_SUBSCRIPTIONRESULTS2_XML, "org.uddi.sub_v3");
      getSubResultsIn.setAuthInfo(authInfoSam);
     
      Subscription subIn = (Subscription)EntityCreator.buildFromDoc(SAM_SUBSCRIPTION2_XML, "org.uddi.sub_v3");
     
      int expectedIterations = FINDQUALIFIER_TMODEL_TOTAL / subIn.getMaxEntities();
      if (FINDQUALIFIER_TMODEL_TOTAL % subIn.getMaxEntities() >0)
        expectedIterations++;
     
      String chunkToken = "";
      int iterations = 0;
      while (chunkToken != null) {
        iterations++;
       
        getSubResultsIn.setChunkToken(chunkToken);
        SubscriptionResultsList result = subscription.getSubscriptionResults(getSubResultsIn);
        if (result == null)
          Assert.fail("Null result from getSubscriptionResults operation");
       
        TModelList tmodelList = result.getTModelList();
        if (tmodelList == null)
          Assert.fail("No result from getSubscriptionResults operation on chunk attempt " + iterations);

        int resultSize = tmodelList.getTModelInfos().getTModelInfo().size();
       
        if (iterations < expectedIterations)
          assertEquals(resultSize, subIn.getMaxEntities().intValue());
        else {
          if (FINDQUALIFIER_TMODEL_TOTAL % subIn.getMaxEntities() > 0)
            assertEquals(resultSize, FINDQUALIFIER_TMODEL_TOTAL % subIn.getMaxEntities());
          else
            assertEquals(resultSize, subIn.getMaxEntities().intValue());
        }
       
        chunkToken = result.getChunkToken();
       
      }
View Full Code Here

  public void getSamSyndicatorSubscriptionResultsWithChunkingOnGet(String authInfoSam) {
    try {
      GetSubscriptionResults getSubResultsIn = (GetSubscriptionResults)EntityCreator.buildFromDoc(SAM_SUBSCRIPTIONRESULTS3_XML, "org.uddi.sub_v3");
      getSubResultsIn.setAuthInfo(authInfoSam);
         
      Subscription subIn = (Subscription)EntityCreator.buildFromDoc(SAM_SUBSCRIPTION3_XML, "org.uddi.sub_v3");
     
      int expectedIterations = FINDQUALIFIER_TMODEL_TOTAL / subIn.getMaxEntities();
      if (FINDQUALIFIER_TMODEL_TOTAL % subIn.getMaxEntities() >0)
        expectedIterations++;
     
      String chunkToken = "";
      int iterations = 0;
      while (chunkToken != null) {
        iterations++;
       
        getSubResultsIn.setChunkToken(chunkToken);
        SubscriptionResultsList result = subscription.getSubscriptionResults(getSubResultsIn);
        if (result == null)
          Assert.fail("Null result from getSubscriptionResults operation");
       
        TModelDetail tmodelDetail = result.getTModelDetail();
        if (tmodelDetail == null)
          Assert.fail("No result from getSubscriptionResults operation on chunk attempt " + iterations);

        int resultSize = tmodelDetail.getTModel().size();
       
        if (iterations < expectedIterations)
          assertEquals(resultSize, subIn.getMaxEntities().intValue());
        else {
          if (FINDQUALIFIER_TMODEL_TOTAL % subIn.getMaxEntities() > 0)
            assertEquals(resultSize, FINDQUALIFIER_TMODEL_TOTAL % subIn.getMaxEntities());
          else
            assertEquals(resultSize, subIn.getMaxEntities().intValue());
        }
       
        chunkToken = result.getChunkToken();
       
      }
View Full Code Here

   
  }
 
  public void saveSubscription(String authInfo, String subscriptionXML, String subscriptionKey) {
    try {
      Subscription subIn = (Subscription)EntityCreator.buildFromDoc(subscriptionXML, "org.uddi.sub_v3");
      List<Subscription> subscriptionList = new ArrayList<Subscription>();
      subscriptionList.add(subIn);
      Holder<List<Subscription>> subscriptionHolder = new Holder<List<Subscription>>();
      subscriptionHolder.value = subscriptionList;
     
      subscription.saveSubscription(authInfo, subscriptionHolder);
     
      Subscription subDirectOut = subscriptionHolder.value.get(0);
      assertEquals(subIn.getSubscriptionKey(), subDirectOut.getSubscriptionKey());
     
      List<Subscription> outSubscriptionList = subscription.getSubscriptions(authInfo);
      Assert.assertNotNull(outSubscriptionList);
      Subscription subOut = outSubscriptionList.get(0);
     
      assertEquals(subIn.getSubscriptionKey(), subOut.getSubscriptionKey());
      assertEquals(subDirectOut.getExpiresAfter().getMonth(), subOut.getExpiresAfter().getMonth());
      assertEquals(subDirectOut.getExpiresAfter().getDay(), subOut.getExpiresAfter().getDay());
      assertEquals(subDirectOut.getExpiresAfter().getYear(), subOut.getExpiresAfter().getYear());
     
      //assertEquals(subIn.getSubscriptionFilter().getFindService().getName().get(0).getValue(),
      //       subOut.getSubscriptionFilter().getFindService().getName().get(0).getValue());
     
    } catch (Exception e) {
View Full Code Here

    deleteSubscription(authInfo, SUBSCRIPTION_KEY);
  }
 
  public void saveSubscription(String authInfo, String subscriptionXML, String subscriptionKey) {
    try {
      Subscription subIn = (Subscription)EntityCreator.buildFromDoc(subscriptionXML, "org.uddi.sub_v3");
      List<Subscription> subscriptionList = new ArrayList<Subscription>();
      subscriptionList.add(subIn);
      Holder<List<Subscription>> subscriptionHolder = new Holder<List<Subscription>>();
      subscriptionHolder.value = subscriptionList;
     
      subscription.saveSubscription(authInfo, subscriptionHolder);
     
      Subscription subDirectOut = subscriptionHolder.value.get(0);
      assertEquals(subIn.getSubscriptionKey(), subDirectOut.getSubscriptionKey());
     
      List<Subscription> outSubscriptionList = subscription.getSubscriptions(authInfo);
      Assert.assertNotNull(outSubscriptionList);
      Subscription subOut = outSubscriptionList.get(0);
     
      assertEquals(subIn.getSubscriptionKey(), subOut.getSubscriptionKey());
      assertEquals(subDirectOut.getExpiresAfter().getMonth(), subOut.getExpiresAfter().getMonth());
      assertEquals(subDirectOut.getExpiresAfter().getDay(), subOut.getExpiresAfter().getDay());
      assertEquals(subDirectOut.getExpiresAfter().getYear(), subOut.getExpiresAfter().getYear());
     
      //assertEquals(subIn.getSubscriptionFilter().getFindService().getName().get(0).getValue(),
      //       subOut.getSubscriptionFilter().getFindService().getName().get(0).getValue());
     
    } catch (Exception e) {
View Full Code Here

     
      List<org.apache.juddi.model.Subscription> modelSubscriptionList = (List<org.apache.juddi.model.Subscription>)FindSubscriptionByPublisherQuery.select(em, publisher.getAuthorizedName());
      if (modelSubscriptionList != null && modelSubscriptionList.size() > 0) {
        for (org.apache.juddi.model.Subscription modelSubscription : modelSubscriptionList) {
         
          Subscription apiSubscription = new Subscription();
         
          MappingModelToApi.mapSubscription(modelSubscription, apiSubscription);
         
          result.add(apiSubscription);
        }
View Full Code Here

     
      List<org.apache.juddi.model.Subscription> modelSubscriptionList = (List<org.apache.juddi.model.Subscription>)FindSubscriptionByPublisherQuery.select(em, publisher.getAuthorizedName());
      if (modelSubscriptionList != null && modelSubscriptionList.size() > 0) {
        for (org.apache.juddi.model.Subscription modelSubscription : modelSubscriptionList) {
         
          Subscription apiSubscription = new Subscription();
         
          MappingModelToApi.mapSubscription(modelSubscription, apiSubscription);
         
          result.add(apiSubscription);
        }
View Full Code Here

                }
        }

        private static Subscription BuildClientSubscriptionSearchResults(Map map, AtomicReference<String> outmsg) {
                try {
                        Subscription sub = new Subscription();
                        String alertCritera = ((String[]) map.get("alertCriteraMultipleItem"))[0];

                        sub.setSubscriptionFilter(new SubscriptionFilter());
                        Name name = new Name();
                        name.setValue(((String[]) map.get("searchcontent"))[0]);
                        name.setLang(((String[]) map.get("searchlang"))[0]);
                        FindQualifiers fq = new FindQualifiers();
                        String[] fqs = (String[]) map.get("findqualifier");
                        if (fqs != null) {
                                for (int i = 0; i < fqs.length; i++) {
                                        fq.getFindQualifier().add(fqs[i]);
                                }
                        }
                        if (fq.getFindQualifier().isEmpty()) {
                                fq = null;
                        }
                        if (alertCritera != null) {
                                if (alertCritera.equalsIgnoreCase("binding")) {
                    //sub.getSubscriptionFilter().setFindBinding(new FindBinding());
                                        //sub.getSubscriptionFilter().getFindBinding().
                                } else if (alertCritera.equalsIgnoreCase("service")) {
                                        sub.getSubscriptionFilter().setFindService(new FindService());
                                        sub.getSubscriptionFilter().getFindService().getName().add(name);
                                        sub.getSubscriptionFilter().getFindService().setFindQualifiers(fq);
                                } else if (alertCritera.equalsIgnoreCase("business")) {
                                        sub.getSubscriptionFilter().setFindBusiness(new FindBusiness());
                                        sub.getSubscriptionFilter().getFindBusiness().setFindQualifiers(fq);
                                        sub.getSubscriptionFilter().getFindBusiness().getName().add(name);
                                        //              sub.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey().addAll(keys);
                                } else if (alertCritera.equalsIgnoreCase("publisherAssertion")) {
                                        //unknow if this will work
                                        sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport());
                                        sub.getSubscriptionFilter().getGetAssertionStatusReport().setCompletionStatus(CompletionStatus.valueOf(((String[]) map.get("assertionStatus"))[0]));
                                } else if (alertCritera.equalsIgnoreCase("relatedBusiness")) {
                                        sub.getSubscriptionFilter().setFindRelatedBusinesses(new FindRelatedBusinesses());
                                        sub.getSubscriptionFilter().getFindRelatedBusinesses().setFindQualifiers(fq);
                                        sub.getSubscriptionFilter().getFindRelatedBusinesses().setBusinessKey(((String[]) map.get("searchcontent"))[0]);
                                } else if (alertCritera.equalsIgnoreCase("tmodel")) {
                                        sub.getSubscriptionFilter().setFindTModel(new FindTModel());
                                        sub.getSubscriptionFilter().getFindTModel().setFindQualifiers(fq);
                                        sub.getSubscriptionFilter().getFindTModel().setName(name);
                                } else {
                                        outmsg.set("alert critera invalid");
                                        return null;
                                }
                        } else {
View Full Code Here

        }

        public void saveSubscription(String authInfo, String subscriptionXML, String subscriptionKey, String bindingkey) {
                try {
                        logger.info("saving subscription " + subscriptionKey + " " + subscriptionXML + " " + bindingkey);
                        Subscription subIn = (Subscription) EntityCreator.buildFromDoc(subscriptionXML, "org.uddi.sub_v3");
                        List<Subscription> subscriptionList = new ArrayList<Subscription>();
                        subscriptionList.add(subIn);
                        Holder<List<Subscription>> subscriptionHolder = new Holder<List<Subscription>>();
                        subscriptionHolder.value = subscriptionList;

                        subscription.saveSubscription(authInfo, subscriptionHolder);

                        Subscription subDirectOut = subscriptionHolder.value.get(0);
                        Assert.assertEquals(subIn.getSubscriptionKey(), subDirectOut.getSubscriptionKey());

                        List<Subscription> outSubscriptionList = subscription.getSubscriptions(authInfo);
                        Assert.assertNotNull(outSubscriptionList);
                        Subscription subOut = outSubscriptionList.get(0);



                        Assert.assertEquals(subDirectOut.getExpiresAfter().getMonth(), subOut.getExpiresAfter().getMonth());
                        Assert.assertEquals(subDirectOut.getExpiresAfter().getDay(), subOut.getExpiresAfter().getDay());
                        Assert.assertEquals(subDirectOut.getExpiresAfter().getYear(), subOut.getExpiresAfter().getYear());

                        //assertEquals(subIn.getSubscriptionFilter().getFindService().getName().get(0).getValue(),
                        //       subOut.getSubscriptionFilter().getFindService().getName().get(0).getValue());

                } catch (Exception e) {
View Full Code Here

                        ftm.getCategoryBag().getKeyedReference().add(new KeyedReference("uddi:uddi.org:categorization:types", "uddi-org:types:findQualifier", "findQualifier"));
                        TModelList findTModel = inquiry.findTModel(ftm);
     
                        FINDQUALIFIER_TMODEL_TOTAL = findTModel.getListDescription().getActualCount();
                       
      Subscription subIn = (Subscription)EntityCreator.buildFromDoc(SAM_SUBSCRIPTION2_XML, "org.uddi.sub_v3");
     
      int expectedIterations = FINDQUALIFIER_TMODEL_TOTAL / subIn.getMaxEntities();
      if (FINDQUALIFIER_TMODEL_TOTAL % subIn.getMaxEntities() >0)
        expectedIterations++;
     
                       
                        logger.info("getSamSyndicatorSubscriptionResultsWithChunkingOnFind loading from " + SAM_SUBSCRIPTION2_XML + " expecting " + FINDQUALIFIER_TMODEL_TOTAL + " find qualifier tmodels. Fetching "
                        + subIn.getMaxEntities() + " at a time, expected iterations " + expectedIterations);
     
      String chunkToken = "";
      int iterations = 0;
                        //JUDDI-655
      while (chunkToken != null && !chunkToken.equalsIgnoreCase("0")) {
        iterations++;
                               
        getSubResultsIn.setChunkToken(chunkToken);
        SubscriptionResultsList result = subscription.getSubscriptionResults(getSubResultsIn);
        if (result == null)
          Assert.fail("Null result from getSubscriptionResults operation");
        Assert.assertNotNull("Chunk token should either be not null or '0'",result.getChunkToken());
        TModelList tmodelList = result.getTModelList();
        if (tmodelList == null || tmodelList.getTModelInfos()==null)
          Assert.fail("No result from getSubscriptionResults operation on chunk attempt " + iterations);

        int resultSize = tmodelList.getTModelInfos().getTModelInfo().size();
       
        if (iterations < expectedIterations)
          assertEquals(resultSize, subIn.getMaxEntities().intValue());
        else {
          if (FINDQUALIFIER_TMODEL_TOTAL % subIn.getMaxEntities() > 0)
            assertEquals(resultSize, FINDQUALIFIER_TMODEL_TOTAL % subIn.getMaxEntities());
          else
            assertEquals(resultSize, subIn.getMaxEntities().intValue());
        }
       
        chunkToken = result.getChunkToken();
       
      }
View Full Code Here

TOP

Related Classes of org.apache.qpid.client.messaging.address.Link$Subscription

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.