-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert back the type requirement of GenericContainer instead of Start…
…able. Signed-off-by: James R. Perkins <[email protected]>
- Loading branch information
Showing
4 changed files
with
37 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
import org.jboss.arquillian.testcontainers.api.DockerRequired; | ||
import org.jboss.arquillian.testcontainers.api.Testcontainer; | ||
import org.testcontainers.DockerClientFactory; | ||
import org.testcontainers.lifecycle.Startable; | ||
import org.testcontainers.containers.GenericContainer; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
|
@@ -47,9 +47,9 @@ public void enrich(final Object testCase) { | |
.collect(Collectors.toList()); | ||
final Testcontainer testcontainer = field.getAnnotation(Testcontainer.class); | ||
|
||
// If the field is the default Startable, validate the field is a Startable | ||
if (testcontainer.type() == Startable.class) { | ||
if (!(Startable.class.isAssignableFrom(field.getType()))) { | ||
// If the field is the default GenericContainer, validate the field is a GenericContainer | ||
if (testcontainer.type() == GenericContainer.class) { | ||
if (!(GenericContainer.class.isAssignableFrom(field.getType()))) { | ||
throw new IllegalArgumentException( | ||
String.format("Field %s is not assignable to %s", field, testcontainer.type().getName())); | ||
} | ||
|
@@ -62,7 +62,8 @@ public void enrich(final Object testCase) { | |
} | ||
} | ||
|
||
value = instances.get().lookupOrCreate((Class<Startable>) field.getType(), field, testcontainer, qualifiers); | ||
value = instances.get().lookupOrCreate((Class<GenericContainer<?>>) field.getType(), field, testcontainer, | ||
qualifiers); | ||
} catch (Exception e) { | ||
throw new RuntimeException("Could not lookup value for field " + field, e); | ||
} | ||
|
@@ -95,9 +96,9 @@ public Object[] resolve(final Method method) { | |
.filter(a -> !(a instanceof Testcontainer)) | ||
.collect(Collectors.toList()); | ||
|
||
// If the field is the default Startable, validate the field is a Startable | ||
if (testcontainer.type() == Startable.class) { | ||
if (!(Startable.class.isAssignableFrom(parameter.getType()))) { | ||
// If the field is the default GenericContainer, validate the field is a GenericContainer | ||
if (testcontainer.type() == GenericContainer.class) { | ||
if (!(GenericContainer.class.isAssignableFrom(parameter.getType()))) { | ||
throw new IllegalArgumentException( | ||
String.format("Parameter %s is not assignable to %s", parameter, | ||
testcontainer.type().getName())); | ||
|
@@ -110,7 +111,8 @@ public Object[] resolve(final Method method) { | |
.getName())); | ||
} | ||
} | ||
values[i] = instances.get().lookupOrCreate((Class<Startable>) parameter.getType(), parameter, testcontainer, | ||
values[i] = instances.get().lookupOrCreate((Class<GenericContainer<?>>) parameter.getType(), parameter, | ||
testcontainer, | ||
qualifiers); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,18 +8,19 @@ | |
import java.lang.reflect.AnnotatedElement; | ||
|
||
import org.jboss.arquillian.testcontainers.api.Testcontainer; | ||
import org.testcontainers.lifecycle.Startable; | ||
import org.testcontainers.containers.GenericContainer; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
class TestcontainerDescription { | ||
|
||
final Testcontainer testcontainer; | ||
final Startable instance; | ||
final GenericContainer<?> instance; | ||
final AnnotatedElement element; | ||
|
||
TestcontainerDescription(final Testcontainer testcontainer, final AnnotatedElement element, final Startable instance) { | ||
TestcontainerDescription(final Testcontainer testcontainer, final AnnotatedElement element, | ||
final GenericContainer<?> instance) { | ||
this.testcontainer = testcontainer; | ||
this.element = element; | ||
this.instance = instance; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters