Search in sources :

Example 1 with HubNodeStatus

use of alluxio.hub.proto.HubNodeStatus in project alluxio by Alluxio.

the class AgentProcessContextTest method testRegisterAgentSuccess.

@Test
public void testRegisterAgentSuccess() throws Exception {
    assertEquals(0, mContext.getHubCluster().size());
    InstancedConfiguration config = getTestSpecificConfig();
    AgentProcessContext ctx = new AgentProcessContext(config, mClient);
    RetryPolicy retry = new ExponentialBackoffRetry(5, 50, 10);
    ctx.registerAgent(retry);
    assertEquals(1, mContext.getHubCluster().size());
    HubNodeStatus node = mContext.getHubCluster().toProto().getNode(0);
    String host = NetworkAddressUtils.getConnectHost(NetworkAddressUtils.ServiceType.HUB_AGENT_RPC, config);
    assertEquals(host, node.getNode().getHostname());
    assertEquals(config.getInt(PropertyKey.HUB_AGENT_RPC_PORT), node.getNode().getRpcPort());
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) ExponentialBackoffRetry(alluxio.retry.ExponentialBackoffRetry) HubNodeStatus(alluxio.hub.proto.HubNodeStatus) RetryPolicy(alluxio.retry.RetryPolicy) Test(org.junit.Test) BaseHubTest(alluxio.hub.test.BaseHubTest)

Example 2 with HubNodeStatus

use of alluxio.hub.proto.HubNodeStatus in project alluxio by Alluxio.

the class ManagerAgentServiceTest method registerAgentTest.

@Test
public void registerAgentTest() {
    RegisterAgentRequest req = RegisterAgentRequest.newBuilder().setNode(HubNodeAddress.newBuilder().setHostname("test-host").setRpcPort(54321).build()).build();
    RegisterAgentResponse resp = mClient.registerAgent(req);
    assertTrue(resp.hasOk());
    assertEquals(1, mContext.getHubCluster().size());
    assertTrue(mContext.getHubCluster().hosts().contains("test-host"));
    HubNodeStatus node = mContext.getHubCluster().toProto().getNode(0);
    assertTrue(node.hasNode());
    assertTrue(node.hasState());
    assertEquals("test-host", node.getNode().getHostname());
    assertEquals(54321, node.getNode().getRpcPort());
    assertEquals(HubNodeState.ALIVE, node.getState());
}
Also used : RegisterAgentResponse(alluxio.hub.proto.RegisterAgentResponse) RegisterAgentRequest(alluxio.hub.proto.RegisterAgentRequest) HubNodeStatus(alluxio.hub.proto.HubNodeStatus) Test(org.junit.Test) BaseHubTest(alluxio.hub.test.BaseHubTest)

Aggregations

HubNodeStatus (alluxio.hub.proto.HubNodeStatus)2 BaseHubTest (alluxio.hub.test.BaseHubTest)2 Test (org.junit.Test)2 InstancedConfiguration (alluxio.conf.InstancedConfiguration)1 RegisterAgentRequest (alluxio.hub.proto.RegisterAgentRequest)1 RegisterAgentResponse (alluxio.hub.proto.RegisterAgentResponse)1 ExponentialBackoffRetry (alluxio.retry.ExponentialBackoffRetry)1 RetryPolicy (alluxio.retry.RetryPolicy)1