Search in sources :

Example 46 with LocationFactory

use of org.apache.twill.filesystem.LocationFactory in project cdap by caskdata.

the class RemotePrivilegesTestBase method setup.

protected static void setup() throws IOException, InterruptedException {
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMPORARY_FOLDER.newFolder().getAbsolutePath());
    cConf.setBoolean(Constants.Security.ENABLED, true);
    cConf.setBoolean(Constants.Security.KERBEROS_ENABLED, false);
    cConf.setBoolean(Constants.Security.Authorization.ENABLED, true);
    cConf.setInt(Constants.Security.Authorization.CACHE_TTL_SECS, CACHE_TIMEOUT);
    Manifest manifest = new Manifest();
    manifest.getMainAttributes().put(Attributes.Name.MAIN_CLASS, InMemoryAuthorizer.class.getName());
    LocationFactory locationFactory = new LocalLocationFactory(TEMPORARY_FOLDER.newFolder());
    Location externalAuthJar = AppJarHelper.createDeploymentJar(locationFactory, InMemoryAuthorizer.class, manifest);
    cConf.set(Constants.Security.Authorization.EXTENSION_JAR_PATH, externalAuthJar.toString());
    Injector injector = AppFabricTestHelper.getInjector(cConf);
    discoveryService = injector.getInstance(DiscoveryServiceClient.class);
    appFabricServer = injector.getInstance(AppFabricServer.class);
    appFabricServer.startAndWait();
    waitForService(Constants.Service.APP_FABRIC_HTTP);
    authorizationEnforcer = injector.getInstance(RemoteAuthorizationEnforcer.class);
    privilegesManager = injector.getInstance(PrivilegesManager.class);
}
Also used : DiscoveryServiceClient(org.apache.twill.discovery.DiscoveryServiceClient) RemoteAuthorizationEnforcer(co.cask.cdap.security.authorization.RemoteAuthorizationEnforcer) InMemoryAuthorizer(co.cask.cdap.security.authorization.InMemoryAuthorizer) Injector(com.google.inject.Injector) AppFabricServer(co.cask.cdap.internal.app.services.AppFabricServer) PrivilegesManager(co.cask.cdap.security.spi.authorization.PrivilegesManager) Manifest(java.util.jar.Manifest) LocalLocationFactory(org.apache.twill.filesystem.LocalLocationFactory) LocalLocationFactory(org.apache.twill.filesystem.LocalLocationFactory) LocationFactory(org.apache.twill.filesystem.LocationFactory) Location(org.apache.twill.filesystem.Location)

Aggregations

LocationFactory (org.apache.twill.filesystem.LocationFactory)46 Location (org.apache.twill.filesystem.Location)28 LocalLocationFactory (org.apache.twill.filesystem.LocalLocationFactory)25 BeforeClass (org.junit.BeforeClass)13 File (java.io.File)12 Test (org.junit.Test)12 CConfiguration (co.cask.cdap.common.conf.CConfiguration)11 NamespacedLocationFactory (co.cask.cdap.common.namespace.NamespacedLocationFactory)11 FileContextLocationFactory (org.apache.twill.filesystem.FileContextLocationFactory)9 Injector (com.google.inject.Injector)8 Configuration (org.apache.hadoop.conf.Configuration)8 TransactionSystemClient (org.apache.tephra.TransactionSystemClient)8 Transactional (co.cask.cdap.api.Transactional)6 DatasetManager (co.cask.cdap.api.dataset.DatasetManager)6 ConfigModule (co.cask.cdap.common.guice.ConfigModule)6 DatasetFramework (co.cask.cdap.data2.dataset2.DatasetFramework)6 SystemDatasetInstantiator (co.cask.cdap.data.dataset.SystemDatasetInstantiator)5 DefaultDatasetManager (co.cask.cdap.data2.datafabric.dataset.DefaultDatasetManager)5 MultiThreadDatasetCache (co.cask.cdap.data2.dataset2.MultiThreadDatasetCache)5 HBaseTableUtilFactory (co.cask.cdap.data2.util.hbase.HBaseTableUtilFactory)5