Skip to content

Commit

Permalink
Format the source and enable the check on CI.
Browse files Browse the repository at this point in the history
Signed-off-by: James R. Perkins <[email protected]>
  • Loading branch information
jamezp committed Jun 28, 2024
1 parent c4d1f64 commit 168bc94
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,23 @@ concurrency:
cancel-in-progress: true

jobs:
build-:
format-check:
runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
cache: 'maven'
- name: Validate Formatting
run: |
mvn -B validate -Pformat-check
build:
needs: format-check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@
@Inherited
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Target({ ElementType.TYPE })
public @interface TestContainer {
Class<? extends GenericContainer<?>> value();

boolean failIfNoDocker() default true;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

import java.lang.annotation.Annotation;

import org.jboss.arquillian.container.test.impl.enricher.resource.OperatesOnDeploymentAwareProvider;
import org.jboss.arquillian.core.api.Instance;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.test.api.ArquillianResource;
import org.jboss.arquillian.test.spi.annotation.ClassScoped;
import org.jboss.arquillian.container.test.impl.enricher.resource.OperatesOnDeploymentAwareProvider;
import org.testcontainers.containers.GenericContainer;

public class TestContainerProvider extends OperatesOnDeploymentAwareProvider {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.lang.reflect.Constructor;

import com.github.dockerjava.api.DockerClient;
import org.jboss.arquillian.core.api.InstanceProducer;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.core.api.annotation.Observes;
Expand All @@ -29,6 +28,8 @@
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.GenericContainer;

import com.github.dockerjava.api.DockerClient;

public class TestContainersObserver {
@Inject
@ClassScoped
Expand All @@ -45,7 +46,7 @@ public void createContainer(@Observes(precedence = 500) BeforeClass beforeClass)
final GenericContainer<?> container = clazz.getConstructor().newInstance();
container.start();
containerWrapper.set(container);
} catch (Exception e) { //Clean up
} catch (Exception e) { // Clean up
throw new RuntimeException(e);
}
}
Expand Down Expand Up @@ -74,7 +75,7 @@ private void checkForDocker(boolean failIfNoDocker) {
}

private boolean isDockerAvailable() {
try(DockerClient client = DockerClientFactory.instance().client()) {
try (DockerClient client = DockerClientFactory.instance().client()) {
return true;
} catch (Throwable ex) {
return false;
Expand Down

0 comments on commit 168bc94

Please sign in to comment.