Search in sources :

Example 86 with ListeningTestLogger

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

the class P2PUnsupportedClassVersionTest method beforeTestsStarted.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTestsStarted() throws Exception {
    super.beforeTestsStarted();
    lsnrLog = new ListeningTestLogger(false, log);
    srv = startGrid("server");
    cli = startClientGrid("client");
}
Also used : ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger)

Example 87 with ListeningTestLogger

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

the class SqlMergeTest method testCheckKeysWarning.

/**
 */
@Test
public void testCheckKeysWarning() throws Exception {
    LogListener logLsnr = LogListener.matches("The search row by explicit KEY isn't supported. The primary key is always used to search row").build();
    ListeningTestLogger listeningTestLogger = testLog();
    listeningTestLogger.registerListener(logLsnr);
    sql("CREATE TABLE test2 (id INT, id2 INT, name VARCHAR, PRIMARY KEY (id, id2))");
    checkMergeQuery("MERGE INTO test2 (id, id2, name) KEY(_key) VALUES (100, 1, 'Bob')", 1L);
    checkSqlResults("SELECT id, id2, name FROM test2 WHERE id = 100", Arrays.asList(100, 1, "Bob"));
    assertTrue(logLsnr.check());
    logLsnr.reset();
    checkMergeQuery("MERGE INTO test2 (id2, id, name) KEY(_key) VALUES (2, 100, 'Alice')", 1L);
    checkSqlResults("SELECT id, id2, name FROM test2 WHERE id = 100 AND id2 = 2", Arrays.asList(100, 2, "Alice"));
    assertTrue(logLsnr.check());
    logLsnr.reset();
    checkMergeQuery("MERGE INTO test2 (id, id2, name) KEY(id, id2) VALUES (3, 5, 'Stan')", 1L);
    checkSqlResults("SELECT id, id2, name FROM test2 WHERE id = 3", Arrays.asList(3, 5, "Stan"));
    assertTrue(logLsnr.check());
    logLsnr.reset();
    checkMergeQuery("MERGE INTO test2 (id, id2, name) KEY(id2, id) VALUES (1, 100, 'Satan')", 1L);
    checkSqlResults("SELECT id, id2, name FROM test2 WHERE id = 1", Arrays.asList(1, 100, "Satan"));
    assertTrue(logLsnr.check());
    logLsnr.reset();
    checkMergeQuery("MERGE INTO test2 (id2, id, name) KEY(id) VALUES (15, 32, 'Kyle')", 1L);
    checkSqlResults("SELECT id, id2, name FROM test2 WHERE id = 32", Arrays.asList(32, 15, "Kyle"));
    assertTrue(logLsnr.check());
    logLsnr.reset();
    checkMergeQuery("MERGE INTO test2 (name, id, id2) KEY(id2) VALUES ('Morlock', 13, 12)", 1L);
    checkSqlResults("SELECT id, id2, name FROM test2 WHERE id = 13", Arrays.asList(13, 12, "Morlock"));
    assertTrue(logLsnr.check());
    logLsnr.reset();
    checkMergeQuery("MERGE INTO test2 (id, name, id2) KEY(_key, id) VALUES (10, 'Warlock', 52)", 1L);
    checkSqlResults("SELECT id, id2, name FROM test2 WHERE id = 10", Arrays.asList(10, 52, "Warlock"));
    assertTrue(logLsnr.check());
    logLsnr.reset();
    checkMergeQuery("MERGE INTO test2 (id, id2, name) KEY(name) VALUES (10, -11, 'Sherlock')", 1L);
    checkSqlResults("SELECT id, id2, name FROM test2 WHERE id = 10 and id2=-11", Arrays.asList(10, -11, "Sherlock"));
    assertTrue(logLsnr.check());
    logLsnr.reset();
}
Also used : LogListener(org.apache.ignite.testframework.LogListener) ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger) AbstractIndexingCommonTest(org.apache.ignite.internal.processors.cache.index.AbstractIndexingCommonTest) Test(org.junit.Test)

