Package com.cloudera.flume.conf.avro

Examples of com.cloudera.flume.conf.avro.FlumeNodeStatusAvro


   * Convert from a { @link StatusManager.NodeStatus } object to Avro's { @link
   * FlumeNodeStatusAvro }.
   */
  public static FlumeNodeStatusAvro statusToAvro(StatusManager.NodeStatus status) {
    long time = System.currentTimeMillis();
    FlumeNodeStatusAvro out = new FlumeNodeStatusAvro();
    out.state = MasterClientServerAvro.stateToAvro(status.state);
    out.version = status.version;
    out.lastseen = status.lastseen;
    out.lastSeenDeltaMillis = time - status.lastseen;
    out.host = status.host;
View Full Code Here


*/
public class TestShellRPCAvro {

  @Test
  public void testAvroStatusConversion() {
    FlumeNodeStatusAvro start = new FlumeNodeStatusAvro();
    start.host = "HOST";
    long time = System.currentTimeMillis();
    start.lastseen = time;
    start.lastSeenDeltaMillis = time;
    start.physicalNode = "PHYSICAL_NODE";
    start.state = FlumeNodeState.ACTIVE;

    NodeStatus middle = MasterAdminServerAvro.statusFromAvro(start);

    assertEquals("HOST", middle.host);
    assertEquals(start.lastseen, middle.lastseen);
    assertEquals("PHYSICAL_NODE", middle.physicalNode);
    assertEquals(NodeState.ACTIVE, middle.state);

    FlumeNodeStatusAvro end = MasterAdminServerAvro.statusToAvro(middle);
    assertEquals(end.host, start.host);
    assertEquals(end.lastseen, start.lastseen);
    assertEquals(end.physicalNode, start.physicalNode);
    assertEquals(end.state, start.state);
  }
View Full Code Here

   * Convert from a { @link StatusManager.NodeStatus } object to Avro's { @link
   * FlumeNodeStatusAvro }.
   */
  public static FlumeNodeStatusAvro statusToAvro(StatusManager.NodeStatus status) {
    long time = System.currentTimeMillis();
    FlumeNodeStatusAvro out = new FlumeNodeStatusAvro();
    out.state = MasterClientServerAvro.stateToAvro(status.state);
    out.version = status.version;
    out.lastseen = status.lastseen;
    out.lastSeenDeltaMillis = time - status.lastseen;
    out.host = status.host;
View Full Code Here

TOP

Related Classes of com.cloudera.flume.conf.avro.FlumeNodeStatusAvro

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.