Search in sources :

Example 1 with MongoStorage

use of org.kie.kogito.persistence.mongodb.storage.MongoStorage in project kogito-apps by kiegroup.

the class ProcessIndexObserverIT method testOnProcessIndexEvent.

@Test
void testOnProcessIndexEvent() {
    String processId = "testProcess";
    String processType = "testProcessType";
    ProcessDescriptor processDescriptor = new ProcessDescriptor(processId, processType);
    ProcessIndexEvent processIndexEvent = new ProcessIndexEvent(processDescriptor);
    processIndexObserver.onProcessIndexEvent(processIndexEvent);
    Storage<String, String> processIdStorage = new MongoStorage<>(mongoClientManager.getCollection(PROCESS_ID_MODEL_STORAGE, ProcessIdEntity.class), String.class.getName(), new ProcessIdEntityMapper());
    assertTrue(processIdStorage.containsKey(processId));
    assertEquals(processType, processIdStorage.get(processId));
    mockIndexCreateOrUpdateEventListener.assertFire("testProcess_domain", processType);
}
Also used : ProcessIdEntityMapper(org.kie.kogito.index.mongodb.model.ProcessIdEntityMapper) ProcessIdEntity(org.kie.kogito.index.mongodb.model.ProcessIdEntity) ProcessDescriptor(org.kie.kogito.persistence.api.schema.ProcessDescriptor) ProcessIndexEvent(org.kie.kogito.persistence.mongodb.index.ProcessIndexEvent) MongoStorage(org.kie.kogito.persistence.mongodb.storage.MongoStorage) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

QuarkusTest (io.quarkus.test.junit.QuarkusTest)1 Test (org.junit.jupiter.api.Test)1 ProcessIdEntity (org.kie.kogito.index.mongodb.model.ProcessIdEntity)1 ProcessIdEntityMapper (org.kie.kogito.index.mongodb.model.ProcessIdEntityMapper)1 ProcessDescriptor (org.kie.kogito.persistence.api.schema.ProcessDescriptor)1 ProcessIndexEvent (org.kie.kogito.persistence.mongodb.index.ProcessIndexEvent)1 MongoStorage (org.kie.kogito.persistence.mongodb.storage.MongoStorage)1