Author: kstam
Date: Fri Feb  3 19:41:30 2012
New Revision: 1240311

URL: http://svn.apache.org/viewvc?rev=1240311&view=rev
Log:
SCOUT-106, SCOUT-107 fixing up the way the properties and passed in, with their 
default settings.

Modified:
    juddi/scout/trunk/pom.xml
    
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java
    
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionImpl.java
    
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java
    
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Impl.java
    juddi/scout/trunk/src/test/java/org/apache/ws/scout/BaseTestCase.java
    
juddi/scout/trunk/src/test/java/org/apache/ws/scout/registry/ConnectionFactoryTest.java
    juddi/scout/trunk/src/test/resources/scoutv3.properties

Modified: juddi/scout/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/juddi/scout/trunk/pom.xml?rev=1240311&r1=1240310&r2=1240311&view=diff
==============================================================================
--- juddi/scout/trunk/pom.xml (original)
+++ juddi/scout/trunk/pom.xml Fri Feb  3 19:41:30 2012
@@ -12,7 +12,7 @@
        <packaging>bundle</packaging>
 
        <properties>
-               <juddi.registry.version>3.1.2</juddi.registry.version>
+               <juddi.registry.version>3.1.3</juddi.registry.version>
        </properties>
 
        <prerequisites>

Modified: 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java?rev=1240311&r1=1240310&r2=1240311&view=diff
==============================================================================
--- 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java
 (original)
+++ 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionFactoryImpl.java
 Fri Feb  3 19:41:30 2012
@@ -17,15 +17,12 @@
 package org.apache.ws.scout.registry;
 
 import java.io.Serializable;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.Collection;
 import java.util.Properties;
 
 import javax.xml.registry.Connection;
 import javax.xml.registry.ConnectionFactory;
 import javax.xml.registry.FederatedConnection;
-import javax.xml.registry.InvalidRequestException;
 import javax.xml.registry.JAXRException;
 import javax.xml.registry.UnsupportedCapabilityException;
 
@@ -49,66 +46,24 @@ public class ConnectionFactoryImpl exten
        public static final String AUTHENTICATIONMETHOD_PROPERTY = 
"javax.xml.registry.security.authenticationMethod";
        public static final String MAXROWS_PROPERTY              = 
"javax.xml.registry.uddi.maxRows";
        
-       public static final String JUDDI_CLIENT_CONFIG_FILE      = 
"scout.juddi.client.config.file";
-       
-       public static final String DEFAULT_JUDDI_CLIENT_CONFIG_FILE = 
"META-INF/jaxr-uddi.xml";
-
-    private String queryManagerURL;
-    private String lifeCycleManagerURL;
-    private String securityManagerURL;
-    private String transportClass;
-    private String semanticEquivalences;
-    private String authenticationMethod;
-    private Integer maxRows;
-    private String postalAddressScheme;
-       private String uddiNamespace;
-       private String uddiVersion;
+       public static final String ADMIN_ENDPOINT_PROPERTY       = 
"scout.proxy.adminURL";
+       public static final String TRANSPORT_CLASS_PROPERTY      = 
"scout.proxy.transportClass";
+       public static final String SECURITY_PROVIDER_PROPERTY    = 
"scout.proxy.securityProvider";
+       public static final String PROTOCOL_HANDLER_PROPERTY     = 
"scout.proxy.protocolHandler";
+       public static final String UDDI_VERSION_PROPERTY         = 
"scout.proxy.uddiVersion";
+       public static final String UDDI_NAMESPACE_PROPERTY       = 
"scout.proxy.uddiNamespace";
        
        private Properties properties = new Properties();
-       
-       private String uddiConfigFile;
 
     /**
      * Public no-arg constructor so that this ConnectionFactory can be
      * instantiated by the JAXR ConnectionFactory;
      */
