Compare commits
2 commits
6785ec64d3
...
8caafd6d01
Author | SHA1 | Date | |
---|---|---|---|
8caafd6d01 | |||
0252776195 |
2 changed files with 20 additions and 12 deletions
|
@ -177,14 +177,30 @@ public final class DependencyResolver {
|
||||||
for (char character : dependency.toCharArray()) {
|
for (char character : dependency.toCharArray()) {
|
||||||
switch (character) {
|
switch (character) {
|
||||||
case '=' -> {
|
case '=' -> {
|
||||||
|
// Check for duplicate
|
||||||
|
if (duplicateCheck[0])
|
||||||
|
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '=' characters");
|
||||||
|
|
||||||
|
// Update mode
|
||||||
mode = 1;
|
mode = 1;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case '<' -> {
|
case '<' -> {
|
||||||
|
// Check for duplicate
|
||||||
|
if (duplicateCheck[1])
|
||||||
|
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '<' characters");
|
||||||
|
|
||||||
|
// Update mode
|
||||||
mode = 2;
|
mode = 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
case '>' -> {
|
case '>' -> {
|
||||||
|
// Check for duplicate
|
||||||
|
if (duplicateCheck[2])
|
||||||
|
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '>' characters");
|
||||||
|
|
||||||
|
// Update mode
|
||||||
mode = 3;
|
mode = 3;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -195,9 +211,6 @@ public final class DependencyResolver {
|
||||||
case 0 -> identifier.append(character);
|
case 0 -> identifier.append(character);
|
||||||
// Version equal
|
// Version equal
|
||||||
case 1 -> {
|
case 1 -> {
|
||||||
// Check for duplicate
|
|
||||||
if (character == '=' && duplicateCheck[0])
|
|
||||||
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '=' characters");
|
|
||||||
duplicateCheck[0] = true;
|
duplicateCheck[0] = true;
|
||||||
|
|
||||||
// Check for smaller and bigger than
|
// Check for smaller and bigger than
|
||||||
|
@ -208,9 +221,6 @@ public final class DependencyResolver {
|
||||||
}
|
}
|
||||||
// Version smaller
|
// Version smaller
|
||||||
case 2 -> {
|
case 2 -> {
|
||||||
// Check for duplicate
|
|
||||||
if (character == '<' && duplicateCheck[1])
|
|
||||||
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '<' characters");
|
|
||||||
duplicateCheck[1] = true;
|
duplicateCheck[1] = true;
|
||||||
|
|
||||||
// Check for equal
|
// Check for equal
|
||||||
|
@ -221,9 +231,6 @@ public final class DependencyResolver {
|
||||||
}
|
}
|
||||||
// Version bigger
|
// Version bigger
|
||||||
case 3 -> {
|
case 3 -> {
|
||||||
// Check for duplicate
|
|
||||||
if (character == '>' && duplicateCheck[2])
|
|
||||||
throw new IllegalStateException("The dependency listing \"" + dependency + "\" cannot include multiple '>' characters");
|
|
||||||
duplicateCheck[2] = true;
|
duplicateCheck[2] = true;
|
||||||
|
|
||||||
// Check for equal
|
// Check for equal
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
package de.staropensource.sosengine.base.srctests.utility;
|
package de.staropensource.sosengine.base.srctests.utility;
|
||||||
|
|
||||||
import de.staropensource.sosengine.base.Engine;
|
|
||||||
import de.staropensource.sosengine.base.exception.dependency.UnmetDependenciesException;
|
import de.staropensource.sosengine.base.exception.dependency.UnmetDependenciesException;
|
||||||
import de.staropensource.sosengine.base.implementation.versioning.OneNumberVersioningSystem;
|
import de.staropensource.sosengine.base.implementation.versioning.OneNumberVersioningSystem;
|
||||||
import de.staropensource.sosengine.base.srctests.TestBase;
|
import de.staropensource.sosengine.base.srctests.TestBase;
|
||||||
|
@ -33,7 +32,7 @@ import org.junit.jupiter.params.provider.ValueSource;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the class {@link DependencyResolver}.
|
* Tests the class {@link DependencyResolver}.
|
||||||
|
@ -270,6 +269,8 @@ class DependencyResolverTest extends TestBase {
|
||||||
getLogger().error("Dependency resolution failed: Unmet dependencies found:");
|
getLogger().error("Dependency resolution failed: Unmet dependencies found:");
|
||||||
for (DependencyVector vector : exception.getUnmetDependencies().keySet())
|
for (DependencyVector vector : exception.getUnmetDependencies().keySet())
|
||||||
getLogger().error("-> " + vector.getIdentifier() + "=" + vector.getVersion() + ": " + exception.getUnmetDependencies().get(vector));
|
getLogger().error("-> " + vector.getIdentifier() + "=" + vector.getVersion() + ": " + exception.getUnmetDependencies().get(vector));
|
||||||
|
|
||||||
|
assertEquals("Please ignore this, this just exists to trigger an error", "", "Dependency resolution failed (layers=" + layers + "): See logs");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -489,6 +490,6 @@ class DependencyResolverTest extends TestBase {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
assertNotNull(Engine.getInstance(), "Dependency resolution succeeded (layers=" + layers + ")");
|
assertEquals("Please ignore this, this just exists to trigger an error", "", "Dependency resolution succeeded (layers=" + layers + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue