You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2013/05/31 00:11:42 UTC
svn commit: r1488037 - in /accumulo/contrib/instamo-archetype/branches/1.4:
./ 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/t...
Author: kturner
Date: Thu May 30 22:11:41 2013
New Revision: 1488037
URL: http://svn.apache.org/r1488037
Log:
ACCUMULO-1166 improved instamo example unit test
Removed:
accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/src/main/java/AccumuloApp.java
Modified:
accumulo/contrib/instamo-archetype/branches/1.4/ (props changed)
accumulo/contrib/instamo-archetype/branches/1.4/README.md (contents, props changed)
accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/META-INF/maven/archetype-metadata.xml (contents, props changed)
accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/README.md (contents, props changed)
accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/pom.xml (contents, props changed)
accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/src/main/java/ (props changed)
accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/src/test/java/ (props changed)
accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java (contents, props changed)
Propchange: accumulo/contrib/instamo-archetype/branches/1.4/
------------------------------------------------------------------------------
Merged /accumulo/contrib/instamo-archetype/branches/1.5:r1488024
Modified: accumulo/contrib/instamo-archetype/branches/1.4/README.md
URL: http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/branches/1.4/README.md?rev=1488037&r1=1488036&r2=1488037&view=diff
==============================================================================
--- accumulo/contrib/instamo-archetype/branches/1.4/README.md (original)
+++ accumulo/contrib/instamo-archetype/branches/1.4/README.md Thu May 30 22:11:41 2013
@@ -13,7 +13,9 @@ Usage
Checkout this project and run a `mvn install`. This will install the archetype
to your local repository.
-Then, change to a new directory and run `mvn archetype:generate
--DarchetypeGroupId=org.apache.accumulo -DarchetypeArtifactId=instamo-archetype`
+Then, change to a new directory and run
+
+`mvn archetype:generate -DarchetypeGroupId=org.apache.accumulo -DarchetypeArtifactId=instamo-archetype -DinteractiveMode=false`
+
and 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/branches/1.4/README.md
------------------------------------------------------------------------------
svn:eol-style = native
Modified: accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/META-INF/maven/archetype-metadata.xml
URL: http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/META-INF/maven/archetype-metadata.xml?rev=1488037&r1=1488036&r2=1488037&view=diff
==============================================================================
Binary files - no diff available.
Propchange: accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/META-INF/maven/archetype-metadata.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/META-INF/maven/archetype-metadata.xml
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May 30 22:11:41 2013
@@ -1 +1 @@
-application/xml
+text/xml
Modified: accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/README.md
URL: http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/README.md?rev=1488037&r1=1488036&r2=1488037&view=diff
==============================================================================
--- accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/README.md (original)
+++ accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/README.md Thu May 30 22:11:41 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/branches/1.4/src/main/resources/archetype-resources/README.md
------------------------------------------------------------------------------
svn:eol-style = native
Modified: accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/pom.xml?rev=1488037&r1=1488036&r2=1488037&view=diff
==============================================================================
Binary files - no diff available.
Propchange: accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/pom.xml
------------------------------------------------------------------------------
--- svn:mime-type (original)
+++ svn:mime-type Thu May 30 22:11:41 2013
@@ -1 +1 @@
-application/xml
+text/xml
Propchange: accumulo/contrib/instamo-archetype/branches/1.4/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/branches/1.4/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/branches/1.4/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
URL: http://svn.apache.org/viewvc/accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java?rev=1488037&r1=1488036&r2=1488037&view=diff
==============================================================================
--- accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java (original)
+++ accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java Thu May 30 22:11:41 2013
@@ -19,7 +19,19 @@
*/
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.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.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;
@@ -48,7 +60,54 @@ public class ExampleAccumuloUnitTest {
@Test(timeout = 30000)
public void test() throws Exception {
- AccumuloApp.run(accumulo.getInstanceName(), accumulo.getZooKeepers(), "superSecret".getBytes(), new String[0]);
+ // edit this method to play with Accumulo
+
+ Instance instance = new ZooKeeperInstance(accumulo.getInstanceName(), accumulo.getZooKeepers());
+
+ Connector conn = instance.getConnector("root", "superSecret");
+
+ conn.tableOperations().create("foo");
+
+ BatchWriter bw = conn.createBatchWriter("foo", 10000000, 60000, 3);
+ 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
@@ -56,5 +115,4 @@ public class ExampleAccumuloUnitTest {
accumulo.stop();
folder.delete();
}
-
}
Propchange: accumulo/contrib/instamo-archetype/branches/1.4/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
------------------------------------------------------------------------------
svn:eol-style = native