use of org.apache.ignite.testframework.junits.GridTestKernalContext in project ignite by apache.
the class GridLogCommandHandlerTest method testHandleAsync.
/**
* @throws Exception If failed.
*/
public void testHandleAsync() 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(2);
req.path(igniteHome + "/work/log/" + "test.log");
IgniteInternalFuture<GridRestResponse> resp = cmdHandler.handleAsync(req);
assertNull(resp.result().getError());
assertEquals(GridRestResponse.STATUS_SUCCESS, resp.result().getSuccessStatus());
assertNotNull(resp.result().getResponse());
}
use of org.apache.ignite.testframework.junits.GridTestKernalContext in project ignite by apache.
the class GridLogCommandHandlerTest method testHandleAsyncPathIsOutsideIgniteHome.
/**
* @throws Exception If failed.
*/
public void testHandleAsyncPathIsOutsideIgniteHome() 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(2);
req.path("/home/users/mytest.log");
IgniteInternalFuture<GridRestResponse> resp = cmdHandler.handleAsync(req);
assertEquals("Request parameter 'path' must contain a path to valid log file.", 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 GridLogCommandHandlerTest method testHandleAsyncFromEqualTo.
/**
* @throws Exception If failed.
*/
public void testHandleAsyncFromEqualTo() 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(5);
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 GridDeploymentManagerStopSelfTest method testOnKernalStop.
/**
* @throws Exception If failed.
*/
public void testOnKernalStop() throws Exception {
DeploymentSpi spi = new GridTestDeploymentSpi();
GridTestKernalContext ctx = newContext();
ctx.config().setMarshaller(new JdkMarshaller());
ctx.config().setDeploymentSpi(spi);
GridResourceProcessor resProc = new GridResourceProcessor(ctx);
resProc.setSpringContext(null);
ctx.add(resProc);
GridComponent mgr = new GridDeploymentManager(ctx);
try {
mgr.onKernalStop(true);
} catch (Exception e) {
error("Error during onKernalStop() callback.", e);
assert false : "Unexpected exception " + e;
}
}
Aggregations