Search in sources :

Example 1 with CorrectRptIntrospectionService

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;
}
Also used : CorrectRptIntrospectionResponse(io.jans.ca.common.introspection.CorrectRptIntrospectionResponse) UmaClientFactory(io.jans.as.client.uma.UmaClientFactory) OpClientFactory(io.jans.ca.server.op.OpClientFactory) ClientFactory(io.jans.ca.server.introspection.ClientFactory) CorrectRptIntrospectionService(io.jans.ca.server.introspection.CorrectRptIntrospectionService)

Aggregations

UmaClientFactory (io.jans.as.client.uma.UmaClientFactory)1 CorrectRptIntrospectionResponse (io.jans.ca.common.introspection.CorrectRptIntrospectionResponse)1 ClientFactory (io.jans.ca.server.introspection.ClientFactory)1 CorrectRptIntrospectionService (io.jans.ca.server.introspection.CorrectRptIntrospectionService)1 OpClientFactory (io.jans.ca.server.op.OpClientFactory)1