Search in sources :

Example 1 with BibliographicEntityRequest

use of dk.dbc.search.solrdocstore.request.BibliographicEntityRequest in project solr-document-store by DBCDK.

the class BibliographicBeanIT method makeBibliographicRequestJson.

private String makeBibliographicRequestJson(int agency, Consumer<BibliographicEntityRequest> modifier) throws JSONBException {
    BibliographicEntityRequest entity = new BibliographicEntityRequest(agency, "clazzifier", "new", "id#0", "work:0", "unit:0", false, new IndexKeys(), "IT", null);
    modifier.accept(entity);
    return jsonbContext.marshall(entity);
}
Also used : IndexKeys(dk.dbc.search.solrdocstore.jpa.IndexKeys) SolrIndexKeys(dk.dbc.search.solrdocstore.SolrIndexKeys) BibliographicEntityRequest(dk.dbc.search.solrdocstore.request.BibliographicEntityRequest)

Example 2 with BibliographicEntityRequest

use of dk.dbc.search.solrdocstore.request.BibliographicEntityRequest in project solr-document-store by DBCDK.

the class BibliographicEntityRequestTest method testDecode.

@Test(timeout = 2_000L)
public void testDecode() throws Exception {
    System.out.println("testDecode");
    String jsonContentOld = "{\"superceds\":[\"a\"]}";
    BibliographicEntityRequest beOld = context.unmarshall(jsonContentOld, BibliographicEntityRequest.class);
    assertThat(beOld.getSupersedes(), containsInAnyOrder("a"));
    String jsonContentNew = "{\"supersedes\":[\"a\"]}";
    BibliographicEntityRequest beNew = context.unmarshall(jsonContentNew, BibliographicEntityRequest.class);
    assertThat(beNew.getSupersedes(), containsInAnyOrder("a"));
}
Also used : BibliographicEntityRequest(dk.dbc.search.solrdocstore.request.BibliographicEntityRequest) Test(org.junit.Test)

Example 3 with BibliographicEntityRequest

use of dk.dbc.search.solrdocstore.request.BibliographicEntityRequest in project solr-document-store by DBCDK.

the class BibliographicBeanIT method testHoldingsUponCommonStaysIfDeletedManifestationIsCreated.

@Test(timeout = 2_000L)
public void testHoldingsUponCommonStaysIfDeletedManifestationIsCreated() throws Exception {
    System.out.println("testHoldingsUponCommonStaysIfDeletedManifestationIsCreated");
    Response r;
    HoldingsToBibliographicEntity htob;
    HoldingsItemBean hol = createHoldingsItemBean(env());
    String a870970 = jsonbContext.marshall(new BibliographicEntityRequest(870970, "clazzifier", "25912233", "id#0", "work:0", "unit:0", false, new IndexKeys(), "IT", null));
    String d710100 = jsonbContext.marshall(new BibliographicEntityRequest(710100, "clazzifier", "25912233", "id#0", "work:0", "unit:0", true, new IndexKeys(), "IT", null));
    String h710100 = jsonRequestHold("710100-25912233-a");
    r = env().getPersistenceContext().run(() -> bean.addBibliographicKeys(true, a870970));
    assertThat(r.getStatus(), is(200));
    r = env().getPersistenceContext().run(() -> hol.setHoldingsKeys(h710100));
    assertThat(r.getStatus(), is(200));
    htob = env().getPersistenceContext().run(() -> em.find(HoldingsToBibliographicEntity.class, new HoldingsToBibliographicKey(710100, "25912233")));
    System.out.println("htob = " + htob);
    assertThat(htob, notNullValue());
    assertThat(htob.getBibliographicAgencyId(), is(870970));
    r = env().getPersistenceContext().run(() -> bean.addBibliographicKeys(true, d710100));
    assertThat(r.getStatus(), is(200));
    htob = env().getPersistenceContext().run(() -> em.find(HoldingsToBibliographicEntity.class, new HoldingsToBibliographicKey(710100, "25912233")));
    System.out.println("htob = " + htob);
    assertThat(htob, notNullValue());
    assertThat(htob.getBibliographicAgencyId(), is(870970));
}
Also used : Response(javax.ws.rs.core.Response) HoldingsToBibliographicEntity(dk.dbc.search.solrdocstore.jpa.HoldingsToBibliographicEntity) IndexKeys(dk.dbc.search.solrdocstore.jpa.IndexKeys) SolrIndexKeys(dk.dbc.search.solrdocstore.SolrIndexKeys) BibliographicEntityRequest(dk.dbc.search.solrdocstore.request.BibliographicEntityRequest) HoldingsToBibliographicKey(dk.dbc.search.solrdocstore.jpa.HoldingsToBibliographicKey) Test(org.junit.Test)

Aggregations

BibliographicEntityRequest (dk.dbc.search.solrdocstore.request.BibliographicEntityRequest)3 SolrIndexKeys (dk.dbc.search.solrdocstore.SolrIndexKeys)2 IndexKeys (dk.dbc.search.solrdocstore.jpa.IndexKeys)2 Test (org.junit.Test)2 HoldingsToBibliographicEntity (dk.dbc.search.solrdocstore.jpa.HoldingsToBibliographicEntity)1 HoldingsToBibliographicKey (dk.dbc.search.solrdocstore.jpa.HoldingsToBibliographicKey)1 Response (javax.ws.rs.core.Response)1