Search in sources :

Example 21 with ActionProfile

use of org.folio.ActionProfile in project mod-inventory by folio-org.

the class CreateMarcHoldingsEventHandlerTest method isEligibleShouldReturnFalseIfRecordIsNotHoldings.

@Test
public void isEligibleShouldReturnFalseIfRecordIsNotHoldings() {
    ActionProfile actionProfile = new ActionProfile().withId(UUID.randomUUID().toString()).withName("Create preliminary Item").withAction(ActionProfile.Action.CREATE).withFolioRecord(ITEM);
    ProfileSnapshotWrapper profileSnapshotWrapper = new ProfileSnapshotWrapper().withId(UUID.randomUUID().toString()).withProfileId(actionProfile.getId()).withContentType(JOB_PROFILE).withContent(actionProfile);
    DataImportEventPayload dataImportEventPayload = new DataImportEventPayload().withEventType(DI_INVENTORY_HOLDING_CREATED.value()).withContext(new HashMap<>()).withProfileSnapshot(profileSnapshotWrapper);
    assertFalse(createMarcHoldingsEventHandler.isEligible(dataImportEventPayload));
}
Also used : HashMap(java.util.HashMap) ActionProfile(org.folio.ActionProfile) ProfileSnapshotWrapper(org.folio.rest.jaxrs.model.ProfileSnapshotWrapper) DataImportEventPayload(org.folio.DataImportEventPayload) Test(org.junit.Test)

Example 22 with ActionProfile

use of org.folio.ActionProfile in project mod-inventory by folio-org.

the class CreateMarcHoldingsEventHandlerTest method isEligibleShouldReturnFalseIfActionIsNotCreate.

@Test
public void isEligibleShouldReturnFalseIfActionIsNotCreate() {
    ActionProfile actionProfile = new ActionProfile().withId(UUID.randomUUID().toString()).withName("Create preliminary Item").withAction(ActionProfile.Action.DELETE).withFolioRecord(HOLDINGS);
    ProfileSnapshotWrapper actionProfileSnapshotWrapper = new ProfileSnapshotWrapper().withId(UUID.randomUUID().toString()).withProfileId(actionProfile.getId()).withContentType(ACTION_PROFILE).withContent(actionProfile);
    DataImportEventPayload dataImportEventPayload = new DataImportEventPayload().withEventType(DI_INVENTORY_HOLDING_CREATED.value()).withContext(new HashMap<>()).withCurrentNode(actionProfileSnapshotWrapper);
    assertFalse(createMarcHoldingsEventHandler.isEligible(dataImportEventPayload));
}
Also used : HashMap(java.util.HashMap) ActionProfile(org.folio.ActionProfile) ProfileSnapshotWrapper(org.folio.rest.jaxrs.model.ProfileSnapshotWrapper) DataImportEventPayload(org.folio.DataImportEventPayload) Test(org.junit.Test)

Example 23 with ActionProfile

use of org.folio.ActionProfile in project mod-inventory by folio-org.

the class DeleteAuthorityEventHandlerTest method isEligibleShouldReturnFalseIfRecordIsNotAuthority.

@Test
public void isEligibleShouldReturnFalseIfRecordIsNotAuthority() {
    ActionProfile actionProfile = new ActionProfile().withId(UUID.randomUUID().toString()).withName("Delete Marc Authorities").withAction(DELETE).withFolioRecord(ITEM);
    ProfileSnapshotWrapper profileSnapshotWrapper = new ProfileSnapshotWrapper().withId(UUID.randomUUID().toString()).withProfileId(actionProfile.getId()).withContentType(ACTION_PROFILE).withContent(actionProfile);
    DataImportEventPayload dataImportEventPayload = new DataImportEventPayload().withEventType(DI_SRS_MARC_AUTHORITY_RECORD_DELETED.value()).withContext(context).withCurrentNode(profileSnapshotWrapper);
    assertFalse(eventHandler.isEligible(dataImportEventPayload));
}
Also used : ActionProfile(org.folio.ActionProfile) ProfileSnapshotWrapper(org.folio.rest.jaxrs.model.ProfileSnapshotWrapper) DataImportEventPayload(org.folio.DataImportEventPayload) Test(org.junit.Test)

