Search in sources :

Example 1 with CherryPickClassLoader

use of org.infinispan.test.CherryPickClassLoader 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)

Aggregations

StringLogAppender (org.infinispan.commons.test.skip.StringLogAppender)1 CherryPickClassLoader (org.infinispan.test.CherryPickClassLoader)1