Skip to content

Commit

Permalink
ARTEMIS-5214 Replacing 1.5.5 artemis and 2.0.0 libraries since they a…
Browse files Browse the repository at this point in the history
…re not compatible with the current JDK

Also fixing a possible leak
  • Loading branch information
clebertsuconic committed Dec 18, 2024
1 parent 7bf596c commit 8685b81
Show file tree
Hide file tree
Showing 21 changed files with 86 additions and 125 deletions.
46 changes: 0 additions & 46 deletions tests/compatibility-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -620,29 +620,6 @@
<file>${basedir}/target/ARTEMIS-210.cp</file>
</configuration>
</execution>
<execution>
<phase>compile</phase>
<goals>
<goal>dependency-scan</goal>
</goals>
<id>200-check</id>
<configuration>
<libListWithDeps>
<arg>org.apache.activemq:artemis-jms-server:2.0.0</arg>
<arg>org.apache.activemq:artemis-jms-client:2.0.0</arg>
<arg>org.apache.activemq:artemis-cli:2.0.0</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:2.0.0</arg>
<arg>org.apache.activemq:artemis-amqp-protocol:2.0.0</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:2.0.0</arg>
<arg>org.apache.qpid:qpid-jms-client:0.20.0</arg>
<arg>org.apache.groovy:groovy-all:pom:${groovy.version}</arg>
</libListWithDeps>
<libList>
<arg>org.apache.activemq.tests:compatibility-tests:${project.version}</arg>
</libList>
<file>${basedir}/target/ARTEMIS-200.cp</file>
</configuration>
</execution>
<execution>
<id>140-check</id>
<phase>compile</phase>
Expand All @@ -665,29 +642,6 @@
<file>${basedir}/target/ARTEMIS-140.cp</file>
</configuration>
</execution>
<execution>
<id>155-check</id>
<phase>compile</phase>
<goals>
<goal>dependency-scan</goal>
</goals>
<configuration>
<libListWithDeps>
<arg>org.apache.activemq:artemis-jms-server:1.5.5</arg>
<arg>org.apache.activemq:artemis-jms-client:1.5.5</arg>
<arg>org.apache.activemq:artemis-cli:1.5.5</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:1.5.5</arg>
<arg>org.apache.activemq:artemis-amqp-protocol:1.5.5</arg>
<arg>org.apache.activemq:artemis-hornetq-protocol:1.5.5</arg>
<arg>org.apache.groovy:groovy-all:pom:${groovy.version}</arg>
<arg>org.jboss.marshalling:jboss-marshalling-river:2.0.9.Final</arg>
</libListWithDeps>
<libList>
<arg>org.apache.activemq.tests:compatibility-tests:${project.version}</arg>
</libList>
<file>${basedir}/target/ARTEMIS-155.cp</file>
</configuration>
</execution>
<execution>
<id>hornetq-235</id>
<phase>compile</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public class GroovyRun {

public static final String SNAPSHOT = "ARTEMIS-SNAPSHOT";
public static final String JAKARTAEE = "ARTEMIS-JAKARTAEE";
public static final String ONE_FIVE = "ARTEMIS-155";
public static final String ONE_FOUR = "ARTEMIS-140";
public static final String TWO_ZERO = "ARTEMIS-200";
public static final String TWO_ONE = "ARTEMIS-210";
public static final String TWO_FOUR = "ARTEMIS-240";
public static final String TWO_SIX_THREE = "ARTEMIS-263";
Expand All @@ -48,13 +46,42 @@ public class GroovyRun {
public static final String HORNETQ_247 = "HORNETQ-247";
public static final String AMQ_5_11 = "AMQ_5_11";

public static Binding binding = new Binding();
public static GroovyShell shell = new GroovyShell(binding);
private static Binding theBinding;
private static GroovyShell theShell;


public static void clear() {
List<String> variablesToRemove = new ArrayList<>();
variablesToRemove.addAll(binding.getVariables().keySet());
variablesToRemove.forEach(v -> binding.removeVariable(v));
try {
if (theBinding != null) {
List<String> variablesToRemove = new ArrayList<>(theBinding.getVariables().keySet());
variablesToRemove.forEach(theBinding::removeVariable);
theBinding.setMetaClass(null);
}
} finally {
theBinding = null;
theShell = null;
}
}

private static GroovyShell getShell() {
initShell();

return theShell;

}

private static Binding getBinding() {
initShell();

return theBinding;

}

private static void initShell() {
if (theShell == null || theBinding == null) {
theBinding = new Binding();
theShell = new GroovyShell(theBinding);
}
}

/**
Expand Down Expand Up @@ -83,21 +110,21 @@ public static Object evaluate(String script,

setVariable(argVariableName, arg);

return shell.evaluate(scriptURI);
return getShell().evaluate(scriptURI);
}


public static void setVariable(String name, Object arg) {
binding.setVariable(name, arg);
getBinding().setVariable(name, arg);
}

public static Object getVariable(String name) {
return binding.getVariable(name);
return getBinding().getVariable(name);
}

// Called with reflection
public static Object execute(String script) throws Throwable {
return shell.evaluate(script);
return getShell().evaluate(script);
}

public static void assertNotNull(Object value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.activemq.artemis.tests.compatibility;

import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assumptions.assumeTrue;
Expand Down Expand Up @@ -54,6 +53,8 @@ public void testActiveMQJMSCompatibility_1XPrefix_SNAPSHOT() throws Exception {
System.clearProperty(ActiveMQJMSClient.class.getName() + ".enable1xPrefixes");
}

clearClassLoader(loader);

}

@Test
Expand Down Expand Up @@ -83,13 +84,4 @@ public void testActiveMQJMSCompatibility_1XPrefix_SNAPSHOT_with_properties() thr

}

@Test

// The purpose here is just to validate the test itself. Nothing to be fixed here
public void testActiveMQJMSCompatibility_1XPrefix_ONE_FIVE() throws Exception {
ClassLoader loader = getClasspath(ONE_FIVE, false);

evaluate(loader, "ActiveMQJMSClientCompatibilityTest/validateClient.groovy");

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.activemq.artemis.tests.compatibility;

import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FOUR;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand Down Expand Up @@ -55,7 +55,7 @@ public static Collection getParameters() {
// combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, ONE_FIVE});
// combinations.add(new Object[]{ONE_FIVE, ONE_FIVE, ONE_FIVE});

combinations.addAll(combinatory(new Object[]{SNAPSHOT}, new Object[]{ONE_FIVE, SNAPSHOT}, new Object[]{ONE_FIVE, SNAPSHOT}));
combinations.addAll(combinatory(new Object[]{SNAPSHOT}, new Object[]{ONE_FOUR, SNAPSHOT}, new Object[]{ONE_FOUR, SNAPSHOT}));
return combinations;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.activemq.artemis.tests.compatibility;

import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FOUR;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.TWO_FOUR;

Expand Down Expand Up @@ -53,7 +53,7 @@ public static Collection getParameters() {
// combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, ONE_FIVE});
// combinations.add(new Object[]{ONE_FIVE, ONE_FIVE, ONE_FIVE});

combinations.addAll(combinatory(new Object[]{null}, new Object[]{ONE_FIVE, SNAPSHOT, TWO_FOUR}, new Object[]{ONE_FIVE, SNAPSHOT, TWO_FOUR}));
combinations.addAll(combinatory(new Object[]{null}, new Object[]{ONE_FOUR, SNAPSHOT, TWO_FOUR}, new Object[]{ONE_FOUR, SNAPSHOT, TWO_FOUR}));
return combinations;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.activemq.artemis.tests.compatibility;

import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FOUR;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;
import static org.junit.jupiter.api.Assumptions.assumeFalse;

Expand Down Expand Up @@ -54,7 +54,7 @@ public static Collection getParameters() {
// combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, ONE_FIVE});
// combinations.add(new Object[]{ONE_FIVE, ONE_FIVE, ONE_FIVE});

combinations.add(new Object[]{null, ONE_FIVE, SNAPSHOT});
combinations.add(new Object[]{null, ONE_FOUR, SNAPSHOT});
combinations.add(new Object[]{null, SNAPSHOT, SNAPSHOT});
return combinations;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.TWO_ONE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.TWO_SEVEN_ZERO;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.TWO_SIX_THREE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.TWO_ZERO;

import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -45,7 +44,7 @@ public static Collection getParameters() {
List<Object[]> combinations = new ArrayList<>();

// FQQN was added into 2.7.0, hence we only test the server as SNAPSHOT or TWO_SEVEN_ZERO
List testsList = combinatory(new Object[]{SNAPSHOT}, new Object[]{SNAPSHOT, TWO_ZERO, TWO_FOUR, TWO_ONE, TWO_SIX_THREE, TWO_SEVEN_ZERO}, new Object[]{SNAPSHOT, TWO_ZERO, TWO_FOUR, TWO_ONE, TWO_SIX_THREE, TWO_SEVEN_ZERO});
List testsList = combinatory(new Object[]{SNAPSHOT}, new Object[]{SNAPSHOT, TWO_FOUR, TWO_ONE, TWO_SIX_THREE, TWO_SEVEN_ZERO}, new Object[]{SNAPSHOT, TWO_FOUR, TWO_ONE, TWO_SIX_THREE, TWO_SEVEN_ZERO});
addCombinations(testsList, null, new Object[] {TWO_SEVEN_ZERO}, new Object[]{SNAPSHOT, TWO_SEVEN_ZERO}, new Object[]{SNAPSHOT, TWO_SEVEN_ZERO});
return testsList;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package org.apache.activemq.artemis.tests.compatibility;

import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.HORNETQ_235;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;

import org.apache.activemq.artemis.tests.compatibility.base.VersionedBase;
Expand Down Expand Up @@ -46,7 +45,6 @@ public static Collection getParameters() {
List<Object[]> combinations = new ArrayList<>();

combinations.add(new Object[]{SNAPSHOT, HORNETQ_235, HORNETQ_235});
combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, ONE_FIVE});
return combinations;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.activemq.artemis.tests.compatibility;

import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.HORNETQ_235;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FOUR;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;
import static org.junit.jupiter.api.Assertions.assertEquals;

Expand All @@ -43,7 +43,7 @@ public class HornetQSoakTest extends ClasspathBase {
public void setUp() throws Throwable {

this.artemisClassLoader = getClasspath(SNAPSHOT);
this.artemis1XClassLoader = getClasspath(ONE_FIVE);
this.artemis1XClassLoader = getClasspath(ONE_FOUR);
this.hornetqClassLoader = getClasspath(HORNETQ_235);

FileUtil.deleteDirectory(serverFolder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.activemq.artemis.tests.compatibility;

import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.JAKARTAEE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FOUR;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand All @@ -43,15 +43,15 @@ public class JmsReplyToQueueTest extends VersionedBase {
@Parameters(name = "server={0}, producer={1}, consumer={2}")
public static Collection getParameters() {
List<Object[]> combinations = new ArrayList<>();
combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, SNAPSHOT});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FIVE});
combinations.add(new Object[]{SNAPSHOT, ONE_FOUR, SNAPSHOT});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FOUR});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, SNAPSHOT});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, SNAPSHOT, SNAPSHOT});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, SNAPSHOT});
combinations.add(new Object[]{JAKARTAEE, SNAPSHOT, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FIVE});
combinations.add(new Object[]{JAKARTAEE, ONE_FIVE, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FOUR});
combinations.add(new Object[]{JAKARTAEE, ONE_FOUR, JAKARTAEE});
return combinations;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.activemq.artemis.tests.compatibility;

import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.JAKARTAEE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FOUR;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand All @@ -43,14 +43,14 @@ public class JmsReplyToTempQueueTest extends VersionedBase {
@Parameters(name = "server={0}, producer={1}, consumer={2}")
public static Collection getParameters() {
List<Object[]> combinations = new ArrayList<>();
combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, SNAPSHOT});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FIVE});
combinations.add(new Object[]{SNAPSHOT, ONE_FOUR, SNAPSHOT});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FOUR});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, SNAPSHOT});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, SNAPSHOT});
combinations.add(new Object[]{JAKARTAEE, SNAPSHOT, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FIVE});
combinations.add(new Object[]{JAKARTAEE, ONE_FIVE, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FOUR});
combinations.add(new Object[]{JAKARTAEE, ONE_FOUR, JAKARTAEE});
return combinations;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.activemq.artemis.tests.compatibility;

import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.JAKARTAEE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FOUR;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand All @@ -43,14 +43,14 @@ public class JmsReplyToTempTopicTest extends VersionedBase {
@Parameters(name = "server={0}, producer={1}, consumer={2}")
public static Collection getParameters() {
List<Object[]> combinations = new ArrayList<>();
combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, SNAPSHOT});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FIVE});
combinations.add(new Object[]{SNAPSHOT, ONE_FOUR, SNAPSHOT});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FOUR});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, SNAPSHOT});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, SNAPSHOT});
combinations.add(new Object[]{JAKARTAEE, SNAPSHOT, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FIVE});
combinations.add(new Object[]{JAKARTAEE, ONE_FIVE, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FOUR});
combinations.add(new Object[]{JAKARTAEE, ONE_FOUR, JAKARTAEE});
return combinations;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package org.apache.activemq.artemis.tests.compatibility;

import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.JAKARTAEE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FIVE;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.ONE_FOUR;
import static org.apache.activemq.artemis.tests.compatibility.GroovyRun.SNAPSHOT;
import static org.junit.jupiter.api.Assertions.assertTrue;

Expand All @@ -43,14 +43,14 @@ public class JmsReplyToTopicTest extends VersionedBase {
@Parameters(name = "server={0}, producer={1}, consumer={2}")
public static Collection getParameters() {
List<Object[]> combinations = new ArrayList<>();
combinations.add(new Object[]{SNAPSHOT, ONE_FIVE, SNAPSHOT});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FIVE});
combinations.add(new Object[]{SNAPSHOT, ONE_FOUR, SNAPSHOT});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, ONE_FOUR});
combinations.add(new Object[]{SNAPSHOT, SNAPSHOT, SNAPSHOT});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, SNAPSHOT});
combinations.add(new Object[]{JAKARTAEE, SNAPSHOT, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FIVE});
combinations.add(new Object[]{JAKARTAEE, ONE_FIVE, JAKARTAEE});
combinations.add(new Object[]{JAKARTAEE, JAKARTAEE, ONE_FOUR});
combinations.add(new Object[]{JAKARTAEE, ONE_FOUR, JAKARTAEE});
return combinations;
}

Expand Down
Loading

0 comments on commit 8685b81

Please sign in to comment.