-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from gdgib/G2-1559-MavenModuleProfile
G2-1559 Add module & profile support for MavenPOM
- Loading branch information
Showing
7 changed files
with
124 additions
and
9 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
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
28 changes: 28 additions & 0 deletions
28
re-maven/src/main/java/com/g2forge/reassert/maven/model/MavenProfile.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,28 @@ | ||
package com.g2forge.reassert.maven.model; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.Singular; | ||
|
||
@Data | ||
@Builder(toBuilder = true) | ||
@RequiredArgsConstructor | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class MavenProfile { | ||
protected final String id; | ||
|
||
@Singular | ||
protected final List<MavenDependency> dependencies; | ||
|
||
@Singular | ||
protected final Map<String, String> properties; | ||
|
||
@Singular | ||
protected final List<String> modules; | ||
} |
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
27 changes: 27 additions & 0 deletions
27
re-maven/src/test/java/com/g2forge/reassert/maven/model/TestMavenPOM.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,27 @@ | ||
package com.g2forge.reassert.maven.model; | ||
|
||
import org.junit.Test; | ||
|
||
import com.g2forge.alexandria.java.core.helpers.HCollection; | ||
import com.g2forge.alexandria.java.core.resource.Resource; | ||
import com.g2forge.alexandria.java.io.dataaccess.ResourceDataSource; | ||
import com.g2forge.alexandria.test.HAssert; | ||
import com.g2forge.reassert.core.api.module.Context; | ||
import com.g2forge.reassert.maven.MavenCoordinates; | ||
import com.g2forge.reassert.maven.MavenSystem; | ||
|
||
public class TestMavenPOM { | ||
@Test | ||
public void test() { | ||
final MavenSystem mavenSystem = new MavenSystem(Context.getContext()); | ||
final MavenPOM actual = mavenSystem.parse(new ResourceDataSource(new Resource(getClass(), "test-pom.xml.txt"))); | ||
|
||
HAssert.assertEquals(new MavenCoordinates(mavenSystem, "Group", "Artifact", "Version", null), actual.getCoordinates()); | ||
HAssert.assertNull(actual.getParent()); | ||
HAssert.assertNull(actual.getLicenses()); | ||
HAssert.assertNull(actual.getProperties()); | ||
HAssert.assertEquals(HCollection.asList(new MavenDependency(new MavenCoordinates(mavenSystem, "Dependencies", "One", "1.0.0", null), null, false), new MavenDependency(new MavenCoordinates(mavenSystem, "Dependencies", "Two", "2.0.0", null), MavenScope.Test, false)), actual.getDependencies()); | ||
HAssert.assertEquals(HCollection.asList("ModuleA", "ModuleB"), actual.getModules()); | ||
HAssert.assertEquals(HCollection.asList(new MavenProfile("Profile1", null, null, HCollection.asList("ModuleC"))), actual.getProfiles()); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
re-maven/src/test/java/com/g2forge/reassert/maven/model/test-pom.xml.txt
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,38 @@ | ||
<?xml version='1.0' encoding='UTF-8'?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>Group</groupId> | ||
<artifactId>Artifact</artifactId> | ||
<version>Version</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>Dependencies</groupId> | ||
<artifactId>One</artifactId> | ||
<version>1.0.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>Dependencies</groupId> | ||
<artifactId>Two</artifactId> | ||
<version>2.0.0</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<modules> | ||
<module>ModuleA</module> | ||
<module>ModuleB</module> | ||
</modules> | ||
|
||
<profiles> | ||
<profile> | ||
<id>Profile1</id> | ||
<modules> | ||
<module>ModuleC</module> | ||
</modules> | ||
</profile> | ||
</profiles> | ||
</project> |