use of dk.dbc.search.solrdocstore.jpa.HoldingsItemEntity in project solr-document-store by DBCDK.
the class BibliographicRecordAPIBeanIT method createBibAndHoldings.
private void createBibAndHoldings(int agencyId, String bibliographicRecordId, int... agencies) {
em.persist(new BibliographicEntity(agencyId, "clazzifier", bibliographicRecordId, "id#1", "w", "u", false, new IndexKeys(), "IT"));
for (int i = 0; i < agencies.length; i++) {
em.persist(new HoldingsItemEntity(agencies[i], bibliographicRecordId, SolrIndexKeys.ON_SHELF, "track"));
HoldingsToBibliographicEntity h2b = new HoldingsToBibliographicEntity(agencies[i], bibliographicRecordId, agencyId, false);
em.persist(h2b);
}
}
use of dk.dbc.search.solrdocstore.jpa.HoldingsItemEntity in project solr-document-store by DBCDK.
the class DocumentRetrieveBeanIT method newCommonRecordWithExistingHoldings.
@Test
public void newCommonRecordWithExistingHoldings() throws Exception {
em.merge(new BibliographicEntity(300000, "clazzifier", "12345678", "id#1", "work:0", "unit:0", false, new IndexKeys(), "T1"));
em.merge(new HoldingsItemEntity(300101, "12345678", new IndexKeysList(), "T2"));
em.merge(new HoldingsItemEntity(300102, "12345678", new IndexKeysList(), "T3"));
em.merge(new HoldingsToBibliographicEntity(300101, "12345678", 300000, false));
em.merge(new HoldingsToBibliographicEntity(300102, "12345678", 300000, false));
DocumentRetrieveResponse doc = env().getPersistenceContext().run(() -> bean.getDocumentWithHoldingsitems(300000, "clazzifier", "12345678"));
assertThat(doc.bibliographicRecord.getAgencyId(), is(300000));
assertThat(doc.bibliographicRecord.getBibliographicRecordId(), is("12345678"));
assertThat(doc.holdingsItemRecords.size(), is(2));
}
use of dk.dbc.search.solrdocstore.jpa.HoldingsItemEntity in project solr-document-store by DBCDK.
the class DocumentRetrieveResponseTest method testCase.
@Test(timeout = 2_000L)
public void testCase() throws Exception {
System.out.println("testCase");
List<HoldingsItemEntity> holdingsItemRecords = Arrays.asList(hiEntityWith("[" + "{'holdingsitem.status':['online']}," + "{'holdingsitem.itemId':['a1', 'a2', 'a3'], 'holdingsitem.status':['onshelf']}" + "]"), hiEntityWith("[" + "{'holdingsitem.itemId':['b1', 'b2'], 'holdingsitem.status':['onshelf']}," + "{'holdingsitem.itemId':['c1', 'c2'], 'holdingsitem.status':['onshelf']}," + "{'holdingsitem.itemId':['d1'], 'holdingsitem.status':['onloan']}" + "]"));
DocumentRetrieveResponse resp = new DocumentRetrieveResponse(null, holdingsItemRecords, null, null);
System.out.println("resp.totalStatusCount = " + resp.totalStatusCount);
List<String> summarized = resp.totalStatusCount.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).collect(Collectors.toList());
assertThat(summarized, containsInAnyOrder("onshelf=7", "online=1", "onloan=1"));
}
use of dk.dbc.search.solrdocstore.jpa.HoldingsItemEntity in project solr-document-store by DBCDK.
the class EnqueueSupplierBeanIT method holdingsUpdate.
@Test(timeout = 2_000L)
public void holdingsUpdate() {
System.out.println("holdingsUpdate");
/*
* Add Bib( 870970 )
* Add Holding ( FBS )
* Queue contains 870970
* Clear queue
*
* Fetch Holding back, update some field
* Queue contains 870970
*/
HoldingsItemEntity h = env().getPersistenceContext().run(() -> {
addBibliographic(commonAgency, "test");
return addHoldings(fbsAgency, "test");
});
assertThat(queueContentAndClear(), containsInAnyOrder(queueItem(commonAgency, "clazzifier", "test"), queueItem("unit:0"), queueItem("work:0")));
env().getPersistenceContext().run(() -> {
h.setTrackingId("NEW");
holdingsItemBean.setHoldingsKeys(h);
});
assertThat(queueContentAndClear(), containsInAnyOrder(queueItem(commonAgency, "clazzifier", "test"), queueItem("unit:0"), queueItem("work:0")));
}
use of dk.dbc.search.solrdocstore.jpa.HoldingsItemEntity in project solr-document-store by DBCDK.
the class EnqueueSupplierBeanIT method addHoldings.
private HoldingsItemEntity addHoldings(int holdingAgency, String holdingBibliographicId) throws SQLException {
// Dummy holding - ensure enqueue from non existing to this
HoldingsItemEntity e = new HoldingsItemEntity(holdingAgency, holdingBibliographicId, SolrIndexKeys.ON_SHELF, "IT");
holdingsItemBean.setHoldingsKeys(e);
return e;
}
Aggregations