juddi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ks...@apache.org
Subject svn commit: r922009 - in /webservices/juddi/trunk: juddi-core/src/test/java/org/apache/juddi/api/impl/ uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/
Date Thu, 11 Mar 2010 20:27:23 GMT
Author: kstam
Date: Thu Mar 11 20:27:22 2010
New Revision: 922009

URL: http://svn.apache.org/viewvc?rev=922009&view=rev
Log:
JUDDI-370, adding test for updating a business. 

Modified:
    webservices/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java
    webservices/juddi/trunk/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusiness.java
    webservices/juddi/trunk/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusinessService.java

Modified: webservices/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java?rev=922009&r1=922008&r2=922009&view=diff
==============================================================================
--- webservices/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java
(original)
+++ webservices/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_040_BusinessServiceTest.java
Thu Mar 11 20:27:22 2010
@@ -82,6 +82,37 @@ public class API_040_BusinessServiceTest
 	}
 	
 	@Test
+	public void joepublisher2Services() {
+		try {
+			tckTModel.saveJoePublisherTmodel(authInfoJoe);
+			tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+			tckBusinessService.saveJoePublisherService(authInfoJoe);
+			tckBusinessService.saveJoePublisherService2(authInfoJoe);
+			tckBusinessService.deleteJoePublisherService(authInfoJoe);
+			tckBusinessService.deleteJoePublisherService2(authInfoJoe);
+		} finally {
+			tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+			tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+		}
+	}
+	
+	@Test
+	public void joepublisher2UpdateBusiness() {
+		try {
+			tckTModel.saveJoePublisherTmodel(authInfoJoe);
+			tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+			tckBusinessService.saveJoePublisherService(authInfoJoe);
+			tckBusinessService.saveJoePublisherService2(authInfoJoe);
+			tckBusiness.updateJoePublisherBusiness(authInfoJoe);
+			tckBusinessService.deleteJoePublisherService(authInfoJoe);
+			tckBusinessService.deleteJoePublisherService2(authInfoJoe);
+		} finally {
+			tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+			tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+		}
+	}
+	
+	@Test
 	public void samsyndicator() {
 		try {
 			// For sam's service projection, joe's information must be loaded

Modified: webservices/juddi/trunk/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusiness.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusiness.java?rev=922009&r1=922008&r2=922009&view=diff
==============================================================================
--- webservices/juddi/trunk/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusiness.java
(original)
+++ webservices/juddi/trunk/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusiness.java
Thu Mar 11 20:27:22 2010
@@ -15,6 +15,7 @@
 package org.apache.juddi.v3.tck;
 
 import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
 
 import java.util.List;
 
@@ -24,6 +25,7 @@ import org.junit.Assert;
 import org.uddi.api_v3.BusinessDetail;
 import org.uddi.api_v3.BusinessEntity;
 import org.uddi.api_v3.DeleteBusiness;
+import org.uddi.api_v3.Description;
 import org.uddi.api_v3.GetBusinessDetail;
 import org.uddi.api_v3.SaveBusiness;
 import org.uddi.v3_service.UDDIInquiryPortType;
@@ -75,6 +77,10 @@ public class TckBusiness 
 		saveBusiness(authInfoJoe, JOE_BUSINESS_XML, JOE_BUSINESS_KEY);
     }
 	
+	public void updateJoePublisherBusiness(String authInfoJoe) {
+		updateBusiness(authInfoJoe, JOE_BUSINESS_XML, JOE_BUSINESS_KEY);
+    }
+	
 	public void saveJoePublisherBusinesses(String authInfoJoe, int numberOfCopies) {
     	saveBusinesses(authInfoJoe, JOE_BUSINESS_XML, JOE_BUSINESS_KEY, numberOfCopies);
     }
@@ -140,6 +146,47 @@ public class TckBusiness 
 
 	}
 	