Example 88 with ListeningTestLogger

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

the class IgniteQueryDedicatedPoolTest method beforeTestsStarted.

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

Example 89 with ListeningTestLogger

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

the class GridTcpCommunicationInverseConnectionEstablishingTest method executeCacheTestWithUnreachableClient.

/**
 * Executes cache test with "unreachable" client.
 *
 * @param forceClientToSrvConnections Flag for the client mode.
 * @throws Exception If failed.
 */
private void executeCacheTestWithUnreachableClient(boolean forceClientToSrvConnections) throws Exception {
    LogListener lsnr = LogListener.matches("Failed to send message to remote node").atMost(0).build();
    for (int i = 0; i < SRVS_NUM; i++) {
        ccfg = cacheConfiguration(CACHE_NAME, ATOMIC);
        startGrid(i, (UnaryOperator<IgniteConfiguration>) cfg -> {
            ListeningTestLogger log = new ListeningTestLogger(false, cfg.getGridLogger());
            log.registerListener(lsnr);
            return cfg.setGridLogger(log);
        });
    }
    this.forceClientToSrvConnections = forceClientToSrvConnections;
    startClientGrid(SRVS_NUM);
    putAndCheckKey();
    assertTrue(lsnr.check());
}
Also used : CacheAtomicityMode(org.apache.ignite.cache.CacheAtomicityMode) IgniteInternalFuture(org.apache.ignite.internal.IgniteInternalFuture) ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger) LogListener(org.apache.ignite.testframework.LogListener) CoreMatchers.is(org.hamcrest.CoreMatchers.is) IgniteSpiException(org.apache.ignite.spi.IgniteSpiException) ClusterState(org.apache.ignite.cluster.ClusterState) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) U(org.apache.ignite.internal.util.typedef.internal.U) HashMap(java.util.HashMap) UnaryOperator(java.util.function.UnaryOperator) IgniteEx(org.apache.ignite.internal.IgniteEx) AtomicReference(java.util.concurrent.atomic.AtomicReference) IgniteSystemProperties(org.apache.ignite.IgniteSystemProperties) ClusterNode(org.apache.ignite.cluster.ClusterNode) IgnitePredicate(org.apache.ignite.lang.IgnitePredicate) Map(java.util.Map) Assume(org.junit.Assume) CoreMatchers.nullValue(org.hamcrest.CoreMatchers.nullValue) IgniteInClosure(org.apache.ignite.lang.IgniteInClosure) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) EventType(org.apache.ignite.events.EventType) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) Event(org.apache.ignite.events.Event) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) Test(org.junit.Test) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) FULL_SYNC(org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC) IgniteCache(org.apache.ignite.IgniteCache) GridIoMessage(org.apache.ignite.internal.managers.communication.GridIoMessage) GridTestUtils(org.apache.ignite.testframework.GridTestUtils) WithSystemProperty(org.apache.ignite.testframework.junits.WithSystemProperty) List(java.util.List) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpInverseConnectionResponseMessage(org.apache.ignite.spi.communication.tcp.internal.TcpInverseConnectionResponseMessage) GridTopic(org.apache.ignite.internal.GridTopic) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) Message(org.apache.ignite.plugin.extensions.communication.Message) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi) ATOMIC(org.apache.ignite.cache.CacheAtomicityMode.ATOMIC) GridCommunicationClient(org.apache.ignite.internal.util.nio.GridCommunicationClient) TcpDiscoveryNode(org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode) Collections(java.util.Collections) LogListener(org.apache.ignite.testframework.LogListener) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) ListeningTestLogger(org.apache.ignite.testframework.ListeningTestLogger)

Example 90 with ListeningTestLogger

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

the class TcpDiscoveryMetricsWarnLogTest method beforeTest.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTest() throws Exception {
    super.beforeTest();
    testLog = new ListeningTestLogger(false, log);
}
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