Search in sources :

Example 6 with AlluxioConfigurationSet

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

the class ConfigurationEditorTest method testWrite.

@Test
public void testWrite() throws IOException {
    String siteProps = "alluxio.test=true";
    String envSh = "ALLUXIO_JAVA_OPTS=\"-XX:DebugNonSafepoints\"";
    String log4j = "log4j.rootLogger=INFO, ${alluxio.logger.type}, ${alluxio.remote.logger.type}";
    AlluxioConfigurationSet s = AlluxioConfigurationSet.newBuilder().setSiteProperties(siteProps).setAlluxioEnv(envSh).setLog4JProperties(log4j).build();
    ConfigurationEditor editor = new ConfigurationEditor(mConfDir.toAbsolutePath().toString());
    editor.writeConf(s);
    assertEquals(s, editor.readConf());
}
Also used : AlluxioConfigurationSet(alluxio.hub.proto.AlluxioConfigurationSet) Test(org.junit.Test)

Example 7 with AlluxioConfigurationSet

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

the class ConfigurationEditorTest method testRead.

@Test
public void testRead() throws IOException {
    String siteProps = "alluxio.test=true";
    String envSh = "ALLUXIO_JAVA_OPTS=\"-XX:DebugNonSafepoints\"";
    String log4j = "log4j.rootLogger=INFO, ${alluxio.logger.type}, ${alluxio.remote.logger.type}";
    Files.write(mSiteProps, siteProps.getBytes());
    Files.write(mEnvSh, envSh.getBytes());
    Files.write(mLog4j, log4j.getBytes());
    ConfigurationEditor editor = new ConfigurationEditor(mConfDir.toAbsolutePath().toString());
    AlluxioConfigurationSet s = editor.readConf();
    assertTrue(s.getSiteProperties().contains(siteProps));
    assertTrue(s.getAlluxioEnv().contains(envSh));
    assertTrue(s.getLog4JProperties().contains(log4j));
}
Also used : AlluxioConfigurationSet(alluxio.hub.proto.AlluxioConfigurationSet) Test(org.junit.Test)

Example 8 with AlluxioConfigurationSet

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

the class ManagerProcessContext method startGetConfigurationSetListener.

/**
 * Starts a request stream observer for {@link HostedManagerServiceGrpc} GetConfigurationSet
 * RPC calls.
 */
public void startGetConfigurationSetListener() {
    HostedManagerServiceGrpc.HostedManagerServiceStub asyncStub = getHostedAsyncStub();
    RequestStreamObserver requestObserver = new RequestStreamObserver<GetConfigurationSetRequest, GetConfigurationSetResponse>() {

        @Override
        public GetConfigurationSetResponse exec(GetConfigurationSetRequest req) {
            AlluxioConfigurationSet confSet = configurationSetFor(req.getPayload().getNodeType());
            return GetConfigurationSetResponse.newBuilder().setHubMetadata(mHubMetadata).setPayload(GetConfigurationSetResponse.Payload.newBuilder().setConfSet(confSet).build()).build();
        }

        @Override
        public void restart() {
            startGetConfigurationSetListener();
        }

        @Override
        public void handleError(String message, Throwable t) {
            handleStatusRuntimeException(message, t);
        }
    };
    StreamObserver<GetConfigurationSetResponse> responseObserver = asyncStub.getConfigurationSet(requestObserver);
    requestObserver.start(responseObserver, GetConfigurationSetResponse.newBuilder().setHubMetadata(mHubMetadata).build());
    LOG.info("Started GetConfigurationSet async listener", asyncStub);
}
Also used : RequestStreamObserver(alluxio.hub.manager.rpc.observer.RequestStreamObserver) AgentGetConfigurationSetRequest(alluxio.hub.proto.AgentGetConfigurationSetRequest) GetConfigurationSetRequest(alluxio.hub.proto.GetConfigurationSetRequest) HostedManagerServiceGrpc(alluxio.hub.proto.HostedManagerServiceGrpc) ByteString(com.google.protobuf.ByteString) GetConfigurationSetResponse(alluxio.hub.proto.GetConfigurationSetResponse) AlluxioConfigurationSet(alluxio.hub.proto.AlluxioConfigurationSet)

Aggregations

AlluxioConfigurationSet (alluxio.hub.proto.AlluxioConfigurationSet)8 Test (org.junit.Test)4 AgentGetConfigurationSetRequest (alluxio.hub.proto.AgentGetConfigurationSetRequest)2 BaseHubTest (alluxio.hub.test.BaseHubTest)2 ConfigurationEditor (alluxio.hub.agent.util.conf.ConfigurationEditor)1 RequestStreamObserver (alluxio.hub.manager.rpc.observer.RequestStreamObserver)1 AgentWriteConfigurationSetRequest (alluxio.hub.proto.AgentWriteConfigurationSetRequest)1 GetConfigurationSetRequest (alluxio.hub.proto.GetConfigurationSetRequest)1 GetConfigurationSetResponse (alluxio.hub.proto.GetConfigurationSetResponse)1 HostedManagerServiceGrpc (alluxio.hub.proto.HostedManagerServiceGrpc)1 HubNodeAddress (alluxio.hub.proto.HubNodeAddress)1 ByteString (com.google.protobuf.ByteString)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 StringWriter (java.io.StringWriter)1 Path (java.nio.file.Path)1 Properties (java.util.Properties)1 TimeoutException (java.util.concurrent.TimeoutException)1