Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id DF263200BFF for ; Tue, 17 Jan 2017 22:50:58 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id DE557160B46; Tue, 17 Jan 2017 21:50:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3143A160B30 for ; Tue, 17 Jan 2017 22:50:58 +0100 (CET) Received: (qmail 73815 invoked by uid 500); 17 Jan 2017 21:50:57 -0000 Mailing-List: contact dev-help@datafu.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@datafu.incubator.apache.org Delivered-To: mailing list dev@datafu.incubator.apache.org Received: (qmail 73804 invoked by uid 99); 17 Jan 2017 21:50:57 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jan 2017 21:50:57 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 9F87B180BB7 for ; Tue, 17 Jan 2017 21:50:56 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.817 X-Spam-Level: X-Spam-Status: No, score=-3.817 tagged_above=-999 required=6.31 tests=[DKIM_ADSP_CUSTOM_MED=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001, HTML_MESSAGE=2, KAM_LAZY_DOMAIN_SECURITY=1, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id TpGofr0zlHTS for ; Tue, 17 Jan 2017 21:50:54 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id 391D65FC81 for ; Tue, 17 Jan 2017 21:50:54 +0000 (UTC) Received: (qmail 73749 invoked by uid 99); 17 Jan 2017 21:50:53 -0000 Received: from reviews-vm.apache.org (HELO reviews.apache.org) (140.211.11.40) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Jan 2017 21:50:53 +0000 Received: from reviews.apache.org (localhost [127.0.0.1]) by reviews.apache.org (Postfix) with ESMTP id 0BAF1315138; Tue, 17 Jan 2017 21:50:53 +0000 (UTC) Content-Type: multipart/alternative; boundary="===============1804233032255498643==" MIME-Version: 1.0 Subject: Re: Review Request 55110: DATAFU-106 Test files are currently created in the subdirectory folder (e.g. datafu-pig/input*). For better organization, they should be created in a subdirectory. From: Piyush Sharma To: Matthew Hayes Cc: DataFu , Piyush Sharma , Eyal Allweil Date: Tue, 17 Jan 2017 21:50:53 -0000 Message-ID: <20170117215053.28415.3611@reviews.apache.org> X-ReviewBoard-URL: https://reviews.apache.org/ Auto-Submitted: auto-generated Sender: Piyush Sharma X-ReviewGroup: DataFu X-Auto-Response-Suppress: DR, RN, OOF, AutoReply X-ReviewRequest-URL: https://reviews.apache.org/r/55110/ X-Sender: Piyush Sharma References: <20170102092943.5940.12327@reviews.apache.org> In-Reply-To: <20170102092943.5940.12327@reviews.apache.org> X-ReviewBoard-Diff-For: datafu-pig/src/test/java/datafu/test/pig/test_filesSubdir/TestFilesSubdirTest.java Reply-To: Piyush Sharma X-ReviewRequest-Repository: datafu archived-at: Tue, 17 Jan 2017 21:50:59 -0000 --===============1804233032255498643== MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit > On Jan. 2, 2017, 9:29 a.m., Eyal Allweil wrote: > > Hi Piyush, > > > > Thank you for your patch! It looks to me that it works fine - I ran our tests on Ubuntu, both from Eclipse and from the command line. > > > > I have two comments, one "real" and one just a typo: > > > > 1) From [this question](http://stackoverflow.com/a/840229/150992), it appears that changing the *user.dir* property in this way can be unpredictable - that it won't affect FileOutputStreams, for example. So although this works for our current tests (the FileOutputStream used in datafu.pig.linkanalysis.PageRank uses *File.createTempFile* instead of the working dir, so it's fine) I worry that this might not work in the future. Maybe add a comment about this in the *beforeClass* method? > > > > 2) "Location" is spelled as "loaction" in PigTests.java > > > > Cheers, > > Eyal > > Piyush Sharma wrote: > Hi Eyal, > > Thank you for reviewing it. > > 1) I've actually tried doing it without changing user.dir. The pigtests don't actually work that way (for eg: LOAD 'input'... searches for the file in the working directory and it apparently deciphers it to be the same as that of the jvm). Hence, this was the only possible way to solve the issue that I could think of. > > I also went through that stackoverflow question whilst creating the patch to resolve my suspicions about the same. Actually, as even the accepted answer says it does affect the subsequent file creations, which happens via a call to writeLinesToFile defined in the PigTests.java which always creates a new file, deleting the existing one if necessary, and then writes to it. Now since writeLinesToFile also implicitly uses FileOutputStream (via a FileWriter object) to write to files just created in the new user.dir, it seemed like changing the working directory did actually affect the FileOutPutStreams, atleast as far as our project goes it did. Moreover the afterMethod resets the user.dir so hopefully there aren't any consequences at all. > > I can add some comment like "//Only some classes reflect the changes in working directory" or something like "//Developers are requested to just work with absoluteFiles and absolutePaths to avoid IOExceptions and such" but I feel it throws up a red flag unnecessarily, so should I ? > > 2) I will surely correct the typo, thank you. > > Cheerio, > Piyush > > Eyal Allweil wrote: > I think this is fine - after all, all existing tests pass. One more very minor comment - I think I'd just put the test in the main java/datafu/test dir - I don't think there's a need for a subdirectory for it. Yeah sure, I've transferred the unit test to the datafu-pig/src/test/java/datafu/test directory and also corrected the typo in PigTests.java in the new patch that I've uploaded. Cheerio - Piyush ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/55110/#review160317 ----------------------------------------------------------- On Jan. 6, 2017, 8:51 p.m., Piyush Sharma wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/55110/ > ----------------------------------------------------------- > > (Updated Jan. 6, 2017, 8:51 p.m.) > > > Review request for DataFu and Matthew Hayes. > > > Repository: datafu > > > Description > ------- > > DATAFU-106: Test files are currently created in the subdirectory folder (e.g. datafu-pig/input*). For better organization, they should be created in a subdirectory. This also makes it easier to exclude them all with gitignore. > (issue: https://issues.apache.org/jira/browse/DATAFU-106) > > > Diffs > ----- > > datafu-pig/src/test/java/datafu/test/pig/PigTests.java d1d6fcc > datafu-pig/src/test/java/datafu/test/pig/test_filesSubdir/TestFilesSubdirTest.java PRE-CREATION > > Diff: https://reviews.apache.org/r/55110/diff/ > > > Testing > ------- > > unit tests passed. > > > Thanks, > > Piyush Sharma > > --===============1804233032255498643==--