On Tue, Sep 25, 2012 at 8:47 AM, Joe Berk <[EMAIL PROTECTED]> wrote:> Hello,>>>> I am trying to write JUnit tests for Accumulo and I keep running into> dead-ends with the “Mock” classes.>>>> /*>> * So, the following lines are how I would traditionally establish an> instance to perform Accumulo reads or writes>> */>>>> Instance zooInstance = new ZooKeeperInstance( InstanceName,> ZooServers);>> Connector connector = zooInstance.getConnector(UserName,> PassWord);>>>>>>>> /*>> * The following lines would be how I would perform a write to Accumulo>> */>>>> BatchWriter batchWriter = configuration.getBatchWriter();>> Mutation videoMutation = new Mutation(new Text( RowId ));>>>> videoMutation.put(ColumnFamily, ColumnQualifer, Value );>>>> batchWriter.addMutation(videoMutation);>> batchWriter.flush();>> batchWriter.close();>>>>>>>> /*>> * The following lines would be how I would perform a read from Accumulo>> */>>>> Authorizations authorizations = new Authorizations();>> Scanner scanner = connector.createScanner(TableName,> authorizations);>>>> scanner.setRange(new Range(RowId));>> scanner.fetchColumnFamily(columnFamily);>>>> Iterator<Entry<Key,Value>> iterator = scanner.iterator();>>>>>>>>>> So, I tried to repeat this process, but substituted:>>>> MockInstance instance = new MockInstance()>> Or>> Instance instance = new MockInstance();>>>> and everything works great until I attempt to addMutation(videoMutation).> That throws a NullPointerException.>>>> I’ve also tried to use the MockConnector & even MockBatchWriter classes, but> have not had any success.>>>> I would really appreciate any help you could provide.>>>>>> Best Regards,>>>> Josh

> Hello,>>>> I am trying to write JUnit tests for Accumulo and I keep running into> dead-ends with the “Mock” classes.>>>> /*>> * So, the following lines are how I would traditionally establish an> instance to perform Accumulo reads or writes>> */>>>> Instance zooInstance = new ZooKeeperInstance( *InstanceName*, *> ZooServers*);>> Connector connector = zooInstance.getConnector(*UserName*, *> PassWord*);>>>>>>>> /*>> * The following lines would be how I would perform a write to Accumulo>> */>>>> BatchWriter batchWriter = configuration.getBatchWriter();>> Mutation videoMutation = *new* Mutation(*new* Text( *RowId *));>>>> videoMutation.put(*ColumnFamily*, *ColumnQualifer*, *Value *);>>>> batchWriter.addMutation(videoMutation);>> batchWriter.flush();>> batchWriter.close();>>>>>>>> /*>> * The following lines would be how I would perform a read from Accumulo>> */>>>> Authorizations authorizations = new Authorizations();>> Scanner scanner = connector.createScanner(*TableName*,> authorizations);>>>> scanner.setRange(*new* Range(*RowId*));>> scanner.fetchColumnFamily(*columnFamily*);>>>> Iterator<Entry<Key,Value>> iterator = scanner.iterator();>>>>>>>>>> So, I tried to repeat this process, but substituted:>>>> MockInstance instance = new MockInstance()>> Or>> Instance instance = new MockInstance();>>>> and everything works great until I attempt to addMutation(videoMutation).> That throws a NullPointerException.>>>> I’ve also tried to use the MockConnector & even MockBatchWriter classes,> but have not had any success.>>>> I would really appreciate any help you could provide.>>>>>> Best Regards,>>>> Josh>

When I execute the following lines:MockInstance instance = new MockInstance();MockConnector connector = (MockConnector) instance.getConnector(*UserName*,*Password*);connector.tableOperations().create("SomeTable");

I get a "caused by: java.lang.ClassNotFoundException:org/apache/commons/lang/NotImplementedException"

& it throws the Exception on the 3rd line there:connector.tableOperations().create("SomeTable");

This is a classpath problem. The JVM is failing to load theMockTableOperations class because it has an include line that referencesthat NotImplementedException class. Try adding all of the jars fromAccumulo's lib directory to your classpath.

What I think is going is that the class MockTableOperations referencesorg.apache.commons.lang.NotImplementedException. When you try to loadthe class MockTableOperations, it tries to load the dependencyNotImplementedException which is not on your class path.

I blame Christopher... I was having a discussion w/ him about thesearch space of solving a rubicks cube while typing the email :) Sowhen I started there was no response... then I took a long type totype... then I sent and saw your response.

> On 09/25/2012 10:07 AM, Keith Turner wrote:>>> I blame Christopher... I was having a discussion w/ him about the>> search space of solving a rubicks cube while typing the email :)>>>> Well now you've got me all curious.>

****Tower to Accumulo thread. Tower to Accumulo thread. We've receiveda distress call. Are you in danger of being hijacked, or has theRubik's cube problem space already taken over?

On Tue, Sep 25, 2012 at 10:12 AM, John Armstrong <[EMAIL PROTECTED]> wrote:> On 09/25/2012 10:07 AM, Keith Turner wrote:>>>> I blame Christopher... I was having a discussion w/ him about the>> search space of solving a rubicks cube while typing the email :)>>> Well now you've got me all curious.

On Tue, Sep 25, 2012 at 10:12 AM, John Armstrong <[EMAIL PROTECTED]> wrote:> On 09/25/2012 10:07 AM, Keith Turner wrote:>>>> I blame Christopher... I was having a discussion w/ him about the>> search space of solving a rubicks cube while typing the email :)>>> Well now you've got me all curious.

Christopher was exploring the concept of an Accumulo example thatinvolving Rubiks cube. He can elaborate.

> On Tue, Sep 25, 2012 at 10:12 AM, John Armstrong <[EMAIL PROTECTED]> wrote:> > On 09/25/2012 10:07 AM, Keith Turner wrote:> >>> >> I blame Christopher... I was having a discussion w/ him about the> >> search space of solving a rubicks cube while typing the email :)> >> >> > Well now you've got me all curious.>> Christopher was exploring the concept of an Accumulo example that> involving Rubiks cube. He can elaborate.>

> On Tue, Sep 25, 2012 at 10:12 AM, John Armstrong <[EMAIL PROTECTED]> wrote:> > On 09/25/2012 10:07 AM, Keith Turner wrote:> >>> >> I blame Christopher... I was having a discussion w/ him about the> >> search space of solving a rubicks cube while typing the email :)> >> >> > Well now you've got me all curious.>> Christopher was exploring the concept of an Accumulo example that> involving Rubiks cube. He can elaborate.>

+1

NEW: Monitor These Apps!

All projects made searchable here are trademarks of the Apache Software Foundation.
Service operated by Sematext