Skip to content

Commit

Permalink
re-enabled executing Junit4 tests in modules which have both Junit4 a…
Browse files Browse the repository at this point in the history
…nd -5 tests

* fixed broken tests in modules "ditto-things-model", "ditto-things-service", "ditto-concierge-service"
* performed module refactoring of "ditto-rql-parser", pulled out "things-search" dependency to another new module "ditto-rql-search-option-parser" in order to prevent a transitive dependency from "ditto-things-model" to "ditto-things-search-model"

Signed-off-by: Thomas Jaeckle <thomas.jaeckle@bosch.io>
  • Loading branch information
thjaeckle committed Dec 9, 2021
1 parent 8c1d024 commit a2d8588
Show file tree
Hide file tree
Showing 21 changed files with 269 additions and 34 deletions.
11 changes: 11 additions & 0 deletions bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,11 @@
<artifactId>ditto-rql-parser</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-rql-search-option-parser</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-messages-model</artifactId>
Expand Down Expand Up @@ -807,6 +812,12 @@
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions concierge/service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mutabilitydetector</groupId>
<artifactId>MutabilityDetector</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import java.util.Collections;

import org.eclipse.ditto.json.JsonObject;
import org.eclipse.ditto.base.model.headers.WithDittoHeaders;
import org.eclipse.ditto.json.JsonObject;
import org.eclipse.ditto.policies.model.PoliciesModelFactory;
import org.eclipse.ditto.policies.model.Policy;
import org.eclipse.ditto.policies.model.PolicyEntry;
Expand Down Expand Up @@ -63,9 +63,9 @@ public void applyReturnsTheSameCommandInstanceWhenNoInlinePolicyIsSpecified() {
}

