Skip to content

Commit

Permalink
Merge pull request #1 from xdev-software/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
AB-xdev committed Apr 22, 2024
2 parents 5384af2 + 2d6208b commit 5cacd62
Show file tree
Hide file tree
Showing 15 changed files with 346 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .run/Run Demo.run.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run Demo" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="software.xdev.Application" />
<module name="standard-maven-template-demo" />
<module name="testcontainers-java-junit4-mock-demo" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<extension name="coverage">
<pattern>
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 1.0.0
_Initial release_
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ You should have the following things installed:
* Ensure that the JDK/Java-Version is correct


## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/standard-maven-template/release.yml?branch=master)](https://github.com/xdev-software/standard-maven-template/actions/workflows/release.yml)
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/testcontainers-java-junit4-mock/release.yml?branch=master)](https://github.com/xdev-software/testcontainers-java-junit4-mock/actions/workflows/release.yml)

Before releasing:
* Consider doing a [test-deployment](https://github.com/xdev-software/standard-maven-template/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
* Consider doing a [test-deployment](https://github.com/xdev-software/testcontainers-java-junit4-mock/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
* Check the [changelog](CHANGELOG.md)

If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes
Expand Down
37 changes: 30 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/standard-maven-template?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/standard-maven-template)
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/standard-maven-template/checkBuild.yml?branch=develop)](https://github.com/xdev-software/standard-maven-template/actions/workflows/checkBuild.yml?query=branch%3Adevelop)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_standard-maven-template&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_standard-maven-template)
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/testcontainers-java-junit4-mock?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/testcontainers-java-junit4-mock)
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/testcontainers-java-junit4-mock/checkBuild.yml?branch=develop)](https://github.com/xdev-software/testcontainers-java-junit4-mock/actions/workflows/checkBuild.yml?query=branch%3Adevelop)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_testcontainers-java-junit4-mock&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_testcontainers-java-junit4-mock)

# standard-maven-template
# testcontainers-java-junit4-mock

Mocks the few [JUnit 4](https://github.com/junit-team/junit4) classes that [testcontainers](https://github.com/testcontainers/testcontainers-java) needs so that JUnit 4 can be excluded.

## Installation
[Installation guide for the latest release](https://github.com/xdev-software/standard-maven-template/releases/latest#Installation)
Fixes/Works around [testcontainers-java#970](https://github.com/testcontainers/testcontainers-java/issues/970)

## Usage
```xml
<dependency>
<groupId>software.xdev</groupId>
<artifactId>testcontainers-java-junit4-mock</artifactId>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<exclusions>
<!-- No JUnit 4 -->
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
```
_Please note that you may need to insert the corresponding versions_

## Installation
[Installation guide for the latest release](https://github.com/xdev-software/testcontainers-java-junit4-mock/releases/latest#Installation)

## Support
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
Expand All @@ -16,4 +39,4 @@ If you need support as soon as possible and you can't wait for any pull request,
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.

## Dependencies and Licenses
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/standard-maven-template/dependencies)
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/testcontainers-java-junit4-mock/dependencies)
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## Reporting a Vulnerability

Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/standard-maven-template/security/advisories/new).
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/testcontainers-java-junit4-mock/security/advisories/new).
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>software.xdev</groupId>
<artifactId>standard-maven-template-root</artifactId>
<artifactId>testcontainers-java-junit4-mock-root</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

Expand All @@ -15,8 +15,8 @@
</organization>

<modules>
<module>standard-maven-template</module>
<module>standard-maven-template-demo</module>
<module>testcontainers-java-junit4-mock</module>
<module>testcontainers-java-junit4-mock-demo</module>
</modules>

<licenses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>

<groupId>software.xdev</groupId>
<artifactId>standard-maven-template-demo</artifactId>
<artifactId>testcontainers-java-junit4-mock-demo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

Expand All @@ -27,9 +27,32 @@
<dependencies>
<dependency>
<groupId>software.xdev</groupId>
<artifactId>standard-maven-template</artifactId>
<artifactId>testcontainers-java-junit4-mock</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.19.7</version>
<exclusions>
<!-- No JUnit 4 -->
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.13</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.13</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package software.xdev;

import org.slf4j.LoggerFactory;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.Slf4jLogConsumer;


public final class Application
{
@SuppressWarnings({"rawtypes", "resouce"})
public static void main(final String[] args)
{
try(final GenericContainer container = new GenericContainer("alpine:3")
.withCommand("/bin/sh", "-c", "echo \"I don't need JUnit 4 to run\"")
.withLogConsumer(new Slf4jLogConsumer(LoggerFactory.getLogger("container.demo"))))
{
container.start();
}
}

private Application()
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
<modelVersion>4.0.0</modelVersion>

<groupId>software.xdev</groupId>
<artifactId>standard-maven-template</artifactId>
<artifactId>testcontainers-java-junit4-mock</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>

<name>standard-maven-template</name>
<description>standard-maven-template</description>
<url>https://github.com/xdev-software/standard-maven-template</url>
<name>testcontainers-java-junit4-mock</name>
<description>testcontainers-java-junit4-mock</description>
<url>https://github.com/xdev-software/testcontainers-java-junit4-mock</url>

<scm>
<url>https://github.com/xdev-software/standard-maven-template</url>
<connection>scm:git:https://github.com/xdev-software/standard-maven-template.git</connection>
<url>https://github.com/xdev-software/testcontainers-java-junit4-mock</url>
<connection>scm:git:https://github.com/xdev-software/testcontainers-java-junit4-mock.git</connection>
</scm>

<inceptionYear>2023</inceptionYear>
<inceptionYear>2024</inceptionYear>

<organization>
<name>XDEV Software</name>
Expand Down Expand Up @@ -84,6 +84,40 @@
</repository>
</distributionManagement>

<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.19.7</version>
<scope>test</scope>
<exclusions>
<!-- No JUnit 4 -->
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<pluginManagement>
<plugins>
Expand Down Expand Up @@ -172,6 +206,12 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright © 2024 XDEV Software (https://xdev.software)
*
* 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.
*/
/**
* This package mocks the few classes that Testcontainers needs from junit 4, so that the lib can be excluded.
* <p>
* <a href="https://github.com/testcontainers/testcontainers-java/issues/970">testcontainers-java#970</a>
* </p>
*/
package org.junit;
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright © 2024 XDEV Software (https://xdev.software)
*
* 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.junit.rules;

import java.util.ArrayList;
import java.util.List;

import org.junit.runner.Description;
import org.junit.runners.model.Statement;


@Deprecated
@SuppressWarnings("all")
public abstract class ExternalResource implements TestRule
{
@Override
public Statement apply(final Statement base, final Description description)
{
return this.statement(base);
}

private Statement statement(final Statement base)
{
return new Statement()
{
@Override
public void evaluate() throws Throwable
{
ExternalResource.this.before();

final List<Throwable> errors = new ArrayList<>();
try
{
base.evaluate();
}
catch(final Throwable t)
{
errors.add(t);
}
finally
{
try
{
ExternalResource.this.after();
}
catch(final Throwable t)
{
errors.add(t);
}
}
}
};
}

protected void before() throws Throwable
{
// do nothing
}

protected void after()
{
// do nothing
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright © 2024 XDEV Software (https://xdev.software)
*
* 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.junit.rules;

import org.junit.runner.Description;
import org.junit.runners.model.Statement;


@Deprecated
@SuppressWarnings("all")
public interface TestRule
{
Statement apply(Statement base, Description description);
}
Loading

0 comments on commit 5cacd62

Please sign in to comment.