|
|
-
Mock classes for JUnit Testing
Joe Berk 2012-09-25, 12:47
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
+
Joe Berk 2012-09-25, 12:47
-
Re: Mock classes for JUnit Testing
Keith Turner 2012-09-25, 12:54
Did you create the table using mockConn.tableOperations().create()?
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
+
Keith Turner 2012-09-25, 12:54
-
Re: Mock classes for JUnit Testing
Joe Berk 2012-09-25, 13:29
Thanks for responding, Keith.
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");
Best Regards,
Josh On Tue, Sep 25, 2012 at 8:54 AM, Keith Turner <[EMAIL PROTECTED]> wrote:
> Did you create the table using mockConn.tableOperations().create()? > > 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 >
+
Joe Berk 2012-09-25, 13:29
-
Re: Mock classes for JUnit Testing
Adam Fuchs 2012-09-25, 13:46
Josh,
This is a classpath problem. The JVM is failing to load the MockTableOperations class because it has an include line that references that NotImplementedException class. Try adding all of the jars from Accumulo's lib directory to your classpath.
Adam On Sep 25, 2012 9:30 AM, "Joe Berk" <[EMAIL PROTECTED]> wrote:
> Thanks for responding, Keith. > > 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"); > > Best Regards, > > Josh > > > > > On Tue, Sep 25, 2012 at 8:54 AM, Keith Turner <[EMAIL PROTECTED]> wrote: > >> Did you create the table using mockConn.tableOperations().create()? >> >> 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 >> > >
+
Adam Fuchs 2012-09-25, 13:46
-
Re: Mock classes for JUnit Testing
Joe Berk 2012-09-25, 13:53
Adam,
Thank you for the reply. I'll inspect what jars I could be missing & try this again.
Thanks,
Josh
On Tue, Sep 25, 2012 at 9:46 AM, Adam Fuchs <[EMAIL PROTECTED]> wrote:
> Josh, > > This is a classpath problem. The JVM is failing to load the > MockTableOperations class because it has an include line that references > that NotImplementedException class. Try adding all of the jars from > Accumulo's lib directory to your classpath. > > Adam > On Sep 25, 2012 9:30 AM, "Joe Berk" <[EMAIL PROTECTED]> wrote: > >> Thanks for responding, Keith. >> >> 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"); >> >> Best Regards, >> >> Josh >> >> >> >> >> On Tue, Sep 25, 2012 at 8:54 AM, Keith Turner <[EMAIL PROTECTED]> wrote: >> >>> Did you create the table using mockConn.tableOperations().create()? >>> >>> 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 >>> >> >>
+
Joe Berk 2012-09-25, 13:53
-
Re: Mock classes for JUnit Testing
Keith Turner 2012-09-25, 13:55
What I think is going is that the class MockTableOperations references org.apache.commons.lang.NotImplementedException. When you try to load the class MockTableOperations, it tries to load the dependency NotImplementedException which is not on your class path.
On Tue, Sep 25, 2012 at 9:29 AM, Joe Berk <[EMAIL PROTECTED]> wrote: > Thanks for responding, Keith. > > 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"); > > Best Regards, > > Josh > > > > > On Tue, Sep 25, 2012 at 8:54 AM, Keith Turner <[EMAIL PROTECTED]> wrote: >> >> Did you create the table using mockConn.tableOperations().create()? >> >> 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 > >
+
Keith Turner 2012-09-25, 13:55
-
Re: Mock classes for JUnit Testing
Adam Fuchs 2012-09-25, 14:03
Too slow, Keith! :)
Adam On Sep 25, 2012 9:55 AM, "Keith Turner" <[EMAIL PROTECTED]> wrote:
> What I think is going is that the class MockTableOperations references > org.apache.commons.lang.NotImplementedException. When you try to load > the class MockTableOperations, it tries to load the dependency > NotImplementedException which is not on your class path. > > On Tue, Sep 25, 2012 at 9:29 AM, Joe Berk <[EMAIL PROTECTED]> wrote: > > Thanks for responding, Keith. > > > > 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"); > > > > Best Regards, > > > > Josh > > > > > > > > > > On Tue, Sep 25, 2012 at 8:54 AM, Keith Turner <[EMAIL PROTECTED]> wrote: > >> > >> Did you create the table using mockConn.tableOperations().create()? > >> > >> 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 > > > > >
+
Adam Fuchs 2012-09-25, 14:03
-
Re: Mock classes for JUnit Testing
Keith Turner 2012-09-25, 14:07
I blame Christopher... I was having a discussion w/ him about the search space of solving a rubicks cube while typing the email :) So when I started there was no response... then I took a long type to type... then I sent and saw your response.
On Tue, Sep 25, 2012 at 10:03 AM, Adam Fuchs <[EMAIL PROTECTED]> wrote: > Too slow, Keith! :) > > Adam > > On Sep 25, 2012 9:55 AM, "Keith Turner" <[EMAIL PROTECTED]> wrote: >> >> What I think is going is that the class MockTableOperations references >> org.apache.commons.lang.NotImplementedException. When you try to load >> the class MockTableOperations, it tries to load the dependency >> NotImplementedException which is not on your class path. >> >> On Tue, Sep 25, 2012 at 9:29 AM, Joe Berk <[EMAIL PROTECTED]> wrote: >> > Thanks for responding, Keith. >> > >> > 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"); >> > >> > Best Regards, >> > >> > Josh >> > >> > >> > >> > >> > On Tue, Sep 25, 2012 at 8:54 AM, Keith Turner <[EMAIL PROTECTED]> wrote: >> >> >> >> Did you create the table using mockConn.tableOperations().create()? >> >> >> >> 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.
+
Keith Turner 2012-09-25, 14:07
-
Re: Mock classes for JUnit Testing
John Armstrong 2012-09-25, 14:12
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.
+
John Armstrong 2012-09-25, 14:12
-
Re: Mock classes for JUnit Testing
Joe Berk 2012-09-25, 14:17
Awesome!
Thanks guys! It WAS a missing jar issue. We've recently done some conversions to maven and i guess some of the jars were left out in the cold during the transition.
I really appreciate the help!
Best Regards,
Josh 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. >
+
Joe Berk 2012-09-25, 14:17
-
Re: Mock classes for JUnit Testing
Jim Klucar 2012-09-25, 14:17
****Tower to Accumulo thread. Tower to Accumulo thread. We've received a distress call. Are you in danger of being hijacked, or has the Rubik'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.
+
Jim Klucar 2012-09-25, 14:17
-
Re: Mock classes for JUnit Testing
Keith Turner 2012-09-25, 14:20
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.
+
Keith Turner 2012-09-25, 14:20
-
Re: Mock classes for JUnit Testing
Joe Berk 2012-09-25, 14:22
:)
On Tue, Sep 25, 2012 at 10:20 AM, Keith Turner <[EMAIL PROTECTED]> wrote:
> 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. >
+
Joe Berk 2012-09-25, 14:22
-
Re: Mock classes for JUnit Testing
Billie Rinaldi 2012-09-25, 15:04
On Tue, Sep 25, 2012 at 7:20 AM, Keith Turner <[EMAIL PROTECTED]> wrote:
> 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
+
Billie Rinaldi 2012-09-25, 15:04
-
Re: Mock classes for JUnit Testing
Adam Fuchs 2012-09-25, 13:16
Josh,
Can you post the stack trace that came with the NPE?
Adam On Sep 25, 2012 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 >
+
Adam Fuchs 2012-09-25, 13:16
|
|