use of org.apache.ignite.internal.processors.rest.handlers.probe.GridProbeCommandHandler in project ignite by apache.
the class GridRestProcessor method start.
/**
* {@inheritDoc}
*/
@Override
public void start() throws IgniteCheckedException {
if (isRestEnabled()) {
if (notStartOnClient()) {
U.quietAndInfo(log, "REST protocols do not start on client node. " + "To start the protocols on client node set '-DIGNITE_REST_START_ON_CLIENT=true' system property.");
return;
}
// Register handlers.
addHandler(new GridCacheCommandHandler(ctx));
addHandler(new GridTaskCommandHandler(ctx));
addHandler(new GridTopologyCommandHandler(ctx));
addHandler(new GridVersionCommandHandler(ctx));
addHandler(new DataStructuresCommandHandler(ctx));
addHandler(new QueryCommandHandler(ctx));
addHandler(new GridLogCommandHandler(ctx));
addHandler(new GridChangeStateCommandHandler(ctx));
addHandler(new GridChangeClusterStateCommandHandler(ctx));
addHandler(new GridClusterNameCommandHandler(ctx));
addHandler(new AuthenticationCommandHandler(ctx));
addHandler(new UserActionCommandHandler(ctx));
addHandler(new GridBaselineCommandHandler(ctx));
addHandler(new MemoryMetricsCommandHandler(ctx));
addHandler(new NodeStateBeforeStartCommandHandler(ctx));
addHandler(new GridProbeCommandHandler(ctx));
// Start protocols.
startTcpProtocol();
startHttpProtocol();
for (GridRestProtocol proto : protos) {
Collection<IgniteBiTuple<String, Object>> props = proto.getProperties();
if (props != null) {
for (IgniteBiTuple<String, Object> p : props) {
String key = p.getKey();
if (key == null)
continue;
if (ctx.hasNodeAttribute(key))
throw new IgniteCheckedException("Node attribute collision for attribute [processor=GridRestProcessor, attr=" + key + ']');
ctx.addNodeAttribute(key, p.getValue());
}
}
proto.onProcessorStart();
}
}
}
use of org.apache.ignite.internal.processors.rest.handlers.probe.GridProbeCommandHandler in project ignite by apache.
the class GridProbeCommandTest method testRestProbeCommand.
/**
* Test for the REST probe command
*
* @throws Exception If failed.
*/
@Test
public void testRestProbeCommand() throws Exception {
startGrid("regular");
GridRestCommandHandler hnd = new GridProbeCommandHandler((grid("regular")).context());
GridRestCacheRequest req = new GridRestCacheRequest();
req.command(GridRestCommand.PROBE);
IgniteInternalFuture<GridRestResponse> resp = hnd.handleAsync(req);
resp.get();
assertEquals(GridRestResponse.STATUS_SUCCESS, resp.result().getSuccessStatus());
assertEquals("grid has started", resp.result().getResponse());
}
Aggregations