testFile, SlingPostConstants.RP_CONTENT_FILE, null);
// assert content at new location
String content = getContent(importedNodeUrl + ".json", CONTENT_TYPE_JSON);
JSONObject jsonObj = new JSONObject(content);
assertNotNull(jsonObj);
//assert that the versionable node is checked in.
assertFalse(jsonObj.getBoolean("jcr:isCheckedOut"));
//2. try an update with the :autoCheckout value set to false
List<NameValuePair> postParams = new ArrayList<NameValuePair>();
postParams.add(new NameValuePair(SlingPostConstants.RP_OPERATION,
SlingPostConstants.OPERATION_IMPORT));
postParams.add(new NameValuePair(SlingPostConstants.RP_CONTENT_TYPE, "json"));
postParams.add(new NameValuePair(SlingPostConstants.RP_CHECKIN, "true"));
postParams.add(new NameValuePair(SlingPostConstants.RP_REPLACE_PROPERTIES, "true"));
postParams.add(new NameValuePair(SlingPostConstants.RP_AUTO_CHECKOUT, "false"));
postParams.add(new NameValuePair(SlingPostConstants.RP_CONTENT, "{ \"abc\": \"def2\" }"));
assertPostStatus(importedNodeUrl, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, "Expected error from VersionException");
//3. now try an update with the :autoCheckout value set to true
postParams.clear();
postParams.add(new NameValuePair(SlingPostConstants.RP_OPERATION,
SlingPostConstants.OPERATION_IMPORT));
postParams.add(new NameValuePair(SlingPostConstants.RP_CONTENT_TYPE, "json"));
postParams.add(new NameValuePair(SlingPostConstants.RP_CHECKIN, "true"));
postParams.add(new NameValuePair(SlingPostConstants.RP_REPLACE_PROPERTIES, "true"));
postParams.add(new NameValuePair(SlingPostConstants.RP_AUTO_CHECKOUT, "true"));
postParams.add(new NameValuePair(SlingPostConstants.RP_CONTENT, "{ \"abc\": \"def2\" }"));
postParams.add(new NameValuePair(":http-equiv-accept", "application/json,*/*;q=0.9"));
HttpMethod post = assertPostStatus(importedNodeUrl, HttpServletResponse.SC_CREATED, postParams, "Expected 201 status");
String responseBodyAsString = post.getResponseBodyAsString();
JSONObject responseJSON = new JSONObject(responseBodyAsString);
JSONArray changes = responseJSON.getJSONArray("changes");
JSONObject checkoutChange = changes.getJSONObject(0);
assertEquals("checkout", checkoutChange.getString("type"));
// assert content at new location
String content2 = getContent(importedNodeUrl + ".json", CONTENT_TYPE_JSON);
JSONObject jsonObj2 = new JSONObject(content2);
assertNotNull(jsonObj2);
//make sure it was really updated
assertEquals("def2", jsonObj2.getString("abc"));
//assert that the versionable node is checked back in.
assertFalse(jsonObj.getBoolean("jcr:isCheckedOut"));
}