wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1511852 - in /wink/2.x/trunk: ./ wink-bv-server/ wink-client-apache-httpclient/ wink-client-asynchttpclient/ wink-client/ wink-common/ wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/ wink-common/src/test/java/org/apach...
Date Thu, 08 Aug 2013 16:26:26 GMT
Author: gpetracek
Date: Thu Aug  8 16:26:26 2013
New Revision: 1511852

URL: http://svn.apache.org/r1511852
Log:
WINK-403 upgraded test-setup (first step)

Modified:
    wink/2.x/trunk/pom.xml
    wink/2.x/trunk/wink-bv-server/pom.xml
    wink/2.x/trunk/wink-client-apache-httpclient/pom.xml
    wink/2.x/trunk/wink-client-asynchttpclient/pom.xml
    wink/2.x/trunk/wink-client/pom.xml
    wink/2.x/trunk/wink-common/pom.xml
    wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java
    wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/entity/SourceProviderTest.java
    wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/entity/xml/AbstractJAXBProviderTest.java
    wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/jaxb/AbstractJAXBCollectionProviderTest.java
    wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/jaxb/ProvidersJAXBTest.java
    wink/2.x/trunk/wink-component-test-support/pom.xml
    wink/2.x/trunk/wink-examples/apps/HelloWorld/pom.xml
    wink/2.x/trunk/wink-examples/core/Jaxb/pom.xml
    wink/2.x/trunk/wink-itests/wink-itest-support/pom.xml
    wink/2.x/trunk/wink-itests/wink-itest/pom.xml
    wink/2.x/trunk/wink-jcdi-server/pom.xml
    wink/2.x/trunk/wink-json4j/pom.xml
    wink/2.x/trunk/wink-osgi/pom.xml
    wink/2.x/trunk/wink-providers/pom.xml
    wink/2.x/trunk/wink-providers/wink-protobuf-provider/pom.xml
    wink/2.x/trunk/wink-providers/wink-thrift-provider/pom.xml
    wink/2.x/trunk/wink-server/pom.xml
    wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjusterTest.java
    wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/lifecycle/ResourceLifecycle.java
    wink/2.x/trunk/wink-spring-support/pom.xml
    wink/2.x/trunk/wink-webdav/pom.xml

Modified: wink/2.x/trunk/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/pom.xml (original)
+++ wink/2.x/trunk/pom.xml Thu Aug  8 16:26:26 2013
@@ -615,9 +615,21 @@
             </dependency>
             <dependency>
                 <groupId>junit</groupId>
-                <artifactId>junit</artifactId>
+                <artifactId>junit-dep</artifactId>
                 <version>4.10</version>
                 <scope>test</scope>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.hamcrest</groupId>
+                        <artifactId>hamcrest-core</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+            <dependency>
+            	<groupId>org.hamcrest</groupId>
+            	<artifactId>hamcrest-core</artifactId>
+            	<version>1.2</version>
+                <scope>test</scope>
             </dependency>
             <dependency>
                 <groupId>org.slf4j</groupId>
@@ -725,13 +737,21 @@
             </dependency>
             <dependency>
                 <groupId>org.jmock</groupId>
-                <artifactId>jmock-junit3</artifactId>
-                <version>2.5.1</version>
+                <artifactId>jmock-junit4</artifactId>
+                <version>2.6.0</version>
+                <scope>test</scope>
+                <exclusions>
+                    <exclusion>
+                        <groupId>junit</groupId>
+                        <artifactId>junit-dep</artifactId>
+                    </exclusion>
+                </exclusions>
             </dependency>
             <dependency>
                 <groupId>org.jmock</groupId>
                 <artifactId>jmock-legacy</artifactId>
-                <version>2.5.1</version>
+                <version>2.6.0</version>
+                <scope>test</scope>
             </dependency>
             <dependency>
                 <groupId>cglib</groupId>

Modified: wink/2.x/trunk/wink-bv-server/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-bv-server/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-bv-server/pom.xml (original)
+++ wink/2.x/trunk/wink-bv-server/pom.xml Thu Aug  8 16:26:26 2013
@@ -57,13 +57,11 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>org.jmock</groupId>
-            <artifactId>jmock-junit3</artifactId>
-            <version>2.5.1</version>
-            <scope>test</scope>
+            <artifactId>jmock-junit4</artifactId>
         </dependency>
        <dependency>
             <groupId>org.slf4j</groupId>

