Example usage for javax.xml.datatype DatatypeFactory newXMLGregorianCalendar

List of usage examples for javax.xml.datatype DatatypeFactory newXMLGregorianCalendar

Introduction

In this page you can find the example usage for javax.xml.datatype DatatypeFactory newXMLGregorianCalendar.

Prototype

public abstract XMLGregorianCalendar newXMLGregorianCalendar(final GregorianCalendar cal);

Source Link

Document

Create an XMLGregorianCalendar from a GregorianCalendar .

Usage

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   w w w.  ja v  a  2 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   www.  j a v  a2 s.  co  m*/
@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  .  ja v a 2  s  . 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 w  ww  . ja  v  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_141_JIRAIntegrationTest.java

/**
 * testing upper case subscription callbacks
 *
 * @throws Exception//from   www .  j av a  2s  .  c  o m
 */
@Test
public void JIRA_597() throws Exception {
    Assume.assumeTrue(TckPublisher.isEnabled());
    System.out.println("JIRA_597");

    int port = 7000;
    String hostname = TckPublisher.getProperties().getProperty("bindaddress");
    if (hostname == null) {
        hostname = InetAddress.getLocalHost().getHostName();
    }

    TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe);
    UDDISubscriptionListenerImpl.notifcationMap.clear();
    UDDISubscriptionListenerImpl.notificationCount = 0;
    Endpoint ep = null;
    boolean ok = false;
    do {
        try {
            logger.info("Attempting to bring up endpoint at " + "http://" + hostname + ":" + port
                    + "/UDDI_CALLBACK");
            ep = Endpoint.publish("http://" + hostname + ":" + port + "/UDDI_CALLBACK", impl);
            ok = true;
        } catch (Exception ex) {
            logger.warn("Trouble starting endpoint: " + ex.getMessage());
            port++;
        }
    } while (!ok);
    SaveBusiness sb = new SaveBusiness();
    sb.setAuthInfo(authInfoJoe);
    BusinessEntity be = new BusinessEntity();
    be.getName().add(new Name());
    be.getName().get(0).setValue("Joe's callback business");
    be.setBusinessServices(new BusinessServices());
    BusinessService bs = new BusinessService();
    bs.getName().add(new Name());
    bs.getName().get(0).setValue("Joe's callback service");
    bs.setBindingTemplates(new BindingTemplates());
    BindingTemplate bt = new BindingTemplate();
    bt.setAccessPoint(new AccessPoint());
    bt.getAccessPoint().setValue("http://" + hostname + ":" + port + "/UDDI_CALLBACK");
    bt.getAccessPoint().setUseType("endPoint");
    //Added per Kurt
    TModelInstanceInfo instanceInfo = new TModelInstanceInfo();
    instanceInfo.setTModelKey("uddi:uddi.org:transport:http");
    bt.setTModelInstanceDetails(new TModelInstanceDetails());
    bt.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo);

    bs.getBindingTemplates().getBindingTemplate().add(bt);

    bs.getBindingTemplates().getBindingTemplate().add(bt);
    be.getBusinessServices().getBusinessService().add(bs);
    sb.getBusinessEntity().add(be);
    BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);

    List<String> deleteme = new ArrayList<String>();
    deleteme.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
    //ok Joe's callback is setup

    //Setup a business to subscribe to
    sb = new SaveBusiness();
    sb.setAuthInfo(authInfoSam);
    be = new BusinessEntity();
    be.getName().add(new Name());
    be.getName().get(0).setValue("Sam's business");
    sb.getBusinessEntity().add(be);
    BusinessDetail saveBusiness1 = publicationSam.saveBusiness(sb);

    //ok Joe now needs to subscribe for Sam's business
    Holder<List<Subscription>> list = new Holder<List<Subscription>>();
    list.value = new ArrayList<Subscription>();
    Subscription s = new Subscription();
    s.setBindingKey(saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0)
            .getBindingTemplates().getBindingTemplate().get(0).getBindingKey());
    s.setSubscriptionFilter(new SubscriptionFilter());
    s.getSubscriptionFilter().setGetBusinessDetail(new GetBusinessDetail());
    s.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey()
            .add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey());
    DatatypeFactory df = DatatypeFactory.newInstance();
    GregorianCalendar gcal = new GregorianCalendar();
    gcal.setTimeInMillis(System.currentTimeMillis());
    gcal.add(Calendar.HOUR, 1);
    s.setExpiresAfter(df.newXMLGregorianCalendar(gcal));

    s.setNotificationInterval(df.newDuration(5000));
    list.value.add(s);
    subscriptionJoe.saveSubscription(authInfoJoe, list);

    //ok have sam change his business around.
    sb = new SaveBusiness();
    sb.setAuthInfo(authInfoSam);
    be = saveBusiness1.getBusinessEntity().get(0);
    be.getName().get(0).setLang("en");
    sb.getBusinessEntity().add(be);
    publicationSam.saveBusiness(sb);
    int maxwait = 30000;
    logger.info("waiting for callbacks");
    while (maxwait > 0) {
        if (UDDISubscriptionListenerImpl.notifcationMap.size() > 0) {
            break;
        }
        Thread.sleep(1000);
        maxwait = maxwait - 1000;
    }
    TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe);
    this.DeleteBusinesses(deleteme, authInfoJoe, publicationJoe);
    deleteme.clear();
    deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey());
    this.DeleteBusinesses(deleteme, authInfoSam, publicationSam);
    ep.stop();
    if (UDDISubscriptionListenerImpl.notifcationMap.isEmpty()) {
        Assert.fail("no callbacks were recieved.");
    }

}

