Package com.cloudera.flume.master.flows

Examples of com.cloudera.flume.master.flows.FlowConfigManager


  /**
   * Create simple non translating FlowConfigManager
   */
  FlowConfigManager createSimple() {
    return new FlowConfigManager(new ConfigManager()) {
      @Override
      public ConfigurationManager createConfigMan() {
        return new ConfigManager();
      }
    };
View Full Code Here


    };
  }

  @Test
  public void testFlowIsolation() throws IOException, FlumeSpecException {
    FlowConfigManager fcm = createSimple();

    fcm.setConfig("node1", "flow1", "null", "null");
    fcm.setConfig("node21", "flow2", "null", "null");
    fcm.setConfig("node22", "flow2", "null", "null");
    fcm.setConfig("node31", "flow3", "null", "null");
    fcm.setConfig("node32", "flow3", "null", "null");
    fcm.setConfig("node33", "flow3", "null", "null");

    assertEquals(1, fcm.getConfigManForFlow("flow1").getAllConfigs().size());
    assertEquals(2, fcm.getConfigManForFlow("flow2").getAllConfigs().size());
    assertEquals(3, fcm.getConfigManForFlow("flow3").getAllConfigs().size());
    assertEquals(6, fcm.getAllConfigs().size());
    assertEquals(6, fcm.getTranslatedConfigs().size());

    assertEquals("flow1", fcm.getFlowId("node1"));
    assertEquals("flow2", fcm.getFlowId("node21"));
    assertEquals("flow2", fcm.getFlowId("node22"));
    assertEquals("flow3", fcm.getFlowId("node31"));
    assertEquals("flow3", fcm.getFlowId("node32"));
    assertEquals("flow3", fcm.getFlowId("node33"));
  }
View Full Code Here

  // bulk set
  @SuppressWarnings("serial")
  @Test
  public void testBulkSet() throws IOException {
    FlowConfigManager fcm = createSimple();

    Map<String, FlumeConfigData> configs = new HashMap<String, FlumeConfigData>() {
      {
        put("node1", new FlumeConfigData(1, "null", "null", 1, 1, "flow1"));
        put("node21", new FlumeConfigData(1, "null", "null", 1, 1, "flow2"));
        put("node22", new FlumeConfigData(1, "null", "null", 1, 1, "flow2"));
        put("node31", new FlumeConfigData(1, "null", "null", 1, 1, "flow3"));
        put("node32", new FlumeConfigData(1, "null", "null", 1, 1, "flow3"));
        put("node33", new FlumeConfigData(1, "null", "null", 1, 1, "flow3"));
      }
    };

    fcm.setBulkConfig(configs);

    assertEquals(1, fcm.getConfigManForFlow("flow1").getAllConfigs().size());
    assertEquals(2, fcm.getConfigManForFlow("flow2").getAllConfigs().size());
    assertEquals(3, fcm.getConfigManForFlow("flow3").getAllConfigs().size());
    assertEquals(6, fcm.getAllConfigs().size());
    assertEquals(6, fcm.getTranslatedConfigs().size());

    assertEquals("flow1", fcm.getFlowId("node1"));
    assertEquals("flow2", fcm.getFlowId("node21"));
    assertEquals("flow2", fcm.getFlowId("node22"));
    assertEquals("flow3", fcm.getFlowId("node31"));
    assertEquals("flow3", fcm.getFlowId("node32"));
    assertEquals("flow3", fcm.getFlowId("node33"));
  }
View Full Code Here

    assertEquals("flow3", fcm.getFlowId("node33"));
  }

  @Test
  public void testFlowMove() throws IOException, FlumeSpecException {
    FlowConfigManager fcm = createSimple();

    fcm.setConfig("node1", "flow1", "null", "null");
    fcm.setConfig("node2", "flow2", "null", "null");

    assertEquals(1, fcm.getConfigManForFlow("flow1").getAllConfigs().size());
    assertEquals(1, fcm.getConfigManForFlow("flow2").getAllConfigs().size());
    assertEquals(2, fcm.getAllConfigs().size());
    assertEquals(2, fcm.getTranslatedConfigs().size());

    // move a node from one flow to another.
    fcm.setConfig("node1", "flow2", "null", "null");
    assertEquals(0, fcm.getConfigManForFlow("flow1").getAllConfigs().size());
    assertEquals(2, fcm.getConfigManForFlow("flow2").getAllConfigs().size());
    assertEquals(2, fcm.getAllConfigs().size());
    assertEquals(2, fcm.getTranslatedConfigs().size());
  }
View Full Code Here

    assertEquals(2, fcm.getTranslatedConfigs().size());
  }

  @Test
  public void testFlowRemove() throws IOException, FlumeSpecException {
    FlowConfigManager fcm = createSimple();

    fcm.setConfig("node1", "flow1", "null", "null");
    fcm.setConfig("node2", "flow2", "null", "null");

    assertEquals(1, fcm.getConfigManForFlow("flow1").getAllConfigs().size());
    assertEquals(1, fcm.getConfigManForFlow("flow2").getAllConfigs().size());
    assertEquals(2, fcm.getAllConfigs().size());
    assertEquals(2, fcm.getTranslatedConfigs().size());

    // move a node from one flow to another.
    fcm.removeLogicalNode("node1");
    assertEquals(0, fcm.getConfigManForFlow("flow1").getAllConfigs().size());
    assertEquals(1, fcm.getConfigManForFlow("flow2").getAllConfigs().size());
    assertEquals(1, fcm.getAllConfigs().size());
    assertEquals(1, fcm.getTranslatedConfigs().size());
  }
View Full Code Here

TOP

Related Classes of com.cloudera.flume.master.flows.FlowConfigManager

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.