Skip to content

Commit

Permalink
Update dependencies and add modules
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalijr2 authored Jan 2, 2025
1 parent 999d850 commit 9606ad0
Show file tree
Hide file tree
Showing 29 changed files with 410 additions and 142 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 11
distribution: 'zulu'
java-version: '11'
- name: Build with Maven
env:
SIGN_KEY: ${{ secrets.SIGN_KEY }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codacy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 11
distribution: 'zulu'
java-version: '11'
- name: Build with Maven
run: ./mvnw --batch-mode
- name: Temporarily save target and test requests
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v4
with:
name: targets
path: |
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Retrieve saved test requests and target
uses: actions/download-artifact@master
uses: actions/download-artifact@v4
with:
name: targets
path: .
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 11
distribution: 'zulu'
java-version: '11'
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sonatype.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
- name: Setup Java JDK
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: 11
distribution: 'zulu'
java-version: '11'
- name: Build and publish with Maven
env:
SIGN_KEY: ${{ secrets.SIGN_KEY }}
Expand Down
11 changes: 11 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"line-length": {
"headings": false,
"line_length": 80,
"code_blocks": false,
"tables": false
},
"no-duplicate-heading": {
"siblings_only": true
}
}
10 changes: 5 additions & 5 deletions THIRD-PARTY.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

