Search in sources :

Example 1 with ZkMasterConnectDetails

use of alluxio.master.ZkMasterInquireClient.ZkMasterConnectDetails in project alluxio by Alluxio.

the class FileSystemUriIntegrationTest method zookeeperUriTest.

@Test
public void zookeeperUriTest() throws Exception {
    mCluster = MultiProcessCluster.newBuilder(PortCoordination.ZOOKEEPER_URI).setClusterName("ZookeeperUriFileSystemIntegrationTest").setNumMasters(3).setNumWorkers(2).addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.UFS.toString()).build();
    mCluster.start();
    // Get the zookeeper address
    ZkMasterConnectDetails connectDetails = (ZkMasterConnectDetails) mCluster.getMasterInquireClient().getConnectDetails();
    String zkAddress = connectDetails.getZkAddress();
    testConnection("zk@" + zkAddress);
}
Also used : ZkMasterConnectDetails(alluxio.master.ZkMasterInquireClient.ZkMasterConnectDetails) Test(org.junit.Test) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest)

Example 2 with ZkMasterConnectDetails

use of alluxio.master.ZkMasterInquireClient.ZkMasterConnectDetails 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)

Aggregations

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