use of io.jans.ca.server.introspection.CorrectRptIntrospectionService in project jans by JanssenProject.
the class OpClientFactoryMockImpl method createClientFactory.
public synchronized ClientFactory createClientFactory() {
Optional<ClientFactory> clientFactoryOpt = Optional.ofNullable((ClientFactory) opClientCache.getIfPresent("ClientFactory"));
Optional<CorrectRptIntrospectionService> correctRptIntrospectionServiceOpt = Optional.ofNullable((CorrectRptIntrospectionService) opClientCache.getIfPresent("CorrectRptIntrospectionService"));
ClientFactory clientFactory = null;
if (!clientFactoryOpt.isPresent() || !correctRptIntrospectionServiceOpt.isPresent()) {
clientFactory = mock(ClientFactory.class);
CorrectRptIntrospectionService correctRptIntrospectionService = mock(CorrectRptIntrospectionService.class);
when(clientFactory.createCorrectRptStatusService(any(), any())).thenReturn(correctRptIntrospectionService);
CorrectRptIntrospectionResponse correctRptIntrospectionResponse = new CorrectRptIntrospectionResponse();
correctRptIntrospectionResponse.setActive(true);
correctRptIntrospectionResponse.setClientId("d457e3de-30dd-400a-8698-2b98472b7a40");
correctRptIntrospectionResponse.setIssuedAt((int) (System.currentTimeMillis() / 1000));
correctRptIntrospectionResponse.setExpiresAt((int) (System.currentTimeMillis() / 1000));
when(correctRptIntrospectionService.requestRptStatus(any(), any(), any())).thenReturn(correctRptIntrospectionResponse);
opClientCache.put("ClientFactory", clientFactory);
opClientCache.put("CorrectRptIntrospectionService", correctRptIntrospectionService);
} else {
clientFactory = (ClientFactory) opClientCache.getIfPresent("ClientFactory");
}
return clientFactory;
}
Aggregations