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

Change annotation name #43

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.jboss.arquillian.core.api.Instance;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.test.spi.TestEnricher;
import org.jboss.arquillian.testcontainers.api.DockerRequired;
import org.jboss.arquillian.testcontainers.api.ContainerRequired;
import org.jboss.arquillian.testcontainers.api.Testcontainer;
import org.testcontainers.containers.GenericContainer;

Expand All @@ -33,7 +33,7 @@ public class ContainerInjectionTestEnricher implements TestEnricher {

@Override
public void enrich(final Object testCase) {
if (!isAnnotatedWith(testCase.getClass(), DockerRequired.class)) {
if (!isAnnotatedWith(testCase.getClass(), ContainerRequired.class)) {
return;
}
for (Field field : getFieldsWithAnnotation(testCase.getClass())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.jboss.arquillian.test.spi.event.enrichment.AfterEnrichment;
import org.jboss.arquillian.test.spi.event.suite.AfterClass;
import org.jboss.arquillian.test.spi.event.suite.BeforeClass;
import org.jboss.arquillian.testcontainers.api.DockerRequired;
import org.jboss.arquillian.testcontainers.api.ContainerRequired;
import org.testcontainers.DockerClientFactory;

@SuppressWarnings("unused")
Expand All @@ -30,7 +30,7 @@ class TestContainersObserver {
private Instance<ContainerRegistry> registry;

/**
* This first checks if the {@link DockerRequired} annotation is present on the test class failing if necessary. It
* This first checks if the {@link ContainerRequired} annotation is present on the test class failing if necessary. It
* then creates the {@link TestcontainerRegistry} and stores it in a {@link ClassScoped} instance.
*
* @param beforeClass the before class event
Expand All @@ -39,7 +39,7 @@ class TestContainersObserver {
*/
public void createContainer(@Observes(precedence = 500) BeforeClass beforeClass) throws Throwable {
final TestClass javaClass = beforeClass.getTestClass();
final DockerRequired dockerRequired = javaClass.getAnnotation(DockerRequired.class);
final ContainerRequired dockerRequired = javaClass.getAnnotation(ContainerRequired.class);
if (dockerRequired != null) {
if (!isDockerAvailable()) {
throw createException(dockerRequired.value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import java.lang.annotation.Target;

/**
* An annotation which will check if docker is available and if not throw an exception. By default, this will throw an
* An annotation which will check if container engine is available and if not throw an exception. By default, this will throw an
* {@link AssertionError}. However, you can define the type of exception to throw. The exception <strong>must</strong>
* have a string or no-arg constructor.
*
Expand All @@ -24,7 +24,7 @@
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface DockerRequired {
public @interface ContainerRequired {

/**
* The type of the exception to throw. The exception must have a public string constructor.
Expand All @@ -33,7 +33,7 @@
* {@code TestAbortedException} to act as an Assumption error.
* </p>
*
* @return the exception type to throw if docker is not available
* @return the exception type to throw if container engine is not available
*/
Class<? extends Throwable> value() default AssertionError.class;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

/**
* Used to annotate a field which <strong>must</strong> be an instance of a {@link GenericContainer}. A
* {@link DockerRequired} annotation must be present on the type to use Testcontainer injection.
* {@link ContainerRequired} annotation must be present on the type to use Testcontainer injection.
*
* <pre>
* &#064;ExtendWith(ArquillianExtension.class)
* &#064;RunAsClient
* // By throwing the TestAbortedException, the test will be skipped if docker is not available
* // By throwing the TestAbortedException, the test will be skipped if a container engine is not available
* &#064;DockerRequired(TestAbortedException.class)
* public class ContainerTest {
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.arquillian.testcontainers.api.DockerRequired;
import org.jboss.arquillian.testcontainers.api.ContainerRequired;
import org.jboss.arquillian.testcontainers.api.Testcontainer;
import org.jboss.arquillian.testcontainers.test.common.SimpleTestContainer;
import org.jboss.shrinkwrap.api.ShrinkWrap;
Expand All @@ -27,7 +27,7 @@
* @author <a href="mailto:[email protected]">James R. Perkins</a>
*/
@ExtendWith(ArquillianExtension.class)
@DockerRequired(TestAbortedException.class)
@ContainerRequired(TestAbortedException.class)
@RunAsClient
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
public class ManualContainerTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.arquillian.testcontainers.api.DockerRequired;
import org.jboss.arquillian.testcontainers.api.ContainerRequired;
import org.jboss.arquillian.testcontainers.api.Testcontainer;
import org.jboss.arquillian.testcontainers.test.common.SimpleTestContainer;
import org.jboss.arquillian.testcontainers.test.common.WildFlyContainer;
Expand All @@ -24,7 +24,7 @@
* @author <a href="mailto:[email protected]">James R. Perkins</a>
*/
@ExtendWith(ArquillianExtension.class)
@DockerRequired(TestAbortedException.class)
@ContainerRequired(TestAbortedException.class)
@RunAsClient
public class MultipleContainerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.arquillian.testcontainers.api.DockerRequired;
import org.jboss.arquillian.testcontainers.api.ContainerRequired;
import org.jboss.arquillian.testcontainers.api.Testcontainer;
import org.jboss.arquillian.testcontainers.test.common.SimpleTestContainer;
import org.jboss.shrinkwrap.api.ShrinkWrap;
Expand All @@ -29,7 +29,7 @@
*/
@ExtendWith(ArquillianExtension.class)
@RunAsClient
@DockerRequired(TestAbortedException.class)
@ContainerRequired(TestAbortedException.class)
public class SameInstanceTest {

@Testcontainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.arquillian.testcontainers.api.DockerRequired;
import org.jboss.arquillian.testcontainers.api.ContainerRequired;
import org.jboss.arquillian.testcontainers.api.Testcontainer;
import org.jboss.arquillian.testcontainers.test.common.SimpleTestContainer;
import org.jboss.shrinkwrap.api.ShrinkWrap;
Expand All @@ -24,7 +24,7 @@
*/
@ExtendWith(ArquillianExtension.class)
@RunAsClient
@DockerRequired(TestAbortedException.class)
@ContainerRequired(TestAbortedException.class)
public class SanityTest {

@Testcontainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.RunAsClient;
import org.jboss.arquillian.junit5.ArquillianExtension;
import org.jboss.arquillian.testcontainers.api.DockerRequired;
import org.jboss.arquillian.testcontainers.api.ContainerRequired;
import org.jboss.arquillian.testcontainers.api.Testcontainer;
import org.jboss.arquillian.testcontainers.test.common.SimpleTestContainer;
import org.jboss.arquillian.testcontainers.test.common.WildFlyContainer;
Expand All @@ -26,7 +26,7 @@
*/
@ExtendWith(ArquillianExtension.class)
@RunAsClient
@DockerRequired(TestAbortedException.class)
@ContainerRequired(TestAbortedException.class)
public class TypeSpecifiedInjectionTest {

@Deployment
Expand Down