Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISPN-13181 JDK 17 changes (Nashorn) #9450

Merged
merged 2 commits into from Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 6 additions & 4 deletions build-configuration/pom.xml
Expand Up @@ -114,7 +114,7 @@

<!-- org.wildfly / org.jboss.eap -->
<appserver.groupId>org.wildfly</appserver.groupId>
<appserver.version>23.0.2.Final</appserver.version>
<appserver.version>24.0.1.Final</appserver.version>

<!-- Java source/target version -->
<version.java>11</version.java>
Expand Down Expand Up @@ -170,12 +170,13 @@
<version.mockito>2.27.0</version.mockito>
<version.mockito_dep.bytebuddy>1.9.7</version.mockito_dep.bytebuddy>
<version.mockito_dep.objenesis>2.6</version.mockito_dep.objenesis>
<version.nashorn>15.3</version.nashorn>
<version.netty>4.1.63.Final</version.netty>
<version.okhttp>3.14.8</version.okhttp>
<version.openjdk.jmh>1.23</version.openjdk.jmh>
<version.org.wildfly.arquillian>2.2.0.Final</version.org.wildfly.arquillian>
<version.org.wildfly.core>15.0.1.Final</version.org.wildfly.core>
<version.org.wildfly.elytron>1.15.5.Final</version.org.wildfly.elytron>
<version.org.wildfly.arquillian>3.0.1.Final</version.org.wildfly.arquillian>
<version.org.wildfly.core>16.0.1.Final</version.org.wildfly.core>
<version.org.wildfly.elytron>1.16.1.Final</version.org.wildfly.elytron>
<version.org.wildfly.openssl>2.1.4.Final</version.org.wildfly.openssl>
<version.org.wildfly.openssl.natives>2.1.0.Final</version.org.wildfly.openssl.natives>
<version.picketbox>5.0.3.Final</version.picketbox>
Expand All @@ -194,6 +195,7 @@
<version.spring.session>2.5.1</version.spring.session>
<version.micrometer>1.7.1</version.micrometer>
<version.kafka.client>2.5.0</version.kafka.client>
<version.xom>1.3.7</version.xom>

