accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [accumulo-instamo-archetype] branch main updated: Update instamo archetype for 2.0.0
Date Tue, 11 Aug 2020 02:53:09 GMT
This is an automated email from the ASF dual-hosted git repository.

ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-instamo-archetype.git


The following commit(s) were added to refs/heads/main by this push:
     new 322e8ac  Update instamo archetype for 2.0.0
322e8ac is described below

commit 322e8ac0461db74260e60f1e703cbbed7948f3ad
Author: Christopher Tubbs <ctubbsii@apache.org>
AuthorDate: Mon Aug 10 22:51:43 2020 -0400

    Update instamo archetype for 2.0.0
    
    * Drop Travis in favor of GitHub Actions for CI
    * Simplify example project built from the archetype
---
 .github/workflows/maven.yaml                       |  76 +++++++
 .travis.yml                                        |  37 ----
 README.md                                          |  16 +-
 pom.xml                                            |  27 +--
 .../META-INF/maven/archetype-metadata.xml          |  12 +-
 src/main/resources/archetype-resources/README.md   |  42 +---
 src/main/resources/archetype-resources/pom.xml     | 229 +++++----------------
 .../src/main/java/MapReduceExample.java            |  71 -------
 .../src/main/java/ReadData.java                    |  38 ++++
 .../src/main/java/ShellExample.java                |  84 --------
 .../src/main/java/WriteData.java                   |  45 ++++
 .../src/main/resources/log4j.properties            |  29 ---
 .../src/test/java/ExampleAccumuloUnitTest.java     | 129 ------------
 .../src/test/java/WriteReadIT.java                 |  34 +++
 .../src/test/resources/log4j.properties            |   7 +-
 15 files changed, 275 insertions(+), 601 deletions(-)

diff --git a/.github/workflows/maven.yaml b/.github/workflows/maven.yaml
new file mode 100644
index 0000000..91530bf
--- /dev/null
+++ b/.github/workflows/maven.yaml
@@ -0,0 +1,76 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+# This workflow will build a Java project with Maven
+# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
+
+name: QA
+
+on:
+  push:
+    branches: [ '*' ]
+  pull_request:
+    branches: [ '*' ]
+
+jobs:
+  mvn:
+    strategy:
+      matrix:
+        profile:
+          - {name: 'verify', args: 'verify'}
+      fail-fast: false
+    timeout-minutes: 60
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v2
+    - name: Set up JDK 11
+      uses: actions/setup-java@v1
+      with:
+        java-version: 11
+    - name: Cache local maven repository
+      uses: actions/cache@v2
+      with:
+        path: |
+          ~/.m2/repository/
+          !~/.m2/repository/org/apache/accumulo
+        key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+        restore-keys: ${{ runner.os }}-m2
+    - name: Build with Maven (${{ matrix.profile.name }})
+      run: mvn -B -V -e -ntp "-Dstyle.color=always" ${{ matrix.profile.args }}
+      env:
+        MAVEN_OPTS: -Djansi.force=true
+    - name: Upload unit test results
+      uses: actions/upload-artifact@v2
+      with:
+        name: surefire-reports-${{ matrix.profile.name }}
+        path: ./**/target/surefire-reports/
+        if-no-files-found: ignore
+    - name: Upload integration test results
+      uses: actions/upload-artifact@v2
+      with:
+        name: failsafe-reports-${{ matrix.profile.name }}
+        path: ./**/target/failsafe-reports/
+        if-no-files-found: ignore
+    - name: Upload mini test logs
+      uses: actions/upload-artifact@v2
+      with:
+        name: mini-tests-logs-${{ matrix.profile.name }}
+        path: ./**/target/**/mini-tests/**/logs/
+        if-no-files-found: ignore
+
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index c835afc..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-#  Licensed to the Apache Software Foundation (ASF) under one or more
-#  contributor license agreements.  See the NOTICE file distributed with
-#  this work for additional information regarding copyright ownership.
-#  The ASF licenses this file to You under the Apache License, Version 2.0
-#  (the "License"); you may not use this file except in compliance with
-#  the License.  You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-language: java
-notifications:
-  irc:
-    channels:
-      - "chat.freenode.net#accumulo"
-    use_notice: true
-    on_success: change
-    on_failure: always
-    template:
-      - "%{result} %{repository_slug} %{branch} (%{build_url}): %{message}"
-# speed up builds; don't use with install
-cache:
-  directories:
-    - $HOME/.m2
-# skip pre-fetch of maven dependencies by making install step a NOOP
-install: true
-jdk:
-  - openjdk8
-# clear any cache of accumulo artifacts, just in case; use https for central
-before_script:
-  - rm -rf $HOME/.m2/repository/org/apache/accumulo
-  - echo "<settings xmlns='http://maven.apache.org/SETTINGS/1.0.0'><mirrors><mirror><id>secure-central</id><url>https://repo.maven.apache.org/maven2</url><mirrorOf>central</mirrorOf></mirror></mirrors></settings>"
> $HOME/settings-custom.xml
-script: mvn --settings $HOME/settings-custom.xml clean verify
diff --git a/README.md b/README.md
index 5bd15e0..7170bbe 100644
--- a/README.md
+++ b/README.md
@@ -15,24 +15,26 @@
  limitations under the License.
 -->
 
