use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class DistributedLogFrameworkTest method init.
@BeforeClass
public static void init() {
CConfiguration cConf = KAFKA_TESTER.getCConf();
KAFKA_TESTER.createTopic(cConf.get(Constants.Logging.KAFKA_TOPIC), cConf.getInt(Constants.Logging.NUM_PARTITIONS));
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class DatasetBasedTimeScheduleStoreTest method schedulerSetup.
private static void schedulerSetup(boolean enablePersistence) throws SchedulerException {
JobStore js;
if (enablePersistence) {
CConfiguration conf = injector.getInstance(CConfiguration.class);
js = new DatasetBasedTimeScheduleStore(factory, new ScheduleStoreTableUtil(dsFramework, conf), conf);
} else {
js = new RAMJobStore();
}
SimpleThreadPool threadPool = new SimpleThreadPool(10, Thread.NORM_PRIORITY);
threadPool.initialize();
DirectSchedulerFactory.getInstance().createScheduler(DUMMY_SCHEDULER_NAME, "1", threadPool, js);
scheduler = DirectSchedulerFactory.getInstance().getScheduler(DUMMY_SCHEDULER_NAME);
scheduler.start();
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class AppFabricServerTest method testSSL.
@Test
public void testSSL() throws IOException {
CConfiguration cConf = CConfiguration.create();
cConf.setBoolean(Constants.Security.SSL.INTERNAL_ENABLED, true);
cConf.setInt(Constants.AppFabric.SERVER_SSL_PORT, 20443);
SConfiguration sConf = SConfiguration.create();
final Injector injector = AppFabricTestHelper.getInjector(cConf, sConf, new AbstractModule() {
@Override
protected void configure() {
// no overrides
}
});
final DiscoveryServiceClient discoveryServiceClient = injector.getInstance(DiscoveryServiceClient.class);
AppFabricServer appFabricServer = injector.getInstance(AppFabricServer.class);
appFabricServer.startAndWait();
Assert.assertTrue(appFabricServer.isRunning());
Supplier<EndpointStrategy> endpointStrategySupplier = Suppliers.memoize(new Supplier<EndpointStrategy>() {
@Override
public EndpointStrategy get() {
return new RandomEndpointStrategy(discoveryServiceClient.discover(Constants.Service.APP_FABRIC_HTTP));
}
});
Discoverable discoverable = endpointStrategySupplier.get().pick(3, TimeUnit.SECONDS);
Assert.assertNotNull(discoverable);
Assert.assertArrayEquals(Constants.Security.SSL_URI_SCHEME.getBytes(), discoverable.getPayload());
InetSocketAddress addr = discoverable.getSocketAddress();
// Since the server uses a self signed certificate we need a client that trusts all certificates
SSLSocket socket = (SSLSocket) LDAPLoginModule.TrustAllSSLSocketFactory.getDefault().createSocket(addr.getHostName(), addr.getPort());
// in millis
socket.setSoTimeout(5000);
// Would throw exception if the server does not support ssl.
// "javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?"
socket.startHandshake();
appFabricServer.stopAndWait();
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class DatasetBasedTimeScheduleStoreTest method beforeClass.
@BeforeClass
public static void beforeClass() throws Exception {
CConfiguration conf = CConfiguration.create();
conf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder("data").getAbsolutePath());
injector = Guice.createInjector(new ConfigModule(conf), new NonCustomLocationUnitTestModule().getModule(), new DiscoveryRuntimeModule().getInMemoryModules(), new MetricsClientRuntimeModule().getInMemoryModules(), new DataFabricModules().getInMemoryModules(), new DataSetsModules().getStandaloneModules(), new DataSetServiceModules().getInMemoryModules(), new ExploreClientModule(), new NamespaceClientRuntimeModule().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new AbstractModule() {
@Override
protected void configure() {
bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
bind(OwnerAdmin.class).to(NoOpOwnerAdmin.class);
}
});
txService = injector.getInstance(TransactionManager.class);
txService.startAndWait();
dsOpsService = injector.getInstance(DatasetOpExecutor.class);
dsOpsService.startAndWait();
dsService = injector.getInstance(DatasetService.class);
dsService.startAndWait();
dsFramework = injector.getInstance(DatasetFramework.class);
factory = injector.getInstance(TransactionExecutorFactory.class);
}
use of co.cask.cdap.common.conf.CConfiguration in project cdap by caskdata.
the class WorkerProgramRunnerTest method beforeClass.
@BeforeClass
public static void beforeClass() throws IOException {
// we are only gonna do long-running transactions here. Set the tx timeout to a ridiculously low value.
// that will test that the long-running transactions actually bypass that timeout.
CConfiguration conf = CConfiguration.create();
conf.setInt(TxConstants.Manager.CFG_TX_TIMEOUT, 1);
conf.setInt(TxConstants.Manager.CFG_TX_CLEANUP_INTERVAL, 2);
Injector injector = AppFabricTestHelper.getInjector(conf);
txService = injector.getInstance(TransactionManager.class);
txExecutorFactory = injector.getInstance(TransactionExecutorFactory.class);
dsFramework = injector.getInstance(DatasetFramework.class);
datasetCache = new SingleThreadDatasetCache(new SystemDatasetInstantiator(dsFramework, WorkerProgramRunnerTest.class.getClassLoader(), null), injector.getInstance(TransactionSystemClient.class), NamespaceId.DEFAULT, DatasetDefinition.NO_ARGUMENTS, null, null);
metricStore = injector.getInstance(MetricStore.class);
txService.startAndWait();
}
Aggregations