Search in sources :

Example 16 with GridStringLogger

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

the class DhtAndNearEvictionTest method beforeTest.

/**
 */
@Override
protected void beforeTest() throws Exception {
    super.beforeTest();
    strLog = new GridStringLogger(false, log);
    strLog.logLength(1024 * 1024);
}
Also used : GridStringLogger(org.apache.ignite.testframework.GridStringLogger)

Example 17 with GridStringLogger

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

the class IgniteDevOnlyLogTest method testDevOnlyDisabledProperty.

/**
 * Check that {@link IgniteUtils#warnDevOnly(IgniteLogger, Object)}
 * doesn't print anything if {@link org.apache.ignite.IgniteSystemProperties#IGNITE_DEV_ONLY_LOGGING_DISABLED}
 * is set to {@code true}.
 */
@Test
public void testDevOnlyDisabledProperty() throws Exception {
    additionalArgs = Collections.singletonList("-D" + IgniteSystemProperties.IGNITE_DEV_ONLY_LOGGING_DISABLED + "=true");
    log = new GridStringLogger(false, grid(0).log());
    Ignite ignite = startGrid(1);
    String msg = getMessage(ignite);
    warnDevOnly(msg);
    assertFalse(log.toString().contains(msg));
}
Also used : GridStringLogger(org.apache.ignite.testframework.GridStringLogger) Ignite(org.apache.ignite.Ignite) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 18 with GridStringLogger

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

the class ContinuousQueryRemoteFilterMissingInClassPathSelfTest method testServerJoinsExtClassLoaderNoException.

/**
 * @throws Exception If fail.
 */
@Test
public void testServerJoinsExtClassLoaderNoException() throws Exception {
    setExternalLoader = true;
    Ignite ignite0 = startGrid(1);
    executeContinuousQuery(ignite0.cache(DEFAULT_CACHE_NAME));
    log = new GridStringLogger();
    startGrid(2);
    assertTrue(!log.toString().contains("class org.apache.ignite.IgniteCheckedException: " + "Failed to find class with given class loader for unmarshalling"));
}
Also used : GridStringLogger(org.apache.ignite.testframework.GridStringLogger) Ignite(org.apache.ignite.Ignite) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 19 with GridStringLogger

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

the class ContinuousQueryRemoteFilterMissingInClassPathSelfTest method testClientJoinsMissingClassWarning.

/**
 * @throws Exception If fail.
 */
@Test
public void testClientJoinsMissingClassWarning() throws Exception {
    setExternalLoader = true;
    Ignite ignite0 = startGrid(1);
    executeContinuousQuery(ignite0.cache(DEFAULT_CACHE_NAME));
    log = new GridStringLogger();
    setExternalLoader = false;
    startClientGrid(2);
    String logStr = log.toString();
    assertTrue(logStr.contains("Failed to unmarshal continuous query remote filter on client node. " + "Can be ignored.") || logStr.contains("Failed to unmarshal continuous routine handler"));
}
Also used : GridStringLogger(org.apache.ignite.testframework.GridStringLogger) Ignite(org.apache.ignite.Ignite) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test)

Example 20 with GridStringLogger

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

the class IgniteDiagnosticMessagesTest method testRemoteTx.

/**
 * @throws Exception If failed.
 */
public void testRemoteTx() throws Exception {
    int timeout = 3500;
    System.setProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT, String.valueOf(timeout));
    try {
        testSpi = true;
        startGrid(0);
        GridStringLogger strLog = this.strLog = new GridStringLogger();
        strLog.logLength(1024 * 100);
        startGrid(1);
        awaitPartitionMapExchange();
        CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
        ccfg.setWriteSynchronizationMode(FULL_SYNC);
        ccfg.setCacheMode(PARTITIONED);
        ccfg.setAtomicityMode(TRANSACTIONAL);
        ccfg.setBackups(1);
        ccfg.setNearConfiguration(new NearCacheConfiguration());
        final Ignite node0 = ignite(0);
        final Ignite node1 = ignite(1);
        node0.createCache(ccfg);
        UUID id0 = node0.cluster().localNode().id();
        TestRecordingCommunicationSpi.spi(node0).blockMessages(GridDhtTxPrepareResponse.class, node1.name());
        int txCnt = 4;
        final List<Integer> keys = primaryKeys(node1.cache(DEFAULT_CACHE_NAME), txCnt, 0);
        final AtomicInteger idx = new AtomicInteger();
        IgniteInternalFuture<Long> fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {

            @Override
            public Void call() throws Exception {
                IgniteCache<Object, Object> cache = node1.cache(DEFAULT_CACHE_NAME);
                try (Transaction tx = node1.transactions().txStart()) {
                    Integer key = keys.get(idx.getAndIncrement());
                    cache.getAndPut(key, "new-" + key);
                    tx.commit();
                }
                return null;
            }
        }, txCnt, "tx");
        U.sleep(timeout * 2);
        assertFalse(fut.isDone());
        TestRecordingCommunicationSpi.spi(node0).stopBlock();
        fut.get();
        String log = strLog.toString();
        assertTrue(log.contains("Related transactions ["));
        assertTrue(log.contains("General node info [id=" + id0));
    } finally {
        System.clearProperty(IGNITE_LONG_OPERATIONS_DUMP_TIMEOUT);
    }
}
Also used : GridStringLogger(org.apache.ignite.testframework.GridStringLogger) IgniteCache(org.apache.ignite.IgniteCache) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Transaction(org.apache.ignite.transactions.Transaction) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Ignite(org.apache.ignite.Ignite) UUID(java.util.UUID) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Aggregations

GridStringLogger (org.apache.ignite.testframework.GridStringLogger)37 Ignite (org.apache.ignite.Ignite)22 Test (org.junit.Test)16 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)14 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)9 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)9 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)9 UUID (java.util.UUID)7 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)7 Transaction (org.apache.ignite.transactions.Transaction)5 URLClassLoader (java.net.URLClassLoader)4 IgniteCache (org.apache.ignite.IgniteCache)4 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)4 ClusterNode (org.apache.ignite.cluster.ClusterNode)2 IgniteEx (org.apache.ignite.internal.IgniteEx)2 IgniteInternalFuture (org.apache.ignite.internal.IgniteInternalFuture)2 IgniteClusterEx (org.apache.ignite.internal.cluster.IgniteClusterEx)2 GridTestLog4jLogger (org.apache.ignite.testframework.junits.logger.GridTestLog4jLogger)2 File (java.io.File)1 Callable (java.util.concurrent.Callable)1