-Instamo Archetype
-=======
+# Instamo Archetype
+
+## About
 
-About
------------
 This is a Maven Archetype which automates the customization of Instamo, a small
 amount of code meant to quickly spin up Accumulo processes in memory in an
 attempt to get out of the way of the developer who wants to run code against
 Accumulo.
 
-Usage
------------
+## 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
-DinteractiveMode=false`
+```bash
+mvn archetype:generate -DarchetypeGroupId=org.apache.accumulo -DarchetypeArtifactId=accumulo2-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)
+
diff --git a/pom.xml b/pom.xml
index a42df1d..9f3cc11 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,19 +15,20 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache</groupId>
     <artifactId>apache</artifactId>
-    <version>18</version>
+    <version>23</version>
   </parent>
 
   <groupId>org.apache.accumulo</groupId>
-  <artifactId>accumulo-instamo-archetype</artifactId>
-  <version>1.6.0-SNAPSHOT</version>
+  <artifactId>accumulo2-instamo-archetype</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
   <packaging>maven-archetype</packaging>
   <name>Accumulo Instamo Archetype</name>
+  <description>Instant Accumulo Client Project</description>
   <scm>
     <connection>scm:git:https://gitbox.apache.org/repos/asf/accumulo-instamo-archetype.git</connection>
     <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/accumulo-instamo-archetype.git</developerConnection>
@@ -43,7 +44,7 @@
       <extension>
         <groupId>org.apache.maven.archetype</groupId>
         <artifactId>archetype-packaging</artifactId>
-        <version>3.0.1</version>
+        <version>3.2.0</version>
       </extension>
     </extensions>
     <pluginManagement>
@@ -51,7 +52,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-archetype-plugin</artifactId>
-          <version>3.0.1</version>
+          <version>3.2.0</version>
         </plugin>
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
@@ -63,19 +64,5 @@
         </plugin>
       </plugins>
     </pluginManagement>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.rat</groupId>
-        <artifactId>apache-rat-plugin</artifactId>
-        <executions>
-          <execution>
-            <goals>
-              <goal>check</goal>
-            </goals>
-            <phase>verify</phase>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
   </build>
 </project>
diff --git a/src/main/resources/META-INF/maven/archetype-metadata.xml b/src/main/resources/META-INF/maven/archetype-metadata.xml
index dc3408a..5ebb795 100644
--- a/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -41,12 +41,6 @@
         <include>**/*.java</include>
       </includes>
     </fileSet>
-    <fileSet filtered="true" encoding="UTF-8">
-      <directory>src/main/resources</directory>
-      <includes>
-        <include>**/*.properties</include>
-      </includes>
-    </fileSet>
     <fileSet filtered="true" packaged="true"  encoding="UTF-8">
       <directory>src/test/java</directory>
       <includes>
@@ -54,6 +48,12 @@
       </includes>
     </fileSet>
     <fileSet filtered="true" encoding="UTF-8">
