accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1488030 - in /accumulo/contrib/instamo-archetype/trunk: ./ src/main/resources/META-INF/maven/ src/main/resources/archetype-resources/ src/main/resources/archetype-resources/src/main/java/ src/main/resources/archetype-resources/src/test/java/
Date Thu, 30 May 2013 21:49:44 GMT
Author: kturner
Date: Thu May 30 21:49:44 2013
New Revision: 1488030

URL: http://svn.apache.org/r1488030
Log:
ACCUMULO-1166 improved instamo example unit test

Removed:
    accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/AccumuloApp.java
Modified:
    accumulo/contrib/instamo-archetype/trunk/   (props changed)
    accumulo/contrib/instamo-archetype/trunk/README.md   (contents, props changed)
    accumulo/contrib/instamo-archetype/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml
  (contents, props changed)
    accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/README.md
  (contents, props changed)
    accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/pom.xml
  (contents, props changed)
    accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/
  (props changed)
    accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/
  (props changed)
    accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
  (contents, props changed)

Propchange: accumulo/contrib/instamo-archetype/trunk/
------------------------------------------------------------------------------
  Merged /accumulo/contrib/instamo-archetype/branches/1.5:r1488024

Modified: accumulo/contrib/instamo-archetype/trunk/README.md
URL: http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/README.md?rev=1488030&r1=1488029&r2=1488030&view=diff
==============================================================================
--- accumulo/contrib/instamo-archetype/trunk/README.md (original)
+++ accumulo/contrib/instamo-archetype/trunk/README.md Thu May 30 21:49:44 2013
@@ -15,7 +15,7 @@ to your local repository.
 
 Then, change to a new directory and run 
 
-`mvn archetype:generate -DarchetypeGroupId=org.apache.accumulo -DarchetypeArtifactId=instamo-archetype`
+`mvn archetype:generate -DarchetypeGroupId=org.apache.accumulo -DarchetypeArtifactId=instamo-archetype
-DinteractiveMode=false`
 
 Maven will prompt you to enter the rest of the necessary configuration
 parameters (e.g. groupId, artifactId, version and Java package)

Propchange: accumulo/contrib/instamo-archetype/trunk/README.md
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: accumulo/contrib/instamo-archetype/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml
URL: http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml?rev=1488030&r1=1488029&r2=1488030&view=diff
==============================================================================
Binary files - no diff available.

Propchange: accumulo/contrib/instamo-archetype/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: accumulo/contrib/instamo-archetype/trunk/src/main/resources/META-INF/maven/archetype-metadata.xml
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May 30 21:49:44 2013
@@ -1 +1 @@
-application/xml
+text/xml

Modified: accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/README.md
URL: http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/README.md?rev=1488030&r1=1488029&r2=1488030&view=diff
==============================================================================
--- accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/README.md
(original)
+++ accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/README.md
Thu May 30 21:49:44 2013
@@ -10,11 +10,12 @@ installation is required.  This is possi
 installed by following the steps below.
 
 ```
-vim src/main/java/${package}/AccumuloApp.java
+vim src/test/java/${package}/ExampleAccumuloUnitTest.java
 mvn package
 ```
 
-After packing the code, you can run one of the below applications.
+The maven package command will run the unit test.  After packing the code, you
+can also run one of the below applications.
 
 Map Reduce
 ----------

Propchange: accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/README.md
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/pom.xml?rev=1488030&r1=1488029&r2=1488030&view=diff
==============================================================================
Binary files - no diff available.

Propchange: accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/pom.xml
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May 30 21:49:44 2013
@@ -1 +1 @@
-application/xml
+text/xml

Propchange: accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/main/java/
------------------------------------------------------------------------------
  Merged /accumulo/contrib/instamo-archetype/branches/1.5/src/main/resources/archetype-resources/src/main/java:r1488024

Propchange: accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/
------------------------------------------------------------------------------
  Merged /accumulo/contrib/instamo-archetype/branches/1.5/src/main/resources/archetype-resources/src/test/java:r1488024

Modified: accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
URL: http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java?rev=1488030&r1=1488029&r2=1488030&view=diff
==============================================================================
--- accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
(original)
+++ accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
Thu May 30 21:49:44 2013
@@ -19,8 +19,21 @@
  */
 package ${package};
 
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.Constants;
+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.Instance;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.ZooKeeperInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+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.minicluster.MiniAccumuloCluster;
+
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -49,7 +62,54 @@ public class ExampleAccumuloUnitTest {
 
   @Test(timeout = 30000)
   public void test() throws Exception {
-    AccumuloApp.run(accumulo.getInstanceName(), accumulo.getZooKeepers(), new PasswordToken("superSecret"),
new String[0]);
+    // edit this method to play with Accumulo
+
+    Instance instance = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
+    
+    Connector conn = instance.getConnector("root", new PasswordToken("superSecret"));
+    
+    conn.tableOperations().create("foo");
+    
+    BatchWriter bw = conn.createBatchWriter("foo", new BatchWriterConfig());
+    Mutation m = new Mutation("1234");
+    m.put("name", "first", "Alice");
+    m.put("friend", "5678", "");
+    m.put("enemy", "5555", "");
+    m.put("enemy", "9999", "");
+    bw.addMutation(m);
+
+    m = new Mutation("5678");
+    m.put("name", "first", "Bob");
+    m.put("friend", "1234", "");
+    m.put("enemy", "5555", "");
+    m.put("enemy", "9999", "");
+    bw.addMutation(m);
+
+    m = new Mutation("9999");
+    m.put("name", "first", "Eve");
+    m.put("friend", "5555", "");
+    m.put("enemy", "1234", "");
+    m.put("enemy", "5678", "");
+    bw.addMutation(m);
+
+    m = new Mutation("5555");
+    m.put("name", "first", "Mallory");
+    m.put("friend", "9999", "");
+    m.put("enemy", "1234", "");
+    m.put("enemy", "5678", "");
+    bw.addMutation(m);
+
+    bw.close();
+    
+    Scanner scanner = conn.createScanner("foo", Constants.NO_AUTHS);
+    for (Entry<Key,Value> entry : scanner) {
+      System.out.println(entry.getKey() + " " + entry.getValue());
+    }
+   
+    //TODO use scanner to find common enemie ids between Alice and Bob, then
+    //use BatchScanner to look up their names
+ 
+    conn.tableOperations().delete("foo");
   }
   
   @AfterClass
@@ -57,5 +117,4 @@ public class ExampleAccumuloUnitTest {
     accumulo.stop();
     folder.delete();
   }
-  
 }

Propchange: accumulo/contrib/instamo-archetype/trunk/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message