use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class GridNoopManagerSelfTest method testEnabledManager.
/**
*/
public void testEnabledManager() throws IgniteCheckedException {
GridTestKernalContext ctx = new GridTestKernalContext(new GridStringLogger());
assertTrue(new Manager(ctx, new Spi()).enabled());
assertFalse(new Manager(ctx, new NoopSpi()).enabled());
assertTrue(new Manager(ctx, new Spi(), new NoopSpi()).enabled());
assertTrue(new Manager(ctx, new NoopSpi(), new Spi()).enabled());
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class IgniteDiagnosticMessagesTest method testSeveralLongRunningTxs.
/**
* @throws Exception If failed.
*/
public void testSeveralLongRunningTxs() throws Exception {
int timeout = 3500;
System.setProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, String.valueOf(timeout));
try {
testSpi = true;
startGrid(0);
GridStringLogger strLog = this.strLog = new GridStringLogger();
strLog.logLength(1024 * 100);
startGrid(1);
awaitPartitionMapExchange();
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setCacheMode(PARTITIONED);
ccfg.setAtomicityMode(TRANSACTIONAL);
final Ignite node0 = ignite(0);
final Ignite node1 = ignite(1);
node0.createCache(ccfg);
UUID id0 = node0.cluster().localNode().id();
TestRecordingCommunicationSpi.spi(node0).blockMessages(GridNearLockResponse.class, node1.name());
IgniteCache<Object, Object> cache = node0.cache(DEFAULT_CACHE_NAME);
int txCnt = 4;
final List<Integer> keys = primaryKeys(cache, txCnt, 0);
final AtomicInteger idx = new AtomicInteger();
IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
@Override
public Void call() throws Exception {
IgniteCache<Object, Object> cache = node1.cache(DEFAULT_CACHE_NAME);
try (Transaction tx = node1.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) {
Integer key = keys.get(idx.getAndIncrement() % keys.size());
cache.putIfAbsent(key, String.valueOf(key));
tx.commit();
}
return null;
}
}, txCnt * 2, "tx");
U.sleep(timeout * 2);
assertFalse(fut.isDone());
TestRecordingCommunicationSpi.spi(node0).stopBlock();
fut.get();
String log = strLog.toString();
assertTrue(log.contains("Cache entries [cacheId=" + CU.cacheId(DEFAULT_CACHE_NAME) + ", cacheName=" + DEFAULT_CACHE_NAME + "]:"));
assertTrue(countTxKeysInASingleBlock(log) == txCnt);
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 IgniteDiagnosticMessagesTest method testLongRunning.
/**
* @throws Exception If failed.
*/
public void testLongRunning() throws Exception {
System.setProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, "3500");
try {
testSpi = true;
startGrid(0);
GridStringLogger strLog = this.strLog = new GridStringLogger();
startGrid(1);
awaitPartitionMapExchange();
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setCacheMode(PARTITIONED);
ccfg.setAtomicityMode(TRANSACTIONAL);
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 ContinuousQueryRemoteFilterMissingInClassPathSelfTest method testNoWarningMessageOnClientNode.
/**
* @throws Exception If fail.
*/
public void testNoWarningMessageOnClientNode() throws Exception {
ldr = new URLClassLoader(URLS, getClass().getClassLoader());
setExternalLoader = true;
clientMode = false;
final Ignite ignite0 = startGrid(1);
executeContiniouseQuery(ignite0.cache("simple"));
log = new GridStringLogger();
clientMode = true;
startGrid(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 ContinuousQueryRemoteFilterMissingInClassPathSelfTest method testExceptionOnServerNode.
/**
* @throws Exception If fail.
*/
public void testExceptionOnServerNode() throws Exception {
ldr = new URLClassLoader(URLS, getClass().getClassLoader());
clientMode = false;
setExternalLoader = true;
final Ignite ignite0 = startGrid(1);
executeContiniouseQuery(ignite0.cache("simple"));
log = new GridStringLogger();
setExternalLoader = false;
startGrid(2);
assertTrue(log.toString().contains("class org.apache.ignite.IgniteCheckedException: " + "Failed to find class with given class loader for unmarshalling"));
}
Aggregations