Example 24 with ActionProfile

use of org.folio.ActionProfile in project mod-inventory by folio-org.

the class UpdateAuthorityEventHandlerTest method isEligibleShouldReturnFalseIfActionIsNotCreate.

@Test
public void isEligibleShouldReturnFalseIfActionIsNotCreate() {
    ActionProfile actionProfile = new ActionProfile().withId(UUID.randomUUID().toString()).withName("Create preliminary Item").withAction(ActionProfile.Action.UPDATE).withFolioRecord(AUTHORITY);
    ProfileSnapshotWrapper profileSnapshotWrapper = new ProfileSnapshotWrapper().withId(UUID.randomUUID().toString()).withProfileId(actionProfile.getId()).withContentType(JOB_PROFILE).withContent(actionProfile);
    DataImportEventPayload dataImportEventPayload = new DataImportEventPayload().withEventType(DI_INVENTORY_AUTHORITY_MATCHED.value()).withContext(new HashMap<>()).withProfileSnapshot(profileSnapshotWrapper);
    assertFalse(eventHandler.isEligible(dataImportEventPayload));
}
Also used : HashMap(java.util.HashMap) ActionProfile(org.folio.ActionProfile) ProfileSnapshotWrapper(org.folio.rest.jaxrs.model.ProfileSnapshotWrapper) DataImportEventPayload(org.folio.DataImportEventPayload) Test(org.junit.Test)

Example 25 with ActionProfile

use of org.folio.ActionProfile in project mod-inventory by folio-org.

the class CreateHoldingEventHandlerTest method isEligibleShouldReturnFalseIfRecordIsNotHoldings.

@Test
public void isEligibleShouldReturnFalseIfRecordIsNotHoldings() {
    ActionProfile actionProfile = new ActionProfile().withId(UUID.randomUUID().toString()).withName("Create preliminary Item").withAction(ActionProfile.Action.CREATE).withFolioRecord(ActionProfile.FolioRecord.INSTANCE);
    ProfileSnapshotWrapper profileSnapshotWrapper = new ProfileSnapshotWrapper().withId(UUID.randomUUID().toString()).withProfileId(actionProfile.getId()).withContentType(JOB_PROFILE).withContent(actionProfile);
    DataImportEventPayload dataImportEventPayload = new DataImportEventPayload().withEventType(DI_INVENTORY_HOLDING_CREATED.value()).withContext(new HashMap<>()).withCurrentNode(profileSnapshotWrapper);
    assertFalse(createHoldingEventHandler.isEligible(dataImportEventPayload));
}
Also used : HashMap(java.util.HashMap) ActionProfile(org.folio.ActionProfile) ProfileSnapshotWrapper(org.folio.rest.jaxrs.model.ProfileSnapshotWrapper) DataImportEventPayload(org.folio.DataImportEventPayload) Test(org.junit.Test)

Aggregations

ActionProfile (org.folio.ActionProfile)34 ProfileSnapshotWrapper (org.folio.rest.jaxrs.model.ProfileSnapshotWrapper)34 Test (org.junit.Test)33 DataImportEventPayload (org.folio.DataImportEventPayload)32 HashMap (java.util.HashMap)18 Async (io.vertx.ext.unit.Async)5 RegexPattern (com.github.tomakehurst.wiremock.matching.RegexPattern)2 UrlPathPattern (com.github.tomakehurst.wiremock.matching.UrlPathPattern)2 List (java.util.List)2 KeyValue (net.mguenther.kafka.junit.KeyValue)2 JobProfile (org.folio.JobProfile)2 AbstractRestTest (org.folio.rest.impl.AbstractRestTest)2 DataImportEventPayload (org.folio.rest.jaxrs.model.DataImportEventPayload)2 Event (org.folio.rest.jaxrs.model.Event)2 ParsedRecord (org.folio.rest.jaxrs.model.ParsedRecord)2 RawRecord (org.folio.rest.jaxrs.model.RawRecord)2 Record (org.folio.rest.jaxrs.model.Record)2 Json (io.vertx.core.json.Json)1 JsonObject (io.vertx.core.json.JsonObject)1 TestContext (io.vertx.ext.unit.TestContext)1