You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mahout.apache.org by Grant Ingersoll <gs...@apache.org> on 2009/02/02 16:42:01 UTC

FileDataModelTest failing

Anyone else seeing the following on trunk?

------------- ---------------- ---------------
     [junit] Testcase:  
testFile 
(org.apache.mahout.cf.taste.impl.model.file.FileDataModelTest):   FAILED
     [junit] expected:<2> but was:<0>
     [junit] junit.framework.AssertionFailedError: expected:<2> but  
was:<0>
     [junit]     at  
org 
.apache 
.mahout 
.cf 
.taste 
.impl.model.file.FileDataModelTest.testFile(FileDataModelTest.java:57)



Thanks,
Grant

Re: FileDataModelTest failing

Posted by Grant Ingersoll <gs...@apache.org>.
I've found that most things can be done in Maven, but there are still  
a few that cannot.  For instance, the other day, I needed some custom  
setup for docbook to HTML generation for which I used the Maven Ant  
tasks.  It actually works out quite nice.

I find Maven doesn't work so hot when you need to do things that don't  
always make sense being in the "resources" part of the tree, or if you  
need to bring things together from different places.  At any rate, I  
don't think we will have too many issues with it.

I'm working through it, but help is appreciated.


On Feb 3, 2009, at 3:37 PM, Ted Dunning wrote:

