Search in sources :

Example 66 with ListeningTestLogger

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

the class GridCachePartitionsUpdateCountersAndSizeTest method beforeTest.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTest() throws Exception {
    super.beforeTest();
    stopAllGrids();
    testLog = new ListeningTestLogger(log);
}
Also used : ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger)

Example 67 with ListeningTestLogger

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

the class ExchangeLatchManagerTest method testExcessAcknowledgeForNewCoordinator.

/**
 * Checks reaction of latch on stale acknowledge from new coordinator.
 *
 * @throws Exception If failed.
 */
@Test
public void testExcessAcknowledgeForNewCoordinator() throws Exception {
    gridLogger = new ListeningTestLogger(log);
    LogListener staleMessageLsnr = LogListener.matches(STALE_ACK_LOG_MSG).build();
    LogListener errorLsnr = LogListener.matches(ERROR_MSG).build();
    IgniteEx ignite0 = startGrids(3);
    awaitPartitionMapExchange();
    TestRecordingCommunicationSpi spi0 = TestRecordingCommunicationSpi.spi(ignite0);
    spi0.blockMessages((node, msg) -> msg instanceof LatchAckMessage && node.order() == 2);
    spi0.record((node, msg) -> msg instanceof LatchAckMessage && node.order() == 3);
    Ignite ignite1 = G.allGrids().stream().filter(node -> node.cluster().localNode().order() == 2).findAny().get();
    assertNotNull("Could not find node with second order.", ignite1);
    TestRecordingCommunicationSpi spi1 = TestRecordingCommunicationSpi.spi(ignite1);
    spi1.blockMessages((node, msg) -> {
        if (msg instanceof LatchAckMessage && node.order() == 3) {
            LatchAckMessage ack = (LatchAckMessage) msg;
            return ack.topVer().topologyVersion() == 3;
        }
        return false;
    });
    IgniteInternalFuture exchangeDoingFut = GridTestUtils.runAsync(() -> ignite0.createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)));
    spi0.waitForBlocked();
    spi0.waitForRecorded();
    ignite0.close();
    spi1.waitForBlocked();
    awaitPartitionMapExchange();
    assertTrue(exchangeDoingFut.isDone());
    gridLogger.registerAllListeners(errorLsnr, staleMessageLsnr);
    spi1.stopBlock();
    assertTrue(GridTestUtils.waitForCondition(() -> staleMessageLsnr.check(), 10_000));
    assertFalse(errorLsnr.check());
}
Also used : TestRecordingCommunicationSpi(org.apache.ignite.internal.TestRecordingCommunicationSpi) LogListener(org.apache.ignite.testframework.LogListener) IgniteEx(org.apache.ignite.internal.IgniteEx) Ignite(org.apache.ignite.Ignite) ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 68 with ListeningTestLogger

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

the class CleanupRestoredCachesSlowTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    ListeningTestLogger testLog = new ListeningTestLogger(false, super.getConfiguration(igniteInstanceName).getGridLogger());
    testLog.registerListener(logLsnr);
    return super.getConfiguration(igniteInstanceName).setDataStorageConfiguration(new DataStorageConfiguration().setDefaultDataRegionConfiguration(new DataRegionConfiguration().setPersistenceEnabled(true).setInitialSize(100 * 1024L * 1024L).setMaxSize(1024 * 1024L * 1024L).setMetricsEnabled(true)).setFileIOFactory(new SlowFileIOFactory())).setCacheConfiguration(new CacheConfiguration().setName(CACHE_NAME).setBackups(1)).setGridLogger(testLog);
}
Also used : DataStorageConfiguration(org.apache.ignite.configuration.DataStorageConfiguration) DataRegionConfiguration(org.apache.ignite.configuration.DataRegionConfiguration) ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 69 with ListeningTestLogger

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

the class CacheRebalanceWithRemovedWalSegment method beforeTest.

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

Example 70 with ListeningTestLogger

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

the class GridP2PContinuousDeploymentClientDisconnectTest method beforeTest.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTest() throws Exception {
    super.beforeTest();
    testLog = new ListeningTestLogger(true, log);
    startGrid(0);
    startClientGrid(1);
    blockClassLoadingRequest(grid(1));
}
Also used : ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger)

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