Author: ningjiang
Date: Thu Jun 14 23:15:41 2007
New Revision: 547543
URL: http://svn.apache.org/viewvc?view=rev&rev=547543
Log:
Clean up the Ignor testcase in JCA module
Modified:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalException.java
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/DummyManagedConnectionImpl.java
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ManagedConnectionImplTest.java
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalExceptionTest.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/handlers/ObjectMethodInvocationHandlerTest.java
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/servant/CXFConnectEJBServantTest.java
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/servant/GreeterImpl.java
Modified:
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalException.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalException.java?view=diff&rev=547543&r1=547542&r2=547543
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalException.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalException.java
Thu Jun 14 23:15:41 2007
@@ -71,7 +71,7 @@
}
}
- /*
+
public Exception getLinkedException() {
Exception linkedEx = null;
if (getCause() instanceof Exception) {
@@ -79,5 +79,5 @@
}
return linkedEx;
}
- */
+
}
Modified:
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/DummyManagedConnectionImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/DummyManagedConnectionImpl.java?view=diff&rev=547543&r1=547542&r2=547543
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/DummyManagedConnectionImpl.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/DummyManagedConnectionImpl.java
Thu Jun 14 23:15:41 2007
@@ -19,15 +19,20 @@
package org.apache.cxf.jca.core.resourceadapter;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
import javax.resource.ResourceException;
import javax.resource.spi.ConnectionRequestInfo;
import javax.resource.spi.LocalTransaction;
import javax.security.auth.Subject;
-//import org.apache.cxf.jca.cxf.CXFManagedConnectionFactory;
+import org.apache.cxf.common.logging.LogUtils;
+
public class DummyManagedConnectionImpl extends AbstractManagedConnectionImpl {
+ private static final Logger LOG =
LogUtils.getL7dLogger(AbstractManagedConnectionImpl.class);
boolean bound;
Object con;
@@ -36,6 +41,8 @@
ConnectionRequestInfo crInfo, Subject subject)
throws ResourceException {
super(managedFactory, crInfo, subject);
+ // trun off the noise error logger
+ LOG.setLevel(Level.OFF);
}
public void associateConnection(Object arg0) throws ResourceException {
Modified:
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ManagedConnectionImplTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ManagedConnectionImplTest.java?view=diff&rev=547543&r1=547542&r2=547543
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ManagedConnectionImplTest.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ManagedConnectionImplTest.java
Thu Jun 14 23:15:41 2007
@@ -125,6 +125,7 @@
listener.connectionErrorOccurred(EasyMock.isA(ConnectionEvent.class));
EasyMock.expectLastCall();
EasyMock.replay(listener);
+ mc.setLogWriter(null);
mc.error(new Exception());
EasyMock.verify(listener);
}
Modified:
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalExceptionTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalExceptionTest.java?view=diff&rev=547543&r1=547542&r2=547543
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalExceptionTest.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/core/resourceadapter/ResourceAdapterInternalExceptionTest.java
Thu Jun 14 23:15:41 2007
@@ -129,24 +129,24 @@
}
- /[EMAIL PROTECTED]
+ @Test
public void testGetLinkedExceptionReturnNullIfNoCause() throws Exception {
ResourceAdapterInternalException re = new
ResourceAdapterInternalException("ex");
assertNull("getLinkedException return null", re.getLinkedException());
}
- @Ignore
+ @Test
public void testGetLinkedExceptionReturnNullIfCauseIsError() throws
Exception {
java.lang.Throwable cause = new java.lang.UnknownError("error");
ResourceAdapterInternalException re = new
ResourceAdapterInternalException("ex", cause);
assertNull("getLinkedException return null", re.getLinkedException());
}
- @Ignore
+ @Test
public void testGetLinkedExceptionReturnNotNullIfCauseIsException() throws
Exception {
java.lang.Throwable cause = new RuntimeException("runtime exception");
ResourceAdapterInternalException re = new
ResourceAdapterInternalException("ex", cause);
assertEquals("get same exception", cause, re.getLinkedException());
- }*/
+ }
}
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?view=diff&rev=547543&r1=547542&r2=547543
==============================================================================
---
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
Thu Jun 14 23:15:41 2007
@@ -50,22 +50,22 @@
((Connection)mci).close();
}
- @Ignore
+ @Test
public void testGetConnectionServiceGetPortThrows() throws Exception {
cri = new CXFConnectionRequestInfo(Foo.class, null, serviceName, null);
try {
+ //current cxf supprot pojo simple frontend, so it is ok to create
proxy now
mci.getConnection(subj, cri);
- fail("Expected ResourceAdapterInternalException");
+
} catch (ResourceAdapterInternalException raie) {
- assertTrue("asserting ResourceException.", raie.getMessage()
- .indexOf("Failed to create proxy") != -1);
+ fail("NotExpected ResourceAdapterInternalException");
}
}
- @Ignore
+ @Ignore("need to check the classloader")
public void testThreadContextClassLoaderIsSet() throws Exception {
//set the threadContextClassLoader for Bus
//TODO njiang classloader things
@@ -73,7 +73,7 @@
mci.getConnection(subj, cri);
}
- @Ignore
+ @Test
public void
testGetConnectionWithNoWSDLInvokesCreateClientWithTwoParameters() throws
Exception {
@@ -85,7 +85,7 @@
assertTrue("checking implementation of passed interface", o instanceof
Greeter);
}
- @Ignore
+ @Test
public void testGetConnectionWithNoWSDLInvokesCreateClientWithTwoArgs()
throws Exception {
Modified:
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/handlers/ObjectMethodInvocationHandlerTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/handlers/ObjectMethodInvocationHandlerTest.java?view=diff&rev=547543&r1=547542&r2=547543
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/handlers/ObjectMethodInvocationHandlerTest.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/cxf/handlers/ObjectMethodInvocationHandlerTest.java
Thu Jun 14 23:15:41 2007
@@ -24,7 +24,6 @@
import org.apache.cxf.jca.cxf.CXFInvocationHandler;
import org.apache.cxf.jca.cxf.CXFInvocationHandlerData;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
@@ -58,7 +57,8 @@
@Test
public void testToString() throws Throwable {
- Method toString = Object.class.getMethod("toString", new Class[0]);
+ Method toString = Object.class.getMethod("toString", new Class[0]);
+
Object result = handler.invoke(testTarget, toString, null);
assertTrue("object method must not be passed to next handler in
chain",
!dummyHandler.invokeCalled);
@@ -66,7 +66,7 @@
assertTrue("checking toString method ",
((String)result).startsWith("ConnectionHandle"));
}
- @Ignore
+ @Test
public void testHashCode() throws Throwable {
Method hashCode = Object.class.getMethod("hashCode", new Class[0]);
@@ -127,12 +127,10 @@
handler.invoke(testTarget, method, args);
assertTrue("object method must not be passed to next handler in chain",
- dummyHandler.invokeCalled);
+ !dummyHandler.invokeCalled);
assertEquals(method + " must be invoked directly on target object",
method.getName(), target.lastMethod.getName());
- }
-
-
+ }
public CXFInvocationHandler getHandler() {
return handler;
Modified:
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/servant/CXFConnectEJBServantTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/servant/CXFConnectEJBServantTest.java?view=diff&rev=547543&r1=547542&r2=547543
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/servant/CXFConnectEJBServantTest.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/servant/CXFConnectEJBServantTest.java
Thu Jun 14 23:15:41 2007
@@ -18,7 +18,6 @@
*/
package org.apache.cxf.jca.servant;
-//import java.lang.reflect.Method;
import java.lang.reflect.Method;
@@ -100,7 +99,8 @@
}
- @Ignore
+ @Ignore("There are duplicate code in the CXFConnectEJBServant and
JCABusFactory"
+ + "Need to refactor this code")
public void testServantInvoke() throws Exception {
Greeter target = new GreeterImpl();
@@ -113,27 +113,24 @@
e.printStackTrace();
}
}
- /*
- @Ignore
+
+
+ @Ignore("There are duplicate code in the CXFConnectEJBServant and
JCABusFactory"
+ + "Need to refactor this code")
public void testServantInvokeThrowBusExceptionIfEJBThrowRuntimeException()
throws Exception {
final String msg = "jjljljlj";
GreeterImpl target = new GreeterImpl();
- target.mockInvoke = new MockInvoke() {
- public Object invoke(Object[] args) throws Exception {
- throw new NullPointerException(msg);
- }
- };
-
+
Method method = target.getClass().getMethod("sayHi", new Class[0]);
try {
ejbservant.invoke(target, method, new Object[0]);
fail("exception expected");
- } catch (Exception ex) {
- assertTrue("target method invoked. ex: " + ex, target.sayHiCalled);
+ } catch (Throwable ex) {
+ assertTrue("target method invoked. ex: " + ex,
target.getSayHiCalled());
assertTrue("cause is RuntimeException", ex.getCause() instanceof
RuntimeException);
- assertTrue("exception message contains " + msg,
ex.getMessage().indexOf(msg)!=-1);
+ assertTrue("exception message contains " + msg,
ex.getMessage().indexOf(msg) != -1);
}
- }*/
+ }
protected Bus createMockBus() {
return EasyMock.createMock(Bus.class);
Modified:
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/servant/GreeterImpl.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/servant/GreeterImpl.java?view=diff&rev=547543&r1=547542&r2=547543
==============================================================================
---
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/servant/GreeterImpl.java
(original)
+++
incubator/cxf/trunk/integration/jca/src/test/java/org/apache/cxf/jca/servant/GreeterImpl.java
Thu Jun 14 23:15:41 2007
@@ -19,15 +19,13 @@
package org.apache.cxf.jca.servant;
import java.rmi.RemoteException;
-//import com.iona.mockobject.MockInvoke;
+
public class GreeterImpl implements Greeter {
private boolean sayHiCalled;
-// public MockInvoke mockInvoke;
public GreeterImpl() {
sayHiCalled = false;
-// MockInvoke mockInvoke = null;
}
public boolean getSayHiCalled() {
@@ -38,18 +36,6 @@
}
public String sayHi() throws RemoteException {
sayHiCalled = true;
-/*
- if (mockInvoke instanceof MockInvoke) {
- try {
- return (String) ((MockInvoke)mockInvoke).invoke(null);
- } catch (Throwable t) {
- if (t instanceof RuntimeException) {
- throw (RuntimeException)t;
- }
- throw new RuntimeException("unexpected exception in test:" +
t, t);
- }
- }
-*/
return "hi";
}
}