> I have been converting code at work to maven and am finding that it  
> is a
> very gratifying experience (subject to the usual "go along with the
> conventions" advice).
>
> I would re-examine cases where "you can't do it" with maven with a  
> very
> jaundiced eye.  Are these really necessary?  Are they really that  
> hard?
> Code generation isn't hard, interesting test cases aren't hard.  Is  
> the
> difficulty actually just that it is hard to redo exactly what ant  
> does?
>
> On Tue, Feb 3, 2009 at 6:25 AM, Grant Ingersoll  
> <gs...@apache.org> wrote:
>
>>
>> On Feb 2, 2009, at 6:35 PM, Grant Ingersoll wrote:
>>
>>>
>>> (So on build.xml files -- we are retaining them in some situations  
>>> to
>>>> script things that Maven can't, and then call out to them from  
>>>> Maven?
>>>> for instance everything that is left in taste-build.xml, and it's  
>>>> not
>>>> much, can't be translated AFAIK. I don't want to lose it though.)
>>>>
>>>
>>> I will likely create an area for holding the maven specific
>>> customizations.  But, yeah, in general, I would like to remove  
>>> anything that
>>> is not needed.  The key for me is that the end user building  
>>> Mahout should
>>> have as simple a process as possible.
>>>
>>
>>
>>
>> More update here:  Moving to Maven likely means removing most of  
>> the lib
>> files, as I see no reason to keep them around, other than the ones  
>> that
>> don't currently publish to Maven repo.  This will definitely mean  
>> the Ant
>> scripts will no longer work, although it is easy enough to have Maven
>> generate a "lib" directory, so I don't think it is that big of a  
>> deal.  I
>> don't want to be in the mode of maintaining two files, so as soon  
>> as we are
>> sure Maven is doing what we need, then we should remove them and  
>> keep a
>> small build file under /maven that contains any Ant plugin code.
>>
>> -Grant
>>
>
>
>
> -- 
> Ted Dunning, CTO
> DeepDyve
> 4600 Bohannon Drive, Suite 220
> Menlo Park, CA 94025
> www.deepdyve.com
> 650-324-0110, ext. 738
> 858-414-0013 (m)

--------------------------
Grant Ingersoll
http://www.lucidimagination.com/

Lucene Helpful Hints:
http://wiki.apache.org/lucene-java/BasicsOfPerformance
http://wiki.apache.org/lucene-java/LuceneFAQ












Re: FileDataModelTest failing

Posted by Ted Dunning <te...@gmail.com>.
I have been converting code at work to maven and am finding that it is a
very gratifying experience (subject to the usual "go along with the
conventions" advice).

I would re-examine cases where "you can't do it" with maven with a very
jaundiced eye.  Are these really necessary?  Are they really that hard?
Code generation isn't hard, interesting test cases aren't hard.  Is the
difficulty actually just that it is hard to redo exactly what ant does?

On Tue, Feb 3, 2009 at 6:25 AM, Grant Ingersoll <gs...@apache.org> wrote:

>
> On Feb 2, 2009, at 6:35 PM, Grant Ingersoll wrote:
>
>>
>>  (So on build.xml files -- we are retaining them in some situations to
>>> script things that Maven can't, and then call out to them from Maven?
>>> for instance everything that is left in taste-build.xml, and it's not
>>> much, can't be translated AFAIK. I don't want to lose it though.)
>>>
>>
>> I will likely create an area for holding the maven specific
>> customizations.  But, yeah, in general, I would like to remove anything that
>> is not needed.  The key for me is that the end user building Mahout should
>> have as simple a process as possible.
>>
>
>
>
> More update here:  Moving to Maven likely means removing most of the lib
> files, as I see no reason to keep them around, other than the ones that
> don't currently publish to Maven repo.  This will definitely mean the Ant
> scripts will no longer work, although it is easy enough to have Maven
> generate a "lib" directory, so I don't think it is that big of a deal.  I
> don't want to be in the mode of maintaining two files, so as soon as we are
> sure Maven is doing what we need, then we should remove them and keep a
> small build file under /maven that contains any Ant plugin code.
>
> -Grant
>



-- 
Ted Dunning, CTO
DeepDyve
4600 Bohannon Drive, Suite 220
Menlo Park, CA 94025
www.deepdyve.com
650-324-0110, ext. 738
858-414-0013 (m)

Re: FileDataModelTest failing

Posted by Grant Ingersoll <gs...@apache.org>.
On Feb 2, 2009, at 6:35 PM, Grant Ingersoll wrote:
>
>> (So on build.xml files -- we are retaining them in some situations to
>> script things that Maven can't, and then call out to them from Maven?
>> for instance everything that is left in taste-build.xml, and it's not
>> much, can't be translated AFAIK. I don't want to lose it though.)
>
> I will likely create an area for holding the maven specific  
> customizations.  But, yeah, in general, I would like to remove  
> anything that is not needed.  The key for me is that the end user  
> building Mahout should have as simple a process as possible.



More update here:  Moving to Maven likely means removing most of the  
lib files, as I see no reason to keep them around, other than the ones  
that don't currently publish to Maven repo.  This will definitely mean  
the Ant scripts will no longer work, although it is easy enough to  
have Maven generate a "lib" directory, so I don't think it is that big  
of a deal.  I don't want to be in the mode of maintaining two files,  
so as soon as we are sure Maven is doing what we need, then we should  
remove them and keep a small build file under /maven that contains any  
Ant plugin code.

-Grant

Re: FileDataModelTest failing

Posted by Grant Ingersoll <gs...@apache.org>.
On Feb 2, 2009, at 2:22 PM, Sean Owen wrote:

> Got it, and I squashed the last bug. Should be ready to rock?
>

I'll try it out.

> (So on build.xml files -- we are retaining them in some situations to
> script things that Maven can't, and then call out to them from Maven?
> for instance everything that is left in taste-build.xml, and it's not
> much, can't be translated AFAIK. I don't want to lose it though.)

I will likely create an area for holding the maven specific  
customizations.  But, yeah, in general, I would like to remove  
anything that is not needed.  The key for me is that the end user  
building Mahout should have as simple a process as possible.

-Grant

Re: FileDataModelTest failing

Posted by Sean Owen <sr...@gmail.com>.
Got it, and I squashed the last bug. Should be ready to rock?

(So on build.xml files -- we are retaining them in some situations to
script things that Maven can't, and then call out to them from Maven?
for instance everything that is left in taste-build.xml, and it's not
much, can't be translated AFAIK. I don't want to lose it though.)

On Mon, Feb 2, 2009 at 6:49 PM, Grant Ingersoll <gs...@apache.org> wrote:
> I committed my change.  It just uses a temp file.  Everything still passes
> except the one test that didn't pass before.

Re: FileDataModelTest failing

Posted by Grant Ingersoll <gs...@apache.org>.
I committed my change.  It just uses a temp file.  Everything still  
passes except the one test that didn't pass before.

On Feb 2, 2009, at 1:36 PM, Sean Owen wrote:

> I see, the problem is just depending on where it's run from. The other
> option is to include the file in the .jar and load it using
> getResourceAsStream(). I like this too. You have a patch and ready to
> commit or should I dig in along these lines?
>
> Sean
>
> On Mon, Feb 2, 2009 at 4:15 PM, Grant Ingersoll  
> <gs...@apache.org> wrote:
>> Thanks!  Also, I'm going to convert this test to be "self- 
>> contained" which
>> will make it work better in Maven w/o having to worry about where a  
>> file is
>> located, i.e.:


Re: FileDataModelTest failing

Posted by Sean Owen <sr...@gmail.com>.
I see, the problem is just depending on where it's run from. The other
option is to include the file in the .jar and load it using
getResourceAsStream(). I like this too. You have a patch and ready to
commit or should I dig in along these lines?

Sean

On Mon, Feb 2, 2009 at 4:15 PM, Grant Ingersoll <gs...@apache.org> wrote:
> Thanks!  Also, I'm going to convert this test to be "self-contained" which
> will make it work better in Maven w/o having to worry about where a file is
> located, i.e.:

Re: FileDataModelTest failing

Posted by Grant Ingersoll <gs...@apache.org>.
Thanks!  Also, I'm going to convert this test to be "self-contained"  
which will make it work better in Maven w/o having to worry about  
where a file is located, i.e.:

Index: src/test/java/org/apache/mahout/cf/taste/impl/model/file/ 
FileDataModelTest.java
===================================================================
--- src/test/java/org/apache/mahout/cf/taste/impl/model/file/ 
FileDataModelTest.java     (revision 739991)
+++ src/test/java/org/apache/mahout/cf/taste/impl/model/file/ 
FileDataModelTest.java     (working copy)
@@ -30,6 +30,7 @@
  import org.apache.mahout.cf.taste.recommender.Recommender;

  import java.io.File;
+import java.io.FileWriter;
  import java.util.Iterator;
  import java.util.NoSuchElementException;
  import java.util.concurrent.atomic.AtomicBoolean;
@@ -39,13 +40,36 @@
   */
  public final class FileDataModelTest extends TasteTestCase {

-  private static final File testFile = new File("src/test/java/org/ 
apache/mahout/cf/taste/impl/model/file/test1.txt");
+  //private static final File testFile = new File("src/test/resources/ 
file-data-model-test.txt");

    private DataModel model;

+  private static final String [] DATA = {
+          "A123,456,0.1",
+          "A123,789,0.6",
+          "A123,654,0.7",
+          "B234,123,0.5",
+          "B234,234,1.0",
+          "C345,789,0.6",
+          "C345,654,0.7",
+          "C345,123,1.0",
+          "C345,234,0.5",
+          "D456,456,0.1"};
+
    @Override
    public void setUp() throws Exception {
      super.setUp();
+    File tmpDir = new File(System.getProperty("java.io.tmpdir"));
+    File tmpLoc = new File(tmpDir, "fileDataModel");
+    tmpLoc.mkdirs();
+    File testFile = File.createTempFile("test", ".txt", tmpLoc);
+    FileWriter writer = new FileWriter(testFile);
+    String lineSep = System.getProperty("line.separator");
+    for (int i = 0; i < DATA.length; i++) {
+      writer.write(DATA[i]);
+      writer.write(lineSep);
+    }
+    writer.close();
      model = new FileDataModel(testFile);
    }

On Feb 2, 2009, at 11:01 AM, Sean Owen wrote:

> My fault, I will fix ASAP.
>
> On Mon, Feb 2, 2009 at 3:42 PM, Grant Ingersoll  
> <gs...@apache.org> wrote:
>> Anyone else seeing the following on trunk?
>>
>> ------------- ---------------- ---------------
>>   [junit] Testcase:
>> testFile 
>> (org.apache.mahout.cf.taste.impl.model.file.FileDataModelTest):
>> FAILED
>>   [junit] expected:<2> but was:<0>
>>   [junit] junit.framework.AssertionFailedError: expected:<2> but  
>> was:<0>
>>   [junit]     at
>> org 
>> .apache 
>> .mahout 
>> .cf 
>> .taste 
>> .impl.model.file.FileDataModelTest.testFile(FileDataModelTest.java: 
>> 57)
>>
>>
>>
>> Thanks,
>> Grant
>>












Re: FileDataModelTest failing

Posted by Sean Owen <sr...@gmail.com>.
My fault, I will fix ASAP.

On Mon, Feb 2, 2009 at 3:42 PM, Grant Ingersoll <gs...@apache.org> wrote:
> Anyone else seeing the following on trunk?
>
> ------------- ---------------- ---------------
>    [junit] Testcase:
> testFile(org.apache.mahout.cf.taste.impl.model.file.FileDataModelTest):
> FAILED
>    [junit] expected:<2> but was:<0>
>    [junit] junit.framework.AssertionFailedError: expected:<2> but was:<0>
>    [junit]     at
> org.apache.mahout.cf.taste.impl.model.file.FileDataModelTest.testFile(FileDataModelTest.java:57)
>
>
>
> Thanks,
> Grant
>