-
Notifications
You must be signed in to change notification settings - Fork 3
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 #24 from spyrkob/SET-813_add_latest_existing_merge…
…_strategy Add LATEST_EXISTING manifest merge strategy
- Loading branch information
Showing
4 changed files
with
93 additions
and
7 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
48 changes: 48 additions & 0 deletions
48
src/test/java/org/wildfly/prospero/extras/manifest/merge/ManifestMergeCommandTest.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,48 @@ | ||
package org.wildfly.prospero.extras.manifest.merge; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.wildfly.channel.ChannelManifest; | ||
import org.wildfly.channel.Stream; | ||
|
||
class ManifestMergeCommandTest { | ||
|
||
protected static final ChannelManifest MANIFEST_ONE = new ChannelManifest(null, null, null, List.of(new Stream("org.test", "test-one", "1.0.0"))); | ||
protected static final ChannelManifest MANIFEST_TWO = new ChannelManifest(null, null, null, List.of(new Stream("org.test", "test-one", "1.1.0"))); | ||
|
||
@Test | ||
public void pickFirstVersion() throws Exception { | ||
|
||
|
||
final VersionMergeStrategy strategy = (v1, v2) -> v1; | ||
final ChannelManifest merged = ManifestMergeCommand.merge(MANIFEST_ONE, MANIFEST_TWO, strategy, null, null); | ||
|
||
assertThat(merged.getStreams()) | ||
.containsOnly(new Stream("org.test", "test-one", "1.0.0")); | ||
|
||
} | ||
|
||
@Test | ||
public void pickSecondVersion() throws Exception { | ||
final VersionMergeStrategy strategy = (v1, v2) -> v2; | ||
final ChannelManifest merged = ManifestMergeCommand.merge(MANIFEST_ONE, MANIFEST_TWO, strategy, null, null); | ||
|
||
assertThat(merged.getStreams()) | ||
.containsOnly(new Stream("org.test", "test-one", "1.1.0")); | ||
|
||
} | ||
|
||
@Test | ||
public void rejectStream() throws Exception { | ||
// if the strategy returns null, the stream should be removed | ||
final VersionMergeStrategy strategy = (v1, v2) -> null; | ||
final ChannelManifest merged = ManifestMergeCommand.merge(MANIFEST_ONE, MANIFEST_TWO, strategy, null, null); | ||
|
||
assertThat(merged.getStreams()) | ||
.isEmpty(); | ||
|
||
} | ||
} |
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