+	private void updateBusiness(String authInfo, String businessXML, String businessKey) {
+		try {
+			
+			// Now get the entity and check the values
+			GetBusinessDetail gb = new GetBusinessDetail();
+			gb.getBusinessKey().add(businessKey);
+			BusinessDetail bd = inquiry.getBusinessDetail(gb);
+			List<BusinessEntity> beOutList = bd.getBusinessEntity();
+			BusinessEntity beOut = beOutList.get(0);
+			//We are expecting 2 services
+			assertEquals(2,beOut.getBusinessServices().getBusinessService().size());
+			
+			//Now updating the business by adding another description
+			SaveBusiness sb = new SaveBusiness();
+			sb.setAuthInfo(authInfo);
+			BusinessEntity beIn = beOut;
+			Description desc2= new Description();
+			desc2.setLang("nl");
+			desc2.setValue("Omschrijving");
+			beIn.getDescription().add(desc2);
+			sb.getBusinessEntity().add(beIn);
+			publication.saveBusiness(sb);
+	
+			// Now get the entity and check the values
+			BusinessDetail bdnew = inquiry.getBusinessDetail(gb);
+			List<BusinessEntity> beOutListNew = bdnew.getBusinessEntity();
+			BusinessEntity beOutNew = beOutListNew.get(0);
+
+			assertEquals(beIn.getBusinessKey(), beOutNew.getBusinessKey());
+			// After the update we still are supposed to see two services.
+			assertNotNull(beOutNew.getBusinessServices());
+			assertEquals(2,beOutNew.getBusinessServices().getBusinessService().size());
+			
+			
+		} catch(Throwable e) {
+			logger.error(e.getMessage(),e);
+			Assert.fail("No exception should be thrown");
+		}
+
+	}
+	
 	private void deleteBusinesses(String authInfo, String businessXML, String businessKey, int
numberOfCopies) {
 		try {
 			for (int i=0; i<numberOfCopies; i++) {

Modified: webservices/juddi/trunk/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusinessService.java
URL: http://svn.apache.org/viewvc/webservices/juddi/trunk/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusinessService.java?rev=922009&r1=922008&r2=922009&view=diff
==============================================================================
--- webservices/juddi/trunk/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusinessService.java
(original)
+++ webservices/juddi/trunk/uddi-tck-base/src/main/java/org/apache/juddi/v3/tck/TckBusinessService.java
Thu Mar 11 20:27:22 2010
@@ -40,6 +40,8 @@ public class TckBusinessService 
 
 	final static String JOE_SERVICE_XML              = "uddi_data/joepublisher/businessService.xml";
     final static String JOE_SERVICE_KEY              = "uddi:uddi.joepublisher.com:serviceone";
+    final static String JOE_SERVICE_XML_2              = "uddi_data/joepublisher/businessService2.xml";
+    final static String JOE_SERVICE_KEY_2              = "uddi:uddi.joepublisher.com:servicetwo";
     final static String SAM_SERVICE_XML              = "uddi_data/samsyndicator/businessService.xml";
     final static String SAM_SERVICE_KEY              = "uddi:www.samco.com:listingservice";
    
@@ -57,6 +59,10 @@ public class TckBusinessService 
 	public void saveJoePublisherService(String authInfoJoe) {
 		saveService(authInfoJoe, JOE_SERVICE_XML, JOE_SERVICE_KEY);
 	}
+	
+	public void saveJoePublisherService2(String authInfoJoe) {
+		saveService2(authInfoJoe, JOE_SERVICE_KEY, JOE_SERVICE_XML_2, JOE_SERVICE_KEY_2);
+	}
 
 	public void saveJoePublisherServices(String authInfoJoe, int numberOfCopies) {
 		saveServices(authInfoJoe, JOE_SERVICE_XML, JOE_SERVICE_KEY, numberOfCopies);
@@ -65,6 +71,10 @@ public class TckBusinessService 
 	public void deleteJoePublisherService(String authInfoJoe) {
 		deleteService(authInfoJoe, JOE_SERVICE_KEY);
 	}
+	
+	public void deleteJoePublisherService2(String authInfoJoe) {
+		deleteService(authInfoJoe, JOE_SERVICE_KEY_2);
+	}
 
 	public void saveNotifierService(String authInfoJoe) {
 		saveService(authInfoJoe, NOTIFIER_SERVICE_XML, NOTIFIER_SERVICE_KEY);
@@ -151,6 +161,35 @@ public class TckBusinessService 
 		
 	}
 	
+	private void saveService2(String authInfo, String serviceKey, String serviceXML2,  String
serviceKey2) {
+		try {
+			// First save the entity
+			SaveService ss = new SaveService();
+			ss.setAuthInfo(authInfo);
+			
+			org.uddi.api_v3.BusinessService bsIn = (org.uddi.api_v3.BusinessService)EntityCreator.buildFromDoc(serviceXML2,
"org.uddi.api_v3");
+			ss.getBusinessService().add(bsIn);
+			publication.saveService(ss);
+			
+			// Now get the entity and check the values
+			GetServiceDetail gs = new GetServiceDetail();
+			gs.getServiceKey().add(serviceKey);
+			gs.getServiceKey().add(serviceKey2);
+			ServiceDetail sd = inquiry.getServiceDetail(gs);
+			List<BusinessService> bsOutList = sd.getBusinessService();
+			int size = bsOutList.size();
+
+			assertEquals(2, size);
+			
+			
+		}
+		catch(Exception e) {
+			logger.error(e.getMessage(), e);
+			Assert.fail("No exception should be thrown.");
+		}
+		
+	}
+	
 	private void deleteService(String authInfo, String serviceKey) {
 		try {
 			// Delete the entity and make sure it is removed



---------------------------------------------------------------------
To unsubscribe, e-mail: juddi-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: juddi-cvs-help@ws.apache.org


Mime
View raw message