Author: scottbw
Date: Fri Mar 7 14:48:41 2014
New Revision: 1575278
URL: http://svn.apache.org/r1575278
Log:
Updated test for cloning widget instances taking account changes to Properties
API
Modified:
wookie/trunk/wookie-server/src/test/java/org/apache/wookie/tests/functional/WidgetInstancesControllerTest.java
Modified:
wookie/trunk/wookie-server/src/test/java/org/apache/wookie/tests/functional/WidgetInstancesControllerTest.java
URL:
http://svn.apache.org/viewvc/wookie/trunk/wookie-server/src/test/java/org/apache/wookie/tests/functional/WidgetInstancesControllerTest.java?rev=1575278&r1=1575277&r2=1575278&view=diff
==============================================================================
---
wookie/trunk/wookie-server/src/test/java/org/apache/wookie/tests/functional/WidgetInstancesControllerTest.java
(original)
+++
wookie/trunk/wookie-server/src/test/java/org/apache/wookie/tests/functional/WidgetInstancesControllerTest.java
Fri Mar 7 14:48:41 2014
@@ -23,10 +23,14 @@ import java.io.File;
import java.io.IOException;
import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.httpclient.methods.multipart.FilePart;
import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
import org.apache.commons.httpclient.methods.multipart.Part;
import org.apache.wookie.tests.helpers.Request;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
@@ -351,9 +355,10 @@ public class WidgetInstancesControllerTe
*
* @throws IOException
* @throws HttpException
+ * @throws JSONException
*/
@Test
- public void cloneSharedData() throws HttpException, IOException {
+ public void cloneSharedData() throws HttpException, IOException,
JSONException {
//
// Create an instance using POST
//
@@ -374,9 +379,17 @@ public class WidgetInstancesControllerTe
post.addParameter("widgetid", WIDGET_ID_VALID);
post.addParameter("userid", "test");
post.addParameter("shareddatakey", "clonetestsrc");
- post.addParameter("propertyname", "cat");
- post.addParameter("propertyvalue", "garfield");
- post.addParameter("is_public", "true");
+
+ JSONObject data = new JSONObject();
+ data.put("name", "cat");
+ data.put("value", "garfield");
+ JSONObject json = new JSONObject();
+ JSONArray set = new JSONArray();
+ set.put(data);
+ json.put("shareddata", set);
+ StringRequestEntity entity = new
StringRequestEntity(json.toString(), "application/json", "UTF-8");
+ post.setRequestEntity(entity);
+
post.execute(true, false);
code = post.getStatusCode();
assertEquals(201, code);