use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class ContinuousQueryRemoteFilterMissingInClassPathSelfTest method testClientJoinsExtClassLoaderNoWarning.
/**
* @throws Exception If fail.
*/
@Test
public void testClientJoinsExtClassLoaderNoWarning() throws Exception {
setExternalLoader = true;
Ignite ignite0 = startGrid(1);
executeContinuousQuery(ignite0.cache(DEFAULT_CACHE_NAME));
log = new GridStringLogger();
startClientGrid(2);
assertTrue(!log.toString().contains("Failed to unmarshal continuous query remote filter on client node. " + "Can be ignored."));
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class GridCacheConfigurationConsistencySelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
if (useStrLog) {
strLog = new GridStringLogger(false, cfg.getGridLogger());
cfg.setGridLogger(strLog);
}
cfg.setDeploymentMode(depMode);
if (cacheEnabled) {
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setName(cacheName);
cacheCfg.setCacheMode(cacheMode);
cacheCfg.setAffinity(aff);
cacheCfg.setBackups(backups);
cacheCfg.setAtomicityMode(TRANSACTIONAL);
if (initCache != null)
initCache.apply(cacheCfg);
cfg.setCacheConfiguration(cacheCfg);
} else
cfg.setCacheConfiguration();
return cfg;
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class GridCacheConfigurationConsistencySelfTest method testCacheUtilsCheckAttributeMismatch.
/**
* @throws Exception If failed.
*/
@Test
public void testCacheUtilsCheckAttributeMismatch() throws Exception {
Ignite ignite = startGrid(1);
final ClusterNode node = ignite.cluster().localNode();
final GridStringLogger strLog = new GridStringLogger(false, log);
CU.checkAttributeMismatch(strLog, "cache", node.id(), "cacheMode", "Cache mode", LOCAL, PARTITIONED, false);
assertTrue("No expected message in log: " + strLog.toString(), strLog.toString().contains("Cache mode mismatch"));
strLog.reset();
GridTestUtils.assertThrows(log, new Callable<Void>() {
/**
* {@inheritDoc}
*/
@Override
public Void call() throws Exception {
CU.checkAttributeMismatch(strLog, "cache", node.id(), "cacheMode", "Cache mode", LOCAL, PARTITIONED, true);
return null;
}
}, IgniteCheckedException.class, "Cache mode mismatch");
final CacheConfiguration cfg1 = defaultCacheConfiguration();
cfg1.setCacheMode(LOCAL);
final CacheConfiguration cfg2 = defaultCacheConfiguration();
cfg2.setCacheMode(PARTITIONED);
CU.checkAttributeMismatch(strLog, cfg1, cfg2, node.id(), new T2<>("cacheMode", "Cache mode"), false);
assertTrue("No expected message in log: " + strLog.toString(), strLog.toString().contains("Cache mode mismatch"));
GridTestUtils.assertThrows(log, new Callable<Void>() {
/**
* {@inheritDoc}
*/
@Override
public Void call() throws Exception {
CU.checkAttributeMismatch(strLog, cfg1, cfg2, node.id(), new T2<>("cacheMode", "Cache mode"), true);
return null;
}
}, IgniteCheckedException.class, "Cache mode mismatch");
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class TcpDiscoverySelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
((TcpCommunicationSpi) cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
TcpDiscoverySpi spi = nodeSpi.get();
if (spi == null) {
spi = igniteInstanceName.contains("testPingInterruptedOnNodeFailedFailingNode") ? new TestTcpDiscoverySpi() : new TcpDiscoverySpi();
} else
nodeSpi.set(null);
discoMap.put(igniteInstanceName, spi);
spi.setIpFinder(ipFinder);
spi.setNetworkTimeout(2500);
spi.setIpFinderCleanFrequency(5000);
spi.setJoinTimeout(5000);
cfg.setDiscoverySpi(spi);
cfg.setFailureDetectionTimeout(7500);
if (ccfgs != null)
cfg.setCacheConfiguration(ccfgs);
else
cfg.setCacheConfiguration();
if (segPlc != null)
cfg.setSegmentationPolicy(segPlc);
cfg.setIncludeEventTypes(EVT_TASK_FAILED, EVT_TASK_FINISHED, EVT_JOB_MAPPED);
cfg.setIncludeProperties();
cfg.setMetricsUpdateFrequency(1000);
if (!igniteInstanceName.contains("LoopbackProblemTest"))
cfg.setLocalHost("127.0.0.1");
if (igniteInstanceName.contains("testFailureDetectionOnNodePing")) {
// To make test faster: on Windows 1 connect takes 1 second.
spi.setReconnectCount(1);
cfg.setMetricsUpdateFrequency(40000);
cfg.setClientFailureDetectionTimeout(41000);
}
cfg.setConnectorConfiguration(null);
if (nodeId != null)
cfg.setNodeId(nodeId);
if (igniteInstanceName.contains("NonSharedIpFinder")) {
TcpDiscoveryVmIpFinder finder = new TcpDiscoveryVmIpFinder();
finder.setAddresses(Arrays.asList("127.0.0.1:47501"));
spi.setIpFinder(finder);
} else if (igniteInstanceName.contains("MulticastIpFinder")) {
TcpDiscoveryMulticastIpFinder finder = new TcpDiscoveryMulticastIpFinder();
finder.setAddressRequestAttempts(5);
finder.setMulticastGroup(GridTestUtils.getNextMulticastGroup(getClass()));
finder.setMulticastPort(GridTestUtils.getNextMulticastPort(getClass()));
spi.setIpFinder(finder);
// (possibly due to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7122846).
if (U.isMacOs())
spi.setLocalAddress(F.first(U.allLocalIps()));
} else if (igniteInstanceName.contains("testPingInterruptedOnNodeFailedPingingNode"))
cfg.setFailureDetectionTimeout(30_000);
else if (igniteInstanceName.contains("testNoRingMessageWorkerAbnormalFailureNormalNode"))
cfg.setFailureDetectionTimeout(3_000);
else if (igniteInstanceName.contains("testNoRingMessageWorkerAbnormalFailureSegmentedNode")) {
cfg.setFailureDetectionTimeout(6_000);
cfg.setGridLogger(strLog = new GridStringLogger());
strLog.logLength(300_000);
} else if (igniteInstanceName.contains("testNodeShutdownOnRingMessageWorkerFailureFailedNode")) {
cfg.setGridLogger(strLog = new GridStringLogger());
strLog.logLength(300_000);
}
return cfg;
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class AffinityDistributionLoggingTest method runAndGetExchangeLog.
/**
* Starts a specified number of Ignite nodes and log partition node exchange during a last node's startup.
*
* @param testClientNode Whether it is necessary to get exchange log from the client node.
* @return Log of latest partition map exchange.
* @throws Exception In case of an error.
*/
private String runAndGetExchangeLog(boolean testClientNode) throws Exception {
assert nodes > 1;
IgniteEx ignite = startGrids(nodes - 1);
awaitPartitionMapExchange();
GridCacheProcessor proc = ignite.context().cache();
GridCacheContext cctx = proc.context().cacheContext(CU.cacheId(DEFAULT_CACHE_NAME));
final GridStringLogger log = new GridStringLogger(false, this.log);
GridAffinityAssignmentCache aff = GridTestUtils.getFieldValue(cctx.affinity(), "aff");
GridTestUtils.setFieldValue(aff, "log", log);
if (testClientNode)
startClientGrid(getConfiguration("client"));
else
startGrid(nodes);
awaitPartitionMapExchange();
return log.toString();
}
Aggregations