accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [05/15] git commit: ACCUMULO-3150 Set 0 for monitor log4j port config value
Date Fri, 19 Sep 2014 19:00:02 GMT
ACCUMULO-3150 Set 0 for monitor log4j port config value

The rest of the code is already in place to support
a randomly chosen port for the log4j forwarding to
the monitor. We just need to configure MAC to do this.

Added a test to ensure that ports we want to have
a value of '0' are in fact configured as such.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/72fd6bec
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/72fd6bec
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/72fd6bec

Branch: refs/heads/1.6.1-SNAPSHOT
Commit: 72fd6beccd093d544a880c4564917039b80ee23a
Parents: c170f01
Author: Josh Elser <elserj@apache.org>
Authored: Fri Sep 19 13:27:54 2014 -0400
Committer: Josh Elser <elserj@apache.org>
Committed: Fri Sep 19 13:28:24 2014 -0400

----------------------------------------------------------------------
 .../minicluster/MiniAccumuloCluster.java        |  1 +
 .../minicluster/MiniAccumuloClusterTest.java    | 99 +++++++++++---------
 2 files changed, 58 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/72fd6bec/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
index 8246c51..c9aa1f1 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
@@ -270,6 +270,7 @@ public class MiniAccumuloCluster {
     mergePropWithRandomPort(siteConfig, Property.TSERV_CLIENTPORT.getKey());
     mergePropWithRandomPort(siteConfig, Property.MONITOR_PORT.getKey());
     mergePropWithRandomPort(siteConfig, Property.GC_PORT.getKey());
+    mergePropWithRandomPort(siteConfig, Property.MONITOR_LOG4J_PORT.getKey());
     
     // since there is a small amount of memory, check more frequently for majc... setting
may not be needed in 1.5
     appendProp(fileWriter, Property.TSERV_MAJC_DELAY, "3", siteConfig);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/72fd6bec/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
----------------------------------------------------------------------
diff --git a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
index 1b46591..d1d64aa 100644
--- a/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
+++ b/minicluster/src/test/java/org/apache/accumulo/minicluster/MiniAccumuloClusterTest.java
@@ -38,6 +38,7 @@ import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.commons.io.FileUtils;
+import org.apache.hadoop.conf.Configuration;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -45,61 +46,61 @@ import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
 public class MiniAccumuloClusterTest {
-  
+
   public static TemporaryFolder folder = new TemporaryFolder();
-  
+
   private static MiniAccumuloCluster accumulo;
-  
+
   @BeforeClass
   public static void setupMiniCluster() throws Exception {
-    
+
     folder.create();
-    
+
     accumulo = new MiniAccumuloCluster(folder.getRoot(), "superSecret");
-    
+
     accumulo.start();
-    
+
   }
-  
+
   @Test(timeout = 30000)
   public void test() throws Exception {
     Connector conn = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()).getConnector("root",
new PasswordToken("superSecret"));
-    
+
     conn.tableOperations().create("table1");
-    
+
     conn.securityOperations().createLocalUser("user1", new PasswordToken("pass1"));
     conn.securityOperations().changeUserAuthorizations("user1", new Authorizations("A", "B"));
     conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.WRITE);
     conn.securityOperations().grantTablePermission("user1", "table1", TablePermission.READ);
-    
+
     IteratorSetting is = new IteratorSetting(10, SummingCombiner.class);
     SummingCombiner.setEncodingType(is, LongCombiner.Type.STRING);
     SummingCombiner.setColumns(is, Collections.singletonList(new IteratorSetting.Column("META",
"COUNT")));
-    
+
     conn.tableOperations().attachIterator("table1", is);
-    
+
     Connector uconn = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()).getConnector("user1",
new PasswordToken("pass1"));
-    
+
     BatchWriter bw = uconn.createBatchWriter("table1", new BatchWriterConfig());
-    
+
     UUID uuid = UUID.randomUUID();
-    
+
     Mutation m = new Mutation(uuid.toString());
     m.put("META", "SIZE", new ColumnVisibility("A|B"), "8");
     m.put("META", "CRC", new ColumnVisibility("A|B"), "456");
     m.put("META", "COUNT", new ColumnVisibility("A|B"), "1");
     m.put("DATA", "IMG", new ColumnVisibility("A&B"), "ABCDEFGH");
