You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by jf...@apache.org on 2008/09/26 03:50:17 UTC

svn commit: r699151 - in /webservices/juddi/branches/v3_trunk/juddi-core/src: main/java/org/apache/juddi/api/impl/ main/java/org/apache/juddi/mapping/ main/resources/ main/resources/META-INF/ test/java/org/apache/juddi/test/

Author: jfaath
Date: Thu Sep 25 18:50:17 2008
New Revision: 699151

URL: http://svn.apache.org/viewvc?rev=699151&view=rev
Log:
Worked on the mapping from model to API.  Implemented many of the "get" methods of the Inquiry API.  Enhanced the unit testing code.

Added:
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java   (with props)
    webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/UDDIApiTestHelper.java   (with props)
Modified:
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/META-INF/persistence.xml
    webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties
    webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessEntityTest.java
    webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessServiceTest.java

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java?rev=699151&r1=699150&r2=699151&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIInquiryImpl.java Thu Sep 25 18:50:17 2008
@@ -17,8 +17,18 @@
 
 package org.apache.juddi.api.impl;
 
+import java.util.Iterator;
+import java.util.List;
+
 import javax.jws.WebService;
 
+import javax.persistence.EntityTransaction;
+import javax.persistence.EntityManager;
+
+import org.apache.juddi.config.Configuration;
+import org.apache.juddi.error.UDDIErrorHelper;
+import org.apache.juddi.mapping.MappingModelToApi;
+import org.apache.juddi.util.JPAUtil;
 import org.uddi.api_v3.BindingDetail;
 import org.uddi.api_v3.BusinessDetail;
 import org.uddi.api_v3.BusinessList;
@@ -77,14 +87,76 @@
 
 	public BindingDetail getBindingDetail(GetBindingDetail body)
 			throws DispositionReportFaultMessage {
-		// TODO Auto-generated method stub
-		return null;
+
+		org.uddi.api_v3.BindingDetail result = new org.uddi.api_v3.BindingDetail();
+		
+		// TODO: Perform necessary authentication logic
+		String authInfo = body.getAuthInfo();
+
+		EntityManager em = JPAUtil.getEntityManager();
+		EntityTransaction tx = em.getTransaction();
+		tx.begin();
+
+		List<String> bindingKeyList = body.getBindingKey();
+		Iterator<String> bindingKeyListItr = bindingKeyList.iterator();
+		while (bindingKeyListItr.hasNext()) {
+			String bindingKey = bindingKeyListItr.next();
+			
+			
+			org.apache.juddi.model.BindingTemplate modelBindingTemplate = em.find(org.apache.juddi.model.BindingTemplate.class, bindingKey);
+			if (modelBindingTemplate == null) {
+				throw new DispositionReportFaultMessage(Configuration.getGlobalMessage("errors.invalidkey.BindingTemplateNotFound") + ":  " + bindingKey, 
+														UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_KEY_PASSED));
+			}
+			
+			org.uddi.api_v3.BindingTemplate apiBindingTemplate = new org.uddi.api_v3.BindingTemplate();
+			
+			MappingModelToApi.mapBindingTemplate(modelBindingTemplate, apiBindingTemplate);
+			
+			result.getBindingTemplate().add(apiBindingTemplate);
+		}
+
+		tx.commit();
+		em.close();
+		
+		return result;
 	}
 
 	public BusinessDetail getBusinessDetail(GetBusinessDetail body)
 			throws DispositionReportFaultMessage {
-		// TODO Auto-generated method stub
-		return null;
+		
+		org.uddi.api_v3.BusinessDetail result = new org.uddi.api_v3.BusinessDetail();
+		
+		// TODO: Perform necessary authentication logic
+		String authInfo = body.getAuthInfo();
+
+		EntityManager em = JPAUtil.getEntityManager();
+		EntityTransaction tx = em.getTransaction();
+		tx.begin();
+
+		List<String> businessKeyList = body.getBusinessKey();
+		Iterator<String> businessKeyListItr = businessKeyList.iterator();
+		while (businessKeyListItr.hasNext()) {
+			String businessKey = businessKeyListItr.next();
+			
+			
+			org.apache.juddi.model.BusinessEntity modelBusinessEntity = em.find(org.apache.juddi.model.BusinessEntity.class, businessKey);
+			if (modelBusinessEntity == null) {
+				throw new DispositionReportFaultMessage(Configuration.getGlobalMessage("errors.invalidkey.BusinessNotFound") + ":  " + businessKey, 
+														UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_KEY_PASSED));
+			}
+			
+			org.uddi.api_v3.BusinessEntity apiBusinessEntity = new org.uddi.api_v3.BusinessEntity();
+			
+			MappingModelToApi.mapBusinessEntity(modelBusinessEntity, apiBusinessEntity);
+			
+			result.getBusinessEntity().add(apiBusinessEntity);
+		}
+
+		tx.commit();
+		em.close();
+		
+		return result;
 	}
 
 	public OperationalInfos getOperationalInfo(GetOperationalInfo body)
@@ -95,14 +167,76 @@
 
 	public ServiceDetail getServiceDetail(GetServiceDetail body)
 			throws DispositionReportFaultMessage {
-		// TODO Auto-generated method stub
-		return null;
+
+		org.uddi.api_v3.ServiceDetail result = new org.uddi.api_v3.ServiceDetail();
+		
+		// TODO: Perform necessary authentication logic
+		String authInfo = body.getAuthInfo();
+
+		EntityManager em = JPAUtil.getEntityManager();
+		EntityTransaction tx = em.getTransaction();
+		tx.begin();
+
+		List<String> serviceKeyList = body.getServiceKey();
+		Iterator<String> serviceKeyListItr = serviceKeyList.iterator();
+		while (serviceKeyListItr.hasNext()) {
+			String serviceKey = serviceKeyListItr.next();
+			
+			
+			org.apache.juddi.model.BusinessService modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, serviceKey);
+			if (modelBusinessService == null) {
+				throw new DispositionReportFaultMessage(Configuration.getGlobalMessage("errors.invalidkey.ServiceNotFound") + ":  " + serviceKey, 
+														UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_KEY_PASSED));
+			}
+			
+			org.uddi.api_v3.BusinessService apiBusinessService = new org.uddi.api_v3.BusinessService();
+			
+			MappingModelToApi.mapBusinessService(modelBusinessService, apiBusinessService);
+			
+			result.getBusinessService().add(apiBusinessService);
+		}
+
+		tx.commit();
+		em.close();
+		
+		return result;
 	}
 
 	public TModelDetail getTModelDetail(GetTModelDetail body)
 			throws DispositionReportFaultMessage {
-		// TODO Auto-generated method stub
-		return null;
+
+		org.uddi.api_v3.TModelDetail result = new org.uddi.api_v3.TModelDetail();
+		
+		// TODO: Perform necessary authentication logic
+		String authInfo = body.getAuthInfo();
+
+		EntityManager em = JPAUtil.getEntityManager();
+		EntityTransaction tx = em.getTransaction();
+		tx.begin();
+
+		List<String> tmodelKeyList = body.getTModelKey();
+		Iterator<String> tmodelKeyListItr = tmodelKeyList.iterator();
+		while (tmodelKeyListItr.hasNext()) {
+			String tmodelKey = tmodelKeyListItr.next();
+			
+			
+			org.apache.juddi.model.Tmodel modelTModel = em.find(org.apache.juddi.model.Tmodel.class, tmodelKey);
+			if (modelTModel == null) {
+				throw new DispositionReportFaultMessage(Configuration.getGlobalMessage("errors.invalidkey.TModelNotFound") + ":  " + tmodelKey, 
+														UDDIErrorHelper.buildDispositionReport(UDDIErrorHelper.E_INVALID_KEY_PASSED));
+			}
+			
+			org.uddi.api_v3.TModel apiTModel = new org.uddi.api_v3.TModel();
+			
+			MappingModelToApi.mapTModel(modelTModel, apiTModel);
+			
+			result.getTModel().add(apiTModel);
+		}
+
+		tx.commit();
+		em.close();
+		
+		return result;
 	}
 
 }

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java?rev=699151&r1=699150&r2=699151&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingApiToModel.java Thu Sep 25 18:50:17 2008
@@ -117,7 +117,7 @@
 			while (apiContactListItr.hasNext()) {
 				org.uddi.api_v3.Contact apiContact = apiContactListItr.next();
 				
-				// The model only supports one personName per contact and it is just a string value (no language code).
+				// TODO: The model only supports one personName per contact and it is just a string value (no language code).
 				List<org.uddi.api_v3.PersonName> apiNameList = apiContact.getPersonName();
 				String personName = null;
 				if (apiNameList != null && apiNameList.size() > 0)
@@ -370,10 +370,10 @@
 	}
 
 	public static void mapBindingTemplates(org.uddi.api_v3.BindingTemplates apiBindingTemplates, 
-										   Set<org.apache.juddi.model.BindingTemplate> modelBusinessTemplateList,
+										   Set<org.apache.juddi.model.BindingTemplate> modelBindingTemplateList,
 										   org.apache.juddi.model.BusinessService modelBusinessService) 
 				   throws DispositionReportFaultMessage {
-		modelBusinessTemplateList.clear();
+		modelBindingTemplateList.clear();
 
 		if (apiBindingTemplates != null) {
 			List<org.uddi.api_v3.BindingTemplate> apiBindingTemplateList = apiBindingTemplates.getBindingTemplate();
@@ -384,7 +384,7 @@
 
 				mapBindingTemplate(apiBindingTemplate, modelBindingTemplate, modelBusinessService);
 
-				modelBusinessTemplateList.add(modelBindingTemplate);
+				modelBindingTemplateList.add(modelBindingTemplate);
 			}
 		}
 	}