Modified: wink/2.x/trunk/wink-client-apache-httpclient/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-client-apache-httpclient/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-client-apache-httpclient/pom.xml (original)
+++ wink/2.x/trunk/wink-client-apache-httpclient/pom.xml Thu Aug  8 16:26:26 2013
@@ -33,8 +33,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.httpcomponents</groupId>
@@ -67,8 +66,7 @@
         </dependency>
         <dependency>
             <groupId>org.jmock</groupId>
-            <artifactId>jmock-junit3</artifactId>
-            <scope>test</scope>
+            <artifactId>jmock-junit4</artifactId>
         </dependency>
     </dependencies>
 </project>

Modified: wink/2.x/trunk/wink-client-asynchttpclient/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-client-asynchttpclient/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-client-asynchttpclient/pom.xml (original)
+++ wink/2.x/trunk/wink-client-asynchttpclient/pom.xml Thu Aug  8 16:26:26 2013
@@ -41,8 +41,7 @@
 
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
 
         <dependency>
@@ -53,8 +52,7 @@
 
         <dependency>
             <groupId>org.jmock</groupId>
-            <artifactId>jmock-junit3</artifactId>
-            <scope>test</scope>
+            <artifactId>jmock-junit4</artifactId>
         </dependency>
 
         <dependency>

Modified: wink/2.x/trunk/wink-client/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-client/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-client/pom.xml (original)
+++ wink/2.x/trunk/wink-client/pom.xml Thu Aug  8 16:26:26 2013
@@ -56,8 +56,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>javax.xml.bind</groupId>

Modified: wink/2.x/trunk/wink-common/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-common/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-common/pom.xml (original)
+++ wink/2.x/trunk/wink-common/pom.xml Thu Aug  8 16:26:26 2013
@@ -53,8 +53,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>javax.xml.bind</groupId>
@@ -74,8 +73,7 @@
         </dependency>
         <dependency>
             <groupId>org.jmock</groupId>
-            <artifactId>jmock-junit3</artifactId>
-            <scope>test</scope>
+            <artifactId>jmock-junit4</artifactId>
         </dependency>
         <dependency>
             <groupId>org.codehaus.woodstox</groupId>
@@ -96,7 +94,6 @@
         <dependency>
             <groupId>org.jmock</groupId>
             <artifactId>jmock-legacy</artifactId>
-            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>cglib</groupId>

Modified: wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java
(original)
+++ wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/lifecycle/JSR250OFFactoryTest.java
Thu Aug  8 16:26:26 2013
@@ -28,6 +28,7 @@ import junit.framework.TestCase;
 
 import org.apache.wink.common.RuntimeContext;
 import org.apache.wink.common.internal.runtime.RuntimeContextTLS;
+import org.junit.Before;
 
 public class JSR250OFFactoryTest extends TestCase {
 
@@ -94,7 +95,7 @@ public class JSR250OFFactoryTest extends
         }
     }
     