From source file:org.apache.juddi.v3.tck.UDDI_141_JIRAIntegrationTest.java

/**
 * testing callbacks with undefined transport type with a uppercase path
 * this also tests the case of one user subscribing to a specific entity
 * via GetBusinessDetail subscription filter
 *
 * @throws Exception/*from  w  ww.  j  a v  a2s.  co  m*/
 */
@Test
public void JIRA_596() throws Exception {
    Assume.assumeTrue(TckPublisher.isEnabled());
    System.out.println("JIRA_596");
    int port = 9000;

    String hostname = TckPublisher.getProperties().getProperty("bindaddress");
    if (hostname == null) {
        hostname = InetAddress.getLocalHost().getHostName();
    }

    // String localhostname = "localhost";//java.net.InetAddress.getLocalHost().getHostName();
    TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe);
    //UDDISubscriptionListenerImpl impl = new UDDISubscriptionListenerImpl();
    UDDISubscriptionListenerImpl.notifcationMap.clear();
    UDDISubscriptionListenerImpl.notificationCount = 0;

    Endpoint ep = null;
    boolean ok = false;
    do {
        try {
            ep = Endpoint.publish("http://" + hostname + ":" + port + "/UDDI_CALLBACK", impl);
            ok = true;
        } catch (Exception ex) {
            port++;
        }
    } while (!ok);
    SaveBusiness sb = new SaveBusiness();
    sb.setAuthInfo(authInfoJoe);
    BusinessEntity be = new BusinessEntity();
    be.getName().add(new Name());
    be.getName().get(0).setValue("Joe's callback business");
    be.setBusinessServices(new BusinessServices());
    BusinessService bs = new BusinessService();
    bs.getName().add(new Name());
    bs.getName().get(0).setValue("Joe's callback service");
    bs.setBindingTemplates(new BindingTemplates());
    BindingTemplate bt = new BindingTemplate();
    bt.setAccessPoint(new AccessPoint());
    bt.getAccessPoint().setValue("http://" + hostname + ":" + port + "/UDDI_CALLBACK");
    bt.getAccessPoint().setUseType("endPoint");
    //obmitted as part of the jira test case
    /*TModelInstanceInfo instanceInfo = new TModelInstanceInfo();
         instanceInfo.setTModelKey("uddi:uddi.org:transport:http");
         bt.setTModelInstanceDetails(new TModelInstanceDetails());
         bt.getTModelInstanceDetails().getTModelInstanceInfo().add(instanceInfo);
         */
    bs.getBindingTemplates().getBindingTemplate().add(bt);
    be.getBusinessServices().getBusinessService().add(bs);
    sb.getBusinessEntity().add(be);
    logger.info("setting up joe's callback business");
    BusinessDetail saveBusiness = publicationJoe.saveBusiness(sb);

    List<String> deleteme = new ArrayList<String>();
    deleteme.add(saveBusiness.getBusinessEntity().get(0).getBusinessKey());
    //ok Joe's callback is setup

    //Setup a business to subscribe to
    sb = new SaveBusiness();
    sb.setAuthInfo(authInfoSam);
    be = new BusinessEntity();
    be.getName().add(new Name());
    be.getName().get(0).setValue("Sam's business");
    sb.getBusinessEntity().add(be);
    logger.info("saving sam's business");
    BusinessDetail saveBusiness1 = publicationSam.saveBusiness(sb);

    //ok Joe now needs to subscribe for Sam's business
    Holder<List<Subscription>> list = new Holder<List<Subscription>>();
    list.value = new ArrayList<Subscription>();
    Subscription s = new Subscription();
    s.setBindingKey(saveBusiness.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0)
            .getBindingTemplates().getBindingTemplate().get(0).getBindingKey());
    s.setSubscriptionFilter(new SubscriptionFilter());
    s.getSubscriptionFilter().setGetBusinessDetail(new GetBusinessDetail());
    s.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey()
            .add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey());
    DatatypeFactory df = DatatypeFactory.newInstance();
    GregorianCalendar gcal = new GregorianCalendar();
    gcal.setTimeInMillis(System.currentTimeMillis());
    gcal.add(Calendar.HOUR, 1);
    s.setExpiresAfter(df.newXMLGregorianCalendar(gcal));

    s.setNotificationInterval(df.newDuration(5000));
    list.value.add(s);
    logger.info("subscribing joe's to updates for sam's business");
    subscriptionJoe.saveSubscription(authInfoJoe, list);

    //ok have sam change his business around.
    sb = new SaveBusiness();
    sb.setAuthInfo(authInfoSam);
    be = saveBusiness1.getBusinessEntity().get(0);
    be.getName().get(0).setLang("en");
    sb.getBusinessEntity().add(be);
    logger.info("altering sam's business");
    publicationSam.saveBusiness(sb);
    logger.info("Waiting...");
    int maxwait = 30000;
    while (maxwait > 0) {
        if (UDDISubscriptionListenerImpl.notifcationMap.size() > 0) {
            break;
        }
        Thread.sleep(1000);
        maxwait = maxwait - 1000;
    }
    TckCommon.removeAllExistingSubscriptions(authInfoJoe, subscriptionJoe);
    DeleteBusinesses(deleteme, authInfoJoe, publicationJoe);
    deleteme.clear();
    deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey());
    DeleteBusinesses(deleteme, authInfoSam, publicationSam);
    ep.stop();
    if (UDDISubscriptionListenerImpl.notifcationMap.isEmpty()) {
        logger.error("no callbacks were recieved");
        Assert.fail("no callbacks were recieved.");
    }
    logger.info("callback response was " + UDDISubscriptionListenerImpl.notifcationMap.get(0));
    logger.info("PASS");

}