@@ -496,11 +496,11 @@
 
 		if (apiInstanceDetails != null) {
 			List<JAXBElement<?>> apiInstanceDetailsContent = apiInstanceDetails.getContent();
-			Iterator<JAXBElement<?>> aapiInstanceDetailsContentItr = apiInstanceDetailsContent.iterator();
+			Iterator<JAXBElement<?>> apiInstanceDetailsContentItr = apiInstanceDetailsContent.iterator();
 			int docId = 0;
 			int descId = 0;
-			while (aapiInstanceDetailsContentItr.hasNext()) {
-				JAXBElement<?> elem = aapiInstanceDetailsContentItr.next();
+			while (apiInstanceDetailsContentItr.hasNext()) {
+				JAXBElement<?> elem = apiInstanceDetailsContentItr.next();
 				
 				if (elem.getValue() instanceof org.uddi.api_v3.OverviewDoc) {
 					org.uddi.api_v3.OverviewDoc apiOverviewDoc = (org.uddi.api_v3.OverviewDoc)elem.getValue();
@@ -534,7 +534,7 @@
 		mapTModelDescriptions(apiTModel.getDescription(), modelTModel.getTmodelDescrs(), modelTModel);
 		mapTModelIdentifiers(apiTModel.getIdentifierBag(), modelTModel.getTmodelIdentifiers(), modelTModel);
 		mapTModelCategories(apiTModel.getCategoryBag(), modelTModel.getTmodelCategories(), modelTModel);
-		//TODO: OverviewDoc - requires handling the JAXBElement catch-all issue, also, model doesn't have logical mapping
+		//TODO: OverviewDoc - model doesn't have logical mapping
 
 	}
 

Added: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java?rev=699151&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java Thu Sep 25 18:50:17 2008
@@ -0,0 +1,601 @@
+/*
+ * Copyright 2001-2008 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.juddi.mapping;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.bind.JAXBElement;
+import org.uddi.api_v3.ObjectFactory;
+
+import org.uddi.v3_service.DispositionReportFaultMessage;
+
+/**
+ * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
+ */
+public class MappingModelToApi {
+	
+	public static void mapBusinessEntity(org.apache.juddi.model.BusinessEntity modelBusinessEntity, 
+										 org.uddi.api_v3.BusinessEntity apiBusinessEntity) 
+			throws DispositionReportFaultMessage {
+
+		apiBusinessEntity.setBusinessKey(modelBusinessEntity.getBusinessKey());
+		
+		mapBusinessNames(modelBusinessEntity.getBusinessNames(), apiBusinessEntity.getName());
+		mapBusinessDescriptions(modelBusinessEntity.getBusinessDescrs(), apiBusinessEntity.getDescription());
+
+		mapDiscoveryUrls(modelBusinessEntity.getDiscoveryUrls(), apiBusinessEntity.getDiscoveryURLs(), apiBusinessEntity);
+		mapContacts(modelBusinessEntity.getContacts(), apiBusinessEntity.getContacts(), apiBusinessEntity);
+		mapBusinessIdentifiers(modelBusinessEntity.getBusinessIdentifiers(), apiBusinessEntity.getIdentifierBag(), apiBusinessEntity);
+		mapBusinessCategories(modelBusinessEntity.getBusinessCategories(), apiBusinessEntity.getCategoryBag(), apiBusinessEntity);
+		
+		mapBusinessServices(modelBusinessEntity.getBusinessServices(), apiBusinessEntity.getBusinessServices(), apiBusinessEntity);
+	
+	}
+
+	public static void mapBusinessNames(Set<org.apache.juddi.model.BusinessName> modelNameList, 
+										List<org.uddi.api_v3.Name> apiNameList) 
+				   throws DispositionReportFaultMessage {
+		apiNameList.clear();
+
+		Iterator<org.apache.juddi.model.BusinessName> modelNameListItr = modelNameList.iterator();
+		while (modelNameListItr.hasNext()) {
+			org.apache.juddi.model.BusinessName modelName = modelNameListItr.next();
+
+			org.uddi.api_v3.Name apiName = new org.uddi.api_v3.Name();
+			apiName.setLang(modelName.getLangCode());
+			apiName.setValue(modelName.getName());
+			apiNameList.add(apiName);
+		}
+	}
+
+	public static void mapBusinessDescriptions(Set<org.apache.juddi.model.BusinessDescr> modelDescList, 
+											   List<org.uddi.api_v3.Description> apiDescList) 
+				   throws DispositionReportFaultMessage {
+		apiDescList.clear();
+
+		Iterator<org.apache.juddi.model.BusinessDescr> modelDescListItr = modelDescList.iterator();
+		while (modelDescListItr.hasNext()) {
+			org.apache.juddi.model.BusinessDescr modelDesc = modelDescListItr.next();
+
+			org.uddi.api_v3.Description apiDesc = new org.uddi.api_v3.Description();
+			apiDesc.setLang(modelDesc.getLangCode());
+			apiDesc.setValue(modelDesc.getDescr());
+			apiDescList.add(apiDesc);
+		}
+	}
+
+	public static void mapDiscoveryUrls(Set<org.apache.juddi.model.DiscoveryUrl> modelDiscUrlList, 
+										org.uddi.api_v3.DiscoveryURLs apiDiscUrls,
+										org.uddi.api_v3.BusinessEntity apiBusinessEntity) 
+				   throws DispositionReportFaultMessage {
+		if (apiDiscUrls == null)
+			apiDiscUrls = new org.uddi.api_v3.DiscoveryURLs();
+
+		List<org.uddi.api_v3.DiscoveryURL> apiDiscUrlList = apiDiscUrls.getDiscoveryURL();
+		apiDiscUrlList.clear();
+		
+		Iterator<org.apache.juddi.model.DiscoveryUrl> modelDiscUrlListItr = modelDiscUrlList.iterator();
+		while (modelDiscUrlListItr.hasNext()) {
+			org.apache.juddi.model.DiscoveryUrl modelDiscUrl = modelDiscUrlListItr.next();
+
+			org.uddi.api_v3.DiscoveryURL apiDiscUrl = new org.uddi.api_v3.DiscoveryURL();
+			apiDiscUrl.setUseType(modelDiscUrl.getUseType());
+			apiDiscUrl.setValue(modelDiscUrl.getUrl());
+			apiDiscUrlList.add(apiDiscUrl);
+		}
+		apiBusinessEntity.setDiscoveryURLs(apiDiscUrls);
+	}
+	
+	public static void mapContacts(Set<org.apache.juddi.model.Contact> modelContactList, 
+								   org.uddi.api_v3.Contacts apiContacts,
+								   org.uddi.api_v3.BusinessEntity apiBusinessEntity) 
+				   throws DispositionReportFaultMessage {
+		if (apiContacts == null)
+			apiContacts = new org.uddi.api_v3.Contacts();
+
+		List<org.uddi.api_v3.Contact> apiContactList = apiContacts.getContact();
+		apiContactList.clear();
+
+		Iterator<org.apache.juddi.model.Contact> modelContactListItr = modelContactList.iterator();
+		while (modelContactListItr.hasNext()) {
+			org.apache.juddi.model.Contact modelContact = modelContactListItr.next();
+
+			org.uddi.api_v3.Contact apiContact = new org.uddi.api_v3.Contact();
+			apiContact.setUseType(modelContact.getUseType());
+			// TODO: The model only supports one person name, needs to support collection.
+			org.uddi.api_v3.PersonName apiPersonName = new org.uddi.api_v3.PersonName();
+			apiPersonName.setValue(modelContact.getPersonName());
+			apiContact.getPersonName().add(apiPersonName);
+			
+			mapContactDescriptions(modelContact.getContactDescrs(), apiContact.getDescription());
+			mapContactEmails(modelContact.getEmails(), apiContact.getEmail());
+			mapContactPhones(modelContact.getPhones(), apiContact.getPhone());
+			mapContactAddresses(modelContact.getAddresses(), apiContact.getAddress());
+			
+			apiContactList.add(apiContact);
+		}
+		apiBusinessEntity.setContacts(apiContacts);
+	}
+
+	public static void mapContactDescriptions(Set<org.apache.juddi.model.ContactDescr> modelDescList, 
+											  List<org.uddi.api_v3.Description> apiDescList) 
+	throws DispositionReportFaultMessage {
+		apiDescList.clear();
+
+		Iterator<org.apache.juddi.model.ContactDescr> modelDescListItr = modelDescList.iterator();
+		while (modelDescListItr.hasNext()) {
+			org.apache.juddi.model.ContactDescr modelDesc = modelDescListItr.next();
+
+			org.uddi.api_v3.Description apiDesc = new org.uddi.api_v3.Description();
+			apiDesc.setLang(modelDesc.getLangCode());
+			apiDesc.setValue(modelDesc.getDescr());
+			apiDescList.add(apiDesc);
+		}
+	}
+
+	public static void mapContactEmails(Set<org.apache.juddi.model.Email> modelEmailList, 
+										List<org.uddi.api_v3.Email> apiEmailList) 
+				   throws DispositionReportFaultMessage {
+		apiEmailList.clear();
+
+		Iterator<org.apache.juddi.model.Email> modelEmailListItr = modelEmailList.iterator();
+		while (modelEmailListItr.hasNext()) {
+			org.apache.juddi.model.Email modelEmail = modelEmailListItr.next();
+			
+			org.uddi.api_v3.Email apiEmail = new org.uddi.api_v3.Email();
+			apiEmail.setUseType(modelEmail.getUseType());
+			apiEmail.setValue(modelEmail.getEmailAddress());
+			apiEmailList.add(apiEmail);
+		}
+	}
+	
+	public static void mapContactPhones(Set<org.apache.juddi.model.Phone> modelPhoneList, 
+										List<org.uddi.api_v3.Phone> apiPhoneList) 
+				   throws DispositionReportFaultMessage {
+		apiPhoneList.clear();
+
+		Iterator<org.apache.juddi.model.Phone> modelPhoneListItr = modelPhoneList.iterator();
+		while (modelPhoneListItr.hasNext()) {
+			org.apache.juddi.model.Phone modelPhone = modelPhoneListItr.next();
+
+			org.uddi.api_v3.Phone apiPhone = new org.uddi.api_v3.Phone();
+			apiPhone.setUseType(modelPhone.getUseType());
+			apiPhone.setValue(modelPhone.getPhoneNumber());
+			apiPhoneList.add(apiPhone);
+		}
+	}
+
+	public static void mapContactAddresses(Set<org.apache.juddi.model.Address> modelAddressList, 
+										   List<org.uddi.api_v3.Address> apiAddressList) 
+				   throws DispositionReportFaultMessage {
+		apiAddressList.clear();
+
+		Iterator<org.apache.juddi.model.Address> modelAddressListItr = modelAddressList.iterator();
+		while (modelAddressListItr.hasNext()) {
+			org.apache.juddi.model.Address modelAddress = modelAddressListItr.next();
+
+			org.uddi.api_v3.Address apiAddress = new org.uddi.api_v3.Address();
+			apiAddress.setUseType(modelAddress.getUseType());
+			apiAddress.setLang("");
+			apiAddress.setSortCode(modelAddress.getSortCode());
+			apiAddress.setTModelKey(modelAddress.getTmodelKey());
+			
+			mapAddressLines(modelAddress.getAddressLines(), apiAddress.getAddressLine());
+			
+			apiAddressList.add(apiAddress);
+		}
+	}
+
+	public static void mapAddressLines(Set<org.apache.juddi.model.AddressLine> modelAddressLineList, 
+									   List<org.uddi.api_v3.AddressLine> apiAddressLineList) 
+				   throws DispositionReportFaultMessage {
+		apiAddressLineList.clear();
+
+		Iterator<org.apache.juddi.model.AddressLine> modelAddressLineListItr = modelAddressLineList.iterator();
+		while (modelAddressLineListItr.hasNext()) {
+			org.apache.juddi.model.AddressLine modelAddressLine = modelAddressLineListItr.next();
+
+			org.uddi.api_v3.AddressLine apiAddressLine = new org.uddi.api_v3.AddressLine();
+			apiAddressLine.setKeyName(modelAddressLine.getKeyName());
+			apiAddressLine.setKeyName(modelAddressLine.getKeyValue());
+			apiAddressLine.setValue(modelAddressLine.getLine());
+			apiAddressLineList.add(apiAddressLine);
+		}
+	}
+
+	public static void mapBusinessIdentifiers(Set<org.apache.juddi.model.BusinessIdentifier> modelIdentifierList, 
+											  org.uddi.api_v3.IdentifierBag apiIdentifierBag,
+											  org.uddi.api_v3.BusinessEntity apiBusinessEntity) 
+				   throws DispositionReportFaultMessage {
+		if (apiIdentifierBag == null)
+			apiIdentifierBag = new org.uddi.api_v3.IdentifierBag();
+
+		List<org.uddi.api_v3.KeyedReference> apiKeyedRefList = apiIdentifierBag.getKeyedReference();
+		apiKeyedRefList.clear();
+
+		Iterator<org.apache.juddi.model.BusinessIdentifier> modelIdentifierListItr = modelIdentifierList.iterator();
+		while (modelIdentifierListItr.hasNext()) {
+			org.apache.juddi.model.BusinessIdentifier modelIdentifier = modelIdentifierListItr.next();
+
+			org.uddi.api_v3.KeyedReference apiKeyedRef = new org.uddi.api_v3.KeyedReference();
+			apiKeyedRef.setTModelKey(modelIdentifier.getTmodelKeyRef());
+			apiKeyedRef.setKeyName(modelIdentifier.getKeyName());
+			apiKeyedRef.setKeyValue(modelIdentifier.getKeyValue());
+			apiKeyedRefList.add(apiKeyedRef);
+		}
+		apiBusinessEntity.setIdentifierBag(apiIdentifierBag);
+	}
+	
+	public static void mapBusinessCategories(Set<org.apache.juddi.model.BusinessCategory> modelCategoryList, 
+											 org.uddi.api_v3.CategoryBag apiCategoryBag,
+											 org.uddi.api_v3.BusinessEntity apiBusinessEntity) 
+				   throws DispositionReportFaultMessage {
+		if (apiCategoryBag == null)
+			apiCategoryBag = new org.uddi.api_v3.CategoryBag();
+
+		List<JAXBElement<?>> apiCategoryList = apiCategoryBag.getContent();
+		apiCategoryList.clear();
+
+		Iterator<org.apache.juddi.model.BusinessCategory> modelCategoryListItr = modelCategoryList.iterator();
+		while (modelCategoryListItr.hasNext()) {
+			// TODO:  Currently, the model doesn't allow for the persistence of keyedReference groups.  This must be incorporated into the model.  For now
+			// the KeyedReferenceGroups are ignored.
+			org.apache.juddi.model.BusinessCategory modelCategory = modelCategoryListItr.next();
+
+			org.uddi.api_v3.KeyedReference apiKeyedRef = new org.uddi.api_v3.KeyedReference();
+			apiKeyedRef.setTModelKey(modelCategory.getTmodelKeyRef());
+			apiKeyedRef.setKeyName(modelCategory.getKeyName());
+			apiKeyedRef.setKeyValue(modelCategory.getKeyValue());
+			apiCategoryList.add(new ObjectFactory().createKeyedReference(apiKeyedRef));
+		}
+		apiBusinessEntity.setCategoryBag(apiCategoryBag);
+	}
+
+	public static void mapBusinessServices(Set<org.apache.juddi.model.BusinessService> modelBusinessServiceList, 
+										   org.uddi.api_v3.BusinessServices apiBusinessServices,
+										   org.uddi.api_v3.BusinessEntity apiBusinessEntity) 
+				   throws DispositionReportFaultMessage {
+
+		if (apiBusinessServices == null)
+			apiBusinessServices = new org.uddi.api_v3.BusinessServices();
+
+		List<org.uddi.api_v3.BusinessService> apiBusinessServiceList = apiBusinessServices.getBusinessService();
+		apiBusinessServiceList.clear();
+		
+		Iterator<org.apache.juddi.model.BusinessService> modelBusinessServiceListItr = modelBusinessServiceList.iterator();
+		while (modelBusinessServiceListItr.hasNext()) {
+			org.apache.juddi.model.BusinessService modelBusinessService = modelBusinessServiceListItr.next();
+
+			org.uddi.api_v3.BusinessService apiBusinessService = new org.uddi.api_v3.BusinessService();
+			mapBusinessService(modelBusinessService, apiBusinessService);
+			apiBusinessServiceList.add(apiBusinessService);
+		}
+		apiBusinessEntity.setBusinessServices(apiBusinessServices);
+	}
+
+	public static void mapBusinessService(org.apache.juddi.model.BusinessService modelBusinessService, 
+										  org.uddi.api_v3.BusinessService apiBusinessService) 
+				   throws DispositionReportFaultMessage {
+
+		apiBusinessService.setBusinessKey(modelBusinessService.getBusinessEntity().getBusinessKey());
+		apiBusinessService.setServiceKey(modelBusinessService.getServiceKey());
+
+		mapServiceNames(modelBusinessService.getServiceNames(), apiBusinessService.getName());
+		mapServiceDescriptions(modelBusinessService.getServiceDescrs(), apiBusinessService.getDescription());
+
+		mapServiceCategories(modelBusinessService.getServiceCategories(), apiBusinessService.getCategoryBag(), apiBusinessService);
+
+	}
+
+	public static void mapServiceNames(Set<org.apache.juddi.model.ServiceName> modelNameList, 
+									   List<org.uddi.api_v3.Name> apiNameList) 
+				   throws DispositionReportFaultMessage {
+		apiNameList.clear();
+
+		Iterator<org.apache.juddi.model.ServiceName> modelNameListItr = modelNameList.iterator();
+		while (modelNameListItr.hasNext()) {
+			org.apache.juddi.model.ServiceName modelName = modelNameListItr.next();
+
+			org.uddi.api_v3.Name apiName = new org.uddi.api_v3.Name();
+			apiName.setLang(modelName.getLangCode());
+			apiName.setValue(modelName.getName());
+			apiNameList.add(apiName);
+		}
+	}
+
+	public static void mapServiceDescriptions(Set<org.apache.juddi.model.ServiceDescr> modelDescList, 
+											  List<org.uddi.api_v3.Description> apiDescList) 
+				   throws DispositionReportFaultMessage {
+		apiDescList.clear();
+
+		Iterator<org.apache.juddi.model.ServiceDescr> modelDescListItr = modelDescList.iterator();
+		while (modelDescListItr.hasNext()) {
+			org.apache.juddi.model.ServiceDescr modelDesc = modelDescListItr.next();
+
+			org.uddi.api_v3.Description apiDesc = new org.uddi.api_v3.Description();
+			apiDesc.setLang(modelDesc.getLangCode());
+			apiDesc.setValue(modelDesc.getDescr());
+			apiDescList.add(apiDesc);
+		}
+	}
+	
+	public static void mapServiceCategories(Set<org.apache.juddi.model.ServiceCategory> modelCategoryList, 
+											org.uddi.api_v3.CategoryBag apiCategoryBag,
+											org.uddi.api_v3.BusinessService apiBusinessService) 
+				   throws DispositionReportFaultMessage {
+		if (apiCategoryBag == null)
+			apiCategoryBag = new org.uddi.api_v3.CategoryBag();
+
+		List<JAXBElement<?>> apiCategoryList = apiCategoryBag.getContent();
+		apiCategoryList.clear();
+
+		Iterator<org.apache.juddi.model.ServiceCategory> modelCategoryListItr = modelCategoryList.iterator();
+		while (modelCategoryListItr.hasNext()) {
+			// TODO:  Currently, the model doesn't allow for the persistence of keyedReference groups.  This must be incorporated into the model.  For now
+			// the KeyedReferenceGroups are ignored.
+			org.apache.juddi.model.ServiceCategory modelCategory = modelCategoryListItr.next();
+
+			org.uddi.api_v3.KeyedReference apiKeyedRef = new org.uddi.api_v3.KeyedReference();
+			apiKeyedRef.setTModelKey(modelCategory.getTmodelKeyRef());
+			apiKeyedRef.setKeyName(modelCategory.getKeyName());
+			apiKeyedRef.setKeyValue(modelCategory.getKeyValue());
+			apiCategoryList.add(new ObjectFactory().createKeyedReference(apiKeyedRef));
+		}
+		apiBusinessService.setCategoryBag(apiCategoryBag);
+	}
+
+	public static void mapBindingTemplates(Set<org.apache.juddi.model.BindingTemplate> modelBindingTemplateList, 
+										   org.uddi.api_v3.BindingTemplates apiBindingTemplates,
+										   org.uddi.api_v3.BusinessService apiBusinessService) 
+				   throws DispositionReportFaultMessage {
+
+		if (apiBindingTemplates == null)
+			apiBindingTemplates = new org.uddi.api_v3.BindingTemplates();
+
+		List<org.uddi.api_v3.BindingTemplate> apiBindingTemplateList = apiBindingTemplates.getBindingTemplate();
+		apiBindingTemplateList.clear();
+
+		Iterator<org.apache.juddi.model.BindingTemplate> modelBindingTemplateListItr = modelBindingTemplateList.iterator();
+		while (modelBindingTemplateListItr.hasNext()) {
+			org.apache.juddi.model.BindingTemplate modelBindingTemplate = modelBindingTemplateListItr.next();
+
+			org.uddi.api_v3.BindingTemplate apiBindingTemplate = new org.uddi.api_v3.BindingTemplate();
+			mapBindingTemplate(modelBindingTemplate, apiBindingTemplate);
+			apiBindingTemplateList.add(apiBindingTemplate);
+		}
+		apiBusinessService.setBindingTemplates(apiBindingTemplates);
+	}
+
+	public static void mapBindingTemplate(org.apache.juddi.model.BindingTemplate modelBindingTemplate, 
+										  org.uddi.api_v3.BindingTemplate apiBindingTemplate) 
+				   throws DispositionReportFaultMessage {
+
+		apiBindingTemplate.setServiceKey(modelBindingTemplate.getBusinessService().getServiceKey());
+		apiBindingTemplate.setBindingKey(modelBindingTemplate.getBindingKey());
+		org.uddi.api_v3.AccessPoint apiAccessPoint = new org.uddi.api_v3.AccessPoint();
+		apiAccessPoint.setUseType(modelBindingTemplate.getAccessPointType());
+		apiAccessPoint.setValue(modelBindingTemplate.getAccessPointUrl());
+		apiBindingTemplate.setAccessPoint(apiAccessPoint);
+		org.uddi.api_v3.HostingRedirector apiHost = new org.uddi.api_v3.HostingRedirector();
+		apiHost.setBindingKey(modelBindingTemplate.getHostingRedirector());
+		apiBindingTemplate.setHostingRedirector(apiHost);
+
+		mapBindingDescriptions(modelBindingTemplate.getBindingDescrs(), apiBindingTemplate.getDescription());
+
+		mapBindingCategories(modelBindingTemplate.getBindingCategories(), apiBindingTemplate.getCategoryBag(), apiBindingTemplate);
+
+	}
+
+	public static void mapBindingDescriptions(Set<org.apache.juddi.model.BindingDescr> modelDescList, 
+											  List<org.uddi.api_v3.Description> apiDescList) 
+				   throws DispositionReportFaultMessage {
+		apiDescList.clear();
+
+		Iterator<org.apache.juddi.model.BindingDescr> modelDescListItr = modelDescList.iterator();
+		while (modelDescListItr.hasNext()) {
+			org.apache.juddi.model.BindingDescr modelDesc = modelDescListItr.next();
+
+			org.uddi.api_v3.Description apiDesc = new org.uddi.api_v3.Description();
+			apiDesc.setLang(modelDesc.getLangCode());
+			apiDesc.setValue(modelDesc.getDescr());
+			apiDescList.add(apiDesc);
+		}
+	}
+
+	public static void mapBindingCategories(Set<org.apache.juddi.model.BindingCategory> modelCategoryList, 
+											org.uddi.api_v3.CategoryBag apiCategoryBag,
+											org.uddi.api_v3.BindingTemplate apiBindingTemplate) 
+				   throws DispositionReportFaultMessage {
+		if (apiCategoryBag == null)
+			apiCategoryBag = new org.uddi.api_v3.CategoryBag();
+
+		List<JAXBElement<?>> apiCategoryList = apiCategoryBag.getContent();
+		apiCategoryList.clear();
+
+		Iterator<org.apache.juddi.model.BindingCategory> modelCategoryListItr = modelCategoryList.iterator();
+		while (modelCategoryListItr.hasNext()) {
+			// TODO:  Currently, the model doesn't allow for the persistence of keyedReference groups.  This must be incorporated into the model.  For now
+			// the KeyedReferenceGroups are ignored.
+			org.apache.juddi.model.BindingCategory modelCategory = modelCategoryListItr.next();
+
+			org.uddi.api_v3.KeyedReference apiKeyedRef = new org.uddi.api_v3.KeyedReference();
+			apiKeyedRef.setTModelKey(modelCategory.getTmodelKeyRef());
+			apiKeyedRef.setKeyName(modelCategory.getKeyName());
+			apiKeyedRef.setKeyValue(modelCategory.getKeyValue());
+			apiCategoryList.add(new ObjectFactory().createKeyedReference(apiKeyedRef));
+		}
+		apiBindingTemplate.setCategoryBag(apiCategoryBag);
+	}
+
+	public static void mapTModelInstanceDetails(Set<org.apache.juddi.model.TmodelInstanceInfo> modelTModelInstInfoList, 
+												org.uddi.api_v3.TModelInstanceDetails apiTModelInstDetails,
+												org.uddi.api_v3.BindingTemplate apiBindingTemplate) 
+				   throws DispositionReportFaultMessage {
+		if (apiTModelInstDetails == null)
+			apiTModelInstDetails = new org.uddi.api_v3.TModelInstanceDetails();
+
+		List<org.uddi.api_v3.TModelInstanceInfo> apiTModelInstInfoList = apiTModelInstDetails.getTModelInstanceInfo();
+		apiTModelInstInfoList.clear();
+
+		Iterator<org.apache.juddi.model.TmodelInstanceInfo> modelTModelInstInfoListItr = modelTModelInstInfoList.iterator();
+		while (modelTModelInstInfoListItr.hasNext()) {
+			org.apache.juddi.model.TmodelInstanceInfo modelTModelInstInfo = modelTModelInstInfoListItr.next();
+
+			org.uddi.api_v3.TModelInstanceInfo apiTModelInstInfo = new org.uddi.api_v3.TModelInstanceInfo();
+			apiTModelInstInfo.setTModelKey(modelTModelInstInfo.getTmodelKey());
+			mapTModelInstanceInfoDescriptions(modelTModelInstInfo.getTmodelInstanceInfoDescrs(), apiTModelInstInfo.getDescription());
+			mapInstanceDetails(modelTModelInstInfo, apiTModelInstInfo.getInstanceDetails(), apiTModelInstInfo);
+
+			apiTModelInstInfoList.add(apiTModelInstInfo);
+		}
+		apiBindingTemplate.setTModelInstanceDetails(apiTModelInstDetails);
+	}
+	
+	public static void mapTModelInstanceInfoDescriptions(Set<org.apache.juddi.model.TmodelInstanceInfoDescr> modelDescList, 
+														 List<org.uddi.api_v3.Description> apiDescList) 
+				   throws DispositionReportFaultMessage {
+		apiDescList.clear();
+
+		Iterator<org.apache.juddi.model.TmodelInstanceInfoDescr> modelDescListItr = modelDescList.iterator();
+		while (modelDescListItr.hasNext()) {
+			org.apache.juddi.model.TmodelInstanceInfoDescr modelDesc = modelDescListItr.next();
+
+			org.uddi.api_v3.Description apiDesc = new org.uddi.api_v3.Description();
+			apiDesc.setLang(modelDesc.getLangCode());
+			apiDesc.setValue(modelDesc.getDescr());
+			apiDescList.add(apiDesc);
+		}
+	}
+
+	public static void mapInstanceDetails(org.apache.juddi.model.TmodelInstanceInfo modelTModelInstInfo, 
+										  org.uddi.api_v3.InstanceDetails apiInstanceDetails,
+										  org.uddi.api_v3.TModelInstanceInfo apiTModelInstInfo) 
+				   throws DispositionReportFaultMessage {
+		if (apiInstanceDetails == null)
+			apiInstanceDetails = new org.uddi.api_v3.InstanceDetails();
+
+		List<JAXBElement<?>> apiInstanceDetailsContent = apiInstanceDetails.getContent();
+		apiInstanceDetailsContent.clear();
+
+		apiInstanceDetailsContent.add(new ObjectFactory().createInstanceParms(modelTModelInstInfo.getInstanceParms()));
+		
+		Set<org.apache.juddi.model.InstanceDetailsDescr> modelInstDetailsDescrList = modelTModelInstInfo.getInstanceDetailsDescrs();
+		Iterator<org.apache.juddi.model.InstanceDetailsDescr> modelInstDetailsDescrListItr = modelInstDetailsDescrList.iterator();
+		while (modelInstDetailsDescrListItr.hasNext()) {
+			org.apache.juddi.model.InstanceDetailsDescr modelInstDetailDescr = modelInstDetailsDescrListItr.next();
+			
+			org.uddi.api_v3.Description apiDesc = new org.uddi.api_v3.Description();
+			apiDesc.setLang(modelInstDetailDescr.getLangCode());
+			apiDesc.setValue(modelInstDetailDescr.getDescr());
+			apiInstanceDetailsContent.add(new ObjectFactory().createDescription(apiDesc));
+			
+		}
+		
+		// TODO: OverviewDoc is not mapped properly in the model.
+		apiInstanceDetailsContent.add(new ObjectFactory().createOverviewDoc(null));
+		
+		apiTModelInstInfo.setInstanceDetails(apiInstanceDetails);
+	}
+	
+	public static void mapTModel(org.apache.juddi.model.Tmodel modelTModel, 
+								 org.uddi.api_v3.TModel apiTModel) 
+				   throws DispositionReportFaultMessage {
+
+		apiTModel.setTModelKey(modelTModel.getTmodelKey());
+		org.uddi.api_v3.Name apiName = new org.uddi.api_v3.Name();
+		apiName.setValue(modelTModel.getName());
+		apiTModel.setName(apiName);
+		apiTModel.setDeleted(modelTModel.isDeleted());
+		
+		mapTModelDescriptions(modelTModel.getTmodelDescrs(), apiTModel.getDescription());
+
+		mapTModelIdentifiers(modelTModel.getTmodelIdentifiers(), apiTModel.getIdentifierBag(), apiTModel);
+		mapTModelCategories(modelTModel.getTmodelCategories(), apiTModel.getCategoryBag(), apiTModel);
+		//TODO: OverviewDoc - model doesn't have logical mapping
+		apiTModel.getOverviewDoc();
+
+	}
+
+	public static void mapTModelDescriptions(Set<org.apache.juddi.model.TmodelDescr> modelDescList, 
+											 List<org.uddi.api_v3.Description> apiDescList) 
+			    throws DispositionReportFaultMessage {
+		apiDescList.clear();
+
+		Iterator<org.apache.juddi.model.TmodelDescr> modelDescListItr = modelDescList.iterator();
+		while (modelDescListItr.hasNext()) {
+			org.apache.juddi.model.TmodelDescr modelDesc = modelDescListItr.next();
+
+			org.uddi.api_v3.Description apiDesc = new org.uddi.api_v3.Description();
+			apiDesc.setLang(modelDesc.getLangCode());
+			apiDesc.setValue(modelDesc.getDescr());
+			apiDescList.add(apiDesc);
+		}
+	}
+
+	public static void mapTModelIdentifiers(Set<org.apache.juddi.model.TmodelIdentifier> modelIdentifierList, 
+											org.uddi.api_v3.IdentifierBag apiIdentifierBag,
+											org.uddi.api_v3.TModel apiTModel) 
+				   throws DispositionReportFaultMessage {
+		if (apiIdentifierBag == null)
+			apiIdentifierBag = new org.uddi.api_v3.IdentifierBag();
+
+		List<org.uddi.api_v3.KeyedReference> apiKeyedRefList = apiIdentifierBag.getKeyedReference();
+		apiKeyedRefList.clear();
+
+		Iterator<org.apache.juddi.model.TmodelIdentifier> modelIdentifierListItr = modelIdentifierList.iterator();
+		while (modelIdentifierListItr.hasNext()) {
+			org.apache.juddi.model.TmodelIdentifier modelIdentifier = modelIdentifierListItr.next();
+
+			org.uddi.api_v3.KeyedReference apiKeyedRef = new org.uddi.api_v3.KeyedReference();
+			apiKeyedRef.setTModelKey(modelIdentifier.getTmodelKeyRef());
+			apiKeyedRef.setKeyName(modelIdentifier.getKeyName());
+			apiKeyedRef.setKeyValue(modelIdentifier.getKeyValue());
+			apiKeyedRefList.add(apiKeyedRef);
+		}
+		apiTModel.setIdentifierBag(apiIdentifierBag);
+	}
+	
+	public static void mapTModelCategories(Set<org.apache.juddi.model.TmodelCategory> modelCategoryList, 
+										   org.uddi.api_v3.CategoryBag apiCategoryBag,
+										   org.uddi.api_v3.TModel apiTModel) 
+				   throws DispositionReportFaultMessage {
+		if (apiCategoryBag == null)
+			apiCategoryBag = new org.uddi.api_v3.CategoryBag();
+
+		List<JAXBElement<?>> apiCategoryList = apiCategoryBag.getContent();
+		apiCategoryList.clear();
+
+		Iterator<org.apache.juddi.model.TmodelCategory> modelCategoryListItr = modelCategoryList.iterator();
+		while (modelCategoryListItr.hasNext()) {
+			// TODO:  Currently, the model doesn't allow for the persistence of keyedReference groups.  This must be incorporated into the model.  For now
+			// the KeyedReferenceGroups are ignored.
+			org.apache.juddi.model.TmodelCategory modelCategory = modelCategoryListItr.next();
+
+			org.uddi.api_v3.KeyedReference apiKeyedRef = new org.uddi.api_v3.KeyedReference();
+			apiKeyedRef.setTModelKey(modelCategory.getTmodelKeyRef());
+			apiKeyedRef.setKeyName(modelCategory.getKeyName());
+			apiKeyedRef.setKeyValue(modelCategory.getKeyValue());
+			apiCategoryList.add(new ObjectFactory().createKeyedReference(apiKeyedRef));
+		}
+		apiTModel.setCategoryBag(apiCategoryBag);
+	}
+
+	
+}

Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/main/java/org/apache/juddi/mapping/MappingModelToApi.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/META-INF/persistence.xml?rev=699151&r1=699150&r2=699151&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/META-INF/persistence.xml (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/META-INF/persistence.xml Thu Sep 25 18:50:17 2008
@@ -17,7 +17,7 @@
        
       <!-- connection properties -->
       <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
-      <property name="hibernate.connection.url" value="jdbc:mysql://celeborn:3306/juddi?autoReconnect=true"/>
+      <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/juddi?autoReconnect=true"/>
       <property name="hibernate.connection.username" value="juddi"/>
       <property name="hibernate.connection.password" value="juddi"/>
 

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties?rev=699151&r1=699150&r2=699151&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/main/resources/messages_en.properties Thu Sep 25 18:50:17 2008
@@ -53,6 +53,8 @@
 E_valueNotAllowed=
 
 #-- General error messages
-errors.Unspecified=An unspecified error occured
+errors.Unspecified=An unspecified error occurred
 errors.invalidkey.BusinessNotFound=The business entity was not found for the given key
 errors.invalidkey.ServiceNotFound=The business service was not found for the given key
+errors.invalidkey.BindingTemplatelNotFound=The binding template was not found for the given key
+errors.invalidkey.TModelNotFound=The technical model was not found for the given key

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessEntityTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessEntityTest.java?rev=699151&r1=699150&r2=699151&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessEntityTest.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessEntityTest.java Thu Sep 25 18:50:17 2008
@@ -1,39 +1,51 @@
 package org.apache.juddi.test;
 
-import java.io.File;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Unmarshaller;
+import java.util.List;
+import java.util.Iterator;
 import javax.xml.bind.JAXBException;
 
 import org.apache.juddi.api.impl.UDDIPublicationImpl;
+import org.apache.juddi.api.impl.UDDIInquiryImpl;
 import org.testng.annotations.*;
 import static junit.framework.Assert.fail;
+import static junit.framework.Assert.assertEquals;
 
-import org.uddi.api_v3.DeleteBusiness;
-import org.uddi.api_v3.SaveBusiness;
+import org.uddi.api_v3.*;
 import org.uddi.v3_service.DispositionReportFaultMessage;
 
 public class BusinessEntityTest {
 	private UDDIPublicationImpl publish = new UDDIPublicationImpl();
+	private UDDIInquiryImpl inquiry = new UDDIInquiryImpl();
 	
-	@Parameters({ "businessFile" })
+	@Parameters({ "businessFile", "businessKey" })
 	@Test
-	public void saveBusiness(String businessFile) {
+	public void saveBusiness(String businessFile, String businessKey) {
 		try {
 			SaveBusiness sb = new SaveBusiness();
-			org.uddi.api_v3.BusinessEntity be = (org.uddi.api_v3.BusinessEntity)buildEntityFromDoc(businessFile);
-			sb.getBusinessEntity().add(be);
+			BusinessEntity beIn = (BusinessEntity)UDDIApiTestHelper.buildEntityFromDoc(businessFile);
+			sb.getBusinessEntity().add(beIn);
 			publish.saveBusiness(sb);
 	
 			// 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);
+
+			assertEquals(beIn.getBusinessKey(), beOut.getBusinessKey());
+			
+			UDDIApiTestHelper.checkNames(beIn.getName(), beOut.getName());
+			UDDIApiTestHelper.checkDescriptions(beIn.getDescription(), beOut.getDescription());
+			UDDIApiTestHelper.checkDiscoveryUrls(beIn.getDiscoveryURLs(), beOut.getDiscoveryURLs());
+			UDDIApiTestHelper.checkContacts(beIn.getContacts(), beOut.getContacts());
+			UDDIApiTestHelper.checkCategories(beIn.getCategoryBag(), beOut.getCategoryBag());
 		}
 		catch(DispositionReportFaultMessage dr) {
-			
+			fail("No exception should be thrown");
 		}
 		catch(JAXBException je) {
-			
+			fail("No exception should be thrown");
 		}
 
 	}
@@ -53,11 +65,4 @@
 		
 	}
 
-	public static Object buildEntityFromDoc(String fileName) throws JAXBException {
-		JAXBContext jc = JAXBContext.newInstance("org.uddi.api_v3");
-		Unmarshaller unmarshaller = jc.createUnmarshaller();
-		Object obj = ((JAXBElement)unmarshaller.unmarshal(new File(fileName))).getValue();
-		return obj;
-	}
-
 }

Modified: webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessServiceTest.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessServiceTest.java?rev=699151&r1=699150&r2=699151&view=diff
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessServiceTest.java (original)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/BusinessServiceTest.java Thu Sep 25 18:50:17 2008
@@ -1,41 +1,58 @@
 package org.apache.juddi.test;
 
+import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.fail;
 
 import java.io.File;
+import java.util.List;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.Unmarshaller;
 import javax.xml.bind.JAXBException;
 
+import org.apache.juddi.api.impl.UDDIInquiryImpl;
 import org.apache.juddi.api.impl.UDDIPublicationImpl;
 import org.testng.annotations.*;
+import org.uddi.api_v3.ServiceDetail;
+import org.uddi.api_v3.BusinessService;
 import org.uddi.api_v3.DeleteService;
-import org.uddi.api_v3.DeleteService;
+import org.uddi.api_v3.GetServiceDetail;
 import org.uddi.api_v3.SaveService;
 import org.uddi.v3_service.DispositionReportFaultMessage;
 
 public class BusinessServiceTest {
 	private UDDIPublicationImpl publish = new UDDIPublicationImpl();
+	private UDDIInquiryImpl inquiry = new UDDIInquiryImpl();
 
-	@Parameters({ "serviceFile" })
+	@Parameters({ "serviceFile", "serviceKey" })
 	@Test
-	public void saveService(String serviceFile) {
+	public void saveService(String serviceFile, String serviceKey) {
 		try {
 			// First save the entity
 			SaveService ss = new SaveService();
-			org.uddi.api_v3.BusinessService bs = (org.uddi.api_v3.BusinessService)buildEntityFromDoc(serviceFile);
-			ss.getBusinessService().add(bs);
+			org.uddi.api_v3.BusinessService bsIn = (org.uddi.api_v3.BusinessService)UDDIApiTestHelper.buildEntityFromDoc(serviceFile);
+			ss.getBusinessService().add(bsIn);
 			publish.saveService(ss);
 			
 			// Now get the entity and check the values
+			GetServiceDetail gs = new GetServiceDetail();
+			gs.getServiceKey().add(serviceKey);
+			ServiceDetail sd = inquiry.getServiceDetail(gs);
+			List<BusinessService> bsOutList = sd.getBusinessService();
+			BusinessService bsOut = bsOutList.get(0);
+
+			assertEquals(bsIn.getServiceKey(), bsOut.getServiceKey());
+			
+			UDDIApiTestHelper.checkNames(bsIn.getName(), bsOut.getName());
+			UDDIApiTestHelper.checkDescriptions(bsIn.getDescription(), bsOut.getDescription());
+			UDDIApiTestHelper.checkCategories(bsIn.getCategoryBag(), bsOut.getCategoryBag());
 		}
 		catch(DispositionReportFaultMessage dr) {
-			
+			fail("No exception should be thrown");
 		}
 		catch(JAXBException je) {
-			
+			fail("No exception should be thrown");
 		}
 		
 	}
@@ -50,16 +67,9 @@
 			publish.deleteService(ds);
 		}
 		catch(DispositionReportFaultMessage dr) {
-			
+			fail("No exception should be thrown");
 		}
 		
 	}
 
-	public static Object buildEntityFromDoc(String fileName) throws JAXBException {
-		JAXBContext jc = JAXBContext.newInstance("org.uddi.api_v3");
-		Unmarshaller unmarshaller = jc.createUnmarshaller();
-		Object obj = ((JAXBElement)unmarshaller.unmarshal(new File(fileName))).getValue();
-		return obj;
-	}
-
 }

Added: webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/UDDIApiTestHelper.java
URL: http://svn.apache.org/viewvc/webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/UDDIApiTestHelper.java?rev=699151&view=auto
==============================================================================
--- webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/UDDIApiTestHelper.java (added)
+++ webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/UDDIApiTestHelper.java Thu Sep 25 18:50:17 2008
@@ -0,0 +1,157 @@
+package org.apache.juddi.test;
+
+import static junit.framework.Assert.assertEquals;
+
+import java.io.File;
+import java.util.List;
+import java.util.Iterator;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.bind.Marshaller;
+
+import org.uddi.api_v3.*;
+
+public class UDDIApiTestHelper {
+
+	public static Object buildEntityFromDoc(String fileName) throws JAXBException {
+		JAXBContext jc = JAXBContext.newInstance("org.uddi.api_v3");
+		Unmarshaller unmarshaller = jc.createUnmarshaller();
+		Object obj = ((JAXBElement)unmarshaller.unmarshal(new File(fileName))).getValue();
+		return obj;
+	}
+	
+	public static void outputEntity(Object obj) throws JAXBException {
+		JAXBContext jc = JAXBContext.newInstance("org.uddi.api_v3");
+		Marshaller marshaller = jc.createMarshaller();
+		marshaller.marshal( new JAXBElement<Object>(new javax.xml.namespace.QName("uri","local"), Object.class, obj), System.out);
+		
+	}
+
+
+	public static void checkNames(List<Name> names1, List<Name> names2) {
+		if (names1 == null || names2 == null) {
+			assertEquals(names1, names2);
+			return;
+		}
+		assertEquals(names1.size(), names2.size());
+		Iterator<Name> names1Itr = names1.iterator();
+		Iterator<Name> names2Itr = names2.iterator();
+		while (names1Itr.hasNext()) {
+			Name name1 = names1Itr.next();
+			Name name2 = names2Itr.next();
+			assertEquals(name1.getLang(), name2.getLang());
+			assertEquals(name1.getValue(), name2.getValue());
+		}
+	}
+	
+	public static void checkDescriptions(List<Description> descriptions1, List<Description> descriptions2) {
+		if (descriptions1 == null || descriptions2 == null) {
+			assertEquals(descriptions1, descriptions2);
+			return;
+		}
+		assertEquals(descriptions1.size(), descriptions2.size());
+		Iterator<Description> descriptions1Itr = descriptions1.iterator();
+		Iterator<Description> descriptions2Itr = descriptions2.iterator();
+		while (descriptions1Itr.hasNext()) {
+			Description description1 = descriptions1Itr.next();
+			Description description2 = descriptions2Itr.next();
+			assertEquals(description1.getLang(), description2.getLang());
+			assertEquals(description1.getValue(), description2.getValue());
+		}
+	}
+	
+	public static void checkDiscoveryUrls(DiscoveryURLs discs1, DiscoveryURLs discs2) {
+		if (discs1 == null || discs2 == null) {
+			assertEquals(discs1, discs2);
+			return;
+		}
+		List<DiscoveryURL> discList1 = discs1.getDiscoveryURL();
+		List<DiscoveryURL> discList2 = discs2.getDiscoveryURL();
+		if (discList1 == null || discList2 == null) {
+			assertEquals(discList1, discList2);
+			return;
+		}
+		assertEquals(discList1.size(), discList2.size());
+		Iterator<DiscoveryURL> discList1Itr = discList1.iterator();
+		Iterator<DiscoveryURL> discList2Itr = discList2.iterator();
+		while (discList1Itr.hasNext()) {
+			DiscoveryURL disc1 = discList1Itr.next();
+			DiscoveryURL disc2 = discList2Itr.next();
+			assertEquals(disc1.getUseType(), disc2.getUseType());
+			assertEquals(disc1.getValue(), disc2.getValue());
+		}
+	}
+	
+	public static void checkContacts(Contacts contacts1, Contacts contacts2) {
+		if (contacts1 == null || contacts2 == null) {
+			assertEquals(contacts1, contacts2);
+			return;
+		}
+		List<Contact> contactList1 = contacts1.getContact();
+		List<Contact> contactList2 = contacts2.getContact();
+		if (contactList1 == null || contactList2 == null) {
+			assertEquals(contactList1, contactList2);
+			return;
+		}
+		assertEquals(contactList1.size(), contactList2.size());
+		Iterator<Contact> contactList1Itr = contactList1.iterator();
+		Iterator<Contact> contactList2Itr = contactList2.iterator();
+		while (contactList1Itr.hasNext()) {
+			Contact contact1 = contactList1Itr.next();
+			Contact contact2 = contactList2Itr.next();
+			assertEquals(contact1.getUseType(), contact2.getUseType());
+			
+			checkPersonNames(contact1.getPersonName(), contact2.getPersonName());
+			checkDescriptions(contact1.getDescription(), contact2.getDescription());
+		}
+	}
+	
+	public static void checkPersonNames(List<PersonName> names1, List<PersonName> names2) {
+		if (names1 == null || names2 == null) {
+			assertEquals(names1, names2);
+			return;
+		}
+		assertEquals(names1.size(), names2.size());
+		Iterator<PersonName> names1Itr = names1.iterator();
+		Iterator<PersonName> names2Itr = names2.iterator();
+		while (names1Itr.hasNext()) {
+			PersonName name1 = names1Itr.next();
+			PersonName name2 = names2Itr.next();
+			assertEquals(name1.getLang(), name2.getLang());
+			assertEquals(name1.getValue(), name2.getValue());
+		}
+	}
+
+	public static void checkCategories(CategoryBag cbag1, CategoryBag cbag2) {
+		if (cbag1 == null || cbag2 == null) {
+			assertEquals(cbag1, cbag2);
+			return;
+		}
+		List<JAXBElement<?>> elemList1 = cbag1.getContent();
+		List<JAXBElement<?>> elemList2 = cbag2.getContent();
+		if (elemList1 == null || elemList2 == null) {
+			assertEquals(elemList1, elemList2);
+			return;
+		}
+		// In object could have KeyedReferenceGroups which are ignored.  For now, only solo KeyedReferences are checked.
+		//assertEquals(elemList1.size(), elemList2.size());
+		Iterator<JAXBElement<?>> elemList1Itr = elemList1.iterator();
+		Iterator<JAXBElement<?>> elemList2Itr = elemList2.iterator();
+		while (elemList1Itr.hasNext()) {
+			JAXBElement<?> elem1 = elemList1Itr.next();
+			if (elem1.getValue() instanceof org.uddi.api_v3.KeyedReference) {
+				JAXBElement<?> elem2 = elemList2Itr.next();
+				KeyedReference kr1 = (KeyedReference)elem1.getValue();
+				KeyedReference kr2 = (KeyedReference)elem2.getValue();;
+				assertEquals(kr1.getTModelKey(), kr2.getTModelKey());
+				assertEquals(kr1.getKeyName(), kr2.getKeyName());
+				assertEquals(kr1.getKeyValue(), kr2.getKeyValue());
+			}
+			
+		}
+	}
+	
+}

Propchange: webservices/juddi/branches/v3_trunk/juddi-core/src/test/java/org/apache/juddi/test/UDDIApiTestHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



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