Search in sources :

Example 1 with ChainedUserNameMapper

use of org.apache.ignite.hadoop.util.ChainedUserNameMapper in project ignite by apache.

the class ChainedUserNameMapperSelfTest method testChaining.

/**
     * Test actual chaining logic.
     *
     * @throws Exception If failed.
     */
public void testChaining() throws Exception {
    BasicUserNameMapper mapper1 = new BasicUserNameMapper();
    mapper1.setMappings(Collections.singletonMap("1", "101"));
    KerberosUserNameMapper mapper2 = new KerberosUserNameMapper();
    mapper2.setInstance(INSTANCE);
    mapper2.setRealm(REALM);
    ChainedUserNameMapper mapper = create(mapper1, mapper2);
    assertEquals("101" + "/" + INSTANCE + "@" + REALM, mapper.map("1"));
    assertEquals("2" + "/" + INSTANCE + "@" + REALM, mapper.map("2"));
    assertEquals(IgfsUtils.fixUserName(null) + "/" + INSTANCE + "@" + REALM, mapper.map(null));
}
Also used : KerberosUserNameMapper(org.apache.ignite.hadoop.util.KerberosUserNameMapper) BasicUserNameMapper(org.apache.ignite.hadoop.util.BasicUserNameMapper) ChainedUserNameMapper(org.apache.ignite.hadoop.util.ChainedUserNameMapper)

Example 2 with ChainedUserNameMapper

use of org.apache.ignite.hadoop.util.ChainedUserNameMapper in project ignite by apache.

the class ChainedUserNameMapperSelfTest method create.

/**
     * Create chained mapper.
     *
     * @param mappers Child mappers.
     * @return Chained mapper.
     */
private ChainedUserNameMapper create(UserNameMapper... mappers) {
    ChainedUserNameMapper mapper = new ChainedUserNameMapper();
    mapper.setMappers(mappers);
    mapper.start();
    return mapper;
}
Also used : ChainedUserNameMapper(org.apache.ignite.hadoop.util.ChainedUserNameMapper)

Example 3 with ChainedUserNameMapper

use of org.apache.ignite.hadoop.util.ChainedUserNameMapper in project ignite by apache.

the class Hadoop1DualAbstractTest method createSecondaryFileSystemStack.

/**
     * Creates secondary filesystems.
     * @return IgfsSecondaryFileSystem
     * @throws Exception On failure.
     */
@Override
protected IgfsSecondaryFileSystem createSecondaryFileSystemStack() throws Exception {
    startUnderlying();
    prepareConfiguration();
    KerberosUserNameMapper mapper1 = new KerberosUserNameMapper();
    mapper1.setRealm("TEST.COM");
    TestUserNameMapper mapper2 = new TestUserNameMapper();
    ChainedUserNameMapper mapper = new ChainedUserNameMapper();
    mapper.setMappers(mapper1, mapper2);
    CachingHadoopFileSystemFactory factory = new CachingHadoopFileSystemFactory();
    factory.setUri(secondaryUri);
    factory.setConfigPaths(secondaryConfFullPath);
    factory.setUserNameMapper(mapper);
    IgniteHadoopIgfsSecondaryFileSystem second = new IgniteHadoopIgfsSecondaryFileSystem();
    second.setFileSystemFactory(factory);
    igfsSecondary = new HadoopIgfsSecondaryFileSystemTestAdapter(factory);
    return second;
}
Also used : KerberosUserNameMapper(org.apache.ignite.hadoop.util.KerberosUserNameMapper) CachingHadoopFileSystemFactory(org.apache.ignite.hadoop.fs.CachingHadoopFileSystemFactory) IgniteHadoopIgfsSecondaryFileSystem(org.apache.ignite.hadoop.fs.IgniteHadoopIgfsSecondaryFileSystem) ChainedUserNameMapper(org.apache.ignite.hadoop.util.ChainedUserNameMapper)

Aggregations

ChainedUserNameMapper (org.apache.ignite.hadoop.util.ChainedUserNameMapper)3 KerberosUserNameMapper (org.apache.ignite.hadoop.util.KerberosUserNameMapper)2 CachingHadoopFileSystemFactory (org.apache.ignite.hadoop.fs.CachingHadoopFileSystemFactory)1 IgniteHadoopIgfsSecondaryFileSystem (org.apache.ignite.hadoop.fs.IgniteHadoopIgfsSecondaryFileSystem)1 BasicUserNameMapper (org.apache.ignite.hadoop.util.BasicUserNameMapper)1