Search in sources :

Example 1 with UmaMetadataService

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);
}
Also used : UmaMetadata(io.jans.as.model.uma.UmaMetadata) ClientErrorException(javax.ws.rs.ClientErrorException) UmaMetadataService(io.jans.as.client.uma.UmaMetadataService) Parameters(org.testng.annotations.Parameters) BaseTest(io.jans.as.client.BaseTest) Test(org.testng.annotations.Test)

Example 2 with UmaMetadataService

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;
}
Also used : UmaMetadata(io.jans.as.model.uma.UmaMetadata) UmaMetadataService(io.jans.as.client.uma.UmaMetadataService) UmaClientFactory(io.jans.as.client.uma.UmaClientFactory)

Aggregations

UmaMetadataService (io.jans.as.client.uma.UmaMetadataService)2 UmaMetadata (io.jans.as.model.uma.UmaMetadata)2 BaseTest (io.jans.as.client.BaseTest)1 UmaClientFactory (io.jans.as.client.uma.UmaClientFactory)1 ClientErrorException (javax.ws.rs.ClientErrorException)1 Parameters (org.testng.annotations.Parameters)1 Test (org.testng.annotations.Test)1