Skip to content

Commit

Permalink
Revert "Revert quarkusio#40601 and disable tests enabled by quarkusio…
Browse files Browse the repository at this point in the history
…#40749"

This reverts commit fc3988b.
  • Loading branch information
holly-cummins committed May 30, 2024
1 parent d0edd99 commit a712fe9
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 391 deletions.
5 changes: 5 additions & 0 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4817,6 +4817,11 @@
<type>pom</type>
</dependency>

<dependency>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling</artifactId>
<version>${jboss-marshalling.version}</version>
</dependency>
<dependency>
<groupId>org.jboss.threads</groupId>
<artifactId>jboss-threads</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import org.apache.maven.shared.invoker.MavenInvocationException;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledIfSystemProperty;

Expand All @@ -22,7 +21,6 @@
* mvn install -Dit.test=DevMojoIT#methodName
*/
@DisabledIfSystemProperty(named = "quarkus.test.native", matches = "true")
@Disabled("Needs https://github.com/junit-team/junit5/pull/3820 and #40601")
public class TestParameterDevModeIT extends RunAndCheckMojoTestBase {

protected int getPort() {
Expand Down
6 changes: 2 additions & 4 deletions test-framework/junit5/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@
<artifactId>quarkus-core</artifactId>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<!-- Avoid adding this to the BOM -->
<version>1.4.20</version>
<groupId>org.jboss.marshalling</groupId>
<artifactId>jboss-marshalling</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.regex.Pattern;

import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
Expand All @@ -52,7 +51,6 @@
import org.jboss.jandex.Type;
import org.jboss.logging.Logger;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.AfterTestExecutionCallback;
Expand Down Expand Up @@ -106,7 +104,7 @@
import io.quarkus.test.junit.callback.QuarkusTestContext;
import io.quarkus.test.junit.callback.QuarkusTestMethodContext;
import io.quarkus.test.junit.internal.DeepClone;
import io.quarkus.test.junit.internal.SerializationWithXStreamFallbackDeepClone;
import io.quarkus.test.junit.internal.NewSerializingDeepClone;

public class QuarkusTestExtension extends AbstractJvmQuarkusTestExtension
implements BeforeEachCallback, BeforeTestExecutionCallback, AfterTestExecutionCallback, AfterEachCallback,
Expand Down Expand Up @@ -355,7 +353,7 @@ private void shutdownHangDetection() {
}

private void populateDeepCloneField(StartupAction startupAction) {
deepClone = new SerializationWithXStreamFallbackDeepClone(startupAction.getClassLoader());
deepClone = new NewSerializingDeepClone(originalCl, startupAction.getClassLoader());
}

private void populateTestMethodInvokers(ClassLoader quarkusClassLoader) {
Expand Down Expand Up @@ -962,49 +960,13 @@ private Object runExtensionMethod(ReflectiveInvocationContext<Method> invocation
Parameter[] parameters = invocationContext.getExecutable().getParameters();
for (int i = 0; i < originalArguments.size(); i++) {
Object arg = originalArguments.get(i);
boolean cloneRequired = false;
Object replacement = null;
Class<?> argClass = parameters[i].getType();
if (arg != null) {
Class<?> theclass = argClass;
while (theclass.isArray()) {
theclass = theclass.getComponentType();
}
if (theclass.isPrimitive()) {
cloneRequired = false;
} else if (TestInfo.class.isAssignableFrom(theclass)) {
TestInfo info = (TestInfo) arg;
Method newTestMethod = info.getTestMethod().isPresent()
? determineTCCLExtensionMethod(info.getTestMethod().get(), testClassFromTCCL)
: null;
replacement = new TestInfoImpl(info.getDisplayName(), info.getTags(),
Optional.of(testClassFromTCCL),
Optional.ofNullable(newTestMethod));
} else if (clonePattern.matcher(theclass.getName()).matches()) {
cloneRequired = true;
} else {
try {
cloneRequired = runningQuarkusApplication.getClassLoader()
.loadClass(theclass.getName()) != theclass;
} catch (ClassNotFoundException e) {
if (arg instanceof Supplier) {
cloneRequired = true;
} else {
throw e;
}
}
}
}

if (replacement != null) {
argumentsFromTccl.add(replacement);
} else if (cloneRequired) {
argumentsFromTccl.add(deepClone.clone(arg));
} else if (testMethodInvokerToUse != null) {
if (testMethodInvokerToUse != null) {
argumentsFromTccl.add(testMethodInvokerToUse.getClass().getMethod("methodParamInstance", String.class)
.invoke(testMethodInvokerToUse, argClass.getName()));
} else {
argumentsFromTccl.add(arg);
argumentsFromTccl.add(deepClone.clone(arg));
}
}

Expand All @@ -1014,7 +976,7 @@ private Object runExtensionMethod(ReflectiveInvocationContext<Method> invocation
.invoke(testMethodInvokerToUse, effectiveTestInstance, newMethod, argumentsFromTccl,
extensionContext.getRequiredTestClass().getName());
} else {
return newMethod.invoke(effectiveTestInstance, argumentsFromTccl.toArray(new Object[0]));
return newMethod.invoke(effectiveTestInstance, argumentsFromTccl.toArray(Object[]::new));
}

} catch (InvocationTargetException e) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit a712fe9

Please sign in to comment.