-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Add functionality marge for build extensions section (#36)
* Add functionality marge for build extensions section * Add functionality marge for build extensions section
- Loading branch information
Showing
6 changed files
with
108 additions
and
6 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
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
75 changes: 75 additions & 0 deletions
75
...maven-plugin/src/test/java/com/playtika/maven/plugins/MixinModelMergeBuildExtensions.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,75 @@ | ||
package com.playtika.maven.plugins; | ||
|
||
import java.util.List; | ||
|
||
import org.apache.maven.model.Build; | ||
import org.apache.maven.model.Extension; | ||
import org.apache.maven.model.Model; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
||
|
||
public class MixinModelMergeBuildExtensions { | ||
|
||
private MixinModelMerger merger; | ||
private Model buildExtensions, emptyBuildExtensions; | ||
|
||
@BeforeEach | ||
public void setup() { | ||
merger = new MixinModelMerger(); | ||
buildExtensions = new Model(); | ||
buildExtensions.setBuild(new Build()); | ||
Extension extension = new Extension(); | ||
extension.setGroupId("com.test"); | ||
extension.setArtifactId("test-magre-extension"); | ||
extension.setVersion("1.0.0"); | ||
buildExtensions.getBuild().getExtensions().add(extension); | ||
|
||
emptyBuildExtensions = new Model(); | ||
emptyBuildExtensions.setBuild(new Build()); | ||
} | ||
|
||
@Test | ||
public void testEmptyTarget() { | ||
List<Extension> origExtensions = buildExtensions.getBuild().getExtensions(); | ||
assertNotNull(origExtensions); | ||
assertEquals(origExtensions.size(), 1); | ||
merger.mergeBuildExtensions(emptyBuildExtensions, buildExtensions); | ||
assertEquals(origExtensions, buildExtensions.getBuild().getExtensions()); | ||
} | ||
|
||
@Test | ||
public void testEmptySrc() { | ||
merger.mergeScm(buildExtensions, emptyBuildExtensions); | ||
assertNotNull(emptyBuildExtensions.getBuild().getExtensions()); | ||
assertEquals(emptyBuildExtensions.getBuild().getExtensions().size(), 0); | ||
|
||
assertNotNull(buildExtensions.getBuild().getExtensions()); | ||
assertEquals(buildExtensions.getBuild().getExtensions().size(), 1); | ||
} | ||
|
||
@Test | ||
public void testMageFromSrc() { | ||
emptyBuildExtensions = new Model(); | ||
emptyBuildExtensions.setBuild(new Build()); | ||
Extension extension = new Extension(); | ||
extension.setGroupId("com.test2"); | ||
extension.setArtifactId("test-magre-extension-v2"); | ||
extension.setVersion("2.0.0"); | ||
emptyBuildExtensions.getBuild().getExtensions().add(extension); | ||
|
||
assertNotNull(buildExtensions.getBuild().getExtensions()); | ||
assertEquals(1, buildExtensions.getBuild().getExtensions().size()); | ||
|
||
assertNotNull(emptyBuildExtensions.getBuild().getExtensions()); | ||
assertEquals(1, emptyBuildExtensions.getBuild().getExtensions().size()); | ||
|
||
merger.mergeBuildExtensions(buildExtensions, emptyBuildExtensions); | ||
|
||
assertNotNull(buildExtensions.getBuild().getExtensions()); | ||
assertEquals(2, buildExtensions.getBuild().getExtensions().size()); | ||
} | ||
} |