Search in sources :

Example 1 with COMMON_AGENCY

use of dk.dbc.search.solrdocstore.OpenAgencyUtil.COMMON_AGENCY in project solr-document-store by DBCDK.

the class DocumentRetrieveBeanIT method getDocumentWithHoldings.

@Test
public void getDocumentWithHoldings() throws Exception {
    System.out.println("getDocumentWithHoldings");
    DocumentRetrieveResponse resp = env().getPersistenceContext().run(() -> {
        build(300055).holdings(ON_SHELF);
        build(800055).holdings(ON_SHELF);
        build(710001, "CBA").holdings(ON_SHELF);
        return bean.getDocumentWithHoldingsitems(COMMON_AGENCY, "basis", ID);
    });
    System.out.println("resp = " + resp);
    Set<String> holdings = resp.holdingsItemRecords.stream().map(h -> h.getAgencyId() + "-" + h.getBibliographicRecordId()).collect(Collectors.toSet());
    assertThat(holdings, Matchers.containsInAnyOrder("300055-ABC", "710001-CBA"));
}
Also used : DocumentRetrieveResponse(dk.dbc.search.solrdocstore.response.DocumentRetrieveResponse) IndexKeys(dk.dbc.search.solrdocstore.jpa.IndexKeys) Arrays(java.util.Arrays) EnqueueCollector(dk.dbc.search.solrdocstore.enqueue.EnqueueCollector) OpenAgencyUtil.makeOpenAgencyEntity(dk.dbc.search.solrdocstore.OpenAgencyUtil.makeOpenAgencyEntity) Matchers.not(org.hamcrest.Matchers.not) BeanFactoryUtil.createDocumentRetrieveBean(dk.dbc.search.solrdocstore.BeanFactoryUtil.createDocumentRetrieveBean) JpaTestEnvironment(dk.dbc.commons.persistence.JpaTestEnvironment) SQLException(java.sql.SQLException) BeanFactoryUtil.createHoldingsItemBean(dk.dbc.search.solrdocstore.BeanFactoryUtil.createHoldingsItemBean) IndexKeysList(dk.dbc.search.solrdocstore.jpa.IndexKeysList) HoldingsToBibliographicEntity(dk.dbc.search.solrdocstore.jpa.HoldingsToBibliographicEntity) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) TypeReference(com.fasterxml.jackson.core.type.TypeReference) DocumentRetrieveResponse(dk.dbc.search.solrdocstore.response.DocumentRetrieveResponse) Before(org.junit.Before) COMMON_AGENCY(dk.dbc.search.solrdocstore.OpenAgencyUtil.COMMON_AGENCY) Matchers.empty(org.hamcrest.Matchers.empty) HoldingsItemEntity(dk.dbc.search.solrdocstore.jpa.HoldingsItemEntity) Matchers(org.hamcrest.Matchers) Set(java.util.Set) Test(org.junit.Test) IOException(java.io.IOException) EntityManager(javax.persistence.EntityManager) BeanFactoryUtil.createHoldingsToBibliographicBean(dk.dbc.search.solrdocstore.BeanFactoryUtil.createHoldingsToBibliographicBean) Collectors(java.util.stream.Collectors) BeanFactoryUtil.createBibliographicBean(dk.dbc.search.solrdocstore.BeanFactoryUtil.createBibliographicBean) List(java.util.List) QueueType(dk.dbc.search.solrdocstore.jpa.QueueType) Matchers.is(org.hamcrest.Matchers.is) Collections(java.util.Collections) BibliographicEntity(dk.dbc.search.solrdocstore.jpa.BibliographicEntity) Test(org.junit.Test)

Aggregations

TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 JpaTestEnvironment (dk.dbc.commons.persistence.JpaTestEnvironment)1 BeanFactoryUtil.createBibliographicBean (dk.dbc.search.solrdocstore.BeanFactoryUtil.createBibliographicBean)1 BeanFactoryUtil.createDocumentRetrieveBean (dk.dbc.search.solrdocstore.BeanFactoryUtil.createDocumentRetrieveBean)1 BeanFactoryUtil.createHoldingsItemBean (dk.dbc.search.solrdocstore.BeanFactoryUtil.createHoldingsItemBean)1 BeanFactoryUtil.createHoldingsToBibliographicBean (dk.dbc.search.solrdocstore.BeanFactoryUtil.createHoldingsToBibliographicBean)1 COMMON_AGENCY (dk.dbc.search.solrdocstore.OpenAgencyUtil.COMMON_AGENCY)1 OpenAgencyUtil.makeOpenAgencyEntity (dk.dbc.search.solrdocstore.OpenAgencyUtil.makeOpenAgencyEntity)1 EnqueueCollector (dk.dbc.search.solrdocstore.enqueue.EnqueueCollector)1 BibliographicEntity (dk.dbc.search.solrdocstore.jpa.BibliographicEntity)1 HoldingsItemEntity (dk.dbc.search.solrdocstore.jpa.HoldingsItemEntity)1 HoldingsToBibliographicEntity (dk.dbc.search.solrdocstore.jpa.HoldingsToBibliographicEntity)1 IndexKeys (dk.dbc.search.solrdocstore.jpa.IndexKeys)1 IndexKeysList (dk.dbc.search.solrdocstore.jpa.IndexKeysList)1 QueueType (dk.dbc.search.solrdocstore.jpa.QueueType)1 DocumentRetrieveResponse (dk.dbc.search.solrdocstore.response.DocumentRetrieveResponse)1 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1