logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r1439218 - in /logging/log4j/log4j2/trunk/flume-ng/src: main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java test/resources/default_embedded.xml test/resources/embedded.xml
Date Mon, 28 Jan 2013 01:03:18 GMT
Author: rgoers
Date: Mon Jan 28 01:03:17 2013
New Revision: 1439218

URL: http://svn.apache.org/viewvc?rev=1439218&view=rev
Log:
Change Flume embedded tests to use memory channel instead of file channel

Modified:
    logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java
    logging/log4j/log4j2/trunk/flume-ng/src/test/resources/default_embedded.xml
    logging/log4j/log4j2/trunk/flume-ng/src/test/resources/embedded.xml

Modified: logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java?rev=1439218&r1=1439217&r2=1439218&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java
(original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeEmbeddedManager.java
Mon Jan 28 01:03:17 2013
@@ -40,6 +40,8 @@ public class FlumeEmbeddedManager extend
 
     private static final String FiLE_SEP = PropertiesUtil.getProperties().getStringProperty("file.separator");
 
+    private static final String IN_MEMORY = "InMemory";
+
     private final FlumeNode node;
 
     private NodeConfiguration conf;
@@ -201,15 +203,26 @@ public class FlumeEmbeddedManager extend
             if (agents != null && agents.length > 0) {
                 props.put(name + ".sources", FlumeEmbeddedManager.SOURCE_NAME);
                 props.put(name + ".sources." + FlumeEmbeddedManager.SOURCE_NAME + ".type",
SOURCE_TYPE);
-                props.put(name + ".channels", "file");
-                props.put(name + ".channels.file.type", "file");
+
                 if (dataDir != null && dataDir.length() > 0) {
-                    if (!dataDir.endsWith(FiLE_SEP)) {
-                        dataDir = dataDir + FiLE_SEP;
+                    if (dataDir.equals(IN_MEMORY)) {
+                        props.put(name + ".channels", "primary");
+                        props.put(name + ".channels.primary.type", "memory");
+                    } else {
+                        props.put(name + ".channels", "primary");
+                        props.put(name + ".channels.primary.type", "file");
+
+                        if (!dataDir.endsWith(FiLE_SEP)) {
+                            dataDir = dataDir + FiLE_SEP;
+                        }
+
+                        props.put(name + ".channels.primary.checkpointDir", dataDir + "checkpoint");
+                        props.put(name + ".channels.primary.dataDirs", dataDir + "data");
                     }
 
-                    props.put(name + ".channels.file.checkpointDir", dataDir + "checkpoint");
-                    props.put(name + ".channels.file.dataDirs", dataDir + "data");
+                } else {
+                    props.put(name + ".channels", "primary");
+                    props.put(name + ".channels.primary.type", "file");
                 }
 
                 final StringBuilder sb = new StringBuilder();
@@ -219,7 +232,7 @@ public class FlumeEmbeddedManager extend
                     sb.append(leading).append("agent").append(i);
                     leading = " ";
                     final String prefix = name + ".sinks.agent" + i;
-                    props.put(prefix + ".channel", "file");
+                    props.put(prefix + ".channel", "primary");
                     props.put(prefix + ".type", "avro");
                     props.put(prefix + ".hostname", agents[i].getHost());
                     props.put(prefix + ".port", Integer.toString(agents[i].getPort()));
@@ -231,7 +244,7 @@ public class FlumeEmbeddedManager extend
                 props.put(name + ".sinkgroups", "group1");
                 props.put(name + ".sinkgroups.group1.sinks", sb.toString());
                 props.put(name + ".sinkgroups.group1.processor.type", "failover");
-                final String sourceChannels = "file";
+                final String sourceChannels = "primary";
                 props.put(name + ".channels", sourceChannels);
                 props.put(name + ".sources." + FlumeEmbeddedManager.SOURCE_NAME + ".channels",
sourceChannels);
             } else {
@@ -284,7 +297,7 @@ public class FlumeEmbeddedManager extend
                 String sourceChannels = channels;
 
                 if (channels == null) {
-                    sourceChannels = "file";
+                    sourceChannels = "primary";
                     props.put(name + ".channels", sourceChannels);
                 }
 

Modified: logging/log4j/log4j2/trunk/flume-ng/src/test/resources/default_embedded.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/test/resources/default_embedded.xml?rev=1439218&r1=1439217&r2=1439218&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/test/resources/default_embedded.xml (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/test/resources/default_embedded.xml Mon Jan 28
01:03:17 2013
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration status="warn" name="MyApp" packages="">
   <appenders>
-    <Flume name="eventLogger" suppressExceptions="false" compress="true" embedded="true"
dataDir="target/file-channel">
+    <Flume name="eventLogger" suppressExceptions="false" compress="true" embedded="true"
dataDir="InMemory">
       <Agent host="localhost" port="${sys:primaryPort}"/>
       <Agent host="localhost" port="${sys:alternatePort}"/>
       <RFC5424Layout enterpriseNumber="18060" includeMDC="true" appName="MyApp"/>

Modified: logging/log4j/log4j2/trunk/flume-ng/src/test/resources/embedded.xml
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/flume-ng/src/test/resources/embedded.xml?rev=1439218&r1=1439217&r2=1439218&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/flume-ng/src/test/resources/embedded.xml (original)
+++ logging/log4j/log4j2/trunk/flume-ng/src/test/resources/embedded.xml Mon Jan 28 01:03:17
2013
@@ -2,17 +2,15 @@
 <configuration status="warn" name="MyApp" packages="">
   <appenders>
     <Flume name="eventLogger" suppressExceptions="false" compress="true" embedded="true">
-      <Property name="channels">file</Property>
-      <Property name="channels.file.type">file</Property>
-      <Property name="channels.file.checkpointDir">target/file-channel/checkpoint</Property>
-      <Property name="channels.file.dataDirs">target/file-channel/data</Property>
+      <Property name="channels">primary</Property>
+      <Property name="channels.primary.type">memory</Property>
       <Property name="sinks">agent1 agent2</Property>
-      <Property name="sinks.agent1.channel">file</Property>
+      <Property name="sinks.agent1.channel">primary</Property>
       <Property name="sinks.agent1.type">avro</Property>
       <Property name="sinks.agent1.hostname">localhost</Property>
       <Property name="sinks.agent1.port">${sys:primaryPort}</Property>
       <Property name="sinks.agent1.batch-size">1</Property>
-      <Property name="sinks.agent2.channel">file</Property>
+      <Property name="sinks.agent2.channel">primary</Property>
       <Property name="sinks.agent2.type">avro</Property>
       <Property name="sinks.agent2.hostname">localhost</Property>
       <Property name="sinks.agent2.port">${sys:alternatePort}</Property>



Mime
View raw message