Search in sources :

Example 11 with ImmutablePair

use of co.cask.cdap.common.utils.ImmutablePair in project cdap by caskdata.

the class TestFileBasedTokenManager method getTokenManagerAndCodec.

@Override
protected ImmutablePair<TokenManager, Codec<AccessToken>> getTokenManagerAndCodec() throws IOException {
    CConfiguration cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    Injector injector = Guice.createInjector(new IOModule(), new ConfigModule(cConf), new FileBasedSecurityModule(), new DiscoveryRuntimeModule().getInMemoryModules());
    TokenManager tokenManager = injector.getInstance(TokenManager.class);
    tokenManager.startAndWait();
    Codec<AccessToken> tokenCodec = injector.getInstance(AccessTokenCodec.class);
    return new ImmutablePair<>(tokenManager, tokenCodec);
}
Also used : IOModule(co.cask.cdap.common.guice.IOModule) FileBasedSecurityModule(co.cask.cdap.security.guice.FileBasedSecurityModule) ImmutablePair(co.cask.cdap.common.utils.ImmutablePair) Injector(com.google.inject.Injector) ConfigModule(co.cask.cdap.common.guice.ConfigModule) CConfiguration(co.cask.cdap.common.conf.CConfiguration) DiscoveryRuntimeModule(co.cask.cdap.common.guice.DiscoveryRuntimeModule)

Example 12 with ImmutablePair

use of co.cask.cdap.common.utils.ImmutablePair in project cdap by caskdata.

the class TestInMemoryTokenManager method getTokenManagerAndCodec.

@Override
protected ImmutablePair<TokenManager, Codec<AccessToken>> getTokenManagerAndCodec() {
    Injector injector = Guice.createInjector(new IOModule(), new SecurityModules().getInMemoryModules(), new ConfigModule(), new DiscoveryRuntimeModule().getInMemoryModules());
    TokenManager tokenManager = injector.getInstance(TokenManager.class);
    tokenManager.startAndWait();
    Codec<AccessToken> tokenCodec = injector.getInstance(AccessTokenCodec.class);
    return new ImmutablePair<>(tokenManager, tokenCodec);
}
Also used : IOModule(co.cask.cdap.common.guice.IOModule) ImmutablePair(co.cask.cdap.common.utils.ImmutablePair) Injector(com.google.inject.Injector) ConfigModule(co.cask.cdap.common.guice.ConfigModule) DiscoveryRuntimeModule(co.cask.cdap.common.guice.DiscoveryRuntimeModule) SecurityModules(co.cask.cdap.security.guice.SecurityModules)

Aggregations

ImmutablePair (co.cask.cdap.common.utils.ImmutablePair)12 FuzzyRowFilter (co.cask.cdap.data2.dataset2.lib.table.FuzzyRowFilter)3 ArrayList (java.util.ArrayList)3 TransactionExecutor (org.apache.tephra.TransactionExecutor)3 TransactionFailureException (org.apache.tephra.TransactionFailureException)3 Test (org.junit.Test)3 Scan (co.cask.cdap.api.dataset.table.Scan)2 ConfigModule (co.cask.cdap.common.guice.ConfigModule)2 DiscoveryRuntimeModule (co.cask.cdap.common.guice.DiscoveryRuntimeModule)2 IOModule (co.cask.cdap.common.guice.IOModule)2 DatasetId (co.cask.cdap.proto.id.DatasetId)2 TypeToken (com.google.common.reflect.TypeToken)2 Injector (com.google.inject.Injector)2 HashSet (java.util.HashSet)2 Map (java.util.Map)2 NoSuchElementException (java.util.NoSuchElementException)2 DimensionValue (co.cask.cdap.api.dataset.lib.cube.DimensionValue)1 Row (co.cask.cdap.api.dataset.table.Row)1 Scanner (co.cask.cdap.api.dataset.table.Scanner)1 PluginClass (co.cask.cdap.api.plugin.PluginClass)1