You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ni...@apache.org on 2011/07/29 05:28:17 UTC
svn commit: r1152088 - in
/servicemix/components/trunk/bindings/servicemix-cxf-bc/src:
main/java/org/apache/servicemix/cxfbc/ test/java/org/apache/servicemix/cxfbc/
test/java/org/apache/servicemix/cxfbc/ws/security/
test/resources/org/apache/servicemix...
Author: ningjiang
Date: Fri Jul 29 03:28:15 2011
New Revision: 1152088
URL: http://svn.apache.org/viewvc?rev=1152088&view=rev
Log:
SMXCOMP-896 Fixed the cxf-bc issue of working with CXF continuation
Modified:
servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCConsumerAsynTest.java
servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcSUClassloaderTest.java
servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcSecurityJAASTest.java
servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jettyThreadPool.xml
servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/secondSU/xbean.xml
servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
Modified: servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java?rev=1152088&r1=1152087&r2=1152088&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java (original)
+++ servicemix/components/trunk/bindings/servicemix-cxf-bc/src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java Fri Jul 29 03:28:15 2011
@@ -178,8 +178,6 @@ public class CxfBcConsumer extends Consu
private List<AbstractFeature> features = new CopyOnWriteArrayList<AbstractFeature>();
private boolean transactionEnabled;
-
- private boolean isSTFlow;
private ClassLoader suClassLoader;
@@ -320,11 +318,10 @@ public class CxfBcConsumer extends Consu
.get(ContinuationProvider.class.getName());
Continuation continuation = continuationProvider
.getContinuation();
- if (continuation.isPending()) {
- continuation.resume();
- isSTFlow = false;
- } else {
- isSTFlow = true;
+ synchronized(continuation) {
+ if (continuation.isPending()) {
+ continuation.resume();
+ }
}
}
}
@@ -870,23 +867,19 @@ public class CxfBcConsumer extends Consu
Continuation continuation = continuationProvider
.getContinuation();
if (continuation.isNew()) {
+ continuation.suspend(timeout * 1000);
CxfBcConsumer.this.messages.put(exchange
.getExchangeId(), message);
context.getDeliveryChannel().send(exchange);
- if (!isSTFlow) {
- continuation.suspend(timeout * 1000);
- }
} else if (!continuation.isResumed()) {
if (!continuation.isPending()) {
messages.remove(exchange.getExchangeId());
+ continuation.reset();
// exchange timeout
throw new Exception("Exchange timed out: "
+ exchange.getExchangeId());
- } else {
- //retry
- throw new org.apache.cxf.continuations.SuspendedInvocationException();
}
- }
+ }
}
}
}
Modified: servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCConsumerAsynTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCConsumerAsynTest.java?rev=1152088&r1=1152087&r2=1152088&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCConsumerAsynTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBCConsumerAsynTest.java Fri Jul 29 03:28:15 2011
@@ -84,7 +84,7 @@ public class CxfBCConsumerAsynTest exten
CalculatorPortType port = service.getPort(endpoint, CalculatorPortType.class);
ClientProxy.getClient(port).getInInterceptors().add(new LoggingInInterceptor());
ClientProxy.getClient(port).getOutInterceptors().add(new LoggingOutInterceptor());
- MultiClientThread[] clients = new MultiClientThread[2];
+ MultiClientThread[] clients = new MultiClientThread[3];
for (int i = 0; i < clients.length; i++) {
clients[i] = new MultiClientThread(port, i);
}
@@ -97,7 +97,7 @@ public class CxfBCConsumerAsynTest exten
for (int i = 0; i < clients.length; i++) {
clients[i].join();
//ensure the second invocation return first since it's less time consuming
- assertEquals(clients[i].getResult(), "20");
+ assertEquals(clients[i].getResult(), "420");
}
}
Modified: servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcSUClassloaderTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcSUClassloaderTest.java?rev=1152088&r1=1152087&r2=1152088&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcSUClassloaderTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/CxfBcSUClassloaderTest.java Fri Jul 29 03:28:15 2011
@@ -99,6 +99,7 @@ public class CxfBcSUClassloaderTest exte
}
protected String getServiceUnitPath(String name) {
+ // we should load other BC on different port, otherwise the continuation can not work rightly.
URL url = getClass().getClassLoader().getResource("org/apache/servicemix/cxfbc/" + name + "/xbean.xml");
File path = new File(url.getFile());
path = path.getParentFile();
Modified: servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcSecurityJAASTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcSecurityJAASTest.java?rev=1152088&r1=1152087&r2=1152088&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcSecurityJAASTest.java (original)
+++ servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/java/org/apache/servicemix/cxfbc/ws/security/CxfBcSecurityJAASTest.java Fri Jul 29 03:28:15 2011
@@ -24,8 +24,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
-import junit.framework.TestCase;
-
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.bus.spring.SpringBusFactory;
@@ -34,12 +32,13 @@ import org.apache.cxf.interceptor.Loggin
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.testutil.common.ServerLauncher;
import org.apache.hello_world_soap_http.Greeter;
-import org.apache.servicemix.tck.SpringTestSupport;
-import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
-import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
-public class CxfBcSecurityJAASTest extends TestCase {
+public class CxfBcSecurityJAASTest extends Assert {
private static final Logger LOG = LogUtils.getL7dLogger(CxfBCSecurityTest.class);
@@ -66,14 +65,16 @@ public class CxfBcSecurityJAASTest exten
protected static boolean serversStarted;
- private ServerLauncher sl;
+ private static ServerLauncher sl;
- public void setUp() throws Exception {
+ @BeforeClass
+ public static void startServer() throws Exception {
startJBIContainers();
Thread.sleep(3000);
}
- public void tearDown() throws Exception {
+ @AfterClass
+ public static void stopServer() throws Exception {
try {
sl.stopServer();
} catch (IOException ex) {
@@ -81,13 +82,10 @@ public class CxfBcSecurityJAASTest exten
fail("failed to stop jbi container " + sl.getClass());
}
serversStarted = false;
-
- super.tearDown();
+
}
-
-
-
-
+
+ @Test
public void testJAASPolicy() {
LOG.info("test security ws-policy");
Bus bus = new SpringBusFactory().createBus(
@@ -112,6 +110,7 @@ public class CxfBcSecurityJAASTest exten
assertEquals(ret, "Hello ffang");
}
+ @Test
public void testJAAS() {
LOG.info("test security");
Bus bus = new SpringBusFactory().createBus(
@@ -136,6 +135,7 @@ public class CxfBcSecurityJAASTest exten
assertEquals(ret, "Hello ffang");
}
+ @Test
public void testUserNotExist() {
LOG.info("test user not exist");
Bus bus = new SpringBusFactory().createBus(
@@ -162,6 +162,7 @@ public class CxfBcSecurityJAASTest exten
}
}
+ @Test
public void testPasswordMismatch() {
LOG.info("test password not match");
Bus bus = new SpringBusFactory().createBus(
@@ -196,7 +197,7 @@ public class CxfBcSecurityJAASTest exten
}
**/
- protected void startJBIContainers() throws Exception {
+ protected static void startJBIContainers() throws Exception {
if (serversStarted) {
return;
}
@@ -221,7 +222,7 @@ public class CxfBcSecurityJAASTest exten
serversStarted = true;
}
- protected boolean launchServer(Class<?> clz, Map<String, String> p, boolean inProcess) {
+ protected static boolean launchServer(Class<?> clz, Map<String, String> p, boolean inProcess) {
boolean ok = false;
try {
sl = new ServerLauncher(clz.getName(), p, null, inProcess);
Modified: servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jettyThreadPool.xml
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jettyThreadPool.xml?rev=1152088&r1=1152087&r2=1152088&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jettyThreadPool.xml (original)
+++ servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/jettyThreadPool.xml Fri Jul 29 03:28:15 2011
@@ -42,7 +42,7 @@
<httpj:engine-factory bus="cxf">
<httpj:engine port="19000">
- <httpj:threadingParameters minThreads="1" maxThreads="5" />
+ <httpj:threadingParameters minThreads="1" maxThreads="8" />
</httpj:engine>
</httpj:engine-factory>
Modified: servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/secondSU/xbean.xml
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/secondSU/xbean.xml?rev=1152088&r1=1152087&r2=1152088&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/secondSU/xbean.xml (original)
+++ servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/secondSU/xbean.xml Fri Jul 29 03:28:15 2011
@@ -28,7 +28,7 @@
targetEndpoint="CalculatorPort"
targetService="calculator:CalculatorService"
targetInterface="calculator:CalculatorPortType"
- locationURI="http://localhost:19000/CalculatorService/SoapPort"
+ locationURI="http://localhost:19001/CalculatorService/SoapPort"
>
<cxfbc:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
Modified: servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml
URL: http://svn.apache.org/viewvc/servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml?rev=1152088&r1=1152087&r2=1152088&view=diff
==============================================================================
--- servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml (original)
+++ servicemix/components/trunk/bindings/servicemix-cxf-bc/src/test/resources/org/apache/servicemix/cxfbc/xbean_asyn.xml Fri Jul 29 03:28:15 2011
@@ -53,7 +53,7 @@
>
<cxfbc:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
- <bean class="org.apache.servicemix.cxfbc.AsyncCxfBcConsumerInterceptor"/>
+ <!--bean class="org.apache.servicemix.cxfbc.AsyncCxfBcConsumerInterceptor"/-->
</cxfbc:inInterceptors>
<cxfbc:outInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>