Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 3 additions & 18 deletions common/comparator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,20 @@
<dependencies>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<groupId>tools.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down Expand Up @@ -67,10 +57,5 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.knubisoft.comparator;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.json.JsonMapper;
import com.knubisoft.comparator.exception.MatchException;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
Expand All @@ -20,7 +19,7 @@

public class Comparator extends AbstractObjectComparator<String> {

private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
private static final JsonMapper OBJECT_MAPPER = new JsonMapper();
private static final DocumentBuilderFactory XML_FACTORY = createSecureDocumentBuilderFactory();

private final List<ComparatorHandler> handlers = List.of(
Expand Down Expand Up @@ -60,7 +59,7 @@ private ComparisonRequest.ComparisonValue getComparisonValue(final String value)
private JsonNode readJson(final String value) {
try {
return OBJECT_MAPPER.readTree(value);
} catch (JsonProcessingException e) {
} catch (Exception e) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.knubisoft.comparator;

import com.fasterxml.jackson.databind.JsonNode;
import tools.jackson.databind.JsonNode;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.w3c.dom.Node;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.knubisoft.comparator;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.node.JsonNodeType;
import com.knubisoft.comparator.exception.MatchException;

import java.math.BigDecimal;
Expand Down Expand Up @@ -32,7 +32,7 @@ private void compareByType(final JsonNode expected, final JsonNode actual,
if (expType == actType) {
compareSameType(expected, actual, expType);
} else if (isStringToComparableType(expType, actType)) {
stringComparator.compare(expected.asText(), actual.asText());
stringComparator.compare(expected.asString(), actual.asString());
} else {
raiseTypeMismatch(expType, actType);
}
Expand All @@ -44,7 +44,7 @@ private void compareSameType(final JsonNode expected, final JsonNode actual,
case NULL, MISSING -> { }
case BOOLEAN -> compareBoolean(expected, actual);
case NUMBER -> compareNumber(expected, actual);
case STRING -> stringComparator.compare(expected.asText(), actual.asText());
case STRING -> stringComparator.compare(expected.asString(), actual.asString());
case ARRAY -> compareArray(expected, actual);
case OBJECT -> compareObject(expected, actual);
default -> raiseTypeMismatch(type, type);
Expand All @@ -63,7 +63,7 @@ private boolean isStringToComparableType(final JsonNodeType expectedType, final
}

private void compareArray(final JsonNode expected, final JsonNode actual) throws MatchException {
compareElements(iteratorToList(expected.elements()), iteratorToList(actual.elements()));
compareElements(iteratorToList(expected.iterator()), iteratorToList(actual.iterator()));
}

private void compareObject(final JsonNode expected, final JsonNode actual) throws MatchException {
Expand All @@ -74,12 +74,12 @@ private void compareObject(final JsonNode expected, final JsonNode actual) throw

private void compareBoolean(final JsonNode expected, final JsonNode actual) {
ErrorHelper.raise(expected.asBoolean() != actual.asBoolean(),
String.format("Property [%s] is not equal to [%s]", expected.asText(), actual.asText()));
String.format("Property [%s] is not equal to [%s]", expected.asString(), actual.asString()));
}

private void compareNumber(final JsonNode expected, final JsonNode actual) {
ErrorHelper.raise(!new BigDecimal(expected.asText()).equals(new BigDecimal(actual.asText())),
String.format("Property [%s] is not equal to [%s]", expected.asText(), actual.asText()));
ErrorHelper.raise(!new BigDecimal(expected.asString()).equals(new BigDecimal(actual.asString())),
String.format("Property [%s] is not equal to [%s]", expected.asString(), actual.asString()));
}

private <T> List<T> iteratorToList(final Iterator<T> iterator) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.knubisoft.comparator;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.json.JsonMapper;
import org.junit.jupiter.api.Test;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
Expand All @@ -16,7 +16,7 @@ class ComparisonRequestTest {

@Test
void isJsonReturnsTrueWhenJsonNodePresent() throws Exception {
JsonNode json = new ObjectMapper().readTree("{\"a\":1}");
JsonNode json = new JsonMapper().readTree("{\"a\":1}");
ComparisonRequest.ComparisonValue value = new ComparisonRequest.ComparisonValue("{\"a\":1}", json, null);
assertTrue(value.isJson());
assertFalse(value.isXml());
Expand Down Expand Up @@ -47,7 +47,7 @@ void getValueReturnsRawString() {

@Test
void comparisonRequestHoldsAllFields() throws Exception {
JsonNode json = new ObjectMapper().readTree("{}");
JsonNode json = new JsonMapper().readTree("{}");
ComparisonRequest.ComparisonValue expected = new ComparisonRequest.ComparisonValue("{}", json, null);
ComparisonRequest.ComparisonValue actual = new ComparisonRequest.ComparisonValue("{}", json, null);
ComparisonRequest request = new ComparisonRequest(Mode.STRICT, expected, actual);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.knubisoft.comparator;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import tools.jackson.databind.JsonNode;
import tools.jackson.databind.json.JsonMapper;
import com.knubisoft.comparator.exception.MatchException;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand All @@ -12,7 +12,7 @@
/** Unit tests for {@link JsonComparator} verifying boolean, number, string, array, and object comparison. */
class JsonComparatorTest {

private static final ObjectMapper MAPPER = new ObjectMapper();
private static final JsonMapper MAPPER = new JsonMapper();

private final JsonComparator strict = new JsonComparator(Mode.STRICT);
private final JsonComparator lenient = new JsonComparator(Mode.LENIENT);
Expand Down
2 changes: 0 additions & 2 deletions common/condition/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,12 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.18.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.18.0</version>
<scope>test</scope>
</dependency>

Expand Down
22 changes: 3 additions & 19 deletions common/configuration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,30 +49,20 @@
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<groupId>tools.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>

<dependency>
<groupId>com.knubisoft</groupId>
<artifactId>exception</artifactId>
Expand Down Expand Up @@ -118,12 +108,6 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.18.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ public DataSource getHikariDataSource(final DatabaseConfig dataSource) {

private void setDefaultHikariSettings(final HikariDataSource hikariDataSourceOriginal,
final DatabaseConfig dataSource) {
hikariDataSourceOriginal.setDriverClassName(dataSource.getJdbcDriver());
if (StringUtils.isNotBlank(dataSource.getJdbcDriver())) {
hikariDataSourceOriginal.setDriverClassName(dataSource.getJdbcDriver());
}
hikariDataSourceOriginal.setJdbcUrl(dataSource.getConnectionUrl());
hikariDataSourceOriginal.setUsername(dataSource.getUsername());
hikariDataSourceOriginal.setPassword(dataSource.getPassword());
Expand Down
Loading
Loading