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 39DF518931 for ; Thu, 18 Jun 2015 15:00:33 +0000 (UTC) Received: (qmail 47587 invoked by uid 500); 18 Jun 2015 15:00:28 -0000 Delivered-To: apmail-accumulo-user-archive@accumulo.apache.org Received: (qmail 47538 invoked by uid 500); 18 Jun 2015 15:00:28 -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 47529 invoked by uid 99); 18 Jun 2015 15:00:28 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 18 Jun 2015 15:00:28 +0000 Received: from mail-yh0-f50.google.com (mail-yh0-f50.google.com [209.85.213.50]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id A07A01A0040 for ; Thu, 18 Jun 2015 15:00:27 +0000 (UTC) Received: by yhan67 with SMTP id n67so57973966yha.3 for ; Thu, 18 Jun 2015 08:00:27 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.170.79.5 with SMTP id v5mr13977842ykv.52.1434639627007; Thu, 18 Jun 2015 08:00:27 -0700 (PDT) Received: by 10.129.24.211 with HTTP; Thu, 18 Jun 2015 08:00:26 -0700 (PDT) In-Reply-To: <9A684651E3B11B4C8482FD873FEAA8BA40FB0F@UKDC1CSUEXMV02.CSU.LOCAL> References: <9A684651E3B11B4C8482FD873FEAA8BA40FB0F@UKDC1CSUEXMV02.CSU.LOCAL> Date: Thu, 18 Jun 2015 11:00:26 -0400 Message-ID: Subject: Re: Issue with classpath in unit tests From: Christopher To: Accumulo User List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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#envi= ronmentVariables 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, michael.griffiths3@baesystems.com wrote: > All, > > > > I=E2=80=99m having an issue but I=E2=80=99m probably missing something si= mple. 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 =3D new MockInstance(); > accumulo =3D instance.getConnector("user", new PasswordToken("password"))= ; > assertTrue(accumulo.instanceOperations().testClassLoad(FixedLengthLongArr= ayEncoder.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.loadClas= s(AccumuloVFSClassLoader.java:114) > > at > org.apache.accumulo.core.client.mock.MockInstanceOperationsImpl.testClass= Load(MockInstanceOperationsImpl.java:70) > > at > com.baesystems.ai.np.accumulo.aggregates.ScanTimeAggregateTest.createAccu= muloInstance(ScanTimeAggregateTest.java:41) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java= :62) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI= mpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:497) > > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMeth= od.java:47) > > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallabl= e.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:23= 6) > > 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(JUnit4Prov= ider.java:123) > > at > org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.jav= a:104) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java= :62) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorI= mpl.java:43) > > at java.lang.reflect.Method.invoke(Method.java:497) > > at > org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(Refl= ectionUtils.java:164) > > at > org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(Pro= viderFactory.java:110) > > at > org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireS= tarter.java:175) > > at > org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcessWhenFo= rked(SurefireStarter.java:107) > > at > org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:68) > > Caused by: org.apache.commons.vfs2.FileSystemException: Could not find fi= le > 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(Default= FileSystemManager.java:719) > > at > org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(Default= FileSystemManager.java:649) > > at > org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(Default= FileSystemManager.java:605) > > at > org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.resolve(= AccumuloVFSClassLoader.java:143) > > at > org.apache.accumulo.start.classloader.vfs.AccumuloReloadingVFSClassLoader= .(AccumuloReloadingVFSClassLoader.java:100) > > at > org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.createDy= namicClassloader(AccumuloVFSClassLoader.java:197) > > at > org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.getClass= Loader(AccumuloVFSClassLoader.java:216) > > at > org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.loadClas= s(AccumuloVFSClassLoader.java:112) > > ... 31 more > > > > Any ideas on what I=E2=80=99m doing wrong? For remote testing I=E2=80=99m= aware I need to > include the JAR in Accumulo=E2=80=99s 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: michael.griffiths3@baesystems.com > > 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 er= ror > 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.