forked from apache/incubator-kie-kogito-runtimes
-
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.
[incubator-kie-issues#847] Include generated-resources to quarkus art…
…ifact (apache#3427) * [incubator-kie-issues#847] WIP * [incubator-kie-issues#847] Fix for execution during test * [incubator-kie-issues#847] Fix for execution during test * [incubator-kie-issues#847] Small refactoring for test. Add KogitoAssetsProcessorTest --------- Co-authored-by: Gabriele-Cardosi <[email protected]>
- Loading branch information
1 parent
11f0e5e
commit dfd83f3
Showing
3 changed files
with
81 additions
and
3 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
46 changes: 46 additions & 0 deletions
46
...ent/src/test/java/org/kie/kogito/quarkus/common/deployment/KogitoAssetsProcessorTest.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,46 @@ | ||
package org.kie.kogito.quarkus.common.deployment; | ||
|
||
import java.io.File; | ||
import java.nio.file.Path; | ||
import java.util.Arrays; | ||
|
||
import io.quarkus.bootstrap.model.PathsCollection; | ||
import io.quarkus.paths.PathCollection; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
class KogitoAssetsProcessorTest { | ||
|
||
@Test | ||
void getRootPathsWithoutClasses() { | ||
String projectDirPath = "projectDir"; | ||
String outputTargetPath = "outputTarget"; | ||
Path projectDir = Path.of(projectDirPath); | ||
Path outputTarget = Path.of(outputTargetPath); | ||
Iterable<Path> paths = Arrays.asList(projectDir, outputTarget); | ||
|
||
PathCollection resolvedPaths = PathsCollection.from(paths); | ||
PathCollection retrieved = KogitoAssetsProcessor.getRootPaths(resolvedPaths); | ||
assertEquals(resolvedPaths.size(), retrieved.size()); | ||
paths.forEach(expected -> assertTrue(retrieved.contains(expected))); | ||
} | ||
|
||
@Test | ||
void getRootPathsWithClasses() { | ||
String projectDirPath = "projectDir"; | ||
String outputTargetPath = "outputTarget"; | ||
String outputTargetPathClasses = String.format("%s/%s/classes", projectDirPath, outputTargetPath).replace("/", File.separator); | ||
Path projectDir = Path.of(projectDirPath); | ||
Path outputTarget = Path.of(outputTargetPathClasses); | ||
Iterable<Path> paths = Arrays.asList(projectDir, outputTarget); | ||
|
||
PathCollection resolvedPaths = PathsCollection.from(paths); | ||
PathCollection retrieved = KogitoAssetsProcessor.getRootPaths(resolvedPaths); | ||
assertEquals(resolvedPaths.size() + 1, retrieved.size()); | ||
paths.forEach(expected -> assertTrue(retrieved.contains(expected))); | ||
String expectedPath = String.format("%s/%s/generated-resources", projectDirPath, outputTargetPath).replace("/", File.separator); | ||
assertTrue(retrieved.contains(Path.of(expectedPath))); | ||
} | ||
} |