Search in sources :

Example 1 with AbstractTransactionManager

use of org.kie.kogito.mongodb.transaction.AbstractTransactionManager in project kogito-runtimes by kiegroup.

the class KogitoProcessInstancesFactoryIT method test.

@Test
void test() {
    AbstractTransactionManager transactionManager = mock(AbstractTransactionManager.class);
    AbstractProcessInstancesFactory factory = new AbstractProcessInstancesFactory(getMongoClient(), DB_NAME, false, transactionManager) {
    };
    assertNotNull(factory);
    Process<?> process = mock(Process.class);
    lenient().when(process.id()).thenReturn(PROCESS_NAME);
    lenient().when(process.name()).thenReturn(PROCESS_NAME);
    MongoDBProcessInstances<?> instance = factory.createProcessInstances(process);
    assertNotNull(instance);
}
Also used : AbstractTransactionManager(org.kie.kogito.mongodb.transaction.AbstractTransactionManager) Test(org.junit.jupiter.api.Test)

Example 2 with AbstractTransactionManager

use of org.kie.kogito.mongodb.transaction.AbstractTransactionManager in project kogito-runtimes by kiegroup.

the class MongoDBProcessInstancesIT method testValuesReadMode.

@Test
void testValuesReadMode() {
    AbstractTransactionManager transactionManager = new AbstractTransactionManager(mongoClient, false) {
    };
    testValuesReadMode(transactionManager);
}
Also used : AbstractTransactionManager(org.kie.kogito.mongodb.transaction.AbstractTransactionManager) Test(org.junit.jupiter.api.Test)

Example 3 with AbstractTransactionManager

use of org.kie.kogito.mongodb.transaction.AbstractTransactionManager in project kogito-runtimes by kiegroup.

the class MongoDBProcessInstancesIT method testFindByIdReadModeWithTransaction.

@Test
void testFindByIdReadModeWithTransaction() {
    AbstractTransactionManager transactionManager = new AbstractTransactionManager(mongoClient, true) {
    };
    transactionManager.onBeforeStartEvent(new UnitOfWorkStartEvent(null));
    testFindByIdReadMode(transactionManager);
    transactionManager.onAfterEndEvent(new UnitOfWorkEndEvent(null));
}
Also used : UnitOfWorkStartEvent(org.kie.kogito.uow.events.UnitOfWorkStartEvent) UnitOfWorkEndEvent(org.kie.kogito.uow.events.UnitOfWorkEndEvent) AbstractTransactionManager(org.kie.kogito.mongodb.transaction.AbstractTransactionManager) Test(org.junit.jupiter.api.Test)

Example 4 with AbstractTransactionManager

use of org.kie.kogito.mongodb.transaction.AbstractTransactionManager in project kogito-runtimes by kiegroup.

the class MongoDBProcessInstancesIT method testFindByIdReadMode.

@Test
void testFindByIdReadMode() {
    AbstractTransactionManager transactionManager = new AbstractTransactionManager(mongoClient, false) {
    };
    testFindByIdReadMode(transactionManager);
}
Also used : AbstractTransactionManager(org.kie.kogito.mongodb.transaction.AbstractTransactionManager) Test(org.junit.jupiter.api.Test)

Example 5 with AbstractTransactionManager

use of org.kie.kogito.mongodb.transaction.AbstractTransactionManager in project kogito-runtimes by kiegroup.

the class MongoDBProcessInstancesIT method testValuesReadModeWithTransaction.

@Test
void testValuesReadModeWithTransaction() {
    AbstractTransactionManager transactionManager = new AbstractTransactionManager(mongoClient, true) {
    };
    transactionManager.onBeforeStartEvent(new UnitOfWorkStartEvent(null));
    testValuesReadMode(transactionManager);
    transactionManager.onAfterEndEvent(new UnitOfWorkEndEvent(null));
}
Also used : UnitOfWorkStartEvent(org.kie.kogito.uow.events.UnitOfWorkStartEvent) UnitOfWorkEndEvent(org.kie.kogito.uow.events.UnitOfWorkEndEvent) AbstractTransactionManager(org.kie.kogito.mongodb.transaction.AbstractTransactionManager) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)9 AbstractTransactionManager (org.kie.kogito.mongodb.transaction.AbstractTransactionManager)9 UnitOfWorkEndEvent (org.kie.kogito.uow.events.UnitOfWorkEndEvent)4 UnitOfWorkStartEvent (org.kie.kogito.uow.events.UnitOfWorkStartEvent)4 MongoClient (com.mongodb.client.MongoClient)2 Document (org.bson.Document)2 ClassPathResource (org.drools.util.io.ClassPathResource)2 BpmnProcess (org.kie.kogito.process.bpmn2.BpmnProcess)2 BpmnVariables (org.kie.kogito.process.bpmn2.BpmnVariables)2 ClientSession (com.mongodb.client.ClientSession)1 MongoClients (com.mongodb.client.MongoClients)1 MongoCollection (com.mongodb.client.MongoCollection)1 MongoDatabase (com.mongodb.client.MongoDatabase)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1