Skip to content

Commit

Permalink
Added punctuation to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
BojithaPiyathilake committed Jul 7, 2022
1 parent 9b2f31e commit 0ee56a7
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -555,44 +555,44 @@ public void test194GetUserListWithIDCondition() throws UserStoreException {

public void test194GetUserListWithIDConditionCursor() throws Exception {

// Current user list admin, user1WithID, user2, user2WithID, user3, user3WithID, user4, user4WithID
// Current user list admin, user1WithID, user2, user2WithID, user3, user3WithID, user4, user4WithID.

// userName sw use
// userName sw use.
ExpressionCondition expressionCondition = new ExpressionCondition(ExpressionOperation.SW.toString(),
ExpressionAttribute.USERNAME.toString(), "use");
ExpressionCondition noConditions = new ExpressionCondition(ExpressionOperation.SW.toString(),
ExpressionAttribute.USERNAME.toString(), "");

//Making a List of expressionConditions for multi-attribute filtering
// userName co WithID
//Making a List of expressionConditions for multi-attribute filtering.
// userName co WithID.
ExpressionCondition expressionCondition2 = new ExpressionCondition(ExpressionOperation.CO.toString(),
ExpressionAttribute.USERNAME.toString(), "WithID");
// userName sw use and userName co WithID
// userName sw use and userName co WithID.
OperationalCondition multiFiltering =
new OperationalCondition("AND", expressionCondition, expressionCondition2);

// No filtering
// No filtering.
assertEquals(8, admin.getUserListWithID(noConditions, null, null, 10, "", "NEXT", null, null).size());

// Single userName filtering initial query (no cursor)
// Single userName filtering initial query (no cursor).
assertEquals(7, admin.getUserListWithID(expressionCondition, null, null, 10, "", "NEXT", null, null).size());

// Single userName filtering - Forwards cursor pagination
// Single userName filtering - Forwards cursor pagination.
assertEquals(4, admin.getUserListWithID(expressionCondition, null, null, 10, "user2WithID", "NEXT", null, null)
.size());

// Single userName filtering - Backwards cursor pagination
// Single userName filtering - Backwards cursor pagination.
assertEquals(2, admin.getUserListWithID(expressionCondition, null, null, 10, "user2WithID", "PREVIOUS",
null, null).size());

// Multiple filter conditions with userName attribute - Forwards cursor pagination
// Multiple filter conditions with userName attribute - Forwards cursor pagination.
assertEquals(4, admin.getUserListWithID(multiFiltering, null, null, 10, "", "NEXT", null, null).size());

// Multiple filter conditions with userName attribute - Backwards cursor pagination
// Multiple filter conditions with userName attribute - Backwards cursor pagination.
assertEquals(1, admin.getUserListWithID(multiFiltering, null, null, 10, "user2WithID", "PREVIOUS", null, null)
.size());

// Setup for claim filtering
// Setup for claim filtering.
Map<String, String> claims = new HashMap<>();
claims.put(ClaimTestUtil.CLAIM_URI1, "Alucard");
claims.put(ClaimTestUtil.CLAIM_URI6, "Tepes, Alucard");
Expand All @@ -611,98 +611,109 @@ public void test194GetUserListWithIDConditionCursor() throws Exception {
admin.addUser("Annie", "pass100", null, claims, null, false);

// New user list: admin, Akira, Alphonse, Alucard, Annie, user1WithID, user2, user2WithID, user3, user3WithID,
// user4, user4WithID
// Having claims: Akira, Alphonse, Alucard, Annie
// user4, user4WithID.
// Having claims: Akira, Alphonse, Alucard, Annie.

// givenname sw A
// givenname sw A.
ExpressionCondition claimFiltering1 = new ExpressionCondition(ExpressionOperation.SW.toString(), "attr1", "A");
// fullname sw T
// fullname sw T.
ExpressionCondition claimFiltering2 = new ExpressionCondition(ExpressionOperation.SW.toString(), "fullname",
"T");
// givenname sw A and fullname sw T
// givenname sw A and fullname sw T.
OperationalCondition multiClaimFiltering = new OperationalCondition("AND", claimFiltering1, claimFiltering2);

// Single claim filtering forward cursor pagination
// Single claim filtering forward cursor pagination.
assertEquals(4, admin.getUserListWithID(claimFiltering1, null, null, 10, "", "NEXT", null, null).size());

// Single claim filtering backwards cursor pagination
// Single claim filtering backwards cursor pagination.
assertEquals(2, admin.getUserListWithID(claimFiltering1, null, null, 10, "Alucard", "PREVIOUS", null, null)
.size());

// Multi claim filtering forwards cursor pagination
// Multi claim filtering forwards cursor pagination.
assertEquals(2, admin.getUserListWithID(multiClaimFiltering, null, null, 10, "", "NEXT", null, null).size());

// Multi claim filtering backwards cursor pagination
// Multi claim filtering backwards cursor pagination.
assertEquals(1, admin.getUserListWithID(multiClaimFiltering, null, null, 10, "Alucard", "PREVIOUS", null, null)
.size());

// Role configuration for group filtering
// Role configuration for group filtering.

// admin.addUser("user1", "pass1", new String[]{"role1"}, null, null, false);
admin.addRole("Manager", new String[]{"Alucard", "Akira", "Alphonse", "Annie", "user2", "user2WithID", "user3",
"user3WithID"}, null);
admin.addRole("HeadManager", new String[]{"Alucard", "Akira", "Alphonse", "Annie", "user2", "user2WithID",
"user3", "user4"}, null);
// New role list: admin, Internal/everyone, role1WithID, role3, role4, Manager, HeadManager
// New role list: admin, Internal/everyone, role1WithID, role3, role4, Manager, HeadManager.

// groups eq Manager
// groups eq Manager.
ExpressionCondition groupFiltering = new ExpressionCondition(ExpressionOperation.EQ.toString(),
ExpressionAttribute.ROLE.toString(), "Manager");
// group eq HeadManager
// group eq HeadManager.
ExpressionCondition groupFiltering2 = new ExpressionCondition(ExpressionOperation.EQ.toString(),
ExpressionAttribute.ROLE.toString(), "HeadManager");
// groups eq Manager and groups eq HeadManager
// groups eq Manager and groups eq HeadManager.
OperationalCondition multiGroupFiltering = new OperationalCondition("AND", groupFiltering, groupFiltering2);

// Group Filtering forwards cursor pagination
// Group Filtering forwards cursor pagination.
assertEquals(3, admin.getUserListWithID(groupFiltering, null, null, 10, "user2", "NEXT", null, null).size());

// Group Filtering backwards cursor pagination
// Group Filtering backwards cursor pagination.
assertEquals(6, admin.getUserListWithID(groupFiltering, null, null, 10, "user3", "PREVIOUS", null, null)
.size());

// Multi-group filtering forwards cursor pagination
// Multi-group filtering forwards cursor pagination.
assertEquals(2, admin.getUserListWithID(multiGroupFiltering, null, null, 10, "user2", "NEXT", null, null)
.size());

// Multi-group filtering backwards cursor pagination
// Multi-group filtering backwards cursor pagination.
assertEquals(3, admin.getUserListWithID(multiGroupFiltering, null, null, 10, "Annie", "PREVIOUS", null, null)
.size());

// groups eq Manager and groups eq HeadManager and userName sw use
// groups eq Manager and groups eq HeadManager and userName sw use.
OperationalCondition groupAndUserNameFilter =
new OperationalCondition("AND", multiGroupFiltering, expressionCondition);

// Multi-group filtering and userName filtering forward cursor pagination
// Multi-group filtering and userName filtering forward cursor pagination.
assertEquals(3, admin.getUserListWithID(groupAndUserNameFilter, null, null, 10, "", "NEXT", null, null).size());

// Multi-group filtering and userName filtering backwards cursor pagination
// Multi-group filtering and userName filtering backwards cursor pagination.
assertEquals(1, admin.getUserListWithID(groupAndUserNameFilter, null, null, 10, "user2WithID", "PREVIOUS",
null, null).size());

// givenname sw A and groups eq Manager
// givenname sw A and groups eq Manager.
OperationalCondition singleClaimAndGroupFilter =
new OperationalCondition("AND", claimFiltering1, groupFiltering);
// givenname sw A and groups eq Manager and groups eq HeadManager
// givenname sw A and groups eq Manager and groups eq HeadManager.
OperationalCondition singleClaimAndMultiGroupFilter =
new OperationalCondition("AND", claimFiltering1, multiGroupFiltering);
// givenname sw A and fullname sw T and groups eq Manager and groups eq HeadManager
// givenname sw A and fullname sw T and groups eq Manager and groups eq HeadManager.
OperationalCondition multiGroupAndMultiClaimFilter =
new OperationalCondition("AND", multiClaimFiltering, multiGroupFiltering);

// Having claims + In the manager and HeadManager groups: Akira, Alphonse, Alucard, Annie
// Having claims + In the manager and HeadManager groups: Akira, Alphonse, Alucard, Annie.

// Single group and claim filtering forward cursor pagination
// Single group and claim filtering forward cursor pagination.
assertEquals(3, admin.getUserListWithID(singleClaimAndGroupFilter, null, null, 10, "Akira", "NEXT", null, null)
.size());

// Multi-group filtering and single claim filtering forward cursor pagination
// Single group and claim filtering backward cursor pagination.
assertEquals(0, admin.getUserListWithID(singleClaimAndGroupFilter, null, null, 10, "Akira", "PREVIOUS", null,
null).size());

// Multi-group filtering and single claim filtering forward cursor pagination.
assertEquals(4, admin.getUserListWithID(singleClaimAndMultiGroupFilter, null, null, 10, "", "NEXT", null, null)
.size());

// Multi-group filtering and multi-claim filtering forward cursor pagination
// Multi-group filtering and single claim filtering backward cursor pagination.
assertEquals(3, admin.getUserListWithID(singleClaimAndMultiGroupFilter, null, null, 10, "Annie", "PREVIOUS", null,
null).size());

// Multi-group filtering and multi-claim filtering forward cursor pagination.
assertEquals(1, admin.getUserListWithID(multiGroupAndMultiClaimFilter, null, null, 10, "Akira", "NEXT",
null, null).size());

// Multi-group filtering and multi-claim filtering backward cursor pagination.
assertEquals(1, admin.getUserListWithID(multiGroupAndMultiClaimFilter, null, null, 10, "Alucard", "PREVIOUS",
null, null).size());
}

public void test195GetRoleListOfUserWithID() throws UserStoreException {
Expand Down
Loading

0 comments on commit 0ee56a7

Please sign in to comment.