-    
+
     bw.addMutation(m);
     bw.flush();
-    
+
     m = new Mutation(uuid.toString());
     m.put("META", "COUNT", new ColumnVisibility("A|B"), "1");
     m.put("META", "CRC", new ColumnVisibility("A|B"), "123");
     bw.addMutation(m);
-    
+
     bw.close();
-    
+
     int count = 0;
     Scanner scanner = uconn.createScanner("table1", new Authorizations("A"));
     for (Entry<Key,Value> entry : scanner) {
@@ -114,9 +115,9 @@ public class MiniAccumuloClusterTest {
       }
       count++;
     }
-    
+
     Assert.assertEquals(3, count);
-    
+
     count = 0;
     scanner = uconn.createScanner("table1", new Authorizations("A", "B"));
     for (Entry<Key,Value> entry : scanner) {
@@ -125,62 +126,76 @@ public class MiniAccumuloClusterTest {
       }
       count++;
     }
-    
+
     Assert.assertEquals(4, count);
-    
+
     conn.tableOperations().delete("table1");
   }
-  
+
   @Test(timeout = 60000)
   public void testPerTableClasspath() throws Exception {
-    
+
     Connector conn = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers()).getConnector("root",
new PasswordToken("superSecret"));
-    
+
     conn.tableOperations().create("table2");
-    
+
     File jarFile = File.createTempFile("iterator", ".jar");
     FileUtils.copyURLToFile(this.getClass().getResource("/FooFilter.jar"), jarFile);
     jarFile.deleteOnExit();
-    
+
     conn.instanceOperations().setProperty(Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey()
+ "cx1", jarFile.toURI().toString());
     conn.tableOperations().setProperty("table2", Property.TABLE_CLASSPATH.getKey(), "cx1");
     conn.tableOperations().attachIterator("table2", new IteratorSetting(100, "foocensor",
"org.apache.accumulo.test.FooFilter"));
-    
+
     BatchWriter bw = conn.createBatchWriter("table2", new BatchWriterConfig());
-    
+
     Mutation m1 = new Mutation("foo");
     m1.put("cf1", "cq1", "v2");
     m1.put("cf1", "cq2", "v3");
-    
+
     bw.addMutation(m1);
-    
+
     Mutation m2 = new Mutation("bar");
     m2.put("cf1", "cq1", "v6");
     m2.put("cf1", "cq2", "v7");
-    
+
     bw.addMutation(m2);
-    
+
     bw.close();
-    
+
     Scanner scanner = conn.createScanner("table2", new Authorizations());
-    
+
     int count = 0;
     for (Entry<Key,Value> entry : scanner) {
       Assert.assertFalse(entry.getKey().getRowData().toString().toLowerCase().contains("foo"));
       count++;
     }
-    
+
     Assert.assertEquals(2, count);
-    
+
     conn.instanceOperations().removeProperty(Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey()
+ "cx1");
     conn.tableOperations().delete("table2");
-    
+
   }
-  
+
+  @Test
+  public void testRandomPorts() throws Exception {
+    File confDir = new File(folder.getRoot(), "conf");
+    File accumuloSite = new File(confDir, "accumulo-site.xml");
+    Configuration conf = new Configuration(false);
+    conf.addResource(accumuloSite.toURI().toURL());
+    for (Property randomPortProp : new Property[] {Property.TSERV_CLIENTPORT, Property.MONITOR_PORT,
Property.MONITOR_LOG4J_PORT, Property.MASTER_CLIENTPORT,
+        Property.TRACE_PORT, Property.GC_PORT}) {
+      String value = conf.get(randomPortProp.getKey());
+      Assert.assertNotNull("Found no value for " + randomPortProp, value);
+      Assert.assertEquals("0", value);
+    }
+  }
+
   @AfterClass
   public static void tearDownMiniCluster() throws Exception {
     accumulo.stop();
     // folder.delete();
   }
-  
+
 }


Mime
View raw message