Skip to content

Commit

Permalink
chore: updated maven plugin dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
gclaussn committed Jan 15, 2022
1 parent 9c24829 commit 0867785
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 53 deletions.
10 changes: 5 additions & 5 deletions maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Add dependencies, which are required to execute the generated test code:
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.197</version>
<version>2.0.206</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -113,11 +113,11 @@ Recommended versions:

| Dependency | Version |
|:-------------------|:--------|
| Camunda BPM | 7.15.0+ |
| Camunda BPM Assert | 10.0.0 |
| Camunda BPM | 7.16.0 |
| Camunda BPM Assert | 13.0.0 |
| JUnit 4 | 4.13.2 |
| Assertj | 3.18.1 |
| Spring Framework | 5.2.8.RELEASE+ |
| Assertj | 3.22.0 |
| Spring Framework | 5.3.15 |

## Testing
:warning: This section is only important for plugin development!
Expand Down
22 changes: 13 additions & 9 deletions maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
<version.java>1.8</version.java>

<!-- Versions -->
<assertj.version>3.18.1</assertj.version>
<camunda.bpm.version>7.15.0</camunda.bpm.version>
<camunda.bpm.assert.version>10.0.0</camunda.bpm.assert.version>
<assertj.version>3.22.0</assertj.version>
<camunda.bpm.version>7.16.0</camunda.bpm.version>
<camunda.bpm.assert.version>13.0.0</camunda.bpm.assert.version>
<javapoet.version>1.13.0</javapoet.version>
<junit.version>4.13.2</junit.version>
<maven.version>3.0</maven.version>
<maven.plugin.version>3.5</maven.plugin.version>
<spring.version>5.3.3</spring.version>
<maven.version>3.8.4</maven.version>
<maven.plugin.version>3.6.2</maven.plugin.version>
<spring.version>5.3.15</spring.version>
</properties>

