Package com.cloudera.flume.conf

Examples of com.cloudera.flume.conf.Context


  }

  @Test
  public void testBuilder() throws IOException, InterruptedException {
    EventSink snk = GangliaSink.builder().build(new Context(), "localhost",
        "foo", "int");
    for (int i = 0; i < 10; i++) {
      snk.open();
      snk.append(new EventImpl("".getBytes()));
      snk.close();
    }

    EventSink snk4 = GangliaSink.builder().build(new Context(), "localhost",
        "foo", "int", FlumeConfiguration.get().getGangliaServers());
    for (int i = 0; i < 10; i++) {
      snk4.open();
      snk4.append(new EventImpl("".getBytes()));
      snk4.close();
    }

    try {
      GangliaSink.builder().build(new Context(), "localhost", "foo", "bar");
    } catch (IllegalArgumentException e) {
      // expected a bad type ;
      return;
    }
    fail("expected failure");
View Full Code Here


  }

  @Test
  public void testFactoryBuild() throws FlumeSpecException, IOException,
      InterruptedException {
    EventSink snk = new CompositeSink(new Context(),
        "ganglia(\"localhost\", \"foo\", \"int\")");
    for (int i = 0; i < 10; i++) {
      snk.open();
      snk.append(new EventImpl("".getBytes()));
      snk.close();
View Full Code Here

  public void testWALChainBadContext() throws FlumeSpecException {
    ReportManager.get().clear();
    String spec = "agentE2EChain(\"foo:123\",\"bar\",\"baz\")";

    LOG.info("waled failchain: " + spec);
    new CompositeSink(new Context(), spec);
  }
View Full Code Here

  public void testBEFailchain() throws FlumeSpecException, JSONException {
    ReportManager.get().clear();
    String spec = AgentFailChainSink.genBestEffortChain("counter(\"foo1\")",
        "counter(\"foo2\")", "counter(\"foo3\")");
    LOG.info("best effort failchain: " + spec);
    EventSink snk = FlumeBuilder.buildSink(new Context(), spec);
    ReportEvent rpt = ReportUtil.getFlattenedReport(snk);
    LOG.info(ReportUtil.toJSONObject(rpt).toString());

    // just check a sample of the values:
    assertEquals(
View Full Code Here

  public void testBEChain() throws FlumeSpecException {
    ReportManager.get().clear();
    String spec = "agentBEChain(\"foo:123\",\"bar\",\"baz\")";

    LOG.info("waled failchain: " + spec);
    new CompositeSink(new Context(), spec);
  }
View Full Code Here

        LogicalNodeContext.testingContext(), c2);
    c2Src.open();

    // create agentBEChain sink
    String spec = "agentBEChain(\"localhost:1234\", \"localhost:1235\")";
    EventSink snk = new CompositeSink(new Context(), spec);
    snk.open();

    Event e1 = new EventImpl("test 1".getBytes());
    Event e2 = new EventImpl("test 2".getBytes());
    Event e3 = new EventImpl("test 3".getBytes());
View Full Code Here

  public void testDFOChainBadContext() throws FlumeSpecException {
    ReportManager.get().clear();
    String spec = "agentDFOChain(\"foo:123\",\"bar\",\"baz\")";

    LOG.info("waled failchain: " + spec);
    new CompositeSink(new Context(), spec);
  }
View Full Code Here

      String spec = cmd.getOptionValue("c");
      LOG.info("Loading spec from command line: '" + spec + "'");

      try {
        // TODO the first one should be physical node name
        Context ctx = new LogicalNodeContext(nodename, nodename);
        Map<String, Pair<String, String>> cfgs = FlumeBuilder.parseConf(ctx,
            spec);
        Pair<String, String> node = cfgs.get(nodename);
        flume.nodesMan.spawn(nodename, node.getLeft(), node.getRight());
      } catch (Exception e) {
View Full Code Here

  /**
   * Test that checkConfig has the correct versioning behaviour
   */
  @Test
  public void testCheckConfig() {
    LogicalNode node = new LogicalNode(new Context(), "test-logical-node");

    assertFalse(node.checkConfig(null));

    // Are new configs accepted?
    FlumeConfigData cfgData = new FlumeConfigData(0, "null", "null", 0, 0,
View Full Code Here

  /**
   * Core driver for this series of tests.
   */
  LogicalNode drive(String src, String snk) throws IOException,
      RuntimeException, FlumeSpecException, InterruptedException {
    LogicalNode node = new LogicalNode(new Context(), "test-logical-node");
    FlumeConfigData cfg = new FlumeConfigData(0, src, snk, 1, 1, "my-test-flow");
    node.loadConfig(cfg);

    long sleep = 1000;
    Clock.sleep(sleep); // sleep is not the right approach
View Full Code Here

TOP

Related Classes of com.cloudera.flume.conf.Context

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.