Search in sources :

Example 1 with UrlDedupRecordEnricher

use of cz.mzk.recordmanager.server.index.enrich.UrlDedupRecordEnricher in project RecordManager2 by moravianlibrary.

the class UrlEnricherTest method krameriusUrlTest.

@Test
public void krameriusUrlTest() {
    DedupRecord dr = new DedupRecord();
    SolrInputDocument merged = new SolrInputDocument();
    List<SolrInputDocument> local = new ArrayList<SolrInputDocument>();
    local.add(newField(MZKKRAM_PROT_URL));
    local.add(newField(MZKKRAM_UNKN_URL));
    List<String> result = new ArrayList<>();
    result.add(MZKKRAM_PROT_URL);
    UrlDedupRecordEnricher ue = new UrlDedupRecordEnricher();
    ue.enrich(dr, merged, local);
    Assert.assertEquals(merged.getFieldValues(SolrFieldConstants.URL).toArray(), result.toArray());
}
Also used : SolrInputDocument(org.apache.solr.common.SolrInputDocument) UrlDedupRecordEnricher(cz.mzk.recordmanager.server.index.enrich.UrlDedupRecordEnricher) ArrayList(java.util.ArrayList) DedupRecord(cz.mzk.recordmanager.server.model.DedupRecord) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Example 2 with UrlDedupRecordEnricher

use of cz.mzk.recordmanager.server.index.enrich.UrlDedupRecordEnricher in project RecordManager2 by moravianlibrary.

the class UrlEnricherTest method notDuplicitUrlTest.

@Test
public void notDuplicitUrlTest() {
    DedupRecord dr = new DedupRecord();
    SolrInputDocument merged = new SolrInputDocument();
    List<SolrInputDocument> local = new ArrayList<SolrInputDocument>();
    local.add(newField(MZK_ONLINE_MZK_URL));
    local.add(newField(MZK_UNKNOWN_TRE_URL));
    local.add(newField(MZK_PROTECTED_BRNO_URL));
    List<String> result = new ArrayList<>();
    result.add(MZK_ONLINE_MZK_URL);
    result.add(MZK_UNKNOWN_TRE_URL);
    result.add(MZK_PROTECTED_BRNO_URL);
    UrlDedupRecordEnricher ue = new UrlDedupRecordEnricher();
    ue.enrich(dr, merged, local);
    Assert.assertTrue(merged.getFieldValues(SolrFieldConstants.URL).containsAll(result));
}
Also used : SolrInputDocument(org.apache.solr.common.SolrInputDocument) UrlDedupRecordEnricher(cz.mzk.recordmanager.server.index.enrich.UrlDedupRecordEnricher) ArrayList(java.util.ArrayList) DedupRecord(cz.mzk.recordmanager.server.model.DedupRecord) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Example 3 with UrlDedupRecordEnricher

use of cz.mzk.recordmanager.server.index.enrich.UrlDedupRecordEnricher in project RecordManager2 by moravianlibrary.

the class UrlEnricherTest method unknownUrlTest.

@Test
public void unknownUrlTest() {
    DedupRecord dr = new DedupRecord();
    SolrInputDocument merged = new SolrInputDocument();
    List<SolrInputDocument> local = new ArrayList<SolrInputDocument>();
    local.add(newField(MZK_UNKNOWN_MZK_TEXT_URL));
    local.add(newField(TRE_UNKNOWN_MZK_TEXT_URL));
    local.add(newField(MZK_UNKNOWN_BRNO_URL));
    local.add(newField(TRE_UNKNOWN_BRNO_URL));
    local.add(newField(MZK_UNKNOWN_TRE_URL));
    List<String> result = new ArrayList<>();
    result.add(MZK_UNKNOWN_TRE_URL);
    result.add(UNKNOWN_MZK_TEXT_URL);
    result.add(UNKNOWN_BRNO_URL);
    UrlDedupRecordEnricher ue = new UrlDedupRecordEnricher();
    ue.enrich(dr, merged, local);
    Assert.assertEquals(merged.getFieldValues(SolrFieldConstants.URL).toArray(), result.toArray());
}
Also used : SolrInputDocument(org.apache.solr.common.SolrInputDocument) UrlDedupRecordEnricher(cz.mzk.recordmanager.server.index.enrich.UrlDedupRecordEnricher) ArrayList(java.util.ArrayList) DedupRecord(cz.mzk.recordmanager.server.model.DedupRecord) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Example 4 with UrlDedupRecordEnricher

