diff --git a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/AbstractArquillianResourceTest.java b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/AbstractArquillianResourceTest.java
index 6162f2ede..a02cbfd5f 100644
--- a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/AbstractArquillianResourceTest.java
+++ b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/AbstractArquillianResourceTest.java
@@ -31,7 +31,6 @@
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -65,7 +64,6 @@ public void checkUrl() {
}
@Test
- @Disabled("https://github.com/arquillian/arquillian-core/issues/312")
public void checkParameterUrl(@ArquillianResource final URL url) {
Assertions.assertNotNull(url, "The URL should have been injected");
Assertions.assertEquals(TestEnvironment.protocol(), url.getProtocol());
@@ -83,7 +81,6 @@ public void checkUri() {
}
@Test
- @Disabled("https://github.com/arquillian/arquillian-core/issues/312")
public void checkParameterUri(@ArquillianResource final URI uri) {
Assertions.assertNotNull(uri, "The URI should have been injected");
checkHost(uri.getHost());
diff --git a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/ClientArquillianResourceTest.java b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/ClientArquillianResourceTest.java
index 90a75fa22..bd2120118 100644
--- a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/ClientArquillianResourceTest.java
+++ b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/ClientArquillianResourceTest.java
@@ -19,11 +19,29 @@
package org.jboss.arquillian.integration.test.resource.injection;
+import java.net.URL;
+import java.nio.file.Path;
+
import org.jboss.arquillian.container.test.api.RunAsClient;
+import org.jboss.arquillian.integration.test.common.TestEnvironment;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
/**
* @author James R. Perkins
*/
@RunAsClient
public class ClientArquillianResourceTest extends AbstractArquillianResourceTest {
+
+ @Test
+ public void checkMultipleParameters(@ArquillianResource final URL url, @TempDir final Path tempDir) {
+ Assertions.assertNotNull(url, "The URL should have been injected");
+ Assertions.assertEquals(TestEnvironment.protocol(), url.getProtocol());
+ checkHost(url.getHost());
+ Assertions.assertEquals(TestEnvironment.port(), url.getPort());
+ Assertions.assertEquals("/" + DEPLOYMENT_NAME + "/", url.getPath());
+ Assertions.assertNotNull(tempDir, "The temp dir should have been injected");
+ }
}
diff --git a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/InContainerArquillianResourceTest.java b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/InContainerArquillianResourceTest.java
index bab8ae897..4fe9b8ac8 100644
--- a/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/InContainerArquillianResourceTest.java
+++ b/integration-tests/junit5-tests/src/test/java/org/jboss/arquillian/integration/test/resource/injection/InContainerArquillianResourceTest.java
@@ -19,13 +19,17 @@
package org.jboss.arquillian.integration.test.resource.injection;
+import java.net.URL;
+import java.nio.file.Path;
import javax.naming.Context;
import javax.naming.InitialContext;
+import org.jboss.arquillian.integration.test.common.TestEnvironment;
import org.jboss.arquillian.test.api.ArquillianResource;
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;
+import org.junit.jupiter.api.io.TempDir;
/**
* @author James R. Perkins
@@ -46,7 +50,7 @@ public void checkContext() throws Exception {
}
@Test
- @Disabled("https://github.com/arquillian/arquillian-core/issues/312")
+ @DisabledIfSystemProperty(named = "javax.naming.Context.parameter", matches = "skip")
public void checkContextParameter(@ArquillianResource final Context context) throws Exception {
Assertions.assertNotNull(context, "The Context should have been injected");
final Object bm = context.lookup("java:comp/BeanManager");
@@ -61,10 +65,20 @@ public void checkInitialContext() throws Exception {
}
@Test
- @Disabled("https://github.com/arquillian/arquillian-core/issues/312")
+ @DisabledIfSystemProperty(named = "javax.naming.Context.parameter", matches = "skip")
public void checkInitialContextParameter(@ArquillianResource final InitialContext initialContext) throws Exception {
Assertions.assertNotNull(initialContext, "The InitialContext should have been injected");
final Object bm = initialContext.lookup("java:comp/BeanManager");
Assertions.assertNotNull(bm);
}
+
+ @Test
+ public void checkMultipleParameters(@ArquillianResource final URL url, @TempDir final Path tempDir) {
+ Assertions.assertNotNull(url, "The URL should have been injected");
+ Assertions.assertEquals(TestEnvironment.protocol(), url.getProtocol());
+ checkHost(url.getHost());
+ Assertions.assertEquals(TestEnvironment.port(), url.getPort());
+ Assertions.assertEquals("/" + DEPLOYMENT_NAME + "/", url.getPath());
+ Assertions.assertNotNull(tempDir, "The temp dir should have been injected");
+ }
}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 1366e1281..68780e2ec 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -257,6 +257,7 @@
fish.payara.arquillian
arquillian-payara-server-managed
${version.fish.payara.arquillian}
+ test
@@ -292,6 +293,7 @@
${payara.home}
localhost
+ skip
diff --git a/junit5/container/src/main/java/org/jboss/arquillian/junit5/container/JUnitJupiterDeploymentAppender.java b/junit5/container/src/main/java/org/jboss/arquillian/junit5/container/JUnitJupiterDeploymentAppender.java
index 820cb1f36..9554d6fa9 100644
--- a/junit5/container/src/main/java/org/jboss/arquillian/junit5/container/JUnitJupiterDeploymentAppender.java
+++ b/junit5/container/src/main/java/org/jboss/arquillian/junit5/container/JUnitJupiterDeploymentAppender.java
@@ -1,6 +1,7 @@
package org.jboss.arquillian.junit5.container;
+import org.jboss.arquillian.container.test.spi.RemoteLoadableExtension;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.arquillian.container.test.spi.TestRunner;
import org.jboss.arquillian.container.test.spi.client.deployment.CachedAuxilliaryArchiveAppender;
@@ -22,6 +23,8 @@ protected Archive> buildArchive() {
.addAsServiceProvider(
TestRunner.class,
JUnitJupiterTestRunner.class)
- .addAsServiceProvider(TestEngine.class, JupiterTestEngine.class);
+ .addAsServiceProvider(TestEngine.class, JupiterTestEngine.class)
+ // The remote extension for in-container tests
+ .addAsServiceProvider(RemoteLoadableExtension.class, JUnitJupiterRemoteExtension.class);
}
}
diff --git a/junit5/container/src/main/java/org/jboss/arquillian/junit5/container/JUnitJupiterRemoteExtension.java b/junit5/container/src/main/java/org/jboss/arquillian/junit5/container/JUnitJupiterRemoteExtension.java
new file mode 100644
index 000000000..c3b6bd175
--- /dev/null
+++ b/junit5/container/src/main/java/org/jboss/arquillian/junit5/container/JUnitJupiterRemoteExtension.java
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ *
+ * Copyright 2024 Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.arquillian.junit5.container;
+
+import org.jboss.arquillian.container.test.spi.RemoteLoadableExtension;
+import org.jboss.arquillian.core.spi.LoadableExtension;
+import org.jboss.arquillian.junit5.MethodParameterObserver;
+
+/**
+ * The remote extension for JUnit 5 in-container tests.
+ *
+ * @author James R. Perkins
+ */
+public class JUnitJupiterRemoteExtension implements RemoteLoadableExtension {
+
+ @Override
+ public void register(LoadableExtension.ExtensionBuilder builder) {
+ builder.observer(MethodParameterObserver.class);
+ }
+}
diff --git a/junit5/core/src/main/java/org/jboss/arquillian/junit5/ArquillianExtension.java b/junit5/core/src/main/java/org/jboss/arquillian/junit5/ArquillianExtension.java
index 6165e4e09..9da2c3828 100644
--- a/junit5/core/src/main/java/org/jboss/arquillian/junit5/ArquillianExtension.java
+++ b/junit5/core/src/main/java/org/jboss/arquillian/junit5/ArquillianExtension.java
@@ -9,12 +9,16 @@
import org.jboss.arquillian.test.spi.LifecycleMethodExecutor;
import org.jboss.arquillian.test.spi.TestMethodExecutor;
import org.jboss.arquillian.test.spi.TestResult;
+import org.jboss.arquillian.test.spi.TestRunnerAdaptor;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.InvocationInterceptor;
+import org.junit.jupiter.api.extension.ParameterContext;
+import org.junit.jupiter.api.extension.ParameterResolutionException;
+import org.junit.jupiter.api.extension.ParameterResolver;
import org.junit.jupiter.api.extension.ReflectiveInvocationContext;
import org.junit.jupiter.api.extension.TestExecutionExceptionHandler;
import org.junit.platform.commons.JUnitException;
@@ -23,12 +27,13 @@
import static org.jboss.arquillian.junit5.ContextStore.getContextStore;
import static org.jboss.arquillian.junit5.JUnitJupiterTestClassLifecycleManager.getManager;
-public class ArquillianExtension implements BeforeAllCallback, AfterAllCallback, BeforeEachCallback, AfterEachCallback, InvocationInterceptor, TestExecutionExceptionHandler {
+public class ArquillianExtension implements BeforeAllCallback, AfterAllCallback, BeforeEachCallback, AfterEachCallback, InvocationInterceptor, TestExecutionExceptionHandler, ParameterResolver {
public static final String RUNNING_INSIDE_ARQUILLIAN = "insideArquillian";
private static final String CHAIN_EXCEPTION_MESSAGE_PREFIX = "Chain of InvocationInterceptors never called invocation";
- private static final Predicate IS_INSIDE_ARQUILLIAN = (context -> Boolean.parseBoolean(context.getConfigurationParameter(RUNNING_INSIDE_ARQUILLIAN).orElse("false")));
+ private static final Predicate IS_INSIDE_ARQUILLIAN = (context -> Boolean.parseBoolean(context.getConfigurationParameter(RUNNING_INSIDE_ARQUILLIAN)
+ .orElse("false")));
@Override
public void beforeAll(ExtensionContext context) throws Exception {
@@ -46,18 +51,31 @@ public void afterAll(ExtensionContext context) throws Exception {
@Override
public void beforeEach(ExtensionContext context) throws Exception {
- getManager(context).getAdaptor().before(
- context.getRequiredTestInstance(),
- context.getRequiredTestMethod(),
- LifecycleMethodExecutor.NO_OP);
+ // Get the adapter, test instance and method
+ final TestRunnerAdaptor adapter = getManager(context)
+ .getAdaptor();
+ final Object instance = context.getRequiredTestInstance();
+ final Method method = context.getRequiredTestMethod();
+ // Create a new parameter holder
+ final MethodParameters methodParameters = ContextStore.getContextStore(context).createMethodParameters();
+ // Fired to set the MethodParameters on the producer
+ adapter.fireCustomLifecycle(new MethodParameterProducerEvent(instance, method, methodParameters));
+ adapter.before(
+ instance,
+ method,
+ LifecycleMethodExecutor.NO_OP);
}
@Override
public void afterEach(ExtensionContext context) throws Exception {
- getManager(context).getAdaptor().after(
+ try {
+ getManager(context).getAdaptor().after(
context.getRequiredTestInstance(),
context.getRequiredTestMethod(),
LifecycleMethodExecutor.NO_OP);
+ } finally {
+ ContextStore.getContextStore(context).removeMethodParameters();
+ }
}
@Override
@@ -190,4 +208,40 @@ private boolean isRunAsClient(ExtensionContext extensionContext) throws Exceptio
manager.getAdaptor().fireCustomLifecycle(runModeEvent);
return runModeEvent.isRunAsClient();
}
+
+ @Override
+ public boolean supportsParameter(final ParameterContext parameterContext, final ExtensionContext extensionContext) throws ParameterResolutionException {
+ try {
+ // Get the parameter holder
+ final MethodParameters holder = ContextStore.getContextStore(extensionContext).getMethodParameters();
+ if (holder == null) {
+ throw createParameterResolutionException(parameterContext, null);
+ }
+ return holder.get(parameterContext.getIndex()) != null;
+ } catch (Exception e) {
+ throw createParameterResolutionException(parameterContext, e);
+ }
+ }
+
+ @Override
+ public Object resolveParameter(final ParameterContext parameterContext, final ExtensionContext extensionContext) throws ParameterResolutionException {
+ try {
+ // Get the parameter holder
+ final MethodParameters holder = ContextStore.getContextStore(extensionContext).getMethodParameters();
+ if (holder == null) {
+ throw createParameterResolutionException(parameterContext, null);
+ }
+ return holder.get(parameterContext.getIndex());
+ } catch (Exception e) {
+ throw createParameterResolutionException(parameterContext, e);
+ }
+ }
+
+ private static ParameterResolutionException createParameterResolutionException(final ParameterContext parameterContext, final Throwable cause) {
+ final String msg = String.format("Failed to resolve parameter %s", parameterContext.getParameter().getName());
+ if (cause == null) {
+ return new ParameterResolutionException(msg);
+ }
+ return new ParameterResolutionException(msg, cause);
+ }
}
diff --git a/junit5/core/src/main/java/org/jboss/arquillian/junit5/ContextStore.java b/junit5/core/src/main/java/org/jboss/arquillian/junit5/ContextStore.java
index deedc407b..3e0ca8b7f 100644
--- a/junit5/core/src/main/java/org/jboss/arquillian/junit5/ContextStore.java
+++ b/junit5/core/src/main/java/org/jboss/arquillian/junit5/ContextStore.java
@@ -1,11 +1,11 @@
package org.jboss.arquillian.junit5;
-import org.junit.jupiter.api.extension.ExtensionContext;
-
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Optional;
+import org.junit.jupiter.api.extension.ExtensionContext;
+
class ContextStore {
private static final String NAMESPACE_KEY = "arquillianNamespace";
@@ -13,6 +13,8 @@ class ContextStore {
private static final String RESULT_NAMESPACE_KEY = "results";
+ private static final String PARAMETER_NAMESPACE_KEY = "methodParameters";
+
private final ExtensionContext context;
private ContextStore(ExtensionContext context) {
@@ -60,4 +62,34 @@ Optional getResult(String uniqueId) {
final ExtensionContext.Store resultStore = getResultStore();
return Optional.ofNullable(resultStore.getOrDefault(uniqueId, Throwable.class, null));
}
+
+ /**
+ * Creates a new method parameter holder and stores it in the current context.
+ *
+ * @return the method parameters holder
+ */
+ MethodParameters createMethodParameters() {
+ final MethodParameters methodParameters = new MethodParameters();
+ context.getStore(ExtensionContext.Namespace.create(NAMESPACE_KEY, PARAMETER_NAMESPACE_KEY))
+ .put(PARAMETER_NAMESPACE_KEY, methodParameters);
+ return methodParameters;
+ }
+
+ /**
+ * Gets the method parameters holder.
+ *
+ * @return the method parameters holder or {@code null} if one was not created
+ */
+ MethodParameters getMethodParameters() {
+ return context.getStore(ExtensionContext.Namespace.create(NAMESPACE_KEY, PARAMETER_NAMESPACE_KEY))
+ .get(PARAMETER_NAMESPACE_KEY, MethodParameters.class);
+ }
+
+ /**
+ * Removes the method parameters holder.
+ */
+ void removeMethodParameters() {
+ context.getStore(ExtensionContext.Namespace.create(NAMESPACE_KEY, PARAMETER_NAMESPACE_KEY))
+ .remove(PARAMETER_NAMESPACE_KEY);
+ }
}
diff --git a/junit5/core/src/main/java/org/jboss/arquillian/junit5/MethodParameterObserver.java b/junit5/core/src/main/java/org/jboss/arquillian/junit5/MethodParameterObserver.java
new file mode 100644
index 000000000..e9d015921
--- /dev/null
+++ b/junit5/core/src/main/java/org/jboss/arquillian/junit5/MethodParameterObserver.java
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ *
+ * Copyright 2024 Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.arquillian.junit5;
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+import org.jboss.arquillian.core.api.Event;
+import org.jboss.arquillian.core.api.Instance;
+import org.jboss.arquillian.core.api.InstanceProducer;
+import org.jboss.arquillian.core.api.annotation.Inject;
+import org.jboss.arquillian.core.api.annotation.Observes;
+import org.jboss.arquillian.core.spi.ServiceLoader;
+import org.jboss.arquillian.test.spi.TestEnricher;
+import org.jboss.arquillian.test.spi.annotation.TestScoped;
+import org.jboss.arquillian.test.spi.event.enrichment.AfterEnrichment;
+import org.jboss.arquillian.test.spi.event.enrichment.BeforeEnrichment;
+import org.jboss.arquillian.test.spi.event.enrichment.EnrichmentEvent;
+import org.jboss.arquillian.test.spi.event.suite.Before;
+
+/**
+ * The observer used to process method parameters provided by Arquillian.
+ *
+ * @author James R. Perkins
+ */
+public class MethodParameterObserver {
+
+ @Inject
+ private Instance serviceLoader;
+
+ @Inject
+ private Event enrichmentEvent;
+
+ @Inject
+ @TestScoped
+ private InstanceProducer methodParametersProducer;
+
+ /**
+ * Updates the stored {@link MethodParameters} for method parameters which can be provided by Arquillian.
+ *
+ * @param event the fired event
+ */
+ public void injectParameters(@Observes final Before event) {
+ final Object testInstance = event.getTestInstance();
+ final Method testMethod = event.getTestMethod();
+ enrichmentEvent.fire(new BeforeEnrichment(testInstance, testMethod));
+ final MethodParameters methodParameters = methodParametersProducer.get();
+ final Collection testEnrichers = serviceLoader.get().all(TestEnricher.class);
+ for (TestEnricher enricher : testEnrichers) {
+ final Object[] values = enricher.resolve(testMethod);
+ for (int i = 0; i < values.length; i++) {
+ if (values[i] != null) {
+ methodParameters.add(i, values[i]);
+ }
+ }
+ }
+ enrichmentEvent.fire(new AfterEnrichment(testEnrichers, testMethod));
+ }
+
+ /**
+ * Sets the {@link MethodParameters} instance.
+ *
+ * @param event the fired event
+ */
+ public void injectParameters(@Observes MethodParameterProducerEvent event) {
+ methodParametersProducer.set(event.getTestParameterHolder());
+ }
+}
diff --git a/junit5/core/src/main/java/org/jboss/arquillian/junit5/MethodParameterProducerEvent.java b/junit5/core/src/main/java/org/jboss/arquillian/junit5/MethodParameterProducerEvent.java
new file mode 100644
index 000000000..2c5a2e358
--- /dev/null
+++ b/junit5/core/src/main/java/org/jboss/arquillian/junit5/MethodParameterProducerEvent.java
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ *
+ * Copyright 2024 Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.arquillian.junit5;
+
+import java.lang.reflect.Method;
+
+import org.jboss.arquillian.test.spi.LifecycleMethodExecutor;
+import org.jboss.arquillian.test.spi.event.suite.TestLifecycleEvent;
+
+/**
+ * An event which is fired and allows an observer to set the {@link MethodParameters} on a producer for later usage
+ * in {@link org.jboss.arquillian.test.spi.event.suite.Before} events.
+ *
+ * @author James R. Perkins
+ */
+public class MethodParameterProducerEvent extends TestLifecycleEvent {
+
+ private final MethodParameters testParameterHolder;
+
+ MethodParameterProducerEvent(final Object testInstance, final Method testMethod, final MethodParameters testParameterHolder) {
+ super(testInstance, testMethod, LifecycleMethodExecutor.NO_OP);
+ this.testParameterHolder = testParameterHolder;
+ }
+
+ MethodParameters getTestParameterHolder() {
+ return testParameterHolder;
+ }
+}
diff --git a/junit5/core/src/main/java/org/jboss/arquillian/junit5/MethodParameters.java b/junit5/core/src/main/java/org/jboss/arquillian/junit5/MethodParameters.java
new file mode 100644
index 000000000..e8b7e29f4
--- /dev/null
+++ b/junit5/core/src/main/java/org/jboss/arquillian/junit5/MethodParameters.java
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ *
+ * Copyright 2024 Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jboss.arquillian.junit5;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.junit.jupiter.api.extension.ExtensionContext;
+
+/**
+ * A simple holder for method parameters resolved by a {@link org.jboss.arquillian.test.spi.TestEnricher} and their
+ * index.
+ *
+ * @author James R. Perkins
+ */
+class MethodParameters implements ExtensionContext.Store.CloseableResource {
+ private final Map parameters;
+
+ MethodParameters() {
+ this.parameters = new ConcurrentHashMap<>();
+ }
+
+ /**
+ * Adds a parameter value with the given index.
+ *
+ * @param index the index of the parameter
+ * @param value the value for the parameter
+ */
+ void add(final int index, final Object value) {
+ parameters.put(index, value);
+ }
+
+ /**
+ * Gets the parameter value based on the index.
+ *
+ * @param index the index of the parameter to get the value for
+ *
+ * @return the value for the parameter or {@code null} if one was not registered at the provided index
+ */
+ Object get(final int index) {
+ return parameters.get(index);
+ }
+
+ @Override
+ public void close() {
+ parameters.clear();
+ }
+}
diff --git a/junit5/core/src/main/java/org/jboss/arquillian/junit5/extension/JUnitJupiterCoreExtension.java b/junit5/core/src/main/java/org/jboss/arquillian/junit5/extension/JUnitJupiterCoreExtension.java
index 8af82b362..cf899d5fa 100644
--- a/junit5/core/src/main/java/org/jboss/arquillian/junit5/extension/JUnitJupiterCoreExtension.java
+++ b/junit5/core/src/main/java/org/jboss/arquillian/junit5/extension/JUnitJupiterCoreExtension.java
@@ -1,10 +1,12 @@
package org.jboss.arquillian.junit5.extension;
import org.jboss.arquillian.core.spi.LoadableExtension;
+import org.jboss.arquillian.junit5.MethodParameterObserver;
public class JUnitJupiterCoreExtension implements LoadableExtension {
@Override
public void register(ExtensionBuilder builder) {
+ builder.observer(MethodParameterObserver.class);
}
}