use of io.jans.as.client.uma.UmaMetadataService in project jans by JanssenProject.
the class MetaDataFlowHttpTest method testGetUmaMetaDataConfiguration.
/**
* Test for getting meta data configuration
*/
@Test
@Parameters({ "umaMetaDataUrl" })
public void testGetUmaMetaDataConfiguration(final String umaMetaDataUrl) throws Exception {
showTitle("testGetUmaMetaDataConfiguration");
UmaMetadataService metaDataConfigurationService = UmaClientFactory.instance().createMetadataService(umaMetaDataUrl, clientEngine(true));
// Get meta data
UmaMetadata c = null;
try {
c = metaDataConfigurationService.getMetadata();
} catch (ClientErrorException ex) {
System.err.println(ex.getResponse().readEntity(String.class));
throw ex;
}
UmaTestUtil.assertIt(c);
}
use of io.jans.as.client.uma.UmaMetadataService 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;
}
Aggregations