-
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.
Add a simple sanity and some simple test framework.
Signed-off-by: James R. Perkins <[email protected]>
- Loading branch information
Showing
7 changed files
with
191 additions
and
15 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
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
42 changes: 42 additions & 0 deletions
42
src/test/java/org/jboss/arquillian/testcontainers/SanityTest.java
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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright The Arquillian Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.jboss.arquillian.testcontainers; | ||
|
||
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.test.api.ArquillianResource; | ||
import org.jboss.arquillian.testcontainers.test.common.SimpleTestContainer; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
@ExtendWith(ArquillianExtension.class) | ||
@TestContainer(value = SimpleTestContainer.class, failIfNoDocker = false) | ||
@RunAsClient | ||
public class SanityTest { | ||
|
||
@ArquillianResource | ||
private SimpleTestContainer container; | ||
|
||
@Deployment | ||
public static JavaArchive createDeployment() { | ||
return ShrinkWrap.create(JavaArchive.class) | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"); | ||
} | ||
|
||
@Test | ||
public void testContainerInjected() { | ||
Assertions.assertNotNull(container, "Expected the container to be injected."); | ||
Assertions.assertTrue(container.isRunning(), "Expected the container to be running"); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/test/java/org/jboss/arquillian/testcontainers/test/common/SimpleTestContainer.java
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright The Arquillian Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.jboss.arquillian.testcontainers.test.common; | ||
|
||
import org.testcontainers.containers.MockServerContainer; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
public class SimpleTestContainer extends MockServerContainer { | ||
|
||
public SimpleTestContainer() { | ||
super(DockerImageName | ||
.parse("mockserver/mockserver") | ||
.withTag("latest")); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/test/java/org/jboss/arquillian/testcontainers/test/common/TestDeployableContainer.java
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright The Arquillian Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.jboss.arquillian.testcontainers.test.common; | ||
|
||
import org.jboss.arquillian.container.spi.ConfigurationException; | ||
import org.jboss.arquillian.container.spi.client.container.ContainerConfiguration; | ||
import org.jboss.arquillian.container.spi.client.container.DeployableContainer; | ||
import org.jboss.arquillian.container.spi.client.protocol.ProtocolDescription; | ||
import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; | ||
import org.jboss.shrinkwrap.api.Archive; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
public class TestDeployableContainer implements DeployableContainer<TestDeployableContainer.EmptyContainerConfiguration> { | ||
@Override | ||
public Class<EmptyContainerConfiguration> getConfigurationClass() { | ||
return EmptyContainerConfiguration.class; | ||
} | ||
|
||
@Override | ||
public ProtocolDescription getDefaultProtocol() { | ||
return new ProtocolDescription("TestDeployableContainer"); | ||
} | ||
|
||
@Override | ||
public ProtocolMetaData deploy(final Archive<?> archive) { | ||
return new ProtocolMetaData(); | ||
} | ||
|
||
@Override | ||
public void undeploy(final Archive<?> archive) { | ||
} | ||
|
||
public static class EmptyContainerConfiguration implements ContainerConfiguration { | ||
|
||
@Override | ||
public void validate() throws ConfigurationException { | ||
|
||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/test/java/org/jboss/arquillian/testcontainers/test/common/TestLoadableExtension.java
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright The Arquillian Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.jboss.arquillian.testcontainers.test.common; | ||
|
||
import org.jboss.arquillian.container.spi.client.container.DeployableContainer; | ||
import org.jboss.arquillian.core.spi.LoadableExtension; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
public class TestLoadableExtension implements LoadableExtension { | ||
@Override | ||
public void register(final ExtensionBuilder builder) { | ||
builder.service(DeployableContainer.class, TestDeployableContainer.class); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/test/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
org.jboss.arquillian.testcontainers.test.common.TestLoadableExtension |