Search in sources :

Example 11 with DisabledForJreRange

use of org.junit.jupiter.api.condition.DisabledForJreRange in project logging-log4j2 by apache.

the class AbstractScriptFilterTest method testJavascriptFilter.

@Test
@DisabledForJreRange(min = JRE.JAVA_15, disabledReason = "JEP 372: Remove the Nashorn JavaScript Engine")
public void testJavascriptFilter(final LoggerContext context, @Named("List") final ListAppender app) throws Exception {
    final Logger logger = context.getLogger("TestJavaScriptFilter");
    logger.traceEntry();
    logger.info("This should not be logged");
    ThreadContext.put("UserId", "JohnDoe");
    logger.info("This should be logged");
    ThreadContext.clearMap();
    final List<String> messages = app.getMessages();
    try {
        assertNotNull(messages, "No Messages");
        assertEquals(messages.size(), 2, "Incorrect number of messages. Expected 2, Actual " + messages.size());
    } finally {
        app.clear();
    }
}
Also used : Logger(org.apache.logging.log4j.Logger) Test(org.junit.jupiter.api.Test) DisabledForJreRange(org.junit.jupiter.api.condition.DisabledForJreRange)

Example 12 with DisabledForJreRange

use of org.junit.jupiter.api.condition.DisabledForJreRange in project dropwizard by dropwizard.

the class HttpsConnectorFactoryTest method testExcludedProtocolsJava16.

@Test
@DisabledForJreRange(max = JRE.JAVA_15)
void testExcludedProtocolsJava16() throws Exception {
    List<String> excludedProtocols = Arrays.asList("SSLv3", "TLSv1");
    HttpsConnectorFactory factory = new HttpsConnectorFactory();
    // necessary to avoid a prompt for a password
    factory.setKeyStorePassword("password");
    factory.setExcludedProtocols(excludedProtocols);
    SslContextFactory sslContextFactory = factory.configureSslContextFactory(new SslContextFactory.Server());
    assertThat(Arrays.asList(sslContextFactory.getExcludeProtocols())).isEqualTo(excludedProtocols);
    sslContextFactory.start();
    try {
        assertThat(sslContextFactory.newSSLEngine().getEnabledProtocols()).contains("TLSv1.2", "TLSv1.3").doesNotContain("SSLv3", "TLSv1");
    } finally {
        sslContextFactory.stop();
    }
}
Also used : SslContextFactory(org.eclipse.jetty.util.ssl.SslContextFactory) Test(org.junit.jupiter.api.Test) DisabledForJreRange(org.junit.jupiter.api.condition.DisabledForJreRange)

Aggregations

Test (org.junit.jupiter.api.Test)12 DisabledForJreRange (org.junit.jupiter.api.condition.DisabledForJreRange)12 Document (org.bson.Document)4 SslContextFactory (org.eclipse.jetty.util.ssl.SslContextFactory)4 MetricRegistry (com.codahale.metrics.MetricRegistry)2 InstrumentedConnectionFactory (com.codahale.metrics.jetty9.InstrumentedConnectionFactory)2 DBRef (com.mongodb.DBRef)2 ResourceConfigurationSourceProvider (io.dropwizard.configuration.ResourceConfigurationSourceProvider)2 YamlConfigurationFactory (io.dropwizard.configuration.YamlConfigurationFactory)2 DiscoverableSubtypeResolver (io.dropwizard.jackson.DiscoverableSubtypeResolver)2 Jackson (io.dropwizard.jackson.Jackson)2 BaseValidator (io.dropwizard.validation.BaseValidator)2 File (java.io.File)2 IOException (java.io.IOException)2 UncheckedIOException (java.io.UncheckedIOException)2 URI (java.net.URI)2 KeyStore (java.security.KeyStore)2 KeyStoreException (java.security.KeyStoreException)2 Arrays (java.util.Arrays)2 Collection (java.util.Collection)2