use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class IgniteDiagnosticMessagesTest method checkLongRunning.
/**
* @param atomicityMode Cache atomicity mode.
* @throws Exception If failed.
*/
public void checkLongRunning(CacheAtomicityMode atomicityMode) throws Exception {
System.setProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, "3500");
try {
testSpi = true;
startGrid(0);
GridStringLogger strLog = this.strLog = new GridStringLogger();
strLog.logLength(1024 * 100);
startGrid(1);
awaitPartitionMapExchange();
CacheConfiguration ccfg = cacheConfiguration(atomicityMode);
final Ignite node0 = ignite(0);
node0.createCache(ccfg);
final Ignite node1 = ignite(1);
UUID id0 = node0.cluster().localNode().id();
TestRecordingCommunicationSpi.spi(node0).blockMessages(GridNearSingleGetResponse.class, node1.name());
IgniteInternalFuture fut = GridTestUtils.runAsync(new Callable<Void>() {
@Override
public Void call() throws Exception {
Integer key = primaryKey(node0.cache(DEFAULT_CACHE_NAME));
node1.cache(DEFAULT_CACHE_NAME).get(key);
return null;
}
}, "get");
U.sleep(10_000);
assertFalse(fut.isDone());
TestRecordingCommunicationSpi.spi(node0).stopBlock();
fut.get();
String log = strLog.toString();
assertTrue(log.contains("GridPartitionedSingleGetFuture waiting for response [node=" + id0));
assertTrue(log.contains("General node info [id=" + id0));
} finally {
System.clearProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT);
}
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class IgniteUidAsConsistentIdMigrationTest method testOldStyleNodeWithUnexpectedPort.
/**
* Test case If there are no matching folders,
* but the directory contains old-style consistent IDs.
* Ignite should print out a warning.
*
* @throws Exception if failed.
*/
@Test
public void testOldStyleNodeWithUnexpectedPort() throws Exception {
// emulated old-style node with not appropriate consistent ID
this.configuredConsistentId = "127.0.0.1:49999";
final Ignite ignite = startActivateFillDataGrid(0);
final IgniteCache<Object, Object> second = ignite.getOrCreateCache("second");
final int entries = 100;
for (int i = 0; i < entries; i++) second.put((int) (Math.random() * entries), getClass().getName());
final String prevVerFolder = U.maskForFileName(ignite.cluster().localNode().consistentId().toString());
final String path = new File(new File(U.defaultWorkDirectory(), "db"), prevVerFolder).getCanonicalPath();
assertPdsDirsDefaultExist(prevVerFolder);
stopAllGrids();
this.configuredConsistentId = null;
this.strLog = new GridStringLogger();
startActivateGrid(0);
// one 0 index folder is created
assertNodeIndexesInFolder(0);
final String wholeNodeLog = strLog.toString();
stopAllGrids();
String foundWarning = null;
for (String line : wholeNodeLog.split("\n")) {
if (line.contains("There is other non-empty storage folder under storage base directory")) {
foundWarning = line;
break;
}
}
if (foundWarning != null)
log.info("\nWARNING generated successfully [\n" + foundWarning + "\n]");
assertTrue("Expected to warn user on existence of old style path", foundWarning != null);
assertTrue("Expected to warn user on existence of old style path [" + path + "]", foundWarning.contains(path));
assertTrue("Expected to print some size for [" + path + "]", Pattern.compile(" [0-9]* bytes").matcher(foundWarning).find());
strLog = null;
startActivateGrid(0);
// one 0 index folder is created
assertNodeIndexesInFolder(0);
stopAllGrids();
}
Aggregations