use of org.forgerock.openam.rest.RealmContext in project OpenAM by OpenRock.
the class ResourceSetServiceTest method mockContext.
private Context mockContext(String realm) {
RealmContext realmContext = mock(RealmContext.class);
given(realmContext.getResolvedRealm()).willReturn(realm);
return realmContext;
}
use of org.forgerock.openam.rest.RealmContext in project OpenAM by OpenRock.
the class UmaEnabledFilterTest method setup.
@BeforeMethod
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
context = ClientContext.newInternalClientContext(new RealmContext(new RootContext()));
requestHandler = mock(RequestHandler.class);
when(requestHandler.handleAction(any(Context.class), any(ActionRequest.class))).thenReturn(promise(newActionResponse(null)));
when(requestHandler.handleCreate(any(Context.class), any(CreateRequest.class))).thenReturn(promise(newResourceResponse(null, null, null)));
when(requestHandler.handleDelete(any(Context.class), any(DeleteRequest.class))).thenReturn(promise(newResourceResponse(null, null, null)));
when(requestHandler.handlePatch(any(Context.class), any(PatchRequest.class))).thenReturn(promise(newResourceResponse(null, null, null)));
when(requestHandler.handleQuery(any(Context.class), any(QueryRequest.class), any(QueryResourceHandler.class))).thenReturn(promise(newQueryResponse()));
when(requestHandler.handleRead(any(Context.class), any(ReadRequest.class))).thenReturn(promise(newResourceResponse(null, null, null)));
when(requestHandler.handleUpdate(any(Context.class), any(UpdateRequest.class))).thenReturn(promise(newResourceResponse(null, null, null)));
}
use of org.forgerock.openam.rest.RealmContext in project OpenAM by OpenRock.
the class ResourceSetServiceTest method createContext.
private Context createContext() {
RealmContext realmContext = new RealmContext(new RootContext());
realmContext.setDnsAlias("/", "REALM");
return realmContext;
}
use of org.forgerock.openam.rest.RealmContext in project OpenAM by OpenRock.
the class UmaPolicyServiceImplDelegationTest method getContext.
private Context getContext() throws Exception {
SubjectContext subjectContext = mock(SSOTokenContext.class);
SSOToken ssoToken = mock(SSOToken.class);
Principal principal = mock(Principal.class);
given(subjectContext.getCallerSSOToken()).willReturn(ssoToken);
given(ssoToken.getProperty(Constants.UNIVERSAL_IDENTIFIER)).willReturn("id=" + loggedInUserId + ",ou=REALM,dc=forgerock,dc=org");
given(ssoToken.getPrincipal()).willReturn(principal);
given(principal.getName()).willReturn(loggedInUserId);
return ClientContext.newInternalClientContext(new RealmContext(subjectContext));
}
Aggregations