Search in sources :

Example 1 with ConnectDetails

use of alluxio.master.MasterInquireClient.ConnectDetails in project alluxio by Alluxio.

the class MasterInquireClientTest method zkConnectString.

@Test
public void zkConnectString() throws Exception {
    String zkAddr = "zkAddr:1234";
    String leaderPath = "/my/leader/path";
    try (Closeable c = new ConfigurationRule(new HashMap<PropertyKey, Object>() {

        {
            put(PropertyKey.MASTER_JOURNAL_TYPE, "UFS");
            put(PropertyKey.ZOOKEEPER_ADDRESS, zkAddr);
            put(PropertyKey.ZOOKEEPER_LEADER_PATH, leaderPath);
        }
    }, mConfiguration).toResource()) {
        ConnectDetails singleConnect = new SingleMasterConnectDetails(NetworkAddressUtils.getConnectAddress(ServiceType.MASTER_RPC, mConfiguration));
        assertCurrentConnectString(singleConnect);
        try (Closeable c2 = new ConfigurationRule(PropertyKey.ZOOKEEPER_ENABLED, true, mConfiguration).toResource()) {
            ConnectDetails zkConnect = new ZkMasterConnectDetails(zkAddr, leaderPath);
            assertCurrentConnectString(zkConnect);
            assertEquals("zk@zkAddr:1234/my/leader/path", zkConnect.toString());
        }
    }
}
Also used : HashMap(java.util.HashMap) Closeable(java.io.Closeable) ConnectDetails(alluxio.master.MasterInquireClient.ConnectDetails) SingleMasterConnectDetails(alluxio.master.SingleMasterInquireClient.SingleMasterConnectDetails) ZkMasterConnectDetails(alluxio.master.ZkMasterInquireClient.ZkMasterConnectDetails) SingleMasterConnectDetails(alluxio.master.SingleMasterInquireClient.SingleMasterConnectDetails) ZkMasterConnectDetails(alluxio.master.ZkMasterInquireClient.ZkMasterConnectDetails) ConfigurationRule(alluxio.ConfigurationRule) Test(org.junit.Test)

Example 2 with ConnectDetails

use of alluxio.master.MasterInquireClient.ConnectDetails in project alluxio by Alluxio.

the class MasterInquireClientTest method defaultConnectString.

@Test
public void defaultConnectString() {
    ConnectDetails cs = new SingleMasterConnectDetails(NetworkAddressUtils.getConnectAddress(ServiceType.MASTER_RPC, mConfiguration));
    assertCurrentConnectString(cs);
    assertEquals(NetworkAddressUtils.getConnectHost(ServiceType.MASTER_RPC, mConfiguration) + ":" + NetworkAddressUtils.getPort(ServiceType.MASTER_RPC, mConfiguration), cs.toString());
}
Also used : ConnectDetails(alluxio.master.MasterInquireClient.ConnectDetails) SingleMasterConnectDetails(alluxio.master.SingleMasterInquireClient.SingleMasterConnectDetails) ZkMasterConnectDetails(alluxio.master.ZkMasterInquireClient.ZkMasterConnectDetails) SingleMasterConnectDetails(alluxio.master.SingleMasterInquireClient.SingleMasterConnectDetails) Test(org.junit.Test)

Example 3 with ConnectDetails

use of alluxio.master.MasterInquireClient.ConnectDetails in project alluxio by Alluxio.

the class MasterInquireClientTest method singleMasterConnectString.

@Test
public void singleMasterConnectString() throws Exception {
    String host = "testhost";
    int port = 123;
    try (Closeable c = new ConfigurationRule(new HashMap<PropertyKey, Object>() {

        {
            put(PropertyKey.MASTER_HOSTNAME, host);
            put(PropertyKey.MASTER_RPC_PORT, Integer.toString(port));
        }
    }, mConfiguration).toResource()) {
        ConnectDetails cs = new SingleMasterConnectDetails(InetSocketAddress.createUnresolved(host, port));
        assertCurrentConnectString(cs);
        assertEquals("testhost:123", cs.toString());
    }
}
Also used : HashMap(java.util.HashMap) Closeable(java.io.Closeable) ConnectDetails(alluxio.master.MasterInquireClient.ConnectDetails) SingleMasterConnectDetails(alluxio.master.SingleMasterInquireClient.SingleMasterConnectDetails) ZkMasterConnectDetails(alluxio.master.ZkMasterInquireClient.ZkMasterConnectDetails) SingleMasterConnectDetails(alluxio.master.SingleMasterInquireClient.SingleMasterConnectDetails) ConfigurationRule(alluxio.ConfigurationRule) Test(org.junit.Test)

Aggregations

ConnectDetails (alluxio.master.MasterInquireClient.ConnectDetails)3 SingleMasterConnectDetails (alluxio.master.SingleMasterInquireClient.SingleMasterConnectDetails)3 ZkMasterConnectDetails (alluxio.master.ZkMasterInquireClient.ZkMasterConnectDetails)3 Test (org.junit.Test)3 ConfigurationRule (alluxio.ConfigurationRule)2 Closeable (java.io.Closeable)2 HashMap (java.util.HashMap)2