use of io.cdap.cdap.gateway.handlers.ArtifactHttpHandlerInternal in project cdap by caskdata.
the class RemoteConfiguratorTest method init.
@BeforeClass
public static void init() throws Exception {
cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
cConf.setInt(Constants.TaskWorker.CONTAINER_KILL_AFTER_REQUEST_COUNT, 0);
InMemoryDiscoveryService discoveryService = new InMemoryDiscoveryService();
MasterEnvironments.setMasterEnvironment(new TestMasterEnvironment(discoveryService));
NamespaceAdmin namespaceAdmin = new InMemoryNamespaceAdmin();
namespaceAdmin.create(NamespaceMeta.SYSTEM);
namespaceAdmin.create(NamespaceMeta.DEFAULT);
remoteClientFactory = new RemoteClientFactory(discoveryService, new DefaultInternalAuthenticator(new AuthenticationTestContext()));
httpService = new CommonNettyHttpServiceBuilder(cConf, "test").setHttpHandlers(new TaskWorkerHttpHandlerInternal(cConf, className -> {
}, new NoOpMetricsCollectionService()), new ArtifactHttpHandlerInternal(new TestArtifactRepository(cConf), namespaceAdmin), new ArtifactLocalizerHttpHandlerInternal(new ArtifactLocalizer(cConf, remoteClientFactory, ((namespaceId, retryStrategy) -> {
return new NoOpArtifactManager();
})))).setPort(cConf.getInt(Constants.ArtifactLocalizer.PORT)).setChannelPipelineModifier(new ChannelPipelineModifier() {
@Override
public void modify(ChannelPipeline pipeline) {
pipeline.addAfter("compressor", "decompressor", new HttpContentDecompressor());
}
}).build();
httpService.start();
discoveryService.register(URIScheme.createDiscoverable(Constants.Service.TASK_WORKER, httpService));
discoveryService.register(URIScheme.createDiscoverable(Constants.Service.APP_FABRIC_HTTP, httpService));
metricsCollectionService = new NoOpMetricsCollectionService();
}
Aggregations