use of cz.mzk.recordmanager.server.index.enrich.UrlDedupRecordEnricher in project RecordManager2 by moravianlibrary.

the class UrlEnricherTest method onlineUrlTest.

@Test
public void onlineUrlTest() {
    DedupRecord dr = new DedupRecord();
    SolrInputDocument merged = new SolrInputDocument();
    List<SolrInputDocument> local = new ArrayList<SolrInputDocument>();
    local.add(newField(MZK_ONLINE_MZK_URL));
    local.add(newField(TRE_ONLINE_MZK_URL));
    local.add(newField(MZK_UNKNOWN_MZK_URL));
    local.add(newField(MZK_PROTECTED_MZK_URL));
    List<String> result = new ArrayList<>();
    result.add(MZK_ONLINE_MZK_URL);
    result.add(TRE_ONLINE_MZK_URL);
    UrlDedupRecordEnricher ue = new UrlDedupRecordEnricher();
    ue.enrich(dr, merged, local);
    Assert.assertEquals(merged.getFieldValues(SolrFieldConstants.URL).toArray(), result.toArray());
}
Also used : SolrInputDocument(org.apache.solr.common.SolrInputDocument) UrlDedupRecordEnricher(cz.mzk.recordmanager.server.index.enrich.UrlDedupRecordEnricher) ArrayList(java.util.ArrayList) DedupRecord(cz.mzk.recordmanager.server.model.DedupRecord) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Example 5 with UrlDedupRecordEnricher

use of cz.mzk.recordmanager.server.index.enrich.UrlDedupRecordEnricher in project RecordManager2 by moravianlibrary.

the class UrlEnricherTest method unknownProtectedUrlTest.

@Test
public void unknownProtectedUrlTest() {
    DedupRecord dr = new DedupRecord();
    SolrInputDocument merged = new SolrInputDocument();
    List<SolrInputDocument> local = new ArrayList<SolrInputDocument>();
    local.add(newField(TRE_UNKNOWN_MZK_URL));
    local.add(newField(MZK_PROTECTED_MZK_URL));
    List<String> result = new ArrayList<>();
    result.add(MZK_PROTECTED_MZK_URL);
    UrlDedupRecordEnricher ue = new UrlDedupRecordEnricher();
    ue.enrich(dr, merged, local);
    Assert.assertEquals(merged.getFieldValues(SolrFieldConstants.URL).toArray(), result.toArray());
}
Also used : SolrInputDocument(org.apache.solr.common.SolrInputDocument) UrlDedupRecordEnricher(cz.mzk.recordmanager.server.index.enrich.UrlDedupRecordEnricher) ArrayList(java.util.ArrayList) DedupRecord(cz.mzk.recordmanager.server.model.DedupRecord) Test(org.testng.annotations.Test) AbstractTest(cz.mzk.recordmanager.server.AbstractTest)

Aggregations

AbstractTest (cz.mzk.recordmanager.server.AbstractTest)5 UrlDedupRecordEnricher (cz.mzk.recordmanager.server.index.enrich.UrlDedupRecordEnricher)5 DedupRecord (cz.mzk.recordmanager.server.model.DedupRecord)5 ArrayList (java.util.ArrayList)5 SolrInputDocument (org.apache.solr.common.SolrInputDocument)5 Test (org.testng.annotations.Test)5