org.eclipse.microprofile.rest.client.spi.RestClientBuilderResolver Java Examples

The following examples show how to use org.eclipse.microprofile.rest.client.spi.RestClientBuilderResolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RestClientBuilder.java    From microprofile-rest-client with Apache License 2.0 5 votes vote down vote up
static RestClientBuilder newBuilder() {
    RestClientBuilder builder = RestClientBuilderResolver.instance().newBuilder();
    AccessController.doPrivileged((PrivilegedAction<Void>)
        () -> {
            for(RestClientBuilderListener listener : ServiceLoader.load(RestClientBuilderListener.class)) {
                listener.onNewBuilder(builder);
            }
            return null;
        }
    );
    return builder;
}
 
Example #2
Source File: RestClientBuilderTest.java    From microprofile-rest-client with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetBuilderFromDynamicallyRegistered() {
    // given
    RestClientBuilderResolver.setInstance(new RestClientBuilder1Resolver());
    // when
    RestClientBuilder builder = RestClientBuilder.newBuilder();
    //then
    assertTrue(builder instanceof BuilderImpl1);
}
 
Example #3
Source File: RestClientRecorder.java    From quarkus with Apache License 2.0 4 votes vote down vote up
public void setRestClientBuilderResolver() {
    RestClientBuilderResolver.setInstance(new BuilderResolver());
}
 
Example #4
Source File: RestClientBuilderTest.java    From microprofile-rest-client with Apache License 2.0 4 votes vote down vote up
@BeforeMethod
public void cleanupResolver() {
    RestClientBuilderResolver.setInstance(null);
}