SLING-1208 As of Jackrabbit 1.6 the protected properties of the repository reflection of users and groups are not returned as Authorizable properties any more. Therefore the rep:principalName property which is checked in the integration test does not exist any longer.
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@886156 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/userManager/CreateGroupTest.java b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/userManager/CreateGroupTest.java
index 3075211..b0b817d 100644
--- a/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/userManager/CreateGroupTest.java
+++ b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/userManager/CreateGroupTest.java
@@ -34,7 +34,7 @@
public class CreateGroupTest extends AbstractUserManagerTest {
String testGroupId = null;
-
+
@Override
protected void tearDown() throws Exception {
if (testGroupId != null) {
@@ -53,15 +53,16 @@
testGroupId = "testGroup" + (counter++);
List<NameValuePair> postParams = new ArrayList<NameValuePair>();
postParams.add(new NameValuePair(":name", testGroupId));
+ postParams.add(new NameValuePair("marker", testGroupId));
assertAuthenticatedAdminPostStatus(postUrl, HttpServletResponse.SC_OK, postParams, null);
-
+
//fetch the group profile json to verify the settings
String getUrl = HTTP_BASE_URL + "/system/userManager/group/" + testGroupId + ".json";
Credentials creds = new UsernamePasswordCredentials("admin", "admin");
String json = getAuthenticatedContent(creds, getUrl, CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
assertNotNull(json);
JSONObject jsonObj = new JSONObject(json);
- assertEquals(testGroupId, jsonObj.getString("rep:principalName"));
+ assertEquals(testGroupId, jsonObj.getString("marker"));
}
public void testCreateGroupMissingGroupId() throws IOException {
@@ -78,17 +79,18 @@
List<NameValuePair> postParams = new ArrayList<NameValuePair>();
postParams.add(new NameValuePair(":name", testGroupId));
assertAuthenticatedAdminPostStatus(postUrl, HttpServletResponse.SC_OK, postParams, null);
-
+
//post the same info again, should fail
assertAuthenticatedAdminPostStatus(postUrl, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, null);
}
-
+
public void testCreateGroupWithExtraProperties() throws IOException, JSONException {
String postUrl = HTTP_BASE_URL + "/system/userManager/group.create.html";
testGroupId = "testGroup" + (counter++);
List<NameValuePair> postParams = new ArrayList<NameValuePair>();
postParams.add(new NameValuePair(":name", testGroupId));
+ postParams.add(new NameValuePair("marker", testGroupId));
postParams.add(new NameValuePair("displayName", "My Test Group"));
postParams.add(new NameValuePair("url", "http://www.apache.org"));
assertAuthenticatedAdminPostStatus(postUrl, HttpServletResponse.SC_OK, postParams, null);
@@ -99,8 +101,8 @@
String json = getAuthenticatedContent(creds, getUrl, CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
assertNotNull(json);
JSONObject jsonObj = new JSONObject(json);
- assertEquals(testGroupId, jsonObj.getString("rep:principalName"));
+ assertEquals(testGroupId, jsonObj.getString("marker"));
assertEquals("My Test Group", jsonObj.getString("displayName"));
assertEquals("http://www.apache.org", jsonObj.getString("url"));
- }
+ }
}
diff --git a/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/userManager/CreateUserTest.java b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/userManager/CreateUserTest.java
index 2fcdc93..6ed42cd 100644
--- a/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/userManager/CreateUserTest.java
+++ b/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/userManager/CreateUserTest.java
@@ -34,7 +34,7 @@
public class CreateUserTest extends AbstractUserManagerTest {
String testUserId = null;
-
+
@Override
protected void tearDown() throws Exception {
if (testUserId != null) {
@@ -56,21 +56,22 @@
*/
public void testCreateUser() throws IOException, JSONException {
String postUrl = HTTP_BASE_URL + "/system/userManager/user.create.html";
-
+
testUserId = "testUser" + (counter++);
List<NameValuePair> postParams = new ArrayList<NameValuePair>();
postParams.add(new NameValuePair(":name", testUserId));
+ postParams.add(new NameValuePair("marker", testUserId));
postParams.add(new NameValuePair("pwd", "testPwd"));
postParams.add(new NameValuePair("pwdConfirm", "testPwd"));
assertPostStatus(postUrl, HttpServletResponse.SC_OK, postParams, null);
-
+
//fetch the user profile json to verify the settings
String getUrl = HTTP_BASE_URL + "/system/userManager/user/" + testUserId + ".json";
Credentials creds = new UsernamePasswordCredentials("admin", "admin");
String json = getAuthenticatedContent(creds, getUrl, CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
assertNotNull(json);
JSONObject jsonObj = new JSONObject(json);
- assertEquals(testUserId, jsonObj.getString("rep:principalName"));
+ assertEquals(testUserId, jsonObj.getString("marker"));
assertFalse(jsonObj.has(":name"));
assertFalse(jsonObj.has("pwd"));
assertFalse(jsonObj.has("pwdConfirm"));
@@ -112,11 +113,11 @@
postParams.add(new NameValuePair("pwd", "testPwd"));
postParams.add(new NameValuePair("pwdConfirm", "testPwd"));
assertPostStatus(postUrl, HttpServletResponse.SC_OK, postParams, null);
-
+
//post the same info again, should fail
assertPostStatus(postUrl, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, postParams, null);
}
-
+
/*
<form action="/system/userManager/user.create.html" method="POST">
<div>Name: <input type="text" name=":name" value="testUser" /></div>
@@ -133,6 +134,7 @@
testUserId = "testUser" + (counter++);
List<NameValuePair> postParams = new ArrayList<NameValuePair>();
postParams.add(new NameValuePair(":name", testUserId));
+ postParams.add(new NameValuePair("marker", testUserId));
postParams.add(new NameValuePair("pwd", "testPwd"));
postParams.add(new NameValuePair("pwdConfirm", "testPwd"));
postParams.add(new NameValuePair("displayName", "My Test User"));
@@ -145,11 +147,11 @@
String json = getAuthenticatedContent(creds, getUrl, CONTENT_TYPE_JSON, null, HttpServletResponse.SC_OK);
assertNotNull(json);
JSONObject jsonObj = new JSONObject(json);
- assertEquals(testUserId, jsonObj.getString("rep:principalName"));
+ assertEquals(testUserId, jsonObj.getString("marker"));
assertEquals("My Test User", jsonObj.getString("displayName"));
assertEquals("http://www.apache.org", jsonObj.getString("url"));
assertFalse(jsonObj.has(":name"));
assertFalse(jsonObj.has("pwd"));
assertFalse(jsonObj.has("pwdConfirm"));
- }
+ }
}