use of org.forgerock.json.JsonPointer in project OpenAM by OpenRock.
the class PrivilegePolicyStoreTest method shouldHandleStringEquality.
@Test
public void shouldHandleStringEquality() throws Exception {
// Given
String value = "testValue";
QueryRequest request = mockQueryRequest(QueryFilter.equalTo(new JsonPointer(STRING_ATTRIBUTE), value));
// When
testStore.query(request);
// Then
verify(mockManager).search(singleton(new SearchFilter(STRING_SEARCH_ATTRIBUTE, value)));
}
use of org.forgerock.json.JsonPointer in project OpenAM by OpenRock.
the class PrivilegePolicyStoreTest method shouldRejectPresenceQueries.
@Test(expectedExceptions = EntitlementException.class, expectedExceptionsMessageRegExp = ".*not supported.*")
public void shouldRejectPresenceQueries() throws Exception {
// Given
QueryRequest request = mockQueryRequest(QueryFilter.present(new JsonPointer((STRING_ATTRIBUTE))));
// When
testStore.query(request);
// Then - exception
}
use of org.forgerock.json.JsonPointer in project OpenAM by OpenRock.
the class ApplicationsResourceTest method shouldRejectOrQueries.
@Test(expectedExceptions = EntitlementException.class, expectedExceptionsMessageRegExp = ".*'Or' not supported.*")
public void shouldRejectOrQueries() throws Exception {
// Given
QueryRequest request = mockQueryRequest(or(QueryFilter.<JsonPointer>alwaysTrue(), QueryFilter.<JsonPointer>alwaysTrue()));
Subject subject = new Subject();
// When
applicationsResource.query(request, subject, "/abc");
// Then - exception
}
use of org.forgerock.json.JsonPointer in project OpenAM by OpenRock.
the class ApplicationsResourceTest method shouldRejectUnsupportedQueryOperators.
@Test(dataProvider = "UnsupportedOperators", expectedExceptions = EntitlementException.class, expectedExceptionsMessageRegExp = ".*not supported.*")
public void shouldRejectUnsupportedQueryOperators(String queryOperator) throws Exception {
// Given
QueryRequest request = mockQueryRequest(comparisonFilter(new JsonPointer(NUMERIC_ATTRIBUTE), queryOperator, 123l));
Subject subject = new Subject();
// When
applicationsResource.query(request, subject, "/abc");
// Then - exception
}
use of org.forgerock.json.JsonPointer in project OpenAM by OpenRock.
the class ApplicationsResourceTest method shouldHandleAndQueries.
@Test
public void shouldHandleAndQueries() throws Exception {
// Given
String value1 = "value1";
String value2 = "value2";
QueryRequest request = mockQueryRequest(and(equalTo(new JsonPointer(STRING_ATTRIBUTE), value1), equalTo(new JsonPointer(STRING_ATTRIBUTE), value2)));
Subject subject = new Subject();
// When
applicationsResource.query(request, subject, "/abc");
// Then
SearchFilter searchFilter1 = new SearchFilter(new SearchAttribute(STRING_ATTRIBUTE, "ou"), value1);
SearchFilter searchFilter2 = new SearchFilter(new SearchAttribute(STRING_ATTRIBUTE, "ou"), value2);
verify(applicationManagerWrapper).search(eq(subject), eq("/abc"), eq(asSet(searchFilter1, searchFilter2)));
}
Aggregations