use of dk.dbc.search.solrdocstore.jpa.IndexKeys in project solr-document-store by DBCDK.
the class BibliographicEntityIT method LoadEntity.
@Test
public void LoadEntity() {
executeScriptResource("/entityTestData.sql");
EntityManager em = env().getEntityManager();
AgencyClassifierItemKey key = new AgencyClassifierItemKey(300, "clazzifier", "4321");
BibliographicEntity be = env().getPersistenceContext().run(() -> em.find(BibliographicEntity.class, key));
assertThat(be.getAgencyId(), is(300));
assertThat(be.getClassifier(), is("clazzifier"));
assertThat(be.getBibliographicRecordId(), is("4321"));
assertThat(be.getWork(), is("work:3"));
assertThat(be.getUnit(), is("unit:3"));
assertThat(be.isDeleted(), is(true));
IndexKeys expected = new IndexKeys();
expected.put("ti", Arrays.asList("isdnBogen", "title2"));
expected.put("001", Collections.singletonList("argle"));
assertThat(be.getIndexKeys(), is(expected));
assertThat(be.getTrackingId(), is("track"));
}
use of dk.dbc.search.solrdocstore.jpa.IndexKeys in project solr-document-store by DBCDK.
the class BibliographicEntityIT method StoreEntity.
@Test
public void StoreEntity() {
EntityManager em = env().getEntityManager();
env().getPersistenceContext().run(() -> {
IndexKeys indexKeys = new IndexKeys();
indexKeys.put("titel", Collections.singletonList("unix bogen"));
indexKeys.put("id", Collections.singletonList("argle"));
BibliographicEntity be = new BibliographicEntity(200, "clazzifier", "1234", "id#1", "work:1", "unit:2", false, indexKeys, "");
em.persist(be);
});
AgencyClassifierItemKey key = new AgencyClassifierItemKey(200, "clazzifier", "1234");
BibliographicEntity be2 = env().getPersistenceContext().run(() -> em.find(BibliographicEntity.class, key));
assertThat(be2.getAgencyId(), is(200));
assertThat(be2.getClassifier(), is("clazzifier"));
assertThat(be2.getBibliographicRecordId(), is("1234"));
}
use of dk.dbc.search.solrdocstore.jpa.IndexKeys in project solr-document-store by DBCDK.
the class BibliographicEntityTest method simpleDecode.
@Test
public void simpleDecode() throws Exception {
String jsonContent = "{\"agencyId\":200,\"classifier\":\"clazzifier\",\"bibliographicRecordId\":\"1234\",\"repositoryId\":\"id#1\",\"work\":\"work:1\",\"unit\":\"unit:2\",\"deleted\":false,\"indexKeys\":{\"title\": [\"unix bogen\", \"title2\"], \"id\": [\"argle\"] },\"trackingId\":\"\"}";
BibliographicEntity be = context.unmarshall(jsonContent, BibliographicEntity.class);
assertThat(be.getAgencyId(), is(200));
assertThat(be.getClassifier(), is("clazzifier"));
assertThat(be.getBibliographicRecordId(), is("1234"));
assertThat(be.getRepositoryId(), is("id#1"));
assertThat(be.getWork(), is("work:1"));
assertThat(be.getUnit(), is("unit:2"));
assertThat(be.isDeleted(), is(false));
assertThat(be.getTrackingId(), is(""));
IndexKeys expected = new IndexKeys();
expected.put("title", Arrays.asList("unix bogen", "title2"));
expected.put("id", Collections.singletonList("argle"));
assertThat(be.getIndexKeys(), is(expected));
}
use of dk.dbc.search.solrdocstore.jpa.IndexKeys in project solr-document-store by DBCDK.
the class BibliographicRecordAPIBeanIT method testGetBibliographicRecord.
@Test
public void testGetBibliographicRecord() {
Response result = bean.getBibliographicRecord("page-order", 103862);
BibliographicFrontendResponse res = (BibliographicFrontendResponse) result.getEntity();
IndexKeys map = new IndexKeys();
map.put("rec.repositoryId", Collections.singletonList("p-o"));
BibliographicEntity b = new BibliographicEntity(103862, "clazzifier", "page-order", "p-o", "work:2", "unit:6", false, map, "track:8");
Assert.assertEquals(res, new BibliographicFrontendResponse(b, "0639423"));
}
use of dk.dbc.search.solrdocstore.jpa.IndexKeys in project solr-document-store by DBCDK.
the class EnqueueSupplierBeanIT method addBibliographic.
private BibliographicEntity addBibliographic(int agency, String classifier, String bibliographicRecordId, Optional<List<String>> superseed) throws SQLException {
List<String> superseedList = superseed.orElse(Collections.emptyList());
BibliographicEntity e = new BibliographicEntity(agency, classifier, bibliographicRecordId, "id#1", "work:0", "unit:0", false, new IndexKeys(), "IT");
bibliographicBean.addBibliographicKeys(e, superseedList, true);
return e;
}
Aggregations