use of org.apache.ignite.spi.discovery.DiscoverySpi in project ignite by apache.
the class GridMultiSplitsLoadTest method getConfiguration.
/**
* {@inheritDoc}
*/
@SuppressWarnings("ConstantConditions")
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
IgniteConfiguration cfg = super.getConfiguration();
CommunicationSpi commSpi = new TcpCommunicationSpi();
cfg.setCommunicationSpi(commSpi);
DiscoverySpi discoSpi = new TcpDiscoverySpi();
cfg.setDiscoverySpi(discoSpi);
return cfg;
}
use of org.apache.ignite.spi.discovery.DiscoverySpi in project ignite by apache.
the class GridSingleSplitsRedeployLoadTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
IgniteConfiguration cfg = super.getConfiguration();
CommunicationSpi commSpi = new TcpCommunicationSpi();
cfg.setCommunicationSpi(commSpi);
DiscoverySpi discoSpi = new TcpDiscoverySpi();
cfg.setDiscoverySpi(discoSpi);
cfg.setDeploymentMode(DeploymentMode.CONTINUOUS);
return cfg;
}
use of org.apache.ignite.spi.discovery.DiscoverySpi in project ignite by apache.
the class GridSpiAbstractConfigTest method checkNegativeSpiProperty.
/**
* Checks that unacceptable property value prevents SPI from being started.
*
* @param spi Spi to test property on.
* @param propName name of property to check.
* @param val An illegal value.
* @param checkExMsg If {@code true} then additional info will be added to failure.
* @throws Exception If check failed.
*/
protected void checkNegativeSpiProperty(IgniteSpi spi, String propName, Object val, boolean checkExMsg) throws Exception {
assert spi != null;
assert propName != null;
getTestData().getTestResources().inject(spi);
String mtdName = "set" + propName.substring(0, 1).toUpperCase() + propName.substring(1);
Method mtd = null;
for (Method m : spi.getClass().getMethods()) if (m.getName().equals(mtdName)) {
mtd = m;
break;
}
assert mtd != null : "The setter is not found for property: " + propName;
boolean err = false;
try {
mtd.invoke(spi, val);
} catch (InvocationTargetException e) {
info("SPI property setter thrown exception: " + e);
if (e.getCause() instanceof IllegalArgumentException)
err = true;
else
throw e;
}
if (!err)
try {
if (!(spi instanceof DiscoverySpi))
spi.getNodeAttributes();
spi.spiStart(getTestIgniteInstanceName());
} catch (IgniteSpiException e) {
info("SPI start thrown exception: " + e);
if (checkExMsg)
assert e.getMessage().contains("SPI parameter failed condition check: ") : "SPI has returned wrong exception message [propName=" + propName + ", msg=" + e + ']';
err = true;
}
assert err : "No check for property [property=" + propName + ", value=" + val + ']';
}
use of org.apache.ignite.spi.discovery.DiscoverySpi in project ignite by apache.
the class TcpDiscoverySelfTest method testPing.
/**
* @throws Exception If any error occurs.
*/
public void testPing() throws Exception {
try {
startGrid(1);
startGrid(2);
startGrid(3);
info("Nodes were started");
for (Map.Entry<String, TcpDiscoverySpi> e : discoMap.entrySet()) {
DiscoverySpi spi = e.getValue();
for (Ignite g : G.allGrids()) {
boolean res = spi.pingNode(g.cluster().localNode().id());
assert res : e.getKey() + " failed to ping " + g.cluster().localNode().id() + " of " + g.name();
info(e.getKey() + " pinged " + g.cluster().localNode().id() + " of " + g.name());
}
}
info("All nodes pinged successfully.");
} finally {
stopAllGrids();
}
}
use of org.apache.ignite.spi.discovery.DiscoverySpi in project ignite by apache.
the class TcpDiscoverySnapshotHistoryTest method testHistorySupported.
/**
* @throws Exception If any error occurs.
*/
public void testHistorySupported() throws Exception {
try {
final Ignite g = startGrid();
DiscoverySpi spi = g.configuration().getDiscoverySpi();
DiscoverySpiHistorySupport ann = U.getAnnotation(spi.getClass(), DiscoverySpiHistorySupport.class);
assertNotNull("Spi does not have annotation for history support", ann);
assertTrue("History support is disabled for current spi", ann.value());
} finally {
stopGrid();
}
}
Aggregations