model.authorizationControl = AuthorizationControl.AUTHENTICATED;\r
\r
// create\r
+ RpcUtils.deleteRepository(model, url, account, password.toCharArray());\r
assertTrue("Failed to create repository!",\r
RpcUtils.createRepository(model, url, account, password.toCharArray()));\r
\r
// rename and change access restriciton\r
String originalName = model.name;\r
model.name = "garbagerepo2.git";\r
- model.accessRestriction = AccessRestrictionType.PUSH;\r
+ model.accessRestriction = AccessRestrictionType.CLONE;\r
model.authorizationControl = AuthorizationControl.NAMED;\r
+ RpcUtils.deleteRepository(model, url, account, password.toCharArray());\r
assertTrue("Failed to update repository!", RpcUtils.updateRepository(originalName, model,\r
url, account, password.toCharArray()));\r
\r
retrievedRepository = findRepository(model.name);\r
assertNotNull("Failed to find " + model.name, retrievedRepository);\r
assertTrue("Access retriction type is wrong",\r
- AccessRestrictionType.PUSH.equals(retrievedRepository.accessRestriction));\r
+ AccessRestrictionType.CLONE.equals(retrievedRepository.accessRestriction));\r
\r
+ // restore VIEW restriction\r
+ retrievedRepository.accessRestriction = AccessRestrictionType.VIEW;\r
+ assertTrue("Failed to update repository!", RpcUtils.updateRepository(retrievedRepository.name, retrievedRepository,\r
+ url, account, password.toCharArray()));\r
+ retrievedRepository = findRepository(retrievedRepository.name);\r
+ \r
// memberships\r
UserModel testMember = new UserModel("justadded");\r
assertTrue(RpcUtils.createUser(testMember, url, account, password.toCharArray()));\r
\r
List<RegistrantAccessPermission> permissions = RpcUtils.getRepositoryMemberPermissions(retrievedRepository, url, account,\r
password.toCharArray());\r
- assertEquals("Membership permissions is not empty!", 0, permissions.size());\r
- permissions.add(new RegistrantAccessPermission(testMember.username, AccessPermission.PUSH, PermissionType.EXPLICIT, RegistrantType.USER, null, true));\r
+ assertEquals("Unexpected permissions! " + permissions.toString(), 1, permissions.size());\r
+ permissions.add(new RegistrantAccessPermission(testMember.username, AccessPermission.VIEW, PermissionType.EXPLICIT, RegistrantType.USER, null, true));\r
assertTrue(\r
"Failed to set member permissions!",\r
RpcUtils.setRepositoryMemberPermissions(retrievedRepository, permissions, url, account,\r
for (RegistrantAccessPermission permission : permissions) {\r
if (permission.registrant.equalsIgnoreCase(testMember.username)) {\r
foundMember = true;\r
- assertEquals(AccessPermission.PUSH, permission.permission);\r
+ assertEquals(AccessPermission.VIEW, permission.permission);\r
break;\r
}\r
}\r