Lists of 13 third-party dependencies.
(Apache License version 2.0) Apache Commons Logging (commons-logging:commons-logging:1.3.4 - https://commons.apache.org/proper/commons-logging/)
(Apache License version 2.0) Byte Buddy (without dependencies) (net.bytebuddy:byte-buddy:1.15.4 - https://bytebuddy.net/byte-buddy)
(Apache License version 2.0) Byte Buddy agent (net.bytebuddy:byte-buddy-agent:1.15.4 - https://bytebuddy.net/byte-buddy-agent)
(Apache License version 2.0) Byte Buddy (without dependencies) (net.bytebuddy:byte-buddy:1.15.11 - https://bytebuddy.net/byte-buddy)
(Apache License version 2.0) Byte Buddy agent (net.bytebuddy:byte-buddy-agent:1.15.11 - https://bytebuddy.net/byte-buddy-agent)
(Apache License version 2.0) org.apiguardian:apiguardian-api (org.apiguardian:apiguardian-api:1.1.2 - https://github.com/apiguardian-team/apiguardian)
(Apache License version 2.0) JetBrains Java Annotations (org.jetbrains:annotations:26.0.1 - https://github.com/JetBrains/java-annotations)
(Eclipse Public License - v 2.0) JUnit Jupiter API (org.junit.jupiter:junit-jupiter-api:5.11.3 - https://junit.org/junit5/)
(Eclipse Public License - v 2.0) JUnit Platform Commons (org.junit.platform:junit-platform-commons:1.11.3 - https://junit.org/junit5/)
(MIT License) mockito-core (org.mockito:mockito-core:5.14.2 - https://github.com/mockito/mockito)
(Eclipse Public License - v 2.0) JUnit Jupiter API (org.junit.jupiter:junit-jupiter-api:5.11.4 - https://junit.org/junit5/)
(Eclipse Public License - v 2.0) JUnit Platform Commons (org.junit.platform:junit-platform-commons:1.11.4 - https://junit.org/junit5/)
(MIT License) mockito-core (org.mockito:mockito-core:5.15.2 - https://github.com/mockito/mockito)
(Apache License version 2.0) Objenesis (org.objenesis:objenesis:3.3 - http://objenesis.org/objenesis)
(Apache License version 2.0) org.opentest4j:opentest4j (org.opentest4j:opentest4j:1.3.0 - https://github.com/ota4j-team/opentest4j)
(MIT License) SLF4J API Module (org.slf4j:slf4j-api:2.0.16 - http://www.slf4j.org)
Expand Down
40 changes: 36 additions & 4 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,77 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## 1.1.1 - 2025-01-02 - Modules

### Added

- Added modules

### Changed

- Update Mockito to 5.15.2
- Update Javadoc
- Update jUnit to 5.11.4

## 1.1.0 - 2024-11-28

### Added

- Add tinylog modules: provider and writer

### Changed

- Fix dependencies' scopes

## 1.0.0 - 2024-11-13 - Mock Loggers

- Rename to **Mock Loggers**
### Added

- Add SLF4J and Apache Commons Logging modules

### Changed

- Rename to **Mock Loggers**

## 1.1.3 - 2024-11-09

### Added

- Improved Javadoc
- Use BOM for jUnit and Mockito
- Add activity badges, update other
- Update Maven plugins: invoker, javadoc, surefire and failsafe
- Custom annotation @MockLoggers

### Changed

- Update Maven plugins: invoker, javadoc, surefire and failsafe

## 1.1.2 - 2024-10-21

### Changed

- Update jUnit Jupiter and Platform
- Update Mockito to 5.14
- Update a bunch of Maven plugins: javadoc, surefire, failsafe, invoker, central-publishing, jetbrains annotations
- Update a bunch of Maven plugins: javadoc, surefire, failsafe, invoker,
central-publishing, jetbrains annotations

## 1.1.1 - 2024-08-20

### Changed

- Update jUnit to 5.11
- Improve extension's logging
- Clean the Maven publishing plugin's configuration.

## 1.1.0 - 2024-07-19

### Added

- Implement jUnit extension.

## 1.0.0 - 2024-07-15 - Mock of JDK Platform Logging

### Added

- Implement a logger finder.
- Add Javadocs.
29 changes: 27 additions & 2 deletions commons-logging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
<artifactId>maven-failsafe-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>mock.loggers.commons</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
</plugin>
<plugin>
<artifactId>jacoco-maven-plugin</artifactId>
<groupId>org.jacoco</groupId>
Expand Down Expand Up @@ -44,7 +55,7 @@
<dependency>
<artifactId>mock-loggers-core</artifactId>
<groupId>io.github.vitalijr2.logging</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.1</version>
</dependency>
<dependency>
<artifactId>mockito-core</artifactId>
Expand All @@ -62,9 +73,23 @@
<parent>
<artifactId>mock-loggers</artifactId>
<groupId>io.github.vitalijr2.logging</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.1</version>
</parent>
<profiles>
<profile>
<build>
<plugins>
<plugin>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<skipCheckLicense>false</skipCheckLicense>
</configuration>
<groupId>org.codehaus.mojo</groupId>
</plugin>
</plugins>
</build>
<id>prepare-and-check</id>
</profile>
<profile>
<build>
<plugins>
Expand Down
22 changes: 17 additions & 5 deletions commons-logging/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Mock loggers for Apache Commons Logging

[Apache Commons Logging][commons-logging] factory with mock loggers backed by [Mockito][].
[Apache Commons Logging][commons-logging] factory with mock loggers
backed by [Mockito][].

> [!WARNING]
> This library does not support _parallel test execution_.
Expand All @@ -15,16 +16,18 @@
## How to use

Just put a test dependency to your POM:

```xml
<dependency>
<artifactId>mock-loggers-commons-logging</artifactId>
<groupId>io.github.vitalijr2.logging</groupId>
<scope>test</scope>
<version>1.1.0</version>
<version>1.1.1</version>
</dependency>
```

The simplest usage example looks like this:

```java
@Test
void helloWorld() {
Expand All @@ -35,12 +38,15 @@ void helloWorld() {
verify(LogFactory.getLog(helloService.getClass())).info("Hello World!");
}
```

See more details at [HelloServiceBasicTest.java](src/it/hello-commons-logging-world/src/test/java/example/hello/HelloServiceBasicTest.java)

> [!IMPORTANT]
> Keep in mind that all loggers are initialized only once during the test run.
Therefore, a more complex example cleans the loggers after (or before) each test:
Therefore, a more complex example cleans the loggers after (or before)
each test:

```java
// the static logger instance
private static Log log;
Expand Down Expand Up @@ -72,9 +78,12 @@ void names(String name) {
verifyNoMoreInteractions(actualLog);
}
```

See more details at [HelloServiceFullTest.java](src/it/hello-commons-logging-world/src/test/java/example/hello/HelloServiceFullTest.java)

To avoid manual cleaning of mock loggers you can use the [jUnit extension][junit-extension] for automation:
To avoid manual cleaning of mock loggers you can use
the [jUnit extension][junit-extension] for automation:

```java
@ExtendWith(MockLoggerExtension.class)
class HelloServiceExtensionTest {
Expand Down Expand Up @@ -102,9 +111,11 @@ class HelloServiceExtensionTest {

}
```

See more details at [HelloServiceExtensionTest.java](src/it/hello-commons-logging-world/src/test/java/example/hello/HelloServiceExtensionTest.java)

Also you can use the annotation for automation:

```java
@MockLoggers
class HelloServiceAnnotationTest {
Expand Down Expand Up @@ -132,6 +143,7 @@ class HelloServiceAnnotationTest {

}
```

See more details at [HelloServiceAnnotationTest.java](src/it/hello-commons-logging-world/src/test/java/example/hello/HelloServiceAnnotationTest.java)

[commons-logging]: https://commons.apache.org/proper/commons-logging/
Expand All @@ -144,7 +156,7 @@ See more details at [HelloServiceAnnotationTest.java](src/it/hello-commons-loggi

[commons-logging-version]: https://img.shields.io/static/v1?label=commons-logging&message=1.3.4&color=blue&logoColor=E23D28

[mockito-version]: https://img.shields.io/static/v1?label=Mockito&message=5.14.2&color=blue&logoColor=E23D28
[mockito-version]: https://img.shields.io/static/v1?label=Mockito&message=5.15.2&color=blue&logoColor=E23D28

[maven-central-last-update]: https://img.shields.io/maven-central/last-update/io.github.vitalijr2.logging/mock-loggers-commons-logging

Expand Down
2 changes: 1 addition & 1 deletion commons-logging/src/it/hello-commons-logging-world/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<properties>
<java.version>11</java.version>
<junit-jupiter.version>5.11.3</junit-jupiter.version>
<mockito.version>5.14.2</mockito.version>
<mockito.version>5.15.2</mockito.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<version>1.0.0</version>
Expand Down
34 changes: 28 additions & 6 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@
<artifactId>maven-failsafe-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>mock.loggers.core</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
<groupId>org.apache.maven.plugins</groupId>
</plugin>
<plugin>
<artifactId>jacoco-maven-plugin</artifactId>
<groupId>org.jacoco</groupId>
Expand All @@ -37,11 +48,6 @@
<artifactId>junit-jupiter-engine</artifactId>
<groupId>org.junit.jupiter</groupId>
</dependency>
<dependency>
<artifactId>junit-platform-commons</artifactId>
<groupId>org.junit.platform</groupId>
<scope>provided</scope>
</dependency>
<dependency>
<artifactId>mockito-core</artifactId>
<groupId>org.mockito</groupId>
Expand All @@ -60,6 +66,22 @@
<parent>
<artifactId>mock-loggers</artifactId>
<groupId>io.github.vitalijr2.logging</groupId>
<version>1.1.1-SNAPSHOT</version>
<version>1.1.1</version>
</parent>
<profiles>
<profile>
<build>
<plugins>
<plugin>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<skipCheckLicense>false</skipCheckLicense>
</configuration>
<groupId>org.codehaus.mojo</groupId>
</plugin>
</plugins>
</build>
<id>prepare-and-check</id>
</profile>
</profiles>
</project>
8 changes: 5 additions & 3 deletions core/readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Logger Keeper and jUnit Extension

The observer pattern is implemented here: cleaners subscribe to notifications from a keeper, who sends
alerts when mock loggers need to be cleaned and reset. Logger factories should implement the cleaner interface and
register themselves with the keeper. The jUnit extension manages the keeper and sends alerts before and after tests.
The observer pattern is implemented here: cleaners subscribe to notifications
from a keeper, who sends alerts when mock loggers need to be cleaned and reset.
Logger factories should implement the cleaner interface and register
themselves with the keeper. The jUnit extension manages the keeper
and sends alerts before and after tests.

[![Java Version][java-version]][jdk-download]
![jUnit Version][junit-version]
Expand Down
Loading

0 comments on commit 9606ad0

Please sign in to comment.