Search in sources :

Example 1 with KogitoProcessInstancesFactory

use of org.kie.kogito.persistence.KogitoProcessInstancesFactory in project kogito-runtimes by kiegroup.

the class KogitoProcessInstancesFactoryIT method test.

@Test
void test() {
    MongoDBTransactionManager transactionManager = mock(MongoDBTransactionManager.class);
    KogitoProcessInstancesFactory factory = new KogitoProcessInstancesFactory(getMongoClient()) {

        @Override
        public String dbName() {
            return DB_NAME;
        }

        @Override
        public MongoDBTransactionManager transactionManager() {
            return transactionManager;
        }

        @Override
        public boolean lock() {
            return false;
        }
    };
    assertNotNull(factory);
    assertThat(factory.dbName()).isEqualTo(DB_NAME);
    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);
    assertEquals(transactionManager, factory.transactionManager());
}
Also used : MongoDBTransactionManager(org.kie.kogito.mongodb.transaction.MongoDBTransactionManager) KogitoProcessInstancesFactory(org.kie.kogito.persistence.KogitoProcessInstancesFactory) Test(org.junit.jupiter.api.Test)

Example 2 with KogitoProcessInstancesFactory

use of org.kie.kogito.persistence.KogitoProcessInstancesFactory in project kogito-runtimes by kiegroup.

the class KogitoProcessInstancesFactoryTest method testCreate.

@Test
void testCreate() {
    RemoteCacheManager cacheManager = mock(RemoteCacheManager.class);
    when(cacheManager.administration()).thenReturn(mock(RemoteCacheManagerAdmin.class));
    KogitoProcessInstancesFactory factory = new KogitoProcessInstancesFactory(cacheManager) {

        @Override
        public boolean lock() {
            return false;
        }
    };
    assertNotNull(factory.createProcessInstances(mock(Process.class)));
}
Also used : RemoteCacheManager(org.infinispan.client.hotrod.RemoteCacheManager) KogitoProcessInstancesFactory(org.kie.kogito.persistence.KogitoProcessInstancesFactory) RemoteCacheManagerAdmin(org.infinispan.client.hotrod.RemoteCacheManagerAdmin) Test(org.junit.jupiter.api.Test)

Example 3 with KogitoProcessInstancesFactory

use of org.kie.kogito.persistence.KogitoProcessInstancesFactory in project kogito-runtimes by kiegroup.

the class CacheProcessInstancesWithLockIT method createProcess.

private BpmnProcess createProcess(String fileName) {
    BpmnProcess process = BpmnProcess.from(new ClassPathResource(fileName)).get(0);
    KogitoProcessInstancesFactory factory = mock(KogitoProcessInstancesFactory.class);
    process.setProcessInstancesFactory(factory);
    process.configure();
    return process;
}
Also used : BpmnProcess(org.kie.kogito.process.bpmn2.BpmnProcess) KogitoProcessInstancesFactory(org.kie.kogito.persistence.KogitoProcessInstancesFactory) ClassPathResource(org.drools.core.io.impl.ClassPathResource)

Aggregations

KogitoProcessInstancesFactory (org.kie.kogito.persistence.KogitoProcessInstancesFactory)3 Test (org.junit.jupiter.api.Test)2 ClassPathResource (org.drools.core.io.impl.ClassPathResource)1 RemoteCacheManager (org.infinispan.client.hotrod.RemoteCacheManager)1 RemoteCacheManagerAdmin (org.infinispan.client.hotrod.RemoteCacheManagerAdmin)1 MongoDBTransactionManager (org.kie.kogito.mongodb.transaction.MongoDBTransactionManager)1 BpmnProcess (org.kie.kogito.process.bpmn2.BpmnProcess)1