accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1499414 - in /accumulo/trunk/test: src/main/java/org/apache/accumulo/test/ src/main/java/org/apache/accumulo/test/functional/ src/test/java/org/apache/accumulo/test/functional/ system/auto/simple/
Date Wed, 03 Jul 2013 14:17:39 GMT
Author: ecn
Date: Wed Jul  3 14:17:38 2013
New Revision: 1499414

URL: http://svn.apache.org/r1499414
Log:
ACCUMULO-1537 fixing tests and timings, migrated visibility test

Added:
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/VisibilityIT.java
      - copied, changed from r1499109, accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/VisibilityTest.java
Removed:
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/VisibilityTest.java
    accumulo/trunk/test/system/auto/simple/visibility.py
Modified:
    accumulo/trunk/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
    accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java

Modified: accumulo/trunk/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java?rev=1499414&r1=1499413&r2=1499414&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java (original)
+++ accumulo/trunk/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java Wed
Jul  3 14:17:38 2013
@@ -20,6 +20,8 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map.Entry;
 
+import javax.crypto.Mac;
+
 import org.apache.accumulo.core.cli.BatchWriterOpts;
 import org.apache.accumulo.core.cli.ScannerOpts;
 import org.apache.accumulo.core.client.AccumuloException;
@@ -32,6 +34,7 @@ import org.apache.accumulo.core.data.Key
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.server.cli.ClientOpts;
+import org.apache.accumulo.test.functional.MacTest;
 import org.apache.hadoop.io.Text;
 
 import com.beust.jcommander.Parameter;

