Search in sources :

Example 26 with ListeningTestLogger

use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.

the class ContinuousQueryRemoteFilterMissingInClassPathSelfTest method testServerJoinsMissingClassException.

/**
 * @throws Exception If fail.
 */
@Test
public void testServerJoinsMissingClassException() throws Exception {
    setExternalLoader = true;
    Ignite ignite0 = startGrid(1);
    executeContinuousQuery(ignite0.cache(DEFAULT_CACHE_NAME));
    ListeningTestLogger listeningLogger = new ListeningTestLogger();
    log = listeningLogger;
    LogListener lsnr = LogListener.matches(logStr -> logStr.contains("class org.apache.ignite.IgniteCheckedException: " + "Failed to find class with given class loader for unmarshalling") || logStr.contains("Failed to unmarshal continuous routine handler")).build();
    listeningLogger.registerListener(lsnr);
    setExternalLoader = false;
    GridTestUtils.assertThrows(log, () -> startGrid(2), IgniteCheckedException.class, "Failed to start");
    assertTrue(lsnr.check());
}
Also used : ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger) LogListener(org.apache.ignite.testframework.LogListener) URL(java.net.URL) CacheEntryEventSerializableFilter(org.apache.ignite.cache.CacheEntryEventSerializableFilter) U(org.apache.ignite.internal.util.typedef.internal.U) IgniteLogger(org.apache.ignite.IgniteLogger) URLClassLoader(java.net.URLClassLoader) CacheEntryEventFilter(javax.cache.event.CacheEntryEventFilter) X(org.apache.ignite.internal.util.typedef.X) CacheEntryUpdatedListener(javax.cache.event.CacheEntryUpdatedListener) Factory(javax.cache.configuration.Factory) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) MalformedURLException(java.net.MalformedURLException) GridTestProperties(org.apache.ignite.testframework.config.GridTestProperties) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) Test(org.junit.Test) Ignite(org.apache.ignite.Ignite) ContinuousQuery(org.apache.ignite.cache.query.ContinuousQuery) IgniteCache(org.apache.ignite.IgniteCache) GridStringLogger(org.apache.ignite.testframework.GridStringLogger) GridTestUtils(org.apache.ignite.testframework.GridTestUtils) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) CacheEntryEvent(javax.cache.event.CacheEntryEvent) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) CacheEntryListenerException(javax.cache.event.CacheEntryListenerException) CacheMode(org.apache.ignite.cache.CacheMode) LogListener(org.apache.ignite.testframework.LogListener) Ignite(org.apache.ignite.Ignite) ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 27 with ListeningTestLogger

use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.

the class IgniteUtilsUnitTest method logMessagesCollector.

/**
 */
private ListeningTestLogger logMessagesCollector() {
    ListeningTestLogger log = new ListeningTestLogger();
    log.registerListener(logMessages::add);
    return log;
}
Also used : ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger)

Example 28 with ListeningTestLogger

use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.

the class GridCacheFastNodeLeftForTransactionTest method beforeTestsStarted.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTestsStarted() throws Exception {
    super.beforeTestsStarted();
    listeningLog = new ListeningTestLogger(false, GridAbstractTest.log);
}
Also used : ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger)

Example 29 with ListeningTestLogger

use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.

the class RebuildIndexLogMessageTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    ListeningTestLogger testLog = new ListeningTestLogger(false, super.getConfiguration(igniteInstanceName).getGridLogger());
    testLog.registerListener(logLsnr);
    testLog.registerListener(latchLsnr);
    return super.getConfiguration(igniteInstanceName).setGridLogger(testLog).setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true))).setCacheConfiguration(new CacheConfiguration<>().setName(CACHE_NAME_A).setBackups(0).setIndexedTypes(Integer.class, Person.class).setAffinity(new RendezvousAffinityFunction(false, 8)), new CacheConfiguration<>().setName(CACHE_NAME_B).setBackups(0).setIndexedTypes(Integer.class, Person.class).setAffinity(new RendezvousAffinityFunction(false, 8)));
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) RendezvousAffinityFunction(org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction) ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger)

Example 30 with ListeningTestLogger

use of org.apache.ignite.testframework.ListeningTestLogger in project ignite by apache.

the class RebuildIndexTest method check.

/**
 * @throws Exception if failed.
 */
private void check(boolean msgFound) throws Exception {
    srvLog = new ListeningTestLogger(false, log);
    LogListener idxRebuildLsnr = LogListener.matches(idxRebuildPattert).build();
    srvLog.registerListener(idxRebuildLsnr);
    IgniteEx node = startGrids(2);
    node.cluster().active(true);
    IgniteCache<UserKey, UserValue> cache = node.getOrCreateCache(CACHE_NAME);
    cache.put(new UserKey(1), new UserValue(333));
    cache.put(new UserKey(2), new UserValue(555));
    stopGrid(0);
    removeIndexBin(0);
    node = startGrid(0);
    awaitPartitionMapExchange();
    forceCheckpoint();
    enableCheckpoints(G.allGrids(), false);
    // Validate indexes on start.
    ValidateIndexesClosure clo = new ValidateIndexesClosure(() -> false, Collections.singleton(CACHE_NAME), 0, 0, false, true);
    node.context().resource().injectGeneric(clo);
    assertFalse(clo.call().hasIssues());
    assertEquals(msgFound, idxRebuildLsnr.check());
}
Also used : LogListener(org.apache.ignite.testframework.LogListener) IgniteEx(org.apache.ignite.internal.IgniteEx) ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger) ValidateIndexesClosure(org.apache.ignite.internal.visor.verify.ValidateIndexesClosure)

Aggregations

ListeningTestLogger (org.apache.ignite.testframework.ListeningTestLogger)101 Test (org.junit.Test)51 LogListener (org.apache.ignite.testframework.LogListener)48 IgniteEx (org.apache.ignite.internal.IgniteEx)36 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)32 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)30 Ignite (org.apache.ignite.Ignite)21 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)21 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)17 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)14 CountDownLatch (java.util.concurrent.CountDownLatch)9 IgniteCache (org.apache.ignite.IgniteCache)9 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)9 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)9 List (java.util.List)8 Pattern (java.util.regex.Pattern)8 ClusterState (org.apache.ignite.cluster.ClusterState)7 GridQueryProcessor (org.apache.ignite.internal.processors.query.GridQueryProcessor)7 Collections (java.util.Collections)6 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)6