You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2018/11/24 20:56:47 UTC
[2/4] juddi-scout git commit: [SCOUT-133] updates site definitions to
match jUDDI's theming and corrects release version [SCOUT-132] fixes debug
statements[SCOUT-132] fixes debug statements [SCOUT-133] updates site
definitions to match jUDDI's theming an
http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiV3Helper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiV3Helper.java b/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiV3Helper.java
index cc8a6f4..ac81f42 100644
--- a/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiV3Helper.java
+++ b/src/main/java/org/apache/ws/scout/util/ScoutJaxrUddiV3Helper.java
@@ -19,6 +19,7 @@ package org.apache.ws.scout.util;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
+import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
@@ -56,19 +57,18 @@ import org.apache.ws.scout.registry.infomodel.InternationalStringImpl;
* @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>
* @author <a href="mailto:tcunning@apache.org">Tom Cunningham</a>
*/
-public class ScoutJaxrUddiV3Helper
-{
+public class ScoutJaxrUddiV3Helper {
+
private static final String UDDI_ORG_TYPES = "uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4";
- private static Log log = LogFactory.getLog(ScoutJaxrUddiV3Helper.class);
- private static ObjectFactory objectFactory = new ObjectFactory();
-
+ private static Log log = LogFactory.getLog(ScoutJaxrUddiV3Helper.class);
+ private static ObjectFactory objectFactory = new ObjectFactory();
+
/**
* Get UDDI Address given JAXR Postal Address
*/
- public static Address getAddress(PostalAddress postalAddress) throws JAXRException {
- Address address = objectFactory.createAddress();
-
- AddressLine[] addarr = new AddressLine[7];
+ public static Address getAddress(PostalAddress postalAddress) throws JAXRException {
+ Address address = objectFactory.createAddress();
+ List<AddressLine> list = new LinkedList<AddressLine>();
String stnum = postalAddress.getStreetNumber();
String st = postalAddress.getStreet();
@@ -78,135 +78,150 @@ public class ScoutJaxrUddiV3Helper
String state = postalAddress.getStateOrProvince();
String type = postalAddress.getType();
- AddressLine stnumAL = objectFactory.createAddressLine();
- stnumAL.setKeyName("STREET_NUMBER");
- if (stnum != null) {
- stnumAL.setKeyValue("STREET_NUMBER");
- stnumAL.setValue(stnum);
- }
-
- AddressLine stAL = objectFactory.createAddressLine();
- stAL.setKeyName("STREET");
- if (st != null) {
- stAL.setKeyValue("STREET");
- stAL.setValue(st);
- }
-
- AddressLine cityAL = objectFactory.createAddressLine();
- cityAL.setKeyName("CITY");
- if (city != null) {
- cityAL.setKeyValue("CITY");
- cityAL.setValue(city);
- }
-
- AddressLine countryAL = objectFactory.createAddressLine();
- countryAL.setKeyName("COUNTRY");
- if (country != null) {
- countryAL.setKeyValue("COUNTRY");
- countryAL.setValue(country);
- }
-
- AddressLine codeAL = objectFactory.createAddressLine();
- codeAL.setKeyName("POSTALCODE");
- if (code != null) {
- codeAL.setKeyValue("POSTALCODE");
- codeAL.setValue(code);
- }
-
- AddressLine stateAL = objectFactory.createAddressLine();
- stateAL.setKeyName("STATE");
- if (state != null) {
- stateAL.setKeyValue("STATE");
- stateAL.setValue(state);
- }
-
- AddressLine typeAL = objectFactory.createAddressLine();
- typeAL.setKeyName("TYPE");
- if (type != null) {
- typeAL.setKeyValue("TYPE");
- typeAL.setValue(type);
+ AddressLine stnumAL = null;
+
+ if (stnum != null && stnum.length() > 0) {
+ stnumAL = objectFactory.createAddressLine();
+ stnumAL.setKeyName("uddi:uddi.org:ubr:postaladdress");
+ stnumAL.setKeyValue("STREET_NUMBER");
+ stnumAL.setValue(stnum);
+ list.add(stnumAL);
+ }
+
+ AddressLine stAL = null;
+
+ if (st != null && st.length() > 0) {
+ stAL = objectFactory.createAddressLine();
+ stAL.setKeyName("uddi:uddi.org:ubr:postaladdress");
+ stAL.setKeyValue("STREET");
+ stAL.setValue(st);
+ list.add(stAL);
+ }
+
+ AddressLine cityAL = null;
+
+ if (city != null && city.length() > 0) {
+ cityAL = objectFactory.createAddressLine();
+ cityAL.setKeyName("uddi:uddi.org:ubr:postaladdress");
+ cityAL.setKeyValue("CITY");
+ cityAL.setValue(city);
+ list.add(cityAL);
+ }
+
+ AddressLine countryAL = null;
+
+ if (country != null && country.length() > 0) {
+ countryAL = objectFactory.createAddressLine();
+ countryAL.setKeyName("uddi:uddi.org:ubr:postaladdress");
+ countryAL.setKeyValue("COUNTRY");
+ countryAL.setValue(country);
+ list.add(countryAL);
+
+ }
+
+ AddressLine codeAL = null;
+
+ if (code != null&& code.length() > 0) {
+ codeAL = objectFactory.createAddressLine();
+ codeAL.setKeyName("uddi:uddi.org:ubr:postaladdress");
+ codeAL.setKeyValue("POSTALCODE");
+ codeAL.setValue(code);
+ list.add(codeAL);
}
- // Add the AddressLine to vector
- addarr[0] = stnumAL;
- addarr[1] = stAL;
- addarr[2] = cityAL;
- addarr[3] = countryAL;
- addarr[4] = codeAL;
- addarr[5] = stateAL;
- addarr[6] = typeAL;
-
- address.getAddressLine().addAll(Arrays.asList(addarr));
+ AddressLine stateAL = null;
+ if (state != null && state.length()>0) {
+ stateAL = objectFactory.createAddressLine();
+ stateAL.setKeyName("uddi:uddi.org:ubr:postaladdress");
+ stateAL.setKeyValue("STATE");
+ stateAL.setValue(state);
+ list.add(stateAL);
+
+ }
+
+ AddressLine typeAL = null;
+ if (type != null && type.length()>0) {
+ typeAL = objectFactory.createAddressLine();
+ typeAL.setKeyName("uddi:uddi.org:ubr:postaladdress");
+
+ typeAL.setValue(type);
+ typeAL.setKeyValue("TYPE");
+ list.add(typeAL);
+ }
+
+ //FIXME this may need v2 vs v3 support?
+ address.setTModelKey("uddi:uddi.org:ubr:postaladdress");
+ address.getAddressLine().addAll(list);
return address;
}
- public static BindingTemplate getBindingTemplateFromJAXRSB(
- ServiceBinding serviceBinding) throws JAXRException {
- BindingTemplate bt = objectFactory.createBindingTemplate();
- if (serviceBinding.getKey() != null && serviceBinding.getKey().getId() != null) {
- bt.setBindingKey(serviceBinding.getKey().getId());
- } else {
- bt.setBindingKey("");
- }
-
- try {
- // Set Access URI
+ public static BindingTemplate getBindingTemplateFromJAXRSB(
+ ServiceBinding serviceBinding) throws JAXRException {
+ BindingTemplate bt = objectFactory.createBindingTemplate();
+ if (serviceBinding.getKey() != null && serviceBinding.getKey().getId() != null) {
+ bt.setBindingKey(serviceBinding.getKey().getId());
+ } else {
+ bt.setBindingKey("");
+ }
+
+ try {
+ // Set Access URI
String accessuri = serviceBinding.getAccessURI();
- if (accessuri != null) {
- AccessPoint accessPoint = objectFactory.createAccessPoint();
+ if (accessuri != null) {
+ AccessPoint accessPoint = objectFactory.createAccessPoint();
accessPoint.setUseType(getUseType(accessuri));
- accessPoint.setValue(accessuri);
+ accessPoint.setValue(accessuri);
bt.setAccessPoint(accessPoint);
}
ServiceBinding sb = serviceBinding.getTargetBinding();
- if (sb != null) {
- HostingRedirector red = objectFactory.createHostingRedirector();
+ if (sb != null) {
+ HostingRedirector red = objectFactory.createHostingRedirector();
Key key = sb.getKey();
- if (key != null && key.getId() != null) {
- red.setBindingKey(key.getId());
+ if (key != null && key.getId() != null) {
+ red.setBindingKey(key.getId());
} else {
red.setBindingKey("");
}
bt.setHostingRedirector(red);
} else {
- if (bt.getAccessPoint() == null) {
- bt.setAccessPoint(objectFactory.createAccessPoint());
- }
+ if (bt.getAccessPoint() == null) {
+ bt.setAccessPoint(objectFactory.createAccessPoint());
+ }
}
- // TODO:Need to look further at the mapping b/w BindingTemplate and
- // Jaxr ServiceBinding
+ // TODO:Need to look further at the mapping b/w BindingTemplate and
+ // Jaxr ServiceBinding
CategoryBag catBag = getCategoryBagFromClassifications(serviceBinding.getClassifications());
- if (catBag!=null) {
+ if (catBag != null) {
bt.setCategoryBag(catBag);
}
-
+
// Get Service information
Service svc = serviceBinding.getService();
if (svc != null && svc.getKey() != null && svc.getKey().getId() != null) {
- bt.setServiceKey(svc.getKey().getId());
+ bt.setServiceKey(svc.getKey().getId());
}
-
- InternationalString idesc = serviceBinding.getDescription();
-
+
+ InternationalString idesc = serviceBinding.getDescription();
+
addDescriptions(bt.getDescription(), idesc);
- // SpecificationLink
- Collection<SpecificationLink> slcol = serviceBinding.getSpecificationLinks();
- TModelInstanceDetails tid = objectFactory.createTModelInstanceDetails();
- if (slcol != null && !slcol.isEmpty()) {
- Iterator<SpecificationLink> iter = slcol.iterator();
- while (iter.hasNext()) {
- SpecificationLink slink = (SpecificationLink) iter.next();
+ // SpecificationLink
+ Collection<SpecificationLink> slcol = serviceBinding.getSpecificationLinks();
+ TModelInstanceDetails tid = objectFactory.createTModelInstanceDetails();
+ if (slcol != null && !slcol.isEmpty()) {
+ Iterator<SpecificationLink> iter = slcol.iterator();
+ while (iter.hasNext()) {
+ SpecificationLink slink = (SpecificationLink) iter.next();
- TModelInstanceInfo emptyTInfo = objectFactory.createTModelInstanceInfo();
- tid.getTModelInstanceInfo().add(emptyTInfo);
+ TModelInstanceInfo emptyTInfo = objectFactory.createTModelInstanceInfo();
+ tid.getTModelInstanceInfo().add(emptyTInfo);
RegistryObject specificationObject = slink.getSpecificationObject();
- if (specificationObject.getKey() != null && specificationObject.getKey().getId() != null) {
- emptyTInfo.setTModelKey(specificationObject.getKey().getId());
- if (specificationObject.getDescription()!=null) {
+ if (specificationObject.getKey() != null && specificationObject.getKey().getId() != null) {
+ emptyTInfo.setTModelKey(specificationObject.getKey().getId());
+ if (specificationObject.getDescription() != null) {
for (Object o : specificationObject.getDescription().getLocalizedStrings()) {
LocalizedString locDesc = (LocalizedString) o;
Description description = objectFactory.createDescription();
@@ -216,16 +231,16 @@ public class ScoutJaxrUddiV3Helper
}
}
Collection<ExternalLink> externalLinks = slink.getExternalLinks();
- if (externalLinks!=null && externalLinks.size()>0) {
+ if (externalLinks != null && externalLinks.size() > 0) {
for (ExternalLink link : externalLinks) {
InstanceDetails ids = objectFactory.createInstanceDetails();
emptyTInfo.setInstanceDetails(ids);
- if (link.getDescription()!=null) {
+ if (link.getDescription() != null) {
Description description = objectFactory.createDescription();
ids.getDescription().add(description);
description.setValue(link.getDescription().getValue());
}
- if (link.getExternalURI()!=null) {
+ if (link.getExternalURI() != null) {
OverviewDoc overviewDoc = objectFactory.createOverviewDoc();
ids.getOverviewDoc().add(overviewDoc);
org.uddi.api_v3.OverviewURL ourl = new org.uddi.api_v3.OverviewURL();
@@ -240,95 +255,96 @@ public class ScoutJaxrUddiV3Helper
}
ids.setInstanceParms(buffer.toString().trim());
}
- }
+ }
}
- }
- }
- }
- if (tid.getTModelInstanceInfo().size() != 0) {
- bt.setTModelInstanceDetails(tid);
- }
- log.debug("BindingTemplate=" + bt.toString());
- } catch (Exception ud) {
+ }
+ }
+ }
+ if (tid.getTModelInstanceInfo().size() != 0) {
+ bt.setTModelInstanceDetails(tid);
+ }
+ log.debug("BindingTemplate=" + bt.toString());
+ } catch (Exception ud) {
throw new JAXRException("Apache JAXR Impl:", ud);
}
return bt;
}
- public static PublisherAssertion getPubAssertionFromJAXRAssociation(
- Association association) throws JAXRException {
- PublisherAssertion pa = objectFactory.createPublisherAssertion();
- try {
- if (association.getSourceObject().getKey() != null &&
- association.getSourceObject().getKey().getId() != null) {
- pa.setFromKey(association.getSourceObject().getKey().getId());
- }
-
- if (association.getTargetObject().getKey() != null &&
- association.getTargetObject().getKey().getId() != null) {
- pa.setToKey(association.getTargetObject().getKey().getId());
- }
+ public static PublisherAssertion getPubAssertionFromJAXRAssociation(
+ Association association) throws JAXRException {
+ PublisherAssertion pa = objectFactory.createPublisherAssertion();
+ try {
+ if (association.getSourceObject().getKey() != null
+ && association.getSourceObject().getKey().getId() != null) {
+ pa.setFromKey(association.getSourceObject().getKey().getId());
+ }
+
+ if (association.getTargetObject().getKey() != null
+ && association.getTargetObject().getKey().getId() != null) {
+ pa.setToKey(association.getTargetObject().getKey().getId());
+ }
Concept c = association.getAssociationType();
String v = c.getValue();
- KeyedReference kr = objectFactory.createKeyedReference();
+ KeyedReference kr = objectFactory.createKeyedReference();
Key key = c.getKey();
- if (key == null) {
- // TODO:Need to check this. If the concept is a predefined
- // enumeration, the key can be the parent classification scheme
+ if (key == null) {
+ // TODO:Need to check this. If the concept is a predefined
+ // enumeration, the key can be the parent classification scheme
key = c.getClassificationScheme().getKey();
}
- if (key != null && key.getId() != null) {
- kr.setTModelKey(key.getId());
- }
+ if (key != null && key.getId() != null) {
+ kr.setTModelKey(key.getId());
+ }
kr.setKeyName("Concept");
- if (v != null) {
- kr.setKeyValue(v);
- }
+ if (v != null) {
+ kr.setKeyValue(v);
+ }
pa.setKeyedReference(kr);
- } catch (Exception ud) {
+ } catch (Exception ud) {
throw new JAXRException("Apache JAXR Impl:", ud);
}
return pa;
}
- public static PublisherAssertion getPubAssertionFromJAXRAssociationKey(
- String key) throws JAXRException {
- PublisherAssertion pa = objectFactory.createPublisherAssertion();
- try {
- StringTokenizer token = new StringTokenizer(key, "|");
- if (token.hasMoreTokens()) {
- pa.setFromKey(getToken(token.nextToken()));
- pa.setToKey(getToken(token.nextToken()));
- KeyedReference kr = objectFactory.createKeyedReference();
- // Sometimes the Key is UUID:something
- String str = getToken(token.nextToken());
- if ("UUID".equalsIgnoreCase(str))
- str += ":" + getToken(token.nextToken());
- kr.setTModelKey(str);
- kr.setKeyName(getToken(token.nextToken()));
- kr.setKeyValue(getToken(token.nextToken()));
- pa.setKeyedReference(kr);
- }
-
- } catch (Exception ud) {
+ public static PublisherAssertion getPubAssertionFromJAXRAssociationKey(
+ String key) throws JAXRException {
+ PublisherAssertion pa = objectFactory.createPublisherAssertion();
+ try {
+ StringTokenizer token = new StringTokenizer(key, "|");
+ if (token.hasMoreTokens()) {
+ pa.setFromKey(getToken(token.nextToken()));
+ pa.setToKey(getToken(token.nextToken()));
+ KeyedReference kr = objectFactory.createKeyedReference();
+ // Sometimes the Key is UUID:something
+ String str = getToken(token.nextToken());
+ if ("UUID".equalsIgnoreCase(str)) {
+ str += ":" + getToken(token.nextToken());
+ }
+ kr.setTModelKey(str);
+ kr.setKeyName(getToken(token.nextToken()));
+ kr.setKeyValue(getToken(token.nextToken()));
+ pa.setKeyedReference(kr);
+ }
+
+ } catch (Exception ud) {
throw new JAXRException("Apache JAXR Impl:", ud);
}
return pa;
}
- public static BusinessService getBusinessServiceFromJAXRService(
- Service service) throws JAXRException {
- BusinessService bs = objectFactory.createBusinessService();
- try {
- InternationalString iname = service.getName();
-
- addNames(bs.getName(), iname);
-
+ public static BusinessService getBusinessServiceFromJAXRService(
+ Service service) throws JAXRException {
+ BusinessService bs = objectFactory.createBusinessService();
+ try {
+ InternationalString iname = service.getName();
+
+ addNames(bs.getName(), iname);
+
InternationalString idesc = service.getDescription();
-
- addDescriptions(bs.getDescription(), idesc);
+
+ addDescriptions(bs.getDescription(), idesc);
Organization o = service.getProvidingOrganization();
@@ -338,26 +354,26 @@ public class ScoutJaxrUddiV3Helper
if (o != null) {
Key k = o.getKey();
- if (k != null && k.getId() != null) {
+ if (k != null && k.getId() != null) {
bs.setBusinessKey(k.getId());
- }
-
- } else {
+ }
+
+ } else {
/*
* gmj - I *think* this is the right thing to do
*/
- throw new JAXRException(
- "Service has no associated organization");
+ throw new JAXRException(
+ "Service has no associated organization");
}
- if (service.getKey() != null && service.getKey().getId() != null) {
+ if (service.getKey() != null && service.getKey().getId() != null) {
bs.setServiceKey(service.getKey().getId());
} else {
bs.setServiceKey("");
}
CategoryBag catBag = getCategoryBagFromClassifications(service.getClassifications());
- if (catBag!=null) {
+ if (catBag != null) {
bs.setCategoryBag(catBag);
}
@@ -366,18 +382,18 @@ public class ScoutJaxrUddiV3Helper
if (bt != null) {
bs.setBindingTemplates(bt);
}
-
+
log.debug("BusinessService=" + bs.toString());
- } catch (Exception ud) {
+ } catch (Exception ud) {
throw new JAXRException("Apache JAXR Impl:", ud);
}
return bs;
}
- public static TModel getTModelFromJAXRClassificationScheme(
- ClassificationScheme classificationScheme) throws JAXRException {
- TModel tm = objectFactory.createTModel();
- try {
+ public static TModel getTModelFromJAXRClassificationScheme(
+ ClassificationScheme classificationScheme) throws JAXRException {
+ TModel tm = objectFactory.createTModel();
+ try {
/*
* a fresh scheme might not have a key
*/
@@ -393,52 +409,53 @@ public class ScoutJaxrUddiV3Helper
/*
* There's no reason to believe these are here either
*/
-
Slot s = classificationScheme.getSlot("authorizedName");
-/*
+ /*
if (s != null && s.getName() != null) {
tm.setAuthorizedName(s.getName());
}
-*/
+ */
s = classificationScheme.getSlot("operator");
-/*
+ /*
if (s != null && s.getName() != null) {
tm.setOperator(s.getName());
}
-*/
- InternationalString iname = classificationScheme.getName();
-
+ */
+ InternationalString iname = classificationScheme.getName();
+
tm.setName(getFirstName(iname));
- InternationalString idesc = classificationScheme.getDescription();
-
- addDescriptions(tm.getDescription(), idesc);
+ InternationalString idesc = classificationScheme.getDescription();
+
+ addDescriptions(tm.getDescription(), idesc);
IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(classificationScheme.getExternalIdentifiers());
- if (idBag!=null) {
+ if (idBag != null) {
tm.setIdentifierBag(idBag);
}
CategoryBag catBag = getCategoryBagFromClassifications(classificationScheme.getClassifications());
- if (catBag!=null) {
+ if (catBag != null) {
tm.setCategoryBag(catBag);
}
-
- // ToDO: overviewDoc
- } catch (Exception ud) {
+
+ // ToDO: overviewDoc
+ } catch (Exception ud) {
throw new JAXRException("Apache JAXR Impl:", ud);
}
return tm;
}
public static TModel getTModelFromJAXRConcept(Concept concept)
- throws JAXRException {
- TModel tm = objectFactory.createTModel();
- if (concept == null)
- return null;
- try {
+ throws JAXRException {
+ TModel tm = objectFactory.createTModel();
+ if (concept == null) {
+ return null;
+ }
+ try {
Key key = concept.getKey();
- if (key != null && key.getId() != null)
- tm.setTModelKey(key.getId());
+ if (key != null && key.getId() != null) {
+ tm.setTModelKey(key.getId());
+ }
Slot sl1 = concept.getSlot("authorizedName");
/*
if (sl1 != null && sl1.getName() != null)
@@ -447,32 +464,31 @@ public class ScoutJaxrUddiV3Helper
Slot sl2 = concept.getSlot("operator");
if (sl2 != null && sl2.getName() != null)
tm.setOperator(sl2.getName());
- */
- InternationalString iname = concept.getName();
+ */
+ InternationalString iname = concept.getName();
tm.setName(getFirstName(iname));
InternationalString idesc = concept.getDescription();
-
+
addDescriptions(tm.getDescription(), idesc);
// External Links
- Collection<ExternalLink> externalLinks = concept.getExternalLinks();
- if(externalLinks != null && externalLinks.size() > 0)
- {
- tm.getOverviewDoc().add(getOverviewDocFromExternalLink((ExternalLink)externalLinks.iterator().next()));
- }
+ Collection<ExternalLink> externalLinks = concept.getExternalLinks();
+ if (externalLinks != null && externalLinks.size() > 0) {
+ tm.getOverviewDoc().add(getOverviewDocFromExternalLink((ExternalLink) externalLinks.iterator().next()));
+ }
IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(concept.getExternalIdentifiers());
- if (idBag!=null) {
+ if (idBag != null) {
tm.setIdentifierBag(idBag);
}
CategoryBag catBag = getCategoryBagFromClassifications(concept.getClassifications());
- if (catBag!=null) {
+ if (catBag != null) {
tm.setCategoryBag(catBag);
}
- } catch (Exception ud) {
+ } catch (Exception ud) {
throw new JAXRException("Apache JAXR Impl:", ud);
}
return tm;
@@ -500,6 +516,7 @@ public class ScoutJaxrUddiV3Helper
}
return null;
}
+
private static void addNames(List<Name> names, InternationalString iname) throws JAXRException {
for (Object o : iname.getLocalizedStrings()) {
LocalizedString locName = (LocalizedString) o;
@@ -511,52 +528,52 @@ public class ScoutJaxrUddiV3Helper
}
public static BusinessEntity getBusinessEntityFromJAXROrg(Organization organization)
- throws JAXRException {
- BusinessEntity biz = objectFactory.createBusinessEntity();
- BusinessServices bss = objectFactory.createBusinessServices();
- BusinessService[] barr = new BusinessService[0];
+ throws JAXRException {
+ BusinessEntity biz = objectFactory.createBusinessEntity();
+ BusinessServices bss = objectFactory.createBusinessServices();
+ BusinessService[] barr = new BusinessService[0];
- try {
- // It may just be an update
+ try {
+ // It may just be an update
Key key = organization.getKey();
- if (key != null && key.getId() != null) {
- biz.setBusinessKey(key.getId());
+ if (key != null && key.getId() != null) {
+ biz.setBusinessKey(key.getId());
} else {
biz.setBusinessKey("");
}
- // Lets get the Organization attributes at the top level
-
- InternationalString iname = organization.getName();
-
- if (iname != null) {
+ // Lets get the Organization attributes at the top level
+
+ InternationalString iname = organization.getName();
+
+ if (iname != null) {
addNames(biz.getName(), iname);
- }
-
- InternationalString idesc = organization.getDescription();
-
+ }
+
+ InternationalString idesc = organization.getDescription();
+
addDescriptions(biz.getDescription(), idesc);
- if (organization.getPrimaryContact() != null &&
- organization.getPrimaryContact().getPersonName()!= null &&
- organization.getPrimaryContact().getPersonName().getFullName() != null) {
+ if (organization.getPrimaryContact() != null
+ && organization.getPrimaryContact().getPersonName() != null
+ && organization.getPrimaryContact().getPersonName().getFullName() != null) {
- //biz.setAuthorizedName(organization.getPrimaryContact().getPersonName()
- // .getFullName());
- }
+ //biz.setAuthorizedName(organization.getPrimaryContact().getPersonName()
+ // .getFullName());
+ }
Collection<Service> s = organization.getServices();
log.debug("?Org has services=" + s.isEmpty());
- barr = new BusinessService[s.size()];
+ barr = new BusinessService[s.size()];
Iterator<Service> iter = s.iterator();
- int barrPos = 0;
- while (iter.hasNext()) {
- BusinessService bs = ScoutJaxrUddiV3Helper
- .getBusinessServiceFromJAXRService((Service) iter
- .next());
- barr[barrPos] = bs;
- barrPos++;
+ int barrPos = 0;
+ while (iter.hasNext()) {
+ BusinessService bs = ScoutJaxrUddiV3Helper
+ .getBusinessServiceFromJAXRService((Service) iter
+ .next());
+ barr[barrPos] = bs;
+ barrPos++;
}
/*
@@ -564,16 +581,14 @@ public class ScoutJaxrUddiV3Helper
* special designation for one of the users, and D6.1 seems to say
* that the first UDDI user is the primary contact
*/
-
- Contacts cts = objectFactory.createContacts();
- Contact[] carr = new Contact[0];
+ Contacts cts = objectFactory.createContacts();
+ Contact[] carr = new Contact[0];
User primaryContact = organization.getPrimaryContact();
Collection<User> users = organization.getUsers();
// Expand array to necessary size only (xmlbeans does not like
// null items in cases like this)
-
int carrSize = 0;
if (primaryContact != null) {
@@ -611,8 +626,8 @@ public class ScoutJaxrUddiV3Helper
}
}
- bss.getBusinessService().addAll(Arrays.asList(barr));
- if (carr.length>0) {
+ bss.getBusinessService().addAll(Arrays.asList(barr));
+ if (carr.length > 0) {
cts.getContact().addAll(Arrays.asList(carr));
biz.setContacts(cts);
}
@@ -624,7 +639,9 @@ public class ScoutJaxrUddiV3Helper
boolean first = true;
while (exiter.hasNext()) {
ExternalLink link = (ExternalLink) exiter.next();
- /** Note: jUDDI adds its own discoverURL as the businessEntity* */
+ /**
+ * Note: jUDDI adds its own discoverURL as the businessEntity*
+ */
if (first) {
emptyDUs = objectFactory.createDiscoveryURLs();
biz.setDiscoveryURLs(emptyDUs);
@@ -633,22 +650,22 @@ public class ScoutJaxrUddiV3Helper
DiscoveryURL emptyDU = objectFactory.createDiscoveryURL();
emptyDUs.getDiscoveryURL().add(emptyDU);
emptyDU.setUseType("businessEntityExt");
-
+
if (link.getExternalURI() != null) {
emptyDU.setValue(link.getExternalURI());
}
}
-
- IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(organization.getExternalIdentifiers());
- if (idBag!=null) {
- biz.setIdentifierBag(idBag);
- }
- CategoryBag catBag = getCategoryBagFromClassifications(organization.getClassifications());
- if (catBag!=null) {
- biz.setCategoryBag(catBag);
- }
-
- } catch (Exception ud) {
+
+ IdentifierBag idBag = getIdentifierBagFromExternalIdentifiers(organization.getExternalIdentifiers());
+ if (idBag != null) {
+ biz.setIdentifierBag(idBag);
+ }
+ CategoryBag catBag = getCategoryBagFromClassifications(organization.getClassifications());
+ if (catBag != null) {
+ biz.setCategoryBag(catBag);
+ }
+
+ } catch (Exception ud) {
throw new JAXRException("Apache JAXR Impl:", ud);
}
return biz;
@@ -656,210 +673,225 @@ public class ScoutJaxrUddiV3Helper
/**
*
- * Convert JAXR User Object to UDDI Contact
+ * Convert JAXR User Object to UDDI Contact
*/
public static Contact getContactFromJAXRUser(User user)
- throws JAXRException {
- Contact ct = objectFactory.createContact();
+ throws JAXRException {
+ Contact ct = objectFactory.createContact();
if (user == null) {
return null;
}
- Address[] addarr = new Address[0];
- Phone[] phonearr = new Phone[0];
- Email[] emailarr = new Email[0];
- try {
-
- if (user.getPersonName() != null && user.getPersonName().getFullName() != null) {
- org.uddi.api_v3.PersonName pn = new org.uddi.api_v3.PersonName();
- pn.setValue(user.getPersonName().getFullName());
- ct.getPersonName().add(pn);
- }
-
- if (user.getType() != null) {
- ct.setUseType(user.getType());
- }
- // Postal Address
+ Address[] addarr = new Address[0];
+ Phone[] phonearr = new Phone[0];
+ Email[] emailarr = new Email[0];
+ try {
+
+ if (user.getPersonName() != null && user.getPersonName().getFullName() != null) {
+ org.uddi.api_v3.PersonName pn = new org.uddi.api_v3.PersonName();
+ pn.setValue(user.getPersonName().getFullName());
+ ct.getPersonName().add(pn);
+ }
+
+ if (user.getType() != null) {
+ ct.setUseType(user.getType());
+ }
+ // Postal Address
Collection<PostalAddress> postc = user.getPostalAddresses();
- addarr = new Address[postc.size()];
+ addarr = new Address[postc.size()];
Iterator<PostalAddress> iterator = postc.iterator();
- int addarrPos = 0;
- while (iterator.hasNext()) {
+ int addarrPos = 0;
+ while (iterator.hasNext()) {
PostalAddress post = (PostalAddress) iterator.next();
- addarr[addarrPos] = ScoutJaxrUddiV3Helper.getAddress(post);
- addarrPos++;
+ addarr[addarrPos] = ScoutJaxrUddiV3Helper.getAddress(post);
+ addarrPos++;
}
- // Phone Numbers
+ // Phone Numbers
Collection ph = user.getTelephoneNumbers(null);
- phonearr = new Phone[ph.size()];
+ phonearr = new Phone[ph.size()];
Iterator it = ph.iterator();
- int phonearrPos = 0;
- while (it.hasNext()) {
+ int phonearrPos = 0;
+ while (it.hasNext()) {
TelephoneNumber t = (TelephoneNumber) it.next();
- Phone phone = objectFactory.createPhone();
+ Phone phone = objectFactory.createPhone();
String str = t.getNumber();
log.debug("Telephone=" + str);
-
- // FIXME: If phone number is null, should the phone
- // not be set at all, or set to empty string?
- if (str != null) {
- phone.setValue(str);
- } else {
- phone.setValue("");
- }
- phonearr[phonearrPos] = phone;
- phonearrPos++;
+ // FIXME: If phone number is null, should the phone
+ // not be set at all, or set to empty string?
+ if (str != null) {
+ phone.setValue(str);
+ } else {
+ phone.setValue("");
+ }
+
+ phonearr[phonearrPos] = phone;
+ phonearrPos++;
}
- // Email Addresses
+ // Email Addresses
Collection ec = user.getEmailAddresses();
- emailarr = new Email[ec.size()];
+ emailarr = new Email[ec.size()];
Iterator iter = ec.iterator();
- int emailarrPos = 0;
- while (iter.hasNext()) {
+ int emailarrPos = 0;
+ while (iter.hasNext()) {
EmailAddress ea = (EmailAddress) iter.next();
- Email email = objectFactory.createEmail();
-
- if (ea.getAddress() != null) {
- email.setValue(ea.getAddress());
- }
- // email.setText( ea.getAddress() );
-
- if (ea.getType() != null) {
- email.setUseType(ea.getType());
- }
-
- emailarr[emailarrPos] = email;
- emailarrPos++;
- }
- ct.getAddress().addAll(Arrays.asList(addarr));
- ct.getPhone().addAll(Arrays.asList(phonearr));
- ct.getEmail().addAll(Arrays.asList(emailarr));
- } catch (Exception ud) {
+ Email email = objectFactory.createEmail();
+
+ if (ea.getAddress() != null) {
+ email.setValue(ea.getAddress());
+ }
+ // email.setText( ea.getAddress() );
+
+ if (ea.getType() != null) {
+ email.setUseType(ea.getType());
+ }
+
+ emailarr[emailarrPos] = email;
+ emailarrPos++;
+ }
+ ct.getAddress().addAll(Arrays.asList(addarr));
+ ct.getPhone().addAll(Arrays.asList(phonearr));
+ ct.getEmail().addAll(Arrays.asList(emailarr));
+ } catch (Exception ud) {
throw new JAXRException("Apache JAXR Impl:", ud);
}
return ct;
}
- private static String getToken(String tokenstr) {
- // Token can have the value NULL which need to be converted into null
- if (tokenstr.equals("NULL"))
- tokenstr = "";
- return tokenstr;
- }
-
- private static String getUseType(String accessuri) {
- String acc = accessuri.toLowerCase();
- String uri = "other";
- if (acc.startsWith("http:"))
- uri = "http:";
- else if (acc.startsWith("https:"))
- uri = "https:";
- else if (acc.startsWith("ftp:"))
- uri = "ftp:";
- else if (acc.startsWith("phone:"))
- uri = "phone:";
-
- return uri;
- }
-
- /**
- * According to JAXR Javadoc, there are two types of classification, internal and external and they use the Classification, Concept,
- * and ClassificationScheme objects. It seems the only difference between internal and external (as related to UDDI) is that the
- * name/value pair of the categorization is held in the Concept for internal classifications and the Classification for external (bypassing
- * the Concept entirely).
- *
- * The translation to UDDI is simple. Relevant objects have a category bag which contains a bunch of KeyedReferences (name/value pairs).
- * These KeyedReferences optionally refer to a tModel that identifies the type of category (translates to the ClassificationScheme key). If
- * this is set and the tModel doesn't exist in the UDDI registry, then an invalid key error will occur when trying to save the object.
- *
+ private static String getToken(String tokenstr) {
+ // Token can have the value NULL which need to be converted into null
+ if (tokenstr.equals("NULL")) {
+ tokenstr = "";
+ }
+ return tokenstr;
+ }
+
+ private static String getUseType(String accessuri) {
+ String acc = accessuri.toLowerCase();
+ String uri = "other";
+ if (acc.startsWith("http:")) {
+ uri = "http:";
+ } else if (acc.startsWith("https:")) {
+ uri = "https:";
+ } else if (acc.startsWith("ftp:")) {
+ uri = "ftp:";
+ } else if (acc.startsWith("phone:")) {
+ uri = "phone:";
+ }
+
+ return uri;
+ }
+
+ /**
+ * According to JAXR Javadoc, there are two types of classification,
+ * internal and external and they use the Classification, Concept, and
+ * ClassificationScheme objects. It seems the only difference between
+ * internal and external (as related to UDDI) is that the name/value pair of
+ * the categorization is held in the Concept for internal classifications
+ * and the Classification for external (bypassing the Concept entirely).
+ *
+ * The translation to UDDI is simple. Relevant objects have a category bag
+ * which contains a bunch of KeyedReferences (name/value pairs). These
+ * KeyedReferences optionally refer to a tModel that identifies the type of
+ * category (translates to the ClassificationScheme key). If this is set and
+ * the tModel doesn't exist in the UDDI registry, then an invalid key error
+ * will occur when trying to save the object.
+ *
* @param classifications classifications to turn into categories
* @throws JAXRException
*/
- public static CategoryBag getCategoryBagFromClassifications(Collection classifications) throws JAXRException {
- try {
- if (classifications == null || classifications.size()==0)
- return null;
-
- // Classifications
- CategoryBag cbag = objectFactory.createCategoryBag();
- Iterator classiter = classifications.iterator();
- while (classiter.hasNext()) {
- Classification classification = (Classification) classiter.next();
- if (classification != null ) {
- KeyedReference keyr = objectFactory.createKeyedReference();
- cbag.getKeyedReference().add(keyr);
-
- InternationalStringImpl iname = null;
- String value = null;
- ClassificationScheme scheme = classification.getClassificationScheme();
- if (scheme==null || (classification.isExternal() && classification.getConcept()==null)) {
+ public static CategoryBag getCategoryBagFromClassifications(Collection classifications) throws JAXRException {
+ try {
+ if (classifications == null || classifications.size() == 0) {
+ return null;
+ }
+
+ // Classifications
+ CategoryBag cbag = objectFactory.createCategoryBag();
+ Iterator classiter = classifications.iterator();
+ while (classiter.hasNext()) {
+ Classification classification = (Classification) classiter.next();
+ if (classification != null) {
+ KeyedReference keyr = objectFactory.createKeyedReference();
+ cbag.getKeyedReference().add(keyr);
+
+ InternationalStringImpl iname = null;
+ String value = null;
+ ClassificationScheme scheme = classification.getClassificationScheme();
+ if (scheme == null || (classification.isExternal() && classification.getConcept() == null)) {
/*
* JAXR 1.0 Specification: Section D6.4.4
* Specification related tModels mapped from Concept may be automatically
* categorized by the well-known uddi-org:types taxonomy in UDDI (with
* tModelKey uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4) as follows:
* The keyed reference is assigned a taxonomy value of specification.
- */
+ */
keyr.setTModelKey(UDDI_ORG_TYPES);
- keyr.setKeyValue("specification");
+ keyr.setKeyValue("specification");
} else {
- if (classification.isExternal()) {
+ if (classification.isExternal()) {
iname = (InternationalStringImpl) ((RegistryObject) classification).getName();
value = classification.getValue();
- } else {
- Concept concept = classification.getConcept();
- if (concept != null) {
- iname = (InternationalStringImpl) ((RegistryObject) concept).getName();
- value = concept.getValue();
- scheme = concept.getClassificationScheme();
- }
- }
-
- String name = iname.getValue();
- if (name != null)
- keyr.setKeyName(name);
-
- if (value != null)
- keyr.setKeyValue(value);
-
- if (scheme != null) {
- Key key = scheme.getKey();
- if (key != null && key.getId() != null)
- keyr.setTModelKey(key.getId());
- }
- }
+ } else {
+ Concept concept = classification.getConcept();
+ if (concept != null) {
+ iname = (InternationalStringImpl) ((RegistryObject) concept).getName();
+ value = concept.getValue();
+ scheme = concept.getClassificationScheme();
+ }
+ }
+
+ String name = iname.getValue();
+ if (name != null) {
+ keyr.setKeyName(name);
+ }
+
+ if (value != null) {
+ keyr.setKeyValue(value);
+ }
+
+ if (scheme != null) {
+ Key key = scheme.getKey();
+ if (key != null && key.getId() != null) {
+ keyr.setTModelKey(key.getId());
+ }
+ }
+ }
}
- }
- if (cbag.getKeyedReference().isEmpty()) return null;
- else return cbag;
- } catch (Exception ud) {
- throw new JAXRException("Apache JAXR Impl:", ud);
- }
+ }
+ if (cbag.getKeyedReference().isEmpty()) {
+ return null;
+ } else {
+ return cbag;
+ }
+ } catch (Exception ud) {
+ throw new JAXRException("Apache JAXR Impl:", ud);
+ }
}
- public static TModelBag getTModelBagFromSpecifications(Collection specifications) throws JAXRException {
- try {
- if (specifications == null || specifications.size()==0)
- return null;
-
- // Classifications
- TModelBag tbag = objectFactory.createTModelBag();
- Iterator speciter = specifications.iterator();
- while (speciter.hasNext()) {
- RegistryObject registryobject = (RegistryObject) speciter.next();
- if (registryobject instanceof Concept) {
- Concept concept = (Concept) registryobject;
- if (concept.getKey() != null) {
- tbag.getTModelKey().add(concept.getKey().toString());
- }
+ public static TModelBag getTModelBagFromSpecifications(Collection specifications) throws JAXRException {
+ try {
+ if (specifications == null || specifications.size() == 0) {
+ return null;
+ }
+
+ // Classifications
+ TModelBag tbag = objectFactory.createTModelBag();
+ Iterator speciter = specifications.iterator();
+ while (speciter.hasNext()) {
+ RegistryObject registryobject = (RegistryObject) speciter.next();
+ if (registryobject instanceof Concept) {
+ Concept concept = (Concept) registryobject;
+ if (concept.getKey() != null) {
+ tbag.getTModelKey().add(concept.getKey().toString());
+ }
// SpecificationLink specificationlink = (SpecificationLink) registryobject;
// if (specificationlink.getSpecificationObject() != null) {
// RegistryObject ro = specificationlink.getSpecificationObject();
@@ -868,91 +900,96 @@ public class ScoutJaxrUddiV3Helper
// tbag.getTModelKey().add(key.toString());
// }
// }
- } else {
- log.info("ebXML case - the RegistryObject is an ExtrinsicObject, Not implemented");
- }
- }
- if (tbag.getTModelKey().isEmpty()) return null;
- else return tbag;
- } catch (Exception ud) {
- throw new JAXRException("Apache JAXR Impl:", ud);
- }
+ } else {
+ log.info("ebXML case - the RegistryObject is an ExtrinsicObject, Not implemented");
+ }
+ }
+ if (tbag.getTModelKey().isEmpty()) {
+ return null;
+ } else {
+ return tbag;
+ }
+ } catch (Exception ud) {
+ throw new JAXRException("Apache JAXR Impl:", ud);
+ }
}
-
- /**
+ /**
* Adds the objects identifiers from JAXR's external identifier collection
- *
+ *
* @param identifiers external identifiers to turn into identifiers
* @throws JAXRException
*/
- public static IdentifierBag getIdentifierBagFromExternalIdentifiers(Collection identifiers) throws JAXRException {
- try {
- if (identifiers == null || identifiers.size()==0)
- return null;
-
- // Identifiers
- IdentifierBag ibag = objectFactory.createIdentifierBag();
- Iterator iditer = identifiers.iterator();
- while (iditer.hasNext()) {
- ExternalIdentifier extid = (ExternalIdentifier) iditer.next();
- if (extid != null ) {
- KeyedReference keyr = objectFactory.createKeyedReference();
- ibag.getKeyedReference().add(keyr);
-
- InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) extid).getName();
- String value = extid.getValue();
- ClassificationScheme scheme = extid.getIdentificationScheme();
-
- String name = iname.getValue();
- if (name != null)
- keyr.setKeyName(name);
-
- if (value != null)
- keyr.setKeyValue(value);
-
- if (scheme != null) {
- Key key = scheme.getKey();
- if (key != null && key.getId() != null)
- keyr.setTModelKey(key.getId());
- }
- }
- }
- return ibag;
- } catch (Exception ud) {
- throw new JAXRException("Apache JAXR Impl:", ud);
- }
+ public static IdentifierBag getIdentifierBagFromExternalIdentifiers(Collection identifiers) throws JAXRException {
+ try {
+ if (identifiers == null || identifiers.size() == 0) {
+ return null;
+ }
+
+ // Identifiers
+ IdentifierBag ibag = objectFactory.createIdentifierBag();
+ Iterator iditer = identifiers.iterator();
+ while (iditer.hasNext()) {
+ ExternalIdentifier extid = (ExternalIdentifier) iditer.next();
+ if (extid != null) {
+ KeyedReference keyr = objectFactory.createKeyedReference();
+ ibag.getKeyedReference().add(keyr);
+
+ InternationalStringImpl iname = (InternationalStringImpl) ((RegistryObject) extid).getName();
+ String value = extid.getValue();
+ ClassificationScheme scheme = extid.getIdentificationScheme();
+
+ String name = iname.getValue();
+ if (name != null) {
+ keyr.setKeyName(name);
+ }
+
+ if (value != null) {
+ keyr.setKeyValue(value);
+ }
+
+ if (scheme != null) {
+ Key key = scheme.getKey();
+ if (key != null && key.getId() != null) {
+ keyr.setTModelKey(key.getId());
+ }
+ }
+ }
+ }
+ return ibag;
+ } catch (Exception ud) {
+ throw new JAXRException("Apache JAXR Impl:", ud);
+ }
}
-
+
private static OverviewDoc getOverviewDocFromExternalLink(ExternalLink link)
- throws JAXRException
- {
- OverviewDoc od = objectFactory.createOverviewDoc();
- String url = link.getExternalURI();
- if(url != null) {
- org.uddi.api_v3.OverviewURL ourl = new org.uddi.api_v3.OverviewURL();
- ourl.setValue(url.toString());
- od.setOverviewURL(ourl);
- }
- InternationalString extDesc = link.getDescription();
- if(extDesc != null) {
- Description description = objectFactory.createDescription();
- od.getDescription().add(description);
- description.setValue(extDesc.getValue());
- }
- return od;
- }
+ throws JAXRException {
+ OverviewDoc od = objectFactory.createOverviewDoc();
+ String url = link.getExternalURI();
+ if (url != null) {
+ org.uddi.api_v3.OverviewURL ourl = new org.uddi.api_v3.OverviewURL();
+ ourl.setValue(url.toString());
+ od.setOverviewURL(ourl);
+ }
+ InternationalString extDesc = link.getDescription();
+ if (extDesc != null) {
+ Description description = objectFactory.createDescription();
+ od.getDescription().add(description);
+ description.setValue(extDesc.getValue());
+ }
+ return od;
+ }
private static BindingTemplates getBindingTemplates(Collection serviceBindings)
- throws JAXRException {
+ throws JAXRException {
BindingTemplates bt = null;
- if(serviceBindings != null && serviceBindings.size() > 0) {
+ if (serviceBindings != null && serviceBindings.size() > 0) {
bt = objectFactory.createBindingTemplates();
Iterator iter = serviceBindings.iterator();
int currLoc = 0;
BindingTemplate[] bindingTemplateArray = new BindingTemplate[serviceBindings.size()];
- while(iter.hasNext()) {
- ServiceBinding sb = (ServiceBinding)iter.next();
+ while (iter.hasNext()) {
+ ServiceBinding sb = (ServiceBinding) iter.next();
bindingTemplateArray[currLoc] = getBindingTemplateFromJAXRSB(sb);
currLoc++;
}
@@ -960,6 +997,6 @@ public class ScoutJaxrUddiV3Helper
bt.getBindingTemplate().addAll(Arrays.asList(bindingTemplateArray));
}
}
- return bt;
+ return bt;
}
}
http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/main/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java b/src/main/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
index 13e56e3..5093b25 100644
--- a/src/main/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
+++ b/src/main/java/org/apache/ws/scout/util/ScoutUddiJaxrHelper.java
@@ -319,7 +319,7 @@ public class ScoutUddiJaxrHelper
PostalAddress pa = new PostalAddressImpl();
HashMap<String, String> hm = new HashMap<String, String>();
for (AddressLine anAddressLineArr : addressLineArr) {
- hm.put(anAddressLineArr.getKeyName(), anAddressLineArr.getKeyValue());
+ hm.put(anAddressLineArr.getKeyValue(), anAddressLineArr.getValue());
}
if (hm.containsKey("STREET_NUMBER")) {
http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/main/java/org/apache/ws/scout/util/ScoutUddiV3JaxrHelper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/ws/scout/util/ScoutUddiV3JaxrHelper.java b/src/main/java/org/apache/ws/scout/util/ScoutUddiV3JaxrHelper.java
index 2455950..f1f26d4 100644
--- a/src/main/java/org/apache/ws/scout/util/ScoutUddiV3JaxrHelper.java
+++ b/src/main/java/org/apache/ws/scout/util/ScoutUddiV3JaxrHelper.java
@@ -303,7 +303,7 @@ public class ScoutUddiV3JaxrHelper
PostalAddress pa = new PostalAddressImpl();
HashMap<String, String> hm = new HashMap<String, String>();
for (AddressLine anAddressLineArr : addressLineArr) {
- hm.put(anAddressLineArr.getKeyName(), anAddressLineArr.getValue());
+ hm.put(anAddressLineArr.getKeyValue(), anAddressLineArr.getValue());
}
if (hm.containsKey("STREET_NUMBER")) {
http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/site/site.xml
----------------------------------------------------------------------
diff --git a/src/site/site.xml b/src/site/site.xml
index 704960a..8cc79c8 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -19,7 +19,8 @@
-->
<project name="Apache Scout">
-
+
+ <version position="right"/>
<bannerLeft>
<name>Apache Scout</name>
<src>images/juddi_logo_v3.png</src>
@@ -28,11 +29,27 @@
<bannerRight>
<src>images/scout.jpg</src>
</bannerRight>
- <skin>
- <groupId>org.apache.maven.skins</groupId>
- <artifactId>maven-default-skin</artifactId>
- <version>1.0</version>
- </skin>
+ <skin>
+ <groupId>org.apache.maven.skins</groupId>
+ <artifactId>maven-fluido-skin</artifactId>
+ <version>1.6</version>
+ </skin>
+ <custom>
+ <fluidoSkin>
+ <googleSearch>
+ <sitesearch/>
+ </googleSearch>
+ <sourceLineNumbersEnabled>true</sourceLineNumbersEnabled>
+ <gitHub>
+ <projectId>apache/maven-skins</projectId>
+ <ribbonOrientation>right</ribbonOrientation>
+ <ribbonColor>black</ribbonColor>
+ <projectId>apache/juddi</projectId>
+ </gitHub>
+ <topBarEnabled>true</topBarEnabled>
+ <sideBarEnabled>true</sideBarEnabled>
+ </fluidoSkin>
+ </custom>
<publishDate format="dd MMM yyyy" position="right"/>
@@ -52,7 +69,7 @@
<item name="Wiki" href="http://wiki.apache.org/juddi/scout"/>
</menu>
<menu name="Related Projects">
- <item name="Apache jUDDI" href="http://juddi.apache.org/" description="Apache jUDDI"/>
+ <item name="Apache jUDDI" href="http://juddi.apache.org/" />
</menu>
<menu ref="reports"/>
http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/site/xdoc/releases.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/releases.xml b/src/site/xdoc/releases.xml
index b88947b..37681e4 100644
--- a/src/site/xdoc/releases.xml
+++ b/src/site/xdoc/releases.xml
@@ -16,6 +16,11 @@
<td><strong>Date</strong></td>
<td><strong>Description</strong></td>
</tr>
+ <tr>
+ <td><a href="https://repository.apache.org/content/groups/public/org/apache/juddi/scout/scout/1.2.6/">scout-1.2.6</a></td>
+ <td>Nov 30, 2012</td>
+ <td>Version 1.2.7 of Scout, stable release</td>
+ </tr>
<tr>
<td><a href="https://repository.apache.org/content/groups/public/org/apache/juddi/scout/scout/1.2.6/">scout-1.2.6</a></td>
<td>March 6, 2012</td>
http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/test/java/org/apache/ws/scout/Finder.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/ws/scout/Finder.java b/src/test/java/org/apache/ws/scout/Finder.java
index 0c6802c..d2fd790 100644
--- a/src/test/java/org/apache/ws/scout/Finder.java
+++ b/src/test/java/org/apache/ws/scout/Finder.java
@@ -177,7 +177,6 @@ public class Finder
{
Collection<ServiceBinding> serviceBindings=null;
Collection<String> findQualifiers = new ArrayList<String>();
- findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
Collection<Classification> classifications = new ArrayList<Classification>();
classifications.add(classification);
BulkResponse bulkResponse = bqm.findServiceBindings(serviceKey,findQualifiers,classifications,null);
@@ -194,7 +193,6 @@ public class Finder
{
Collection<ServiceBinding> serviceBindings=null;
Collection<String> findQualifiers = new ArrayList<String>();
- findQualifiers.add(FindQualifier.SORT_BY_NAME_ASC);
Collection<SpecificationLink> specifications = new ArrayList<SpecificationLink>();
specifications.add(specLink);
BulkResponse bulkResponse = bqm.findServiceBindings(serviceKey,findQualifiers,null,specifications);
http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java b/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java
index 7a762ac..0f2f78d 100644
--- a/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java
+++ b/src/test/java/org/apache/ws/scout/registry/qa/JAXR010OrganizationTest.java
@@ -16,25 +16,30 @@
*/
package org.apache.ws.scout.registry.qa;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import javax.xml.registry.BulkResponse;
+import javax.xml.registry.FindQualifier;
import javax.xml.registry.JAXRException;
import javax.xml.registry.JAXRResponse;
+import static javax.xml.registry.LifeCycleManager.PERSON_NAME;
import javax.xml.registry.RegistryService;
import javax.xml.registry.infomodel.Classification;
import javax.xml.registry.infomodel.ClassificationScheme;
+import javax.xml.registry.infomodel.EmailAddress;
import javax.xml.registry.infomodel.Key;
import javax.xml.registry.infomodel.Organization;
+import javax.xml.registry.infomodel.PersonName;
+import javax.xml.registry.infomodel.PostalAddress;
import javax.xml.registry.infomodel.Service;
import javax.xml.registry.infomodel.ServiceBinding;
+import javax.xml.registry.infomodel.TelephoneNumber;
+import javax.xml.registry.infomodel.User;
import junit.framework.JUnit4TestAdapter;
@@ -43,13 +48,23 @@ import org.apache.ws.scout.Creator;
import org.apache.ws.scout.Finder;
import org.apache.ws.scout.Printer;
import org.apache.ws.scout.Remover;
+import static org.apache.ws.scout.registry.qa.JAXR015PrimaryContactTest.CITY;
+import static org.apache.ws.scout.registry.qa.JAXR015PrimaryContactTest.COUNTRY;
+import static org.apache.ws.scout.registry.qa.JAXR015PrimaryContactTest.EMAIL;
+import static org.apache.ws.scout.registry.qa.JAXR015PrimaryContactTest.PHONE_NUMBER;
+import static org.apache.ws.scout.registry.qa.JAXR015PrimaryContactTest.POSTAL_CODE;
+import static org.apache.ws.scout.registry.qa.JAXR015PrimaryContactTest.STATE;
+import static org.apache.ws.scout.registry.qa.JAXR015PrimaryContactTest.STREET;
+import static org.apache.ws.scout.registry.qa.JAXR015PrimaryContactTest.STREET_NUMBER;
import org.junit.After;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.Test;
/**
* Test to check Jaxr Publish
- * Open source UDDI Browser <http://www.uddibrowser.org>
+ * Open source UDDI Browser http://www.uddibrowser.org or using the juddi-gui project
* can be used to check your results
* @author <ma...@apache.org>Anil Saldhana
* @since Nov 20, 2004
@@ -57,15 +72,42 @@ import org.junit.Test;
public class JAXR010OrganizationTest extends BaseTestCase
{
@Before
- public void setUp()
- {
+ public void setUp() {
super.setUp();
+ login();
+ try {
+ RegistryService rs = connection.getRegistryService();
+ bqm = rs.getBusinessQueryManager();
+ blm = rs.getBusinessLifeCycleManager();
+ ClassificationScheme cScheme = blm.createClassificationScheme("org.jboss.soa.esb.:testcategory", "JBossESB Classification Scheme");
+ ArrayList<ClassificationScheme> cSchemes = new ArrayList<ClassificationScheme>();
+ cSchemes.add(cScheme);
+ BulkResponse br = blm.saveClassificationSchemes(cSchemes);
+ assertEquals(JAXRResponse.STATUS_SUCCESS, br.getStatus());
+ } catch (Exception je) {
+ je.printStackTrace();
+ fail(je.getMessage());
+ }
}
-
+
@After
- public void tearDown()
- {
- super.tearDown();
+ public void tearDown() {
+ super.tearDown();
+ login();
+ try {
+ RegistryService rs = connection.getRegistryService();
+ bqm = rs.getBusinessQueryManager();
+ blm = rs.getBusinessLifeCycleManager();
+ Collection<String> findQualifiers = new ArrayList<String>();
+ findQualifiers.add(FindQualifier.AND_ALL_KEYS);
+ //findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
+ ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, "org.jboss.soa.esb.:testcategory");
+ Remover remover = new Remover(blm);
+ remover.removeClassificationScheme(cScheme);
+ } catch (Exception je) {
+ je.printStackTrace();
+ fail(je.getMessage());
+ }
}
@Test
@@ -136,11 +178,13 @@ public class JAXR010OrganizationTest extends BaseTestCase
System.err.println("JAXRExceptions " +
"occurred during save:");
Collection exceptions = br.getExceptions();
- Iterator iter = exceptions.iterator();
- while (iter.hasNext())
- {
- Exception e = (Exception) iter.next();
- System.err.println(e.toString());
+ if (exceptions!=null) {
+ Iterator iter = exceptions.iterator();
+ while (iter.hasNext())
+ {
+ Exception e = (Exception) iter.next();
+ System.err.println(e.toString());
+ }
}
}
@@ -157,18 +201,60 @@ public class JAXR010OrganizationTest extends BaseTestCase
login();
try
{
- // Get registry service and business query manager
RegistryService rs = connection.getRegistryService();
+ blm = rs.getBusinessLifeCycleManager();
+ bqm = rs.getBusinessQueryManager();
+ Creator creator = new Creator(blm);
+ Finder finder = new Finder(bqm, uddiversion);
+
+ Collection<Organization> orgs = new ArrayList<Organization>();
+ Organization organization = creator.createOrganization(this.getClass().getName());
+// Add a Service
+ Service service = creator.createService(this.getClass().getName());
+ ServiceBinding serviceBinding = creator.createServiceBinding();
+ service.addServiceBinding(serviceBinding);
+ organization.addService(service);
+
+
+ User user = blm.createUser();
+ PersonName personName = blm.createPersonName(PERSON_NAME);
+ TelephoneNumber telephoneNumber = blm.createTelephoneNumber();
+ telephoneNumber.setNumber(PHONE_NUMBER);
+ telephoneNumber.setType(null);
+ PostalAddress address = blm.createPostalAddress(STREET_NUMBER,
+ STREET, CITY, STATE, COUNTRY, POSTAL_CODE, "");
+
+ Collection<PostalAddress> postalAddresses = new ArrayList<PostalAddress>();
+ postalAddresses.add(address);
+ Collection<EmailAddress> emailAddresses = new ArrayList<EmailAddress>();
+ EmailAddress emailAddress = blm.createEmailAddress(EMAIL);
+ emailAddresses.add(emailAddress);
+
+ Collection<TelephoneNumber> numbers = new ArrayList<TelephoneNumber>();
+ numbers.add(telephoneNumber);
+ user.setPersonName(personName);
+ user.setPostalAddresses(postalAddresses);
+ user.setEmailAddresses(emailAddresses);
+ user.setTelephoneNumbers(numbers);
+ organization.setPrimaryContact(user);
+
+ orgs.add(organization);
+
+ //Now save the Organization along with a Service, ServiceBinding and Classification
+ BulkResponse br = blm.saveOrganizations(orgs);
+
+ // Get registry service and business query manager
+ rs = connection.getRegistryService();
bqm = rs.getBusinessQueryManager();
System.out.println("We have the Business Query Manager");
Printer printer = new Printer();
- Finder finder = new Finder(bqm, uddiversion);
+ finder = new Finder(bqm, uddiversion);
- Collection orgs = finder.findOrganizationsByName(this.getClass().getName());
+ orgs = finder.findOrganizationsByName(this.getClass().getName());
if (orgs == null) {
fail("Only Expecting 1 Organization");
} else {
- assertEquals(1,orgs.size());
+ assertTrue(orgs.size()>=1);
// then step through them
for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)
{
http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/test/java/org/apache/ws/scout/registry/qa/JAXR015PrimaryContactTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/ws/scout/registry/qa/JAXR015PrimaryContactTest.java b/src/test/java/org/apache/ws/scout/registry/qa/JAXR015PrimaryContactTest.java
index 6fc7668..d0fd0e6 100644
--- a/src/test/java/org/apache/ws/scout/registry/qa/JAXR015PrimaryContactTest.java
+++ b/src/test/java/org/apache/ws/scout/registry/qa/JAXR015PrimaryContactTest.java
@@ -26,6 +26,7 @@ import java.util.Collection;
import java.util.Iterator;
import javax.xml.registry.BulkResponse;
+import javax.xml.registry.FindQualifier;
import javax.xml.registry.JAXRException;
import javax.xml.registry.JAXRResponse;
import javax.xml.registry.RegistryService;
@@ -49,76 +50,101 @@ import org.apache.ws.scout.Finder;
import org.apache.ws.scout.Printer;
import org.apache.ws.scout.Remover;
import org.junit.After;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
import org.junit.Before;
import org.junit.Test;
/**
* Test to check that the primary contact is added
+ *
* @author <a href="mailto:tcunning@redhat.com">Tom Cunningham</a>
* @since Dec 6, 2007
*/
-public class JAXR015PrimaryContactTest extends BaseTestCase
-{
- private static final String PERSON_NAME = "John AXel Rose";
- private static final String PHONE_NUMBER = "111-222-3333";
- private static final String STREET_NUMBER = "1";
- private static final String STREET = "Uddi Drive";
- private static final String CITY = "Apache Town";
- private static final String STATE = "CA";
- private static final String COUNTRY = "USA";
- private static final String POSTAL_CODE = "00000-1111";
-
- private static final String EMAIL = "jaxr@apache.org";
+public class JAXR015PrimaryContactTest extends BaseTestCase {
+
+ public static final String PERSON_NAME = "John AXel Rose";
+ public static final String PHONE_NUMBER = "111-222-3333";
+ public static final String STREET_NUMBER = "1";
+ public static final String STREET = "Uddi Drive";
+ public static final String CITY = "Apache Town";
+ public static final String STATE = "CA";
+ public static final String COUNTRY = "USA";
+ public static final String POSTAL_CODE = "00000-1111";
+
+ public static final String EMAIL = "jaxr@apache.org";
@Before
- public void setUp()
- {
+ public void setUp() {
super.setUp();
+ login();
+ try {
+ RegistryService rs = connection.getRegistryService();
+ bqm = rs.getBusinessQueryManager();
+ blm = rs.getBusinessLifeCycleManager();
+ ClassificationScheme cScheme = blm.createClassificationScheme("org.jboss.soa.esb.:testcategory", "JBossESB Classification Scheme");
+ ArrayList<ClassificationScheme> cSchemes = new ArrayList<ClassificationScheme>();
+ cSchemes.add(cScheme);
+ BulkResponse br = blm.saveClassificationSchemes(cSchemes);
+ assertEquals(JAXRResponse.STATUS_SUCCESS, br.getStatus());
+ } catch (Exception je) {
+ je.printStackTrace();
+ fail(je.getMessage());
+ }
}
-
+
@After
- public void tearDown()
- {
- super.tearDown();
+ public void tearDown() {
+ super.tearDown();
+ login();
+ try {
+ RegistryService rs = connection.getRegistryService();
+ bqm = rs.getBusinessQueryManager();
+ blm = rs.getBusinessLifeCycleManager();
+ Collection<String> findQualifiers = new ArrayList<String>();
+ findQualifiers.add(FindQualifier.AND_ALL_KEYS);
+ //findQualifiers.add(FindQualifier.SORT_BY_NAME_DESC);
+ ClassificationScheme cScheme = bqm.findClassificationSchemeByName(findQualifiers, "org.jboss.soa.esb.:testcategory");
+ Remover remover = new Remover(blm);
+ remover.removeClassificationScheme(cScheme);
+ } catch (Exception je) {
+ je.printStackTrace();
+ fail(je.getMessage());
+ }
}
-
- @Test
- public void publishClassificationScheme()
- {
+
+ @Test
+ public void publishClassificationScheme() {
login();
- try
- {
+ try {
RegistryService rs = connection.getRegistryService();
blm = rs.getBusinessLifeCycleManager();
Creator creator = new Creator(blm);
-
+
Collection<ClassificationScheme> schemes = new ArrayList<ClassificationScheme>();
ClassificationScheme classificationScheme = creator.createClassificationScheme(this.getClass().getName());
schemes.add(classificationScheme);
-
+
BulkResponse bulkResponse = blm.saveClassificationSchemes(schemes);
- assertEquals(JAXRResponse.STATUS_SUCCESS,bulkResponse.getStatus());
-
-
+ assertEquals(JAXRResponse.STATUS_SUCCESS, bulkResponse.getStatus());
+
} catch (JAXRException e) {
e.printStackTrace();
assertTrue(false);
- }
+ }
}
-
+
@Test
- public void publishOrganization()
- {
+ public void publishOrganization() {
BulkResponse response = null;
login();
- try
- {
+ try {
RegistryService rs = connection.getRegistryService();
blm = rs.getBusinessLifeCycleManager();
bqm = rs.getBusinessQueryManager();
Creator creator = new Creator(blm);
Finder finder = new Finder(bqm, uddiversion);
-
+
Collection<Organization> orgs = new ArrayList<Organization>();
Organization organization = creator.createOrganization(this.getClass().getName());
// Add a Service
@@ -130,14 +156,14 @@ public class JAXR015PrimaryContactTest extends BaseTestCase
ClassificationScheme cs = finder.findClassificationSchemeByName(this.getClass().getName());
Classification classification = creator.createClassification(cs);
organization.addClassification(classification);
-
+
User user = blm.createUser();
PersonName personName = blm.createPersonName(PERSON_NAME);
TelephoneNumber telephoneNumber = blm.createTelephoneNumber();
telephoneNumber.setNumber(PHONE_NUMBER);
telephoneNumber.setType(null);
PostalAddress address = blm.createPostalAddress(STREET_NUMBER,
- STREET, CITY, STATE, COUNTRY, POSTAL_CODE, "");
+ STREET, CITY, STATE, COUNTRY, POSTAL_CODE, "");
Collection<PostalAddress> postalAddresses = new ArrayList<PostalAddress>();
postalAddresses.add(address);
@@ -153,99 +179,136 @@ public class JAXR015PrimaryContactTest extends BaseTestCase
user.setTelephoneNumbers(numbers);
organization.setPrimaryContact(user);
- orgs.add(organization);
-
+ orgs.add(organization);
+
//Now save the Organization along with a Service, ServiceBinding and Classification
BulkResponse br = blm.saveOrganizations(orgs);
- if (br.getStatus() == JAXRResponse.STATUS_SUCCESS)
- {
+ if (br.getStatus() == JAXRResponse.STATUS_SUCCESS) {
System.out.println("Organization Saved");
Collection coll = br.getCollection();
Iterator iter = coll.iterator();
- while (iter.hasNext())
- {
+ while (iter.hasNext()) {
Key key = (Key) iter.next();
System.out.println("Saved Key=" + key.getId());
}//end while
- } else
- {
- System.err.println("JAXRExceptions " +
- "occurred during save:");
+ } else {
+ System.err.println("JAXRExceptions "
+ + "occurred during save:");
Collection exceptions = br.getExceptions();
- Iterator iter = exceptions.iterator();
- while (iter.hasNext())
- {
- Exception e = (Exception) iter.next();
- System.err.println(e.toString());
+ if (exceptions != null) {
+ Iterator iter = exceptions.iterator();
+ while (iter.hasNext()) {
+ Exception e = (Exception) iter.next();
+ System.err.println(e.toString());
+ }
}
}
-
+
} catch (JAXRException e) {
e.printStackTrace();
- assertTrue(false);
+ fail(e.getMessage());
}
assertNull(response);
}
-
+
@SuppressWarnings("unchecked")
@Test
- public void queryOrganization()
- {
+ public void queryOrganization() {
login();
- try
- {
- // Get registry service and business query manager
+ try {
+
RegistryService rs = connection.getRegistryService();
+ blm = rs.getBusinessLifeCycleManager();
+ bqm = rs.getBusinessQueryManager();
+ Creator creator = new Creator(blm);
+ Finder finder = new Finder(bqm, uddiversion);
+
+ Collection<Organization> orgs = new ArrayList<Organization>();
+ Organization organization = creator.createOrganization(this.getClass().getName());
+// Add a Service
+ Service service = creator.createService(this.getClass().getName());
+ ServiceBinding serviceBinding = creator.createServiceBinding();
+ service.addServiceBinding(serviceBinding);
+ organization.addService(service);
+
+
+ User user = blm.createUser();
+ PersonName personName = blm.createPersonName(PERSON_NAME);
+ TelephoneNumber telephoneNumber = blm.createTelephoneNumber();
+ telephoneNumber.setNumber(PHONE_NUMBER);
+ telephoneNumber.setType(null);
+ PostalAddress address = blm.createPostalAddress(STREET_NUMBER,
+ STREET, CITY, STATE, COUNTRY, POSTAL_CODE, "");
+
+ Collection<PostalAddress> postalAddresses = new ArrayList<PostalAddress>();
+ postalAddresses.add(address);
+ Collection<EmailAddress> emailAddresses = new ArrayList<EmailAddress>();
+ EmailAddress emailAddress = blm.createEmailAddress(EMAIL);
+ emailAddresses.add(emailAddress);
+
+ Collection<TelephoneNumber> numbers = new ArrayList<TelephoneNumber>();
+ numbers.add(telephoneNumber);
+ user.setPersonName(personName);
+ user.setPostalAddresses(postalAddresses);
+ user.setEmailAddresses(emailAddresses);
+ user.setTelephoneNumbers(numbers);
+ organization.setPrimaryContact(user);
+
+ orgs.add(organization);
+
+ //Now save the Organization along with a Service, ServiceBinding and Classification
+ BulkResponse br = blm.saveOrganizations(orgs);
+
+
bqm = rs.getBusinessQueryManager();
System.out.println("We have the Business Query Manager");
Printer printer = new Printer();
- Finder finder = new Finder(bqm, uddiversion);
+ finder = new Finder(bqm, uddiversion);
- Collection orgs = finder.findOrganizationsByName(this.getClass().getName());
+ orgs = finder.findOrganizationsByName(this.getClass().getName());
if (orgs == null) {
fail("Only Expecting 1 Organization");
} else {
- assertEquals(1,orgs.size());
+ assertTrue(orgs.size() >= 1);
// then step through them
- for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)
- {
+ for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();) {
Organization org = (Organization) orgIter.next();
System.out.println("Org name: " + printer.getName(org));
System.out.println("Org description: " + printer.getDescription(org));
System.out.println("Org key id: " + printer.getKey(org));
- User user = org.getPrimaryContact();
+ user = org.getPrimaryContact();
System.out.println("Primary Contact Full Name : " + user.getPersonName().getFullName());
- assertEquals("User name does not match", user.getPersonName().getFullName(), PERSON_NAME);
-
- Collection<EmailAddress> emailAddresses = user.getEmailAddresses();
- System.out.println("Found " + emailAddresses.size() + " email addresses.");
+ assertEquals("User name does not match", user.getPersonName().getFullName(), PERSON_NAME);
+
+ emailAddresses = user.getEmailAddresses();
+ System.out.println("Found " + emailAddresses.size() + " email addresses.");
assertEquals("Should have found 1 email address, found " + emailAddresses.size(), 1, emailAddresses.size());
- for (EmailAddress email : emailAddresses) {
- System.out.println("Primary Contact email : " + email.getAddress());
- assertEquals("Email should be " + EMAIL, EMAIL, email.getAddress());
+ for (EmailAddress email : emailAddresses) {
+ System.out.println("Primary Contact email : " + email.getAddress());
+ assertEquals("Email should be " + EMAIL, EMAIL, email.getAddress());
}
-
- Collection<PostalAddress> postalAddresses = user.getPostalAddresses();
- System.out.println("Found " + postalAddresses.size() + " postal addresses.");
+
+ postalAddresses = user.getPostalAddresses();
+ System.out.println("Found " + postalAddresses.size() + " postal addresses.");
assertEquals("Should have found 1 postal address, found " + postalAddresses.size(), 1, postalAddresses.size());
- for (PostalAddress postalAddress : postalAddresses) {
- System.out.println("Postal Address is " + postalAddress);
- assertEquals("Street number should be " + STREET_NUMBER, STREET_NUMBER, postalAddress.getStreetNumber());
- assertEquals("Street should be " + STREET, STREET, postalAddress.getStreet());
- assertEquals("City should be " + CITY, CITY, postalAddress.getCity());
- assertEquals("State should be " + STATE, STATE, postalAddress.getStateOrProvince());
- assertEquals("Country should be " + COUNTRY, COUNTRY, postalAddress.getCountry());
- assertEquals("Postal code should be " + POSTAL_CODE, POSTAL_CODE, postalAddress.getPostalCode());
+ for (PostalAddress postalAddress : postalAddresses) {
+ System.out.println("Postal Address is " + postalAddress);
+ assertEquals("Street number should be " + STREET_NUMBER, STREET_NUMBER, postalAddress.getStreetNumber());
+ assertEquals("Street should be " + STREET, STREET, postalAddress.getStreet());
+ assertEquals("City should be " + CITY, CITY, postalAddress.getCity());
+ assertEquals("State should be " + STATE, STATE, postalAddress.getStateOrProvince());
+ assertEquals("Country should be " + COUNTRY, COUNTRY, postalAddress.getCountry());
+ assertEquals("Postal code should be " + POSTAL_CODE, POSTAL_CODE, postalAddress.getPostalCode());
}
-
- Collection<TelephoneNumber> numbers = user.getTelephoneNumbers(null);
- System.out.println("Found " + numbers.size() + " telephone numbers.");
+
+ numbers = user.getTelephoneNumbers(null);
+ System.out.println("Found " + numbers.size() + " telephone numbers.");
assertEquals("Should have found 1 phone number, found " + numbers.size(), 1, numbers.size());
- for (TelephoneNumber tele : numbers) {
- System.out.println("Phone number is " + tele.getNumber());
- assertEquals("Telephone number should be " + PHONE_NUMBER, PHONE_NUMBER, tele.getNumber());
- }
+ for (TelephoneNumber tele : numbers) {
+ System.out.println("Phone number is " + tele.getNumber());
+ assertEquals("Telephone number should be " + PHONE_NUMBER, PHONE_NUMBER, tele.getNumber());
+ }
printer.printServices(org);
printer.printClassifications(org);
}
@@ -253,38 +316,34 @@ public class JAXR015PrimaryContactTest extends BaseTestCase
} catch (JAXRException e) {
e.printStackTrace();
fail(e.getMessage());
- }
+ }
}
-
+
@Test
- public void deleteOrganization()
- {
+ public void deleteOrganization() {
login();
- try
- {
+ try {
RegistryService rs = connection.getRegistryService();
blm = rs.getBusinessLifeCycleManager();
- // Get registry service and business query manager
+ // Get registry service and business query manager
bqm = rs.getBusinessQueryManager();
System.out.println("We have the Business Query Manager");
Finder finder = new Finder(bqm, uddiversion);
Remover remover = new Remover(blm);
Collection orgs = finder.findOrganizationsByName(this.getClass().getName());
- for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();)
- {
+ for (Iterator orgIter = orgs.iterator(); orgIter.hasNext();) {
Organization org = (Organization) orgIter.next();
remover.removeOrganization(org);
}
-
+
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
-
+
@Test
- public void deleteClassificationScheme()
- {
+ public void deleteClassificationScheme() {
login();
try {
RegistryService rs = connection.getRegistryService();
@@ -294,18 +353,17 @@ public class JAXR015PrimaryContactTest extends BaseTestCase
Finder finder = new Finder(bqm, uddiversion);
Remover remover = new Remover(blm);
Collection schemes = finder.findClassificationSchemesByName(this.getClass().getName());
- for (Iterator iter = schemes.iterator(); iter.hasNext();)
- {
+ for (Iterator iter = schemes.iterator(); iter.hasNext();) {
ClassificationScheme scheme = (ClassificationScheme) iter.next();
remover.removeClassificationScheme(scheme);
}
-
+
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
-
+
public static junit.framework.Test suite() {
return new JUnit4TestAdapter(JAXR015PrimaryContactTest.class);
}
http://git-wip-us.apache.org/repos/asf/juddi-scout/blob/8836df0d/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java b/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java
index 848e060..73fa58c 100644
--- a/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java
+++ b/src/test/java/org/apache/ws/scout/registry/qa/JAXR030AssociationsTest.java
@@ -40,6 +40,7 @@ import junit.framework.JUnit4TestAdapter;
import org.apache.ws.scout.BaseTestCase;
import org.apache.ws.scout.Creator;
import org.junit.After;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@@ -117,6 +118,7 @@ public class JAXR030AssociationsTest extends BaseTestCase {
System.out.println("\nSearching for newly created organizations...\n");
ArrayList<Organization> newOrgs = findTempOrgs();
+ Assert.assertEquals(2, newOrgs.size());
sOrg = newOrgs.get(0);
tOrg = newOrgs.get(1);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org