Modified: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java?rev=1499414&r1=1499413&r2=1499414&view=diff
==============================================================================
--- accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java
(original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java
Wed Jul  3 14:17:38 2013
@@ -56,7 +56,7 @@ import org.junit.Test;
 
 public class ReadWriteIT extends MacTest {
   
-  static final int ROWS = 200000;
+  static final int ROWS = 20000;
   static final int COLS = 1;
   static final String COLF = "colf";
   
@@ -226,7 +226,7 @@ public class ReadWriteIT extends MacTest
     assertTrue(foundFile);
   }
   
-  @Test(timeout=60*1000)
+  @Test(timeout=90*1000)
   public void localityGroupChange() throws Exception {
     // Make changes to locality groups and ensure nothing is lostssh
     final Connector connector = getConnector();

Copied: accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/VisibilityIT.java
(from r1499109, accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/VisibilityTest.java)
URL: http://svn.apache.org/viewvc/accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/VisibilityIT.java?p2=accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/VisibilityIT.java&p1=accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/VisibilityTest.java&r1=1499109&r2=1499414&rev=1499414&view=diff
==============================================================================
--- accumulo/trunk/test/src/main/java/org/apache/accumulo/test/functional/VisibilityTest.java
(original)
+++ accumulo/trunk/test/src/test/java/org/apache/accumulo/test/functional/VisibilityIT.java
Wed Jul  3 14:17:38 2013
@@ -17,7 +17,6 @@
 package org.apache.accumulo.test.functional;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -32,6 +31,7 @@ import java.util.TreeSet;
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
@@ -42,34 +42,23 @@ import org.apache.accumulo.core.security
 import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.accumulo.core.util.ByteArraySet;
 import org.apache.hadoop.io.Text;
+import org.junit.Test;
 
-public class VisibilityTest extends FunctionalTest {
+public class VisibilityIT extends MacTest {
   
-  @Override
-  public void cleanup() throws Exception {
-    
-  }
-  
-  @Override
-  public Map<String,String> getInitialConfig() {
-    return Collections.emptyMap();
-  }
-  
-  @Override
-  public List<TableSetup> getTablesToCreate() {
-    return Arrays.asList(new TableSetup[] {new TableSetup("vt"),
-        new TableSetup("vt2", Collections.singletonMap(Property.TABLE_DEFAULT_SCANTIME_VISIBILITY.getKey(),
"DEFLABEL"))});
-  }
-  
-  @Override
+  @Test
   public void run() throws Exception {
+    Connector c = getConnector();
+    c.tableOperations().create("vt");
+    c.tableOperations().create("vt2");
+    c.tableOperations().setProperty("vt2", Property.TABLE_DEFAULT_SCANTIME_VISIBILITY.getKey(),
"DEFLABEL");
+    
+    insertData(c);
+    queryData(c);
+    deleteData(c);
     
-    insertData();
-    queryData();
-    deleteData();
-    
-    insertDefaultData();
-    queryDefaultData();
+    insertDefaultData(c);
+    queryDefaultData(c);
     
   }
   
@@ -93,9 +82,9 @@ public class VisibilityTest extends Func
     m.putDelete(new Text(cf), new Text(cq), le);
   }
   
-  private void insertData() throws Exception {
+  private void insertData(Connector c) throws Exception {
     
-    BatchWriter bw = getConnector().createBatchWriter("vt", new BatchWriterConfig());
+    BatchWriter bw = c.createBatchWriter("vt", new BatchWriterConfig());
     Mutation m1 = new Mutation(new Text("row1"));
     
     mput(m1, "cf1", "cq1", "", "v1");
@@ -116,9 +105,9 @@ public class VisibilityTest extends Func
     bw.close();
   }
   
-  private void deleteData() throws Exception {
+  private void deleteData(Connector c) throws Exception {
     
-    BatchWriter bw = getConnector().createBatchWriter("vt", new BatchWriterConfig());
+    BatchWriter bw = c.createBatchWriter("vt", new BatchWriterConfig());
     Mutation m1 = new Mutation(new Text("row1"));
     
     mputDelete(m1, "cf1", "cq1", "");
@@ -145,11 +134,11 @@ public class VisibilityTest extends Func
     expected.put(nss("FOO"), nss("v11"));
     expected.put(nss("A", "FOO"), nss("v9"));
     
-    queryData(nss("A", "B", "FOO", "L", "M", "Z"), nss("A", "B", "FOO", "L", "M", "Z"), expected);
+    queryData(c, nss("A", "B", "FOO", "L", "M", "Z"), nss("A", "B", "FOO", "L", "M", "Z"),
expected);
   }
   
-  private void insertDefaultData() throws Exception {
-    BatchWriter bw = getConnector().createBatchWriter("vt2", new BatchWriterConfig());
+  private void insertDefaultData(Connector c) throws Exception {
+    BatchWriter bw = c.createBatchWriter("vt2", new BatchWriterConfig());
     Mutation m1 = new Mutation(new Text("row1"));
     
     mput(m1, "cf1", "cq1", "BASE", "v1");
@@ -175,7 +164,7 @@ public class VisibilityTest extends Func
     }
   }
   
-  private void queryData() throws Exception {
+  private void queryData(Connector c) throws Exception {
     Map<Set<String>,Set<String>> expected = new HashMap<Set<String>,Set<String>>();
     expected.put(nss(), nss("v1"));
     expected.put(nss("A"), nss("v2"));
@@ -196,16 +185,16 @@ public class VisibilityTest extends Func
     expected.put(nss("B", "FOO", "L"), nss("v12"));
     expected.put(nss("B", "FOO", "M"), nss("v12"));
     
-    queryData(nss("A", "B", "FOO", "L", "M", "Z"), nss("A", "B", "FOO", "L", "M", "Z"), expected);
-    queryData(nss("A", "B", "FOO", "L", "M", "Z"), nss("A", "B", "L", "M", "Z"), expected);
-    queryData(nss("A", "B", "FOO", "L", "M", "Z"), nss("A", "Z"), expected);
-    queryData(nss("A", "B", "FOO", "L", "M", "Z"), nss("Z"), expected);
-    queryData(nss("A", "B", "FOO", "L", "M", "Z"), nss(), expected);
+    queryData(c, nss("A", "B", "FOO", "L", "M", "Z"), nss("A", "B", "FOO", "L", "M", "Z"),
expected);
+    queryData(c, nss("A", "B", "FOO", "L", "M", "Z"), nss("A", "B", "L", "M", "Z"), expected);
+    queryData(c, nss("A", "B", "FOO", "L", "M", "Z"), nss("A", "Z"), expected);
+    queryData(c, nss("A", "B", "FOO", "L", "M", "Z"), nss("Z"), expected);
+    queryData(c, nss("A", "B", "FOO", "L", "M", "Z"), nss(), expected);
   }
   
-  private void queryData(Set<String> allAuths, Set<String> userAuths, Map<Set<String>,Set<String>>
expected) throws Exception {
+  private void queryData(Connector c, Set<String> allAuths, Set<String> userAuths,
Map<Set<String>,Set<String>> expected) throws Exception {
     
-    getConnector().securityOperations().changeUserAuthorizations(getPrincipal(), new Authorizations(nbas(userAuths)));
+    c.securityOperations().changeUserAuthorizations("root", new Authorizations(nbas(userAuths)));
     
     ArrayList<Set<String>> combos = new ArrayList<Set<String>>();
     uniqueCombos(combos, nss(), allAuths);
@@ -223,16 +212,16 @@ public class VisibilityTest extends Func
       }
       
       set1.retainAll(userAuths);
-      verify(set1, e);
+      verify(c, set1, e);
     }
     
   }
   
-  private void queryDefaultData() throws Exception {
+  private void queryDefaultData(Connector c) throws Exception {
     Scanner scanner;
     
     // should return no records
-    getConnector().securityOperations().changeUserAuthorizations(getPrincipal(), new Authorizations("BASE",
"DEFLABEL"));
+    c.securityOperations().changeUserAuthorizations("root", new Authorizations("BASE", "DEFLABEL"));
     scanner = getConnector().createScanner("vt2", new Authorizations());
     verifyDefault(scanner, 0);
     
@@ -253,11 +242,11 @@ public class VisibilityTest extends Func
       throw new Exception(" expected count !=0 " + expectedCount);
   }
   
-  private void verify(Set<String> auths, Set<String> expectedValues) throws Exception
{
+  private void verify(Connector c, Set<String> auths, Set<String> expectedValues)
throws Exception {
     ByteArraySet bas = nbas(auths);
     
     try {
-      verify(bas, expectedValues.toArray(new String[0]));
+      verify(c, bas, expectedValues.toArray(new String[0]));
     } catch (Exception e) {
       throw new Exception("Verification failed auths=" + auths + " exp=" + expectedValues,
e);
     }
@@ -271,8 +260,8 @@ public class VisibilityTest extends Func
     return bas;
   }
   
-  private void verify(ByteArraySet nss, String... expected) throws Exception {
-    Scanner scanner = getConnector().createScanner("vt", new Authorizations(nss));
+  private void verify(Connector c, ByteArraySet nss, String... expected) throws Exception
{
+    Scanner scanner = c.createScanner("vt", new Authorizations(nss));
     verify(scanner.iterator(), expected);
     
     BatchScanner bs = getConnector().createBatchScanner("vt", new Authorizations(nss), 3);



Mime
View raw message