use of ai.grakn.engine.GraknKeyspaceStore in project grakn by graknlabs.
the class PostProcessingTaskTest method setupMocks.
@Before
public void setupMocks() {
GraknKeyspaceStore graknKeyspaceStore = mock(GraknKeyspaceStore.class);
when(graknKeyspaceStore.keyspaces()).thenReturn(keyspaces);
factory = mock(EngineGraknTxFactory.class);
when(factory.keyspaceStore()).thenReturn(graknKeyspaceStore);
indexPostProcessor = mock(IndexPostProcessor.class);
postProcessor = PostProcessor.create(indexPostProcessor, mock(CountPostProcessor.class));
config = mock(GraknConfig.class);
when(config.getProperty(GraknConfigKey.POST_PROCESSOR_POOL_SIZE)).thenReturn(5);
when(config.getProperty(GraknConfigKey.POST_PROCESSOR_DELAY)).thenReturn(1);
postProcessingTask = new PostProcessingTask(factory, indexPostProcessor, config);
}
use of ai.grakn.engine.GraknKeyspaceStore in project grakn by graknlabs.
the class CountPostProcessorTest method setupMocks.
@Before
public void setupMocks() {
countStorage = mock(RedisCountStorage.class);
when(countStorage.getCount(any())).thenReturn(1L);
configMock = mock(GraknConfig.class);
when(configMock.getProperty(GraknConfigKey.SHARDING_THRESHOLD)).thenReturn(5L);
GraknKeyspaceStore graknKeyspaceStoreMock = mock(GraknKeyspaceStore.class);
when(graknKeyspaceStoreMock.containsKeyspace(any())).thenReturn(true);
EmbeddedGraknTx txMock = mock(EmbeddedGraknTx.class);
when(txMock.admin()).thenReturn(mock(GraknAdmin.class));
factoryMock = mock(EngineGraknTxFactory.class);
when(factoryMock.keyspaceStore()).thenReturn(graknKeyspaceStoreMock);
when(factoryMock.tx(any(Keyspace.class), any())).thenReturn(txMock);
lockProviderMock = mock(LockProvider.class);
when(lockProviderMock.getLock(any())).thenReturn(new ReentrantLock());
metricRegistry = new MetricRegistry();
countPostProcessor = CountPostProcessor.create(configMock, factoryMock, lockProviderMock, metricRegistry, countStorage);
}
use of ai.grakn.engine.GraknKeyspaceStore in project grakn by graknlabs.
the class EngineGraknSessionTest method beforeClass.
@BeforeClass
public static void beforeClass() {
JedisLockProvider lockProvider = new JedisLockProvider(inMemoryRedisContext.jedisPool());
GraknKeyspaceStore keyspaceStore = GraknKeyspaceStoreFake.of();
graknFactory = EngineGraknTxFactory.create(lockProvider, config, keyspaceStore);
graknFactory.keyspaceStore().loadSystemSchema();
}
use of ai.grakn.engine.GraknKeyspaceStore in project grakn by graknlabs.
the class PostProcessingTask method run.
@Override
public void run() {
UUID executionId = UUID.randomUUID();
LOG.info("starting post-processing task with ID '" + executionId + "' ... ");
GraknKeyspaceStore keyspaceStore = factory.keyspaceStore();
if (keyspaceStore != null) {
keyspaceStore.keyspaces().forEach(keyspace -> runPostProcessing(executionId, keyspace));
LOG.info("post-processing task with ID " + executionId + "finished.");
} else {
LOG.info("post-processing " + executionId + ": waiting for system keyspace to be ready.");
}
}
Aggregations