List of usage examples for javax.xml.datatype DatatypeFactory newInstance
public static DatatypeFactory newInstance() throws DatatypeConfigurationException
From source file:org.apache.juddi.v3.tck.UDDI_080_SubscriptionIntegrationTest.java
/** * asynch subscriptions , binding key doesn't exist * * @throws DatatypeConfigurationException *///from ww w. ja v a2 s . c o m @Test public void JUDDI_606_9() throws DatatypeConfigurationException { Assume.assumeTrue(TckPublisher.isEnabled()); System.out.println("JUDDI_606_9"); Assume.assumeTrue(TckPublisher.isSubscriptionEnabled()); // DatatypeFactory df = DatatypeFactory.newInstance(); try { Holder<List<Subscription>> data = new Holder<List<Subscription>>(); data.value = new ArrayList<Subscription>(); Subscription sub = new Subscription(); sub.setBrief(true); sub.setExpiresAfter(null); sub.setMaxEntities(null); sub.setNotificationInterval(df.newDuration(5000)); sub.setBindingKey("uddi:uddi.joepublisher.com:mykey"); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setFindService(new FindService()); sub.getSubscriptionFilter().getFindService().setFindQualifiers(new FindQualifiers()); sub.getSubscriptionFilter().getFindService().getFindQualifiers().getFindQualifier() .add(UDDIConstants.APPROXIMATE_MATCH); sub.getSubscriptionFilter().getFindService().getName().add(new Name("%", null)); data.value.add(sub); tckSubscriptionJoe.subscription.saveSubscription(authInfoJoe, data); Assert.fail(); } catch (Exception ex) { logger.info("Expected exception: " + ex.getMessage()); } }
From source file:org.apache.juddi.v3.tck.UDDI_080_SubscriptionIntegrationTest.java
/** * set subscription, make a change as the same user, get subscription * results no key specified/*from w ww . j a va2s . c o m*/ * * @throws DatatypeConfigurationException */ @Test public void JUDDI_606_11() throws DatatypeConfigurationException { Assume.assumeTrue(TckPublisher.isEnabled()); System.out.println("JUDDI_606_11"); Assume.assumeTrue(TckPublisher.isSubscriptionEnabled()); String key = null; DatatypeFactory df = DatatypeFactory.newInstance(); try { Holder<List<Subscription>> data = new Holder<List<Subscription>>(); data.value = new ArrayList<Subscription>(); Subscription sub = new Subscription(); sub.setBrief(false); sub.setExpiresAfter(null); sub.setMaxEntities(null); sub.setNotificationInterval(null); sub.setBindingKey(null); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setFindBusiness(new FindBusiness()); sub.getSubscriptionFilter().getFindBusiness().setFindQualifiers(new FindQualifiers()); sub.getSubscriptionFilter().getFindBusiness().getFindQualifiers().getFindQualifier() .add(UDDIConstants.APPROXIMATE_MATCH); sub.getSubscriptionFilter().getFindBusiness().getName().add(new Name("%", null)); data.value.add(sub); tckSubscriptionJoe.subscription.saveSubscription(authInfoJoe, data); SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); be.getName().add(new Name("Test business", null)); sb.getBusinessEntity().add(be); BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); key = saveBusiness.getBusinessEntity().get(0).getBusinessKey(); GetSubscriptionResults gsr = new GetSubscriptionResults(); gsr.setAuthInfo(authInfoJoe); gsr.setSubscriptionKey(null); gsr.setCoveragePeriod(new CoveragePeriod()); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gcal.add(Calendar.HOUR, -1); gsr.getCoveragePeriod().setStartPoint(df.newXMLGregorianCalendar(gcal)); gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gsr.getCoveragePeriod().setEndPoint(df.newXMLGregorianCalendar(gcal)); tckSubscriptionJoe.subscription.getSubscriptionResults(gsr); Assert.fail(); } catch (Exception ex) { //HandleException(ex); //Assert.fail(); logger.info("Expected exception: " + ex.getMessage()); } finally { TckCommon.DeleteBusiness(key, authInfoJoe, publicationJoe); } }
From source file:org.apache.juddi.v3.tck.UDDI_080_SubscriptionIntegrationTest.java
/** * set subscription, make a change as the same user, get subscription * results valid find_Business//from w ww. j a va 2s . c o m * * @throws DatatypeConfigurationException */ @Test public void JUDDI_606_13() throws DatatypeConfigurationException { Assume.assumeTrue(TckPublisher.isEnabled()); System.out.println("JUDDI_606_13"); Assume.assumeTrue(TckPublisher.isSubscriptionEnabled()); String key = null; DatatypeFactory df = DatatypeFactory.newInstance(); try { Holder<List<Subscription>> data = new Holder<List<Subscription>>(); data.value = new ArrayList<Subscription>(); Subscription sub = new Subscription(); sub.setBrief(false); sub.setExpiresAfter(null); sub.setMaxEntities(null); sub.setNotificationInterval(null); sub.setBindingKey(null); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setFindBusiness(new FindBusiness()); sub.getSubscriptionFilter().getFindBusiness().setFindQualifiers(new FindQualifiers()); sub.getSubscriptionFilter().getFindBusiness().getFindQualifiers().getFindQualifier() .add(UDDIConstants.APPROXIMATE_MATCH); sub.getSubscriptionFilter().getFindBusiness().getName().add(new Name("%", null)); data.value.add(sub); tckSubscriptionJoe.subscription.saveSubscription(authInfoJoe, data); SaveBusiness sb = new SaveBusiness(); sb.setAuthInfo(authInfoJoe); BusinessEntity be = new BusinessEntity(); be.getName().add(new Name("Test business", null)); sb.getBusinessEntity().add(be); BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb); key = saveBusiness.getBusinessEntity().get(0).getBusinessKey(); GetSubscriptionResults gsr = new GetSubscriptionResults(); gsr.setAuthInfo(authInfoJoe); gsr.setSubscriptionKey(data.value.get(0).getSubscriptionKey()); gsr.setCoveragePeriod(new CoveragePeriod()); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gcal.add(Calendar.HOUR, -1); gsr.getCoveragePeriod().setStartPoint(df.newXMLGregorianCalendar(gcal)); gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gsr.getCoveragePeriod().setEndPoint(df.newXMLGregorianCalendar(gcal)); SubscriptionResultsList subscriptionResults = tckSubscriptionJoe.subscription .getSubscriptionResults(gsr); Assert.assertNotNull(subscriptionResults); Assert.assertNotNull(subscriptionResults.getBusinessList()); Assert.assertNotNull(subscriptionResults.getCoveragePeriod()); Assert.assertNotNull(subscriptionResults.getBusinessList().getBusinessInfos()); Assert.assertNotNull(subscriptionResults.getBusinessList().getBusinessInfos().getBusinessInfo().get(0)); Assert.assertNotNull(subscriptionResults.getBusinessList().getBusinessInfos().getBusinessInfo().get(0) .getBusinessKey()); Assert.assertNotNull(subscriptionResults.getBusinessList().getBusinessInfos().getBusinessInfo().get(0) .getName().get(0)); } catch (Exception ex) { HandleException(ex); Assert.fail(); } finally { TckCommon.DeleteBusiness(key, authInfoJoe, publicationJoe); } }
From source file:org.apache.juddi.v3.tck.UDDI_080_SubscriptionIntegrationTest.java
/** * set subscription, make a change as the same user, get subscription * results valid find_services//from ww w . j a v a2 s . c om * * @throws DatatypeConfigurationException */ @Test public void JUDDI_606_14() throws DatatypeConfigurationException { Assume.assumeTrue(TckPublisher.isEnabled()); System.out.println("JUDDI_606_14"); Assume.assumeTrue(TckPublisher.isSubscriptionEnabled()); DatatypeFactory df = DatatypeFactory.newInstance(); try { Holder<List<Subscription>> data = new Holder<List<Subscription>>(); data.value = new ArrayList<Subscription>(); Subscription sub = new Subscription(); sub.setBrief(false); sub.setExpiresAfter(null); sub.setMaxEntities(null); sub.setNotificationInterval(null); sub.setBindingKey(null); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setFindService(new FindService()); sub.getSubscriptionFilter().getFindService().setFindQualifiers(new FindQualifiers()); sub.getSubscriptionFilter().getFindService().getFindQualifiers().getFindQualifier() .add(UDDIConstants.APPROXIMATE_MATCH); sub.getSubscriptionFilter().getFindService().getName().add(new Name("%", null)); data.value.add(sub); tckSubscriptionJoe.subscription.saveSubscription(authInfoJoe, data); tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckBusinessServiceJoe.saveJoePublisherService(authInfoJoe); /*SaveService sb = new SaveService(); sb.setAuthInfo(authInfoJoe); BusinessService bs = new BusinessService(); bs.getName().add(new Name("svc", null)); sb.getBusinessService().add(bs); publicationJoe.saveService(sb);*/ GetSubscriptionResults gsr = new GetSubscriptionResults(); gsr.setAuthInfo(authInfoJoe); gsr.setSubscriptionKey(data.value.get(0).getSubscriptionKey()); gsr.setCoveragePeriod(new CoveragePeriod()); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gcal.add(Calendar.HOUR, -1); gsr.getCoveragePeriod().setStartPoint(df.newXMLGregorianCalendar(gcal)); gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gsr.getCoveragePeriod().setEndPoint(df.newXMLGregorianCalendar(gcal)); SubscriptionResultsList subscriptionResults = tckSubscriptionJoe.subscription .getSubscriptionResults(gsr); Assert.assertNotNull(subscriptionResults); Assert.assertNull(subscriptionResults.getBusinessList()); Assert.assertNotNull(subscriptionResults.getCoveragePeriod()); Assert.assertNotNull(subscriptionResults.getServiceList()); Assert.assertNotNull(subscriptionResults.getServiceList().getServiceInfos().getServiceInfo().get(0)); Assert.assertNotNull(subscriptionResults.getServiceList().getServiceInfos().getServiceInfo().get(0) .getBusinessKey()); Assert.assertNotNull(subscriptionResults.getServiceList().getServiceInfos().getServiceInfo().get(0) .getName().get(0)); } catch (Exception ex) { HandleException(ex); Assert.fail(ex.getMessage()); } finally { tckBusinessJoe.deleteJoePublisherBusiness(authInfoJoe); tckTModelJoe.deleteJoePublisherTmodel(authInfoJoe); } }
From source file:org.apache.juddi.v3.tck.UDDI_080_SubscriptionIntegrationTest.java
/** * //set subscription, make a change as the same user, get subscription * results. valid. publisher assertion, incomplete * * @throws DatatypeConfigurationException *///from w ww . j av a 2 s . c om @Test public void JUDDI_606_15() throws DatatypeConfigurationException { Assume.assumeTrue(TckPublisher.isEnabled()); System.out.println("JUDDI_606_15"); Assume.assumeTrue(TckPublisher.isSubscriptionEnabled()); DatatypeFactory df = DatatypeFactory.newInstance(); try { tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckTModelSam.saveSamSyndicatorTmodel(authInfoSam); tckBusinessSam.saveSamSyndicatorBusiness(authInfoSam); Holder<List<Subscription>> data = new Holder<List<Subscription>>(); data.value = new ArrayList<Subscription>(); Subscription sub = new Subscription(); sub.setBrief(false); sub.setExpiresAfter(null); sub.setMaxEntities(null); sub.setNotificationInterval(null); sub.setBindingKey(null); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport()); sub.getSubscriptionFilter().getGetAssertionStatusReport() .setCompletionStatus(CompletionStatus.STATUS_TO_KEY_INCOMPLETE); data.value.add(sub); tckSubscriptionJoe.subscription.saveSubscription(authInfoJoe, data); AddPublisherAssertions r = new AddPublisherAssertions(); r.setAuthInfo(authInfoJoe); PublisherAssertion pa = new PublisherAssertion(); pa.setFromKey(TckBusiness.JOE_BUSINESS_KEY); pa.setToKey(TckBusiness.SAM_BUSINESS_KEY); pa.setKeyedReference(new KeyedReference()); pa.getKeyedReference().setKeyName("Subsidiary"); pa.getKeyedReference().setKeyValue("parent-child"); pa.getKeyedReference().setTModelKey("uddi:uddi.org:relationships"); r.getPublisherAssertion().add(pa); publicationJoe.addPublisherAssertions(r); GetSubscriptionResults gsr = new GetSubscriptionResults(); gsr.setAuthInfo(authInfoJoe); gsr.setSubscriptionKey(data.value.get(0).getSubscriptionKey()); gsr.setCoveragePeriod(new CoveragePeriod()); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gcal.add(Calendar.HOUR, -1); gsr.getCoveragePeriod().setStartPoint(df.newXMLGregorianCalendar(gcal)); gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gsr.getCoveragePeriod().setEndPoint(df.newXMLGregorianCalendar(gcal)); SubscriptionResultsList subscriptionResults = tckSubscriptionJoe.subscription .getSubscriptionResults(gsr); Assert.assertNotNull(subscriptionResults); Assert.assertNull(subscriptionResults.getBusinessList()); Assert.assertNotNull(subscriptionResults.getCoveragePeriod()); Assert.assertNull(subscriptionResults.getServiceList()); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport()); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem()); Assert.assertFalse(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().isEmpty()); Assert.assertEquals( subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0).getFromKey(), TckBusiness.JOE_BUSINESS_KEY); Assert.assertEquals( subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0).getToKey(), TckBusiness.SAM_BUSINESS_KEY); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0) .getCompletionStatus()); Assert.assertEquals(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0) .getCompletionStatus(), CompletionStatus.STATUS_TO_KEY_INCOMPLETE); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0) .getKeyedReference()); } catch (Exception ex) { HandleException(ex); Assert.fail(ex.getMessage()); } finally { tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); tckBusinessSam.deleteSamSyndicatorBusiness(authInfoSam); tckTModelSam.deleteSamSyndicatorTmodel(authInfoSam); } }
From source file:org.apache.juddi.v3.tck.UDDI_080_SubscriptionIntegrationTest.java
/** * set subscription, make a change as the same user, get subscription * results valid publisher assertion, complete * * @throws DatatypeConfigurationException *//*from w w w. j ava2s .c o m*/ @Test public void JUDDI_606_16() throws DatatypeConfigurationException { Assume.assumeTrue(TckPublisher.isEnabled()); System.out.println("JUDDI_606_16"); Assume.assumeTrue(TckPublisher.isSubscriptionEnabled()); DatatypeFactory df = DatatypeFactory.newInstance(); try { tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckTModelSam.saveSamSyndicatorTmodel(authInfoSam); tckBusinessSam.saveSamSyndicatorBusiness(authInfoSam); Holder<List<Subscription>> data = new Holder<List<Subscription>>(); data.value = new ArrayList<Subscription>(); Subscription sub = new Subscription(); sub.setBrief(false); sub.setExpiresAfter(null); sub.setMaxEntities(null); sub.setNotificationInterval(null); sub.setBindingKey(null); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport()); sub.getSubscriptionFilter().getGetAssertionStatusReport() .setCompletionStatus(CompletionStatus.STATUS_COMPLETE); data.value.add(sub); tckSubscriptionJoe.subscription.saveSubscription(authInfoJoe, data); AddPublisherAssertions r = new AddPublisherAssertions(); r.setAuthInfo(authInfoJoe); PublisherAssertion pa = new PublisherAssertion(); pa.setFromKey(TckBusiness.JOE_BUSINESS_KEY); pa.setToKey(TckBusiness.SAM_BUSINESS_KEY); pa.setKeyedReference(new KeyedReference()); pa.getKeyedReference().setKeyName("Subsidiary"); pa.getKeyedReference().setKeyValue("parent-child"); pa.getKeyedReference().setTModelKey("uddi:uddi.org:relationships"); r.getPublisherAssertion().add(pa); publicationJoe.addPublisherAssertions(r); r = new AddPublisherAssertions(); r.setAuthInfo(authInfoSam); pa = new PublisherAssertion(); pa.setFromKey(TckBusiness.JOE_BUSINESS_KEY); pa.setToKey(TckBusiness.SAM_BUSINESS_KEY); pa.setKeyedReference(new KeyedReference()); pa.getKeyedReference().setKeyName("Subsidiary"); pa.getKeyedReference().setKeyValue("parent-child"); pa.getKeyedReference().setTModelKey("uddi:uddi.org:relationships"); r.getPublisherAssertion().add(pa); publicationJoe.addPublisherAssertions(r); GetSubscriptionResults gsr = new GetSubscriptionResults(); gsr.setAuthInfo(authInfoJoe); gsr.setSubscriptionKey(data.value.get(0).getSubscriptionKey()); gsr.setCoveragePeriod(new CoveragePeriod()); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gcal.add(Calendar.HOUR, -1); gsr.getCoveragePeriod().setStartPoint(df.newXMLGregorianCalendar(gcal)); gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gsr.getCoveragePeriod().setEndPoint(df.newXMLGregorianCalendar(gcal)); SubscriptionResultsList subscriptionResults = tckSubscriptionJoe.subscription .getSubscriptionResults(gsr); Assert.assertNotNull(subscriptionResults); Assert.assertNull(subscriptionResults.getBusinessList()); Assert.assertNotNull(subscriptionResults.getCoveragePeriod()); Assert.assertNull(subscriptionResults.getServiceList()); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport()); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem()); Assert.assertFalse(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().isEmpty()); Assert.assertEquals( subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0).getFromKey(), TckBusiness.JOE_BUSINESS_KEY); Assert.assertEquals( subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0).getToKey(), TckBusiness.SAM_BUSINESS_KEY); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0) .getCompletionStatus()); Assert.assertEquals(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0) .getCompletionStatus(), CompletionStatus.STATUS_COMPLETE); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0) .getKeyedReference()); } catch (Exception ex) { HandleException(ex); Assert.fail(ex.getMessage()); } finally { tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); tckBusinessSam.deleteSamSyndicatorBusiness(authInfoSam); tckTModelSam.deleteSamSyndicatorTmodel(authInfoSam); } }
From source file:org.apache.juddi.v3.tck.UDDI_080_SubscriptionIntegrationTest.java
/** * set subscription, make a change as the same user, get subscription * results valid publisher assertion, deleted * * @throws DatatypeConfigurationException *///from www . j av a2 s .com @Test public void JUDDI_606_17() throws DatatypeConfigurationException { Assume.assumeTrue(TckPublisher.isEnabled()); System.out.println("JUDDI_606_17"); Assume.assumeTrue(TckPublisher.isSubscriptionEnabled()); DatatypeFactory df = DatatypeFactory.newInstance(); try { tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckTModelSam.saveSamSyndicatorTmodel(authInfoSam); tckBusinessSam.saveSamSyndicatorBusiness(authInfoSam); Holder<List<Subscription>> data = new Holder<List<Subscription>>(); data.value = new ArrayList<Subscription>(); Subscription sub = new Subscription(); sub.setBrief(false); sub.setExpiresAfter(null); sub.setMaxEntities(null); sub.setNotificationInterval(null); sub.setBindingKey(null); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport()); sub.getSubscriptionFilter().getGetAssertionStatusReport() .setCompletionStatus(CompletionStatus.STATUS_BOTH_INCOMPLETE); data.value.add(sub); tckSubscriptionJoe.subscription.saveSubscription(authInfoJoe, data); AddPublisherAssertions r = new AddPublisherAssertions(); r.setAuthInfo(authInfoJoe); PublisherAssertion pa = new PublisherAssertion(); pa.setFromKey(TckBusiness.JOE_BUSINESS_KEY); pa.setToKey(TckBusiness.SAM_BUSINESS_KEY); pa.setKeyedReference(new KeyedReference()); pa.getKeyedReference().setKeyName("Subsidiary"); pa.getKeyedReference().setKeyValue("parent-child"); pa.getKeyedReference().setTModelKey("uddi:uddi.org:relationships"); r.getPublisherAssertion().add(pa); publicationJoe.addPublisherAssertions(r); //approve it r = new AddPublisherAssertions(); r.setAuthInfo(authInfoSam); r.getPublisherAssertion().add(pa); publicationSam.addPublisherAssertions(r); DeletePublisherAssertions dp = new DeletePublisherAssertions(); dp.setAuthInfo(authInfoJoe); dp.getPublisherAssertion().add(pa); publicationJoe.deletePublisherAssertions(dp); dp = new DeletePublisherAssertions(); dp.setAuthInfo(authInfoSam); dp.getPublisherAssertion().add(pa); //publicationSam.deletePublisherAssertions(dp); GetSubscriptionResults gsr = new GetSubscriptionResults(); gsr.setAuthInfo(authInfoJoe); gsr.setSubscriptionKey(data.value.get(0).getSubscriptionKey()); gsr.setCoveragePeriod(new CoveragePeriod()); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gcal.add(Calendar.HOUR, -1); gsr.getCoveragePeriod().setStartPoint(df.newXMLGregorianCalendar(gcal)); gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); gsr.getCoveragePeriod().setEndPoint(df.newXMLGregorianCalendar(gcal)); SubscriptionResultsList subscriptionResults = tckSubscriptionJoe.subscription .getSubscriptionResults(gsr); Assert.assertNotNull(subscriptionResults); Assert.assertNull(subscriptionResults.getBusinessList()); Assert.assertNotNull(subscriptionResults.getCoveragePeriod()); Assert.assertNull(subscriptionResults.getServiceList()); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport()); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem()); Assert.assertTrue(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().isEmpty()); /* Assert.assertEquals(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0).getFromKey(), TckBusiness.JOE_BUSINESS_KEY); Assert.assertEquals(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0).getToKey(), TckBusiness.SAM_BUSINESS_KEY); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0).getCompletionStatus()); Assert.assertEquals(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0).getCompletionStatus(), CompletionStatus.STATUS_BOTH_INCOMPLETE); Assert.assertNotNull(subscriptionResults.getAssertionStatusReport().getAssertionStatusItem().get(0).getKeyedReference());*/ } catch (Exception ex) { HandleException(ex); Assert.fail(ex.getMessage()); } finally { tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); tckBusinessSam.deleteSamSyndicatorBusiness(authInfoSam); tckTModelSam.deleteSamSyndicatorTmodel(authInfoSam); } }
From source file:org.apache.juddi.v3.tck.UDDI_090_SubscriptionListenerExternalTest.java
/** * getBusiness tests joe want's updates on mary's business * * @throws Exception//from w w w. j av a 2 s . c o m */ @Test //@Ignore public void joePublisherUpdate_HTTP_GET_BUSINESS_DETAIL() throws Exception { Assume.assumeTrue(TckPublisher.isEnabled()); logger.info("joePublisherUpdate_HTTP_GET_BUSINESS_DETAIL"); TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe); Holder<List<Subscription>> holder = null; try { UDDISubscriptionListenerImpl.notifcationMap.clear(); UDDISubscriptionListenerImpl.notificationCount = 0; String before = TckCommon.DumpAllBusinesses(authInfoJoe, inquiryJoe); tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); tckTModelJoe.saveTModels(authInfoJoe, TckTModel.JOE_PUBLISHER_TMODEL_XML_SUBSCRIPTION3); tckTModelMary.saveMaryPublisherTmodel(authInfoMary); BusinessEntity saveMaryPublisherBusiness = tckBusinessMary.saveMaryPublisherBusiness(authInfoMary); tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckBusinessServiceJoe.saveJoePublisherService(authInfoJoe); //Saving the Listener Service tckSubscriptionListenerJoe.saveService(authInfoJoe, TckSubscriptionListener.LISTENER_HTTP_SERVICE_XML, httpPort, hostname); //Saving the Subscription holder = new Holder<List<Subscription>>(); holder.value = new ArrayList<Subscription>(); Subscription sub = new Subscription(); sub.setBindingKey("uddi:uddi.joepublisher.com:bindinglistener"); sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(5000)); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setGetBusinessDetail(new GetBusinessDetail()); sub.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey().add(TckBusiness.MARY_BUSINESS_KEY); holder.value.add(sub); subscriptionJoe.saveSubscription(authInfoJoe, holder); //tckSubscriptionListenerJoe.saveNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION3_XML); //Changing the service we subscribed to "JoePublisherService" Thread.sleep(1000); logger.info("updating Mary's business ********** "); updatePublisherBusiness(authInfoMary, saveMaryPublisherBusiness, publicationMary); logger.info("Waiting " + TckPublisher.getSubscriptionTimeout() + " seconds for delivery"); //waiting up to 100 seconds for the listener to notice the change. for (int i = 0; i < TckPublisher.getSubscriptionTimeout(); i++) { Thread.sleep(1000); System.out.print("."); } if (UDDISubscriptionListenerImpl.notificationCount == 0) { logger.warn("Test failed, dumping business list"); logger.warn("BEFORE " + before); logger.warn("After " + TckCommon.DumpAllBusinesses(authInfoJoe, inquiryJoe)); Assert.fail("No Notification was sent"); } Iterator<String> it = UDDISubscriptionListenerImpl.notifcationMap.values().iterator(); StringBuilder sb = new StringBuilder(); boolean found = false; while (it.hasNext()) { String test = it.next(); sb.append("Message: " + test + System.getProperty("line.separator")); if (test.contains("Updated Name")) { found = true; break; } } if (!found) { logger.warn("Test failed, dumping business list"); logger.warn("BEFORE " + before); logger.warn("After " + TckCommon.DumpAllBusinesses(authInfoJoe, inquiryJoe)); Assert.fail( "Notification does not contain the correct service. Messages received: " + sb.toString()); } } catch (Exception e) { logger.error("No exceptions please."); e.printStackTrace(); Assert.fail(); } finally { //tckSubscriptionListenerJoe.deleteNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION_KEY); DeleteSubscription ds = new DeleteSubscription(); ds.setAuthInfo(authInfoJoe); ds.getSubscriptionKey().add(holder.value.get(0).getSubscriptionKey()); subscriptionJoe.deleteSubscription(ds); tckBusinessMary.deleteMaryPublisherBusiness(authInfoMary); tckTModelMary.deleteMaryPublisherTmodel(authInfoMary); tckBusinessServiceJoe.deleteJoePublisherService(authInfoJoe); tckBusinessJoe.deleteJoePublisherBusiness(authInfoJoe); tckTModelJoe.deleteJoePublisherTmodel(authInfoJoe); tckTModelJoe.deleteTModel(authInfoJoe, TckTModel.JOE_PUBLISHER_TMODEL_SUBSCRIPTION3_TMODEL_KEY, TckTModel.JOE_PUBLISHER_TMODEL_XML_SUBSCRIPTION3); } }
From source file:org.apache.juddi.v3.tck.UDDI_090_SubscriptionListenerExternalTest.java
/** * getBusiness tests joe want's updates on mary's business * * @throws Exception/*from w w w.j av a2 s .c o m*/ */ @Test //@Ignore public void joePublisherUpdate_SMTP_GET_BUSINESS_DETAIL() throws Exception { Assume.assumeTrue(TckPublisher.isEnabled()); logger.info("joePublisherUpdate_SMTP_GET_BUSINESS_DETAIL"); TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe); Holder<List<Subscription>> holder = null; try { UDDISubscriptionListenerImpl.notifcationMap.clear(); UDDISubscriptionListenerImpl.notificationCount = 0; String before = TckCommon.DumpAllBusinesses(authInfoJoe, inquiryJoe); tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); tckTModelJoe.saveTModels(authInfoJoe, TckTModel.JOE_PUBLISHER_TMODEL_XML_SUBSCRIPTION3); tckTModelMary.saveMaryPublisherTmodel(authInfoMary); BusinessEntity saveMaryPublisherBusiness = tckBusinessMary.saveMaryPublisherBusiness(authInfoMary); tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckBusinessServiceJoe.saveJoePublisherService(authInfoJoe); //Saving the Listener Service tckSubscriptionListenerJoe.saveService(authInfoJoe, TckSubscriptionListener.LISTENER_SMTP_SERVICE_EXTERNAL_XML, 0, email); //Saving the Subscription holder = new Holder<List<Subscription>>(); holder.value = new ArrayList<Subscription>(); Subscription sub = new Subscription(); sub.setBindingKey("uddi:uddi.joepublisher.com:bindinglistenersmtp"); sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(5000)); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setGetBusinessDetail(new GetBusinessDetail()); sub.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey().add(TckBusiness.MARY_BUSINESS_KEY); holder.value.add(sub); subscriptionJoe.saveSubscription(authInfoJoe, holder); //tckSubscriptionListenerJoe.saveNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION3_XML); //Changing the service we subscribed to "JoePublisherService" Thread.sleep(1000); logger.info("updating Mary's business ********** "); updatePublisherBusiness(authInfoMary, saveMaryPublisherBusiness, publicationMary); logger.info("Waiting " + TckPublisher.getSubscriptionTimeout() + " seconds for delivery"); //waiting up to 100 seconds for the listener to notice the change. boolean received = false; for (int i = 0; i < TckPublisher.getSubscriptionTimeout(); i++) { Thread.sleep(1000); System.out.print("."); if (fetchMail("Updated Name") > 0) { logger.info("Received Email Notification"); received = true; break; } } if (!received) { logger.warn("Test failed, dumping business list"); logger.warn("BEFORE " + before); logger.warn("After " + TckCommon.DumpAllBusinesses(authInfoJoe, inquiryJoe)); Assert.fail("No Notification was sent"); } } catch (Exception e) { logger.error("No exceptions please."); e.printStackTrace(); Assert.fail(); } finally { //tckSubscriptionListenerJoe.deleteNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION_KEY); DeleteSubscription ds = new DeleteSubscription(); ds.setAuthInfo(authInfoJoe); ds.getSubscriptionKey().add(holder.value.get(0).getSubscriptionKey()); subscriptionJoe.deleteSubscription(ds); tckBusinessMary.deleteMaryPublisherBusiness(authInfoMary); tckTModelMary.deleteMaryPublisherTmodel(authInfoMary); tckBusinessServiceJoe.deleteJoePublisherService(authInfoJoe); tckBusinessJoe.deleteJoePublisherBusiness(authInfoJoe); tckTModelJoe.deleteJoePublisherTmodel(authInfoJoe); tckTModelJoe.deleteTModel(authInfoJoe, TckTModel.JOE_PUBLISHER_TMODEL_SUBSCRIPTION3_TMODEL_KEY, TckTModel.JOE_PUBLISHER_TMODEL_XML_SUBSCRIPTION3); } }
From source file:org.apache.juddi.v3.tck.UDDI_090_SubscriptionListenerExternalTest.java
/** * getBusiness tests joe want's updates on mary's business * * @throws Exception/*from ww w .ja v a2 s . co m*/ */ @Test public void joePublisherUpdate_HTTP_GET_TMODEL_DETAIL() throws Exception { Assume.assumeTrue(TckPublisher.isEnabled()); logger.info("joePublisherUpdate_HTTP_GET_TMODEL_DETAIL"); TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe); Holder<List<Subscription>> holder = null; try { UDDISubscriptionListenerImpl.notifcationMap.clear(); UDDISubscriptionListenerImpl.notificationCount = 0; String before = TckCommon.DumpAllTModels(authInfoJoe, inquiryJoe); tckTModelJoe.saveJoePublisherTmodel(authInfoJoe); tckTModelJoe.saveTModels(authInfoJoe, TckTModel.JOE_PUBLISHER_TMODEL_XML_SUBSCRIPTION3); TModel saveMaryPublisherTmodel = tckTModelMary.saveMaryPublisherTmodel(authInfoMary); tckBusinessJoe.saveJoePublisherBusiness(authInfoJoe); tckBusinessServiceJoe.saveJoePublisherService(authInfoJoe); //Saving the Listener Service tckSubscriptionListenerJoe.saveService(authInfoJoe, TckSubscriptionListener.LISTENER_HTTP_SERVICE_XML, httpPort, hostname); //Saving the Subscription holder = new Holder<List<Subscription>>(); holder.value = new ArrayList<Subscription>(); Subscription sub = new Subscription(); sub.setBindingKey("uddi:uddi.joepublisher.com:bindinglistener"); sub.setNotificationInterval(DatatypeFactory.newInstance().newDuration(5000)); sub.setSubscriptionFilter(new SubscriptionFilter()); sub.getSubscriptionFilter().setGetTModelDetail(new GetTModelDetail()); sub.getSubscriptionFilter().getGetTModelDetail().getTModelKey() .add(TckTModel.MARY_PUBLISHER_TMODEL_KEY); holder.value.add(sub); subscriptionJoe.saveSubscription(authInfoJoe, holder); //tckSubscriptionListenerJoe.saveNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION3_XML); //Changing the service we subscribed to "JoePublisherService" Thread.sleep(1000); logger.info("updating Mary's tModel ********** "); updateTModel(authInfoMary, saveMaryPublisherTmodel, publicationMary); logger.info("Waiting " + TckPublisher.getSubscriptionTimeout() + " seconds for delivery"); //waiting up to 100 seconds for the listener to notice the change. for (int i = 0; i < TckPublisher.getSubscriptionTimeout(); i++) { Thread.sleep(1000); System.out.print("."); if (UDDISubscriptionListenerImpl.notificationCount > 0) { // logger.info("Received Notification"); // break; } } if (UDDISubscriptionListenerImpl.notificationCount == 0) { logger.warn("Test failed, dumping business list"); logger.warn("BEFORE " + before); logger.warn("After " + TckCommon.DumpAllTModels(authInfoJoe, inquiryJoe)); Assert.fail("No Notification was sent"); } Iterator<String> it = UDDISubscriptionListenerImpl.notifcationMap.values().iterator(); StringBuilder sb = new StringBuilder(); boolean found = false; while (it.hasNext()) { String test = it.next(); sb.append("Message: " + test + System.getProperty("line.separator")); if (test.contains("a new description")) { found = true; break; } } if (!found) { logger.warn("Test failed, dumping business list"); logger.warn("BEFORE " + before); logger.warn("After " + TckCommon.DumpAllBusinesses(authInfoJoe, inquiryJoe)); logger.warn("Messages RX " + sb.toString()); Assert.fail( "Notification does not contain the correct service. Messages received: " + sb.toString()); } } catch (Exception e) { logger.error("No exceptions please."); e.printStackTrace(); Assert.fail(); } finally { //tckSubscriptionListenerJoe.deleteNotifierSubscription(authInfoJoe, TckSubscriptionListener.SUBSCRIPTION_KEY); DeleteSubscription ds = new DeleteSubscription(); ds.setAuthInfo(authInfoJoe); ds.getSubscriptionKey().add(holder.value.get(0).getSubscriptionKey()); subscriptionJoe.deleteSubscription(ds); //tckBusinessMary.deleteMaryPublisherBusiness(authInfoMary); tckTModelMary.deleteMaryPublisherTmodel(authInfoMary); tckBusinessServiceJoe.deleteJoePublisherService(authInfoJoe); tckBusinessJoe.deleteJoePublisherBusiness(authInfoJoe); tckTModelJoe.deleteJoePublisherTmodel(authInfoJoe); tckTModelJoe.deleteTModel(authInfoJoe, TckTModel.JOE_PUBLISHER_TMODEL_SUBSCRIPTION3_TMODEL_KEY, TckTModel.JOE_PUBLISHER_TMODEL_XML_SUBSCRIPTION3); } }