use of co.cask.cdap.data2.audit.AuditModule in project cdap by caskdata.
the class StandaloneMain method createPersistentModules.
private static List<Module> createPersistentModules(CConfiguration cConf, Configuration hConf) {
cConf.setIfUnset(Constants.CFG_DATA_LEVELDB_DIR, Constants.DEFAULT_DATA_LEVELDB_DIR);
cConf.set(Constants.CFG_DATA_INMEMORY_PERSISTENCE, Constants.InMemoryPersistenceType.LEVELDB.name());
// configure all services except for router and auth to bind to 127.0.0.1
String localhost = InetAddress.getLoopbackAddress().getHostAddress();
cConf.set(Constants.Service.MASTER_SERVICES_BIND_ADDRESS, localhost);
cConf.set(Constants.Transaction.Container.ADDRESS, localhost);
cConf.set(Constants.Dataset.Executor.ADDRESS, localhost);
cConf.set(Constants.Stream.ADDRESS, localhost);
cConf.set(Constants.Metrics.ADDRESS, localhost);
cConf.set(Constants.MetricsProcessor.ADDRESS, localhost);
cConf.set(Constants.LogSaver.ADDRESS, localhost);
cConf.set(Constants.Explore.SERVER_ADDRESS, localhost);
cConf.set(Constants.Metadata.SERVICE_BIND_ADDRESS, localhost);
cConf.set(Constants.Preview.ADDRESS, localhost);
return ImmutableList.of(new ConfigModule(cConf, hConf), new IOModule(), new ZKClientModule(), new KafkaClientModule(), new MetricsHandlerModule(), new DiscoveryRuntimeModule().getStandaloneModules(), new LocationRuntimeModule().getStandaloneModules(), new ProgramRunnerRuntimeModule().getStandaloneModules(), new DataFabricModules(StandaloneMain.class.getName()).getStandaloneModules(), new DataSetsModules().getStandaloneModules(), new DataSetServiceModules().getStandaloneModules(), new MetricsClientRuntimeModule().getStandaloneModules(), new LoggingModules().getStandaloneModules(), new LogReaderRuntimeModules().getStandaloneModules(), new RouterModules().getStandaloneModules(), new SecurityModules().getStandaloneModules(), new SecureStoreModules().getStandaloneModules(), new StreamServiceRuntimeModule().getStandaloneModules(), new ExploreRuntimeModule().getStandaloneModules(), new ServiceStoreModules().getStandaloneModules(), new ExploreClientModule(), new NotificationFeedServiceRuntimeModule().getStandaloneModules(), new NotificationServiceRuntimeModule().getStandaloneModules(), new ViewAdminModules().getStandaloneModules(), new StreamAdminModules().getStandaloneModules(), new NamespaceStoreModule().getStandaloneModules(), new MetadataServiceModule(), new RemoteSystemOperationsServiceModule(), new AuditModule().getStandaloneModules(), new AuthorizationModule(), new AuthorizationEnforcementModule().getStandaloneModules(), new PreviewHttpModule(), new MessagingServerRuntimeModule().getStandaloneModules(), new AppFabricServiceRuntimeModule().getStandaloneModules(), new OperationalStatsModule(), new ProvisionerModule());
}
use of co.cask.cdap.data2.audit.AuditModule in project cdap by caskdata.
the class HBaseFileStreamAdminTest method init.
@BeforeClass
public static void init() throws Exception {
InMemoryZKServer zkServer = InMemoryZKServer.builder().setDataDir(tmpFolder.newFolder()).build();
zkServer.startAndWait();
Configuration hConf = testHBase.getConfiguration();
addCConfProperties(cConf);
cConf.setInt(Constants.Stream.CONTAINER_INSTANCES, 1);
cConf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath());
cConf.set(Constants.Zookeeper.QUORUM, zkServer.getConnectionStr());
Injector injector = Guice.createInjector(new ConfigModule(cConf, hConf), new ZKClientModule(), new NonCustomLocationUnitTestModule().getModule(), new DiscoveryRuntimeModule().getInMemoryModules(), new TransactionMetricsModule(), new DataSetsModules().getInMemoryModules(), new SystemDatasetRuntimeModule().getInMemoryModules(), new ExploreClientModule(), new ViewAdminModules().getInMemoryModules(), new AuditModule().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule(), Modules.override(new DataFabricModules().getDistributedModules(), new StreamAdminModules().getDistributedModules()).with(new AbstractModule() {
@Override
protected void configure() {
bind(TransactionStateStorage.class).to(NoOpTransactionStateStorage.class);
bind(TransactionSystemClient.class).to(InMemoryTxSystemClient.class).in(Singleton.class);
bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
bind(NotificationFeedManager.class).to(NoOpNotificationFeedManager.class);
bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
}
}));
ZKClientService zkClientService = injector.getInstance(ZKClientService.class);
zkClientService.startAndWait();
streamAdmin = injector.getInstance(StreamAdmin.class);
txManager = TxInMemory.getTransactionManager(injector.getInstance(TransactionSystemClient.class));
fileWriterFactory = injector.getInstance(StreamFileWriterFactory.class);
streamCoordinatorClient = injector.getInstance(StreamCoordinatorClient.class);
inMemoryAuditPublisher = injector.getInstance(InMemoryAuditPublisher.class);
authorizer = injector.getInstance(AuthorizerInstantiator.class).get();
ownerAdmin = injector.getInstance(OwnerAdmin.class);
setupNamespaces(injector.getInstance(NamespacedLocationFactory.class));
txManager.startAndWait();
streamCoordinatorClient.startAndWait();
}
use of co.cask.cdap.data2.audit.AuditModule in project cdap by caskdata.
the class LevelDBFileStreamAdminTest method init.
@BeforeClass
public static void init() throws Exception {
CConfiguration cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, tmpFolder.newFolder().getAbsolutePath());
addCConfProperties(cConf);
Injector injector = Guice.createInjector(new ConfigModule(cConf), new NonCustomLocationUnitTestModule().getModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new DataSetsModules().getInMemoryModules(), new DataFabricLevelDBModule(), new TransactionMetricsModule(), new DiscoveryRuntimeModule().getInMemoryModules(), new ExploreClientModule(), new ViewAdminModules().getInMemoryModules(), new AuditModule().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getNoOpModule(), Modules.override(new StreamAdminModules().getStandaloneModules()).with(new AbstractModule() {
@Override
protected void configure() {
bind(StreamMetaStore.class).to(InMemoryStreamMetaStore.class);
bind(NotificationFeedManager.class).to(NoOpNotificationFeedManager.class);
bind(UGIProvider.class).to(UnsupportedUGIProvider.class);
bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
bind(NamespaceQueryAdmin.class).to(SimpleNamespaceQueryAdmin.class);
}
}));
streamAdmin = injector.getInstance(StreamAdmin.class);
txManager = injector.getInstance(TransactionManager.class);
fileWriterFactory = injector.getInstance(StreamFileWriterFactory.class);
streamCoordinatorClient = injector.getInstance(StreamCoordinatorClient.class);
inMemoryAuditPublisher = injector.getInstance(InMemoryAuditPublisher.class);
authorizer = injector.getInstance(AuthorizerInstantiator.class).get();
ownerAdmin = injector.getInstance(OwnerAdmin.class);
streamCoordinatorClient.startAndWait();
setupNamespaces(injector.getInstance(NamespacedLocationFactory.class));
txManager.startAndWait();
}
use of co.cask.cdap.data2.audit.AuditModule in project cdap by caskdata.
the class AbstractDatasetFrameworkTest method setup.
@BeforeClass
public static void setup() throws Exception {
cConf = CConfiguration.create();
File dataDir = new File(TMP_FOLDER.newFolder(), "data");
cConf.set(Constants.CFG_LOCAL_DATA_DIR, dataDir.getAbsolutePath());
final Injector injector = Guice.createInjector(new ConfigModule(cConf), new NonCustomLocationUnitTestModule().getModule(), new TransactionInMemoryModule(), new NamespaceClientRuntimeModule().getInMemoryModules(), new AuditModule().getInMemoryModules(), new AbstractModule() {
@Override
protected void configure() {
bind(OwnerStore.class).to(InMemoryOwnerStore.class).in(Scopes.SINGLETON);
bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
}
});
locationFactory = injector.getInstance(LocationFactory.class);
namespacedLocationFactory = injector.getInstance(NamespacedLocationFactory.class);
txExecutorFactory = injector.getInstance(TransactionExecutorFactory.class);
registryFactory = new DatasetDefinitionRegistryFactory() {
@Override
public DatasetDefinitionRegistry create() {
DefaultDatasetDefinitionRegistry registry = new DefaultDatasetDefinitionRegistry();
injector.injectMembers(registry);
return registry;
}
};
namespaceAdmin = injector.getInstance(NamespaceAdmin.class);
namespaceQueryAdmin = injector.getInstance(NamespaceQueryAdmin.class);
ownerAdmin = injector.getInstance(OwnerAdmin.class);
inMemoryAuditPublisher = injector.getInstance(InMemoryAuditPublisher.class);
namespaceAdmin.create(new NamespaceMeta.Builder().setName(NAMESPACE_ID).build());
}
use of co.cask.cdap.data2.audit.AuditModule in project cdap by caskdata.
the class SystemMetadataAuditPublishTest method setup.
@BeforeClass
public static void setup() {
cConf = CConfiguration.create();
cConf.setBoolean(Constants.Audit.ENABLED, true);
Injector injector = AppFabricTestHelper.getInjector(cConf, new AbstractModule() {
@Override
protected void configure() {
bind(MetadataStore.class).to(DefaultMetadataStore.class);
install(new AuditModule().getInMemoryModules());
}
});
auditPublisher = injector.getInstance(InMemoryAuditPublisher.class);
namespaceAdmin = injector.getInstance(NamespaceAdmin.class);
scheduler = injector.getInstance(Scheduler.class);
if (scheduler instanceof Service) {
((Service) scheduler).startAndWait();
}
}
Aggregations