Search in sources :

Example 1 with MasterKeyPBImpl

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());
}
Also used : MasterKeyPBImpl(org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl) Test(org.junit.Test)

Example 2 with MasterKeyPBImpl

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;
}
Also used : MasterKeyPBImpl(org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl) ApplicationACLsManager(org.apache.hadoop.yarn.server.security.ApplicationACLsManager) NMContext(org.apache.hadoop.yarn.server.nodemanager.NodeManager.NMContext) NMContainerTokenSecretManager(org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager) MasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey) NMTokenSecretManagerInNM(org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM)

Example 3 with MasterKeyPBImpl

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;
}
Also used : MasterKeyPBImpl(org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) MasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey)

Example 4 with MasterKeyPBImpl

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;
}
Also used : MasterKeyPBImpl(org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl) MasterKey(org.apache.hadoop.yarn.server.api.records.MasterKey) UnRegisterNodeManagerResponse(org.apache.hadoop.yarn.server.api.protocolrecords.UnRegisterNodeManagerResponse) RegisterNodeManagerResponse(org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerResponse)

Example 5 with MasterKeyPBImpl

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());
}
Also used : MasterKeyPBImpl(org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl)

Aggregations

MasterKeyPBImpl (org.apache.hadoop.yarn.server.api.records.impl.pb.MasterKeyPBImpl)9 MasterKey (org.apache.hadoop.yarn.server.api.records.MasterKey)3 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 RegisterNodeManagerResponse (org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerResponse)1 UnRegisterNodeManagerResponse (org.apache.hadoop.yarn.server.api.protocolrecords.UnRegisterNodeManagerResponse)1 NMContext (org.apache.hadoop.yarn.server.nodemanager.NodeManager.NMContext)1 NMContainerTokenSecretManager (org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager)1 NMTokenSecretManagerInNM (org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM)1 ApplicationACLsManager (org.apache.hadoop.yarn.server.security.ApplicationACLsManager)1 Test (org.junit.Test)1