Search in sources :

Example 1 with UmaClientFactory

use of io.jans.as.client.uma.UmaClientFactory in project jans by JanssenProject.

the class OpClientFactoryMockImpl method createUmaClientFactory.

public synchronized UmaClientFactory createUmaClientFactory() {
    Optional<UmaClientFactory> umaClientFactoryOpt = Optional.ofNullable((UmaClientFactory) opClientCache.getIfPresent("umaClientFactory"));
    Optional<UmaMetadataService> umaMetadataServiceOpt = Optional.ofNullable((UmaMetadataService) opClientCache.getIfPresent("UmaMetadataService"));
    UmaClientFactory umaClientFactory = null;
    if (!umaClientFactoryOpt.isPresent() || !umaMetadataServiceOpt.isPresent()) {
        umaClientFactory = mock(UmaClientFactory.class);
        UmaMetadataService umaMetadataService = mock(UmaMetadataService.class);
        UmaMetadata umaMetadata = new UmaMetadata();
        when(umaClientFactory.createMetadataService(any(), any())).thenReturn(umaMetadataService);
        when(umaMetadataService.getMetadata()).thenReturn(umaMetadata);
        opClientCache.put("umaClientFactory", umaClientFactory);
        opClientCache.put("UmaMetadataService", umaMetadataService);
    } else {
        umaClientFactory = (UmaClientFactory) opClientCache.getIfPresent("umaClientFactory");
    }
    return umaClientFactory;
}
Also used : UmaMetadata(io.jans.as.model.uma.UmaMetadata) UmaMetadataService(io.jans.as.client.uma.UmaMetadataService) UmaClientFactory(io.jans.as.client.uma.UmaClientFactory)

Aggregations

UmaClientFactory (io.jans.as.client.uma.UmaClientFactory)1 UmaMetadataService (io.jans.as.client.uma.UmaMetadataService)1 UmaMetadata (io.jans.as.model.uma.UmaMetadata)1