From e3e85679bf9712c381d06af9d650c0dbee787311 Mon Sep 17 00:00:00 2001 From: Christoph Deppisch Date: Tue, 5 May 2020 20:46:03 +0200 Subject: [PATCH] chore: Reduce 3rd party dependencies Only depend on those Citrus modules that we really need at runtime. Other dependencies will be added to the individual test configurations. This makes the YAKS image smaller and avoids that unused modules are loaded at startup. --- java/pom.xml | 113 +++++++++++++++++- java/runtime/yaks-runtime-maven/pom.xml | 23 +++- java/steps/yaks-camel-k/pom.xml | 8 +- java/steps/yaks-camel/pom.xml | 21 ++-- java/steps/yaks-http/pom.xml | 16 +-- .../resources/citrus-application.properties | 1 + java/steps/yaks-jdbc/pom.xml | 27 ++--- .../citrusframework/yaks/jdbc/JdbcSteps.java | 5 +- .../yaks/jdbc/JdbcStepsTest.java | 8 +- java/steps/yaks-jms/pom.xml | 23 ++-- java/steps/yaks-kafka/pom.xml | 22 ++-- java/steps/yaks-openapi/pom.xml | 20 ++-- .../yaks/openapi/OpenApiSteps.java | 5 +- .../resources/citrus-application.properties | 1 + java/steps/yaks-standard/pom.xml | 16 +-- java/tools/maven/yaks-maven-extension/pom.xml | 13 -- 16 files changed, 202 insertions(+), 120 deletions(-) diff --git a/java/pom.xml b/java/pom.xml index 374527e4..15efb4e8 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -35,6 +35,7 @@ UTF-8 1.8 1.8 + 1.7.30 2.13.1 3.0.0-M1 5.2.4.RELEASE @@ -81,7 +82,32 @@ com.consol.citrus - citrus-core + citrus-base + ${citrus.version} + + + com.consol.citrus + citrus-core-spring + ${citrus.version} + + + com.consol.citrus + citrus-validation-json + ${citrus.version} + + + com.consol.citrus + citrus-validation-text + ${citrus.version} + + + com.consol.citrus + citrus-validation-groovy + ${citrus.version} + + + com.consol.citrus + citrus-validation-hamcrest ${citrus.version} @@ -122,11 +148,40 @@ ${cucumber.version} + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-aop + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + + + + + org.apache.camel + camel-core + ${camel.version} + + + org.apache.camel + camel-spring + ${camel.version} + + - org.apache.logging.log4j - log4j-slf4j-impl - ${log4j2.version} + org.slf4j + slf4j-api + ${slf4j.version} @@ -140,7 +195,19 @@ ${jackson.version} + + org.yaml + snakeyaml + 1.25 + + + + org.apache.logging.log4j + log4j-slf4j-impl + ${log4j2.version} + test + junit junit @@ -151,15 +218,53 @@ org.assertj assertj-core ${assertj-core.version} + test org.mockito mockito-core ${mockito.version} + test + + + org.postgresql + postgresql + ${postgresql.version} + test + + + + org.slf4j + slf4j-api + + + + + junit + junit + test + + + org.assertj + assertj-core + test + + + org.apache.logging.log4j + log4j-slf4j-impl + test + + + org.mockito + mockito-core + test + + + diff --git a/java/runtime/yaks-runtime-maven/pom.xml b/java/runtime/yaks-runtime-maven/pom.xml index 9f90eee3..83ff3320 100644 --- a/java/runtime/yaks-runtime-maven/pom.xml +++ b/java/runtime/yaks-runtime-maven/pom.xml @@ -90,6 +90,21 @@ ${project.version} + + + + + + + + com.consol.citrus + citrus-validation-json + + + com.consol.citrus + citrus-validation-text + + @@ -99,13 +114,13 @@ io.cucumber cucumber-junit + test - - org.apache.logging.log4j - log4j-slf4j-impl + com.consol.citrus + citrus-core-spring + test - diff --git a/java/steps/yaks-camel-k/pom.xml b/java/steps/yaks-camel-k/pom.xml index 26c10499..b2ddfb0b 100644 --- a/java/steps/yaks-camel-k/pom.xml +++ b/java/steps/yaks-camel-k/pom.xml @@ -36,7 +36,7 @@ com.consol.citrus - citrus-core + citrus-base com.consol.citrus @@ -52,12 +52,6 @@ com.fasterxml.jackson.core jackson-databind - - - junit - junit - - diff --git a/java/steps/yaks-camel/pom.xml b/java/steps/yaks-camel/pom.xml index 1005d979..f2efc021 100644 --- a/java/steps/yaks-camel/pom.xml +++ b/java/steps/yaks-camel/pom.xml @@ -36,7 +36,7 @@ com.consol.citrus - citrus-core + citrus-base com.consol.citrus @@ -46,36 +46,26 @@ org.springframework spring-beans - ${spring.version} org.springframework spring-aop - ${spring.version} org.springframework spring-tx - ${spring.version} org.apache.camel camel-core - ${camel.version} org.apache.camel camel-spring - ${camel.version} - - junit - junit - test - io.cucumber cucumber-junit @@ -87,8 +77,13 @@ test - org.apache.logging.log4j - log4j-slf4j-impl + com.consol.citrus + citrus-core-spring + test + + + com.consol.citrus + citrus-validation-text test diff --git a/java/steps/yaks-http/pom.xml b/java/steps/yaks-http/pom.xml index a2415cbc..5655d726 100644 --- a/java/steps/yaks-http/pom.xml +++ b/java/steps/yaks-http/pom.xml @@ -36,7 +36,7 @@ com.consol.citrus - citrus-core + citrus-base com.consol.citrus @@ -44,11 +44,6 @@ - - junit - junit - test - io.cucumber cucumber-junit @@ -60,8 +55,13 @@ test - org.apache.logging.log4j - log4j-slf4j-impl + com.consol.citrus + citrus-core-spring + test + + + com.consol.citrus + citrus-validation-json test diff --git a/java/steps/yaks-http/src/test/resources/citrus-application.properties b/java/steps/yaks-http/src/test/resources/citrus-application.properties index 0a9f5dd5..a801a831 100644 --- a/java/steps/yaks-http/src/test/resources/citrus-application.properties +++ b/java/steps/yaks-http/src/test/resources/citrus-application.properties @@ -16,3 +16,4 @@ # citrus.spring.java.config=org.citrusframework.yaks.http.HttpEndpointConfiguration +citrus.default.message.type=JSON diff --git a/java/steps/yaks-jdbc/pom.xml b/java/steps/yaks-jdbc/pom.xml index 3622afa8..6cf373dc 100644 --- a/java/steps/yaks-jdbc/pom.xml +++ b/java/steps/yaks-jdbc/pom.xml @@ -29,7 +29,6 @@ YAKS :: Steps :: JDBC - io.cucumber cucumber-java @@ -37,29 +36,28 @@ com.consol.citrus - citrus-core + citrus-base + - org.postgresql - postgresql - ${postgresql.version} + io.cucumber + cucumber-junit + test - - - junit - junit + com.consol.citrus + citrus-cucumber test - io.cucumber - cucumber-junit + com.consol.citrus + citrus-core-spring test com.consol.citrus - citrus-cucumber + citrus-validation-groovy test @@ -75,11 +73,10 @@ test - org.apache.logging.log4j - log4j-slf4j-impl + org.postgresql + postgresql test - diff --git a/java/steps/yaks-jdbc/src/main/java/org/citrusframework/yaks/jdbc/JdbcSteps.java b/java/steps/yaks-jdbc/src/main/java/org/citrusframework/yaks/jdbc/JdbcSteps.java index f26b6802..245a2e8f 100644 --- a/java/steps/yaks-jdbc/src/main/java/org/citrusframework/yaks/jdbc/JdbcSteps.java +++ b/java/steps/yaks-jdbc/src/main/java/org/citrusframework/yaks/jdbc/JdbcSteps.java @@ -34,7 +34,6 @@ import io.cucumber.java.en.Given; import io.cucumber.java.en.Then; import io.cucumber.java.en.When; -import org.postgresql.Driver; import org.springframework.jdbc.datasource.SingleConnectionDataSource; import static com.consol.citrus.actions.ExecuteSQLAction.Builder.sql; @@ -74,8 +73,8 @@ public void setDataSource(String id) { public void setConnection(DataTable properties) { Map connectionProps = properties.asMap(String.class, String.class); - String driver = connectionProps.getOrDefault("driver", Driver.class.getName()); - String url = connectionProps.getOrDefault("url", ""); + String driver = connectionProps.getOrDefault("driver", "org.postgresql.Driver"); + String url = connectionProps.getOrDefault("url", "jdbc:postgresql://localhost:5432/testdb"); String username = connectionProps.getOrDefault("username", "test"); String password = connectionProps.getOrDefault("password", "test"); boolean suppressClose = Boolean.parseBoolean(connectionProps.getOrDefault("suppressClose", Boolean.TRUE.toString())); diff --git a/java/steps/yaks-jdbc/src/test/java/org/citrusframework/yaks/jdbc/JdbcStepsTest.java b/java/steps/yaks-jdbc/src/test/java/org/citrusframework/yaks/jdbc/JdbcStepsTest.java index f25f0f5d..1f7cbb72 100644 --- a/java/steps/yaks-jdbc/src/test/java/org/citrusframework/yaks/jdbc/JdbcStepsTest.java +++ b/java/steps/yaks-jdbc/src/test/java/org/citrusframework/yaks/jdbc/JdbcStepsTest.java @@ -17,9 +17,6 @@ package org.citrusframework.yaks.jdbc; -import java.util.function.Consumer; - -import com.github.dockerjava.api.command.CreateContainerCmd; import com.github.dockerjava.api.model.ExposedPort; import com.github.dockerjava.api.model.PortBinding; import com.github.dockerjava.api.model.Ports; @@ -27,7 +24,6 @@ import io.cucumber.junit.CucumberOptions; import org.junit.ClassRule; import org.junit.runner.RunWith; -import org.testcontainers.containers.GenericContainer; import org.testcontainers.containers.PostgreSQLContainer; /** @@ -42,12 +38,12 @@ public class JdbcStepsTest { @ClassRule - public static GenericContainer testdbContainer = new PostgreSQLContainer() + public static PostgreSQLContainer testdbContainer = new PostgreSQLContainer<>() .withDatabaseName("testdb") .withUsername("test") .withPassword("secret") .withInitScript("test-db-init.sql") - .withCreateContainerCmdModifier((Consumer) modifier -> modifier.withPortBindings( + .withCreateContainerCmdModifier(modifier -> modifier.withPortBindings( new PortBinding(Ports.Binding.bindPort(PostgreSQLContainer.POSTGRESQL_PORT), new ExposedPort(PostgreSQLContainer.POSTGRESQL_PORT)))); } diff --git a/java/steps/yaks-jms/pom.xml b/java/steps/yaks-jms/pom.xml index 617de6d6..d5b75c40 100644 --- a/java/steps/yaks-jms/pom.xml +++ b/java/steps/yaks-jms/pom.xml @@ -67,22 +67,20 @@ com.consol.citrus - citrus-core + citrus-base - com.consol.citrus citrus-jms - + org.apache.activemq activemq-client ${activemq.version} provided - org.apache.activemq artemis-jms-client @@ -91,11 +89,6 @@ - - junit - junit - test - io.cucumber cucumber-junit @@ -107,18 +100,18 @@ test - org.apache.logging.log4j - log4j-slf4j-impl + com.consol.citrus + citrus-core-spring test - org.assertj - assertj-core + com.consol.citrus + citrus-validation-json test - org.mockito - mockito-core + com.consol.citrus + citrus-validation-text test diff --git a/java/steps/yaks-kafka/pom.xml b/java/steps/yaks-kafka/pom.xml index 939d23f6..7a4e0b4b 100644 --- a/java/steps/yaks-kafka/pom.xml +++ b/java/steps/yaks-kafka/pom.xml @@ -36,20 +36,14 @@ com.consol.citrus - citrus-core + citrus-base - com.consol.citrus citrus-kafka - - junit - junit - test - io.cucumber cucumber-junit @@ -61,8 +55,18 @@ test - org.apache.logging.log4j - log4j-slf4j-impl + com.consol.citrus + citrus-core-spring + test + + + com.consol.citrus + citrus-validation-json + test + + + com.consol.citrus + citrus-validation-text test diff --git a/java/steps/yaks-openapi/pom.xml b/java/steps/yaks-openapi/pom.xml index abf6afcc..43ce1573 100644 --- a/java/steps/yaks-openapi/pom.xml +++ b/java/steps/yaks-openapi/pom.xml @@ -48,15 +48,14 @@ com.consol.citrus - citrus-core + citrus-base - - - junit - junit - test + com.consol.citrus + citrus-validation-json + + io.cucumber cucumber-junit @@ -68,8 +67,13 @@ test - org.apache.logging.log4j - log4j-slf4j-impl + com.consol.citrus + citrus-core-spring + test + + + com.consol.citrus + citrus-validation-hamcrest test diff --git a/java/steps/yaks-openapi/src/main/java/org/citrusframework/yaks/openapi/OpenApiSteps.java b/java/steps/yaks-openapi/src/main/java/org/citrusframework/yaks/openapi/OpenApiSteps.java index 6b6a3d5f..cd1198b0 100644 --- a/java/steps/yaks-openapi/src/main/java/org/citrusframework/yaks/openapi/OpenApiSteps.java +++ b/java/steps/yaks-openapi/src/main/java/org/citrusframework/yaks/openapi/OpenApiSteps.java @@ -32,6 +32,7 @@ import com.consol.citrus.annotations.CitrusAnnotations; import com.consol.citrus.annotations.CitrusFramework; import com.consol.citrus.annotations.CitrusResource; +import com.consol.citrus.variable.dictionary.AbstractDataDictionary; import com.consol.citrus.variable.dictionary.json.JsonPathMappingDataDictionary; import io.apicurio.datamodels.openapi.models.OasDocument; import io.apicurio.datamodels.openapi.models.OasOperation; @@ -64,8 +65,8 @@ public class OpenApiSteps { private OasDocument openApiDoc; private OasOperation operation; - private JsonPathMappingDataDictionary outboundDictionary; - private JsonPathMappingDataDictionary inboundDictionary; + private AbstractDataDictionary outboundDictionary; + private AbstractDataDictionary inboundDictionary; @Before public void before(Scenario scenario) { diff --git a/java/steps/yaks-openapi/src/test/resources/citrus-application.properties b/java/steps/yaks-openapi/src/test/resources/citrus-application.properties index e5602871..44a5393f 100644 --- a/java/steps/yaks-openapi/src/test/resources/citrus-application.properties +++ b/java/steps/yaks-openapi/src/test/resources/citrus-application.properties @@ -16,3 +16,4 @@ # citrus.spring.java.config=org.citrusframework.yaks.openapi.PetstoreConfiguration +citrus.default.message.type=JSON diff --git a/java/steps/yaks-standard/pom.xml b/java/steps/yaks-standard/pom.xml index d59576e5..fa81e88d 100644 --- a/java/steps/yaks-standard/pom.xml +++ b/java/steps/yaks-standard/pom.xml @@ -36,7 +36,7 @@ com.consol.citrus - citrus-core + citrus-base com.consol.citrus @@ -53,24 +53,14 @@ - - junit - junit - test - - - org.assertj - assertj-core - test - io.cucumber cucumber-junit test - org.apache.logging.log4j - log4j-slf4j-impl + com.consol.citrus + citrus-core-spring test diff --git a/java/tools/maven/yaks-maven-extension/pom.xml b/java/tools/maven/yaks-maven-extension/pom.xml index 565b493d..1958a9dc 100644 --- a/java/tools/maven/yaks-maven-extension/pom.xml +++ b/java/tools/maven/yaks-maven-extension/pom.xml @@ -99,25 +99,12 @@ org.yaml snakeyaml - 1.25 com.fasterxml.jackson.core jackson-databind - - - - junit - junit - test - - - org.assertj - assertj-core - test -