use of org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl in project hadoop by apache.
the class TestYarnServerApiClasses method testMasterKeyPBImpl.
/**
* Test MasterKeyPBImpl.
*/
@Test
public void testMasterKeyPBImpl() {
MasterKeyPBImpl original = new MasterKeyPBImpl();
original.setBytes(ByteBuffer.allocate(0));
original.setKeyId(1);
MasterKeyPBImpl copy = new MasterKeyPBImpl(original.getProto());
assertEquals(1, copy.getKeyId());
assertTrue(original.equals(copy));
assertEquals(original.hashCode(), copy.hashCode());
}
use of org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl in project hadoop by apache.
the class TestContainerManagerRecovery method createContext.
private NMContext createContext(Configuration conf, NMStateStoreService stateStore) {
NMContext context = new NMContext(new NMContainerTokenSecretManager(conf), new NMTokenSecretManagerInNM(), null, new ApplicationACLsManager(conf), stateStore, false, conf) {
public int getHttpPort() {
return HTTP_PORT;
}
};
// simulate registration with RM
MasterKey masterKey = new MasterKeyPBImpl();
masterKey.setKeyId(123);
masterKey.setBytes(ByteBuffer.wrap(new byte[] { new Integer(123).byteValue() }));
context.getContainerTokenSecretManager().setMasterKey(masterKey);
context.getNMTokenSecretManager().setMasterKey(masterKey);
return context;
}
use of org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl in project hadoop by apache.
the class TestNodeStatusUpdater method createMasterKey.
public static MasterKey createMasterKey() {
MasterKey masterKey = new MasterKeyPBImpl();
masterKey.setKeyId(123);
masterKey.setBytes(ByteBuffer.wrap(new byte[] { new Integer(123).byteValue() }));
return masterKey;
}
use of org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl in project hadoop by apache.
the class LocalRMInterface method registerNodeManager.
@Override
public RegisterNodeManagerResponse registerNodeManager(RegisterNodeManagerRequest request) throws YarnException, IOException {
RegisterNodeManagerResponse response = recordFactory.newRecordInstance(RegisterNodeManagerResponse.class);
MasterKey masterKey = new MasterKeyPBImpl();
masterKey.setKeyId(123);
masterKey.setBytes(ByteBuffer.wrap(new byte[] { new Integer(123).byteValue() }));
response.setContainerTokenMasterKey(masterKey);
response.setNMTokenMasterKey(masterKey);
return response;
}
use of org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl in project hadoop by apache.
the class NMMemoryStateStoreService method storeNMTokenCurrentMasterKey.
@Override
public synchronized void storeNMTokenCurrentMasterKey(MasterKey key) throws IOException {
MasterKeyPBImpl keypb = (MasterKeyPBImpl) key;
nmTokenState.currentMasterKey = new MasterKeyPBImpl(keypb.getProto());
}
Aggregations