Search in sources :

Example 1 with StringLogAppender

use of org.infinispan.commons.test.skip.StringLogAppender in project infinispan by infinispan.

the class EpollAvailabilityTest method testEpollNotAvailable.

public void testEpollNotAvailable() throws Exception {
    SkipTestNG.onlyOnOS(OS.LINUX);
    Thread testThread = Thread.currentThread();
    StringLogAppender logAppender = new StringLogAppender("org.infinispan.HOTROD", Level.TRACE, t -> t == testThread, PatternLayout.newBuilder().withPattern(LOG_FORMAT).build());
    logAppender.install();
    try {
        CherryPickClassLoader classLoader = new CherryPickClassLoader(new String[] { EPOLL_AVAILABLE_CLASS }, null, new String[] { "io.netty.channel.epoll.Epoll" }, this.getClass().getClassLoader());
        Class.forName(EPOLL_AVAILABLE_CLASS, true, classLoader);
        String firstLine = logAppender.getLog(0);
        assertTrue(firstLine, firstLine.contains("io.netty.channel.epoll.Epoll"));
    } finally {
        logAppender.uninstall();
    }
}
Also used : CherryPickClassLoader(org.infinispan.test.CherryPickClassLoader) StringLogAppender(org.infinispan.commons.test.skip.StringLogAppender)

Example 2 with StringLogAppender

use of org.infinispan.commons.test.skip.StringLogAppender in project infinispan by infinispan.

the class HotRodAccessLoggingTest method setup.

@Override
protected void setup() throws Exception {
    testShortName = TestResourceTracker.getCurrentTestShortName();
    logAppender = new StringLogAppender("org.infinispan.HOTROD_ACCESS_LOG", Level.TRACE, t -> t.getName().startsWith("non-blocking-thread-" + testShortName), PatternLayout.newBuilder().withPattern(LOG_FORMAT).build());
    logAppender.install();
    super.setup();
}
Also used : TestResourceTracker(org.infinispan.commons.test.TestResourceTracker) Level(org.apache.logging.log4j.Level) Test(org.testng.annotations.Test) AssertJUnit.assertTrue(org.testng.AssertJUnit.assertTrue) PatternLayout(org.apache.logging.log4j.core.layout.PatternLayout) HotRodSingleNodeTest(org.infinispan.server.hotrod.HotRodSingleNodeTest) StringLogAppender(org.infinispan.commons.test.skip.StringLogAppender) StringLogAppender(org.infinispan.commons.test.skip.StringLogAppender)

Example 3 with StringLogAppender

use of org.infinispan.commons.test.skip.StringLogAppender in project infinispan by infinispan.

the class RestAccessLoggingTest method setup.

@Override
protected void setup() throws Exception {
    super.setup();
    testShortName = TestResourceTracker.getCurrentTestShortName();
    logAppender = new StringLogAppender("org.infinispan.REST_ACCESS_LOG", Level.TRACE, t -> t.getName().startsWith("non-blocking-thread-" + testShortName), PatternLayout.newBuilder().withPattern(LOG_FORMAT).build());
    logAppender.install();
    restServer = new RestServerHelper(cacheManager);
    restServer.start(TestResourceTracker.getCurrentTestShortName());
    RestClientConfigurationBuilder builder = new RestClientConfigurationBuilder();
    builder.addServer().host(restServer.getHost()).port(restServer.getPort());
    restClient = RestClient.forConfiguration(builder.create());
    cacheClient = restClient.cache("default");
}
Also used : CompletionStages.join(org.infinispan.util.concurrent.CompletionStages.join) SingleCacheManagerTest(org.infinispan.test.SingleCacheManagerTest) TestResourceTracker(org.infinispan.commons.test.TestResourceTracker) Level(org.apache.logging.log4j.Level) RestClient(org.infinispan.client.rest.RestClient) Test(org.testng.annotations.Test) AssertJUnit.assertTrue(org.testng.AssertJUnit.assertTrue) RestCacheClient(org.infinispan.client.rest.RestCacheClient) RestServerHelper(org.infinispan.rest.helper.RestServerHelper) RestClientConfigurationBuilder(org.infinispan.client.rest.configuration.RestClientConfigurationBuilder) EmbeddedCacheManager(org.infinispan.manager.EmbeddedCacheManager) TestCacheManagerFactory(org.infinispan.test.fwk.TestCacheManagerFactory) PatternLayout(org.apache.logging.log4j.core.layout.PatternLayout) StringLogAppender(org.infinispan.commons.test.skip.StringLogAppender) RestClientConfigurationBuilder(org.infinispan.client.rest.configuration.RestClientConfigurationBuilder) StringLogAppender(org.infinispan.commons.test.skip.StringLogAppender) RestServerHelper(org.infinispan.rest.helper.RestServerHelper)

Aggregations

StringLogAppender (org.infinispan.commons.test.skip.StringLogAppender)3 Level (org.apache.logging.log4j.Level)2 PatternLayout (org.apache.logging.log4j.core.layout.PatternLayout)2 TestResourceTracker (org.infinispan.commons.test.TestResourceTracker)2 AssertJUnit.assertTrue (org.testng.AssertJUnit.assertTrue)2 Test (org.testng.annotations.Test)2 RestCacheClient (org.infinispan.client.rest.RestCacheClient)1 RestClient (org.infinispan.client.rest.RestClient)1 RestClientConfigurationBuilder (org.infinispan.client.rest.configuration.RestClientConfigurationBuilder)1 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)1 RestServerHelper (org.infinispan.rest.helper.RestServerHelper)1 HotRodSingleNodeTest (org.infinispan.server.hotrod.HotRodSingleNodeTest)1 CherryPickClassLoader (org.infinispan.test.CherryPickClassLoader)1 SingleCacheManagerTest (org.infinispan.test.SingleCacheManagerTest)1 TestCacheManagerFactory (org.infinispan.test.fwk.TestCacheManagerFactory)1 CompletionStages.join (org.infinispan.util.concurrent.CompletionStages.join)1