-    public ConnectionFactoryImpl()
-    {
-    }
+    public ConnectionFactoryImpl() {}
 
     public Connection createConnection() throws JAXRException
     {
-        if (queryManagerURL == null)
-        {
-            throw new InvalidRequestException("queryManager is not set");
-        }
-        URI queryManager;
-        URI lifeCycleManager;
-        URI securityManager = null;
-        try
-        {
-            queryManager = new URI(queryManagerURL);
-        } catch (URISyntaxException e)
-        {
-            throw new InvalidRequestException("Invalid queryManagerURL: " + 
queryManagerURL, e);
-        }
-        try
-        {
-            lifeCycleManager = lifeCycleManagerURL == null ? queryManager : 
new URI(lifeCycleManagerURL);
-        } catch (URISyntaxException e)
-        {
-            throw new InvalidRequestException("Invalid lifeCycleManagerURL: " 
+ lifeCycleManagerURL, e);
-        }
-        try
-        {      
-               if (securityManagerURL != null) {
-                       securityManager = new URI(securityManagerURL);
-               }
-        } catch (URISyntaxException e) {
-               securityManager = null;
-        }
-               return new ConnectionImpl(queryManager, lifeCycleManager, 
securityManager, transportClass, null, maxRows == null ? -1 : 
maxRows.intValue(),
-                               uddiNamespace, uddiVersion, uddiConfigFile, 
properties);
+        return new ConnectionImpl(properties);
     }
 
     public FederatedConnection createFederatedConnection(Collection 
collection) throws JAXRException
@@ -137,34 +92,6 @@ public class ConnectionFactoryImpl exten
     {
         if (properties==null) properties = new Properties();
         this.properties.putAll(properties);
-        if (isUDDIv3(properties)) {
-            // UDDI v3 uses the juddi client
-            queryManagerURL     = 
"org.apache.juddi.v3.client.transport.wrapper.UDDIInquiryService#inquire";
-            lifeCycleManagerURL = 
"org.apache.juddi.v3.client.transport.wrapper.UDDIPublicationService#publish";
-            securityManagerURL  = 
"org.apache.juddi.v3.client.transport.wrapper.UDDISecurityService#secure";
-            uddiConfigFile      = 
properties.getProperty(JUDDI_CLIENT_CONFIG_FILE);// 
DEFAULT_JUDDI_CLIENT_CONFIG_FILE);
-        } else {
-            queryManagerURL = properties.getProperty(QUERYMANAGER_PROPERTY);
-            lifeCycleManagerURL = 
properties.getProperty(LIFECYCLEMANAGER_PROPERTY);
-       }
-
-        transportClass = 
properties.getProperty(RegistryImpl.TRANSPORT_CLASS_PROPERTY_NAME);
-        semanticEquivalences = 
properties.getProperty(SEMANTICEQUIVALENCES_PROPERTY);
-        authenticationMethod = 
properties.getProperty(AUTHENTICATIONMETHOD_PROPERTY);
-        postalAddressScheme = 
properties.getProperty(POSTALADDRESSSCHEME_PROPERTY);
-        uddiVersion = 
properties.getProperty(RegistryImpl.UDDI_VERSION_PROPERTY_NAME);
-        uddiNamespace = 
properties.getProperty(RegistryImpl.UDDI_NAMESPACE_PROPERTY_NAME);
-
-        String val = properties.getProperty(MAXROWS_PROPERTY);
-        maxRows = (val == null) ? null : Integer.valueOf(val);
-    }
-    
-    private boolean isUDDIv3(Properties properties) {
-        if (properties.containsKey(RegistryImpl.UDDI_VERSION_PROPERTY_NAME)) {
-            String version = 
properties.getProperty(RegistryImpl.UDDI_VERSION_PROPERTY_NAME);
-            if (version.equals("3") || version.equals("3.0")) return true;
-        }
-        return false;
     }
 
     public static ConnectionFactory newInstance()
@@ -172,37 +99,4 @@ public class ConnectionFactoryImpl exten
         return new ConnectionFactoryImpl();
     }
 
-    public String getAuthenticationMethod()
-    {
-        return authenticationMethod;
-    }
-
-    public String getLifeCycleManagerURL()
-    {
-        return lifeCycleManagerURL;
-    }
-
-    public Integer getMaxRows()
-    {
-        return maxRows;
-    }
-
-    public String getPostalAddressScheme()
-    {
-        return postalAddressScheme;
-    }
-
-    public String getQueryManagerURL()
-    {
-        return queryManagerURL;
-    }
-
-    public String getSemanticEquivalences()
-    {
-        return semanticEquivalences;
-    }
-
-       public String getTransportClass() {
-               return transportClass;
-       }
 }

Modified: 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionImpl.java
URL: 
http://svn.apache.org/viewvc/juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionImpl.java?rev=1240311&r1=1240310&r2=1240311&view=diff
==============================================================================
--- 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionImpl.java
 (original)
+++ 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/ConnectionImpl.java
 Fri Feb  3 19:41:30 2012
@@ -17,7 +17,6 @@
 package org.apache.ws.scout.registry;
 
 import java.io.Serializable;
-import java.net.URI;
 import java.util.Properties;
 import java.util.Set;
 