<!-- Plugin dependencies -->
<version.checkstyle.maven-plugin>3.1.1</version.checkstyle.maven-plugin>
Expand Down
13 changes: 13 additions & 0 deletions client/hotrod-client/pom.xml
Expand Up @@ -600,5 +600,18 @@
</plugins>
</build>
</profile>
<profile>
<id>nashorn-tests</id>
<activation>
<jdk>[16,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Expand Up @@ -93,7 +93,7 @@ public class ThreadLeakChecker {
"|mysql-cj-abandoned-connection-cleanup" +
").*");
private static final String ARQUILLIAN_CONSOLE_CONSUMER =
"org.jboss.as.arquillian.container.managed.ManagedDeployableContainer$ConsoleConsumer";
"org.jboss.as.arquillian.container.CommonManagedDeployableContainer$ConsoleConsumer";
private static final boolean ENABLED =
"true".equalsIgnoreCase(System.getProperty("infinispan.test.checkThreadLeaks", "true"));

Expand Down
Expand Up @@ -13,23 +13,50 @@
*/
public class SkipJunit implements TestRule {
private final OS[] oses;
private final int jdkMajorVersion;

public SkipJunit(OS... oses) {
this.oses = Objects.requireNonNull(oses);
this.jdkMajorVersion = -1;
}

public SkipJunit(int jdkMajorVersion) {
this.jdkMajorVersion = jdkMajorVersion;
this.oses = null;
}

@Override
public Statement apply(Statement base, Description description) {
OS os = OS.getCurrentOs();
if (!Arrays.asList(oses).contains(os))
return base;

return new IgnoreStatement(description, os);
if (oses != null) {
OS os = OS.getCurrentOs();
if (!Arrays.asList(oses).contains(os)) {
return base;
} else {
return new Statement() {
@Override
public void evaluate() {
throw new AssumptionViolatedException("Ignoring test " + description.getDisplayName() + " on OS " + os);
}
};
}
} else {
int version = getJDKVersion();
if (version >= jdkMajorVersion) {
return new Statement() {
@Override
public void evaluate() {
throw new AssumptionViolatedException("Ignoring test " + description.getDisplayName() + " on JDK " + version);
}
};
} else {
return base;
}
}
}

/**
* Use within a {@code @Test} method to skip that method on some OSes.
* Use in a {@code @BeforeClass} method to skip all methods in a class on some OSes.
* Use within a {@code @Test} method to skip that method on some OSes. Use in a {@code @BeforeClass} method to skip
* all methods in a class on some OSes.
*/
public static void skipOnOS(OS... oses) {
OS os = OS.getCurrentOs();
Expand All @@ -38,32 +65,27 @@ public static void skipOnOS(OS... oses) {
}

/**
* Use within a {@code @Test} method to run this test only on certain OSes.
* Use in a {@code @BeforeClass} method to run all methods in a class only on some OSes.
* Use within a {@code @Test} method to run this test only on certain OSes. Use in a {@code @BeforeClass} method to
* run all methods in a class only on some OSes.
*/
public static void onlyOnOS(OS... oses) {
OS os = OS.getCurrentOs();
if (!Arrays.asList(oses).contains(os))
throw new AssumptionViolatedException("Skipping test on " + os);
}

private static class IgnoreStatement extends Statement {

private final Description method;

private final OS os;

IgnoreStatement(Description method, OS os) {
this.method = method;
this.os = os;
}

@Override
public void evaluate() {
String msg = "Skipping test " + method.getDisplayName() + " on " + os;
System.out.println(msg);
throw new AssumptionViolatedException(msg);
public static void skipSinceJDK(int major) {
int version = getJDKVersion();
if (version >= major) {
throw new AssumptionViolatedException("Skipping test on JDK " + version);
}
}

private static int getJDKVersion() {
String[] parts = System.getProperty("java.version").replaceAll("[^0-9\\.]", "").split("\\.");
int version = Integer.parseInt(parts[0]);
if (version == 1)
version = Integer.parseInt(parts[1]);
return version;
}
}
Expand Up @@ -64,7 +64,7 @@ public static void skipBeforeJDK(int major) {
}

private static int getJDKVersion() {
String[] parts = System.getProperty("java.version").split("\\.");
String[] parts = System.getProperty("java.version").replaceAll("[^0-9\\.]", "").split("\\.");
int version = Integer.parseInt(parts[0]);
if (version == 1)
version = Integer.parseInt(parts[1]);
Expand Down
5 changes: 5 additions & 0 deletions integrationtests/security-it/pom.xml
Expand Up @@ -64,6 +64,11 @@
<artifactId>jboss-negotiation-extras</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Expand Up @@ -241,7 +241,7 @@ static class SecurityTraceLoggingServerSetupTask extends AbstractTraceLoggingSer

@Override
protected Collection<String> getCategories(ManagementClient managementClient, String containerId) {
return Arrays.asList("javax.security", "org.jboss.security", "org.picketbox", "org.wildfly.security");
return Arrays.asList("javax.security", "org.jboss.security", "org.wildfly.security");
}
}

Expand Down
Expand Up @@ -13,6 +13,7 @@
import javax.security.auth.login.LoginException;

import org.infinispan.commons.test.ThreadLeakChecker;
import org.infinispan.commons.test.skip.SkipJunit;
import org.infinispan.security.AuthorizationPermission;
import org.infinispan.security.PrincipalRoleMapper;
import org.infinispan.test.integration.security.tasks.AbstractKrb5ConfServerSetupTask;
Expand All @@ -34,6 +35,7 @@
import org.jboss.security.SecurityConstants;
import org.jboss.security.negotiation.AdvancedLdapLoginModule;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.ClassRule;
import org.junit.runner.RunWith;

/**
Expand All @@ -51,6 +53,9 @@
})
public class KrbLdapAuthenticationIT extends AbstractAuthentication {

@ClassRule
public static SkipJunit skip = new SkipJunit(13);

private static final String TRUE = Boolean.TRUE.toString(); // TRUE

public static final String ADMIN_ROLE = "AdminIspnRole";
Expand Down Expand Up @@ -225,7 +230,7 @@ static class SecurityTraceLoggingServerSetupTask extends AbstractTraceLoggingSer

@Override
protected Collection<String> getCategories(ManagementClient managementClient, String containerId) {
return Arrays.asList("javax.security", "org.jboss.security", "org.picketbox", "org.wildfly.security");
return Arrays.asList("javax.security", "org.jboss.security", "org.wildfly.security");
}
}

Expand Down
Expand Up @@ -10,6 +10,7 @@
import javax.security.auth.login.LoginException;

import org.infinispan.commons.test.ThreadLeakChecker;
import org.infinispan.commons.test.skip.SkipJunit;
import org.infinispan.security.AuthorizationPermission;
import org.infinispan.security.PrincipalRoleMapper;
import org.infinispan.security.mappers.IdentityRoleMapper;
Expand All @@ -27,6 +28,7 @@
import org.jboss.as.test.integration.security.common.config.SecurityDomain;
import org.jboss.as.test.integration.security.common.config.SecurityModule;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.ClassRule;
import org.junit.runner.RunWith;

/**
Expand All @@ -51,6 +53,9 @@ public class LdapAuthenticationIT extends AbstractAuthentication {
public static final String UNPRIVILEGED_ROLE = "unprivileged";
public static final String UNPRIVILEGED_PASSWD = "weakPassword";

@ClassRule
public static SkipJunit skip = new SkipJunit(13);

@Deployment
@TargetsContainer(DEFAULT_DEPLOY_CONTAINER)
public static WebArchive getDeployment() {
Expand Down Expand Up @@ -100,7 +105,7 @@ static class SecurityTraceLoggingServerSetupTask extends AbstractTraceLoggingSer

@Override
protected Collection<String> getCategories(ManagementClient managementClient, String containerId) {
return Arrays.asList("javax.security", "org.jboss.security", "org.picketbox", "org.wildfly.security");
return Arrays.asList("javax.security", "org.jboss.security", "org.wildfly.security");
}
}

Expand Down
Expand Up @@ -42,6 +42,7 @@ public static WebArchive createBaseTestDeployment() {
.addAsLibraries(
new File("target/test-libs/infinispan-core.jar"),
new File("target/test-libs/infinispan-commons.jar"),
new File("target/test-libs/infinispan-commons-test.jar"),
new File("target/test-libs/caffeine.jar"),
new File("target/test-libs/rxjava.jar"),
new File("target/test-libs/reactive-streams.jar"),
Expand Down
18 changes: 18 additions & 0 deletions pom.xml
Expand Up @@ -380,6 +380,7 @@
<versionx.org.objectweb.howl.howl>1.0.1-1</versionx.org.objectweb.howl.howl>
<versionx.org.openjdk.jmh.jmh-core>${version.openjdk.jmh}</versionx.org.openjdk.jmh.jmh-core>
<versionx.org.openjdk.jmh.jmh-generator-annprocess>${version.openjdk.jmh}</versionx.org.openjdk.jmh.jmh-generator-annprocess>
<versionx.org.openjdk.nashorn>${version.nashorn}</versionx.org.openjdk.nashorn>
<versionx.org.picketlink.picketlink-api>${version.picketlink}</versionx.org.picketlink.picketlink-api>
<versionx.org.reactivestreams.reactive-streams>${version.reactivestreams}</versionx.org.reactivestreams.reactive-streams>
<versionx.org.rocksdb.rocksdbjni>${version.rocksdb}</versionx.org.rocksdb.rocksdbjni>
Expand Down Expand Up @@ -464,6 +465,11 @@
<artifactId>bcpkix-jdk15to18</artifactId>
<version>${versionx.com.bouncycastle}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>${versionx.com.bouncycastle}</version>
</dependency>
<dependency>
<groupId>com.clearspring.analytics</groupId>
<artifactId>stream</artifactId>
Expand Down Expand Up @@ -1584,6 +1590,11 @@
<version>${versionx.org.openjdk.jmh.jmh-generator-annprocess}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
<version>${versionx.org.openjdk.nashorn}</version>
</dependency>
<dependency>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
Expand Down Expand Up @@ -1898,6 +1909,13 @@
<groupId>org.jboss.galleon</groupId>
<artifactId>galleon-maven-plugin</artifactId>
<version>${version.org.jboss.galleon}</version>
<dependencies>
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>${version.xom}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.antlr</groupId>
Expand Down
16 changes: 16 additions & 0 deletions server/rest/pom.xml
Expand Up @@ -266,4 +266,20 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>nashorn-tests</id>
<activation>
<jdk>[16,)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>org.openjdk.nashorn</groupId>
<artifactId>nashorn-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
Expand Up @@ -14,7 +14,6 @@
import org.infinispan.client.rest.RestResponse;
import org.infinispan.client.rest.RestTaskClient;
import org.infinispan.commons.dataconversion.internal.Json;
import org.infinispan.commons.test.skip.SkipTestNG;
import org.infinispan.factories.GlobalComponentRegistry;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.rest.assertion.ResponseAssertion;
Expand Down Expand Up @@ -90,7 +89,6 @@ public void testFailingTaskExec() {

@Test
public void testTaskUpload() throws Exception {
SkipTestNG.skipSinceJDK(12);
RestTaskClient taskClient = client.tasks();

String script = getResourceAsString("hello.js", getClass().getClassLoader());
Expand Down
2 changes: 1 addition & 1 deletion server/runtime/src/main/server/server/conf/infinispan.xml
Expand Up @@ -48,6 +48,6 @@
</security-realms>
</security>

<endpoints socket-binding="default" security-realm="default"/>
<endpoints socket-binding="default" security-realm="default" />
</server>
</infinispan>
Expand Up @@ -23,6 +23,7 @@ public class ServerOverlayConfigurationTest {
public void testOverlay() {
Properties properties = new Properties();
properties.put(Server.INFINISPAN_SERVER_CONFIG_PATH, getConfigPath().toString());
properties.put(Server.INFINISPAN_SERVER_HOME_PATH, getConfigPath().toString());
Server server = new Server(getConfigPath().toFile(), Arrays.asList(Paths.get("Base.xml"), Paths.get("Overlay.yml")), properties);
ConfigurationBuilderHolder holder = server.getConfigurationBuilderHolder();
assertTrue(holder.getNamedConfigurationBuilders().containsKey("overlay"));
Expand Down
Expand Up @@ -45,6 +45,7 @@ public static void prepareLibs() throws IOException {
public void testLoaderViaSystemProperty() {
Properties properties = new Properties();
properties.put(Loader.INFINISPAN_SERVER_LIB_PATH, String.join(File.pathSeparator, lib1.toString(), lib2.toString(), lib3.toString()));
properties.put("user.dir", System.getProperty("user.dir"));
Loader.run(new String[]{LoaderTest.class.getName()}, properties);
}

Expand All @@ -56,7 +57,9 @@ public void testLoaderViaPropertyFile() throws IOException {
try (Writer w = Files.newBufferedWriter(propertyFile)) {
properties.store(w, null);
}
Loader.run(new String[]{LoaderTest.class.getName(), "-P", propertyFile.toAbsolutePath().toString()}, new Properties());
properties = new Properties();
properties.put("user.dir", System.getProperty("user.dir"));
Loader.run(new String[]{LoaderTest.class.getName(), "-P", propertyFile.toAbsolutePath().toString()}, properties);
}

public static void main(String[] args) {
Expand Down
Expand Up @@ -425,5 +425,4 @@ public void pause(int server) {
public RemoteCacheManager createRemoteCacheManager(ConfigurationBuilder builder) {
return new RemoteCacheManager(builder.build());
}

}