The problem looks like it is this: Could not find file with URI "/lib/ext/[^.].*.jar" because it is a relative path, and no base URI was provided.
It looks like this value is actually "$ACCUMULO_HOME/lib/ext/[^.].*.jar", but that value is not set in the environment. You can set this in your environment when you execute surefire: https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#environmentVariables In general, you should probably avoid using mock for testing, though. It's a bit unreliable, is relatively poorly maintained, and is an incomplete implementation of Accumulo. Many of its features work very differently than a real Accumulo, also, so it is not an adequate test framework. It still has some utility, but only if one really understands where its shortcomings are, and its expected divergences from a real Accumulo instance. We've had discussions before among the developers about deprecating mock, but we haven't yet come to consensus on that. I would urge you to take a look at MiniAccumuloCluster and see if that might be able to satisfy your testing needs. -- Christopher L Tubbs II http://gravatar.com/ctubbsii On Thu, Jun 18, 2015 at 8:17 AM, [email protected] <[email protected]> wrote: > All, > > > > I’m having an issue but I’m probably missing something simple. I am > specifying a custom encoder for the SummingArrayCombiner but during unit > testing (using MockInstance) it cannot find the class in my local project? > > > > The code is below: > > > > MockInstance instance = new MockInstance(); > accumulo = instance.getConnector("user", new PasswordToken("password")); > assertTrue(accumulo.instanceOperations().testClassLoad(FixedLengthLongArrayEncoder.class.getName(), > FixedLengthLongArrayEncoder.class.getTypeName())); > > > > The test fails due to: > > > > java.lang.ClassNotFoundException: IO Error loading class > com.baesystems.ai.np.accumulo.iterators.lists.FixedLengthLongArrayEncoder > > at > org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.loadClass(AccumuloVFSClassLoader.java:114) > > at > org.apache.accumulo.core.client.mock.MockInstanceOperationsImpl.testClassLoad(MockInstanceOperationsImpl.java:70) > > at > com.baesystems.ai.np.accumulo.aggregates.ScanTimeAggregateTest.createAccumuloInstance(ScanTimeAggregateTest.java:41) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:497) > > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) > > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) > > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) > > at > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) > > at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) > > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) > > at > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) > > at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) > > at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) > > at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) > > at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) > > at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) > > at org.junit.runners.ParentRunner.run(ParentRunner.java:309) > > at > org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:53) > > at > org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:123) > > at > org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:104) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:497) > > at > org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:164) > > at > org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:110) > > at > org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:175) > > at > org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenForked(SurefireStarter.java:107) > > at > org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68) > > Caused by: org.apache.commons.vfs2.FileSystemException: Could not find file > with URI "/lib/ext/[^.].*.jar" because it is a relative path, and no base > URI was provided. > > at > org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:719) > > at > org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:649) > > at > org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:605) > > at > org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.resolve(AccumuloVFSClassLoader.java:143) > > at > org.apache.accumulo.start.classloader.vfs.AccumuloReloadingVFSClassLoader.<init>(AccumuloReloadingVFSClassLoader.java:100) > > at > org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.createDynamicClassloader(AccumuloVFSClassLoader.java:197) > > at > org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.getClassLoader(AccumuloVFSClassLoader.java:216) > > at > org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.loadClass(AccumuloVFSClassLoader.java:112) > > ... 31 more > > > > Any ideas on what I’m doing wrong? For remote testing I’m aware I need to > include the JAR in Accumulo’s classpath, but how is this achieved in local > unit tests? > > > > Many thanks, > > > > Michael > > > > Michael Griffiths > Developer > BAE Systems Applied Intelligence > ___________________________________________________________ > > T: +44 (0) 1483 816476 | E: [email protected] > > BAE Systems Applied Intelligence, Surrey Research Park, Guildford, Surrey, > GU2 7RQ. > www.baesystems.com/ai > > > > Please consider the environment before printing this email. This message > should be regarded as confidential. If you have received this email in error > please notify the sender and destroy it immediately. Statements of intent > shall only become binding when confirmed in hard copy by an authorised > signatory. The contents of this email may relate to dealings with other > companies under the control of BAE Systems Applied Intelligence Limited, > details of which can be found at > http://www.baesystems.com/Businesses/index.htm.