@@ -39,6 +38,10 @@ import org.apache.juddi.v3.client.config
  */
 public class ConnectionImpl implements Connection, Serializable
 {
+    public static final String JUDDI_CLIENT_CONFIG_FILE         = 
"scout.juddi.client.config.file";
+    public static final String DEFAULT_JUDDI_CLIENT_CONFIG_FILE = 
"META-INF/jaxr-uddi.xml";
+    public static final String DEFAULT_UDDI_VERSION             = "2.0";
+    
        private static final long serialVersionUID = 3542404895814764176L;
        private static Log log = LogFactory.getLog(ConnectionImpl.class);
        private boolean closed = false;
@@ -50,45 +53,20 @@ public class ConnectionImpl implements C
     private String uddiVersion;
     UDDIClerkManager manager = null;
 
-    public ConnectionImpl(URI queryManagerURI, URI lifeCycleManagerURI, URI 
securityManagerURI, String transportClass, String postalScheme, int maxRows,
-       String uddiNamespace, String uddiVersion, String uddiConfig, Properties 
properties)
+    public ConnectionImpl(Properties properties)
     {
-        /**
-         * If you want to override any of the properties
-         * juddi RegistryProxy uses, set the System property
-         * accordingly.
-         */
-               this.uddiVersion = uddiVersion;
-               if (uddiVersion != null) {
-                   
properties.setProperty(RegistryImpl.UDDI_VERSION_PROPERTY_NAME, uddiVersion);
-               } else {
-                   
properties.setProperty(RegistryImpl.UDDI_VERSION_PROPERTY_NAME, 
RegistryImpl.DEFAULT_UDDI_VERSION);
-               }
-                       
-               if (uddiNamespace!=null) {
-                   
properties.setProperty(RegistryImpl.UDDI_NAMESPACE_PROPERTY_NAME, 
uddiNamespace);
-               } else {
-                   
properties.setProperty(RegistryImpl.UDDI_NAMESPACE_PROPERTY_NAME, 
RegistryImpl.DEFAULT_UDDI_NAMESPACE);
-               }
-               
-        if (transportClass!=null) {
-            properties.setProperty(RegistryImpl.TRANSPORT_CLASS_PROPERTY_NAME, 
transportClass);
-        } else {
-               String transport = 
SecurityActions.getProperty(RegistryImpl.TRANSPORT_CLASS_PROPERTY_NAME);
-               if (transport != null) {
-                   
properties.setProperty(RegistryImpl.TRANSPORT_CLASS_PROPERTY_NAME, transport);
-               }
-        }
-        /**
-         * Even if the properties passed contains no values,
-         * juddi takes default values
-         */
-        if ("3.0".equals(uddiVersion)) {
+        postalScheme = 
properties.getProperty(ConnectionFactoryImpl.POSTALADDRESSSCHEME_PROPERTY);
+        String val = 
properties.getProperty(ConnectionFactoryImpl.MAXROWS_PROPERTY);
+        maxRows = (val == null) ? -1 : Integer.valueOf(val);
+        uddiVersion = 
properties.getProperty(ConnectionFactoryImpl.UDDI_VERSION_PROPERTY, 
DEFAULT_UDDI_VERSION);
+     
+        String uddiConfigFile      = 
properties.getProperty(JUDDI_CLIENT_CONFIG_FILE);// 
DEFAULT_JUDDI_CLIENT_CONFIG_FILE);
+        if (isUDDIv3(uddiVersion)) {
             String nodeName = null;
             String managerName = null;
-            if (manager==null && uddiConfig!=null) {
+            if (manager==null && uddiConfigFile!=null) {
                 try {
-                    manager = new UDDIClerkManager(uddiConfig, properties);
+                    manager = new UDDIClerkManager(uddiConfigFile, properties);
                     manager.start();
                 } catch (ConfigurationException e) {
                     log.error(e.getMessage(),e);
@@ -106,12 +84,15 @@ public class ConnectionImpl implements C
         } else {
             registry = new RegistryImpl(properties);                   
         }
-        registry.setInquiryURI(queryManagerURI);
-        registry.setPublishURI(lifeCycleManagerURI);
-        registry.setSecurityURI(securityManagerURI);
-        this.postalScheme = postalScheme;
-        this.maxRows = maxRows;
 
+        //this.postalScheme = postalScheme;
+        //this.maxRows = maxRows;
+
+    }
+    
+    private boolean isUDDIv3(String version) {
+        if (version.startsWith("3")) return true;
+        return false;
     }
 
     public RegistryService getRegistryService() throws JAXRException

Modified: 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java
URL: 
http://svn.apache.org/viewvc/juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java?rev=1240311&r1=1240310&r2=1240311&view=diff
==============================================================================
--- 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java 
(original)
+++ 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryImpl.java 
Fri Feb  3 19:41:30 2012
@@ -105,25 +105,14 @@ import org.xml.sax.SAXException;
 
 public class RegistryImpl implements IRegistry {
 
-       public static final String INQUIRY_ENDPOINT_PROPERTY_NAME = 
"scout.proxy.inquiryURL";
-       public static final String PUBLISH_ENDPOINT_PROPERTY_NAME = 
"scout.proxy.publishURL";
-       public static final String SECURITY_ENDPOINT_PROPERTY_NAME = 
"scout.proxy.securityURL";
-       public static final String ADMIN_ENDPOINT_PROPERTY_NAME = 
"scout.proxy.adminURL";
-       public static final String TRANSPORT_CLASS_PROPERTY_NAME = 
"scout.proxy.transportClass";
-       public static final String SECURITY_PROVIDER_PROPERTY_NAME = 
"scout.proxy.securityProvider";
-       public static final String PROTOCOL_HANDLER_PROPERTY_NAME = 
"scout.proxy.protocolHandler";
-       public static final String UDDI_VERSION_PROPERTY_NAME = 
"scout.proxy.uddiVersion";
-       public static final String UDDI_NAMESPACE_PROPERTY_NAME = 
"scout.proxy.uddiNamespace";
-
-       public static final String DEFAULT_INQUIRY_ENDPOINT = 
"http://localhost/juddi/inquiry";;
-       public static final String DEFAULT_PUBLISH_ENDPOINT = 
"http://localhost/juddi/publish";;
-       public static final String DEFAULT_SECURITY_ENDPOINT = 
"http://localhost/juddi/security";;
-       public static final String DEFAULT_ADMIN_ENDPOINT = 
"http://localhost/juddi/admin";;
-       public static final String DEFAULT_TRANSPORT_CLASS = 
"org.apache.ws.scout.transport.SaajTransport";
-       public static final String DEFAULT_SECURITY_PROVIDER = 
"com.sun.net.ssl.internal.ssl.Provider";
-       public static final String DEFAULT_PROTOCOL_HANDLER = 
"com.sun.net.ssl.internal.www.protocol";
-       public static final String DEFAULT_UDDI_VERSION = "2.0";
-       public static final String DEFAULT_UDDI_NAMESPACE = 
"urn:uddi-org:api_v2";
+       public static final String DEFAULT_INQUIRY_ENDPOINT        = 
"http://localhost:8080/juddi/inquiry";;
+       public static final String DEFAULT_PUBLISH_ENDPOINT        = 
"http://localhost:8080/juddi/publish";;
+       public static final String DEFAULT_ADMIN_ENDPOINT          = 
"http://localhost:8080/juddi/admin";;
+       public static final String DEFAULT_TRANSPORT_CLASS         = 
"org.apache.ws.scout.transport.SaajTransport";
+       public static final String DEFAULT_SECURITY_PROVIDER       = 
"com.sun.net.ssl.internal.ssl.Provider";
+       public static final String DEFAULT_PROTOCOL_HANDLER        = 
"com.sun.net.ssl.internal.www.protocol";
+       public static final String DEFAULT_UDDI_VERSION            = "2.0";
+       public static final String DEFAULT_UDDI_NAMESPACE          = 
"urn:uddi-org:api_v2";
 
        private URI adminURI;
        private URI inquiryURI;
@@ -159,83 +148,29 @@ public class RegistryImpl implements IRe
        private void init(Properties props) {
                // We need to have a non-null Properties
                // instance so initialization takes place.
-               if (props == null)
-                       props = new Properties();
+               if (props == null) props = new Properties();
 
                // Override defaults with specific specific values
                try {
-                       String iURL = 
props.getProperty(INQUIRY_ENDPOINT_PROPERTY_NAME);
-                       if (iURL != null)
-                               this.setInquiryURI(new URI(iURL));
-                       else
-                               this.setInquiryURI(new 
URI(DEFAULT_INQUIRY_ENDPOINT));
-
-                       String pURL = 
props.getProperty(PUBLISH_ENDPOINT_PROPERTY_NAME);
-                       if (pURL != null)
-                               this.setPublishURI(new URI(pURL));
-                       else
-                               this.setPublishURI(new 
URI(DEFAULT_PUBLISH_ENDPOINT));
-
-                       String sURL = 
props.getProperty(SECURITY_ENDPOINT_PROPERTY_NAME);
-                       if (sURL != null)
-                               this.setSecurityURI(new URI(sURL));
-                       else
-                               this.setSecurityURI(new 
URI(DEFAULT_SECURITY_ENDPOINT));
+                       setInquiryURI(new 
URI(props.getProperty(ConnectionFactoryImpl.QUERYMANAGER_PROPERTY,DEFAULT_INQUIRY_ENDPOINT)));
+                       setPublishURI(new 
URI(props.getProperty(ConnectionFactoryImpl.LIFECYCLEMANAGER_PROPERTY, 
DEFAULT_PUBLISH_ENDPOINT)));
+                       setSecurityURI(new 
URI(props.getProperty(ConnectionFactoryImpl.SECURITYMANAGER_PROPERTY, 
getPublishURI().toString())));
+                       setAdminURI(new 
URI(props.getProperty(ConnectionFactoryImpl.ADMIN_ENDPOINT_PROPERTY, 
DEFAULT_ADMIN_ENDPOINT)));
+                       
setSecurityProvider(props.getProperty(ConnectionFactoryImpl.SECURITY_PROVIDER_PROPERTY,
 DEFAULT_SECURITY_PROVIDER));
+                       
setProtocolHandler(props.getProperty(ConnectionFactoryImpl.PROTOCOL_HANDLER_PROPERTY,
 DEFAULT_PROTOCOL_HANDLER));
+                       
setUddiVersion(props.getProperty(ConnectionFactoryImpl.UDDI_NAMESPACE_PROPERTY, 
DEFAULT_UDDI_VERSION));
+                       
setUddiNamespace(props.getProperty(ConnectionFactoryImpl.UDDI_NAMESPACE_PROPERTY,
 DEFAULT_UDDI_NAMESPACE));
+                       
setTransport(getTransport(props.getProperty(ConnectionFactoryImpl.TRANSPORT_CLASS_PROPERTY,
 DEFAULT_TRANSPORT_CLASS)));
                        
-                       String aURL = 
props.getProperty(ADMIN_ENDPOINT_PROPERTY_NAME);
-                       if (aURL != null)
-                               this.setAdminURI(new URI(aURL));
-                       else
-                               this.setAdminURI(new 
URI(DEFAULT_ADMIN_ENDPOINT));
+                       JAXBContext context = 
JAXBContextUtil.getContext(JAXBContextUtil.UDDI_V2_VERSION);
+            unmarshaller = context.createUnmarshaller(); 
+            marshaller = context.createMarshaller();
+            
                } catch (URISyntaxException muex) {
                        throw new RuntimeException(muex);
-               }
-
-               String secProvider = 
props.getProperty(SECURITY_PROVIDER_PROPERTY_NAME);
-               if (secProvider != null)
-                       this.setSecurityProvider(secProvider);
-               else
-                       this.setSecurityProvider(DEFAULT_SECURITY_PROVIDER);
-
-               String protoHandler = 
props.getProperty(PROTOCOL_HANDLER_PROPERTY_NAME);
-               if (protoHandler != null)
-                       this.setProtocolHandler(protoHandler);
-               else
-                       this.setProtocolHandler(DEFAULT_PROTOCOL_HANDLER);
-
-               String uddiVer = props.getProperty(UDDI_VERSION_PROPERTY_NAME);
-               if (uddiVer != null)
-                       this.setUddiVersion(uddiVer);
-               else
-                       this.setUddiVersion(DEFAULT_UDDI_VERSION);
-
-               String uddiNS = props.getProperty(UDDI_NAMESPACE_PROPERTY_NAME);
-               if (uddiNS != null)
-                       this.setUddiNamespace(uddiNS);
-               else
-                       this.setUddiNamespace(DEFAULT_UDDI_NAMESPACE);
-
-               String transClass = 
props.getProperty(TRANSPORT_CLASS_PROPERTY_NAME);
-               if (transClass != null)
-                       this.setTransport(this.getTransport(transClass));
-               else
-                       
this.setTransport(this.getTransport(DEFAULT_TRANSPORT_CLASS));
-               
-               try
-               {
-                       JAXBContext context = 
JAXBContextUtil.getContext(JAXBContextUtil.UDDI_V2_VERSION);
-                       JAXBContext v3context = 
JAXBContextUtil.getContext(JAXBContextUtil.UDDI_V3_VERSION);
-                       if ("3.0".equals(uddiVer)) { 
-                               this.unmarshaller = 
v3context.createUnmarshaller(); 
-                       } else {
-                               this.unmarshaller = 
context.createUnmarshaller(); 
-                       }
-                       this.marshaller = context.createMarshaller();
-               }
-               catch(JAXBException e)
-               {
-                       throw new RuntimeException(e);
-               }
+               } catch(JAXBException e) {
+           throw new RuntimeException(e);
+        }
        }
 
        /**
@@ -878,12 +813,7 @@ public class RegistryImpl implements IRe
                        request.setCred(cred);
                }
 
-               URI getAuthTokenURI = null;
-               if ("3.0".equals(uddiVersion)) {
-                       getAuthTokenURI = this.getSecurityURI();
-               } else {
-                       getAuthTokenURI = this.getPublishURI();
-               }
+               URI getAuthTokenURI = getSecurityURI();;
                
         AuthToken at;
         JAXBElement<?> o = 
execute(this.objectFactory.createGetAuthToken(request), 

Modified: 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Impl.java
URL: 
http://svn.apache.org/viewvc/juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Impl.java?rev=1240311&r1=1240310&r2=1240311&view=diff
==============================================================================
--- 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Impl.java
 (original)
+++ 
juddi/scout/trunk/src/main/java/org/apache/ws/scout/registry/RegistryV3Impl.java
 Fri Feb  3 19:41:30 2012
@@ -110,25 +110,15 @@ import org.xml.sax.SAXException;
 
 public class RegistryV3Impl implements IRegistryV3 {
 
-       public static final String INQUIRY_ENDPOINT_PROPERTY_NAME = 
"scout.proxy.inquiryURL";
-       public static final String PUBLISH_ENDPOINT_PROPERTY_NAME = 
"scout.proxy.publishURL";
-       public static final String SECURITY_ENDPOINT_PROPERTY_NAME = 
"scout.proxy.securityURL";
-       public static final String ADMIN_ENDPOINT_PROPERTY_NAME = 
"scout.proxy.adminURL";
-       public static final String TRANSPORT_CLASS_PROPERTY_NAME = 
"scout.proxy.transportClass";
-       public static final String SECURITY_PROVIDER_PROPERTY_NAME = 
"scout.proxy.securityProvider";
-       public static final String PROTOCOL_HANDLER_PROPERTY_NAME = 
"scout.proxy.protocolHandler";
-       public static final String UDDI_VERSION_PROPERTY_NAME = 
"scout.proxy.uddiVersion";
-       public static final String UDDI_NAMESPACE_PROPERTY_NAME = 
"scout.proxy.uddiNamespace";
-
-       public static final String DEFAULT_INQUIRY_ENDPOINT = 
"http://localhost/juddi/inquiry";;
-       public static final String DEFAULT_PUBLISH_ENDPOINT = 
"http://localhost/juddi/publish";;
-       public static final String DEFAULT_SECURITY_ENDPOINT = 
"http://localhost/juddi/security";;
-       public static final String DEFAULT_ADMIN_ENDPOINT = 
"http://localhost/juddi/admin";;
-       public static final String DEFAULT_TRANSPORT_CLASS = 
"org.apache.ws.scout.transport.AxisTransport";
+       public static final String DEFAULT_INQUIRY_ENDPOINT  = 
"org.apache.juddi.v3.client.transport.wrapper.UDDIInquiryService#inquire";;
+       public static final String DEFAULT_PUBLISH_ENDPOINT  = 
"org.apache.juddi.v3.client.transport.wrapper.UDDIPublicationService#publish";
+       public static final String DEFAULT_SECURITY_ENDPOINT = 
"org.apache.juddi.v3.client.transport.wrapper.UDDISecurityService#secure";
+       public static final String DEFAULT_ADMIN_ENDPOINT    = 
"http://localhost/juddiv3/";;
+       public static final String DEFAULT_TRANSPORT_CLASS   = 
"org.apache.ws.scout.transport.LocalTransport";
        public static final String DEFAULT_SECURITY_PROVIDER = 
"com.sun.net.ssl.internal.ssl.Provider";
-       public static final String DEFAULT_PROTOCOL_HANDLER = 
"com.sun.net.ssl.internal.www.protocol";
-       public static final String DEFAULT_UDDI_VERSION = "2.0";
-       public static final String DEFAULT_UDDI_NAMESPACE = 
"urn:uddi-org:api_v2";
+       public static final String DEFAULT_PROTOCOL_HANDLER  = 
"com.sun.net.ssl.internal.www.protocol";
+       public static final String DEFAULT_UDDI_VERSION      = "3.0";
+       public static final String DEFAULT_UDDI_NAMESPACE    = 
"urn:uddi-org:api_v3";
 
        private URI adminURI;
        private URI inquiryURI;
@@ -165,83 +155,37 @@ public class RegistryV3Impl implements I
         * 
         */
        private void init(Properties props, String nodeName, String 
managerName) {
-               // We need to have a non-null Properties
-               // instance so initialization takes place.
-               if (props == null)
-                       props = new Properties();
-
-               this.nodeName = nodeName;
-               this.managerName = managerName;
-               // Override defaults with specific specific values
-               try {
-                       String iURL = 
props.getProperty(INQUIRY_ENDPOINT_PROPERTY_NAME);
-                       if (iURL != null)
-                               this.setInquiryURI(new URI(iURL));
-                       else
-                               this.setInquiryURI(new 
URI(DEFAULT_INQUIRY_ENDPOINT));
-
-                       String pURL = 
props.getProperty(PUBLISH_ENDPOINT_PROPERTY_NAME);
-                       if (pURL != null)
-                               this.setPublishURI(new URI(pURL));
-                       else
-                               this.setPublishURI(new 
URI(DEFAULT_PUBLISH_ENDPOINT));
-
-                       String sURL = 
props.getProperty(SECURITY_ENDPOINT_PROPERTY_NAME);
-                       if (sURL != null)
-                               this.setSecurityURI(new URI(sURL));
-                       else
-                               this.setSecurityURI(new 
URI(DEFAULT_SECURITY_ENDPOINT));
-                       
-                       String aURL = 
props.getProperty(ADMIN_ENDPOINT_PROPERTY_NAME);
-                       if (aURL != null)
-                               this.setAdminURI(new URI(aURL));
-                       else
-                               this.setAdminURI(new 
URI(DEFAULT_ADMIN_ENDPOINT));
-               } catch (URISyntaxException muex) {
-                       throw new RuntimeException(muex);
-               }
-
-               String secProvider = 
props.getProperty(SECURITY_PROVIDER_PROPERTY_NAME);
-               if (secProvider != null)
-                       this.setSecurityProvider(secProvider);
-               else
-                       this.setSecurityProvider(DEFAULT_SECURITY_PROVIDER);
-
-               String protoHandler = 
props.getProperty(PROTOCOL_HANDLER_PROPERTY_NAME);
-               if (protoHandler != null)
-                       this.setProtocolHandler(protoHandler);
-               else
-                       this.setProtocolHandler(DEFAULT_PROTOCOL_HANDLER);
-
-               String uddiVer = props.getProperty(UDDI_VERSION_PROPERTY_NAME);
-               if (uddiVer != null)
-                       this.setUddiVersion(uddiVer);
-               else
-                       this.setUddiVersion(DEFAULT_UDDI_VERSION);
+           this.nodeName = nodeName;
+           this.managerName = managerName;
+        // We need to have a non-null Properties
+        // instance so initialization takes place.
+        if (props == null) props = new Properties();
 
-               String uddiNS = props.getProperty(UDDI_NAMESPACE_PROPERTY_NAME);
-               if (uddiNS != null)
-                       this.setUddiNamespace(uddiNS);
-               else
-                       this.setUddiNamespace(DEFAULT_UDDI_NAMESPACE);
-
-               String transClass = 
props.getProperty(TRANSPORT_CLASS_PROPERTY_NAME);
-               if (transClass != null)
-                       this.setTransport(this.getTransport(transClass));
-               else
-                       
this.setTransport(this.getTransport(DEFAULT_TRANSPORT_CLASS));
-               
-               try
-               {
-                       JAXBContext v3context = 
JAXBContextUtil.getContext(JAXBContextUtil.UDDI_V3_VERSION);
-                       this.unmarshaller = v3context.createUnmarshaller(); 
-                       this.marshaller = v3context.createMarshaller();
-
-               }
-               catch(JAXBException e)
-               {
-                       throw new RuntimeException(e);
-               }
+        // Override defaults with specific specific values
+        try {
+            // note that since we are using the juddi-client, these settings 
are fixed!
+            // the URL settings will be passed down to the juddi-client 
config. 
+            // (see the parameters in the "META-INF/jaxr-uddi.xml)
+            setInquiryURI(new URI(DEFAULT_INQUIRY_ENDPOINT));
+            setPublishURI(new URI(DEFAULT_PUBLISH_ENDPOINT));
+            setSecurityURI(new URI(DEFAULT_SECURITY_ENDPOINT));
+            setTransport(getTransport(DEFAULT_TRANSPORT_CLASS));
+            // the following parameters are still configurable however
+            setAdminURI(new 
URI(props.getProperty(ConnectionFactoryImpl.ADMIN_ENDPOINT_PROPERTY, 
DEFAULT_ADMIN_ENDPOINT)));
+            
setSecurityProvider(props.getProperty(ConnectionFactoryImpl.SECURITY_PROVIDER_PROPERTY,
 DEFAULT_SECURITY_PROVIDER));
+            
setProtocolHandler(props.getProperty(ConnectionFactoryImpl.PROTOCOL_HANDLER_PROPERTY,
 DEFAULT_PROTOCOL_HANDLER));
+            
setUddiVersion(props.getProperty(ConnectionFactoryImpl.UDDI_NAMESPACE_PROPERTY, 
DEFAULT_UDDI_VERSION));
+            
setUddiNamespace(props.getProperty(ConnectionFactoryImpl.UDDI_NAMESPACE_PROPERTY,
 DEFAULT_UDDI_NAMESPACE));
+            
+            JAXBContext context = 
JAXBContextUtil.getContext(JAXBContextUtil.UDDI_V3_VERSION);
+            unmarshaller = context.createUnmarshaller(); 
+            marshaller = context.createMarshaller();
+            
+        } catch (URISyntaxException muex) {
+            throw new RuntimeException(muex);
+        } catch(JAXBException e) {
+           throw new RuntimeException(e);
+        }
        }
 
        /**

Modified: juddi/scout/trunk/src/test/java/org/apache/ws/scout/BaseTestCase.java
URL: 
http://svn.apache.org/viewvc/juddi/scout/trunk/src/test/java/org/apache/ws/scout/BaseTestCase.java?rev=1240311&r1=1240310&r2=1240311&view=diff
==============================================================================
--- juddi/scout/trunk/src/test/java/org/apache/ws/scout/BaseTestCase.java 
(original)
+++ juddi/scout/trunk/src/test/java/org/apache/ws/scout/BaseTestCase.java Fri 
Feb  3 19:41:30 2012
@@ -45,8 +45,8 @@ public class BaseTestCase
     protected BusinessQueryManager bqm;
 
     //Set some default values
-       protected String uddiversion = RegistryImpl.DEFAULT_UDDI_VERSION;
-    protected String uddinamespace = RegistryImpl.DEFAULT_UDDI_NAMESPACE;
+       protected String uddiversion = null;
+ 
     protected String userid = System.getProperty("uddi.test.uid")  == null ? 
"jdoe"     : System.getProperty("uddi.test.uid");
     protected String passwd = System.getProperty("uddi.test.pass") == null ? 
"password" : System.getProperty("uddi.test.pass");
     
@@ -66,6 +66,7 @@ public class BaseTestCase
         {
                String envUDDIVersion =  System.getenv("uddi.version");
                if (envUDDIVersion==null) envUDDIVersion = "2";
+               uddiversion = envUDDIVersion + ".0";
                String propertiesFile = "/scoutv" + envUDDIVersion + 
".properties";
                
                System.out.println("Reading Scout Properties from: " + 
propertiesFile);
@@ -86,16 +87,7 @@ public class BaseTestCase
 //            if (scoutProperties.getProperty("password2")!=null) {
 //                passwd = scoutProperties.getProperty("password2");
 //            }
-            
-            if (scoutProperties.getProperty("scout.proxy.uddiVersion") != null)
-            {
-               uddiversion = 
scoutProperties.getProperty("scout.proxy.uddiVersion","2.0");
-            }
-            
-            if (scoutProperties.getProperty("scout.proxy.uddiNamespace") != 
null) {
-               uddinamespace = 
scoutProperties.getProperty("scout.proxy.uddiNamespace");
-            }            
-            
+
             // Create the connection, passing it the configuration properties
             ConnectionFactory factory = ConnectionFactory.newInstance();
             factory.setProperties(scoutProperties);

Modified: 
juddi/scout/trunk/src/test/java/org/apache/ws/scout/registry/ConnectionFactoryTest.java
URL: 
http://svn.apache.org/viewvc/juddi/scout/trunk/src/test/java/org/apache/ws/scout/registry/ConnectionFactoryTest.java?rev=1240311&r1=1240310&r2=1240311&view=diff
==============================================================================
--- 
juddi/scout/trunk/src/test/java/org/apache/ws/scout/registry/ConnectionFactoryTest.java
 (original)
+++ 
juddi/scout/trunk/src/test/java/org/apache/ws/scout/registry/ConnectionFactoryTest.java
 Fri Feb  3 19:41:30 2012
@@ -50,7 +50,6 @@ public class ConnectionFactoryTest exten
         Properties properties = new Properties();
         properties.setProperty(ConnectionFactoryImpl.QUERYMANAGER_PROPERTY, 
url);
         factory.setProperties(properties);
-        assertEquals(url, factory.getQueryManagerURL());
         assertEquals(url, 
factory.getProperties().getProperty("javax.xml.registry.queryManagerURL"));
     }
 
@@ -59,7 +58,6 @@ public class ConnectionFactoryTest exten
         Properties properties = new Properties();
         
properties.setProperty(ConnectionFactoryImpl.LIFECYCLEMANAGER_PROPERTY, url);
         factory.setProperties(properties);
-        assertEquals(url, factory.getLifeCycleManagerURL());
         assertEquals(url, 
factory.getProperties().getProperty("javax.xml.registry.lifeCycleManagerURL"));
     }
 
@@ -70,7 +68,6 @@ public class ConnectionFactoryTest exten
         Properties properties = new Properties();
         
properties.setProperty(ConnectionFactoryImpl.SEMANTICEQUIVALENCES_PROPERTY, 
urns);
         factory.setProperties(properties);
-        assertEquals(urns, factory.getSemanticEquivalences());
         assertEquals(urns, 
factory.getProperties().getProperty("javax.xml.registry.semanticEquivalences"));
     }
 
@@ -79,7 +76,6 @@ public class ConnectionFactoryTest exten
         Properties properties = new Properties();
         
properties.setProperty(ConnectionFactoryImpl.AUTHENTICATIONMETHOD_PROPERTY, 
method);
         factory.setProperties(properties);
-        assertEquals(method, factory.getAuthenticationMethod());
         assertEquals(method, 
factory.getProperties().getProperty("javax.xml.registry.security.authenticationMethod"));
     }
 
@@ -88,7 +84,6 @@ public class ConnectionFactoryTest exten
         Properties properties = new Properties();
         
properties.setProperty(ConnectionFactoryImpl.POSTALADDRESSSCHEME_PROPERTY, 
scheme);
         factory.setProperties(properties);
-        assertEquals(scheme, factory.getPostalAddressScheme());
         assertEquals(scheme, 
factory.getProperties().getProperty("javax.xml.registry.postalAddressScheme"));
     }
 
@@ -97,7 +92,6 @@ public class ConnectionFactoryTest exten
         Properties properties = new Properties();
         properties.setProperty(ConnectionFactoryImpl.MAXROWS_PROPERTY, 
String.valueOf(maxRows));
         factory.setProperties(properties);
-        assertEquals(maxRows, factory.getMaxRows());
         assertEquals(maxRows.toString(), 
factory.getProperties().getProperty("javax.xml.registry.uddi.maxRows"));
     }
 
@@ -159,11 +153,8 @@ public class ConnectionFactoryTest exten
     public void testCreateConnectionWithNullQueryURL() {
         try {
             factory.createConnection();
-            fail("did not reject invalid URL");
-        } catch (InvalidRequestException e) {
-            // OK
-        } catch (JAXRException e) {
-            fail("threw JAXRException");
+        } catch (Exception e) {
+            fail("threw Exception");
         }
     }
 

Modified: juddi/scout/trunk/src/test/resources/scoutv3.properties
URL: 
http://svn.apache.org/viewvc/juddi/scout/trunk/src/test/resources/scoutv3.properties?rev=1240311&r1=1240310&r2=1240311&view=diff
==============================================================================
--- juddi/scout/trunk/src/test/resources/scoutv3.properties (original)
+++ juddi/scout/trunk/src/test/resources/scoutv3.properties Fri Feb  3 19:41:30 
2012
@@ -5,9 +5,7 @@
 javax.xml.registry.queryManagerURL     
=http://localhost:8880/juddiv3/services/inquiry
 javax.xml.registry.lifeCycleManagerURL 
=http://localhost:8880/juddiv3/services/publish
 javax.xml.registry.securityManagerURL   
=http://localhost:8880/juddiv3/services/security
-scout.proxy.transportClass             
=org.apache.ws.scout.transport.LocalTransport
 scout.proxy.uddiVersion                =3.0
-scout.proxy.uddiNamespace              =urn:uddi-org:api_v3
 scout.juddi.client.config.file         =META-INF/jaxr-uddi.xml
 #
 
########################################################################################################



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to