use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class IgniteDiagnosticMessagesTest method testLongRunningTx.
/**
* @throws Exception If failed.
*/
public void testLongRunningTx() throws Exception {
System.setProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, "3500");
try {
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);
final Ignite node1 = ignite(1);
node0.createCache(ccfg);
UUID id0 = node0.cluster().localNode().id();
final CountDownLatch l1 = new CountDownLatch(1);
final CountDownLatch l2 = new CountDownLatch(1);
final AtomicReference<Integer> key = new AtomicReference<>();
GridCompoundFuture<Void, Void> fut = new GridCompoundFuture<>();
fut.add(GridTestUtils.runAsync(new Callable<Void>() {
@Override
public Void call() throws Exception {
IgniteCache<Object, Object> cache = node0.cache(DEFAULT_CACHE_NAME);
try (Transaction tx = node0.transactions().txStart()) {
key.set(primaryKey(cache));
cache.putIfAbsent(key.get(), "dummy val");
l1.countDown();
l2.await();
tx.commit();
}
return null;
}
}, "tx-1"));
fut.add(GridTestUtils.runAsync(new Callable<Void>() {
@Override
public Void call() throws Exception {
IgniteCache<Object, Object> cache = node1.cache(DEFAULT_CACHE_NAME);
try (Transaction tx = node1.transactions().txStart()) {
l1.await();
cache.replace(key.get(), "dummy val2");
tx.commit();
}
return null;
}
}, "tx-2"));
fut.markInitialized();
U.sleep(10_000);
assertFalse(fut.isDone());
l2.countDown();
fut.get();
String log = strLog.toString();
assertTrue(log.contains("Cache entries [cacheId=" + CU.cacheId(DEFAULT_CACHE_NAME) + ", cacheName=" + DEFAULT_CACHE_NAME + "]:"));
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 testWarningMessageOnClientNode.
/**
* @throws Exception If fail.
*/
public void testWarningMessageOnClientNode() throws Exception {
ldr = new URLClassLoader(URLS, getClass().getClassLoader());
clientMode = false;
setExternalLoader = true;
final Ignite ignite0 = startGrid(1);
executeContiniouseQuery(ignite0.cache("simple"));
log = new GridStringLogger();
clientMode = true;
setExternalLoader = false;
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 testNoExceptionOnServerNode.
/**
* @throws Exception If fail.
*/
public void testNoExceptionOnServerNode() throws Exception {
ldr = new URLClassLoader(URLS, getClass().getClassLoader());
clientMode = false;
setExternalLoader = true;
final Ignite ignite0 = startGrid(1);
executeContiniouseQuery(ignite0.cache("simple"));
log = new GridStringLogger();
startGrid(2);
assertTrue(!log.toString().contains("class org.apache.ignite.IgniteCheckedException: " + "Failed to find class with given class loader for unmarshalling"));
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class JdbcThinTransactionsSelfTest method getConfiguration.
/**
* {@inheritDoc}
*/
@SuppressWarnings({ "deprecation", "unchecked" })
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setCacheConfiguration(cacheConfiguration(DEFAULT_CACHE_NAME).setNearConfiguration(null));
cfg.setMarshaller(new BinaryMarshaller());
cfg.setGridLogger(log = new GridStringLogger());
return cfg;
}
use of org.apache.ignite.testframework.GridStringLogger in project ignite by apache.
the class BinaryTypeMismatchLoggingTest method startGridWithLogCapture.
/**
*/
private IgniteEx startGridWithLogCapture() throws Exception {
IgniteEx ignite = startGrid(0);
this.capture = new GridStringLogger(false, this.log);
GridTestUtils.setFieldValue(ignite.context().query(), GridProcessorAdapter.class, "log", capture);
return ignite;
}
Aggregations