use of org.talend.sdk.component.junit.http.junit5.HttpApi in project component-runtime by Talend.
the class JUnit5HttpApi method beforeAll.
@Override
public void beforeAll(final ExtensionContext extensionContext) {
final HttpApi config = extensionContext.getElement().map(c -> c.getAnnotation(HttpApi.class)).orElse(null);
if (config != null) {
setGlobalProxyConfiguration(config.globalProxyConfiguration());
setLogLevel(config.logLevel());
setPort(config.port());
newInstance(config.responseLocator(), ResponseLocator.class).ifPresent(this::setResponseLocator);
newInstance(config.headerFilter(), Predicate.class).ifPresent(this::setHeaderFilter);
newInstance(config.executor(), Executor.class).ifPresent(this::setExecutor);
newInstance(config.sslContext(), Supplier.class).map(s -> SSLContext.class.cast(s.get())).ifPresent(this::setSslContext);
setSkipProxyHeaders(config.skipProxyHeaders());
if (config.useSsl()) {
activeSsl();
}
}
extensionContext.getStore(NAMESPACE).put(HttpApiHandler.class.getName(), this);
final HandlerImpl<JUnit5HttpApi> handler = new HandlerImpl<>(this, null, null);
extensionContext.getStore(NAMESPACE).put(HandlerImpl.class.getName(), handler);
handler.start();
}
Aggregations