Return-Path: X-Original-To: apmail-accumulo-user-archive@www.apache.org Delivered-To: apmail-accumulo-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A3129E020 for ; Wed, 29 May 2013 17:29:56 +0000 (UTC) Received: (qmail 69918 invoked by uid 500); 29 May 2013 17:29:55 -0000 Delivered-To: apmail-accumulo-user-archive@accumulo.apache.org Received: (qmail 69832 invoked by uid 500); 29 May 2013 17:29:55 -0000 Mailing-List: contact user-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@accumulo.apache.org Delivered-To: mailing list user@accumulo.apache.org Received: (qmail 69818 invoked by uid 99); 29 May 2013 17:29:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 May 2013 17:29:54 +0000 X-ASF-Spam-Status: No, hits=3.4 required=5.0 tests=HK_RANDOM_ENVFROM,HTML_MESSAGE,MANY_SPAN_IN_TEXT,RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of aarongmldt@gmail.com designates 74.125.83.41 as permitted sender) Received: from [74.125.83.41] (HELO mail-ee0-f41.google.com) (74.125.83.41) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 May 2013 17:29:47 +0000 Received: by mail-ee0-f41.google.com with SMTP id d4so5483529eek.14 for ; Wed, 29 May 2013 10:29:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=oYjG4e43m+/uzwOnrKfaY8cqgF18uTfdH4WmQSd0yWo=; b=KjJ/ypVKB7QJ39w16FwGZfv3aKIsZMAdkj2k9sjxL8+ZfT7cUdHKn4+4M+buTDfbYN wMUVUjnCLCe4AB7a+BAsYX5CTgxnANrn9wByEo3dkKpLcqiVfmYWpCbi+dGPOkmvbg4C yPy3zK3fIuOdW+HJ4rnHS1kq/3NxWrN2WQlgD/HuJZ6M76i14hi7g3vqpKvf4OEkqrm8 BeJuExqJ5Nb2tMEcZiEVMgug4FXqoa3eKFcI9X1LQh+OZ5AvTl4l4AI3L5QKY3mpBJqk raOilmTbzsokwql1J7rZaTcT5OxuP00S2bX4u8cMJB9xSaPRHLFtX4i6MeWARGf/Pj1Z smeA== MIME-Version: 1.0 X-Received: by 10.15.48.129 with SMTP id h1mr4967481eew.65.1369848566986; Wed, 29 May 2013 10:29:26 -0700 (PDT) Received: by 10.15.50.133 with HTTP; Wed, 29 May 2013 10:29:26 -0700 (PDT) In-Reply-To: <1369791515728-4355.post@n5.nabble.com> References: <1369790702661-4353.post@n5.nabble.com> <34969EA2-05AC-47B8-A57E-0086513B7674@gmail.com> <1369791515728-4355.post@n5.nabble.com> Date: Wed, 29 May 2013 13:29:26 -0400 Message-ID: Subject: Re: POM dependencies for an Accumulo Client From: Aaron To: user@accumulo.apache.org Content-Type: multipart/alternative; boundary=001a11c325743b673604dddeb9ee X-Virus-Checked: Checked by ClamAV on apache.org --001a11c325743b673604dddeb9ee Content-Type: text/plain; charset=ISO-8859-1 Wow..so, I made you copy a bunch of unnecessary things. I wrote a bunch of simple unit tests, and came up with a minimal set of dependancies: log4j log4j 1.2.17 org.apache.accumulo accumulo-core ${accumulo.version} org.apache.hadoop hadoop-common ${hadoop.version} junit junit 4.11 test The accumulo-core & hadoop-common pull is all the necessary extras like zookeeper, and the other accumulo artifacts. Below is my simple Unit tests. public class CRUDTest { private static final Logger log = Logger.getLogger(CRUDTest.class); private static final String zookeeperHost = "172.100.100.101"; private static final String instanceName = "testinstance"; private static final String root = "root"; private static final String pass = "accumulopass"; private static final String tableName = "testtable"; private static final String testuser = "testuser"; private static final String testpass = "testpass"; private static final String auths = "testauth"; private Instance instance; private Connector testUserConn; @Before public void setup() { this.instance = new ZooKeeperInstance(instanceName, zookeeperHost, 20000); try { Connector rootConn = instance.getConnector(root, new PasswordToken(pass)); log.info("Have the connector"); TableOperations tableOps = rootConn.tableOperations(); if (!tableOps.exists(tableName)) tableOps.create(tableName); // Make sure our user has the proper permissions/auths SecurityOperations securOps = rootConn.securityOperations(); securOps.createLocalUser(testuser, new PasswordToken(testpass)); securOps.changeUserAuthorizations(testuser, new Authorizations(auths)); securOps.grantTablePermission(testuser, tableName, TablePermission.WRITE); securOps.grantTablePermission(testuser, tableName, TablePermission.READ); this.testUserConn = instance.getConnector(testuser, new PasswordToken( testpass)); } catch (AccumuloException | AccumuloSecurityException | TableExistsException e) { e.printStackTrace(); } } @After public void teardown() { try { Connector rootConn = this.instance.getConnector(root, new PasswordToken(pass )); TableOperations tableOps = rootConn.tableOperations(); SecurityOperations securOps =rootConn.securityOperations(); tableOps.delete(tableName); securOps.dropLocalUser(testuser); } catch (AccumuloException | AccumuloSecurityException | TableNotFoundException e) { e.printStackTrace(); } } @Test public void testSimpleCreate() { String rowId = UUID.randomUUID().toString(); Text rowID = new Text (rowId); Text colFam = new Text("myColFam"); Text colQual = new Text("myColQual"); ColumnVisibility vis = new ColumnVisibility(auths); String strValue = UUID.randomUUID().toString(); log.info("strValue = " + strValue); Value value = new Value(strValue.getBytes()); Mutation mutation= new Mutation(rowID); mutation.put(colFam, colQual, vis, System.currentTimeMillis(), value); BatchWriterConfig config = new BatchWriterConfig(); try { BatchWriter writer = this.testUserConn.createBatchWriter(tableName, config); writer.addMutation(mutation); writer.flush(); writer.close(); // Now let's see if we can see it Scanner scan = this.testUserConn.createScanner(tableName, newAuthorizations( auths)); Range range = new Range(rowId); scan.setRange(range); scan.fetchColumnFamily(colFam); for(Entry entry : scan) { log.info("key = " + entry.getKey().toString()); log.info("value = " + entry.getValue().toString()); Assert.assertTrue(strValue.equals(entry.getValue().toString())); } scan.close(); } catch (TableNotFoundException | MutationsRejectedException e) { e.printStackTrace(); } } @Test public void testSimpleUpdate() { Text rowID = new Text ("rowid_update"); Text colFam = new Text("myColFam"); Text colQual = new Text("myColQual"); ColumnVisibility vis = new ColumnVisibility(auths); String strValue = UUID.randomUUID().toString(); log.info("strValue = " + strValue); Value value = new Value(strValue.getBytes()); Mutation origMutation= new Mutation(rowID); origMutation.put(colFam, colQual, vis, System.currentTimeMillis(), value); BatchWriterConfig config = new BatchWriterConfig(); try { BatchWriter writer = this.testUserConn.createBatchWriter(tableName, config); // Add the entry to be modified writer.addMutation(origMutation); writer.flush(); // Now let's change the value/timestamp Mutation updateMutation= new Mutation(rowID); updateMutation.put(colFam, colQual, vis, System.currentTimeMillis(), new Value(UUID.randomUUID().toString().getBytes())); writer.addMutation(updateMutation); writer.flush(); writer.close(); // Now let's see if we can see it Scanner scan = this.testUserConn.createScanner(tableName, newAuthorizations( auths)); Range range = new Range(rowID); scan.setRange(range); scan.fetchColumnFamily(colFam); for(Entry entry : scan) { log.info("key = " + entry.getKey().toString()); log.info("value = " + entry.getValue().toString()); Assert.assertFalse(strValue.equals(entry.getValue().toString())); } scan.close(); } catch (TableNotFoundException | MutationsRejectedException e) { e.printStackTrace(); } } @Test public void testSimpleDelete() { Text rowID = new Text ("rowid_delete"); Text colFam = new Text("myColFam"); Text colQual = new Text("myColQual"); ColumnVisibility vis = new ColumnVisibility("public"); String strValue = UUID.randomUUID().toString(); log.info("strValue = " + strValue); Value value = new Value(strValue.getBytes()); BatchWriterConfig config = new BatchWriterConfig(); try { BatchWriter writer = this.testUserConn.createBatchWriter(tableName, config); // Add the entry to be modified Mutation origMutation= new Mutation(rowID); origMutation.put(colFam, colQual, vis, System.currentTimeMillis(), value); writer.addMutation(origMutation); writer.flush(); // Now let's see if we can see it Scanner scan = this.testUserConn.createScanner(tableName, newAuthorizations( auths)); Range range = new Range(rowID); scan.setRange(range); scan.fetchColumnFamily(colFam); for(Entry entry : scan) { log.info("key = " + entry.getKey().toString()); log.info("value = " + entry.getValue().toString()); Assert.assertTrue(strValue.equals(entry.getValue().toString())); } // Delete it BatchDeleter deleter = this.testUserConn.createBatchDeleter(tableName, newAuthorizations( auths), 1, config); List ranges = Arrays.asList(new Range(rowID)); deleter.setRanges(ranges); deleter.delete(); scan.fetchColumnFamily(colFam); for(Entry entry : scan) { log.info("key = " + entry.getKey().toString()); log.info("value = " + entry.getValue().toString()); } scan.close(); } catch (TableNotFoundException | MutationsRejectedException e) { e.printStackTrace(); } } } On Tue, May 28, 2013 at 9:38 PM, albertoaflores wrote: > Thanks Aaron, I'll give these a shot... > > > > -- > View this message in context: > http://apache-accumulo.1065345.n5.nabble.com/POM-dependencies-for-an-Accumulo-Client-tp4182p4355.html > Sent from the Users mailing list archive at Nabble.com. > --001a11c325743b673604dddeb9ee Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Wow..so, I made you copy a bunch of unnecessary things. = =A0I wrote a bunch of simple unit tests, and came up with a minimal set of = dependancies:

<dependencie= s>

<depen= dency>

<grou= pId>log4j</group= Id>

<arti= factId>log4j</ar= tifactId>

<vers= ion>1.2.17</vers= ion>

</depe= ndency>

<depen= dency>

&l= t;groupId>org.apache.accumulo</groupId>

<arti= factId>accumulo-core</art= ifactId>

&l= t;version>${accumulo.version}</version>

</depe= ndency>

<depen= dency>

&l= t;groupId>org.apache.hadoop</groupId>

<arti= factId>hadoop-common</art= ifactId>

&l= t;version>${hadoop.version}</version>

</depe= ndency>

<depen= dency>

<grou= pId>junit</groupId>

<arti= factId>junit</artifactId>=

<vers= ion>4.11</versio= n>

<scop= e>test</scope>

</depe= ndency>


The accumulo-core & hadoop-common pull is all the necessary extras lik= e zookeeper, and the other accumulo artifacts. Below is my simple Unit test= s.

public class CRUDTest

{

pri= vate static final Logger log =3D Logger.getLogger(CRUDTest.class);

<= span class=3D"" style=3D"white-space:pre">

private static= final String zookeeperHost= =3D "172.100.100.101";=

private static= final String instanceName<= span style=3D"color:rgb(0,0,0)"> =3D "testinstance";

private static= final String root =3D &q= uot;root";

private static= final String pass =3D &q= uot;accumulopass";

<= br>

private static= final String tableName =3D "testtable";

private static= final String testuser =3D "testuser";

private static= final String testpass =3D "testpass";

private static= final String auths =3D &= quot;testauth";

<= span class=3D"" style=3D"white-space:pre">

pri= vate Instance instance;

pri= vate Connector testUserConn;

<= span class=3D"" style=3D"white-space:pre">

@Before

pub= lic void setup()

{

th= is.instance =3D new ZooKeeperInstance(instanceName, zookeeperHost, 20000);

try

{

Connector rootConn =3D instance.getConnector(root, new Pas= swordToken(pass));

log.info("Have the connector");

<= span class=3D"" style=3D"white-space:pre">

TableOperations tableOps =3D rootConn.t= ableOperations();

i= f (!tableOps.exists(tableName))

tableOps.create(tableName);

<= span class=3D"" style=3D"white-space:pre">

// Make sure our user has the proper permissions/auths

SecurityOperations securOps =3D rootCon= n.securityOperations();

securOps.createLocalUser(testuser, new PasswordToken(testpass));

securOps.changeUserAuthorizations(testuser, new Authorizations(au= ths));

securOps.grantTablePermission(testuser, tableName, TablePermission.= WRITE);

securOps.grantTablePermission(testuser, tableName, TablePermission.= READ);

<= br>

t= his.testUserConn =3D instance.getConnector(testuser, new PasswordToken(testpass));

}

ca= tch (AccumuloException | AccumuloSecurityException | TableExistsExce= ption e)

{

e.printStackTrace();

}

}

<= span class=3D"" style=3D"white-space:pre">

@After

pub= lic void teardown()

{

try

{

Connector rootConn =3D this.insta= nce.getConnector(root, new PasswordToken(pass));

TableOperations tableOps =3D rootConn.t= ableOperations();

SecurityOperations securOps =3DrootConn= .securityOperations();

<= br>

tableOps.delete(tableName);

securOps.dropLocalUser(testuser);

}

ca= tch (AccumuloException | AccumuloSecurityException | TableNotFoundEx= ception e)

{

e.printStackTrace();

}

}

<= br>

@Test

pub= lic void testSimpleCrea= te()

{

String rowId =3D UUID.randomUUID().toStr= ing();

Text rowID =3D new Text (rowId);

Text colFam =3D new Text("my= ColFam");

Text colQual =3D new Text("m= yColQual");

ColumnVisibility vis =3D new ColumnVisibility(auths);

<= span class=3D"" style=3D"white-space:pre">

String strValue =3D UUID.randomUUID().to= String();

log<= /span>.info("strValue =3D "<= /span> + strValue);

Value value =3D new Value(strValue.getBytes());

<= span class=3D"" style=3D"white-space:pre">

Mutation mutation=3D new Mutation(rowID);=A0

mutation.put(colFam,=A0 colQual,=A0 vis,= System.currentTimeMillis(), value);

<= span class=3D"" style=3D"white-space:pre">

BatchWriterConfig config =3D new BatchWriterConfig();

try

{

BatchWriter writer =3D this.testU= serConn.createBatchWriter(tableN= ame, config);

writer.addMutation(mutation);

writer.flush();

writer.close();

<= span class=3D"" style=3D"white-space:pre">

// Now let's see if we can see it

Scanner scan =3D this.testUserCon= n.createScanner(tableName= , new Authorizations(auths));

Range range =3D new Range(rowId);

scan.setRange(range);

scan.fetchColumnFamily(colFam);

<= span class=3D"" style=3D"white-space:pre">

f= or(Entry<Key,Value> entry : scan)=A0

{

lo= g.info("key =3D " + entry.getKey().toString());

lo= g.info("value =3D " + entry.getValue().toString());

Assert.assertTrue(strValue.equals(entr= y.getValue().toString()));

}

<= span class=3D"" style=3D"white-space:pre">

scan.close();

}

ca= tch (TableNotFoundException | MutationsRejectedException e)

{

e.printStackTrace();

}

}

<= span class=3D"" style=3D"white-space:pre">

@Test

pub= lic void testSimpleUpda= te()

{

Text rowID =3D new Text ("ro= wid_update");

Text colFam =3D new Text("my= ColFam");

Text colQual =3D new Text("m= yColQual");

ColumnVisibility vis =3D new ColumnVisibility(auths);

<= span class=3D"" style=3D"white-space:pre">

String strValue =3D UUID.randomUUID().to= String();

log<= /span>.info("strValue =3D "<= /span> + strValue);

Value value =3D new Value(strValue.getBytes());

<= span class=3D"" style=3D"white-space:pre">

Mutation origMutation=3D new Mutation(rowID);=A0

origMutation.put(colFam,=A0 colQual,=A0 = vis, System.currentTimeMillis(), value);

<= span class=3D"" style=3D"white-space:pre">

BatchWriterConfig config =3D new BatchWriterConfig();

try

{

BatchWriter writer =3D this.testU= serConn.createBatchWriter(tableN= ame, config);

<= br>

// Add the entry to be modified

writer.addMutation(origMutation);

writer.flush();

<= span class=3D"" style=3D"white-space:pre">

// Now let's change the value/timestamp

Mutation updateMutation=3D new Mutation(rowID);=A0

updateMutation.put(colFam, colQual, vis= , System.currentTimeMillis(),=A0

new Value(UUID.randomUUID().toString().getBytes()));

writer.addMutation(updateMutation);

writer.flush();

writer.close();

<= span class=3D"" style=3D"white-space:pre">

// Now let's see if we can see it

Scanner scan =3D this.testUserCon= n.createScanner(tableName= , new Authorizations(auths));

Range range =3D new Range(rowID);

scan.setRange(range);

scan.fetchColumnFamily(colFam);

<= span class=3D"" style=3D"white-space:pre">

f= or(Entry<Key,Value> entry : scan)=A0

{

lo= g.info("key =3D " + entry.getKey().toString());

lo= g.info("value =3D " + entry.getValue().toString());

Assert.assertFalse(strValue.equals(ent= ry.getValue().toString()));

}

<= span class=3D"" style=3D"white-space:pre">

scan.close();

}

ca= tch (TableNotFoundException | MutationsRejectedException e)

{

e.printStackTrace();

}

}

<= span class=3D"" style=3D"white-space:pre">

@Test

pub= lic void testSimpleDele= te()

{

Text rowID =3D new Text ("ro= wid_delete");

Text colFam =3D new Text("my= ColFam");

Text colQual =3D new Text("m= yColQual");

ColumnVisibility vis =3D new ColumnVisibility("public");

<= span class=3D"" style=3D"white-space:pre">

String strValue =3D UUID.randomUUID().to= String();

log<= /span>.info("strValue =3D "<= /span> + strValue);

Value value =3D new Value(strValue.getBytes());

<= span class=3D"" style=3D"white-space:pre">

BatchWriterConfig config =3D new BatchWriterConfig();

try

{

BatchWriter writer =3D this.testU= serConn.createBatchWriter(tableN= ame, config);

<= br>

// Add the entry to be modified

Mutation origMutation=3D new Mutation(rowID);=A0

origMutation.put(colFam,=A0 colQual,=A0= vis, System.currentTimeMillis(), value);

writer.addMutation(origMutation);

writer.flush();

<= span class=3D"" style=3D"white-space:pre">

// Now let's see if we can see it

Scanner scan =3D this.testUserCon= n.createScanner(tableName= , new Authorizations(auths));

Range range =3D new Range(rowID);

scan.setRange(range);

scan.fetchColumnFamily(colFam);

f= or(Entry<Key,Value> entry : scan)=A0

{

lo= g.info("key =3D " + entry.getKey().toString());

lo= g.info("value =3D " + entry.getValue().toString());

Assert.assertTrue(strValue.equals(entr= y.getValue().toString()));

}

<= br>

// Delete it

BatchDeleter deleter =3D this.tes= tUserConn.createBatchDeleter(tab= leName, new Authorizati= ons(auths), 1, config);

List<Range> ranges =3D Arrays.asL= ist(new Range(rowID));

deleter.setRanges(ranges);

deleter.delete();

<= br>

scan.fetchColumnFamily(colFam);

f= or(Entry<Key,Value> entry : scan)=A0

{

lo= g.info("key =3D " + entry.getKey().toString());

lo= g.info("value =3D " + entry.getValue().toString());

}

<= span class=3D"" style=3D"white-space:pre">

scan.close();

}

ca= tch (TableNotFoundException | MutationsRejectedException e)

{

e.printStackTrace();

}

}

}




On Tue, May 28, 2013 at 9:38 PM, albertoaflores <aaflores@gmail.com= > wrote:
Thanks Aaron, I'll give these a shot...<= br>


--
View this message in context: http://apache-accumulo.1065345.n5.nabble.com/POM-dependencies-f= or-an-Accumulo-Client-tp4182p4355.html
Sent from the Users mailing list ar= chive at Nabble.com.

--001a11c325743b673604dddeb9ee--