<repositories>
Expand Down Expand Up @@ -52,21 +52,25 @@
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${maven.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>${maven.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${maven.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
Expand Down Expand Up @@ -152,7 +156,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<version>1.7.32</version>
<scope>test</scope>
</dependency>

Expand All @@ -172,14 +176,14 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.7.7</version>
<version>4.2.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.robotframework</groupId>
<artifactId>robotframework</artifactId>
<version>3.0.4</version>
<version>4.1.2</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import java.util.List;
import java.util.Optional;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
Expand Down Expand Up @@ -69,15 +69,15 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
}

private boolean isH2Artifact(Artifact artifact) {
return H2_GROUP_ID.equals(artifact.getGroupId()) && H2_ARTIFACT_ID.equals(artifact.getArtifactId());
private boolean isH2(Dependency dependency) {
return H2_GROUP_ID.equals(dependency.getGroupId()) && H2_ARTIFACT_ID.equals(dependency.getArtifactId());
}

protected boolean isH2Version2() {
// finds the version of the H2 artifact within the project's direct dependencies
Optional<String> h2Version = project.getDependencyArtifacts().stream()
.filter(this::isH2Artifact)
.map(Artifact::getVersion)
// finds the version of the H2 artifact within the project's dependencies
Optional<String> h2Version = project.getDependencies().stream()
.filter(this::isH2)
.map(Dependency::getVersion)
.findFirst();

if (!h2Version.isPresent()) {
Expand Down
8 changes: 4 additions & 4 deletions maven-plugin/src/test/it/advanced-multi-instance/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Versions -->
<assertj.version>3.18.1</assertj.version>
<camunda.bpm.version>7.15.0</camunda.bpm.version>
<camunda.bpm.assert.version>10.0.0</camunda.bpm.assert.version>
<assertj.version>3.22.0</assertj.version>
<camunda.bpm.version>7.16.0</camunda.bpm.version>
<camunda.bpm.assert.version>13.0.0</camunda.bpm.assert.version>
<junit.version>4.13.2</junit.version>

<plugin.version>0.5.0-SNAPSHOT</plugin.version>
Expand Down Expand Up @@ -48,7 +48,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<version>1.7.32</version>
<scope>test</scope>
</dependency>

Expand Down
10 changes: 5 additions & 5 deletions maven-plugin/src/test/it/advanced-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Versions -->
<assertj.version>3.18.1</assertj.version>
<camunda.bpm.version>7.15.0</camunda.bpm.version>
<camunda.bpm.assert.version>10.0.0</camunda.bpm.assert.version>
<assertj.version>3.22.0</assertj.version>
<camunda.bpm.version>7.16.0</camunda.bpm.version>
<camunda.bpm.assert.version>13.0.0</camunda.bpm.assert.version>
<junit.version>4.13.2</junit.version>
<spring.version>5.3.3</spring.version>
<spring.version>5.3.15</spring.version>

<plugin.version>0.5.0-SNAPSHOT</plugin.version>
</properties>
Expand Down Expand Up @@ -73,7 +73,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<version>1.7.32</version>
<scope>test</scope>
</dependency>

Expand Down
8 changes: 4 additions & 4 deletions maven-plugin/src/test/it/advanced/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Versions -->
<assertj.version>3.18.1</assertj.version>
<camunda.bpm.version>7.15.0</camunda.bpm.version>
<camunda.bpm.assert.version>10.0.0</camunda.bpm.assert.version>
<assertj.version>3.22.0</assertj.version>
<camunda.bpm.version>7.16.0</camunda.bpm.version>
<camunda.bpm.assert.version>13.0.0</camunda.bpm.assert.version>
<junit.version>4.13.2</junit.version>

<plugin.version>0.5.0-SNAPSHOT</plugin.version>
Expand Down Expand Up @@ -48,7 +48,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<version>1.7.32</version>
<scope>test</scope>
</dependency>

Expand Down
8 changes: 4 additions & 4 deletions maven-plugin/src/test/it/simple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- Versions -->
<assertj.version>3.18.1</assertj.version>
<camunda.bpm.version>7.15.0</camunda.bpm.version>
<camunda.bpm.assert.version>10.0.0</camunda.bpm.assert.version>
<assertj.version>3.22.0</assertj.version>
<camunda.bpm.version>7.16.0</camunda.bpm.version>
<camunda.bpm.assert.version>13.0.0</camunda.bpm.assert.version>
<junit.version>4.13.2</junit.version>

<plugin.version>0.5.0-SNAPSHOT</plugin.version>
Expand Down Expand Up @@ -48,7 +48,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.25</version>
<version>1.7.32</version>
<scope>test</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import java.util.Collections;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Dependency;
import org.apache.maven.project.MavenProject;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -29,35 +29,35 @@ public void testIsH2Version2_NoDependencies() {

@Test
public void testIsH2Version2_NoH2Dependency() {
Artifact h2 = Mockito.mock(Artifact.class);
when(h2.getGroupId()).thenReturn(GeneratorMojo.H2_GROUP_ID);
when(h2.getArtifactId()).thenReturn("no-h2");
Dependency dependency = new Dependency();
dependency.setGroupId(GeneratorMojo.H2_GROUP_ID);
dependency.setArtifactId("no-h2");

when(mojo.project.getDependencyArtifacts()).thenReturn(Collections.singleton(h2));
when(mojo.project.getDependencies()).thenReturn(Collections.singletonList(dependency));

assertThat(mojo.isH2Version2(), is(false));
}

@Test
public void testIsH2Version2_V1() {
Artifact h2 = Mockito.mock(Artifact.class);
when(h2.getGroupId()).thenReturn(GeneratorMojo.H2_GROUP_ID);
when(h2.getArtifactId()).thenReturn(GeneratorMojo.H2_ARTIFACT_ID);
when(h2.getVersion()).thenReturn("1.4.197");
Dependency dependency = new Dependency();
dependency.setGroupId(GeneratorMojo.H2_GROUP_ID);
dependency.setArtifactId(GeneratorMojo.H2_ARTIFACT_ID);
dependency.setVersion("1.4.197");

when(mojo.project.getDependencyArtifacts()).thenReturn(Collections.singleton(h2));
when(mojo.project.getDependencies()).thenReturn(Collections.singletonList(dependency));

assertThat(mojo.isH2Version2(), is(false));
}

@Test
public void testIsH2Version2_V2() {
Artifact h2 = Mockito.mock(Artifact.class);
when(h2.getGroupId()).thenReturn(GeneratorMojo.H2_GROUP_ID);
when(h2.getArtifactId()).thenReturn(GeneratorMojo.H2_ARTIFACT_ID);
when(h2.getVersion()).thenReturn("2.0.206");
Dependency dependency = new Dependency();
dependency.setGroupId(GeneratorMojo.H2_GROUP_ID);
dependency.setArtifactId(GeneratorMojo.H2_ARTIFACT_ID);
dependency.setVersion("2.0.206");

when(mojo.project.getDependencyArtifacts()).thenReturn(Collections.singleton(h2));
when(mojo.project.getDependencies()).thenReturn(Collections.singletonList(dependency));

assertThat(mojo.isH2Version2(), is(true));
}
Expand Down

0 comments on commit 0867785

Please sign in to comment.