From source file:org.apache.juddi.v3.tck.UDDI_150_CustodyTransferIntegrationTest.java

/**
 * tests a user to user transfer on the same node
 *
 * @throws Exception//  w w  w. java2s .c o m
 */
@Test
public void ValidTransfer() throws Exception {
    Assume.assumeTrue(TckPublisher.isEnabled());
    System.out.println("ValidTransfer");
    DatatypeFactory df = DatatypeFactory.newInstance();
    GregorianCalendar gcal = new GregorianCalendar();
    gcal.setTimeInMillis(System.currentTimeMillis());
    XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);

    BusinessEntity myBusEntity = new BusinessEntity();
    Name myBusName = new Name();
    myBusName.setLang("en");
    myBusName.setValue("ValidTransfer UDDI's Business" + " " + xcal.toString());
    myBusEntity.getName().add(myBusName);
    myBusEntity.setBusinessServices(new BusinessServices());
    myBusEntity.getBusinessServices().getBusinessService().add(CreateBusiness("UDDI"));
    SaveBusiness sb = new SaveBusiness();
    sb.getBusinessEntity().add(myBusEntity);
    sb.setAuthInfo(authInfoJoe);
    BusinessDetail bd = publishJoe.saveBusiness(sb);

    String keyJoeBiz = bd.getBusinessEntity().get(0).getBusinessKey();
    //String keyJoeBizSvc = bd.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0).getServiceKey();

    myBusEntity = new BusinessEntity();
    myBusName = new Name();
    myBusName.setLang("en");
    myBusName.setValue("ValidTransfer Root's Business" + " " + xcal.toString());
    myBusEntity.getName().add(myBusName);
    myBusEntity.setBusinessServices(new BusinessServices());
    myBusEntity.getBusinessServices().getBusinessService().add(CreateBusiness("root"));
    sb = new SaveBusiness();
    sb.getBusinessEntity().add(myBusEntity);
    sb.setAuthInfo(authInfoSam);
    bd = publishSam.saveBusiness(sb);

    String keySamBiz = bd.getBusinessEntity().get(0).getBusinessKey();
    //String keySamBizSvc = bd.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0).getServiceKey();

    //transfers from Joe to Sam
    KeyBag kb = new KeyBag();
    kb.getKey().add(keyJoeBiz);

    Holder<String> nodeidOUT = new Holder<String>();
    Holder<XMLGregorianCalendar> expiresOUT = new Holder<XMLGregorianCalendar>();
    Holder<byte[]> tokenOUT = new Holder<byte[]>();
    custodyTransferPortTypeJoe.getTransferToken(authInfoJoe, kb, nodeidOUT, expiresOUT, tokenOUT);

    //sam accepts
    TransferEntities te = new TransferEntities();
    te.setAuthInfo(authInfoSam);
    te.setKeyBag(kb);
    TransferToken tt = new TransferToken();
    tt.setExpirationTime(expiresOUT.value);
    tt.setNodeID(nodeidOUT.value);
    tt.setOpaqueToken(tokenOUT.value);
    te.setTransferToken(tt);

    custodyTransferPortTypeSam.transferEntities(te);

    //confirm the transfer
    GetOperationalInfo go = new GetOperationalInfo();
    go.setAuthInfo(authInfoSam);
    go.getEntityKey().add(keySamBiz);
    go.getEntityKey().add(keyJoeBiz);
    OperationalInfos operationalInfo = inquirySam.getOperationalInfo(go);

    for (int i = 0; i < operationalInfo.getOperationalInfo().size(); i++) {
        if (operationalInfo.getOperationalInfo().get(i).getEntityKey().equalsIgnoreCase(keyJoeBiz)) {
            Assert.assertEquals(operationalInfo.getOperationalInfo().get(i).getAuthorizedName(),
                    (TckPublisher.getSamPublisherId()));

        }
    }
    System.out.println("Business Entity transfered successfull");

    //note, we transfered ownership here so sam has to delete both of them
    TckCommon.DeleteBusiness(keyJoeBiz, authInfoSam, publishSam);
    TckCommon.DeleteBusiness(keySamBiz, authInfoSam, publishSam);

}

