use of org.apache.ignite.testframework.junits.GridTestKernalContext in project ignite by apache.
the class GridLogCommandHandlerTest method testHandleAsyncFromGreaterThanTo.
/**
* @throws Exception If failed.
*/
@Test
public void testHandleAsyncFromGreaterThanTo() throws Exception {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setIgniteHome(igniteHome);
GridTestKernalContext ctx = newContext(cfg);
GridLogCommandHandler cmdHandler = new GridLogCommandHandler(ctx);
GridRestLogRequest req = new GridRestLogRequest();
req.to(5);
req.from(7);
req.path(igniteHome + "/work/log/" + "test.log");
IgniteInternalFuture<GridRestResponse> resp = cmdHandler.handleAsync(req);
assertEquals("Request parameter 'from' must be less than 'to'.", resp.result().getError());
assertEquals(GridRestResponse.STATUS_FAILED, resp.result().getSuccessStatus());
assertNull(resp.result().getResponse());
}
use of org.apache.ignite.testframework.junits.GridTestKernalContext in project ignite by apache.
the class GridQueryCommandHandlerTest method testSupportedCommands.
/**
* @throws Exception If failed.
*/
@Test
public void testSupportedCommands() throws Exception {
GridTestKernalContext ctx = newContext(grid().configuration());
ctx.add(new GridTimeoutProcessor(ctx));
QueryCommandHandler cmdHnd = new QueryCommandHandler(ctx);
Collection<GridRestCommand> commands = cmdHnd.supportedCommands();
assertEquals(5, commands.size());
assertTrue(commands.contains(GridRestCommand.EXECUTE_SQL_QUERY));
assertTrue(commands.contains(GridRestCommand.EXECUTE_SQL_FIELDS_QUERY));
assertTrue(commands.contains(GridRestCommand.EXECUTE_SCAN_QUERY));
assertTrue(commands.contains(GridRestCommand.FETCH_SQL_QUERY));
assertTrue(commands.contains(GridRestCommand.CLOSE_SQL_QUERY));
}
use of org.apache.ignite.testframework.junits.GridTestKernalContext in project ignite by apache.
the class GridHashMapLoadTest method testMapEntry.
/**
* @throws Exception If failed.
*/
@Test
public void testMapEntry() throws Exception {
Map<Integer, GridCacheMapEntry> map = new HashMap<>(5 * 1024 * 1024);
int i = 0;
GridCacheTestContext<Integer, Integer> ctx = new GridCacheTestContext<>(new GridTestKernalContext(new GridTestLog4jLogger()));
while (true) {
Integer key = i++;
map.put(key, new GridCacheMapEntry(ctx, ctx.toCacheKeyObject(key)) {
@Override
public boolean tmLock(IgniteInternalTx tx, long timeout, @Nullable GridCacheVersion serOrder, GridCacheVersion serReadVer, boolean read) {
return false;
}
@Override
protected void checkThreadChain(GridCacheMvccCandidate owner) {
// No-op.
}
@Override
public void txUnlock(IgniteInternalTx tx) {
// No-op.
}
@Override
public boolean removeLock(GridCacheVersion ver) {
return false;
}
});
if (i % 100000 == 0)
info("Inserted objects: " + i / 2);
}
}
use of org.apache.ignite.testframework.junits.GridTestKernalContext in project ignite by apache.
the class BPlusTreeReplaceRemoveRaceTest method createPageMemory.
/**
* @return Page memory.
*/
protected PageMemory createPageMemory() {
DataRegionConfiguration plcCfg = new DataRegionConfiguration().setInitialSize(1024 * MB).setMaxSize(1024 * MB);
PageMemory pageMem = new PageMemoryNoStoreImpl(log, new UnsafeMemoryProvider(log), null, PAGE_SIZE, plcCfg, new DataRegionMetricsImpl(plcCfg, new GridTestKernalContext(log())), true);
pageMem.start();
return pageMem;
}
use of org.apache.ignite.testframework.junits.GridTestKernalContext in project ignite by apache.
the class DataRegionMetricsSelfTest method beforeTest.
/**
* {@inheritDoc}
*/
@Override
protected void beforeTest() throws Exception {
DataRegionConfiguration plcCfg = new DataRegionConfiguration();
IgniteConfiguration cfg = new IgniteConfiguration().setMetricExporterSpi(new NoopMetricExporterSpi());
GridTestKernalContext ctx = new GridTestKernalContext(new GridTestLog4jLogger(), cfg);
ctx.add(new GridMetricManager(ctx));
ctx.add(new PerformanceStatisticsProcessor(ctx));
memMetrics = new DataRegionMetricsImpl(plcCfg, ctx);
memMetrics.enableMetrics();
}
Aggregations