@Test
public void applyReturnsTheSameCommandInstanceWhenInvalidInlinePolicyIsSpecified() {
public void applyReturnsTheSameCommandInstanceWhenEmptyInlinePolicyIsSpecified() {
final CreateThing commandWithoutInlinePolicy =
CreateThing.of(THING, JsonObject.newBuilder().set("foo", "bar").build(), DITTO_HEADERS);
CreateThing.of(THING, JsonObject.newBuilder().set("entries", JsonObject.empty()).build(), DITTO_HEADERS);

final WithDittoHeaders response = applyBlocking(commandWithoutInlinePolicy);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

import java.util.Collections;

import org.eclipse.ditto.json.JsonObject;
import org.eclipse.ditto.base.model.headers.WithDittoHeaders;
import org.eclipse.ditto.json.JsonObject;
import org.eclipse.ditto.policies.model.PoliciesModelFactory;
import org.eclipse.ditto.policies.model.Policy;
import org.eclipse.ditto.policies.model.PolicyEntry;
Expand Down Expand Up @@ -64,9 +64,9 @@ public void applyReturnsTheSameCommandInstanceWhenNoInlinePolicyIsSpecified() {
}

@Test
public void applyReturnsTheSameCommandInstanceWhenInvalidInlinePolicyIsSpecified() {
public void applyReturnsTheSameCommandInstanceWhenEmptyInlinePolicyIsSpecified() {
final ModifyThing commandWithoutInlinePolicy =
ModifyThing.of(THING_ID, THING, JsonObject.newBuilder().set("foo", "bar").build(), DITTO_HEADERS);
ModifyThing.of(THING_ID, THING, JsonObject.newBuilder().set("entries", JsonObject.empty()).build(), DITTO_HEADERS);

final WithDittoHeaders response = applyBlocking(commandWithoutInlinePolicy);

Expand Down
4 changes: 4 additions & 0 deletions internal/utils/search/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-rql-parser</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-rql-search-option-parser</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-internal-utils-akka</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions policies/model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>4.4.0</version>
<version>4.5.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
8 changes: 4 additions & 4 deletions rql/parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<!-- ### Compile ### -->
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-thingsearch-model</artifactId>
<artifactId>ditto-base-model</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
Expand Down Expand Up @@ -146,7 +146,6 @@
</Import-Package>
<Export-Package>
!org.eclipse.ditto.rql.parser.internal,
!org.eclipse.ditto.rql.parser.thingsearch.internal,
org.eclipse.ditto.rql.parser.*
</Export-Package>
</instructions>
Expand All @@ -157,7 +156,7 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<excludePackageNames>org.eclipse.ditto.rql.parser,org.eclipse.ditto.rql.parser.thingsearch</excludePackageNames>
<excludePackageNames>org.eclipse.ditto.rql.parser</excludePackageNames>
</configuration>
<executions>
<execution>
Expand All @@ -175,7 +174,8 @@
<excludes>
<!-- Always exclude the 'internal' package -->
<exclude>org.eclipse.ditto.rql.parser.internal</exclude>
<exclude>org.eclipse.ditto.rql.parser.thingsearch.internal</exclude>
<!-- thingsearch package was moved to its own module "ditto-rql-search-option-parser" -->
<exclude>org.eclipse.ditto.rql.parser.thingsearch</exclude>
<!-- Don't add excludes here before checking with the whole Ditto team -->
<!--<exclude></exclude>-->
</excludes>
Expand Down
1 change: 1 addition & 0 deletions rql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<modules>
<module>model</module>
<module>parser</module>
<module>search-option-parser</module>
<module>query</module>
</modules>

Expand Down
191 changes: 191 additions & 0 deletions rql/search-option-parser/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2021 Contributors to the Eclipse Foundation
~
~ See the NOTICE file(s) distributed with this work for additional
~ information regarding copyright ownership.
~
~ This program and the accompanying materials are made available under the
~ terms of the Eclipse Public License 2.0 which is available at
~ http://www.eclipse.org/legal/epl-2.0
~
~ SPDX-License-Identifier: EPL-2.0
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-rql</artifactId>
<version>${revision}</version>
</parent>

<artifactId>ditto-rql-search-option-parser</artifactId>
<packaging>bundle</packaging>
<name>Eclipse Ditto :: RQL :: search option parser</name>

<properties>
<javac.source>1.8</javac.source>
<javac.target>1.8</javac.target>
</properties>

<dependencies>
<!-- ### Compile ### -->
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-thingsearch-model</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-rql-model</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-rql-parser</artifactId>
</dependency>

<dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-parsing_${scala.version}</artifactId>
</dependency>

<!-- ### Testing ### -->
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-base-model</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.ditto</groupId>
<artifactId>ditto-json</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${javac.source}</source>
<target>${javac.target}</target>
</configuration>
</plugin>

<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<configuration>
<source>${javac.source}</source>
<target>${javac.target}</target>
<scalaVersion>${scala.full.version}</scalaVersion>
</configuration>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<phase>compile</phase>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>testCompile</goal>
</goals>
<phase>test-compile</phase>
</execution>
<execution>
<phase>process-resources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-banned-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<!-- as this is a model and thus a minimal dependencies-rules applies,
we don't want to have a slf4j dependency -->
<exclude>org.slf4j</exclude>
</excludes>
<includes>
<include>org.slf4j:*:*:jar:test</include>
</includes>
</bannedDependencies>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>
!org.eclipse.ditto.utils.jsr305.annotations,
akka*,
scala*,
org.eclipse.ditto.*
</Import-Package>
<Export-Package>
!org.eclipse.ditto.rql.parser.thingsearch.internal,
org.eclipse.ditto.rql.parser.*
</Export-Package>
</instructions>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<excludePackageNames>org.eclipse.ditto.rql.parser.thingsearch</excludePackageNames>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>none</phase>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
<configuration>
<skip>true</skip> <!-- TODO TJ unskip once 2.3.0 was released -->
<parameter>
<excludes>
<!-- Always exclude the 'internal' package -->
<exclude>org.eclipse.ditto.rql.parser.thingsearch.internal</exclude>
<!-- Don't add excludes here before checking with the whole Ditto team -->
<!--<exclude></exclude>-->
</excludes>
</parameter>
</configuration>
</plugin>
</plugins>
</build>

</project>
1 change: 1 addition & 0 deletions rql/search-option-parser/src/main/resources/META-INF/._
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Placeholder to ensure META-INF is present
5 changes: 5 additions & 0 deletions things/model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
import java.util.List;
import java.util.Optional;

import org.eclipse.ditto.base.model.entity.metadata.Metadata;
import org.eclipse.ditto.base.model.json.FieldType;
import org.eclipse.ditto.base.model.json.JsonSchemaVersion;
import org.eclipse.ditto.json.JsonFactory;
import org.eclipse.ditto.json.JsonObject;
import org.eclipse.ditto.json.JsonPointer;
import org.eclipse.ditto.json.JsonValue;
import org.eclipse.ditto.json.assertions.DittoJsonAssertions;
import org.eclipse.ditto.base.model.entity.metadata.Metadata;
import org.eclipse.ditto.base.model.json.FieldType;
import org.eclipse.ditto.base.model.json.JsonSchemaVersion;
import org.eclipse.ditto.policies.model.PolicyId;
import org.eclipse.ditto.policies.model.PolicyIdInvalidException;
import org.junit.Test;
Expand Down Expand Up @@ -1140,7 +1140,7 @@ public void ensureThingToJsonWithSpecialContainsAllFieldsV2() {
@Test
public void createThingWithInvalidIds() {
final List<String> invalidThingIds =
Arrays.asList("", "foobar2000", "foo-bar:foobar2000", "foo.bar%bum:foobar2000",
Arrays.asList("", "foobar2000", "foo--bar:foobar2000", "foo.bar%bum:foobar2000",
".namespace:foobar2000", "namespace.:foobar2000", "namespace..invalid:foobar2000",
"namespace.42:foobar2000");

Expand Down

0 comments on commit a2d8588

Please sign in to comment.