+      <directory>src/test/resources</directory>
+      <includes>
+        <include>**/*.properties</include>
+      </includes>
+    </fileSet>
+    <fileSet filtered="true" encoding="UTF-8">
       <directory></directory>
       <includes>
         <include>LICENSE</include>
diff --git a/src/main/resources/archetype-resources/README.md b/src/main/resources/archetype-resources/README.md
index bfd0f61..3c1278f 100644
--- a/src/main/resources/archetype-resources/README.md
+++ b/src/main/resources/archetype-resources/README.md
@@ -15,43 +15,15 @@
  limitations under the License.
 -->
 
-Instamo
-=======
+# Instamo
 
-Introduction
------------
+Instamo is a skeleton project that serves as an example client application for
+[Apache Accumulo](https://accumulo.apache.org) to help you get started.
 
-Instamo makes it easy to write some code and run it against a local, transient
-[Accumulo](http://accumulo.apache.org) instance in minutes.  No setup or
-installation is required.  This is possible if Java and Maven are already
-installed by following the steps below.
+Build the application and run its provided example integration tests by
+executing the following:
 
+```bash
+mvn verify
 ```
-vim src/test/java/${package}/ExampleAccumuloUnitTest.java
-mvn package
-```
-
-The maven package command will run the unit test.  After packing the code, you
-can also run one of the below applications.
-
-Map Reduce
-----------
 
-It's possible to run local map reduce jobs against the MiniAccumuloCluster
-instance.   There is an example of this in the src directory  The following
-command will run the map reduce example.
-
-```
-mvn exec:exec -P mapreduce
-```
-
-Accumulo Shell
------------
-
-The Accumulo shell is a simple application that, among other features, provides
-interactive access to tables in Accumulo. The following command will launch the
-shell against a local Accumulo instance.
-
-```
-mvn exec:exec -P shell
-```
diff --git a/src/main/resources/archetype-resources/pom.xml b/src/main/resources/archetype-resources/pom.xml
index 91e3bf0..feec04c 100644
--- a/src/main/resources/archetype-resources/pom.xml
+++ b/src/main/resources/archetype-resources/pom.xml
@@ -15,209 +15,84 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache</groupId>
+    <artifactId>apache</artifactId>
+    <version>23</version>
+  </parent>
   <groupId>${groupId}</groupId>
   <artifactId>${artifactId}</artifactId>
-  <packaging>jar</packaging>
   <version>${version}</version>
   <name>Instamo Example</name>
-  <url>http://accumulo.apache.org</url>
+  <url>https://accumulo.apache.org</url>
 
   <properties>
-    <accumulo.version>1.6.0-SNAPSHOT</accumulo.version>
-    <hadoop-one.version>1.2.1</hadoop-one.version>
-    <hadoop-two.version>2.1.0-beta</hadoop-two.version>
-    <slf4j.version>1.6.1</slf4j.version>
-    <maclass>${package}.MapReduceExample</maclass>
+    <accumulo.version>2.0.0</accumulo.version>
+    <maven.compiler.release>11</maven.compiler.release>
+    <maven.compiler.source>11</maven.compiler.source>
+    <maven.compiler.target>11</maven.compiler.target>
   </properties>
 
-  <profiles>
-	<!-- profile for building against Hadoop 1.2.x
-    Activate by not specifying hadoop.profile -->
-    <profile>
-      <id>hadoop-1.0</id>
-      <activation>
-        <property>
-          <name>!hadoop.profile</name>
-        </property>
-      </activation>
-      <properties>
-        <hadoop.version>${hadoop-one.version}</hadoop.version>
-		<httpclient.version>3.0.1</httpclient.version>
-		<slf4j.version>1.4.3</slf4j.version>
-      </properties>
-    </profile>
-    <!-- profile for building against Hadoop 2.1.x
-    Activate using: mvn -Dhadoop.profile=2.0 -->
-    <profile>
-      <id>hadoop-2.0</id>
-      <activation>
-        <property>
-          <name>hadoop.profile</name>
-          <value>2.0</value>
-        </property>
-      </activation>
-      <properties>
-        <hadoop.version>${hadoop-two.version}</hadoop.version>
-		<httpclient.version>3.1</httpclient.version>
-		<slf4j.version>1.6.1</slf4j.version>
-      </properties>
-    </profile>
-    <profile>
-      <id>shell</id>
-      <build>
-        <plugins>
-          <plugin>
-              <groupId>org.codehaus.mojo</groupId>
-              <artifactId>exec-maven-plugin</artifactId>
-              <version>1.2.1</version>
-              <configuration>
-              <executable>java</executable>
-              <arguments>
-                  <argument>-classpath</argument>
-                  <classpath />
-                  <argument>${package}.ShellExample</argument>
-              </arguments>
-              </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-    <profile>
-      <id>mapreduce</id>
-      <build>
-        <plugins>
-          <plugin>
-            <groupId>org.codehaus.mojo</groupId>
-            <artifactId>exec-maven-plugin</artifactId>
-            <version>1.2.1</version>
-            <configuration>
-              <executable>java</executable>
-              <arguments>
-                <argument>-classpath</argument>
-                <classpath />
-                <argument>${maclass}</argument>
-              </arguments>
-            </configuration>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-
   <dependencies>
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.11</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>org.apache.accumulo</groupId>
       <artifactId>accumulo-core</artifactId>
       <version>${accumulo.version}</version>
     </dependency>
     <dependency>
       <groupId>org.apache.accumulo</groupId>
-      <artifactId>accumulo-fate</artifactId>
-      <version>${accumulo.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.accumulo</groupId>
-      <artifactId>accumulo-server</artifactId>
-      <version>${accumulo.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.accumulo</groupId>
-      <artifactId>accumulo-test</artifactId>
-      <version>${accumulo.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.accumulo</groupId>
-      <artifactId>accumulo-start</artifactId>
-      <version>${accumulo.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.accumulo</groupId>
-      <artifactId>accumulo-trace</artifactId>
-      <version>${accumulo.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.accumulo</groupId>
       <artifactId>accumulo-minicluster</artifactId>
       <version>${accumulo.version}</version>
+      <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-client</artifactId>
-      <version>${hadoop.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.zookeeper</groupId>
-      <artifactId>zookeeper</artifactId>
-      <version>3.3.6</version>
-      <exclusions>
-        <exclusion>
-          <groupId>com.sun.jmx</groupId>
-          <artifactId>jmxri</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>com.sun.jdmk</groupId>
-          <artifactId>jmxtools</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>javax.jms</groupId>
-          <artifactId>jms</artifactId>
-        </exclusion>
-      </exclusions>
-    </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>2.4</version>
-    </dependency>
-    <dependency>
-      <groupId>com.google.guava</groupId>
-      <artifactId>guava</artifactId>
-      <version>14.0.1</version>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <version>${slf4j.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-log4j12</artifactId>
-      <version>${slf4j.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>commons-cli</groupId>
-      <artifactId>commons-cli</artifactId>
-      <version>1.2</version>
-    </dependency>
-    <dependency>
-      <groupId>commons-codec</groupId>
-      <artifactId>commons-codec</artifactId>
-      <version>1.7</version>
-    </dependency>
-    <dependency>
-      <groupId>commons-httpclient</groupId>
-      <artifactId>commons-httpclient</artifactId>
-      <version>${httpclient.version}</version>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.13</version>
+      <scope>test</scope>
     </dependency>
   </dependencies>
-
   <build>
     <plugins>
       <plugin>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>2.0.2</version>
-        <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
-        </configuration>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-failsafe-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>run-integration-tests</id>
+            <goals>
+              <goal>integration-test</goal>
+              <goal>verify</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.accumulo</groupId>
+        <artifactId>accumulo2-maven-plugin</artifactId>
+        <version>1.0.0</version>
+        <dependencies>
+          <dependency>
+            <groupId>org.apache.accumulo</groupId>
+            <artifactId>accumulo-minicluster</artifactId>
+            <version>${accumulo.version}</version>
+          </dependency>
+        </dependencies>
+        <executions>
+          <execution>
+            <id>run-plugin</id>
+            <goals>
+              <goal>start</goal>
+              <goal>stop</goal>
+            </goals>
+            <configuration>
+              <instanceName>it-instance-maven</instanceName>
+              <rootPassword>ITSecret</rootPassword>
+            </configuration>
+          </execution>
+        </executions>
       </plugin>
     </plugins>
   </build>
diff --git a/src/main/resources/archetype-resources/src/main/java/MapReduceExample.java b/src/main/resources/archetype-resources/src/main/java/MapReduceExample.java
deleted file mode 100644
index 3e0329c..0000000
--- a/src/main/resources/archetype-resources/src/main/java/MapReduceExample.java
+++ /dev/null
@@ -1,71 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package ${package};
-
-import java.io.File;
-import java.util.UUID;
-
-import org.apache.accumulo.minicluster.MiniAccumuloCluster;
-import org.apache.accumulo.test.continuous.ContinuousIngest;
-import org.apache.accumulo.test.continuous.ContinuousVerify;
-import org.apache.commons.io.FileUtils;
-
-/**
- * An example of running local map reduce against MiniAccumuloCluster
- */
-public class MapReduceExample {
-  
-  public static void run(String instanceName, String zookeepers, String rootPassword, String
args[]) throws Exception {
-    
-    // run continuous ingest to create data. This is not a map reduce job
-    ContinuousIngest.main(new String[] {"-i", instanceName, "-z", zookeepers, "-u", "root",
"-p", rootPassword, "--table", "ci", "--num", "5000000",
-        "--batchMemory", "1000000"});
-    
-    String outputDir = FileUtils.getTempDirectoryPath() + File.separator + "ci_verify" +
UUID.randomUUID().toString();
-    
-    try {
-      // run verify map reduce job locally. This jobs looks for holes in the linked list
create by continuous ingest
-      ContinuousVerify.main(new String[] {"-D", "mapred.job.tracker=local", "-D", "fs.default.name=file:///",
"-i", instanceName, "-z", zookeepers, "-u",
-          "root", "-p", rootPassword, "--table", "ci", "--output", outputDir, "--maxMappers",
"4", "--reducers", "1"});
-    } finally {
-      // delete output dir of mapreduce job
-      FileUtils.deleteQuietly(new File(outputDir));
-    }
-  }
-
-  public static void main(String[] args) throws Exception {
-    File tmpDir = new File(FileUtils.getTempDirectory(), "macc-" + UUID.randomUUID().toString());
-    
-    try {
-      MiniAccumuloCluster la = new MiniAccumuloCluster(tmpDir, "pass1234");
-      la.start();
-      
-      System.out.println("${symbol_escape}n   ---- Running Mapred Against Accumulo${symbol_escape}n");
-      
-      run(la.getInstanceName(), la.getZooKeepers(), "pass1234", args);
-      
-      System.out.println("${symbol_escape}n   ---- Ran Mapred Against Accumulo${symbol_escape}n");
-      
-      la.stop();
-    } finally {
-      FileUtils.deleteQuietly(tmpDir);
-    }
-  }
-}
diff --git a/src/main/resources/archetype-resources/src/main/java/ReadData.java b/src/main/resources/archetype-resources/src/main/java/ReadData.java
new file mode 100644
index 0000000..1a02a56
--- /dev/null
+++ b/src/main/resources/archetype-resources/src/main/java/ReadData.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ${package};
+
+import org.apache.accumulo.core.client.Accumulo;
+import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Range;
+import org.apache.accumulo.core.security.Authorizations;
+
+/**
+ * Reads all data between two rows
+ */
+public class ReadData {
+  // usage: java instamo.ReadData /path/to/client.properties
+  public static void main(String[] args) throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(args[0]).build();
+        Scanner scan = client.createScanner("hellotable", Authorizations.EMPTY)) {
+      scan.setRange(new Range(new Key("row_0"), new Key("row_1002")));
+      scan.forEach(System.out::println);
+    }
+  }
+}
diff --git a/src/main/resources/archetype-resources/src/main/java/ShellExample.java b/src/main/resources/archetype-resources/src/main/java/ShellExample.java
deleted file mode 100644
index 7c3406e..0000000
--- a/src/main/resources/archetype-resources/src/main/java/ShellExample.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package ${package};
-
-import com.google.common.io.Files;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.InterruptedException;
-import java.lang.Runnable;
-
-import org.apache.accumulo.core.util.shell.Shell;
-import org.apache.accumulo.minicluster.MiniAccumuloCluster;
-
-public class ShellExample implements Runnable {
-  
-  @Override
-  public void run() {
-    File tempDir = null;
-    MiniAccumuloCluster mac = null;
-    
-    try {
-      tempDir = Files.createTempDir();
-      tempDir.deleteOnExit();
-
-      final String PASSWORD = "pass1234";
-
-      mac = new MiniAccumuloCluster(tempDir, PASSWORD);
-
-      mac.start();
-
-      String[] args = new String[] {"-u", "root", "-p", PASSWORD, "-z",
-        mac.getInstanceName(), mac.getZooKeepers()};
-
-      Shell.main(args);
-
-    } catch (InterruptedException e) {
-      System.err.println("Error starting MiniAccumuloCluster: " + e.getMessage());
-      System.exit(1);
-    } catch (IOException e) {
-      System.err.println("Error starting MiniAccumuloCluster: " + e.getMessage());
-      System.exit(1);
-    } finally {
-      if (null != tempDir) {
-        tempDir.delete();
-      }
-
-      if (null != mac) {
-        try {
-          mac.stop();
-        } catch (InterruptedException e) {
-          System.err.println("Error stopping MiniAccumuloCluster: " + e.getMessage());
-          System.exit(1);
-        } catch (IOException e) {
-          System.err.println("Error stopping MiniAccumuloCluster: " + e.getMessage());
-          System.exit(1);
-        }
-      }
-    }
-  }
-
-  public static void main(String[] args) {
-    System.out.println("\n   ---- Initializing Accumulo Shell\n");
-
-    ShellExample shell = new ShellExample();
-    shell.run();
-    
-    System.exit(0);
-  }
-}
diff --git a/src/main/resources/archetype-resources/src/main/java/WriteData.java b/src/main/resources/archetype-resources/src/main/java/WriteData.java
new file mode 100644
index 0000000..6c918f1
--- /dev/null
+++ b/src/main/resources/archetype-resources/src/main/java/WriteData.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ${package};
+
+import org.apache.accumulo.core.client.Accumulo;
+import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.client.BatchWriter;
+import org.apache.accumulo.core.data.Mutation;
+import org.apache.accumulo.core.data.Value;
+
+/**
+ * Inserts 10K rows (50K entries) into accumulo with each row having 5 entries.
+ */
+public class WriteData {
+  // usage: java instamo.InsertData /path/to/client.properties
+  public static void main(String[] args) throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(args[0]).build()) {
+      client.tableOperations().create("hellotable");
+      try (BatchWriter bw = client.createBatchWriter("hellotable")) {
+        for (int i = 0; i < 10000; i++) {
+          Mutation m = new Mutation(String.format("row_%d", i));
+          for (int j = 0; j < 5; j++) {
+            m.put("colfam", String.format("colqual_%d", j),
+                new Value((String.format("value_%d_%d", i, j)).getBytes()));
+          }
+          bw.addMutation(m);
+        }
+      }
+    }
+  }
+}
diff --git a/src/main/resources/archetype-resources/src/main/resources/log4j.properties b/src/main/resources/archetype-resources/src/main/resources/log4j.properties
deleted file mode 100644
index e9f9124..0000000
--- a/src/main/resources/archetype-resources/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,29 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-log4j.rootLogger=INFO, CA
-log4j.appender.CA=org.apache.log4j.ConsoleAppender
-log4j.appender.CA.layout=org.apache.log4j.PatternLayout
-log4j.appender.CA.layout.ConversionPattern=[%t] %-5p %c %x - %m%n
-
-log4j.logger.org.apache.zookeeper=ERROR,CA
-log4j.logger.org.apache.accumulo.core.client.impl.ServerClient=ERROR,CA
-log4j.logger.org.apache.accumulo.core.util.shell.Shell.audit=WARN,CA
-log4j.logger.org.apache.commons.vfs2.impl.DefaultFileSystemManager=WARN,CA
diff --git a/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
b/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
deleted file mode 100644
index 697c8b0..0000000
--- a/src/main/resources/archetype-resources/src/test/java/ExampleAccumuloUnitTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-#set( $symbol_pound = '#' )
-#set( $symbol_dollar = '$' )
-#set( $symbol_escape = '\' )
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-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.apache.accumulo.minicluster.MiniAccumuloConfig;
-import org.apache.log4j.Logger;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-/**
- * An example unit test that shows how to use MiniAccumuloCluster in a unit test
- */
-
-public class ExampleAccumuloUnitTest {
-  private static final Logger log = Logger.getLogger(ExampleAccumuloUnitTest.class);
-  
-  public static TemporaryFolder folder = new TemporaryFolder();
-  
-  private static MiniAccumuloCluster accumulo;
-
-  @BeforeClass
-  public static void setupMiniCluster() throws Exception {
-
-    folder.create();
-    
-    log.debug("Using " + folder.getRoot());
-    
-    MiniAccumuloConfig config = new MiniAccumuloConfig(folder.getRoot(), "superSecret");
-    config.setNumTservers(1);
-    
-    
-    accumulo = new MiniAccumuloCluster(config);
-    
-    accumulo.start();
-    
-  }
-
-  @Test(timeout = 30000)
-  public void test() throws Exception {
-    // 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) {
-      log.debug(entry.getKey() + " " + entry.getValue());
-    }
-   
-    //TODO use scanner to find common enemy ids between Alice and Bob, then
-    //use BatchScanner to look up their names
- 
-    conn.tableOperations().delete("foo");
-  }
-  
-  @AfterClass
-  public static void tearDownMiniCluster() throws Exception {
-    accumulo.stop();
-    folder.delete();
-  }
-}
diff --git a/src/main/resources/archetype-resources/src/test/java/WriteReadIT.java b/src/main/resources/archetype-resources/src/test/java/WriteReadIT.java
new file mode 100644
index 0000000..14d2d3b
--- /dev/null
+++ b/src/main/resources/archetype-resources/src/test/java/WriteReadIT.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package ${package};
+
+import org.junit.Test;
+
+/**
+ * An example unit test that shows how to use MiniAccumuloCluster in a unit test
+ */
+public class WriteReadIT {
+
+  @Test
+  public void test() throws Exception {
+    String[] clientPropsFilename = {System.getProperty("user.dir")
+        + "/target/accumulo2-maven-plugin/it-instance-maven/conf/accumulo-client.properties"};
+    WriteData.main(clientPropsFilename);
+    ReadData.main(clientPropsFilename);
+  }
+
+}
diff --git a/src/main/resources/archetype-resources/src/test/resources/log4j.properties b/src/main/resources/archetype-resources/src/test/resources/log4j.properties
index e9f9124..2d0091a 100644
--- a/src/main/resources/archetype-resources/src/test/resources/log4j.properties
+++ b/src/main/resources/archetype-resources/src/test/resources/log4j.properties
@@ -18,12 +18,7 @@
 # limitations under the License.
 
 
-log4j.rootLogger=INFO, CA
+log4j.rootLogger=DEBUG, CA
 log4j.appender.CA=org.apache.log4j.ConsoleAppender
 log4j.appender.CA.layout=org.apache.log4j.PatternLayout
 log4j.appender.CA.layout.ConversionPattern=[%t] %-5p %c %x - %m%n
-
-log4j.logger.org.apache.zookeeper=ERROR,CA
-log4j.logger.org.apache.accumulo.core.client.impl.ServerClient=ERROR,CA
-log4j.logger.org.apache.accumulo.core.util.shell.Shell.audit=WARN,CA
-log4j.logger.org.apache.commons.vfs2.impl.DefaultFileSystemManager=WARN,CA


Mime
View raw message