You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jl...@apache.org on 2007/10/25 19:10:56 UTC

svn commit: r588283 [5/18] - in /incubator/cxf/branches/jliu: ./ api/ api/src/main/java/org/apache/cxf/databinding/ api/src/main/java/org/apache/cxf/io/ api/src/main/java/org/apache/cxf/message/ api/src/main/java/org/apache/cxf/phase/ api/src/main/java...

Modified: incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionFactoryImpl.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionFactoryImpl.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionFactoryImpl.java Thu Oct 25 10:09:20 2007
@@ -20,6 +20,7 @@
 
 import java.net.URL;
 import java.util.Properties;
+import java.util.ResourceBundle;
 import java.util.logging.Logger;
 
 import javax.resource.ResourceException;
@@ -30,6 +31,8 @@
 
 import org.apache.cxf.Bus;
 //import org.apache.cxf.BusFactory;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.jca.core.resourceadapter.AbstractManagedConnectionFactoryImpl;
 import org.apache.cxf.jca.core.resourceadapter.AbstractManagedConnectionImpl;
@@ -40,6 +43,8 @@
     implements CXFManagedConnectionFactory {
 
     private static final Logger LOG = LogUtils.getL7dLogger(ManagedConnectionFactoryImpl.class);
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(ManagedConnectionFactoryImpl.class);
+    
     protected JCABusFactory jcaBusFactory;
 
     public ManagedConnectionFactoryImpl() {
@@ -104,6 +109,14 @@
     public URL getEJBServicePropertiesURLInstance() throws ResourceException {
         return getPropsURL(getEJBServicePropertiesURL());
     }
+    
+    public String getEJBServantBaseURL() throws ResourceException {
+        return getPluginProps().getProperty(EJB_SERVANT_BASE_URL);
+    }
+    
+    public void setEJBServantBaseURL(String url) throws ResourceException {
+        setProperty(EJB_SERVANT_BASE_URL, url);
+    }
 
     // compliance: WL9 checks
     // need to ensure multiple instances with same config properties are equal
@@ -114,18 +127,17 @@
     }
 
     public Object createConnectionFactory() throws ResourceException {
-        throw new ResourceAdapterInternalException("Non-Managed usage is not supported, "
-                        + "use createConnectionFactory with a ConnectionManager argument");
+        throw new ResourceAdapterInternalException(
+                           new Message("NON_MANAGED_CONNECTION_IS_NOT_SUPPORTED", BUNDLE).toString());
     }
 
     public Object createConnectionFactory(ConnectionManager connMgr) throws ResourceException {
         LOG.info("connManager=" + connMgr);
         if (connMgr == null) {
-            throw new ResourceAdapterInternalException("Non-Managed usage is not supported, " 
-                        + "the ConnectionManager argument can not be null");
+            throw new ResourceAdapterInternalException(
+                            new Message("NON_MANAGED_CONNECTION_IS_NOT_SUPPORTED", BUNDLE).toString());
         }
         init(connMgr.getClass().getClassLoader());
-        //jcaBusFactory.setAppserverClassLoader(connMgr.getClass().getClassLoader());
         LOG.fine("Setting AppServer classloader in jcaBusFactory. " + connMgr.getClass().getClassLoader());
         return new ConnectionFactoryImpl(this, connMgr);
     }
@@ -138,7 +150,6 @@
     }
 
     public void close() throws javax.resource.spi.ResourceAdapterInternalException {
-        LOG.info("close, this=" + this);
     }
 
     protected synchronized void init(ClassLoader appserverClassLoader) throws ResourceException {

Modified: incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionImpl.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionImpl.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionImpl.java Thu Oct 25 10:09:20 2007
@@ -20,10 +20,9 @@
 
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
-import java.net.URL;
-//import java.util.Iterator;
-import java.util.logging.Logger;
+import java.util.ResourceBundle;
 
+import javax.jws.WebService;
 import javax.resource.NotSupportedException;
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionRequestInfo;
@@ -31,14 +30,14 @@
 import javax.resource.spi.ManagedConnectionMetaData;
 import javax.security.auth.Subject;
 import javax.transaction.xa.XAResource;
-//import javax.wsdl.Port;
-import javax.xml.namespace.QName;
-import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
 
 import org.apache.cxf.Bus;
-import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.connector.Connection;
+import org.apache.cxf.frontend.ClientProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 import org.apache.cxf.jca.core.resourceadapter.AbstractManagedConnectionImpl;
 import org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException;
 import org.apache.cxf.jca.cxf.handlers.InvocationHandlerFactory;
@@ -47,44 +46,38 @@
     extends AbstractManagedConnectionImpl 
     implements CXFManagedConnection, Connection {
 
-    private static final Logger LOG = LogUtils.getL7dLogger(ManagedConnectionImpl.class);    
+    private static final ResourceBundle BUNDLE = BundleUtils.getBundle(ConnectionFactoryImpl.class);   
 
-    private InvocationHandlerFactory handlerFactory;
-    
+    private InvocationHandlerFactory handlerFactory;    
     private Object cxfService;
     private boolean connectionHandleActive;
 
     public ManagedConnectionImpl(ManagedConnectionFactoryImpl managedFactory, ConnectionRequestInfo crInfo,
                                  Subject subject) throws ResourceException {
         super(managedFactory, crInfo, subject);
-        LOG.fine("ManagedConnection created with hash: " + hashCode() + "." + toString());
     }
 
-    public void associateConnection(Object arg0) throws ResourceException {
+    public void associateConnection(Object connection) throws ResourceException {
         try {           
-            CXFInvocationHandler handler = (CXFInvocationHandler)Proxy
-                .getInvocationHandler((Proxy)arg0);
+            CXFInvocationHandler handler = 
+                    (CXFInvocationHandler)Proxy.getInvocationHandler((Proxy)connection);
             Object managedConnection = handler.getData().getManagedConnection();
-            LOG.fine("previously associated managed connection: " + managedConnection.hashCode());
 
             if (managedConnection != this) {
-                LOG.fine("associate handle " + arg0 + " with  managed connection " + this
-                            + " with hashcode: " + hashCode());
                 handler.getData().setManagedConnection(this);
-                ((ManagedConnectionImpl)managedConnection).disassociateConnectionHandle(arg0);
+                ((ManagedConnectionImpl)managedConnection).disassociateConnectionHandle(connection);
 
                 if (getCXFService() == null) { 
                     // Very unlikely as THIS
                     // managed connection is
                     // already involved in a transaction.
-                    cxfService = arg0;
+                    cxfService = connection;
                     connectionHandleActive = true;
                 }
-
             }
         } catch (Exception ex) {         
-            throw new ResourceAdapterInternalException("Error associating handle " + arg0
-                                                       + " with managed connection " + this, ex);
+            throw new ResourceAdapterInternalException(
+                              new Message("ASSOCIATED_ERROR", BUNDLE).toString(), ex);
         }
     }
 
@@ -92,99 +85,90 @@
         return (ManagedConnectionFactoryImpl)theManagedConnectionFactory();
     }
 
-    final Object getCXFService() {
+    public Object getCXFService() {
         return cxfService;
     }
 
-    final void initialiseCXFService(ConnectionRequestInfo crInfo, Subject subject)
+    private void initializeCXFConnection(ConnectionRequestInfo crInfo, Subject subject)
         throws ResourceException {
-        LOG.fine("initialiseCXFService, this=" + this + ", info=" + crInfo + ", subject=" + subject);
-
         this.crinfo = crInfo;
         this.subject = subject;
-
-        cxfService = getCXFServiceFromBus(subject, crInfo);
+        cxfService = getCXFConnection(subject, crInfo);
     }
 
     public Object getConnection(Subject subject, ConnectionRequestInfo crInfo) throws ResourceException {
 
-        LOG.fine("getConnection: this=" + this + ", info=" + crInfo + ", subject=" + subject);
         Object connection = null;
-
+        
         if (getCXFService() == null) {
-            initialiseCXFService(crInfo, subject);
-            connection = getCXFService();
-            
+            initializeCXFConnection(crInfo, subject);
+            connection = getCXFService();            
         } else {
             if (!connectionHandleActive && this.crinfo.equals(crInfo)) {
                 connection = getCXFService();
             } else {
-                connection = getCXFServiceFromBus(subject, crInfo);
+                connection = getCXFConnection(subject, crInfo);
             }
         }
         connectionHandleActive = true;
         return connection;
     }
 
-    public synchronized Object getCXFServiceFromBus(Subject subject, ConnectionRequestInfo crInfo)
+    public synchronized Object getCXFConnection(Subject subject, ConnectionRequestInfo crInfo)
         throws ResourceException {
 
-        CXFConnectionRequestInfo arReqInfo = (CXFConnectionRequestInfo)crInfo;
+        CXFConnectionRequestInfo requestInfo = (CXFConnectionRequestInfo)crInfo;
+        Class<?> serviceInterface = requestInfo.getInterface();
         ClassLoader orig = Thread.currentThread().getContextClassLoader();
-
-//         Bus bus = getBus();
-
-        //Thread.currentThread().setContextClassLoader(bus.getClass().getClassLoader());
-
-        QName serviceName = arReqInfo.getServiceQName();
-        URL wsdlLocationUrl = arReqInfo.getWsdlLocationUrl();
-        if (wsdlLocationUrl == null) { 
-            // if the wsdlLocationUrl is null, set the default wsdl
-            try {
-                Object obj = null;
-                Service service = Service.create(serviceName);
-            
-                QName port = arReqInfo.getPortQName();
-                if (port == null) {
-                    obj = service.getPort(arReqInfo.getInterface());
-                } else {
-                    obj = service.getPort(arReqInfo.getPortQName(), arReqInfo.getInterface());
-                }
-                setSubject(subject);
-                return createConnectionProxy(obj, arReqInfo, subject);
-            } catch (WebServiceException wse) {
-                throw new ResourceAdapterInternalException("Failed to create proxy client for service "
-                                                           + crInfo, wse);
-            } finally {
-//                Thread.currentThread().setContextClassLoader(orig);
-            }
-
-        }
-
         try {
-            Object obj = null;
-            Service service = Service.create(wsdlLocationUrl, serviceName);
-            if (arReqInfo.getPortQName() != null) {                
-                obj = service.getPort(arReqInfo.getPortQName(), arReqInfo.getInterface());
+            ClientProxyFactoryBean factoryBean = null;
+            if (isJaxWsServiceInterface(serviceInterface)) {
+                factoryBean = new JaxWsProxyFactoryBean();
             } else {
-                obj = service.getPort(arReqInfo.getInterface());
-                
+                factoryBean = new ClientProxyFactoryBean();
             }
-
+            factoryBean.setServiceClass(serviceInterface);
+            if (requestInfo.getServiceName() != null) {
+                factoryBean.getServiceFactory().setServiceName(requestInfo.getServiceName());
+            }
+            if (requestInfo.getPortName() != null) {
+                factoryBean.getServiceFactory().setEndpointName(requestInfo.getPortName());
+            }
+            if (requestInfo.getWsdlLocation() != null) {
+                factoryBean.getServiceFactory().setWsdlURL(requestInfo.getWsdlLocation());
+            }
+            if (requestInfo.getAddress() != null) {
+                factoryBean.setAddress(requestInfo.getAddress());
+            }
+            
+            Object obj = factoryBean.create();
+            
             setSubject(subject);
-            return createConnectionProxy(obj, arReqInfo, subject);
-
+            
+            return createConnectionProxy(obj, requestInfo, subject);
         } catch (WebServiceException wse) {
-            throw new ResourceAdapterInternalException("Failed to getPort for " + crInfo, wse);
+            throw new ResourceAdapterInternalException(new Message("FAILED_TO_GET_CXF_CONNECTION", 
+                                                                   BUNDLE, requestInfo).toString() , wse);
         } finally {
             Thread.currentThread().setContextClassLoader(orig);
         }
     }
 
     public ManagedConnectionMetaData getMetaData() throws ResourceException {
-        throw new NotSupportedException("Not Supported");
+        return new CXFManagedConnectionMetaData();
     }
-
+    
+    
+    private boolean isJaxWsServiceInterface(Class<?> cls) {
+        if (cls == null) {
+            return false;
+        }
+        if (null != cls.getAnnotation(WebService.class)) {
+            return true;
+        }
+        return false;
+    }
+    
     public boolean isBound() {
         return getCXFService() != null;
     }
@@ -209,7 +193,7 @@
 
         Class classes[] = {Connection.class, cri.getInterface()};
 
-        return Proxy.newProxyInstance(cri.getInterface().getClassLoader(), classes,
+        return Proxy.newProxyInstance(cri.getInterface().getClassLoader(), classes, 
                                       createInvocationHandler(obj, subject));
     }
 

Modified: incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ResourceAdapterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ResourceAdapterImpl.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ResourceAdapterImpl.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ResourceAdapterImpl.java Thu Oct 25 10:09:20 2007
@@ -35,7 +35,6 @@
 import javax.transaction.xa.XAResource;
 
 import org.apache.cxf.Bus;
-//import org.apache.cxf.BusException;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.jca.core.resourceadapter.ResourceBean;
 
@@ -47,12 +46,10 @@
    
     public ResourceAdapterImpl() {
         super();
-        LOG.fine("Resource Adapter is constructed without props");
     }
 
     public ResourceAdapterImpl(Properties props) {
         super(props);
-        LOG.fine("Resource Adapter is constructed with props");
     }
     
     public void registerBus(Bus bus) {
@@ -77,28 +74,13 @@
     }
 
     public void stop() {
-        LOG.fine("Resource Adapter is stopping by appserver...");
+        LOG.fine("Resource Adapter is being stopped by appserver...");
         if (!busCache.isEmpty()) {
-
             Iterator busIterator = busCache.iterator();
             Bus bus = null;
-//             int busCounter = 0;
-
             while (busIterator.hasNext()) {
-
-//                 busCounter++;
                 bus = (Bus)busIterator.next();
-
-//                 try {
-//                     if (bus != null) {
                 bus.shutdown(true);
-//                         LOG.fine("Number " + busCounter + " Bus: " + bus + " has been shut down");
-//                     } else {
-//                         LOG.fine("Number " + busCounter + " Bus is null");
-//                     }
-//                 } catch (BusException be) {
-//                     LOG.fine("Failed to shutdown bus when stop ResourceAdapter, reason: " + be);
-//                 }
             }
         }   
     }
@@ -120,6 +102,7 @@
         return ctx;
     }
 }
+
 
 
 

Modified: incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/handlers/CXFInvocationHandlerBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/handlers/CXFInvocationHandlerBase.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/handlers/CXFInvocationHandlerBase.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/main/java/org/apache/cxf/jca/cxf/handlers/CXFInvocationHandlerBase.java Thu Oct 25 10:09:20 2007
@@ -75,7 +75,6 @@
             //get the exception when call the method
             RuntimeException re = new RuntimeException("Unexpected exception from method " + targetMethod,
                                                       targetException);
-            LOG.info(re.toString());
             ret = re;
         }
         return ret;

Modified: incubator/cxf/branches/jliu/integration/jca/src/main/rar/META-INF/ra.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/main/rar/META-INF/ra.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/main/rar/META-INF/ra.xml (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/main/rar/META-INF/ra.xml Thu Oct 25 10:09:20 2007
@@ -68,6 +68,11 @@
           <config-property-type>java.lang.Integer</config-property-type>
           <config-property-value>30</config-property-value>
         </config-property>
+        <config-property>
+          <config-property-name>EJBServantBaseURL</config-property-name>
+          <config-property-type>java.lang.String</config-property-type>
+          <config-property-value>http://localhost:9999</config-property-value>
+        </config-property>
         <connectionfactory-interface>org.apache.cxf.connector.CXFConnectionFactory</connectionfactory-interface>
         <connectionfactory-impl-class>org.apache.cxf.jca.cxf.ConnectionFactoryImpl</connectionfactory-impl-class>
         <connection-interface>org.apache.cxf.connector.Connection</connection-interface>

Modified: incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/classloader/PlugInClassLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/classloader/PlugInClassLoaderTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/classloader/PlugInClassLoaderTest.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/classloader/PlugInClassLoaderTest.java Thu Oct 25 10:09:20 2007
@@ -25,6 +25,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.cxf.common.logging.LogUtils;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -32,7 +33,7 @@
 
 
 public class PlugInClassLoaderTest extends Assert {
-    private static final Logger LOG = Logger.getLogger(PlugInClassLoaderTest.class.getName());
+    private static final Logger LOG = LogUtils.getLogger(PlugInClassLoaderTest.class);
     private static boolean debug;
     PlugInClassLoader plugInClassLoader;
    

Modified: incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/logging/LoggerHelperTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/logging/LoggerHelperTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/logging/LoggerHelperTest.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/logging/LoggerHelperTest.java Thu Oct 25 10:09:20 2007
@@ -23,6 +23,7 @@
 import java.util.logging.Handler;
 import java.util.logging.Logger;
 
+import org.apache.cxf.common.logging.LogUtils;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -43,7 +44,7 @@
 
     @Test
     public void testEnableDisableConsoleLogging() {
-        Logger rootLogger = Logger.getLogger("");
+        Logger rootLogger = LogUtils.getLogger(this.getClass(), null, "");
         Handler handler;
         
         /*Handler handler = LoggerHelper.getHandler(rootLogger, LoggerHelper.CONSOLE_HANDLER);
@@ -52,7 +53,7 @@
         LoggerHelper.enableConsoleLogging();
 
         handler = LoggerHelper.getHandler(rootLogger, LoggerHelper.CONSOLE_HANDLER);
-        assertNotNull("default console appender is there", handler);
+        assertNotNull("default console appender is not there", handler);
 
         LoggerHelper.disableConsoleLogging();
 
@@ -65,8 +66,9 @@
         LoggerHelper.setRootLoggerName(TEST_LOGGER_NAME);
         LoggerHelper.setLogLevel("INFO");
         assertEquals("incorrect log level", "INFO", LoggerHelper.getLogLevel());
-        assertEquals("log level not set on IONA logger", "INFO", Logger.getLogger(TEST_LOGGER_NAME)
-            .getLevel().toString());
+        assertEquals("log level not set on IONA logger", "INFO",
+                     LogUtils.getLogger(this.getClass(), null, TEST_LOGGER_NAME)
+                         .getLevel().toString());
     }
 
     @Test

Modified: incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ManagedConnectionImplTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ManagedConnectionImplTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ManagedConnectionImplTest.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ManagedConnectionImplTest.java Thu Oct 25 10:09:20 2007
@@ -83,10 +83,9 @@
     @Test
     public void testGetMetaData() throws Exception {
         try {
-            mc.getMetaData();
-            fail("expect exception");
+            mc.getMetaData();            
         } catch (NotSupportedException expected) {
-            // do nothing here
+            fail("Got the Exception here");
         }
     }
 
@@ -94,7 +93,7 @@
     public void testGetSetSubject() {
         Subject s = new Subject();
         mc.setSubject(s);
-        assertEquals("got back what we set", s, mc.getSubject());
+        assertEquals("Got back what we set", s, mc.getSubject());
     }
 
     @Test
@@ -103,7 +102,7 @@
         };
 
         mc.setConnectionRequestInfo(ri);
-        assertEquals("got back what we set", ri, mc.getConnectionRequestInfo());
+        assertEquals("Got back what we set", ri, mc.getConnectionRequestInfo());
     }
 
     @Test

Modified: incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalExceptionTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalExceptionTest.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalExceptionTest.java Thu Oct 25 10:09:20 2007
@@ -21,6 +21,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import org.apache.cxf.common.logging.LogUtils;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -29,7 +30,7 @@
 
 public class ResourceAdapterInternalExceptionTest extends Assert {
     private static final Logger EXCEPTION_LOGGER = 
-        Logger.getLogger(ResourceAdapterInternalException.class.getName());
+        LogUtils.getLogger(ResourceAdapterInternalException.class);
     private Level logLevel;  
 
     @Before    

Modified: incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ConnectionFactoryImplTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ConnectionFactoryImplTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ConnectionFactoryImplTest.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ConnectionFactoryImplTest.java Thu Oct 25 10:09:20 2007
@@ -30,41 +30,42 @@
 import javax.resource.spi.ManagedConnectionFactory;
 import javax.xml.namespace.QName;
 
-
-
 import org.easymock.classextension.EasyMock;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
 public class ConnectionFactoryImplTest extends Assert {
+    
     ManagedConnectionFactory mockConnectionFactory;
-
     ConnectionManager mockConnectionManager;
+    CXFConnectionRequestInfo param;
+    ConnectionFactoryImpl cf;
 
     @Before
     public void setUp() throws Exception {
         mockConnectionFactory = EasyMock.createMock(ManagedConnectionFactory.class);
         mockConnectionManager = EasyMock.createMock(ConnectionManager.class);
+        
+        param = new CXFConnectionRequestInfo();
+        param.setInterface(Runnable.class);
+        
+        cf = new ConnectionFactoryImpl(mockConnectionFactory, mockConnectionManager);
     }
 
     @Test
     public void testInstanceOfSerializable() throws Exception {
-        ConnectionFactoryImpl cf = new ConnectionFactoryImpl(mockConnectionFactory,
-                                                             mockConnectionManager);
-        assertTrue("instance of serializable", cf instanceof Serializable);
+        assertTrue("Instance of Serializable", cf instanceof Serializable);
     }
 
     @Test
     public void testInstanceOfReferencable() throws Exception {
-        ConnectionFactoryImpl cf = new ConnectionFactoryImpl(mockConnectionFactory,
-                                                             mockConnectionManager);
-        assertTrue("instance of Referencable", cf instanceof Referenceable);
+        assertTrue("Instance of Referenceable", cf instanceof Referenceable);
 
-        assertNull("no ref set", cf.getReference());
+        assertNull("No ref set", cf.getReference());
         Reference ref = EasyMock.createMock(Reference.class);
         cf.setReference(ref);
-        assertEquals("got back what was set", ref, cf.getReference());
+        assertEquals("Got back what was set", ref, cf.getReference());
     }
 
     @Test
@@ -82,12 +83,11 @@
         EasyMock.expectLastCall().andReturn(null);
         EasyMock.replay(mockConnectionManager);
          
-       
-        ConnectionFactoryImpl cf = new ConnectionFactoryImpl((ManagedConnectionFactory)mockConnectionFactory,
-                                                             (ConnectionManager)mockConnectionManager);
-        
-        Object o = cf.getConnection(Runnable.class, new URL("file:/tmp/foo"), new QName(""), new QName(""));
-        assertNull("got the result (the passed in ConnectionRequestInfo) from out mock manager",
+        param.setWsdlLocation(new URL("file:/tmp/foo"));
+        param.setServiceName(new QName(""));
+        param.setPortName(new QName(""));
+        Object o = cf.getConnection(param);
+        assertNull("Got the result (the passed in ConnectionRequestInfo) from out mock manager",
                    o);
         EasyMock.verify(mockConnectionManager); 
     }
@@ -107,15 +107,14 @@
                                                  EasyMock.eq(reqInfo));
         EasyMock.expectLastCall().andReturn(null);
         EasyMock.replay(mockConnectionManager);
-
-        ConnectionFactoryImpl cf = new ConnectionFactoryImpl((ManagedConnectionFactory)mockConnectionFactory,
-                                                             (ConnectionManager)mockConnectionManager);
         
-        Object o = cf.getConnection(Runnable.class, new URL("file:/tmp/foo"), new QName(""));
+        param.setWsdlLocation(new URL("file:/tmp/foo"));
+        param.setServiceName(new QName(""));
+        Object o = cf.getConnection(param);
         
         EasyMock.verify(mockConnectionManager);
         
-        assertNull("got the result (the passed in ConnectionRequestInfo) from out mock manager",
+        assertNull("Got the result (the passed in ConnectionRequestInfo) from out mock manager",
                    o);
         
         
@@ -137,13 +136,12 @@
         EasyMock.expectLastCall().andReturn(null);
         EasyMock.replay(mockConnectionManager);
 
-        ConnectionFactoryImpl cf = new ConnectionFactoryImpl((ManagedConnectionFactory)mockConnectionFactory,
-                                                             (ConnectionManager)mockConnectionManager);
-
-        Object o = cf.getConnection(Runnable.class, new QName(""), new QName(""));
+        param.setServiceName(new QName(""));
+        param.setPortName(new QName(""));
+        Object o = cf.getConnection(param);
         EasyMock.verify(mockConnectionManager);
         
-        assertNull("got the result (the passed in ConnectionRequestInfo) from out mock manager",
+        assertNull("Got the result (the passed in ConnectionRequestInfo) from out mock manager",
                    o);
         
     }
@@ -164,11 +162,10 @@
         EasyMock.expectLastCall().andReturn(null);
         EasyMock.replay(mockConnectionManager);
         
-        ConnectionFactoryImpl cf = new ConnectionFactoryImpl((ManagedConnectionFactory)mockConnectionFactory,
-                                                             (ConnectionManager)mockConnectionManager);
-
-        Object o = cf.getConnection(Runnable.class, new QName(""));
-        assertNull("got the result (the passed in ConnectionRequestInfo) from out mock manager",
+        cf = new ConnectionFactoryImpl(mockConnectionFactory, mockConnectionManager);
+        param.setServiceName(new QName(""));
+        Object o = cf.getConnection(param);
+        assertNull("Got the result (the passed in ConnectionRequestInfo) from out mock manager",
                    o);
         
 
@@ -176,17 +173,27 @@
 
     @Test
     public void testGetConnectionWithNonInterface() throws Exception {
-        ConnectionFactoryImpl cf = new ConnectionFactoryImpl(mockConnectionFactory,
-                                                             mockConnectionManager);
-
         try {
-            cf.getConnection(Object.class, new URL("file:/tmp/foo"), new QName(""), new QName(""));
-            fail("expect exception on use of non interface class");
+            param.setInterface(Object.class);
+            param.setWsdlLocation(new URL("file:/tmp/foo"));
+            param.setServiceName(new QName(""));
+            param.setPortName(new QName(""));
+            cf.getConnection(param);
+            fail("Expect exception on using of none interface class");
         } catch (ResourceException re) {
-            assertTrue("nested ex is invalid arg", re.getCause() instanceof IllegalArgumentException);
+            assertTrue(true);
         }
     }
 
-    
+    @Test
+    public void testGetConnectionWithNoInterface() throws Exception {
+        try {
+            param.setInterface(null);
+            cf.getConnection(param);
+            fail("Expect exception of no interface here");
+        } catch (ResourceException re) {
+            assertTrue(true);
+        }
+    }
     
 }

Modified: incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/JCABusFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/JCABusFactoryTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/JCABusFactoryTest.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/JCABusFactoryTest.java Thu Oct 25 10:09:20 2007
@@ -21,38 +21,15 @@
 
 import java.io.File;
 import java.io.FileNotFoundException;
-//import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.Properties;
-// import java.util.ResourceBundle;
 
 import javax.resource.ResourceException;
-import javax.xml.namespace.QName;
-
-import org.w3c.dom.Node;
 
 import org.apache.cxf.Bus;
-// import org.apache.cxf.BusException;
-// import org.apache.cxf.common.i18n.Message;
-import org.apache.cxf.binding.BindingFactoryManager;
-import org.apache.cxf.binding.soap.SoapBindingFactory;
-import org.apache.cxf.binding.soap.SoapTransportFactory;
-import org.apache.cxf.bus.spring.SpringBusFactory;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.frontend.ServerFactoryBean;
-import org.apache.cxf.jaxws.JAXWSMethodInvoker;
-import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException;
-import org.apache.cxf.service.Service;
-import org.apache.cxf.service.factory.ReflectionServiceFactoryBean;
 import org.apache.cxf.test.AbstractCXFTest;
-import org.apache.cxf.transport.ConduitInitiatorManager;
-import org.apache.cxf.transport.DestinationFactoryManager;
-import org.apache.cxf.transport.local.LocalTransportFactory;
-import org.apache.cxf.wsdl.WSDLManager;
-import org.apache.cxf.wsdl11.WSDLManagerImpl;
-// import org.apache.cxf.jca.cxf.test.DummyBus;
 import org.easymock.classextension.EasyMock;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class JCABusFactoryTest extends AbstractCXFTest {
@@ -81,199 +58,6 @@
     }
 
 
-//     public void testBusInitGetProps() throws Exception {
-//         DummyBus.reset();
-//         System.setProperty("test.bus.class", DummyBus.class.getName());
-//         ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-       
-//         assertEquals("bus not yet initialized", DummyBus.getInitializeCount(), 0);
-
-        
-//         JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-//         jcaBusFactory.create(null, null);
-
-//         assertEquals("bus initialized ", DummyBus.getInitializeCount(), 1);
-       
-//     }
-
-//     public void testInitBusThrowsException() throws Exception {
-//         DummyBus.reset();
-//         System.setProperty("test.bus.class", DummyBus.class.getName());
-//         final Exception thrown = new BusException(new Message("tested bus exception!", 
-//                                                               (ResourceBundle)null, new Object[]{}));
-
-//         ClassLoader originalCl = Thread.currentThread().getContextClassLoader();
-//         try {
-//             ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-           
-//             JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-
-//             // do this for MockObject creation
-//             Thread.currentThread().setContextClassLoader(jcaBusFactory.getClass().getClassLoader());
-//             // DummyBus.setThrowException(true);
-            
-                       
-//             try {
-//                 jcaBusFactory.create(null, null);
-//                 fail("did not get expected resource exception");
-//             } catch (ResourceException re) {
-//                 System.out.println("*************************");
-//                 System.out.println(" exception: " + re.getMessage());
-//                 System.out.println("*************************");
-//                 assertTrue("cause is set", re.getCause() != null);
-//                 assertEquals("cause is expected type", thrown.getClass(), re.getCause().getClass());
-//             }
-
-//             assertEquals("init was called once", 1, DummyBus.getInitializeCount());
-
-//         } finally {
-//             Thread.currentThread().setContextClassLoader(originalCl);
-//         }
-//     }
-
-//     public void testInitBusSetsThreadContextClassLoader() throws Exception {
-//         DummyBus.reset();
-//         System.setProperty("test.bus.class", DummyBus.class.getName());
-//         ClassLoader originalCl = Thread.currentThread().getContextClassLoader();
-//         try {
-//             ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-          
-//             JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-
-//             // do this for MockObject creation
-//             Thread.currentThread().setContextClassLoader(jcaBusFactory.getClass().getClassLoader());
-
-//             Class dummyBusClass = Class.forName(DummyBus.class.getName(), true, jcaBusFactory.getClass()
-//                 .getClassLoader());
-//             // initialise here while thread context classloader is correct
-//             dummyBusClass.newInstance();
-
-//             jcaBusFactory.create(null, null);
-
-         
-//             assertEquals("init was called once", 1, DummyBus.getInitializeCount());
-//             assertTrue("loader is correct in init", DummyBus.isCorrectThreadContextClassLoader());
-
-//         } finally {
-//             Thread.currentThread().setContextClassLoader(originalCl);
-//         }
-//     }
-
-    // service strings to qname localparts
-   
-
-    @Test
-    public void testValidQNameFromString() throws Exception {
-        final Object[][] ejbServantServicePorpsTestStrings =
-            new Object[][] {{"serviceName", new QName("serviceName")},
-                            {"a/b", new QName("a/b")},
-                            {"{http://somenamespace}serviceName,portName",
-                                new QName("http://somenamespace", "serviceName")},
-                            {"{http://addd}n,portName@http://a",
-                                new QName("http://addd", "n")},
-                            {"{http://somenamespace}serviceName@file:/a/b/wsdl.wsdl",
-                                new QName("http://somenamespace", "serviceName")},
-                            {"{http://somenamespace}serviceName@http://a?param=1",
-                                new QName("http://somenamespace", "serviceName")}};
-        
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        for (int i = 0; i < ejbServantServicePorpsTestStrings.length; i++) {
-            String val = (String)ejbServantServicePorpsTestStrings[i][0];
-            QName expected = (QName)ejbServantServicePorpsTestStrings[i][1];
-
-            assertEquals("correct qname from mapping for " + val, expected, jcaBusFactory
-                .serviceQNameFromString(val));
-        }
-    }
-
-    @Test
-    public void testInvalidQNameFromString() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        try {
-            jcaBusFactory.serviceQNameFromString("a@");
-            fail("expecte ex on invalid format");
-        } catch (ResourceException expected) {
-            assertTrue(expected.getCause() instanceof java.util.NoSuchElementException);
-        }
-    }
-
-    
-
-    @Test
-    public void testWsdlLocFromString() throws Exception {
-        //service strings to wsdl urls
-        final String[][] ejbServantServicePropsTestStringsWsdlLoc = 
-            new String[][] {{"serviceName", null},
-                            {"a/b", null},
-                            {"{http://somenamespace}serviceName", null},
-                            {"{http://somenamespace}serviceName,portName@file:/a/b/wsdl.wsdl", 
-                                "file:/a/b/wsdl.wsdl"},
-                            {"{http://somenamespace}serviceName,portName@http://a?param=1",
-                                "http://a?param=1"}};
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        for (int i = 0; i < ejbServantServicePropsTestStringsWsdlLoc.length; i++) {
-            String val = ejbServantServicePropsTestStringsWsdlLoc[i][0];
-            String expectedUrl = ejbServantServicePropsTestStringsWsdlLoc[i][1];
-
-            assertEquals("correct wsdlLocation from mapping for " + val, expectedUrl, jcaBusFactory
-                .wsdlLocFromString(val));
-        }
-    }
-
-    
-    @Test
-    public void testPortNameFromString() throws Exception {
-        //service strings to portName
-        final String[][] ejbServantServicePropsTestStringsPortName = 
-            new String[][] {{"serviceName", null},
-                            {"a/b", null},
-                            {"{http://somenamespace}serviceName", null},
-                            {"{http://somenamespace}serviceName,portName1@file:/a/b/wsdl.wsdl",
-                                "portName1"},
-                            {"{http://somenamespace}serviceName,portName2@http://a?param=1", 
-                                "portName2"}};
-
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        for (int i = 0; i < ejbServantServicePropsTestStringsPortName.length; i++) {
-            String val = ejbServantServicePropsTestStringsPortName[i][0];
-            String expectedUrl = ejbServantServicePropsTestStringsPortName[i][1];
-
-            assertEquals("correct wsdlLocation from mapping for " + val, expectedUrl, jcaBusFactory
-                .portNameFromString(val));
-        }
-    }
-
-    @Test
-    public void testInvalidPortNameFromString() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        try {
-            jcaBusFactory.portNameFromString("serviceName,");
-            fail("expect ex on invalid format");
-        } catch (ResourceException expected) {
-            assertTrue(expected.getCause() instanceof java.util.NoSuchElementException);
-        }
-
-        try {
-            jcaBusFactory.portNameFromString("serviceName,@abc");
-            fail("expect ex on invalid format");
-        } catch (ResourceException expected) {
-            assertTrue("Exception message starts with Empty portName", expected.getMessage()
-                .startsWith("Empty portName"));
-        }
-
-        try {
-            jcaBusFactory.portNameFromString("serviceName,abc,uuu");
-            fail("expect ex on invalid format");
-        } catch (ResourceException expected) {
-            assertTrue("Exception message starts with portName already set", expected.getMessage()
-                .startsWith("portName already set"));
-        }
-    }
 
     @Test
     public void testLoadNonexistentProperties() throws Exception {
@@ -287,7 +71,8 @@
                        re.getCause() instanceof FileNotFoundException);
         }
     }
-
+    
+    @Test
     public void testInvalidMonitorConfigNoPropsURL() throws Exception {
         ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
         mcf.setMonitorEJBServiceProperties(Boolean.TRUE);
@@ -295,7 +80,7 @@
         try {
             Bus mockBus = EasyMock.createMock(Bus.class);
             jcaBusFactory.setBus(mockBus);
-            jcaBusFactory.initialiseServants();
+            jcaBusFactory.initializeServants();
             fail("exception expected");
         } catch (ResourceAdapterInternalException re) {
             assertTrue("EJBServiceProperties is not set.", re.getMessage()
@@ -303,7 +88,7 @@
         }
     }
     
-    
+    @Ignore
     @Test
     public void testInitServants() throws Exception {
         ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
@@ -314,284 +99,10 @@
         Bus mockBus = EasyMock.createMock(Bus.class);
 
         jcaBusFactory.setBus((Bus)mockBus);
-        jcaBusFactory.initialiseServants();
-        
-    }
-    
-    @Test
-    public void testCreateService() throws Exception {
-        Bus springBus = new SpringBusFactory().createBus();
-        
-        JCABusFactory jcaBusFactory = new JCABusFactory(null);
-        jcaBusFactory.setBus(springBus);
-        jcaBusFactory.initBus();
-        
-        ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
-        Service service = jcaBusFactory.createService(HelloInterface.class, bean);
-        assertEquals("test", service.get("test"));
-    }
-
-    @Test
-    public void testCreateServer() throws Exception {
-        //Bus springBus = new SpringBusFactory().createBus();
-        
-        SoapBindingFactory bindingFactory = new SoapBindingFactory();
-
-        bus.getExtension(BindingFactoryManager.class)
-            .registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bindingFactory);
-
-        DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
-
-        SoapTransportFactory soapDF = new SoapTransportFactory();
-        soapDF.setBus(bus);
-        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/", soapDF);
-        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/", soapDF);
-        
-        LocalTransportFactory localTransport = new LocalTransportFactory();
-        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/soap/http", localTransport);
-        dfm.registerDestinationFactory("http://schemas.xmlsoap.org/wsdl/soap/http", localTransport);
-        dfm.registerDestinationFactory("http://cxf.apache.org/bindings/xformat", localTransport);
-
-        ConduitInitiatorManager extension = bus.getExtension(ConduitInitiatorManager.class);
-        extension.registerConduitInitiator(LocalTransportFactory.TRANSPORT_ID, localTransport);
-        extension.registerConduitInitiator("http://schemas.xmlsoap.org/wsdl/soap/", localTransport);
-        extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/http", localTransport);
-        extension.registerConduitInitiator("http://schemas.xmlsoap.org/soap/", localTransport);
-        
-        bus.setExtension(new WSDLManagerImpl(), WSDLManager.class);
-
-        
-        JCABusFactory jcaBusFactory = new JCABusFactory(null);
-        jcaBusFactory.setBus(bus);
-        jcaBusFactory.initBus();
-        
-        ReflectionServiceFactoryBean bean = new JaxWsServiceFactoryBean();
-        Service service = jcaBusFactory.createService(HelloInterface.class, bean);
-        assertEquals("test", service.get("test"));
-        
-        Imple im = new Imple();
-        
-        service.setInvoker(new JAXWSMethodInvoker(im));
-
-        ServerFactoryBean svrFactory = new ServerFactoryBean();
-
-        String address = "http://localhost:9999/Hello";
-        Server server = jcaBusFactory.createServer(svrFactory, bean, address);
-        assertNotNull("The server should not be null", server);
-        
-        Node res = invoke("http://localhost:9999/Hello", 
-                          LocalTransportFactory.TRANSPORT_ID,
-                          "sayHi.xml");
-        assertNotNull("We should get the result ", res);
-    }
-  
-    /*
-    public void testAddServantsCache() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        ClassLoader cl = this.getClass().getClassLoader();
-        Bus bus = jcaBusFactory.initBus(cl);
-
-        Properties props = new Properties();
-        String wsdlLocation =
-            this.getClass().getResource("resources/hello_world.wsdl").toString();
-
-        System.out.println("  in test wsdlLocation: " + wsdlLocation);
-        props.put("jndiName", "{http://apache.org/hello_world_soap_http}SOAPService@"
-                  + wsdlLocation);
-
-        assertTrue("there's no registered servants at beginning", jcaBusFactory.getRegisteredServants()
-            .isEmpty());
-        jcaBusFactory.setBus(bus);
-        jcaBusFactory.initialiseServantsFromProperties(props, true);
-       
-        javax.xml.ws.Endpoint ep = (javax.xml.ws.Endpoint) jcaBusFactory.getRegisteredServants().get(0);
-              
-        assertTrue("registered servant with the expected service name", ((javax.xml.ws.Endpoint)jcaBusFactory
-            .getRegisteredServants().get(0)).isPublished());
-        ep.stop();
-        jcaBusFactory.deregisterServants(bus);
-
-        assertTrue("servants should be deregistered", jcaBusFactory.getRegisteredServants().isEmpty());
-        bus.shutdown(true);
-    }
-    
-    */
-//     public void testInitServantsFromPropertiesWithPortName() throws Exception {
-//         ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-//         JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-//         Bus mockBus = EasyMock.createMock(Bus.class);
-//         jcaBusFactory.setBus(mockBus);
-//         Properties props = new Properties();
-//         props.put("jndiName", "{http://objectweb.org/hello_world_soap_http}SOAPService,SoapPort@file:///");
-//         try {
-//             jcaBusFactory.initialiseServantsFromProperties(props, true);
-//         } catch (ResourceException expected) {
-//             assertTrue("reasonable message", expected.toString().indexOf("jndiName") != -1);
-//             assertTrue(expected instanceof ResourceAdapterInternalException);            
-//         }
-//     }
-
-//     public void testInitServantsFromPropertiesWithMissingWsdlLocInPropertiesAndConfig() throws Exception {
-//         ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-//         JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-//         Bus mockBus = EasyMock.createMock(Bus.class);
-//         jcaBusFactory.setBus(mockBus);
-//         final String jndiName = "/a/b";
-//         try {
-//             Properties props = new Properties();
-//             props.put(jndiName, "{http://ns}ServiceA");
-//             jcaBusFactory.initialiseServantsFromProperties(props, true);
-//             fail("expect ex on missing wsdl loc");
-//         } catch (ResourceException expected) {
-//             assertTrue("reasonable message", expected.toString().indexOf(jndiName) != -1);
-//             assertTrue(expected instanceof ResourceAdapterInternalException);
-//             assertTrue(expected.getMessage().indexOf("ServiceA") != -1);
-//         }
-//     }
-     
-    @Test
-    public void testInitServantsFromPropertiesWithNoServiceQName() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        Bus mockBus = EasyMock.createMock(Bus.class);
-        jcaBusFactory.setBus(mockBus);
-        final String jndiName = "/a/b";
-        try {
-            Properties props = new Properties();
-            props.put(jndiName, "");
-            jcaBusFactory.initialiseServantsFromProperties(props, true);
-            fail("expect ex on missing service QName value");
-        } catch (ResourceException expected) {
-            assertTrue("reasonable message", expected.toString().indexOf(jndiName) != -1);
-        }
-    }
-
-/*  so far doesn't support wsdl file  
-    public void testInitFromPropsWithInvalidWsdlLocUrls() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-
-      
-        try {
-            Properties props = new Properties();
-            props.put("/a/b", "{http://ns}ServiceA@unknownprotocol:/a");
-            jcaBusFactory.initialiseServantsFromProperties(props, true);
-            fail("expect ex on unknown protocol");
-        } catch (ResourceException expected) {
-            assertTrue("have a jcaBusFactorye " + expected.getCause(),
-                       expected.getCause() instanceof MalformedURLException);
-        }
-
-        try {
-            Properties props = new Properties();
-            props.put("/a/b", "{http://ns}ServiceA@a/b");
-            jcaBusFactory.initialiseServantsFromProperties(props, true);
-
-            fail("expect ex on invalid format, no scheme");
-        } catch (ResourceException expected) {
-            assertTrue("have a mue " + expected.getCause(),
-                       expected.getCause() instanceof MalformedURLException);
-        }
-
-        try {
-            Properties props = new Properties();
-            props.put("/a/b", "{http://ns}ServiceA@http://nowhere.plannetx.cupoftea:9090/NoWhere");
-            jcaBusFactory.initialiseServantsFromProperties(props, true);
-
-            fail("expect ex on invalid url, dud host name");
-        } catch (ResourceException expected) {
-            // resolving the URL above results in an IOException which
-            // may be UnknowHostException or something different
-            // depending on the platoform
-            assertTrue("unexpected exception received: " + expected.getCause(),
-                       expected.getCause() instanceof java.io.IOException);       
-
-        }
-          
-    }
-*/
-    
-    @Test
-    public void testInitFromPropsDoesNotThrowExceptionWhenSomethingGoesWrong() throws Exception {
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        Bus mockBus = EasyMock.createMock(Bus.class);
-        jcaBusFactory.setBus(mockBus);
-        Properties props = new Properties();
-        props.put("/a/b", "{http://ns}ServiceA@unknownprotocol:/a");
-        
-        jcaBusFactory.initialiseServantsFromProperties(props, false);
-           
-    }
-
-    /*
-    public void testPropertiesMonitorThreadCausesSomeFailures() throws Exception {
-        FileChannel in = null;
-        FileChannel out = null;
-        URL propFile = getClass().getResource("resources/ejb_servants_one_wrong.properties");
-        
-        File origFile = new File(propFile.toString().substring(5));
-        File tmpFile = File.createTempFile("anyname", "properties");
-        File tmpDir = tmpFile.getParentFile();
-
-        File testFile = new File(tmpDir, "otherunittest.properties");
-        if (testFile.exists()) {
-            testFile.delete();
-        }
-        assertTrue("file: " + testFile.getAbsolutePath() + " does not exist", !(testFile.exists()));
-
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        mcf.setEJBServicePropertiesURL(testFile.toURI().toURL().toString());
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        Bus mockBus = EasyMock.createMock(Bus.class);
-        jcaBusFactory.setBus((Bus)mockBus);
-
-        JCABusFactory.EJBServicePropertiesMonitorRunnable propsRunnable =
-            jcaBusFactory.new EJBServicePropertiesMonitorRunnable(5);
-        propsRunnable.setContinue(false);        
-        propsRunnable.run();
-        //do nothing here 
-        
-        testFile.createNewFile();
-        assertTrue("file exist", testFile.exists());
-        try {
-            in = new FileInputStream(origFile).getChannel();            
-            out = new FileOutputStream(testFile).getChannel();
-            long size = in.size();
-            MappedByteBuffer buf = in.map(FileChannel.MapMode.READ_ONLY, 0, size);            
-            out.write(buf);
-        } finally {
-            if (in != null) {
-                in.close();
-            }
-
-            if (out != null) {
-                out.close();
-            }
-        }
-
-        propsRunnable.run();
-        testFile.delete();
+        jcaBusFactory.initializeServants();
         
     }
     
-    public void testInitServantsWithBootstrapContextNotNull() throws Exception {
-        System.setProperty("test.bus.class", DummyBus.class.getName());
-        ManagedConnectionFactoryImpl mcf = new ManagedConnectionFactoryImpl();
-        mcf.setCXFInstallDir(DummyBus.vobRoot());
-        mcf.setCXFCEURL(DummyBus.CXFCEURL);
-
-        assertEquals("bus not yet initialized", DummyBus.initializeCount, 0);
-
-        JCABusFactory jcaBusFactory = new JCABusFactory(mcf);
-        BootstrapContext bc = (BootstrapContext)MockObjectFactory.create(BootstrapContext.class);
-        assertNotNull("BootstrapContext is not null", bc);
-        jcaBusFactory.create(null, bc);
-        assertEquals("BoostrapContext set", jcaBusFactory.getBootstrapContext(), bc);
-        assertEquals("bus initialized ", DummyBus.initializeCount, 1);
-    }
-*/
    
 }
 

Modified: incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionImplTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionImplTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionImplTest.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionImplTest.java Thu Oct 25 10:09:20 2007
@@ -22,9 +22,9 @@
 import java.lang.reflect.Proxy;
 import java.net.URL;
 
-import javax.resource.NotSupportedException;
 import javax.resource.ResourceException;
 import javax.resource.spi.ConnectionEvent;
+import javax.resource.spi.ManagedConnectionMetaData;
 import javax.resource.spi.ResourceAdapterInternalException;
 import javax.resource.spi.security.PasswordCredential;
 import javax.security.auth.Subject;
@@ -44,29 +44,22 @@
     protected QName serviceName;
     protected QName portName;
 
-    @Test   
+    @Test
     public void testInstanceOfConnection() throws Exception {
-        assertTrue("instance of Connection", mci instanceof Connection);
+        assertTrue("Instance of Connection", mci instanceof Connection);
         ((Connection)mci).close();
     }
 
     @Test
     public void testGetConnectionServiceGetPortThrows() throws Exception {
-        
-        cri = new CXFConnectionRequestInfo(Foo.class, null, serviceName, null);
-        
-        try {
-            //Can not create JAX-WS proxy using pojo
-            mci.getConnection(subj, cri);
-            fail("Did not get expected ResourceAdapterInternalException");         
-           
-        } catch (ResourceAdapterInternalException raie) {
-            //do nothing
-        }
+        cri = new CXFConnectionRequestInfo(Foo.class, null, null, null);
+        cri.setAddress("http://localhost:9000/soap");
+        Object o = mci.getConnection(subj, cri);
+        assertTrue(o instanceof Foo);
     }
 
     
-    @Ignore("need to check the classloader")
+    @Ignore("Need to check the classloader")
     public void testThreadContextClassLoaderIsSet() throws Exception {
         //set the threadContextClassLoader for Bus 
         //TODO njiang classloader things
@@ -76,28 +69,22 @@
     
     @Test
     public void testGetConnectionWithNoWSDLInvokesCreateClientWithTwoParameters() throws Exception {
-
-
         cri = new CXFConnectionRequestInfo(Greeter.class, null, serviceName, portName);
         // need to get wsdl
         Object o = mci.getConnection(subj, cri);
 
-        assertTrue("checking implementation of Connection interface", o instanceof Connection);
-        assertTrue("checking implementation of passed interface", o instanceof Greeter);
+        assertTrue("Checking implementation of Connection interface", o instanceof Connection);
+        assertTrue("Checking implementation of passed interface", o instanceof Greeter);
     }
     
+
     @Test
     public void testGetConnectionWithNoWSDLInvokesCreateClientWithTwoArgs()
         throws Exception {
-
         cri = new CXFConnectionRequestInfo(Greeter.class, null, serviceName, null);
-
         Object o = mci.getConnection(subj, cri);
-        assertTrue("checking implementation of Connection interface", o instanceof Connection);
-        assertTrue("checking implementation of passed interface", o instanceof Greeter);
-        
-     
-
+        assertTrue("Checking implementation of Connection interface", o instanceof Connection);
+        assertTrue("Checking implementation of passed interface", o instanceof Greeter);
     }
 
     @Ignore
@@ -110,32 +97,32 @@
         
         Object o = mci.getConnection(subj, cri);
 
-        assertTrue("returned connect does not implement Connection interface", o instanceof Connection);
-        assertTrue("returned connect does not implement Connection interface", o instanceof Greeter);
+        assertTrue("Returned connection does not implement Connection interface", o instanceof Connection);
+        assertTrue("Returned connection does not implement Connection interface", o instanceof Greeter);
     }
 
+
     @Test
     public void testGetConnectionReturnsConnection() throws ResourceException {
         Object o = mci.getConnection(subj, cri);
-        assertTrue("returned connect does not implement Connection interface", o instanceof Connection);
-        assertTrue("returned connect does not implement Connection interface", o instanceof Greeter);
+        assertTrue("Returned connection does not implement Connection interface", o instanceof Connection);
+        assertTrue("Returned connection does not implement Connection interface", o instanceof Greeter);
     }
 
     private void verifyProxyInterceptors(Object o) {
-
         assertTrue(o instanceof Proxy);
-        
-        assertEquals("fist handler must be a ProxyInvocation Handler", ProxyInvocationHandler.class, 
+        assertEquals("First handler must be a ProxyInvocation Handler", ProxyInvocationHandler.class, 
                      Proxy.getInvocationHandler(o).getClass());
     }
 
+
     @Test
     public void testGetConnectionWithDudSubjectA() throws ResourceException {
         Object o = mci.getConnection(subj, cri);
-
         verifyProxyInterceptors(o);
     }
 
+
     @Test
     public void testGetConnectionWithDudSubjectB() throws ResourceException {
         String user = new String("user");
@@ -143,10 +130,11 @@
         PasswordCredential creds = new PasswordCredential(user, password);
         subj.getPrivateCredentials().add(creds);
         Object o = mci.getConnection(subj, cri);
-
+        
         verifyProxyInterceptors(o);
     }
 
+
     @Test
     public void testGetConnectionWithSubject() throws ResourceException {
         String user = new String("user");
@@ -161,20 +149,18 @@
  
 
     @Test
-    public void testCloseConnection() throws Exception {
-      
-        final Connection conn = (Connection)mci.getConnection(subj, cri);
+    public void testCloseConnection() throws Exception {      
+        Connection conn = (Connection)mci.getConnection(subj, cri);
         EasyMock.reset(mockListener);
         mockListener.connectionClosed(EasyMock.isA(ConnectionEvent.class));
         EasyMock.expectLastCall();
-        EasyMock.replay(mockListener);       
+        EasyMock.replay(mockListener);
         conn.close();
     }
 
+
     @Test
     public void testAssociateConnection() throws Exception {
-
-        // Create the additional ManagedConnectionImpl ..
         
         CXFConnectionRequestInfo cri2 = new CXFConnectionRequestInfo(Greeter.class,
                                                                          new URL("file:/tmp/foo2"),
@@ -185,9 +171,9 @@
 
         Object o = mci.getConnection(subj, cri);
 
-        assertTrue("returned connect does not implement Connection interface", o instanceof Connection);
-        assertTrue("returned connect does not implement Connection interface", o instanceof Greeter);
-        assertTrue("returned connection is not a java.lang.reflect.Proxy instance", o instanceof Proxy);
+        assertTrue("Returned connection does not implement Connection interface", o instanceof Connection);
+        assertTrue("Returned connection does not implement Connection interface", o instanceof Greeter);
+        assertTrue("Returned connection is not a java.lang.reflect.Proxy instance", o instanceof Proxy);
 
         InvocationHandler handler = Proxy.getInvocationHandler(o);
 
@@ -196,45 +182,41 @@
 
         Object assocMci = ((CXFInvocationHandler)handler).getData().getManagedConnection();
 
-        assertTrue("asserting associated ManagedConnection.", mci == assocMci);
-        assertTrue("asserting associated ManagedConnection.", mci2 != assocMci);
+        assertTrue("Asserting associated ManagedConnection.", mci == assocMci);
+        assertTrue("Asserting associated ManagedConnection.", mci2 != assocMci);
 
         mci2.associateConnection(o);
 
         assocMci = ((CXFInvocationHandler)handler).getData().getManagedConnection();
 
-        assertTrue("asserting associated ManagedConnection.", mci2 == assocMci);
-        assertTrue("asserting associated ManagedConnection.", mci != assocMci);
+        assertTrue("Asserting associated ManagedConnection.", mci2 == assocMci);
+        assertTrue("Asserting associated ManagedConnection.", mci != assocMci);
 
     }
 
+
     @Test
     public void testAssociateConnectionThrowsException() throws Throwable {
 
-        
         InvocationHandler ih = EasyMock.createMock(InvocationHandler.class);
                 
         Object dodgyHandle = Proxy.newProxyInstance(getClass().getClassLoader(), new Class[] {Foo.class}, ih);
 
         try {
             mci.associateConnection(dodgyHandle);
-            fail("except exception on call with ClassCast Exception");
+            fail("Except exception on call with ClassCast Exception");
         } catch (ResourceAdapterInternalException raie) {
-            assertTrue("asserting ResourceException.",
-                       raie.getMessage().indexOf("Error associating handle") != -1);
-            assertTrue("asserting ResourceException.", raie.getCause() instanceof ClassCastException);
+            assertTrue(true);
         }
 
     }
 
+
     @Test
     public void testGetMetaData() throws Exception {
-        try {
-            mci.getMetaData();
-            fail("expect exception on getMetaData");
-        } catch (NotSupportedException expected) {
-            // do nothing here
-        }
+        ManagedConnectionMetaData data = mci.getMetaData();
+        assertEquals("Checking the EISProductionVersion", "1.1", data.getEISProductVersion());
+        assertEquals("Checking the EISProductName", "WS-based-EIS", data.getEISProductName());
     }
   
 }

Modified: incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionTestBase.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionTestBase.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionTestBase.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionTestBase.java Thu Oct 25 10:09:20 2007
@@ -46,14 +46,11 @@
 
     protected ManagedConnectionImpl mci;
 
-    protected ManagedConnectionFactoryImpl factory = 
-        EasyMock.createMock(ManagedConnectionFactoryImpl.class);
+    protected ManagedConnectionFactoryImpl factory = EasyMock.createMock(ManagedConnectionFactoryImpl.class);
 
     protected Bus bus;
     
-
-    protected ConnectionEventListener mockListener = 
-        EasyMock.createMock(ConnectionEventListener.class);
+    protected ConnectionEventListener mockListener = EasyMock.createMock(ConnectionEventListener.class);
     
     public ManagedConnectionTestBase() {
         
@@ -89,11 +86,9 @@
         
         EasyMock.expectLastCall().andReturn(bus).anyTimes();
         EasyMock.replay(factory);
-        
-        
+                
         mci = new ManagedConnectionImpl(factory, cri, subj);        
-      
-        
+              
         mci.addConnectionEventListener(mockListener);
     }
     

Modified: incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/jarloader/JarLoaderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/jarloader/JarLoaderTest.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/jarloader/JarLoaderTest.java (original)
+++ incubator/cxf/branches/jliu/integration/jca/src/test/java/org/apache/cxf/jca/jarloader/JarLoaderTest.java Thu Oct 25 10:09:20 2007
@@ -22,6 +22,7 @@
 import java.util.Map;
 import java.util.logging.Logger;
 
+import org.apache.cxf.common.logging.LogUtils;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -29,7 +30,7 @@
 
 
 public class JarLoaderTest extends Assert {
-    private static final Logger LOG = Logger.getLogger(JarLoaderTest.class.getName());
+    private static final Logger LOG = LogUtils.getLogger(JarLoaderTest.class);
     private URL exampleRarURL;
 
 

Modified: incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/pom.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/pom.xml (original)
+++ incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/pom.xml Thu Oct 25 10:09:20 2007
@@ -84,13 +84,7 @@
             <artifactId>cxf-tools-wsdlto-frontend-jaxws</artifactId>
             <version>${project.version}</version>
         </dependency>
-
-        <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-tools-java2wsdl</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
+                     
         <dependency>
             <groupId>ant</groupId>
             <artifactId>ant</artifactId>

Modified: incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java (original)
+++ incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/CodegenUtils.java Thu Oct 25 10:09:20 2007
@@ -19,9 +19,11 @@
 
 package org.apache.cxf.maven_plugin;
 
+import java.io.File;
 import java.io.IOException;
 
 import java.net.MalformedURLException;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Enumeration;
 import java.util.jar.JarEntry;
@@ -65,20 +67,26 @@
                     return;
                 }
             }
-            JarFile jar;
             try {
-                jar = new JarFile(url.getPath());
-                Enumeration entries = jar.entries();
-                while (entries.hasMoreElements()) {
-                    JarEntry entry = (JarEntry)entries.nextElement();
-                    if (!entry.isDirectory()
-                        && !entry.getName().startsWith("META")
-                        && entry.getTime() > timestamp) {
-                        
-                        timestamp = entry.getTime();
-                    }                    
+                if (url.getPath().endsWith(".class")) {
+                    timestamp = new File(url.toURI()).lastModified();
+                } else {
+                    JarFile jar = new JarFile(url.getPath());
+                    Enumeration entries = jar.entries();
+                    while (entries.hasMoreElements()) {
+                        JarEntry entry = (JarEntry)entries.nextElement();
+                        if (!entry.isDirectory()
+                            && !entry.getName().startsWith("META")
+                            && entry.getTime() > timestamp) {
+                            
+                            timestamp = entry.getTime();
+                        }                    
+                    }
                 }
             } catch (IOException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            } catch (URISyntaxException e) {
                 // TODO Auto-generated catch block
                 e.printStackTrace();
             }

Modified: incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java (original)
+++ incubator/cxf/branches/jliu/maven-plugins/codegen-plugin/src/main/java/org/apache/cxf/maven_plugin/WSDL2JavaMojo.java Thu Oct 25 10:09:20 2007
@@ -20,11 +20,18 @@
 package org.apache.cxf.maven_plugin;
 
 import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.tools.wsdlto.WSDLToJava;
+import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.project.MavenProject;
@@ -33,7 +40,8 @@
 /**
  * @goal wsdl2java
  * @description CXF WSDL To Java Tool
- */
+ * @requiresDependencyResolution test
+*/
 public class WSDL2JavaMojo extends AbstractMojo {
     /**
      * @parameter
@@ -53,12 +61,6 @@
     String classesDirectory;
 
     /**
-     * @parameter  expression="${project.compileClasspathElements}"
-     * @required
-     */
-    List classpathElements;
-
-    /**
      * @parameter expression="${project}"
      * @required
      */
@@ -83,19 +85,44 @@
             throw new MojoExecutionException("Must specify wsdlOptions");
         }
 
+        List<URL> urlList = new ArrayList<URL>();
         StringBuffer buf = new StringBuffer();
-        Iterator it = classpathElements.iterator();
-        while (it.hasNext()) {
-            buf.append(it.next().toString());
-            buf.append(File.pathSeparatorChar);
+
+        try {
+            urlList.add(classesDir.toURL());
+        } catch (MalformedURLException e) {
+            //ignore
         }
+
+        buf.append(classesDir.getAbsolutePath());
+        buf.append(File.pathSeparatorChar);
+
+        for (Artifact a : CastUtils.cast(project.getTestArtifacts(), Artifact.class)) {
+            try {
+                if (a.getFile() != null
+                    && a.getFile().exists()) {
+                    urlList.add(a.getFile().toURL());
+                    buf.append(a.getFile().getAbsolutePath());
+                    buf.append(File.pathSeparatorChar);
+                    //System.out.println("     " + a.getFile().getAbsolutePath());
+                }
+            } catch (MalformedURLException e) {
+                //ignore
+            }
+        }
+        
+        ClassLoader origContext = Thread.currentThread().getContextClassLoader();
+        URLClassLoader loader = new URLClassLoader(urlList.toArray(new URL[urlList.size()]),
+                                                   origContext);
         String newCp = buf.toString();
 
         String cp = System.getProperty("java.class.path");
         SecurityManager oldSm = System.getSecurityManager();
         long timestamp = CodegenUtils.getCodegenTimestamp();
         boolean result = true;
+        
         try {
+            Thread.currentThread().setContextClassLoader(loader);
             System.setProperty("java.class.path", newCp);
             System.setSecurityManager(new NoExitSecurityManager());
             for (int x = 0; x < wsdlOptions.length; x++) {
@@ -109,6 +136,12 @@
                 }
             }
         } finally {
+            //cleanup as much as we can.
+            Bus bus = BusFactory.getDefaultBus(false);
+            if (bus != null) {
+                bus.shutdown(true);
+            }
+            Thread.currentThread().setContextClassLoader(origContext);
             System.setSecurityManager(oldSm);
             System.setProperty("java.class.path", cp);
         }
@@ -150,6 +183,7 @@
 
 
         if (doWork) {
+            doneFile.delete();
 
             List<String> list = new ArrayList<String>();
             if (wsdlOption.getPackagenames() != null) {
@@ -184,11 +218,9 @@
                     }
                     System.setProperty("exitOnFinish", "YES");
                     WSDLToJava.main((String[])list.toArray(new String[list.size()]));
-                    doneFile.delete();
                     doneFile.createNewFile();
                 } catch (ExitException e) {
                     if (e.getStatus() == 0) {
-                        doneFile.delete();
                         doneFile.createNewFile();
                     } else {
                         throw e;

Modified: incubator/cxf/branches/jliu/maven-plugins/eclipse-plugin-generator/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/maven-plugins/eclipse-plugin-generator/pom.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/maven-plugins/eclipse-plugin-generator/pom.xml (original)
+++ incubator/cxf/branches/jliu/maven-plugins/eclipse-plugin-generator/pom.xml Thu Oct 25 10:09:20 2007
@@ -85,12 +85,6 @@
         </dependency>
 
         <dependency>
-            <groupId>org.apache.cxf</groupId>
-            <artifactId>cxf-tools-java2wsdl</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-
-        <dependency>
             <groupId>ant</groupId>
             <artifactId>ant</artifactId>
         </dependency>

Propchange: incubator/cxf/branches/jliu/maven-plugins/java2ws-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Oct 25 10:09:20 2007
@@ -0,0 +1,10 @@
+.pmd
+.checkstyle
+.ruleset
+target
+.settings
+.classpath
+.project
+.wtpmodules
+
+

Modified: incubator/cxf/branches/jliu/parent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/jliu/parent/pom.xml?rev=588283&r1=588282&r2=588283&view=diff
==============================================================================
--- incubator/cxf/branches/jliu/parent/pom.xml (original)
+++ incubator/cxf/branches/jliu/parent/pom.xml Thu Oct 25 10:09:20 2007
@@ -43,14 +43,14 @@
         <saaj.impl.groupId>com.sun.xml.messaging.saaj</saaj.impl.groupId>
         <saaj.impl.artifactId>saaj-impl</saaj.impl.artifactId>
 
-        <jaxb.version>2.0</jaxb.version>
-        <jaxb.impl.version>2.0.5</jaxb.impl.version>
-        <jaxb.xjc.version>2.0</jaxb.xjc.version>
-        <jaxws.version>2.0</jaxws.version>
+        <jaxb.version>2.1</jaxb.version>
+        <jaxb.impl.version>2.1.4</jaxb.impl.version>
+        <jaxb.xjc.version>2.1.4</jaxb.xjc.version>
+        <jaxws.version>2.1</jaxws.version>
         <jetty.version>6.1.5</jetty.version>
         <saaj.version>1.3</saaj.version>
         <saaj.impl.version>1.3</saaj.impl.version>
-        <spring.version>2.0.4</spring.version>
+        <spring.version>2.0.6</spring.version>
         <wsdl4j.version>1.6.1</wsdl4j.version>
         <derby.version>10.2.2.0</derby.version>
         <activemq.version>4.1.1</activemq.version>
@@ -61,7 +61,7 @@
         <spring.validation.mode>VALIDATION_AUTO</spring.validation.mode>
 
         <downloadSources>true</downloadSources>
-        <servicemix.version>3.1-incubating</servicemix.version>
+        <servicemix.version>3.1.2</servicemix.version>
     </properties>
 
 
@@ -128,7 +128,7 @@
                     <version>1.1</version>
                     <dependencies>
                         <dependency>
-		             <groupId>org.apache.cxf</groupId>
+                            <groupId>org.apache.cxf</groupId>
                              <artifactId>cxf-xjc-dv</artifactId>
                              <version>${project.version}</version>
                         </dependency>
@@ -236,6 +236,13 @@
                                 <name>spring.validation.mode</name>
                                 <value>${spring.validation.mode}</value>
                             </property>
+                            <property>
+                                <!-- If we close the port after a client in the same JVM has oppened a keep-alive
+                                connection, on some Linux's, the socket remains consumed until
+                                some timeout occurs.   That may cause some tests to timeout/hang. -->
+                                <name>org.apache.cxf.transports.http_jetty.DontClosePort</name>
+                                <value>true</value>
+                            </property>
                         </systemProperties>
                     </configuration>
                 </plugin>
@@ -244,7 +251,7 @@
         <plugins>
             <plugin>
                 <artifactId>maven-remote-resources-plugin</artifactId>
-                <version>1.0-alpha-5</version>
+                <version>1.0-alpha-6</version>
                 <dependencies>
                     <dependency>
                         <groupId>org.apache.cxf</groupId>
@@ -260,13 +267,14 @@
                         <configuration>
                             <resourceBundles>
                                 <resourceBundle>org.apache:apache-incubator-disclaimer-resource-bundle:1.1</resourceBundle>
-                                <resourceBundle>org.apache:apache-jar-resource-bundle:1.2</resourceBundle>
+                                <resourceBundle>org.apache:apache-jar-resource-bundle:1.3</resourceBundle>
                             </resourceBundles>
                             <supplementalModels>
                                 <supplementalModel>notice-supplements.xml</supplementalModel>
                             </supplementalModels>
                             <properties>
                                 <addLicense>true</addLicense>
+                                <addArtifact>true</addArtifact>
                                 <projectName>Apache CXF</projectName>
                             </properties>
                         </configuration>
@@ -354,9 +362,26 @@
             </dependency>
 
             <dependency>
-                <groupId>org.apache.ws.commons.neethi</groupId>
+                <groupId>org.apache.servicemix</groupId>
+                <artifactId>servicemix-jbi</artifactId>
+                <version>${servicemix.version}</version>
+                <scope>provided</scope>
+                <exclusions>
+                    <exclusion>
+                        <groupId>servicemix</groupId>
+                        <artifactId>jaxp</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>mx4j</groupId>
+                        <artifactId>mx4j</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.neethi</groupId>
                 <artifactId>neethi</artifactId>
-                <version>2.0</version>
+                <version>2.0.2</version>
                 <exclusions>
                     <exclusion>
                         <groupId>log4j</groupId>
@@ -395,8 +420,8 @@
                 <version>3.2.1</version>
             </dependency>
             <dependency>
-                <groupId>jetty</groupId>
-                <artifactId>org.mortbay.jetty</artifactId>
+                <groupId>org.mortbay.jetty</groupId>
+                <artifactId>jetty</artifactId>
                 <version>${jetty.version}</version>
                 <exclusions>
                     <exclusion>
@@ -408,7 +433,7 @@
             <dependency>
                 <groupId>org.apache.ws.commons.schema</groupId>
                 <artifactId>XmlSchema</artifactId>
-                <version>1.2</version>
+                <version>1.3.2</version>
             </dependency>
             <dependency>
                 <groupId>javax.xml.soap</groupId>
@@ -435,6 +460,10 @@
                         <artifactId>jsr173</artifactId>
                     </exclusion>
                     <exclusion>
+                        <groupId>javax.xml.stream</groupId>
+                        <artifactId>stax-api</artifactId>
+                    </exclusion>
+                    <exclusion>
                         <groupId>javax.activation</groupId>
                         <artifactId>activation</artifactId>
                     </exclusion>
@@ -611,6 +640,10 @@
                         <groupId>javax.xml.bind</groupId>
                         <artifactId>jsr173_api</artifactId>
                     </exclusion>
+                    <exclusion>
+                        <groupId>javax.jws</groupId>
+                        <artifactId>jsr181-api</artifactId>
+                    </exclusion>
                 </exclusions>
             </dependency>
             <dependency>
@@ -730,6 +763,11 @@
                 <artifactId>commons-lang</artifactId>
                 <version>2.1</version>
             </dependency>
+            <dependency>
+                <groupId>bouncycastle</groupId>
+                <artifactId>bcprov-jdk14</artifactId>
+                <version>136</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -917,6 +955,13 @@
                                     <name>spring.validation.mode</name>
                                     <value>${spring.validation.mode}</value>
                                 </property>
+                                <property>
+                                    <!-- If we close the port after a client in the same JVM has oppened a keep-alive
+                                    connection, on some Linux's, the socket remains consumed until
+                                    some timeout occurs.   That may cause some tests to timeout/hang. -->
+                                    <name>org.apache.cxf.transports.http_jetty.DontClosePort</name>
+                                    <value>true</value>
+                                </property>
                             </systemProperties>
                         </configuration>
                     </plugin>
@@ -932,5 +977,6 @@
     </scm>
 
 </project>
+