wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1511855 - in /wink/2.x/trunk: wink-common/src/main/java/org/apache/wink/common/model/rss/ wink-common/src/test/java/org/apache/wink/common/model/wadl/ wink-server/src/test/java/org/apache/wink/server/internal/registry/
Date Thu, 08 Aug 2013 16:30:09 GMT
Author: gpetracek
Date: Thu Aug  8 16:30:08 2013
New Revision: 1511855

URL: http://svn.apache.org/r1511855
Log:
WINK-404 cleanup of tests which depend on the system

Modified:
    wink/2.x/trunk/wink-common/src/main/java/org/apache/wink/common/model/rss/RssChannel.java
    wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/model/wadl/WADLGeneratorTest.java
    wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/registry/ProvidersRegistrySystemTest.java

Modified: wink/2.x/trunk/wink-common/src/main/java/org/apache/wink/common/model/rss/RssChannel.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-common/src/main/java/org/apache/wink/common/model/rss/RssChannel.java?rev=1511855&r1=1511854&r2=1511855&view=diff
==============================================================================
--- wink/2.x/trunk/wink-common/src/main/java/org/apache/wink/common/model/rss/RssChannel.java
(original)
+++ wink/2.x/trunk/wink-common/src/main/java/org/apache/wink/common/model/rss/RssChannel.java
Thu Aug  8 16:30:08 2013
@@ -30,6 +30,7 @@ import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -804,12 +805,12 @@ public class RssChannel {
     }
 
     public static String convertJavaDateToRssDate(Date javaDate) {
-        SimpleDateFormat format = new SimpleDateFormat(RSS_DATE_FORMAT);
+        SimpleDateFormat format = new SimpleDateFormat(RSS_DATE_FORMAT, Locale.ENGLISH);
         return format.format(javaDate);
     }
 
     public static Date convertRssDateToJavaDate(String rssDate) {
-        SimpleDateFormat format = new SimpleDateFormat(RSS_DATE_FORMAT);
+        SimpleDateFormat format = new SimpleDateFormat(RSS_DATE_FORMAT, Locale.ENGLISH);
         try {
             return format.parse(rssDate);
         } catch (ParseException e) {

Modified: wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/model/wadl/WADLGeneratorTest.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/model/wadl/WADLGeneratorTest.java?rev=1511855&r1=1511854&r2=1511855&view=diff
==============================================================================
--- wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/model/wadl/WADLGeneratorTest.java
(original)
+++ wink/2.x/trunk/wink-common/src/test/java/org/apache/wink/common/model/wadl/WADLGeneratorTest.java
Thu Aug  8 16:30:08 2013
@@ -23,6 +23,7 @@ package org.apache.wink.common.model.wad
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import java.util.Collections;
 import java.util.HashSet;
@@ -161,8 +162,22 @@ public class WADLGeneratorTest {
 
         List<MethodMetadata> methodMetadata = metadata.getResourceMethods();
         assertEquals(2, methodMetadata.size());
-        assertEquals(HttpMethod.GET, methodMetadata.get(0).getHttpMethod());
-        assertEquals(HttpMethod.POST, methodMetadata.get(1).getHttpMethod());
+
+        //the order isn't fixed since Class#getMethods is used
+        boolean getMethodFound = false;
+        boolean postMethodFound = false;
+
+        for (MethodMetadata mm : methodMetadata) {
+            if (HttpMethod.GET.equals(mm.getHttpMethod()) && !getMethodFound) {
+                getMethodFound = true;
+            } else if (HttpMethod.POST.equals(mm.getHttpMethod()) && !postMethodFound)
{
+                postMethodFound = true;
+            } else {
+                fail();
+            }
+        }
+        assertTrue(getMethodFound);
+        assertTrue(postMethodFound);
     }
 
     @Test

Modified: wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/registry/ProvidersRegistrySystemTest.java
URL: http://svn.apache.org/viewvc/wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/registry/ProvidersRegistrySystemTest.java?rev=1511855&r1=1511854&r2=1511855&view=diff
==============================================================================
--- wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/registry/ProvidersRegistrySystemTest.java
(original)
+++ wink/2.x/trunk/wink-server/src/test/java/org/apache/wink/server/internal/registry/ProvidersRegistrySystemTest.java
Thu Aug  8 16:30:08 2013
@@ -31,6 +31,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
+import java.util.Locale;
 import java.util.Set;
 import java.util.StringTokenizer;
 
@@ -58,7 +59,11 @@ import org.springframework.mock.web.Mock
 import org.springframework.mock.web.MockHttpServletResponse;
 
 public class ProvidersRegistrySystemTest extends MockServletInvocationTest {
-    
+
+    static {
+        Locale.setDefault(Locale.ENGLISH);
+    }
+
     private static File winkprovidersFile = null;
     private static File winkapplicationFile = null;
     private static String rootPath = null;
@@ -69,7 +74,7 @@ public class ProvidersRegistrySystemTest
     
     @Override
     protected void setUp() throws Exception {
-        
+
         Field defaultFileField = ApplicationFileLoader.class.getDeclaredField("CORE_APPLICATION");
         defaultFileField.setAccessible(true);
         String filePath = (String)defaultFileField.get(null);



Mime
View raw message