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));
}
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;
}
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;
}
Aggregations