-    @SuppressWarnings("unchecked")
+    @Before
     public void setUp() {
         called = null;
         factoryRegistry = new LifecycleManagersRegistry();

Modified: wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/entity/SourceProviderTest.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/entity/SourceProviderTest.java?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/entity/SourceProviderTest.java
(original)
+++ wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/entity/SourceProviderTest.java
Thu Aug  8 16:26:26 2013
@@ -38,12 +38,18 @@ import org.apache.wink.common.internal.r
 import org.apache.wink.common.model.JAXBUnmarshalOptions;
 import org.apache.wink.common.model.XmlFormattingOptions;
 import org.jmock.Expectations;
-import org.jmock.integration.junit3.MockObjectTestCase;
+import org.jmock.integration.junit4.JUnitRuleMockery;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
-public class SourceProviderTest extends MockObjectTestCase {
+import static org.junit.Assert.assertTrue;
+
+public class SourceProviderTest {
+
+    @Rule
+    public final JUnitRuleMockery context = new JUnitRuleMockery();
 
     static String path = null;
     static {
@@ -75,10 +81,10 @@ public class SourceProviderTest extends 
     
     @Before
     public void setUp() {
-        providers = mock(Providers.class);
-        final RuntimeContext runtimeContext = mock(RuntimeContext.class);
-        winkConfiguration = mock(WinkConfiguration.class);
-        checking(new Expectations() {{
+        providers = context.mock(Providers.class);
+        final RuntimeContext runtimeContext = context.mock(RuntimeContext.class);
+        winkConfiguration = context.mock(WinkConfiguration.class);
+        context.checking(new Expectations() {{
             allowing(providers).getContextResolver(XmlFormattingOptions.class, MediaType.TEXT_XML_TYPE);
will(returnValue(null));
             allowing(providers).getContextResolver(JAXBUnmarshalOptions.class, MediaType.TEXT_XML_TYPE);
will(returnValue(null));
             allowing(runtimeContext).getAttribute(MediaTypeCharsetAdjuster.class); will(returnValue(null));
@@ -103,7 +109,7 @@ public class SourceProviderTest extends 
         
         final Properties props = new Properties();
         props.put("wink.supportDTDEntityExpansion", "true");
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         

Modified: wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/entity/xml/AbstractJAXBProviderTest.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/entity/xml/AbstractJAXBProviderTest.java?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/entity/xml/AbstractJAXBProviderTest.java
(original)
+++ wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/entity/xml/AbstractJAXBProviderTest.java
Thu Aug  8 16:26:26 2013
@@ -35,9 +35,12 @@ import org.apache.wink.common.RuntimeCon
 import org.apache.wink.common.internal.WinkConfiguration;
 import org.apache.wink.common.internal.runtime.RuntimeContextTLS;
 import org.jmock.Expectations;
-import org.jmock.integration.junit3.MockObjectTestCase;
+import org.jmock.integration.junit4.JUnitRuleMockery;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Rule;
+
+import static org.junit.Assert.*;
 
 /**
  * this test class is relatively new compared to the various
@@ -46,7 +49,10 @@ import org.junit.Before;
  * confident in the amount of testing being done in other places.
  *
  */
-public class AbstractJAXBProviderTest extends MockObjectTestCase {
+public class AbstractJAXBProviderTest {
+
+    @Rule
+    public final JUnitRuleMockery context = new JUnitRuleMockery();
 
     /*
      * this test class is relatively new compared to the various
@@ -100,9 +106,9 @@ public class AbstractJAXBProviderTest ex
     
     @Before
     public void setUp() {
-        winkConfiguration = mock(WinkConfiguration.class);
-        final RuntimeContext runtimeContext = mock(RuntimeContext.class);
-        checking(new Expectations() {{
+        winkConfiguration = context.mock(WinkConfiguration.class);
+        final RuntimeContext runtimeContext = context.mock(RuntimeContext.class);
+        context.checking(new Expectations() {{
             allowing(runtimeContext).getAttribute(WinkConfiguration.class); will(returnValue(winkConfiguration));
         }});
         RuntimeContextTLS.setRuntimeContext(runtimeContext);
@@ -117,7 +123,7 @@ public class AbstractJAXBProviderTest ex
     public void testGetXMLStreamReader1() throws Exception {
         
         final Properties props = new Properties();
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         
@@ -135,7 +141,7 @@ public class AbstractJAXBProviderTest ex
     public void testGetXMLStreamReader2() throws Exception {
         
         final Properties props = new Properties();
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         
@@ -153,7 +159,7 @@ public class AbstractJAXBProviderTest ex
     public void testGetXMLStreamReader3() throws Exception {
         
         final Properties props = new Properties();
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         
@@ -171,7 +177,7 @@ public class AbstractJAXBProviderTest ex
     public void testGetXMLStreamReader4() throws Exception {
         
         final Properties props = new Properties();
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         
@@ -189,7 +195,7 @@ public class AbstractJAXBProviderTest ex
     public void testGetXMLStreamReaderWithDTDUnsupported() throws Exception {
         
         final Properties props = new Properties();
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         
@@ -210,7 +216,7 @@ public class AbstractJAXBProviderTest ex
         
         final Properties props = new Properties();
         props.put("wink.supportDTDEntityExpansion", "true");
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         

Modified: wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/jaxb/AbstractJAXBCollectionProviderTest.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/jaxb/AbstractJAXBCollectionProviderTest.java?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/jaxb/AbstractJAXBCollectionProviderTest.java
(original)
+++ wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/jaxb/AbstractJAXBCollectionProviderTest.java
Thu Aug  8 16:26:26 2013
@@ -19,23 +19,6 @@
  *******************************************************************************/
 package org.apache.wink.common.internal.providers.jaxb;
 
-import java.io.ByteArrayInputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import javax.ws.rs.core.GenericEntity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.ext.ContextResolver;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Providers;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.stream.XMLStreamException;
-
 import org.apache.wink.common.RuntimeContext;
 import org.apache.wink.common.internal.WinkConfiguration;
 import org.apache.wink.common.internal.contexts.MediaTypeCharsetAdjuster;
@@ -46,14 +29,36 @@ import org.apache.wink.common.internal.r
 import org.apache.wink.common.model.JAXBUnmarshalOptions;
 import org.apache.wink.common.model.XmlFormattingOptions;
 import org.jmock.Expectations;
-import org.jmock.integration.junit3.MockObjectTestCase;
+import org.jmock.integration.junit4.JUnitRuleMockery;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Rule;
 import org.w3c.dom.Document;
 
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.MessageBodyReader;
+import javax.ws.rs.ext.MessageBodyWriter;
+import javax.ws.rs.ext.Providers;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.stream.XMLStreamException;
+import java.io.ByteArrayInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import static org.junit.Assert.*;
+
+
+public class AbstractJAXBCollectionProviderTest {
+
+    @Rule
+    public final JUnitRuleMockery context = new JUnitRuleMockery();
 
-public class AbstractJAXBCollectionProviderTest extends MockObjectTestCase {
-    
     public class MyJAXBXmlProvider extends JAXBCollectionXmlProvider {
 
         MyJAXBXmlProvider() {
@@ -70,7 +75,6 @@ public class AbstractJAXBCollectionProvi
             // use JAXBContext.newInstance(String).  The default in AbstractJAXBProvider
is JAXBContext.newInstance(Class)
             return JAXBContext.newInstance(type.getPackage().getName());
         }
-        
     }
 
     static String path = null;
@@ -154,10 +158,10 @@ public class AbstractJAXBCollectionProvi
     
     @Before
     public void setUp() {
-        providers = mock(Providers.class);
-        final RuntimeContext runtimeContext = mock(RuntimeContext.class);
-        final WinkConfiguration winkConfiguration = mock(WinkConfiguration.class);
-        checking(new Expectations() {{
+        providers = context.mock(Providers.class);
+        final RuntimeContext runtimeContext = context.mock(RuntimeContext.class);
+        final WinkConfiguration winkConfiguration = context.mock(WinkConfiguration.class);
+        context.checking(new Expectations() {{
             allowing(providers).getContextResolver(JAXBContext.class, MediaType.TEXT_XML_TYPE);
will(returnValue(new MyJAXBContextResolver()));
             allowing(providers).getContextResolver(XmlFormattingOptions.class, MediaType.TEXT_XML_TYPE);
will(returnValue(null));
             allowing(providers).getContextResolver(JAXBUnmarshalOptions.class, MediaType.TEXT_XML_TYPE);
will(returnValue(null));
@@ -182,7 +186,7 @@ public class AbstractJAXBCollectionProvi
         GenericEntity<List<AddNumbers>> type1 =
             new GenericEntity<List<AddNumbers>>(new ArrayList<AddNumbers>())
{
             };
-            
+
         assertTrue(jaxbProviderReader.isReadable(type1.getRawType(), type1.getType(), null,
MediaType.TEXT_XML_TYPE));
         ByteArrayInputStream bais = new ByteArrayInputStream(xml.getBytes());
         Object obj = jaxbProviderReader.readFrom(type1.getRawType(), type1.getType(), null,
MediaType.TEXT_XML_TYPE, null, bais);

Modified: wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/jaxb/ProvidersJAXBTest.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/jaxb/ProvidersJAXBTest.java?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/jaxb/ProvidersJAXBTest.java
(original)
+++ wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/internal/providers/jaxb/ProvidersJAXBTest.java
Thu Aug  8 16:26:26 2013
@@ -50,13 +50,21 @@ import org.apache.wink.common.internal.r
 import org.apache.wink.common.model.JAXBUnmarshalOptions;
 import org.apache.wink.common.model.XmlFormattingOptions;
 import org.jmock.Expectations;
-import org.jmock.integration.junit3.MockObjectTestCase;
+import org.jmock.integration.junit4.JUnitRuleMockery;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
-public class ProvidersJAXBTest extends MockObjectTestCase {
-    
+import static org.junit.Assert.*;
+
+public class ProvidersJAXBTest {
+
+    @Rule
+    public final JUnitRuleMockery context = new JUnitRuleMockery() {{
+        //setThreadingPolicy(new Synchroniser()); //see @Test(timeout) TODO
+    }};
+
     public class MyJAXBXmlProvider extends JAXBXmlProvider {
 
         MyJAXBXmlProvider() {
@@ -189,10 +197,10 @@ public class ProvidersJAXBTest extends M
     
     @Before
     public void setUp() {
-        providers = mock(Providers.class);
-        final RuntimeContext runtimeContext = mock(RuntimeContext.class);
-        winkConfiguration = mock(WinkConfiguration.class);
-        checking(new Expectations() {{
+        providers = context.mock(Providers.class);
+        final RuntimeContext runtimeContext = context.mock(RuntimeContext.class);
+        winkConfiguration = context.mock(WinkConfiguration.class);
+        context.checking(new Expectations() {{
             allowing(providers).getContextResolver(JAXBContext.class, MediaType.TEXT_XML_TYPE);
will(returnValue(new MyJAXBContextResolver()));
             allowing(providers).getContextResolver(XmlFormattingOptions.class, MediaType.TEXT_XML_TYPE);
will(returnValue(null));
             allowing(providers).getContextResolver(JAXBUnmarshalOptions.class, MediaType.TEXT_XML_TYPE);
will(returnValue(null));
@@ -202,7 +210,6 @@ public class ProvidersJAXBTest extends M
         RuntimeContextTLS.setRuntimeContext(runtimeContext);
         jaxbProviderReader = new MyJAXBXmlProvider();
         jaxbProviderWriter = new MyJAXBXmlProvider();
-        
     }
     
     @After
@@ -215,7 +222,7 @@ public class ProvidersJAXBTest extends M
     public void testJAXBUnmarshallingWithAlternateContext1() throws Exception {
         
         final Properties props = new Properties();
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         
@@ -257,7 +264,7 @@ public class ProvidersJAXBTest extends M
     public void testJAXBUnmarshallingWithDTD() throws Exception {
         
         final Properties props = new Properties();
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         
@@ -289,7 +296,7 @@ public class ProvidersJAXBTest extends M
         // pretend we're on the server:
         final Properties props = new Properties();
         props.put("wink.supportDTDEntityExpansion", "true");
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         
@@ -312,7 +319,7 @@ public class ProvidersJAXBTest extends M
     public void testJAXBUnmarshallingMyPojoWithDTD() throws Exception {
 
         final Properties props = new Properties();
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         
@@ -340,7 +347,7 @@ public class ProvidersJAXBTest extends M
     public void testEntityExpansionAttack() throws Exception {
         
         final Properties props = new Properties();
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         
@@ -356,11 +363,10 @@ public class ProvidersJAXBTest extends M
         assertTrue("expected an XMLStreamException", ex.getCause() instanceof XMLStreamException);
     }
     
-    @Test(timeout=2000)
+    //TODO @Test(timeout=2000) needs special handling in combination with JUnitRuleMockery,
because it starts a new thread
     public void testEntityExpansionAttack2() throws Exception {
-        
         final Properties props = new Properties();
-        checking(new Expectations() {{
+        context.checking(new Expectations() {{
             allowing(winkConfiguration).getProperties(); will(returnValue(props));
         }});
         
@@ -375,5 +381,4 @@ public class ProvidersJAXBTest extends M
         }
         assertTrue("expected an XMLStreamException", ex.getCause() instanceof XMLStreamException);
     }
-
 }

Modified: wink/2.x/trunk/wink-component-test-support/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-component-test-support/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-component-test-support/pom.xml (original)
+++ wink/2.x/trunk/wink-component-test-support/pom.xml Thu Aug  8 16:26:26 2013
@@ -56,7 +56,20 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <artifactId>junit-dep</artifactId>
+            <version>4.10</version>
+            <scope>compile</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.hamcrest</groupId>
+                    <artifactId>hamcrest-core</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.hamcrest</groupId>
+            <artifactId>hamcrest-core</artifactId>
+            <version>1.2</version>
             <scope>compile</scope>
         </dependency>
         <dependency>

Modified: wink/2.x/trunk/wink-examples/apps/HelloWorld/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-examples/apps/HelloWorld/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-examples/apps/HelloWorld/pom.xml (original)
+++ wink/2.x/trunk/wink-examples/apps/HelloWorld/pom.xml Thu Aug  8 16:26:26 2013
@@ -69,8 +69,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>woodstox</groupId>

Modified: wink/2.x/trunk/wink-examples/core/Jaxb/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-examples/core/Jaxb/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-examples/core/Jaxb/pom.xml (original)
+++ wink/2.x/trunk/wink-examples/core/Jaxb/pom.xml Thu Aug  8 16:26:26 2013
@@ -73,8 +73,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>woodstox</groupId>

Modified: wink/2.x/trunk/wink-itests/wink-itest-support/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-itests/wink-itest-support/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-itests/wink-itest-support/pom.xml (original)
+++ wink/2.x/trunk/wink-itests/wink-itest-support/pom.xml Thu Aug  8 16:26:26 2013
@@ -30,7 +30,7 @@
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <artifactId>junit-dep</artifactId>
             <scope>compile</scope>
         </dependency>
     </dependencies>

Modified: wink/2.x/trunk/wink-itests/wink-itest/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-itests/wink-itest/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-itests/wink-itest/pom.xml (original)
+++ wink/2.x/trunk/wink-itests/wink-itest/pom.xml Thu Aug  8 16:26:26 2013
@@ -105,8 +105,7 @@
 
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
 
         <dependency>

Modified: wink/2.x/trunk/wink-jcdi-server/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-jcdi-server/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-jcdi-server/pom.xml (original)
+++ wink/2.x/trunk/wink-jcdi-server/pom.xml Thu Aug  8 16:26:26 2013
@@ -70,14 +70,11 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>org.jmock</groupId>
-            <artifactId>jmock-junit3</artifactId>
-            <version>2.5.1</version>
-            <scope>test</scope>
+            <artifactId>jmock-junit4</artifactId>
         </dependency>
        <dependency>
             <groupId>org.slf4j</groupId>

Modified: wink/2.x/trunk/wink-json4j/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-json4j/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-json4j/pom.xml (original)
+++ wink/2.x/trunk/wink-json4j/pom.xml Thu Aug  8 16:26:26 2013
@@ -31,8 +31,7 @@
     <dependencies>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
     </dependencies>
     <build>

Modified: wink/2.x/trunk/wink-osgi/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-osgi/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-osgi/pom.xml (original)
+++ wink/2.x/trunk/wink-osgi/pom.xml Thu Aug  8 16:26:26 2013
@@ -107,8 +107,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
         	<groupId>org.apache.wink</groupId>

Modified: wink/2.x/trunk/wink-providers/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-providers/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-providers/pom.xml (original)
+++ wink/2.x/trunk/wink-providers/pom.xml Thu Aug  8 16:26:26 2013
@@ -57,7 +57,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>

Modified: wink/2.x/trunk/wink-providers/wink-protobuf-provider/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-providers/wink-protobuf-provider/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-providers/wink-protobuf-provider/pom.xml (original)
+++ wink/2.x/trunk/wink-providers/wink-protobuf-provider/pom.xml Thu Aug  8 16:26:26 2013
@@ -46,8 +46,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>

Modified: wink/2.x/trunk/wink-providers/wink-thrift-provider/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-providers/wink-thrift-provider/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-providers/wink-thrift-provider/pom.xml (original)
+++ wink/2.x/trunk/wink-providers/wink-thrift-provider/pom.xml Thu Aug  8 16:26:26 2013
@@ -54,8 +54,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>

Modified: wink/2.x/trunk/wink-server/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-server/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-server/pom.xml (original)
+++ wink/2.x/trunk/wink-server/pom.xml Thu Aug  8 16:26:26 2013
@@ -78,8 +78,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>javax.xml.bind</groupId>
@@ -104,13 +103,11 @@
         </dependency>
         <dependency>
             <groupId>org.jmock</groupId>
-            <artifactId>jmock-junit3</artifactId>
-            <scope>test</scope>
+            <artifactId>jmock-junit4</artifactId>
         </dependency>
         <dependency>
             <groupId>org.jmock</groupId>
             <artifactId>jmock-legacy</artifactId>
-            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>cglib</groupId>

Modified: wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjusterTest.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjusterTest.java?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjusterTest.java
(original)
+++ wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/contexts/ServerMediaTypeCharsetAdjusterTest.java
Thu Aug  8 16:26:26 2013
@@ -32,21 +32,25 @@ import org.apache.wink.common.internal.W
 import org.apache.wink.common.internal.runtime.RuntimeContextTLS;
 import org.apache.wink.server.internal.DeploymentConfiguration;
 import org.jmock.Expectations;
-import org.jmock.integration.junit3.MockObjectTestCase;
+import org.jmock.integration.junit4.JUnitRuleMockery;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
 
-public class ServerMediaTypeCharsetAdjusterTest extends MockObjectTestCase {
+import static org.junit.Assert.*;
+
+public class ServerMediaTypeCharsetAdjusterTest {
+
+    @Rule
+    public final JUnitRuleMockery mockContext = new JUnitRuleMockery();
 
     RuntimeContext context = null;
     DeploymentConfiguration myConfig = new DeploymentConfiguration();
     MultivaluedMap<String, Object> responseHttpHeaders = null;
 
-    
-    @SuppressWarnings("unchecked")
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        
+    @Before
+    public void setUp() throws Exception {
         myConfig.init();
         // default is false in the real config  
         myConfig.setDefaultResponseCharset(true);
@@ -54,16 +58,16 @@ public class ServerMediaTypeCharsetAdjus
         myConfig.setUseAcceptCharset(false);
         
         // common expectations
-        context = mock(RuntimeContext.class);
-        responseHttpHeaders = mock(MultivaluedMap.class);
-        checking(new Expectations() {{
+        context = mockContext.mock(RuntimeContext.class);
+        responseHttpHeaders = mockContext.mock(MultivaluedMap.class);
+        mockContext.checking(new Expectations() {{
             allowing(context).getAttribute(WinkConfiguration.class); will(returnValue(myConfig));
         }});
         
         RuntimeContextTLS.setRuntimeContext(context);
     }
     
-    @Override
+    @After
     public void tearDown() {
         RuntimeContextTLS.setRuntimeContext(null);
     }
@@ -117,7 +121,7 @@ public class ServerMediaTypeCharsetAdjus
 
         final String expected = "application/xml;charset=UTF-8";
         
-        checking(new Expectations() {{
+        mockContext.checking(new Expectations() {{
             oneOf(responseHttpHeaders).isEmpty(); will(returnValue(true));
             oneOf(responseHttpHeaders).putSingle(HttpHeaders.CONTENT_TYPE, expected);
         }});
@@ -135,8 +139,8 @@ public class ServerMediaTypeCharsetAdjus
 
         final String expected = "application/xml;charset=UTF-8";
         
-        final HttpHeaders httpHeaders = mock(HttpHeaders.class);
-        checking(new Expectations() {{
+        final HttpHeaders httpHeaders = mockContext.mock(HttpHeaders.class);
+        mockContext.checking(new Expectations() {{
             oneOf(responseHttpHeaders).isEmpty(); will(returnValue(true));
             oneOf(responseHttpHeaders).putSingle(HttpHeaders.CONTENT_TYPE, expected);
             oneOf(context).getHttpHeaders(); will(returnValue(httpHeaders));
@@ -162,8 +166,8 @@ public class ServerMediaTypeCharsetAdjus
         final List<String> acceptHeaders = new ArrayList<String>();
         acceptHeaders.add("UTF-16");
         
-        final HttpHeaders httpHeaders = mock(HttpHeaders.class);
-        checking(new Expectations() {{
+        final HttpHeaders httpHeaders = mockContext.mock(HttpHeaders.class);
+        mockContext.checking(new Expectations() {{
             oneOf(responseHttpHeaders).add("nonesense", null);
             oneOf(responseHttpHeaders).isEmpty(); will(returnValue(false));
             oneOf(responseHttpHeaders).get(HttpHeaders.CONTENT_TYPE); will(returnValue(null));
@@ -195,7 +199,7 @@ public class ServerMediaTypeCharsetAdjus
         acceptHeaders.add("UTF-16;q=1.0");
         acceptHeaders.add("ISO-8859-1;q=0.5");  // re-prioritize silently added charset to
lower q-value than UTF-16
         
-        checking(new Expectations() {{
+        mockContext.checking(new Expectations() {{
             oneOf(responseHttpHeaders).isEmpty(); will(returnValue(true));
             oneOf(responseHttpHeaders).putSingle(HttpHeaders.CONTENT_TYPE, expected);
         }});
@@ -219,8 +223,8 @@ public class ServerMediaTypeCharsetAdjus
         acceptHeaders.add("UTF-16;q=1.0");
         acceptHeaders.add("ISO-8859-1;q=0.5");  // re-prioritize silently added charset to
lower q-value than UTF-16
         
-        final HttpHeaders httpHeaders = mock(HttpHeaders.class);
-        checking(new Expectations() {{
+        final HttpHeaders httpHeaders = mockContext.mock(HttpHeaders.class);
+        mockContext.checking(new Expectations() {{
             oneOf(responseHttpHeaders).isEmpty(); will(returnValue(true));
             oneOf(responseHttpHeaders).putSingle(HttpHeaders.CONTENT_TYPE, expected);
             oneOf(context).getHttpHeaders(); will(returnValue(httpHeaders));
@@ -247,8 +251,8 @@ public class ServerMediaTypeCharsetAdjus
         acceptHeaders.add("UTF-16;q=1.0");
         acceptHeaders.add("ISO-8859-1;q=0.5");  // re-prioritize silently added charset to
lower q-value than UTF-16
         
-        final HttpHeaders httpHeaders = mock(HttpHeaders.class);
-        checking(new Expectations() {{
+        final HttpHeaders httpHeaders = mockContext.mock(HttpHeaders.class);
+        mockContext.checking(new Expectations() {{
             oneOf(responseHttpHeaders).isEmpty(); will(returnValue(true));
             oneOf(responseHttpHeaders).putSingle(HttpHeaders.CONTENT_TYPE, expected);
             oneOf(context).getHttpHeaders(); will(returnValue(httpHeaders));

Modified: wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/lifecycle/ResourceLifecycle.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/lifecycle/ResourceLifecycle.java?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/lifecycle/ResourceLifecycle.java
(original)
+++ wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/lifecycle/ResourceLifecycle.java
Thu Aug  8 16:26:26 2013
@@ -24,7 +24,7 @@ import javax.ws.rs.Path;
 
 import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
 
-public class ResourceLifecycle extends MockServletInvocationTest {
+public abstract class ResourceLifecycle extends MockServletInvocationTest {
 
     @Path("/resource1")
     public static class Resource1 {

Modified: wink/2.x/trunk/wink-spring-support/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-spring-support/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-spring-support/pom.xml (original)
+++ wink/2.x/trunk/wink-spring-support/pom.xml Thu Aug  8 16:26:26 2013
@@ -68,8 +68,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>org.codehaus.woodstox</groupId>

Modified: wink/2.x/trunk/wink-webdav/pom.xml
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-webdav/pom.xml?rev=1511852&r1=1511851&r2=1511852&view=diff
==============================================================================
--- wink/2.x/trunk/wink-webdav/pom.xml (original)
+++ wink/2.x/trunk/wink-webdav/pom.xml Thu Aug  8 16:26:26 2013
@@ -57,8 +57,7 @@
         </dependency>
         <dependency>
             <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
+            <artifactId>junit-dep</artifactId>
         </dependency>
         <dependency>
             <groupId>xmlunit</groupId>



Mime
View raw message