From source file:org.apache.juddi.v3.tck.UDDI_150_CustodyTransferIntegrationTest.java

@Test
public void InvalidTransferTokenEmptyNullAuthToken() {
    Assume.assumeTrue(TckPublisher.isEnabled());
    String keyJoeBiz = null;//from  w  w w .j  a  v a2s  .  c om
    try {
        DatatypeFactory df = DatatypeFactory.newInstance();
        GregorianCalendar gcal = new GregorianCalendar();
        gcal.setTimeInMillis(System.currentTimeMillis());
        XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);

        BusinessEntity myBusEntity = new BusinessEntity();
        Name myBusName = new Name();
        myBusName.setLang("en");
        myBusName.setValue("InvalidTransferTokenEmptyNullAuthToken UDDI's Business" + " " + xcal.toString());
        myBusEntity.getName().add(myBusName);
        myBusEntity.setBusinessServices(new BusinessServices());
        myBusEntity.getBusinessServices().getBusinessService().add(CreateBusiness("UDDI"));
        SaveBusiness sb = new SaveBusiness();
        sb.getBusinessEntity().add(myBusEntity);
        sb.setAuthInfo(authInfoJoe);
        BusinessDetail bd = publishJoe.saveBusiness(sb);

        keyJoeBiz = bd.getBusinessEntity().get(0).getBusinessKey();

        //transfers from Joe to Sam
        KeyBag kb = new KeyBag();
        kb.getKey().add(keyJoeBiz);

        Holder<String> nodeidOUT = new Holder<String>();
        Holder<XMLGregorianCalendar> expiresOUT = new Holder<XMLGregorianCalendar>();
        Holder<byte[]> tokenOUT = new Holder<byte[]>();
        custodyTransferPortTypeJoe.getTransferToken(null, kb, nodeidOUT, expiresOUT, tokenOUT);

        Assert.fail();
    } catch (Exception ex) {
        logger.info("Expected exception: " + ex.getMessage());

    } finally {
        TckCommon.DeleteBusiness(keyJoeBiz, authInfoJoe, publishJoe);

    }

}

