use of org.apache.ignite.testframework.junits.IgniteTestResources in project ignite by apache.
the class GridTcpCommunicationSpiConcurrentConnectSelfTest method stopSpis.
/**
* @throws Exception If failed.
*/
private void stopSpis() throws Exception {
if (timeoutProcessor != null) {
timeoutProcessor.onKernalStop(true);
timeoutProcessor.stop(true);
timeoutProcessor = null;
}
for (CommunicationSpi<Message> spi : spis) {
spi.onContextDestroyed();
spi.setListener(null);
spi.spiStop();
}
for (IgniteTestResources rsrcs : spiRsrcs) rsrcs.stopThreads();
}
use of org.apache.ignite.testframework.junits.IgniteTestResources in project ignite by apache.
the class GridTcpCommunicationSpiMultithreadedSelfTest method afterTestsStopped.
/**
* {@inheritDoc}
*/
@Override
protected void afterTestsStopped() throws Exception {
if (timeoutProcessor != null) {
timeoutProcessor.onKernalStop(true);
timeoutProcessor.stop(true);
timeoutProcessor = null;
}
for (CommunicationSpi<Message> spi : spis.values()) {
spi.onContextDestroyed();
spi.setListener(null);
spi.spiStop();
}
for (IgniteTestResources rsrcs : spiRsrcs) rsrcs.stopThreads();
lsnrs.clear();
spiRsrcs.clear();
spis.clear();
nodes.clear();
}
use of org.apache.ignite.testframework.junits.IgniteTestResources in project ignite by apache.
the class GridTcpCommunicationSpiMultithreadedSelfTest method beforeTestsStarted.
/**
* {@inheritDoc}
*/
@Override
protected void beforeTestsStarted() throws Exception {
spis.clear();
nodes.clear();
spiRsrcs.clear();
lsnrs.clear();
Map<ClusterNode, GridSpiTestContext> ctxs = new HashMap<>();
timeoutProcessor = new GridTimeoutProcessor(new GridTestKernalContext(log));
timeoutProcessor.start();
timeoutProcessor.onKernalStart(true);
for (int i = 0; i < getSpiCount(); i++) {
CommunicationSpi<Message> spi = newCommunicationSpi();
GridTestUtils.setFieldValue(spi, IgniteSpiAdapter.class, "igniteInstanceName", "grid-" + i);
IgniteTestResources rsrcs = new IgniteTestResources();
GridTestNode node = new GridTestNode(rsrcs.getNodeId());
node.order(i);
GridSpiTestContext ctx = initSpiContext();
ctx.timeoutProcessor(timeoutProcessor);
ctx.setLocalNode(node);
info(">>> Initialized context: nodeId=" + ctx.localNode().id());
spiRsrcs.add(rsrcs);
rsrcs.inject(spi);
MessageListener lsnr = new MessageListener(rsrcs.getNodeId());
spi.setListener(lsnr);
lsnrs.put(rsrcs.getNodeId(), lsnr);
info("Lsnrs: " + lsnrs);
node.setAttributes(spi.getNodeAttributes());
node.setAttribute(ATTR_MACS, F.concat(U.allLocalMACs(), ", "));
nodes.add(node);
spi.spiStart(getTestIgniteInstanceName() + (i + 1));
spis.put(rsrcs.getNodeId(), spi);
spi.onContextInitialized(ctx);
ctxs.put(node, ctx);
}
// For each context set remote nodes.
for (Entry<ClusterNode, GridSpiTestContext> e : ctxs.entrySet()) {
for (ClusterNode n : nodes) {
if (!n.equals(e.getKey()))
e.getValue().remoteNodes().add(n);
}
}
}
use of org.apache.ignite.testframework.junits.IgniteTestResources in project ignite by apache.
the class GridTcpCommunicationSpiRecoverySelfTest method stopSpis.
/**
* @throws Exception If failed.
*/
private void stopSpis() throws Exception {
if (timeoutProcessor != null) {
timeoutProcessor.onKernalStop(true);
timeoutProcessor.stop(true);
timeoutProcessor = null;
}
for (CommunicationSpi<Message> spi : spis) {
spi.onContextDestroyed();
spi.setListener(null);
spi.spiStop();
}
for (IgniteTestResources rsrcs : spiRsrcs) rsrcs.stopThreads();
spis.clear();
nodes.clear();
spiRsrcs.clear();
}
use of org.apache.ignite.testframework.junits.IgniteTestResources in project ignite by apache.
the class IgniteTcpCommunicationRecoveryAckClosureSelfTest method stopSpis.
/**
* @throws Exception If failed.
*/
private void stopSpis() throws Exception {
if (timeoutProcessor != null) {
timeoutProcessor.onKernalStop(true);
timeoutProcessor.stop(true);
timeoutProcessor = null;
}
for (CommunicationSpi<Message> spi : spis) {
spi.onContextDestroyed();
spi.setListener(null);
spi.spiStop();
}
for (IgniteTestResources rsrcs : spiRsrcs) rsrcs.stopThreads();
spis.clear();
nodes.clear();
spiRsrcs.clear();
}
Aggregations