use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class GridP2PScanQueryWithTransformerTest method executeP2PClassLoadingEnabledTest.
/**
* Executes scenario with successful p2p loading of Transformer class
* with client or server node sending Scan Query request and iterating over result set.
*
* @param withClientNode Flag to execute scan query from client or server node.
* @throws Exception If failed.
*/
private void executeP2PClassLoadingEnabledTest(boolean withClientNode) throws Exception {
ListeningTestLogger listeningLogger = new ListeningTestLogger();
LogListener clsDeployedMsgLsnr = LogListener.matches("Class was deployed in SHARED or CONTINUOUS mode: " + "class org.apache.ignite.tests.p2p.cache.ScanQueryTestTransformer").build();
listeningLogger.registerListener(clsDeployedMsgLsnr);
logger = listeningLogger;
IgniteEx ig0 = startGrid(0);
logger = null;
IgniteCache<Integer, Integer> cache = ig0.createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME));
int sumPopulated = populateCache(cache);
IgniteEx requestingNode;
if (withClientNode)
requestingNode = startClientGrid(1);
else {
clsLoader = TEST_CLASS_LOADER;
requestingNode = startGrid(1);
}
// Scan query doesn't work on unstable topology.
awaitPartitionMapExchange();
IgniteCache<Object, Object> reqNodeCache = requestingNode.getOrCreateCache(DEFAULT_CACHE_NAME);
QueryCursor<Integer> query = reqNodeCache.query(new ScanQuery<Integer, Integer>(), loadTransformerClass());
int sumQueried = 0;
for (Integer val : query) sumQueried += val;
assertTrue(sumQueried == sumPopulated * SCALE_FACTOR);
assertTrue(clsDeployedMsgLsnr.check());
}
use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class CheckIndexesInlineSizeOnNodeJoinMultiJvmTest method performTestScenario.
/**
* Restarts node with given index and check messages in the log after node restart.
*
* @param restartNodeIdx Index of restarting node.
* @throws Exception If something goes wrong.
*/
private void performTestScenario(int restartNodeIdx) throws Exception {
assertTrue("Wrong restart node index: " + restartNodeIdx, restartNodeIdx >= 0 && restartNodeIdx < NODES_CNT);
Map<Integer, UUID> nodeIdxToNodeId = IntStream.range(0, NODES_CNT).boxed().collect(Collectors.toMap(i -> i, i -> grid(i).localNode().id()));
stopGrid(restartNodeIdx);
nodeId = UUID.randomUUID();
nodeIdxToNodeId.put(restartNodeIdx, nodeId);
Collection<LogListener> listeners = registerListeners(restartNodeIdx, nodeIdxToNodeId);
assertFalse(F.isEmpty(listeners));
startGrid(restartNodeIdx);
awaitPartitionMapExchange();
for (LogListener listener : listeners) assertTrue(listener.toString(), listener.check());
}
use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class MixedTracingSpiTest method testNodesWithDifferentTracingSpiPrintsWarningOnConsistencyCheck.
/**
* Start two nodes: one with noop tracing spi and another one with open census tracing spi.
* <p/>
* Cause both tracing spi instances are annotated with {@code @IgniteSpiConsistencyChecked(optional = true)}
* 'Remote SPI with the same name is not configured: <TracingSpiInstance></>' warning message is expected on
* node start.
* <p/>
* Besides that 'Failed to create span from serialized value' is expected, cause it's not possible
* to deserialize {@code NoopSpan.INSTANCE} from {@link NoopTracingSpi} on the node
* with {@link OpenCensusTracingSpi}.
*
* @throws Exception If failed.
*/
@Test
public void testNodesWithDifferentTracingSpiPrintsWarningOnConsistencyCheck() throws Exception {
List<LogListener> listeners = prepareLogListeners();
startGrid(getConfiguration(getTestIgniteInstanceName(0) + "node-with-noop-tracing").setTracingSpi(new NoopTracingSpi()).setGridLogger(testLog));
startGrid(getConfiguration(getTestIgniteInstanceName(1) + "node-with-open-census-tracing").setTracingSpi(new OpenCensusTracingSpi()).setGridLogger(testLog));
listeners.forEach(lsnr -> assertTrue(lsnr.check()));
}
use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class MixedTracingSpiTest method testNodesWithOpenCensusTracingSpiPrintsNothingOnConsistencyCheck.
/**
* Start two nodes, both with open census tracing spi instances. No warning messages are expected.
*
* @throws Exception If failed.
*/
@Test
public void testNodesWithOpenCensusTracingSpiPrintsNothingOnConsistencyCheck() throws Exception {
List<LogListener> listeners = prepareLogListeners();
startGrid(getConfiguration(getTestIgniteInstanceName(0) + "node-with-open-census-tracing").setTracingSpi(new OpenCensusTracingSpi()).setGridLogger(testLog));
startGrid(getConfiguration(getTestIgniteInstanceName(1) + "node-with-open-census-tracing").setTracingSpi(new OpenCensusTracingSpi()).setGridLogger(testLog));
listeners.forEach(lsnr -> assertFalse(lsnr.check()));
}
use of org.apache.ignite.testframework.LogListener in project ignite by apache.
the class MixedTracingSpiTest method testNodesWithNoopTracingSpiPrintsNothingOnConsistencyCheck.
/**
* Start two nodes, both with noop tracing spi instances. No warning messages are expected.
*
* @throws Exception If failed.
*/
@Test
public void testNodesWithNoopTracingSpiPrintsNothingOnConsistencyCheck() throws Exception {
List<LogListener> listeners = prepareLogListeners();
startGrid(getConfiguration(getTestIgniteInstanceName(0) + "node-with-noop-tracing").setTracingSpi(new NoopTracingSpi()).setGridLogger(testLog));
startGrid(getConfiguration(getTestIgniteInstanceName(1) + "node-with-noop-tracing").setTracingSpi(new NoopTracingSpi()).setGridLogger(testLog));
listeners.forEach(lsnr -> assertFalse(lsnr.check()));
}
Aggregations