From source file:org.apache.juddi.v3.tck.UDDI_150_CustodyTransferIntegrationTest.java

/**
 * a valid transfer token issued, then modified out of band, this should
 * fail/*from www .j  a v a2 s.c  o m*/
 */
@Test
public void InvalidTransferTokenModified() {
    Assume.assumeTrue(TckPublisher.isEnabled());
    String keySamBiz = null;
    String keyJoeBiz = null;
    try {
        DatatypeFactory df = DatatypeFactory.newInstance();
        GregorianCalendar gcal = new GregorianCalendar();
        gcal.setTimeInMillis(System.currentTimeMillis());
        XMLGregorianCalendar xcal = df.newXMLGregorianCalendar(gcal);

        BusinessEntity myBusEntity = new BusinessEntity();
        Name myBusName = new Name();
        myBusName.setLang("en");
        myBusName.setValue("InvalidTransferTokenModified UDDI's Business" + " " + xcal.toString());
        myBusEntity.getName().add(myBusName);
        myBusEntity.setBusinessServices(new BusinessServices());
        myBusEntity.getBusinessServices().getBusinessService().add(CreateBusiness("UDDI"));
        SaveBusiness sb = new SaveBusiness();
        sb.getBusinessEntity().add(myBusEntity);
        sb.setAuthInfo(authInfoJoe);
        BusinessDetail bd = publishJoe.saveBusiness(sb);

        keyJoeBiz = bd.getBusinessEntity().get(0).getBusinessKey();

        myBusEntity = new BusinessEntity();
        myBusName = new Name();
        myBusName.setLang("en");
        myBusName.setValue("Root's Business" + " " + xcal.toString());
        myBusEntity.getName().add(myBusName);
        myBusEntity.setBusinessServices(new BusinessServices());
        myBusEntity.getBusinessServices().getBusinessService().add(CreateBusiness("root"));
        sb = new SaveBusiness();
        sb.getBusinessEntity().add(myBusEntity);
        sb.setAuthInfo(authInfoSam);
        bd = publishSam.saveBusiness(sb);

        keySamBiz = bd.getBusinessEntity().get(0).getBusinessKey();
        //String keySamBizSvc = bd.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0).getServiceKey();

        //transfers from Joe to Sam
        KeyBag kb = new KeyBag();
        kb.getKey().add(keyJoeBiz);

        Holder<String> nodeidOUT = new Holder<String>();
        Holder<XMLGregorianCalendar> expiresOUT = new Holder<XMLGregorianCalendar>();
        Holder<byte[]> tokenOUT = new Holder<byte[]>();
        custodyTransferPortTypeJoe.getTransferToken(authInfoJoe, kb, nodeidOUT, expiresOUT, tokenOUT);

        //sam accepts
        TransferEntities te = new TransferEntities();
        te.setAuthInfo(authInfoSam);
        te.setKeyBag(kb);
        te.getKeyBag().getKey().add("uddi:uddi.joepublisher.com:" + UUID.randomUUID().toString());
        TransferToken tt = new TransferToken();
        tt.setExpirationTime(expiresOUT.value);
        tt.setNodeID(nodeidOUT.value);
        tt.setOpaqueToken(tokenOUT.value);
        te.setTransferToken(tt);

        custodyTransferPortTypeSam.transferEntities(te);
        Assert.fail();
    } catch (Exception ex) {
        //  HandleException(ex);
        logger.info("Expected exception: " + ex.getMessage());
    } finally {
        TckCommon.DeleteBusiness(keyJoeBiz, authInfoJoe, publishJoe);
        TckCommon.DeleteBusiness(keySamBiz, authInfoSam, publishSam);
    }

}

