Lewis John McGibbney created GORA-227:
-----------------------------------------

             Summary: Failing assertions when putting and getting Values using 
MemStore#execute
                 Key: GORA-227
                 URL: https://issues.apache.org/jira/browse/GORA-227
             Project: Apache Gora
          Issue Type: Sub-task
          Components: gora-core
    Affects Versions: 0.3
         Environment: gora-core 0.3, Nutch 2.x HEAD
            Reporter: Lewis John McGibbney
             Fix For: 0.4


Test [0] fails with the following useless logging... I need to DEBUG this much 
more throughly

{code}
Testcase: testGenerateHighest took 1.845 sec
        FAILED
expected:<2> but was:<0>
junit.framework.AssertionFailedError: expected:<2> but was:<0>
        at 
org.apache.nutch.crawl.TestGenerator.testGenerateHighest(TestGenerator.java:78)

Testcase: testGenerateHostLimit took 1.207 sec
        FAILED
expected:<1> but was:<0>
junit.framework.AssertionFailedError: expected:<1> but was:<0>
        at 
org.apache.nutch.crawl.TestGenerator.testGenerateHostLimit(TestGenerator.java:134)

Testcase: testGenerateDomainLimit took 1.175 sec
        FAILED
expected:<1> but was:<0>
junit.framework.AssertionFailedError: expected:<1> but was:<0>
        at 
org.apache.nutch.crawl.TestGenerator.testGenerateDomainLimit(TestGenerator.java:185)

Testcase: testFilter took 2.31 sec
        FAILED
expected:<3> but was:<0>
junit.framework.AssertionFailedError: expected:<3> but was:<0>
        at 
org.apache.nutch.crawl.TestGenerator.testFilter(TestGenerator.java:239)
{code}

However so far I have found commonality in the fact that the tests all use the 
following code:

{code}
  public static ArrayList<URLWebPage> readContents(DataStore<String,WebPage> 
store,
      Mark requiredMark, String... fields) throws Exception {
    ArrayList<URLWebPage> l = new ArrayList<URLWebPage>();

    Query<String, WebPage> query = store.newQuery();
    if (fields != null) {
      query.setFields(fields);
    }

    Result<String, WebPage> results = store.execute(query);
    while (results.next()) {
      try {
        WebPage page = results.get();
        String url = results.getKey();

        if (page == null)
          continue;

        if (requiredMark != null && requiredMark.checkMark(page) == null)
          continue;

        l.add(new URLWebPage(TableUtil.unreverseUrl(url), 
(WebPage)page.clone()));
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    return l;
  }
{code}

and also that the assertions are all of the type

{code}
    ArrayList<URLWebPage> fetchList = CrawlTestUtil.readContents(webPageStore, 
Mark.GENERATE_MARK, FIELDS);

    // verify we got right amount of records
    assertEquals(1, fetchList.size());
{code}


[0] 
http://svn.apache.org/viewvc/nutch/branches/2.x/src/test/org/apache/nutch/crawl/TestGenerator.java?view=markup


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to