Author: psharples
Date: Mon Mar 12 13:04:06 2012
New Revision: 1299660

URL: http://svn.apache.org/viewvc?rev=1299660&view=rev
Log:
Updated tests so that they run cleanly (tests remove all widgets & instances 
after they have run, so you can run them multiple times without failing)  Aslo 
updated references to 'id_key'  to be 'idkey'. (also updated in widgetinstance 
controller)

Modified:
    
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ParticipantsControllerTest.java
    
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/PropertiesControllerTest.java
    
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetInstancesControllerTest.java

Modified: 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ParticipantsControllerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ParticipantsControllerTest.java?rev=1299660&r1=1299659&r2=1299660&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ParticipantsControllerTest.java
 (original)
+++ 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/ParticipantsControllerTest.java
 Mon Mar 12 13:04:06 2012
@@ -102,7 +102,7 @@ public class ParticipantsControllerTest 
   public void getParticipant_usingIdKey() throws HttpException, IOException {
     HttpClient client = new HttpClient();
     GetMethod get = new GetMethod(TEST_PARTICIPANTS_SERVICE_URL_VALID);
-    get.setQueryString("api_key=" + API_KEY_VALID + "&id_key="
+    get.setQueryString("api_key=" + API_KEY_VALID + "&idkey="
         + instance_id_key);
     client.executeMethod(get);
     int code = get.getStatusCode();

Modified: 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/PropertiesControllerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/PropertiesControllerTest.java?rev=1299660&r1=1299659&r2=1299660&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/PropertiesControllerTest.java
 (original)
+++ 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/PropertiesControllerTest.java
 Mon Mar 12 13:04:06 2012
@@ -23,6 +23,7 @@ import org.apache.commons.httpclient.met
 import org.apache.commons.httpclient.methods.GetMethod;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.PutMethod;
+import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -48,6 +49,17 @@ public class PropertiesControllerTest ex
     assertEquals(201, code);
     post.releaseConnection();
   }
+  
+  @AfterClass
+  public static void tearDown() throws HttpException, IOException{
+    HttpClient client = new HttpClient();
+    DeleteMethod delete;
+    delete = new DeleteMethod(TEST_INSTANCES_SERVICE_URL_VALID);
+    delete.setQueryString("api_key=" + API_KEY_VALID + "&widgetid="
+        + WIDGET_ID_VALID + "&userid=test&shareddatakey=propstest");
+    client.executeMethod(delete);
+    delete.releaseConnection();
+  }
 
   /**
    * Test that we can set preferences using post parameters

Modified: 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetInstancesControllerTest.java
URL: 
http://svn.apache.org/viewvc/incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetInstancesControllerTest.java?rev=1299660&r1=1299659&r2=1299660&view=diff
==============================================================================
--- 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetInstancesControllerTest.java
 (original)
+++ 
incubator/wookie/trunk/src-tests/org/apache/wookie/tests/functional/WidgetInstancesControllerTest.java
 Mon Mar 12 13:04:06 2012
@@ -76,14 +76,36 @@ public class WidgetInstancesControllerTe
     client.executeMethod(post);   
     int code = post.getStatusCode();
     assertEquals(201,code);
-    post.releaseConnection(); 
+    post.releaseConnection();
   }
   
   @AfterClass
   public static void tearDown() throws HttpException, IOException{
     HttpClient client = new HttpClient();
-    setAuthenticationCredentials(client);
-    DeleteMethod delete = new DeleteMethod(TEST_WIDGETS_SERVICE_URL_VALID + 
"/" + WIDGET_ID_LOCALIZED);
+    DeleteMethod delete;
+    
+    // now set auth as admin
+    setAuthenticationCredentials(client);    
+    
+    delete = new DeleteMethod(TEST_INSTANCES_SERVICE_URL_VALID);
+    delete.setQueryString("api_key=" + API_KEY_VALID + "&widgetid="
+        + WIDGET_ID_VALID + "&userid=test&shareddatakey=test");
+    client.executeMethod(delete);
+    delete.releaseConnection();
+    
+    delete = new DeleteMethod(TEST_INSTANCES_SERVICE_URL_VALID);
+    delete.setQueryString("api_key=" + API_KEY_VALID + "&widgetid="
+        + WIDGET_ID_VALID + "&userid=test&shareddatakey=clonetestsrc");
+    client.executeMethod(delete);
+    delete.releaseConnection();    
+    
+    delete = new DeleteMethod(TEST_INSTANCES_SERVICE_URL_VALID);
+    delete.setQueryString("api_key=" + API_KEY_VALID + "&widgetid="
+        + WIDGET_ID_VALID + "&userid=test&shareddatakey=clonetestsync");
+    client.executeMethod(delete);
+    delete.releaseConnection();            
+    
+    delete = new DeleteMethod(TEST_WIDGETS_SERVICE_URL_VALID + "/" + 
WIDGET_ID_LOCALIZED);
     client.executeMethod(delete);
     delete.releaseConnection();
   }
@@ -146,7 +168,7 @@ public class WidgetInstancesControllerTe
   public void getExistingInstanceByIdKey() throws HttpException, IOException {
     HttpClient client = new HttpClient();
     GetMethod get = new GetMethod(TEST_INSTANCES_SERVICE_URL_VALID);
-    get.setQueryString("api_key=" + API_KEY_VALID + "&id_key=" + TEST_ID_KEY);
+    get.setQueryString("api_key=" + API_KEY_VALID + "&idkey=" + TEST_ID_KEY);
     client.executeMethod(get);
     int code = get.getStatusCode();
     assertEquals(200, code);
@@ -420,14 +442,5 @@ public class WidgetInstancesControllerTe
     assertEquals("garfield", resp);
     post.releaseConnection();
   }
-  
-  @Test
-  public void TestDeleteInstance() throws HttpException, IOException {
-    HttpClient client = new HttpClient();
-    setAuthenticationCredentials(client);
-    DeleteMethod delete = new DeleteMethod(TEST_INSTANCES_SERVICE_URL_VALID + 
"?api_key=" + API_KEY_VALID + "&id_key=" + TEST_ID_KEY);
-    client.executeMethod(delete);
-    delete.releaseConnection();      
-  }
 
 }


Reply via email to