From source file:org.artificer.integration.artifactbuilder.WsdlDocumentArtifactBuilderTest.java

@Test
public void testDeriverWsdl() throws Exception {
    DatatypeFactory dtFactory = DatatypeFactory.newInstance();

    WsdlDocumentArtifactBuilder builder = new WsdlDocumentArtifactBuilder();
    WsdlDocument testSrcArtifact = new WsdlDocument();
    testSrcArtifact.setArtifactType(BaseArtifactEnum.WSDL_DOCUMENT);
    testSrcArtifact.setUuid(UUID.randomUUID().toString());
    testSrcArtifact.setName("sample.wsdl");
    testSrcArtifact.setVersion("2012/09");
    testSrcArtifact.setContentEncoding("UTF-8");
    testSrcArtifact.setContentType("application/xml");
    testSrcArtifact.setContentSize(92779L);
    testSrcArtifact.setCreatedBy("anonymous");
    XMLGregorianCalendar xmlGC = dtFactory.newXMLGregorianCalendar(new GregorianCalendar());
    testSrcArtifact.setCreatedTimestamp(xmlGC);
    testSrcArtifact.setDescription("Sample WSDL.");
    testSrcArtifact.setLastModifiedBy("anonymous");
    testSrcArtifact.setLastModifiedTimestamp(xmlGC);

    InputStream testSrcContent = null;
    try {// w  w w.  ja v a2s .  c o m
        testSrcContent = getClass().getResourceAsStream("/sample-files/wsdl/deriver.wsdl");
        Collection<BaseArtifactType> derivedArtifacts = builder
                .buildArtifacts(testSrcArtifact, new ArtifactContent("deriver.wsdl", testSrcContent))
                .getDerivedArtifacts();
        Assert.assertNotNull(derivedArtifacts);
        Assert.assertEquals(35, derivedArtifacts.size());

        // Index the results by artifact type and name
        Map<QName, DerivedArtifactType> index = new HashMap<QName, DerivedArtifactType>();
        for (BaseArtifactType da : derivedArtifacts) {
            DerivedArtifactType artifact = (DerivedArtifactType) da;
            if (artifact instanceof NamedWsdlDerivedArtifactType) {
                NamedWsdlDerivedArtifactType arty = (NamedWsdlDerivedArtifactType) artifact;
                if (arty.getNCName() != null)
                    index.put(new QName(arty.getArtifactType().toString(), arty.getNCName()), artifact);
            } else if (artifact instanceof WsdlExtension) {
                WsdlExtension arty = (WsdlExtension) artifact;
                index.put(new QName(arty.getArtifactType().toString(), arty.getNCName()), arty);
            } else if (artifact instanceof ElementDeclaration) {
                ElementDeclaration arty = (ElementDeclaration) artifact;
                index.put(new QName(arty.getArtifactType().toString(), arty.getNCName()), artifact);
            } else if (artifact instanceof AttributeDeclaration) {
                AttributeDeclaration arty = (AttributeDeclaration) artifact;
                index.put(new QName(arty.getArtifactType().toString(), arty.getNCName()), artifact);
            } else if (artifact instanceof SimpleTypeDeclaration) {
                SimpleTypeDeclaration arty = (SimpleTypeDeclaration) artifact;
                index.put(new QName(arty.getArtifactType().toString(), arty.getNCName()), artifact);
            } else if (artifact instanceof ComplexTypeDeclaration) {
                ComplexTypeDeclaration arty = (ComplexTypeDeclaration) artifact;
                index.put(new QName(arty.getArtifactType().toString(), arty.getNCName()), artifact);
            }
        }

        // Do some specific assertions
        ////////////////////////////////////////////

        // Find the message named 'findRequest'
        DerivedArtifactType artifact = index.get(new QName(BaseArtifactEnum.MESSAGE.toString(), "findRequest"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("findRequest", artifact.getName());
        Assert.assertEquals("findRequest", ((Message) artifact).getNCName());
        Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl",
                ((Message) artifact).getNamespace());
        Message message = (Message) artifact;
        Assert.assertEquals(1, message.getPart().size());

        // Find the element decl named 'findResponse'
        artifact = index.get(new QName(BaseArtifactEnum.ELEMENT_DECLARATION.toString(), "findResponse"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("findResponse", artifact.getName());
        Assert.assertEquals("findResponse", ((ElementDeclaration) artifact).getNCName());
        Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl/types",
                ((ElementDeclaration) artifact).getNamespace());

        // Find the simple type named 'keywordType'
        artifact = index.get(new QName(BaseArtifactEnum.SIMPLE_TYPE_DECLARATION.toString(), "keywordType"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("keywordType", artifact.getName());
        Assert.assertEquals("keywordType", ((SimpleTypeDeclaration) artifact).getNCName());
        Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl/types",
                ((SimpleTypeDeclaration) artifact).getNamespace());
        String typeUuid = artifact.getUuid();

        // Find the part named 'keyword'
        artifact = index.get(new QName(BaseArtifactEnum.PART.toString(), "keyword"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("keyword", artifact.getName());
        Part part = (Part) artifact;
        Assert.assertEquals("keyword", part.getNCName());
        Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl", part.getNamespace());
        Assert.assertNotNull(part.getType());
        Assert.assertEquals(typeUuid, part.getType().getValue());

        // Find the port type named 'SamplePortType'
        artifact = index.get(new QName(BaseArtifactEnum.PORT_TYPE.toString(), "SamplePortType"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("SamplePortType", artifact.getName());
        Assert.assertEquals("SamplePortType", ((PortType) artifact).getNCName());
        Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl",
                ((PortType) artifact).getNamespace());
        PortType portType = (PortType) artifact;
        Assert.assertEquals(2, portType.getOperation().size());

        // Find the operation named 'find'
        artifact = index.get(new QName(BaseArtifactEnum.OPERATION.toString(), "find"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("find", artifact.getName());
        Operation operation = (Operation) artifact;
        Assert.assertEquals("find", operation.getNCName());
        Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl",
                operation.getNamespace());
        Assert.assertNotNull(operation.getInput());
        Assert.assertNotNull(operation.getOutput());
        Assert.assertNotNull(operation.getFault());
        Assert.assertEquals(2, operation.getFault().size());

        // Find the operation input named 'findRequest'
        artifact = index.get(new QName(BaseArtifactEnum.OPERATION_INPUT.toString(), "findRequest"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("findRequest", artifact.getName());
        OperationInput operationInput = (OperationInput) artifact;
        Assert.assertEquals("findRequest", operationInput.getNCName());
        Assert.assertNotNull(operationInput.getMessage());
        Assert.assertNotNull(operationInput.getMessage().getValue());
        Assert.assertEquals(index.get(new QName(BaseArtifactEnum.MESSAGE.toString(), "findRequest")).getUuid(),
                operationInput.getMessage().getValue());

        // Find the operation output named 'findResponse'
        artifact = index.get(new QName(BaseArtifactEnum.OPERATION_OUTPUT.toString(), "findResponse"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("findResponse", artifact.getName());
        OperationOutput operationOutput = (OperationOutput) artifact;
        Assert.assertEquals("findResponse", operationOutput.getNCName());
        Assert.assertNotNull(operationOutput.getMessage());
        Assert.assertNotNull(operationOutput.getMessage().getValue());
        Assert.assertEquals(index.get(new QName(BaseArtifactEnum.MESSAGE.toString(), "findResponse")).getUuid(),
                operationOutput.getMessage().getValue());

        // Find the binding named 'SampleBinding'
        artifact = index.get(new QName(BaseArtifactEnum.BINDING.toString(), "SampleBinding"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("SampleBinding", artifact.getName());
        Assert.assertEquals("SampleBinding", ((Binding) artifact).getNCName());
        Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl",
                ((Binding) artifact).getNamespace());
        Binding binding = (Binding) artifact;
        Assert.assertEquals(2, binding.getBindingOperation().size());
        Assert.assertEquals(1, binding.getExtension().size());

        // Find the document style soap:binding
        artifact = index.get(new QName(BaseArtifactEnum.SOAP_BINDING.toString(), "binding"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("soap:binding", artifact.getName());
        Assert.assertEquals("binding", ((SoapBinding) artifact).getNCName());
        Assert.assertEquals("http://schemas.xmlsoap.org/wsdl/soap/", ((SoapBinding) artifact).getNamespace());
        SoapBinding soapBinding = (SoapBinding) artifact;
        Assert.assertEquals("document", soapBinding.getStyle());
        Assert.assertEquals("http://schemas.xmlsoap.org/soap/http", soapBinding.getTransport());
        Assert.assertEquals(binding.getExtension().get(0).getValue(), soapBinding.getUuid());

        // Find the binding operation named 'find'
        artifact = index.get(new QName(BaseArtifactEnum.BINDING_OPERATION.toString(), "find"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("find", artifact.getName());
        BindingOperation bindingOperation = (BindingOperation) artifact;
        Assert.assertEquals("find", bindingOperation.getNCName());
        Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl",
                bindingOperation.getNamespace());
        Assert.assertNotNull(bindingOperation.getInput());
        Assert.assertNotNull(bindingOperation.getOutput());
        Assert.assertNotNull(bindingOperation.getFault());
        Assert.assertEquals(2, bindingOperation.getFault().size());
        Assert.assertNotNull(bindingOperation.getOperation());
        Assert.assertEquals(operation.getUuid(), bindingOperation.getOperation().getValue());

        // Find the binding operation input named 'findRequest'
        artifact = index.get(new QName(BaseArtifactEnum.BINDING_OPERATION_INPUT.toString(), "findRequest"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("findRequest", artifact.getName());
        BindingOperationInput bindingOperationInput = (BindingOperationInput) artifact;
        Assert.assertEquals("findRequest", bindingOperationInput.getNCName());
        Assert.assertEquals(bindingOperation.getInput().getValue(), bindingOperationInput.getUuid());

        // Find the binding operation output named 'findResponse'
        artifact = index.get(new QName(BaseArtifactEnum.BINDING_OPERATION_OUTPUT.toString(), "findResponse"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("findResponse", artifact.getName());
        BindingOperationOutput bindingOperationOutput = (BindingOperationOutput) artifact;
        Assert.assertEquals("findResponse", bindingOperationOutput.getNCName());
        Assert.assertEquals(bindingOperation.getOutput().getValue(), bindingOperationOutput.getUuid());

        // Find the service named 'SampleService'
        artifact = index.get(new QName(BaseArtifactEnum.WSDL_SERVICE.toString(), "SampleService"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("SampleService", artifact.getName());
        Assert.assertEquals("SampleService", ((WsdlService) artifact).getNCName());
        Assert.assertEquals("http://ewittman.redhat.com/sample/2012/09/wsdl/sample.wsdl",
                ((WsdlService) artifact).getNamespace());
        WsdlService service = (WsdlService) artifact;
        Assert.assertEquals(1, service.getPort().size());

        // Find the port named 'SamplePort'
        artifact = index.get(new QName(BaseArtifactEnum.PORT.toString(), "SamplePort"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("SamplePort", artifact.getName());
        Assert.assertEquals("SamplePort", ((Port) artifact).getNCName());
        Port port = (Port) artifact;
        Assert.assertNotNull(port.getBinding());
        Assert.assertEquals(port.getBinding().getValue(), binding.getUuid());
        Assert.assertEquals(1, port.getExtension().size());

        // Find the soap:address
        artifact = index.get(new QName(BaseArtifactEnum.SOAP_ADDRESS.toString(), "address"));
        Assert.assertNotNull(artifact);
        Assert.assertEquals("soap:address", artifact.getName());
        Assert.assertEquals("address", ((SoapAddress) artifact).getNCName());
        Assert.assertEquals("http://schemas.xmlsoap.org/wsdl/soap/", ((SoapAddress) artifact).getNamespace());
        SoapAddress soapAddress = (SoapAddress) artifact;
        Assert.assertEquals("http://localhost:8080/sample/sampleEP", soapAddress.getSoapLocation());
        Assert.assertEquals(port.getExtension().get(0).getValue(), soapAddress.getUuid());

    } finally {
        IOUtils.closeQuietly(testSrcContent);
    }
}