Author: ningjiang
Date: Fri Sep 21 02:12:28 2007
New Revision: 578027
URL: http://svn.apache.org/viewvc?rev=578027&view=rev
Log:
CXF-1044 ,thanks Jeff
Added:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionParam.java
(with props)
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFManagedConnectionMetaData.java
(with props)
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties
(with props)
Modified:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionFactory.java
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFConnectionRequestInfo.java
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ConnectionFactoryImpl.java
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionImpl.java
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ConnectionFactoryImplTest.java
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionImplTest.java
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionTestBase.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jca/OutBoundConnectionTest.java
Modified:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionFactory.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionFactory.java?rev=578027&r1=578026&r2=578027&view=diff
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionFactory.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionFactory.java
Fri Sep 21 02:12:28 2007
@@ -18,9 +18,7 @@
*/
package org.apache.cxf.connector;
-import java.net.URL;
import javax.resource.ResourceException;
-import javax.xml.namespace.QName;
/**
* Provides methods to create a [EMAIL PROTECTED] Connection} object that
represents a Web
@@ -29,68 +27,18 @@
*/
public interface CXFConnectionFactory {
-
- /**
- * Creates a client proxy based on the given WSDL information.
- *
- * @param iface The interface class implemented by the returned proxy.
- * @param wsdlLocation The URL to the WSDL that defines the service.
- * @param serviceName The QName that identifies the service.
- * @param portName The port to connect to; services may include multiple
- * ports.
- * @return a proxy object that implements both the given <code>iface</code>
- * and the [EMAIL PROTECTED] Connection} interface. It represents
the Web
- * service associated with the specified service and port.
- * @throws ResourceException If there is an error creating the connection.
- */
- Object getConnection(Class iface, URL wsdlLocation, QName serviceName,
QName portName)
- throws ResourceException;
-
+
/**
- * Creates a client proxy based on the given WSDL information. If the
- * service contains more than one port the first one will be used.
- *
- * @param iface The interface class implemented by the returned proxy.
- * @param wsdlLocation The URL to the WSDL that defines the service.
- * @param serviceName The QName that identifies the service.
+ * Creates a client proxy based on the connection parameter object.
+ * @param param,
* @return A proxy object that implements both the given <code>iface</code>
* and the [EMAIL PROTECTED] Connection} interface. It represents
the Web
* service associated with the specified service.
- * @throws ResourceException If there is an error creating the connection.
+ * @throws ResourceException
*/
- Object getConnection(Class iface, URL wsdlLocation, QName serviceName)
throws ResourceException;
-
- /**
- * Creates a client proxy based on the given WSDL information. The WSDL
- * location will be obtained from Bus configuration using the
- * <code>serviceName</code>.
- *
- * @param iface The interface class implemented by the returned proxy.
- * @param serviceName The QName that identifies the service.
- * @param portName The port to connect to; services may include multiple
- * ports.
- * @return A proxy object that implements both the given <code>iface</code>
- * and the [EMAIL PROTECTED] Connection} interface. It represents
the Web
- * service associated with the specified service and port.
- * @throws ResourceException If there is an error creating the connection.
- */
- Object getConnection(Class iface, QName serviceName, QName portName)
throws ResourceException;
-
- /**
- * Creates a client proxy based on the given WSDL information. If the
- * service contains more than one port the first one will be used as no
port
- * name is passed. The WSDL location will be obtained from Bus
configuration
- * using the <code>serviceName</code>.
- *
- * @param iface The interface class implemented by the returned proxy.
- * @param serviceName The QName that identifies the service..
- * @return A proxy object that implements both the given <code>iface</code>
- * and the [EMAIL PROTECTED] Connection} interface. It represents
the Web
- * service associated with the specified service.
- * @throws ResourceException If there is an error creating the connection.
- */
- Object getConnection(Class iface, QName serviceName) throws
ResourceException;
-
+ Object getConnection(CXFConnectionParam param) throws ResourceException;
+
+
/**
* Returns the underlying [EMAIL PROTECTED] Bus} for this connection
factory. In some
* J2EE environments, for example Weblogic, the [EMAIL PROTECTED] Bus} and
dependent
Added:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionParam.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionParam.java?rev=578027&view=auto
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionParam.java
(added)
+++
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionParam.java
Fri Sep 21 02:12:28 2007
@@ -0,0 +1,129 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.connector;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.jca.cxf.CXFConnectionRequestInfo;
+
+
+public class CXFConnectionParam {
+ private Class iface;
+ private URL wsdlLocation;
+ private QName serviceName;
+ private QName portName;
+ private String address;
+
+ public CXFConnectionParam() {
+ }
+
+ public CXFConnectionParam(Class aIface, URL aWsdlLocation,
+ QName aServiceName, QName aPortName) {
+ this.iface = aIface;
+ this.wsdlLocation = aWsdlLocation;
+ this.serviceName = aServiceName;
+ this.portName = aPortName;
+ }
+
+ public Class<?> getInterface() {
+ return iface;
+ }
+
+ public URL getWsdlLocation() {
+ return wsdlLocation;
+ }
+
+ public QName getServiceName() {
+ return serviceName;
+ }
+
+ public QName getPortName() {
+ return portName;
+ }
+
+ public String getAddress() {
+ return address;
+ }
+
+
+ public boolean equals(java.lang.Object other) {
+ boolean result = false;
+ if (other instanceof CXFConnectionRequestInfo) {
+ CXFConnectionRequestInfo cri = (CXFConnectionRequestInfo)other;
+ result = areEquals(iface, cri.getInterface())
+ && areEquals(wsdlLocation, cri.getWsdlLocation())
+ && areEquals(serviceName, cri.getServiceName())
+ && areEquals(portName, cri.getPortName())
+ && areEquals(address, cri.getAddress());
+ }
+ return result;
+ }
+
+
+
+ public void setAddress(String address) {
+ this.address = address;
+ }
+
+ public void setPortName(QName portName) {
+ this.portName = portName;
+ }
+
+ public void setServiceName(QName serviceName) {
+ this.serviceName = serviceName;
+ }
+
+ public void setWsdlLocation(URL wsdlLocation) {
+ this.wsdlLocation = wsdlLocation;
+ }
+
+ public void setInterface(Class<?> aInterface) {
+ this.iface = aInterface;
+ }
+
+ public int hashCode() {
+ if (getServiceName() != null) {
+ return getInterface().hashCode() ^ getServiceName().hashCode();
+ } else {
+ return getInterface().hashCode() ^ (getAddress() != null ?
getAddress().hashCode() : 1);
+ }
+ }
+
+ public String toString() {
+ StringBuffer buf = new StringBuffer(256);
+ buf.append("Interface [" + getInterface() + "] ");
+ buf.append("PortName [" + getPortName() + "] ");
+ buf.append("ServiceName [" + getServiceName() + "] ");
+ buf.append("WsdlLocation [" + getWsdlLocation() + "] ");
+ buf.append("Address [" + getAddress() + "] ");
+ return buf.toString();
+ }
+
+
+ private boolean areEquals(Object obj1, Object obj2) {
+ if (obj1 == null) {
+ return obj1 == obj2;
+ } else {
+ return obj1.equals(obj2);
+ }
+ }
+}
Propchange:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionParam.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/connector/CXFConnectionParam.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFConnectionRequestInfo.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFConnectionRequestInfo.java?rev=578027&r1=578026&r2=578027&view=diff
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFConnectionRequestInfo.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFConnectionRequestInfo.java
Fri Sep 21 02:12:28 2007
@@ -20,75 +20,22 @@
import java.net.URL;
+
import javax.resource.spi.ConnectionRequestInfo;
import javax.xml.namespace.QName;
+import org.apache.cxf.connector.CXFConnectionParam;
-public class CXFConnectionRequestInfo implements ConnectionRequestInfo {
- private Class iface;
- private URL wsdlLocation;
- private QName serviceName;
- private QName portName;
+public class CXFConnectionRequestInfo extends CXFConnectionParam implements
ConnectionRequestInfo {
+
+ public CXFConnectionRequestInfo() {
+ super();
+ }
+
public CXFConnectionRequestInfo(Class aIface, URL aWsdlLocation,
QName aServiceName, QName aPortName) {
- this.iface = aIface;
- this.wsdlLocation = aWsdlLocation;
- this.serviceName = aServiceName;
- this.portName = aPortName;
- }
-
- public Class<?> getInterface() {
- return iface;
- }
-
- public URL getWsdlLocationUrl() {
- return wsdlLocation;
+ super(aIface, aWsdlLocation, aServiceName, aPortName);
}
-
- public QName getServiceQName() {
- return serviceName;
- }
-
- public QName getPortQName() {
- return portName;
- }
-
-
-
- public boolean equals(java.lang.Object other) {
- boolean ret = this == other;
-
- if (!ret && other instanceof CXFConnectionRequestInfo) {
- CXFConnectionRequestInfo cri = (CXFConnectionRequestInfo)other;
-
- ret = areEquals(iface, cri.iface) && areEquals(wsdlLocation,
cri.wsdlLocation)
- && areEquals(serviceName, cri.serviceName) &&
areEquals(portName, cri.portName);
-
- }
- return ret;
- }
-
- public int hashCode() {
- return getInterface().hashCode() + (serviceName != null ?
serviceName.hashCode() : 0);
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer(256);
-
-
buf.append(iface).append(":").append(portName).append(":").append(serviceName).append("@").append(
- wsdlLocation);
-
- return buf.toString();
- }
-
-
- private boolean areEquals(Object obj1, Object obj2) {
- if (obj1 == null) {
- return obj1 == obj2;
- } else {
- return obj1.equals(obj2);
- }
- }
-
+
}
Added:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFManagedConnectionMetaData.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFManagedConnectionMetaData.java?rev=578027&view=auto
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFManagedConnectionMetaData.java
(added)
+++
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFManagedConnectionMetaData.java
Fri Sep 21 02:12:28 2007
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.jca.cxf;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ManagedConnectionMetaData;
+
+
+public class CXFManagedConnectionMetaData implements ManagedConnectionMetaData
{
+
+
+ public String getEISProductName() throws ResourceException {
+ return "WS-based-EIS";
+ }
+
+ public String getEISProductVersion() throws ResourceException {
+ return "1.1";
+ }
+
+ public int getMaxConnections() throws ResourceException {
+ return 20;
+ }
+
+ public String getUserName() throws ResourceException {
+ return "CXF";
+ }
+
+}
Propchange:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFManagedConnectionMetaData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/CXFManagedConnectionMetaData.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ConnectionFactoryImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ConnectionFactoryImpl.java?rev=578027&r1=578026&r2=578027&view=diff
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ConnectionFactoryImpl.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ConnectionFactoryImpl.java
Fri Sep 21 02:12:28 2007
@@ -20,7 +20,7 @@
import java.io.Serializable;
-import java.net.URL;
+import java.util.ResourceBundle;
import javax.naming.NamingException;
import javax.naming.Reference;
@@ -29,15 +29,17 @@
import javax.resource.spi.ConnectionManager;
import javax.resource.spi.ManagedConnection;
import javax.resource.spi.ManagedConnectionFactory;
-import javax.xml.namespace.QName;
-
+import org.apache.cxf.common.i18n.BundleUtils;
+import org.apache.cxf.common.i18n.Message;
import org.apache.cxf.connector.CXFConnectionFactory;
+import org.apache.cxf.connector.CXFConnectionParam;
import
org.apache.cxf.jca.core.resourceadapter.ResourceAdapterInternalException;
public class ConnectionFactoryImpl implements CXFConnectionFactory,
Referenceable,
Serializable {
+ private static final ResourceBundle BUNDLE =
BundleUtils.getBundle(ConnectionFactoryImpl.class);
private ManagedConnectionFactory managedConnectionFactory;
private ConnectionManager connectionManager;
private Reference reference;
@@ -55,35 +57,25 @@
return reference;
}
- public Object getConnection(Class iface, URL wsdlLocation, QName
serviceName) throws ResourceException {
- return getConnection(iface, wsdlLocation, serviceName, null);
- }
-
- public Object getConnection(Class iface, QName serviceName, QName
portName) throws ResourceException {
- return getConnection(iface, null, serviceName, portName);
- }
-
- public Object getConnection(Class iface, QName serviceName) throws
ResourceException {
- return getConnection(iface, null, serviceName, null);
- }
public Object getBus() {
return
((ManagedConnectionFactoryImpl)managedConnectionFactory).getBus();
}
- public Object getConnection(Class iface, URL wsdlLocation, QName
serviceName, QName portName)
- throws ResourceException {
+ public Object getConnection(CXFConnectionParam param) throws
ResourceException {
- if (!iface.isInterface()) {
- throw new ResourceAdapterInternalException(
- "The first argument to getConnection must be an Interface",
- new IllegalArgumentException(iface.toString() + " is not
an Interface."));
+ if (param.getInterface() == null) {
+ throw new ResourceAdapterInternalException(new
Message("INTERFACE_IS_NULL", BUNDLE).toString());
}
- CXFConnectionRequestInfo reqInfo =
- new CXFConnectionRequestInfo(iface, wsdlLocation, serviceName,
portName);
-
+ if (!param.getInterface().isInterface()) {
+ throw new ResourceAdapterInternalException(new
Message("IS_NOT_AN_INTERFACE",
+ BUNDLE,
param.getInterface()).toString());
+ }
+
+ CXFConnectionRequestInfo reqInfo = (CXFConnectionRequestInfo) param;
+
if (connectionManager == null) {
// non-managed, null Subject
ManagedConnection connection =
managedConnectionFactory.createManagedConnection(null, reqInfo);
@@ -92,22 +84,7 @@
return
connectionManager.allocateConnection(managedConnectionFactory, reqInfo);
}
}
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+}
Modified:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionImpl.java?rev=578027&r1=578026&r2=578027&view=diff
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionImpl.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/ManagedConnectionImpl.java
Fri Sep 21 02:12:28 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,40 +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();
if (managedConnection != this) {
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);
}
}
@@ -88,79 +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 {
this.crinfo = crInfo;
this.subject = subject;
-
- cxfService = getCXFServiceFromBus(subject, crInfo);
+ cxfService = getCXFConnection(subject, crInfo);
}
public Object getConnection(Subject subject, ConnectionRequestInfo crInfo)
throws ResourceException {
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();
- QName serviceName = arReqInfo.getServiceQName();
- URL wsdlLocationUrl = arReqInfo.getWsdlLocationUrl();
-
try {
- Object obj = null;
- Service service = null;
- if (wsdlLocationUrl == null) {
- service = Service.create(serviceName);
+ ClientProxyFactoryBean factoryBean = null;
+ if (isJaxWsServiceInterface(serviceInterface)) {
+ factoryBean = new JaxWsProxyFactoryBean();
} else {
- service = Service.create(wsdlLocationUrl, serviceName);
+ factoryBean = new ClientProxyFactoryBean();
}
-
- QName port = arReqInfo.getPortQName();
- if (port == null) {
- obj = service.getPort(arReqInfo.getInterface());
- } else {
- obj = service.getPort(arReqInfo.getPortQName(),
arReqInfo.getInterface());
+ 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 create proxy
client for service "
- + arReqInfo, wse);
+ throw new ResourceAdapterInternalException(new
Message("FAIL_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;
}
Added:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties?rev=578027&view=auto
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties
(added)
+++
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties
Fri Sep 21 02:12:28 2007
@@ -0,0 +1,24 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+INTERFACE_IS_NULL = The interface parameter is null.
+IS_NOT_AN_INTERFACE = The [{0}] is not an interface.
+FAIL_TO_GET_CXF_CONNECTION = Failed to get the CXF Connection with connection
parameters : {0}
+ASSOCIATED_ERROR = Error in associating connection.
Propchange:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/cxf/Messages.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ConnectionFactoryImplTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ConnectionFactoryImplTest.java?rev=578027&r1=578026&r2=578027&view=diff
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ConnectionFactoryImplTest.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ConnectionFactoryImplTest.java
Fri Sep 21 02:12:28 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 Referencable", 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 use of non 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("Should get an exception");
+ } catch (ResourceException re) {
+ assertTrue(true);
+ }
+ }
}
Modified:
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionImplTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionImplTest.java?rev=578027&r1=578026&r2=578027&view=diff
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionImplTest.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionImplTest.java
Fri Sep 21 02:12:28 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/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionTestBase.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionTestBase.java?rev=578027&r1=578026&r2=578027&view=diff
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionTestBase.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/ManagedConnectionTestBase.java
Fri Sep 21 02:12:28 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/trunk/systests/src/test/java/org/apache/cxf/systest/jca/OutBoundConnectionTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jca/OutBoundConnectionTest.java?rev=578027&r1=578026&r2=578027&view=diff
==============================================================================
---
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jca/OutBoundConnectionTest.java
(original)
+++
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jca/OutBoundConnectionTest.java
Fri Sep 21 02:12:28 2007
@@ -19,9 +19,10 @@
package org.apache.cxf.systest.jca;
-import java.lang.reflect.UndeclaredThrowableException;
import java.net.URL;
+
import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
import javax.security.auth.Subject;
import javax.xml.namespace.QName;
import javax.xml.ws.Endpoint;
@@ -84,7 +85,7 @@
wsdl,
service.getServiceName(),
portName);
- ManagedConnectionFactoryImpl managedFactory = new
ManagedConnectionFactoryImpl();
+ ManagedConnectionFactory managedFactory = new
ManagedConnectionFactoryImpl();
Subject subject = new Subject();
ManagedConnection mc = managedFactory.createManagedConnection(subject,
cri);
Object o = mc.getConnection(subject, cri);
@@ -97,20 +98,35 @@
fail("The connection object should support Object method");
}
+ verifyResult(o);
+ }
+
+
+ @Test
+ public void testGetConnectionFromSEI() throws Exception {
+ CXFConnectionRequestInfo requestInfo = new CXFConnectionRequestInfo();
+ requestInfo.setInterface(Greeter.class);
+ requestInfo.setAddress("http://localhost:9000/SoapContext/SoapPort");
+
+ ManagedConnectionFactory factory = new ManagedConnectionFactoryImpl();
+ ManagedConnection mc = factory.createManagedConnection(null,
requestInfo);
+ Object client = mc.getConnection(null, requestInfo);
+
+ verifyResult(client);
+ }
+
+
+ private void verifyResult(Object o) throws Exception {
+
assertTrue("returned connect does not implement Connection interface",
o instanceof Connection);
assertTrue("returned connect does not implement Connection interface",
o instanceof Greeter);
- Greeter greeter = (Greeter) o;
-
- String response = new String("Bonjour");
- try {
- for (int idx = 0; idx < 5; idx++) {
- String reply = greeter.sayHi();
- assertNotNull("no response received from service", reply);
- assertEquals(response, reply);
- }
- } catch (UndeclaredThrowableException ex) {
- throw (Exception)ex.getCause();
+ Greeter greeter = (Greeter) o;
+ String response = new String("Bonjour");
+ for (int idx = 0; idx < 5; idx++) {
+ String reply = greeter.sayHi();
+ assertNotNull("no response received from service", reply);
+ assertEquals(response, reply);
}
- }
+ }
}