Search in sources :

Example 21 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class MountInfo method toDisplayMountPointInfo.

/**
 * @return the {@link MountPointInfo} for the mount point. Some information is formatted
 * for display purpose.
 */
public MountPointInfo toDisplayMountPointInfo() {
    MountPointInfo info = toMountPointInfo();
    UnderFileSystemConfiguration conf = UnderFileSystemConfiguration.defaults(new InstancedConfiguration(new AlluxioProperties())).createMountSpecificConf(info.getProperties());
    Map<String, String> displayConf = conf.toUserPropertyMap(ConfigurationValueOptions.defaults().useDisplayValue(true));
    info.setProperties(displayConf);
    return info;
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) AlluxioProperties(alluxio.conf.AlluxioProperties) MountPointInfo(alluxio.wire.MountPointInfo) UnderFileSystemConfiguration(alluxio.underfs.UnderFileSystemConfiguration)

Example 22 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class ManagerProcessMonitorTest method testProcessMonitorSuccess.

@Test
public void testProcessMonitorSuccess() throws Exception {
    InstancedConfiguration conf = getTestConfig();
    try (ManagerProcess proc = new ManagerProcess(conf)) {
        CountingRetry cntRetry = new CountingRetry(5);
        CommonUtils.waitFor("rpc server is serving", proc::isServing, WaitForOptions.defaults().setTimeoutMs(10000));
        assertNotEquals(0, proc.getRpcPort());
        ManagerProcessMonitor.pingService(new InetSocketAddress("127.0.0.1", proc.getRpcPort()), cntRetry, 2000);
    } catch (Exception e) {
        fail("Should not have thrown an exception: " + e);
    }
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) CountingRetry(alluxio.retry.CountingRetry) InetSocketAddress(java.net.InetSocketAddress) Test(org.junit.Test) BaseHubTest(alluxio.hub.test.BaseHubTest)

Example 23 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class ManagerRpcServerTest method testGetAddress.

@Test
public void testGetAddress() throws Exception {
    InstancedConfiguration conf = getTestConfig();
    conf.set(PropertyKey.HUB_MANAGER_RPC_BIND_HOST, "127.6.5.4");
    ServerConfiguration.set(PropertyKey.HUB_MANAGER_RPC_PORT, 0);
    InetSocketAddress addr = ManagerRpcServer.getBindAddress(conf);
    assertEquals("127.6.5.4", addr.getHostString());
    assertEquals(0, addr.getPort());
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) InetSocketAddress(java.net.InetSocketAddress) Test(org.junit.Test) BaseHubTest(alluxio.hub.test.BaseHubTest)

Example 24 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class ProcessLauncherTest method testCreateProcwithMock.

void testCreateProcwithMock(Process mockedProcess) throws Exception {
    InstancedConfiguration conf = getTestConfig();
    conf.set(PropertyKey.HOME, "/path/to/non/existent/directory");
    try (MockedStatic<Files> files = Mockito.mockStatic(Files.class)) {
        files.when(() -> Files.exists(ArgumentMatchers.any())).thenReturn(true);
        ProcessLauncher l = new ProcessLauncher(getTestConfig());
        try (MockedStatic<Runtime> runtimeMock = Mockito.mockStatic(Runtime.class)) {
            Runtime mockedRuntime = mock(Runtime.class);
            runtimeMock.when(Runtime::getRuntime).thenReturn(mockedRuntime);
            for (AlluxioNodeType t : AlluxioNodeType.values()) {
                doReturn(mockedProcess).when(mockedRuntime).exec(ArgumentMatchers.any(String.class));
                l.start(t);
                verify(mockedRuntime).exec(ArgumentMatchers.contains("alluxio-start.sh " + t.toString().toLowerCase()));
            }
        }
    }
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) Files(java.nio.file.Files) AlluxioNodeType(alluxio.hub.proto.AlluxioNodeType)

Example 25 with InstancedConfiguration

use of alluxio.conf.InstancedConfiguration in project alluxio by Alluxio.

the class AlluxioProxyMonitor method main.

/**
 * Starts the Alluxio proxy monitor.
 *
 * @param args command line arguments, should be empty
 */
public static void main(String[] args) {
    if (args.length != 0) {
        LOG.info("java -cp {} {}", RuntimeConstants.ALLUXIO_JAR, AlluxioProxyMonitor.class.getCanonicalName());
        LOG.warn("ignoring arguments");
    }
    HealthCheckClient client = new ProxyHealthCheckClient(NetworkAddressUtils.getBindAddress(NetworkAddressUtils.ServiceType.PROXY_WEB, new InstancedConfiguration(ConfigurationUtils.defaults())), () -> new ExponentialBackoffRetry(50, 100, 2));
    if (!client.isServing()) {
        System.exit(1);
    }
    System.exit(0);
}
Also used : InstancedConfiguration(alluxio.conf.InstancedConfiguration) ExponentialBackoffRetry(alluxio.retry.ExponentialBackoffRetry) HealthCheckClient(alluxio.HealthCheckClient)

Aggregations

InstancedConfiguration (alluxio.conf.InstancedConfiguration)94 Test (org.junit.Test)35 AlluxioConfiguration (alluxio.conf.AlluxioConfiguration)16 AlluxioURI (alluxio.AlluxioURI)14 AlluxioProperties (alluxio.conf.AlluxioProperties)11 ArrayList (java.util.ArrayList)11 IOException (java.io.IOException)10 HashMap (java.util.HashMap)9 BaseHubTest (alluxio.hub.test.BaseHubTest)8 InetSocketAddress (java.net.InetSocketAddress)8 FileSystemShell (alluxio.cli.fs.FileSystemShell)6 FileSystemContext (alluxio.client.file.FileSystemContext)6 HealthCheckClient (alluxio.HealthCheckClient)5 AbstractFileSystemShellTest (alluxio.client.cli.fs.AbstractFileSystemShellTest)5 FileSystemShellUtilsTest (alluxio.client.cli.fs.FileSystemShellUtilsTest)5 MasterInquireClient (alluxio.master.MasterInquireClient)5 Properties (java.util.Properties)5 ParseException (org.apache.commons.cli.ParseException)5 ClientContext (alluxio.ClientContext)4 FileSystem (alluxio.client.file.FileSystem)4