Modified: juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java?rev=1552928&r1=1552927&r2=1552928&view=diff ============================================================================== --- juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java (original) +++ juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_141_JIRAIntegrationTest.java Sat Dec 21 17:35:51 2013 @@ -58,7 +58,8 @@ import org.uddi.v3_service.UDDISubscript */ public class UDDI_141_JIRAIntegrationTest { - public UDDI_141_JIRAIntegrationTest() throws RemoteException{} + public UDDI_141_JIRAIntegrationTest() throws RemoteException { + } private static Log logger = LogFactory.getLog(UDDI_141_JIRAIntegrationTest.class); static UDDISecurityPortType security = null; static UDDISubscriptionPortType subscriptionJoe = null; @@ -93,11 +94,14 @@ public class UDDI_141_JIRAIntegrationTes @AfterClass public static void stopManager() throws ConfigurationException { + tckTModelJoe.deleteCreatedTModels(authInfoJoe); + tckTModelSam.deleteCreatedTModels(authInfoSam); manager.stop(); } @BeforeClass public static void startManager() throws ConfigurationException { + logger.info("UDDI_141_JIRAIntegrationTest"); manager = new UDDIClient(); manager.start(); @@ -806,30 +810,10 @@ public class UDDI_141_JIRAIntegrationTes } - - private void removeAllExistingSubscriptions(UDDISubscriptionPortType sub, String authinfo) { - List<Subscription> subscriptions; - try { - subscriptions = sub.getSubscriptions(authinfo); - - DeleteSubscription ds = new DeleteSubscription(); - ds.setAuthInfo(authinfo); - for (int i = 0; i < subscriptions.size(); i++) { - ds.getSubscriptionKey().add(subscriptions.get(i).getSubscriptionKey()); - } - if (!subscriptions.isEmpty()) { - logger.info("Purging " + subscriptions.size() + " old subscriptions"); - sub.deleteSubscription(ds); - } - } catch (Exception ex) { - logger.warn("error clearing subscriptions", ex); - } - } - UDDISubscriptionListenerImpl impl = new UDDISubscriptionListenerImpl(); - + /** - * testing upper case subscription callbacks + * testing upper case subscription callbacks * * @throws Exception */ @@ -844,8 +828,8 @@ public class UDDI_141_JIRAIntegrationTes hostname = InetAddress.getLocalHost().getHostName(); } - - removeAllExistingSubscriptions(subscriptionJoe, authInfoJoe); + + TckCommon.removeAllExistingSubscriptions(authInfoJoe,subscriptionJoe); UDDISubscriptionListenerImpl.notifcationMap.clear(); UDDISubscriptionListenerImpl.notificationCount = 0; Endpoint ep = null; @@ -935,7 +919,7 @@ public class UDDI_141_JIRAIntegrationTes Thread.sleep(1000); maxwait = maxwait - 1000; } - removeAllExistingSubscriptions(subscriptionJoe, authInfoJoe); + TckCommon.removeAllExistingSubscriptions(authInfoJoe,subscriptionJoe); this.DeleteBusinesses(deleteme, authInfoJoe, publicationJoe); deleteme.clear(); deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey()); @@ -959,15 +943,15 @@ public class UDDI_141_JIRAIntegrationTes public void JIRA_596() throws Exception { 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(); - removeAllExistingSubscriptions(subscriptionJoe, authInfoJoe); + + // String localhostname = "localhost";//java.net.InetAddress.getLocalHost().getHostName(); + TckCommon.removeAllExistingSubscriptions(authInfoJoe,subscriptionJoe); //UDDISubscriptionListenerImpl impl = new UDDISubscriptionListenerImpl(); UDDISubscriptionListenerImpl.notifcationMap.clear(); UDDISubscriptionListenerImpl.notificationCount = 0; @@ -1058,7 +1042,7 @@ public class UDDI_141_JIRAIntegrationTes Thread.sleep(1000); maxwait = maxwait - 1000; } - removeAllExistingSubscriptions(subscriptionJoe, authInfoJoe); + TckCommon.removeAllExistingSubscriptions(authInfoJoe,subscriptionJoe); DeleteBusinesses(deleteme, authInfoJoe, publicationJoe); deleteme.clear(); deleteme.add(saveBusiness1.getBusinessEntity().get(0).getBusinessKey()); @@ -1306,7 +1290,7 @@ public class UDDI_141_JIRAIntegrationTes tckBusinessSam.saveSamSyndicatorBusiness(authInfoSam); AddPublisherAssertions apa = new AddPublisherAssertions(); - apa.setAuthInfo(madeupTmodel); + apa.setAuthInfo(authInfoJoe); PublisherAssertion pa = new PublisherAssertion(); pa.setKeyedReference(new KeyedReference(madeupTmodel, "name", "val")); pa.setFromKey(TckBusiness.JOE_BUSINESS_KEY); @@ -1317,6 +1301,11 @@ public class UDDI_141_JIRAIntegrationTes Assert.fail("unexpected success"); } catch (Exception ex) { logger.error(ex.getMessage()); + } finally { + tckBusinessJoe.deleteJoePublisherBusiness(authInfoJoe); + tckBusinessSam.deleteSamSyndicatorBusiness(authInfoSam); + tckTModelJoe.deleteJoePublisherTmodel(authInfoJoe); + tckTModelSam.deleteSamSyndicatorTmodel(authInfoSam); } } @@ -1400,153 +1389,7 @@ public class UDDI_141_JIRAIntegrationTes //TODO tmodel tests //TODO create tests for enforcing ref integrity of tmodel keys, after enforcing this, the tests in this class will need to be heavily revised - //<editor-fold defaultstate="collapsed" desc="Some basic util functions to print out the data structure"> - /** - * Converts category bags of tmodels to a readable string - * - * @param categoryBag - * @return - */ - public static String CatBagToString(CategoryBag categoryBag) { - StringBuilder sb = new StringBuilder(); - if (categoryBag == null) { - return "no data"; - } - for (int i = 0; i < categoryBag.getKeyedReference().size(); i++) { - sb.append(KeyedReferenceToString(categoryBag.getKeyedReference().get(i))); - } - for (int i = 0; i < categoryBag.getKeyedReferenceGroup().size(); i++) { - sb.append("Key Ref Grp: TModelKey="); - for (int k = 0; k < categoryBag.getKeyedReferenceGroup().get(i).getKeyedReference().size(); k++) { - sb.append(KeyedReferenceToString(categoryBag.getKeyedReferenceGroup().get(i).getKeyedReference().get(k))); - } - } - return sb.toString(); - } - - public static String KeyedReferenceToString(KeyedReference item) { - StringBuilder sb = new StringBuilder(); - sb.append("Key Ref: Name="). - append(item.getKeyName()). - append(" Value="). - append(item.getKeyValue()). - append(" tModel="). - append(item.getTModelKey()). - append(System.getProperty("line.separator")); - return sb.toString(); - } - - public static void PrintContacts(Contacts contacts) { - if (contacts == null) { - return; - } - for (int i = 0; i < contacts.getContact().size(); i++) { - System.out.println("Contact " + i + " type:" + contacts.getContact().get(i).getUseType()); - for (int k = 0; k < contacts.getContact().get(i).getPersonName().size(); k++) { - System.out.println("Name: " + contacts.getContact().get(i).getPersonName().get(k).getValue()); - } - for (int k = 0; k < contacts.getContact().get(i).getEmail().size(); k++) { - System.out.println("Email: " + contacts.getContact().get(i).getEmail().get(k).getValue()); - } - for (int k = 0; k < contacts.getContact().get(i).getAddress().size(); k++) { - System.out.println("Address sort code " + contacts.getContact().get(i).getAddress().get(k).getSortCode()); - System.out.println("Address use type " + contacts.getContact().get(i).getAddress().get(k).getUseType()); - System.out.println("Address tmodel key " + contacts.getContact().get(i).getAddress().get(k).getTModelKey()); - for (int x = 0; x < contacts.getContact().get(i).getAddress().get(k).getAddressLine().size(); x++) { - System.out.println("Address line value " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getValue()); - System.out.println("Address line key name " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getKeyName()); - System.out.println("Address line key value " + contacts.getContact().get(i).getAddress().get(k).getAddressLine().get(x).getKeyValue()); - } - } - for (int k = 0; k < contacts.getContact().get(i).getDescription().size(); k++) { - System.out.println("Desc: " + contacts.getContact().get(i).getDescription().get(k).getValue()); - } - for (int k = 0; k < contacts.getContact().get(i).getPhone().size(); k++) { - System.out.println("Phone: " + contacts.getContact().get(i).getPhone().get(k).getValue()); - } - } - - } - - /** - * This function is useful for translating UDDI's somewhat complex data - * format to something that is more useful. - * - * @param bindingTemplates - */ - public static void PrintBindingTemplates(BindingTemplates bindingTemplates) { - if (bindingTemplates == null) { - return; - } - for (int i = 0; i < bindingTemplates.getBindingTemplate().size(); i++) { - System.out.println("Binding Key: " + bindingTemplates.getBindingTemplate().get(i).getBindingKey()); - - if (bindingTemplates.getBindingTemplate().get(i).getAccessPoint() != null) { - System.out.println("Access Point: " + bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getValue() + " type " + bindingTemplates.getBindingTemplate().get(i).getAccessPoint().getUseType()); - } - - if (bindingTemplates.getBindingTemplate().get(i).getHostingRedirector() != null) { - System.out.println("Hosting Redirection: " + bindingTemplates.getBindingTemplate().get(i).getHostingRedirector().getBindingKey()); - } - } - } - - public static void PrintBusinessInfo(BusinessInfos businessInfos) { - if (businessInfos == null) { - System.out.println("No data returned"); - } else { - for (int i = 0; i < businessInfos.getBusinessInfo().size(); i++) { - System.out.println("==============================================="); - System.out.println("Business Key: " + businessInfos.getBusinessInfo().get(i).getBusinessKey()); - System.out.println("Name: " + ListToString(businessInfos.getBusinessInfo().get(i).getName())); - - System.out.println("Name: " + ListToDescString(businessInfos.getBusinessInfo().get(i).getDescription())); - System.out.println("Services:"); - PrintServiceInfo(businessInfos.getBusinessInfo().get(i).getServiceInfos()); - } - } - } - - public static String ListToString(List<Name> name) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < name.size(); i++) { - sb.append(name.get(i).getValue()).append(" "); - } - return sb.toString(); - } - - public static String ListToDescString(List<Description> name) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < name.size(); i++) { - sb.append(name.get(i).getValue()).append(" "); - } - return sb.toString(); - } - - public static void PrintServiceInfo(ServiceInfos serviceInfos) { - for (int i = 0; i < serviceInfos.getServiceInfo().size(); i++) { - System.out.println("-------------------------------------------"); - System.out.println("Service Key: " + serviceInfos.getServiceInfo().get(i).getServiceKey()); - System.out.println("Owning Business Key: " + serviceInfos.getServiceInfo().get(i).getBusinessKey()); - System.out.println("Name: " + ListToString(serviceInfos.getServiceInfo().get(i).getName())); - } - } - - public static void PrintBusinessDetails(List<BusinessEntity> businessDetail) throws Exception { - - - for (int i = 0; i < businessDetail.size(); i++) { - System.out.println("Business Detail - key: " + businessDetail.get(i).getBusinessKey()); - System.out.println("Name: " + ListToString(businessDetail.get(i).getName())); - System.out.println("CategoryBag: " + CatBagToString(businessDetail.get(i).getCategoryBag())); - PrintContacts(businessDetail.get(i).getContacts()); - } - } - //</editor-fold> - private void DeleteBusinesses(List<String> businesskeysToDelete, String authinfo, UDDIPublicationPortType pub) { - - //cleanup try { DeleteBusiness db = new DeleteBusiness();
Modified: juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_150_CustodyTransferIntegrationTest.java URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_150_CustodyTransferIntegrationTest.java?rev=1552928&r1=1552927&r2=1552928&view=diff ============================================================================== --- juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_150_CustodyTransferIntegrationTest.java (original) +++ juddi/branches/juddi-3.3.x/uddi-tck/src/test/java/org/apache/juddi/v3/tck/UDDI_150_CustodyTransferIntegrationTest.java Sat Dec 21 17:35:51 2013 @@ -28,10 +28,6 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.juddi.v3.client.config.UDDIClient; import org.apache.juddi.v3.client.transport.Transport; -import org.apache.juddi.v3.tck.TckPublisher; -import org.apache.juddi.v3.tck.TckSecurity; -import org.apache.juddi.v3.tck.TckTModel; -import static org.apache.juddi.v3.tck.UDDI_141_JIRAIntegrationTest.publicationJoe; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; @@ -77,25 +73,12 @@ public class UDDI_150_CustodyTransferInt protected static String authInfoJoe = null; protected static String authInfoSam = null; private static UDDIClient manager; - static final String str256 = "1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"; - static final String str255 = "uddi:tmodelkey:categories:1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"; - static final String strkey256 = "uddi:tmodelkey:categories:11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"; - static final String strkey256_1 = "uddi:org.apache:omething.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.something.somethi.com"; - static final String str26 = "11111111111111111111111111"; - static final String str27 = "111111111111111111111111110"; - static final String str10 = "0123456789"; - static final String str11 = "01234567890"; - static final String str80 = "01234567890123456789012345678901234567890123456789012345678901234567890123456789"; - static final String str81 = "012345678901234567890123456789012345678901234567890123456789012345678901234567891"; static final String TRANS = "The transaction has been rolled back"; - static final String str4096 = "1234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012345670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012345670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000XXXXXXXX"; - static final String str4097 = "1234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012345670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000012345670000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001234567000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123456700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000XXXXXXXXZ"; - static final String str51 = "111111111111111111111111111111111111111111111111111"; - static final String str50 = "11111111111111111111111111111111111111111111111111"; static final String MISSING_RESOURCE = "Can't find resource for bundle"; @AfterClass public static void stopManager() throws ConfigurationException { + tckTModelJoe.deleteCreatedTModels(authInfoJoe); manager.stop(); } @@ -119,7 +102,7 @@ public class UDDI_150_CustodyTransferInt custodyTransferPortTypeJoe = transport.getUDDICustodyTransferService(); if (!TckPublisher.isUDDIAuthMode()) { - TckSecurity.setCredentials((BindingProvider) publicationJoe, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword()); + TckSecurity.setCredentials((BindingProvider) publishJoe, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword()); TckSecurity.setCredentials((BindingProvider) inquiryJoe, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword()); TckSecurity.setCredentials((BindingProvider) custodyTransferPortTypeJoe, TckPublisher.getJoePublisherId(), TckPublisher.getJoePassword()); } @@ -131,21 +114,21 @@ public class UDDI_150_CustodyTransferInt inquirySam = transport.getUDDIInquiryService(); custodyTransferPortTypeSam = transport.getUDDICustodyTransferService(); if (!TckPublisher.isUDDIAuthMode()) { - TckSecurity.setCredentials((BindingProvider) publicationJoe, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); + TckSecurity.setCredentials((BindingProvider) publishJoe, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); TckSecurity.setCredentials((BindingProvider) inquiryJoe, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); TckSecurity.setCredentials((BindingProvider) custodyTransferPortTypeJoe, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); } - + transport = manager.getTransport(); UDDIPublicationPortType uddiPublishService = transport.getUDDIPublishService(); UDDIInquiryPortType uddiInquiryService = transport.getUDDIInquiryService(); if (!TckPublisher.isUDDIAuthMode()) { - TckSecurity.setCredentials((BindingProvider) publicationJoe, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); + TckSecurity.setCredentials((BindingProvider) publishJoe, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); TckSecurity.setCredentials((BindingProvider) inquiryJoe, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); TckSecurity.setCredentials((BindingProvider) custodyTransferPortTypeJoe, TckPublisher.getSamPublisherId(), TckPublisher.getSamPassword()); } - TckTModel tckTModelUDDI= new TckTModel(uddiPublishService, uddiInquiryService); + TckTModel tckTModelUDDI = new TckTModel(uddiPublishService, uddiInquiryService); String authInfoUDDI = TckSecurity.getAuthToken(security, TckPublisher.getUDDIPublisherId(), TckPublisher.getUDDIPassword()); tckTModelUDDI.saveUDDIPublisherTmodel(authInfoUDDI); tckTModelUDDI.saveTModels(authInfoUDDI, TckTModel.TMODELS_XML); @@ -179,6 +162,7 @@ public class UDDI_150_CustodyTransferInt */ @Test public void ValidTransfer() throws Exception { + System.out.println("ValidTransfer"); DatatypeFactory df = DatatypeFactory.newInstance(); GregorianCalendar gcal = new GregorianCalendar(); gcal.setTimeInMillis(System.currentTimeMillis()); @@ -188,7 +172,7 @@ public class UDDI_150_CustodyTransferInt BusinessEntity myBusEntity = new BusinessEntity(); Name myBusName = new Name(); myBusName.setLang("en"); - myBusName.setValue("UDDI's Business" + " " + xcal.toString()); + myBusName.setValue("ValidTransfer UDDI's Business" + " " + xcal.toString()); myBusEntity.getName().add(myBusName); myBusEntity.setBusinessServices(new BusinessServices()); myBusEntity.getBusinessServices().getBusinessService().add(CreateBusiness("UDDI")); @@ -205,7 +189,7 @@ public class UDDI_150_CustodyTransferInt myBusEntity = new BusinessEntity(); myBusName = new Name(); myBusName.setLang("en"); - myBusName.setValue("Root's Business" + " " + xcal.toString()); + myBusName.setValue("ValidTransfer Root's Business" + " " + xcal.toString()); myBusEntity.getName().add(myBusName); myBusEntity.setBusinessServices(new BusinessServices()); myBusEntity.getBusinessServices().getBusinessService().add(CreateBusiness("root")); @@ -244,7 +228,7 @@ public class UDDI_150_CustodyTransferInt go.getEntityKey().add(keySamBiz); go.getEntityKey().add(keyJoeBiz); OperationalInfos operationalInfo = inquirySam.getOperationalInfo(go); - boolean ok = false; + 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())); @@ -253,6 +237,10 @@ public class UDDI_150_CustodyTransferInt } 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); + } @@ -281,7 +269,7 @@ public class UDDI_150_CustodyTransferInt custodyTransferPortTypeJoe.getTransferToken(authInfoJoe, kb, nodeidOUT, expiresOUT, tokenOUT); Assert.fail(); } catch (Exception ex) { - // HandleException(ex); + logger.info("Expected exception: " + ex.getMessage()); } } @@ -300,13 +288,14 @@ public class UDDI_150_CustodyTransferInt Assert.fail(); } catch (Exception ex) { - // HandleException(ex); + logger.info("Expected exception: " + ex.getMessage()); } } @Test public void InvalidTransferTokenEmptyNullAuthToken() { + String keyJoeBiz = null; try { DatatypeFactory df = DatatypeFactory.newInstance(); GregorianCalendar gcal = new GregorianCalendar(); @@ -317,7 +306,7 @@ public class UDDI_150_CustodyTransferInt BusinessEntity myBusEntity = new BusinessEntity(); Name myBusName = new Name(); myBusName.setLang("en"); - myBusName.setValue("UDDI's Business" + " " + xcal.toString()); + myBusName.setValue("InvalidTransferTokenEmptyNullAuthToken UDDI's Business" + " " + xcal.toString()); myBusEntity.getName().add(myBusName); myBusEntity.setBusinessServices(new BusinessServices()); myBusEntity.getBusinessServices().getBusinessService().add(CreateBusiness("UDDI")); @@ -326,7 +315,7 @@ public class UDDI_150_CustodyTransferInt sb.setAuthInfo(authInfoJoe); BusinessDetail bd = publishJoe.saveBusiness(sb); - String keyJoeBiz = bd.getBusinessEntity().get(0).getBusinessKey(); + keyJoeBiz = bd.getBusinessEntity().get(0).getBusinessKey(); //transfers from Joe to Sam KeyBag kb = new KeyBag(); @@ -339,13 +328,23 @@ public class UDDI_150_CustodyTransferInt Assert.fail(); } catch (Exception ex) { - // HandleException(ex); + logger.info("Expected exception: " + ex.getMessage()); + + } finally { + TckCommon.DeleteBusiness(keyJoeBiz, authInfoJoe, publishJoe); + } } + /** + * a valid transfer token issued, then modified out of band, this should + * fail + */ @Test public void InvalidTransferTokenModified() { + String keySamBiz = null; + String keyJoeBiz = null; try { DatatypeFactory df = DatatypeFactory.newInstance(); GregorianCalendar gcal = new GregorianCalendar(); @@ -356,7 +355,7 @@ public class UDDI_150_CustodyTransferInt BusinessEntity myBusEntity = new BusinessEntity(); Name myBusName = new Name(); myBusName.setLang("en"); - myBusName.setValue("UDDI's Business" + " " + xcal.toString()); + myBusName.setValue("InvalidTransferTokenModified UDDI's Business" + " " + xcal.toString()); myBusEntity.getName().add(myBusName); myBusEntity.setBusinessServices(new BusinessServices()); myBusEntity.getBusinessServices().getBusinessService().add(CreateBusiness("UDDI")); @@ -365,8 +364,7 @@ public class UDDI_150_CustodyTransferInt 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(); + keyJoeBiz = bd.getBusinessEntity().get(0).getBusinessKey(); @@ -382,7 +380,7 @@ public class UDDI_150_CustodyTransferInt sb.setAuthInfo(authInfoSam); bd = publishSam.saveBusiness(sb); - String keySamBiz = bd.getBusinessEntity().get(0).getBusinessKey(); + keySamBiz = bd.getBusinessEntity().get(0).getBusinessKey(); //String keySamBizSvc = bd.getBusinessEntity().get(0).getBusinessServices().getBusinessService().get(0).getServiceKey(); //transfers from Joe to Sam @@ -410,6 +408,10 @@ public class UDDI_150_CustodyTransferInt Assert.fail(); } catch (Exception ex) { // HandleException(ex); + logger.info("Expected exception: " + ex.getMessage()); + } finally { + TckCommon.DeleteBusiness(keyJoeBiz, authInfoJoe, publishJoe); + TckCommon.DeleteBusiness(keySamBiz, authInfoSam, publishSam); } } @@ -428,6 +430,7 @@ public class UDDI_150_CustodyTransferInt Assert.fail(); } catch (Exception ex) { //HandleException(ex); + logger.info("Expected exception: " + ex.getMessage()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
