Search in sources :

Example 1 with AccessResult

use of org.codelibs.fess.crawler.entity.AccessResult in project fess-crawler by codelibs.

the class EsDataServiceTest method test_insert_delete_multiTx.

public void test_insert_delete_multiTx() {
    final EsAccessResult accessResult1 = new EsAccessResult();
    accessResult1.setContentLength(Long.valueOf(10));
    accessResult1.setCreateTime(System.currentTimeMillis());
    accessResult1.setExecutionTime(10);
    accessResult1.setHttpStatusCode(200);
    accessResult1.setLastModified(System.currentTimeMillis());
    accessResult1.setMethod("GET");
    accessResult1.setMimeType("text/plain");
    accessResult1.setParentUrl("http://www.parent.com/");
    accessResult1.setRuleId("htmlRule");
    accessResult1.setSessionId("id1");
    accessResult1.setStatus(200);
    accessResult1.setUrl("http://www.id1.com/");
    dataService.store(accessResult1);
    final EsAccessResult accessResult2 = new EsAccessResult();
    accessResult2.setContentLength(Long.valueOf(10));
    accessResult2.setCreateTime(System.currentTimeMillis());
    accessResult2.setExecutionTime(10);
    accessResult2.setHttpStatusCode(200);
    accessResult2.setLastModified(System.currentTimeMillis());
    accessResult2.setMethod("GET");
    accessResult2.setMimeType("text/plain");
    accessResult2.setParentUrl("http://www.parent.com/");
    accessResult2.setRuleId("htmlRule");
    accessResult2.setSessionId("id2");
    accessResult2.setStatus(200);
    accessResult2.setUrl("http://www.id2.com/");
    dataService.store(accessResult2);
    final EsAccessResult accessResult3 = dataService.getAccessResult("id1", "http://www.id1.com/");
    final EsAccessResult accessResult4 = dataService.getAccessResult("id2", "http://www.id2.com/");
    assertNotNull(accessResult3);
    assertNotNull(accessResult4);
    final List<EsAccessResult> accessResultList = new ArrayList<>();
    accessResult3.setMimeType("text/html");
    accessResult4.setMimeType("text/html");
    accessResultList.add(accessResult3);
    accessResultList.add(accessResult4);
    dataService.update(accessResultList);
    final AccessResult accessResult5 = dataService.getAccessResult("id1", "http://www.id1.com/");
    final AccessResult accessResult6 = dataService.getAccessResult("id2", "http://www.id2.com/");
    assertNotNull(accessResult5);
    assertNotNull(accessResult6);
    assertEquals("text/html", accessResult5.getMimeType());
    assertEquals("text/html", accessResult6.getMimeType());
    dataService.delete("id1");
    assertNull(dataService.getAccessResult("id1", "http://www.id1.com/"));
    assertNotNull(dataService.getAccessResult("id2", "http://www.id2.com/"));
    dataService.store(accessResult1);
    assertNotNull(dataService.getAccessResult("id1", "http://www.id1.com/"));
    dataService.deleteAll();
    assertNull(dataService.getAccessResult("id1", "http://www.id1.com/"));
    assertNull(dataService.getAccessResult("id2", "http://www.id2.com/"));
}
Also used : EsAccessResult(org.codelibs.fess.crawler.entity.EsAccessResult) ArrayList(java.util.ArrayList) EsAccessResult(org.codelibs.fess.crawler.entity.EsAccessResult) AccessResult(org.codelibs.fess.crawler.entity.AccessResult)

Example 2 with AccessResult

use of org.codelibs.fess.crawler.entity.AccessResult in project fess-crawler by codelibs.

the class DataServiceImplTest method test_insert_deleteTx.

public void test_insert_deleteTx() {
    final AccessResult accessResult1 = new AccessResultImpl();
    accessResult1.setContentLength(Long.valueOf(10));
    accessResult1.setCreateTime(System.currentTimeMillis());
    accessResult1.setExecutionTime(10);
    accessResult1.setHttpStatusCode(200);
    accessResult1.setLastModified(System.currentTimeMillis());
    accessResult1.setMethod("GET");
    accessResult1.setMimeType("text/plain");
    accessResult1.setParentUrl("http://www.parent.com/");
    accessResult1.setRuleId("htmlRule");
    accessResult1.setSessionId("id1");
    accessResult1.setStatus(200);
    accessResult1.setUrl("http://www.id1.com/");
    dataService.store(accessResult1);
    final AccessResult accessResult2 = dataService.getAccessResult("id1", "http://www.id1.com/");
    assertNotNull(accessResult2);
    accessResult2.setMimeType("text/html");
    dataService.update(accessResult2);
    final AccessResult accessResult3 = dataService.getAccessResult("id1", "http://www.id1.com/");
    assertNotNull(accessResult3);
    assertEquals("text/html", accessResult3.getMimeType());
    dataService.delete("id1");
    final AccessResult accessResult4 = dataService.getAccessResult("id1", "http://www.id1.com/");
    assertNull(accessResult4);
}
Also used : AccessResult(org.codelibs.fess.crawler.entity.AccessResult) AccessResultImpl(org.codelibs.fess.crawler.entity.AccessResultImpl)

Example 3 with AccessResult

use of org.codelibs.fess.crawler.entity.AccessResult in project fess-crawler by codelibs.

the class EsDataServiceTest method test_insert_deleteTx.

public void test_insert_deleteTx() {
    final EsAccessResult accessResult1 = new EsAccessResult();
    accessResult1.setContentLength(Long.valueOf(10));
    accessResult1.setCreateTime(System.currentTimeMillis());
    accessResult1.setExecutionTime(10);
    accessResult1.setHttpStatusCode(200);
    accessResult1.setLastModified(System.currentTimeMillis());
    accessResult1.setMethod("GET");
    accessResult1.setMimeType("text/plain");
    accessResult1.setParentUrl("http://www.parent.com/");
    accessResult1.setRuleId("htmlRule");
    accessResult1.setSessionId("id1");
    accessResult1.setStatus(200);
    accessResult1.setUrl("http://www.id1.com/");
    dataService.store(accessResult1);
    final EsAccessResult accessResult2 = dataService.getAccessResult("id1", "http://www.id1.com/");
    assertNotNull(accessResult2);
    accessResult2.setMimeType("text/html");
    dataService.update(accessResult2);
    final AccessResult accessResult3 = dataService.getAccessResult("id1", "http://www.id1.com/");
    assertNotNull(accessResult3);
    assertEquals("text/html", accessResult3.getMimeType());
    dataService.delete("id1");
    final AccessResult accessResult4 = dataService.getAccessResult("id1", "http://www.id1.com/");
    assertNull(accessResult4);
}
Also used : EsAccessResult(org.codelibs.fess.crawler.entity.EsAccessResult) EsAccessResult(org.codelibs.fess.crawler.entity.EsAccessResult) AccessResult(org.codelibs.fess.crawler.entity.AccessResult)

Aggregations

AccessResult (org.codelibs.fess.crawler.entity.AccessResult)3 EsAccessResult (org.codelibs.fess.crawler.entity.EsAccessResult)2 ArrayList (java.util.ArrayList)1 AccessResultImpl (org.codelibs.fess.crawler.entity.AccessResultImpl)1