Author: alessio.soldano(a)jboss.com
Date: 2011-11-12 08:36:28 -0500 (Sat, 12 Nov 2011)
New Revision: 15246
Modified:
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineTest.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneEJB3Impl.java
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointOneEJB3Impl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointOneImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointTwoEJB3Impl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointTwoImpl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/JBWS3060ServletTestCase.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/JBWS3060Tests.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/logging/CustomInInterceptor.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneEJB3Impl.java
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneImpl.java
Log:
Fixing some tests: x++ on volatile attributes is not atomic
Modified:
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineTest.java
===================================================================
---
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineTest.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/addons/transports/http/httpserver/src/test/java/org/jboss/wsf/stack/cxf/addons/transports/httpserver/HttpServerEngineTest.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -28,13 +28,13 @@
import java.util.Collections;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
import junit.framework.TestCase;
import org.apache.cxf.Bus;
import org.apache.cxf.configuration.Configurer;
import org.apache.cxf.configuration.spring.ConfigurerImpl;
-import org.apache.cxf.service.model.EndpointInfo;
import org.easymock.classextension.EasyMock;
import org.easymock.classextension.IMocksControl;
@@ -135,8 +135,8 @@
engine.addHandler(urlStr2, handler2);
pingServer(new URL(urlStr1));
pingServer(new URL(urlStr2));
- assertEquals(1, handler1.count);
- assertEquals(1, handler2.count);
+ assertEquals(1, handler1.count.get());
+ assertEquals(1, handler2.count.get());
engine.removeHandler(urlStr1);
engine.removeHandler(urlStr2);
engine.shutdown();
@@ -161,7 +161,7 @@
private class MyTestHandler implements org.jboss.com.sun.net.httpserver.HttpHandler
{
- volatile int count;
+ AtomicInteger count = new AtomicInteger(0);
public MyTestHandler()
{
@@ -170,7 +170,7 @@
@Override
public void handle(org.jboss.com.sun.net.httpserver.HttpExchange exchange) throws
IOException {
- count++;
+ count.incrementAndGet();
exchange.sendResponseHeaders(200, 0);
OutputStream os = exchange.getResponseBody();
os.write("Hello".getBytes());
Modified:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneEJB3Impl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneEJB3Impl.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneEJB3Impl.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.ws.jaxws.cxf.mixtype;
+import java.util.concurrent.atomic.AtomicInteger;
+
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
@@ -34,13 +36,13 @@
@Stateless
public class EndpointOneEJB3Impl
{
- private volatile static int count = 0;
+ private static AtomicInteger count = new AtomicInteger(0);
@WebMethod
public String echo(String input)
{
Logger.getLogger(this.getClass()).info("echo: " + input);
- count++;
+ count.incrementAndGet();
return input;
}
@@ -49,13 +51,13 @@
public void echoOneWay(String input)
{
Logger.getLogger(this.getClass()).info("echoOneWay: " + input);
- count++;
+ count.incrementAndGet();
}
@WebMethod
public int getCount()
{
- return count;
+ return count.get();
}
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneImpl.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/testsuite/cxf-spring-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneImpl.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -22,6 +22,8 @@
package org.jboss.test.ws.jaxws.cxf.mixtype;
+import java.util.concurrent.atomic.AtomicInteger;
+
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;
@@ -33,13 +35,13 @@
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class EndpointOneImpl
{
- private volatile static int count = 0;
+ private static AtomicInteger count = new AtomicInteger(0);
@WebMethod
public String echo(String input)
{
Logger.getLogger(this.getClass()).info("echo: " + input);
- count++;
+ count.incrementAndGet();
return input;
}
@@ -48,13 +50,13 @@
public void echoOneWay(String input)
{
Logger.getLogger(this.getClass()).info("echoOneWay: " + input);
- count++;
+ count.incrementAndGet();
}
@WebMethod
public int getCount()
{
- return count;
+ return count.get();
}
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointOneEJB3Impl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointOneEJB3Impl.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointOneEJB3Impl.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.ws.jaxws.cxf.jbws3060;
+import java.util.concurrent.atomic.AtomicInteger;
+
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
@@ -34,13 +36,13 @@
@Stateless
public class EndpointOneEJB3Impl
{
- private volatile static int count = 0;
+ private static AtomicInteger count = new AtomicInteger(0);
@WebMethod
public String echo(String input)
{
Logger.getLogger(this.getClass()).info("echo: " + input);
- count++;
+ count.incrementAndGet();
return input;
}
@@ -49,12 +51,12 @@
public void echoOneWay(String input)
{
Logger.getLogger(this.getClass()).info("echoOneWay: " + input);
- count++;
+ count.incrementAndGet();
}
@WebMethod
public int getCount()
{
- return count;
+ return count.get();
}
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointOneImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointOneImpl.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointOneImpl.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.ws.jaxws.cxf.jbws3060;
+import java.util.concurrent.atomic.AtomicInteger;
+
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;
@@ -32,13 +34,13 @@
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class EndpointOneImpl
{
- private volatile static int count = 0;
+ private static AtomicInteger count = new AtomicInteger(0);
@WebMethod
public String echo(String input)
{
Logger.getLogger(this.getClass()).info("echo: " + input);
- count++;
+ count.incrementAndGet();
return input;
}
@@ -47,12 +49,12 @@
public void echoOneWay(String input)
{
Logger.getLogger(this.getClass()).info("echoOneWay: " + input);
- count++;
+ count.incrementAndGet();
}
@WebMethod
public int getCount()
{
- return count;
+ return count.get();
}
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointTwoEJB3Impl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointTwoEJB3Impl.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointTwoEJB3Impl.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.ws.jaxws.cxf.jbws3060;
+import java.util.concurrent.atomic.AtomicInteger;
+
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
@@ -34,13 +36,13 @@
@Stateless
public class EndpointTwoEJB3Impl
{
- private volatile static int count = 0;
+ private static AtomicInteger count = new AtomicInteger(0);
@WebMethod
public String sayHello(String input)
{
Logger.getLogger(this.getClass()).info("sayHello: " + input);
- count++;
+ count.incrementAndGet();
return "Hi " + input;
}
@@ -49,12 +51,12 @@
public void sayHelloOneWay(String input)
{
Logger.getLogger(this.getClass()).info("sayHelloOneWay: " + input);
- count++;
+ count.incrementAndGet();
}
@WebMethod
public int getCount()
{
- return count;
+ return count.get();
}
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointTwoImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointTwoImpl.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/EndpointTwoImpl.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.ws.jaxws.cxf.jbws3060;
+import java.util.concurrent.atomic.AtomicInteger;
+
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;
@@ -32,13 +34,13 @@
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class EndpointTwoImpl
{
- private volatile static int count = 0;
+ private static AtomicInteger count = new AtomicInteger(0);
@WebMethod
public String sayHello(String input)
{
Logger.getLogger(this.getClass()).info("sayHello: " + input);
- count++;
+ count.incrementAndGet();
return "Hi " + input;
}
@@ -47,12 +49,12 @@
public void sayHelloOneWay(String input)
{
Logger.getLogger(this.getClass()).info("sayHelloOneWay: " + input);
- count++;
+ count.incrementAndGet();
}
@WebMethod
public int getCount()
{
- return count;
+ return count.get();
}
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/JBWS3060ServletTestCase.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/JBWS3060ServletTestCase.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/JBWS3060ServletTestCase.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -37,10 +37,4 @@
return new JBossWSCXFTestSetup(JBWS3060ServletTestCase.class,
"jaxws-cxf-jbws3060.war");
}
- @Override
- protected void setUp() throws Exception {
- System.out.println("FIXME: JBWS3060ServletTestCase temporarly running with
limited concurrency, investigate load issue.");
- this.defaultSize = 10;
- }
-
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/JBWS3060Tests.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/JBWS3060Tests.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/jbws3060/JBWS3060Tests.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -84,8 +84,8 @@
List<Callable<Boolean>> callables = new
ArrayList<Callable<Boolean>>(size*2);
for (int i = 0; i < size; i++)
{
- callables.add(new CallableOne(portOne, oneway));
- callables.add(new CallableTwo(portTwo, oneway));
+ callables.add(new CallableOne(portOne, oneway, i));
+ callables.add(new CallableTwo(portTwo, oneway, i));
}
List<Future<Boolean>> futures = es.invokeAll(callables);
for (Future<Boolean> f : futures)
@@ -113,16 +113,18 @@
{
private EndpointOne port;
private boolean oneway;
+ private int seqNum;
- public CallableOne(EndpointOne port, boolean oneway)
+ public CallableOne(EndpointOne port, boolean oneway, int seqNum)
{
this.port = port;
this.oneway = oneway;
+ this.seqNum = seqNum;
}
public Boolean call() throws Exception
{
- String arg = "Foo";
+ String arg = "Foo" + seqNum;
if (oneway)
{
port.echoOneWay(arg);
@@ -140,16 +142,18 @@
{
private EndpointTwo port;
private boolean oneway;
+ private int seqNum;
- public CallableTwo(EndpointTwo port, boolean oneway)
+ public CallableTwo(EndpointTwo port, boolean oneway, int seqNum)
{
this.port = port;
this.oneway = oneway;
+ this.seqNum = seqNum;
}
public Boolean call() throws Exception
{
- String arg = "John";
+ String arg = "John" + seqNum;
if (oneway)
{
port.sayHelloOneWay(arg);
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/logging/CustomInInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/logging/CustomInInterceptor.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/logging/CustomInInterceptor.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -1,21 +1,23 @@
package org.jboss.test.ws.jaxws.cxf.logging;
+import java.util.concurrent.atomic.AtomicInteger;
+
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.message.Message;
public class CustomInInterceptor extends LoggingInInterceptor
{
- private static volatile int count = 0;
+ private static AtomicInteger count = new AtomicInteger(0);
public void handleMessage(Message message) throws Fault {
- count++;
+ count.incrementAndGet();
super.handleMessage(message);
}
public static int getCount()
{
- System.out.println("COUNT = "+count);
- return count;
+ System.out.println("COUNT = "+count.get());
+ return count.get();
}
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneEJB3Impl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneEJB3Impl.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneEJB3Impl.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.ws.jaxws.cxf.mixtype;
+import java.util.concurrent.atomic.AtomicInteger;
+
import javax.ejb.Stateless;
import javax.jws.Oneway;
import javax.jws.WebMethod;
@@ -34,13 +36,13 @@
@Stateless
public class EndpointOneEJB3Impl implements EndpointOne
{
- private volatile static int count = 0;
+ private static AtomicInteger count = new AtomicInteger(0);
@WebMethod
public String echo(String input)
{
Logger.getLogger(this.getClass()).info("echo: " + input);
- count = count + 5;
+ count.addAndGet(5);
return input;
}
@@ -49,13 +51,13 @@
public void echoOneWay(String input)
{
Logger.getLogger(this.getClass()).info("echoOneWay: " + input);
- count = count + 5;
+ count.addAndGet(5);
}
@WebMethod
public int getCount()
{
- return count;
+ return count.get();
}
}
Modified:
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneImpl.java
===================================================================
---
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneImpl.java 2011-11-11
18:41:49 UTC (rev 15245)
+++
stack/cxf/trunk/modules/testsuite/cxf-tests/src/test/java/org/jboss/test/ws/jaxws/cxf/mixtype/EndpointOneImpl.java 2011-11-12
13:36:28 UTC (rev 15246)
@@ -22,6 +22,8 @@
package org.jboss.test.ws.jaxws.cxf.mixtype;
+import java.util.concurrent.atomic.AtomicInteger;
+
import javax.jws.Oneway;
import javax.jws.WebMethod;
import javax.jws.WebService;
@@ -33,13 +35,13 @@
@SOAPBinding(style = SOAPBinding.Style.RPC)
public class EndpointOneImpl implements EndpointOne
{
- private volatile static int count = 0;
+ private static AtomicInteger count = new AtomicInteger(0);
@WebMethod
public String echo(String input)
{
Logger.getLogger(this.getClass()).info("echo: " + input);
- count++;
+ count.incrementAndGet();
return input;
}
@@ -48,13 +50,13 @@
public void echoOneWay(String input)
{
Logger.getLogger(this.getClass()).info("echoOneWay: " + input);
- count++;
+ count.incrementAndGet();
}
@WebMethod
public int getCount()
{
- return count;
+ return count.get();
}
}