Return-Path: X-Original-To: apmail-accumulo-dev-archive@www.apache.org Delivered-To: apmail-accumulo-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 93CBAFEE4 for ; Fri, 22 Mar 2013 01:51:15 +0000 (UTC) Received: (qmail 18404 invoked by uid 500); 22 Mar 2013 01:51:15 -0000 Delivered-To: apmail-accumulo-dev-archive@accumulo.apache.org Received: (qmail 18373 invoked by uid 500); 22 Mar 2013 01:51:15 -0000 Mailing-List: contact dev-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list dev@accumulo.apache.org Received: (qmail 18364 invoked by uid 99); 22 Mar 2013 01:51:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Mar 2013 01:51:15 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dlmarion@comcast.net designates 76.96.62.48 as permitted sender) Received: from [76.96.62.48] (HELO qmta05.westchester.pa.mail.comcast.net) (76.96.62.48) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Mar 2013 01:51:08 +0000 Received: from omta04.westchester.pa.mail.comcast.net ([76.96.62.35]) by qmta05.westchester.pa.mail.comcast.net with comcast id EApm1l0060ldTLk55RqnnN; Fri, 22 Mar 2013 01:50:47 +0000 Received: from sz0053.wc.mail.comcast.net ([68.87.26.138]) by omta04.westchester.pa.mail.comcast.net with comcast id ERqn1l0062ymm843QRqnRY; Fri, 22 Mar 2013 01:50:47 +0000 Date: Fri, 22 Mar 2013 01:50:47 +0000 (UTC) From: dlmarion@comcast.net To: dev@accumulo.apache.org Message-ID: <1089435138.937481.1363917047019.JavaMail.root@sz0053a.westchester.pa.mail.comcast.net> In-Reply-To: <010f01ce2689$6119f830$234de890$@comcast.net> Subject: Re: Using powermock-api-mockito in tests? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_937480_843367734.1363917047018" X-Originating-IP: [::ffff:69.137.58.229] X-Mailer: Zimbra 6.0.13_GA_2944 (ZimbraWebClient - FF3.0 (Linux)/6.0.13_GA_2944) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20121106; t=1363917047; bh=0u1X1UZLp2I8NFN9r5mwc2EeaU6lHXN3vGdfOAxRPrU=; h=Received:Received:Date:From:To:Message-ID:Subject:MIME-Version: Content-Type; b=KQpF0qa2TBOV1Eu+vkKGubPoEdq4KKeDLvjjzUHyCI/AmxvCXmNTuQExhs5VpqlUV FycqLt3FymxhdlFXqF9eaXs2B9YqoLASztr1b0epK9PiNP94+dSdlMEp7R1nMLrTNs Q0tWoRGJrIoo4OKMBBiCHxPfGStN/qwfjcB5B7lz87OMcS7B6nUXO+Jz1DRzqKASIQ rXUjA3m1IVZ9Uuzh9EjzxP9Vj7d7JZOizGXPydON6i5YnFKdVP1QNkm7dHvJ3yQC5K Cw2aEYJBKFDs10DgdVpr0r05W1mriCRLh4CyOHM3qqEdiMwbf2x3Dbh+wgVNn00zlv xwp/wwehKn2ng== X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_937480_843367734.1363917047018 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit I do think that the tests that use the MiniDFSCluster (anything that uses AccumuloDFSBase) will fail on Windows. I had to use the following profile in the commons vfs package. Of course the test names will be different here... hdfs false Windows org.apache.maven.plugins maven-surefire-plugin **/HdfsFileProviderTest.java **/HdfsFileProviderTestCase.java ----- Original Message ----- From: "Dave Marion" To: dev@accumulo.apache.org Sent: Thursday, March 21, 2013 7:11:11 PM Subject: RE: Using powermock-api-mockito in tests? The Hadoop MiniDFSCluster won't work on Windoze. He'll have to exclude most of the new classloader tests from running on that platform. -----Original Message----- From: Josh Elser [mailto:josh.elser@gmail.com] Sent: Thursday, March 21, 2013 6:44 PM To: dev@accumulo.apache.org Subject: Re: Using powermock-api-mockito in tests? David is trying to build on Windows. On 03/21/2013 06:40 PM, Dave Marion wrote: > Out of curiosity, why do you say that " System.getenv() which breaks the tests in AccumuloVFSClassLoaderTest?" It's worked fine for a while. What is different now? > > -- Dave > > -----Original Message----- > From: dlmarion@comcast.net [mailto:dlmarion@comcast.net] > Sent: Thursday, March 21, 2013 5:12 PM > To: dev@accumulo.apache.org > Subject: Re: Using powermock-api-mockito in tests? > > > > We can do it with PowerMock, no need to add Mockito. This should work, going from memory here. I should be able to help when I get back to a computer if you have problems. > > > > //Mock the method > > PowerMock.mockStatic(System.class, System.class.getMethod("getenv")); > > > > //Invoke it > > Map mockSystemProperties = new HashMap(); > mockSystemProperties.put("ACCUMULO_HOME", System.getenv("HOME")); > EasyMock.expect(System.getenv()).andReturn(mockSystemProperties); > > > > ----- Original Message ----- > > > From: "David Medinets" > To: "accumulo-dev" > Sent: Thursday, March 21, 2013 4:59:40 PM > Subject: Using powermock-api-mockito in tests? > > Is there any reason why I should not add a dependency in start/pom.xml to powermock-api-mockito? With this library, we can mock the call to > System.getenv() which breaks the tests in AccumuloVFSClassLoaderTest. > The two tests need these four lines of setup in order to pass: > > Map mockSystemProperties = new HashMap(); > mockSystemProperties.put("ACCUMULO_HOME", System.getenv("HOME")); > > PowerMockito.mockStatic(System.class); > Mockito.when(System.getenv()).thenReturn(mockSystemProperties); > > You'll notice that set ACCUMULO_HOME is set to the value of HOME to make the test cross-platform. > ------=_Part_937480_843367734.1363917047018--