diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 498edd35f..85c365864 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -139,7 +139,7 @@ Each Java file must include the following license header at the top of each file ```java /* - * Copyright (c) 2022 Fraunhofer FOKUS and others. All rights reserved. + * Copyright (c) 2024 Fraunhofer FOKUS and others. All rights reserved. * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. diff --git a/NOTICE-THIRD-PARTY.md b/NOTICE-THIRD-PARTY.md index 1a927766b..de248d952 100644 --- a/NOTICE-THIRD-PARTY.md +++ b/NOTICE-THIRD-PARTY.md @@ -5,49 +5,49 @@ Maps Icons Collection * License: Creative Commons Attribution-Share Alike 3.0 Unported license (CC BY SA 3.0) * Project: https://mapicons.mapsmarker.com -Apache Commons CLI (1.4) +Apache Commons CLI (1.6.0) - * License: Apache License, Version 2.0 - * Maven artifact: `commons-cli:commons-cli:1.4` - * Project: http://commons.apache.org/proper/commons-cli/ - * Source: https://svn.apache.org/viewvc/commons/proper/cli/trunk/ + * License: Apache-2.0 + * Maven artifact: `commons-cli:commons-cli:1.6.0` + * Project: https://commons.apache.org/proper/commons-cli/ + * Source: https://gitbox.apache.org/repos/asf?p=commons-cli Apache Commons Configuration (2.5) - * License: Apache License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `org.apache.commons:commons-configuration2:2.5` * Project: http://commons.apache.org/proper/commons-configuration/ * Source: https://gitbox.apache.org/repos/asf?p=commons-configuration -Apache Commons IO (2.6) +Apache Commons IO (2.15.0) - * License: Apache License, Version 2.0 - * Maven artifact: `commons-io:commons-io:2.6` - * Project: http://commons.apache.org/proper/commons-io/ - * Source: https://git-wip-us.apache.org/repos/asf?p=commons-io + * License: Apache-2.0 + * Maven artifact: `commons-io:commons-io:2.15.0` + * Project: https://commons.apache.org/proper/commons-io/ + * Source: https://gitbox.apache.org/repos/asf?p=commons-io -Apache Commons Lang (3.13.0) +Apache Commons Lang (3.14.0) * License: Apache-2.0 - * Maven artifact: `org.apache.commons:commons-lang3:3.13.0` + * Maven artifact: `org.apache.commons:commons-lang3:3.14.0` * Project: https://commons.apache.org/proper/commons-lang/ * Source: https://gitbox.apache.org/repos/asf?p=commons-lang -Apache Commons Logging (1.2) +Apache Commons Logging (1.3.0) - * License: The Apache Software License, Version 2.0 - * Maven artifact: `commons-logging:commons-logging:1.2` - * Project: http://commons.apache.org/proper/commons-logging/ - * Source: https://svn.apache.org/repos/asf/commons/proper/logging/trunk + * License: Apache-2.0 + * Maven artifact: `commons-logging:commons-logging:1.3.0` + * Project: https://commons.apache.org/proper/commons-logging/ + * Source: https://gitbox.apache.org/repos/asf/commons-logging Apache Commons Math (3.6.1) - * License: Apache License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `org.apache.commons:commons-math3:3.6.1` * Project: http://commons.apache.org/proper/commons-math/ * Source: https://git-wip-us.apache.org/repos/asf?p=commons-math @@ -55,31 +55,31 @@ Apache Commons Math (3.6.1) Apache Commons Text (1.6) - * License: Apache License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `org.apache.commons:commons-text:1.6` * Project: http://commons.apache.org/proper/commons-text * Source: https://git-wip-us.apache.org/repos/asf?p=commons-text -Commons Compiler (2.7.5) - - * License: New BSD License - * Maven artifact: `org.codehaus.janino:commons-compiler:2.7.5` - * Project: http://docs.codehaus.org/display/JANINO/Home/commons-compiler - * Source: https://fisheye.codehaus.org/browse/janino/tags/janino_2.7.5/commons-compiler/ - - Commons JXPath (1.3) - * License: The Apache Software License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `commons-jxpath:commons-jxpath:1.3` * Project: http://commons.apache.org/jxpath/ * Source: https://svn.apache.org/repos/asf/commons/proper/jxpath/trunk +commons-compiler (3.1.11) + + * License: BSD-3-Clause + * Maven artifact: `org.codehaus.janino:commons-compiler:3.1.11` + * Project: http://janino-compiler.github.io/commons-compiler/ + * Source: https://github.com/janino-compiler/commons-compiler + + Findbugs Annotations under Apache License (1.3.9-1) - * License: Apache License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `com.github.stephenc.findbugs:findbugs-annotations:1.3.9-1` * Project: http://stephenc.github.com/findbugs-annotations * Source: https://github.com/stephenc/findbugs-annotations/tree/master/ @@ -87,7 +87,7 @@ Findbugs Annotations under Apache License (1.3.9-1) FindBugs-jsr305 (3.0.2) - * License: The Apache Software License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `com.google.code.findbugs:jsr305:3.0.2` * Project: http://findbugs.sourceforge.net/ * Source: https://code.google.com/p/jsr-305/ @@ -95,7 +95,7 @@ FindBugs-jsr305 (3.0.2) GraphHopper Core (8.0) - * License: The Apache Software License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `com.graphhopper:graphhopper-core:8.0` * Project: https://www.graphhopper.com/graphhopper-core * Source: https://github.com/graphhopper/graphhopper/graphhopper-core @@ -103,7 +103,7 @@ GraphHopper Core (8.0) GraphHopper Web API (8.0) - * License: Apache License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `com.graphhopper:graphhopper-web-api:8.0` * Project: https://www.graphhopper.com/graphhopper-web-api * Source: https://github.com/graphhopper/graphhopper/graphhopper-web-api @@ -119,7 +119,7 @@ Gson (2.10.1) Guava: Google Core Libraries for Java (32.1.1-jre) - * License: Apache License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `com.google.guava:guava:32.1.1-jre` * Project: https://github.com/google/guava * Source: https://github.com/google/guava/guava @@ -127,161 +127,129 @@ Guava: Google Core Libraries for Java (32.1.1-jre) HPPC Collections (0.8.1) - * License: The Apache Software License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `com.carrotsearch:hppc:0.8.1` * Project: http://labs.carrotsearch.com/hppc.html/hppc * Source: https://github.com/carrotsearch/hppc/hppc -Jackson-annotations (2.15.0) +Internet Time Utility (1.8.0) + + * License: Apache-2.0 + * Maven artifact: `com.ethlo.time:itu:1.8.0` + * Project: https://github.com/ethlo/itu + * Source: https://github.com/ethlo/itu + + +Jackson-annotations (2.16.1) - * License: The Apache Software License, Version 2.0 - * Maven artifact: `com.fasterxml.jackson.core:jackson-annotations:2.15.0` + * License: Apache-2.0 + * Maven artifact: `com.fasterxml.jackson.core:jackson-annotations:2.16.1` * Project: https://github.com/FasterXML/jackson * Source: https://github.com/FasterXML/jackson-annotations -Jackson-core (2.15.0) +Jackson-core (2.16.1) - * License: The Apache Software License, Version 2.0 - * Maven artifact: `com.fasterxml.jackson.core:jackson-core:2.15.0` + * License: Apache-2.0 + * Maven artifact: `com.fasterxml.jackson.core:jackson-core:2.16.1` * Project: https://github.com/FasterXML/jackson-core * Source: https://github.com/FasterXML/jackson-core -jackson-databind (2.15.0) +jackson-databind (2.16.1) - * License: The Apache Software License, Version 2.0 - * Maven artifact: `com.fasterxml.jackson.core:jackson-databind:2.15.0` + * License: Apache-2.0 + * Maven artifact: `com.fasterxml.jackson.core:jackson-databind:2.16.1` * Project: https://github.com/FasterXML/jackson * Source: https://github.com/FasterXML/jackson-databind -Jackson-dataformat-XML (2.15.0) - - * License: The Apache Software License, Version 2.0 - * Maven artifact: `com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.15.0` - * Project: https://github.com/FasterXML/jackson-dataformat-xml - * Source: https://github.com/FasterXML/jackson-dataformat-xml - - Jackson-datatype-jts (2.14) - * License: The Apache Software License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `com.graphhopper.external:jackson-datatype-jts:2.14` * Project: https://github.com/bedatadriven/jackson-datatype-jts/ * Source: scm:git:https://github.com/bedatadriven/jackson-datatype-jts -Janino (2.7.5) +janino (3.1.11) - * License: New BSD License - * Maven artifact: `org.codehaus.janino:janino:2.7.5` - * Project: http://docs.codehaus.org/display/JANINO/Home/janino - * Source: https://fisheye.codehaus.org/browse/janino/tags/janino_2.7.5/janino/ + * License: BSD-3-Clause + * Maven artifact: `org.codehaus.janino:janino:3.1.11` + * Project: http://janino-compiler.github.io/janino/ + * Source: https://github.com/janino-compiler/janino Java-WebSocket (1.3.9) - * License: MIT License + * License: MIT * Maven artifact: `org.java-websocket:Java-WebSocket:1.3.9` * Project: https://github.com/TooTallNate/Java-WebSocket * Source: https://github.com/TooTallNate/Java-WebSocket -Johnzon :: Core (1.1.13) - - * License: The Apache Software License, Version 2.0 - * Maven artifact: `org.apache.johnzon:johnzon-core:1.1.13` - * Project: http://johnzon.apache.org/johnzon-core - * Source: https://git-wip-us.apache.org/repos/asf?p=johnzon/johnzon-core - - -JSch (0.1.51) +JSch (0.2.16) - * License: Revised BSD - * Maven artifact: `com.jcraft:jsch:0.1.51` - * Project: http://www.jcraft.com/jsch/ - * Source: https://git.jcraft.com/jsch + * License: BSD-3-Clause, ISC + * Maven artifact: `com.github.mwiede:jsch:0.2.16` + * Project: https://github.com/mwiede/jsch + * Source: https://github.com/mwiede/jsch -JSR 374 (JSON Processing) API (1.1.5) +JsonSchemaValidator (1.3.1) - * License: Eclipse Public License 2.0, GNU General Public License, version 2 with the GNU Classpath Exception - * Maven artifact: `jakarta.json:jakarta.json-api:1.1.5` - * Project: https://javaee.github.io/jsonp - * Source: https://github.com/eclipse-ee4j/jsonp/jakarta.json-api + * License: Apache-2.0 + * Maven artifact: `com.networknt:json-schema-validator:1.3.1` + * Project: https://github.com/networknt/json-schema-validator + * Source: https://github.com/networknt/json-schema-validator -Logback Classic Module (1.3.8) +Logback Classic Module (1.5.0) - * License: Eclipse Public License - v 1.0, GNU Lesser General Public License - * Maven artifact: `ch.qos.logback:logback-classic:1.3.8` + * License: EPL-1.0, LGPL-2.1 + * Maven artifact: `ch.qos.logback:logback-classic:1.5.0` * Project: http://logback.qos.ch/logback-classic * Source: https://github.com/qos-ch/logback/logback-classic -Logback Core Module (1.3.8) +Logback Core Module (1.5.0) - * License: Eclipse Public License - v 1.0, GNU Lesser General Public License - * Maven artifact: `ch.qos.logback:logback-core:1.3.8` + * License: EPL-1.0, LGPL-2.1 + * Maven artifact: `ch.qos.logback:logback-core:1.5.0` * Project: http://logback.qos.ch/logback-core * Source: https://github.com/qos-ch/logback/logback-core -org.leadpony.justify (1.1.0) - - * License: The Apache Software License, Version 2.0 - * Maven artifact: `org.leadpony.justify:justify:1.1.0` - * Project: https://github.com/leadpony/justify - * Source: https://github.com/leadpony/justify - - org.locationtech.jts:jts-core (1.19.0) - * License: Eclipse Distribution License - v 1.0, Eclipse Public License, Version 2.0 + * License: BSD-3-Clause (Eclipse Distribution License), Eclipse Public License, Version 2.0 * Maven artifact: `org.locationtech.jts:jts-core:1.19.0` * Project: https://www.locationtech.org/projects/technology.jts/jts-modules/jts-core * Source: https://github.com/locationtech/jts/jts-modules/jts-core -Protocol Buffers [Core] (3.8.0) +Protocol Buffers [Core] (3.23.2) - * License: 3-Clause BSD License - * Maven artifact: `com.google.protobuf:protobuf-java:3.8.0` + * License: BSD-3-Clause + * Maven artifact: `com.google.protobuf:protobuf-java:3.23.2` * Project: https://developers.google.com/protocol-buffers/protobuf-java/ * Source: https://github.com/protocolbuffers/protobuf/protobuf-java -SLF4J API Module (2.0.9) +SLF4J API Module (2.0.12) - * License: MIT License - * Maven artifact: `org.slf4j:slf4j-api:2.0.9` + * License: MIT + * Maven artifact: `org.slf4j:slf4j-api:2.0.12` * Project: http://www.slf4j.org * Source: https://github.com/qos-ch/slf4j/slf4j-parent/slf4j-api SQLite JDBC (3.42.0.0) - * License: The Apache Software License, Version 2.0 + * License: Apache-2.0 * Maven artifact: `org.xerial:sqlite-jdbc:3.42.0.0` * Project: https://github.com/xerial/sqlite-jdbc * Source: https://github.com/xerial/sqlite-jdbc -Stax2 API (4.2.1) - - * License: The BSD License - * Maven artifact: `org.codehaus.woodstox:stax2-api:4.2.1` - * Project: http://github.com/FasterXML/stax2-api - * Source: https://github.com/FasterXML/stax2-api - - -Woodstox (6.5.1) - - * License: The Apache License, Version 2.0 - * Maven artifact: `com.fasterxml.woodstox:woodstox-core:6.5.1` - * Project: https://github.com/FasterXML/woodstox - * Source: https://github.com/FasterXML/woodstox - - diff --git a/NOTICE.md b/NOTICE.md index 9cec59bbb..24ecd88ef 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -2,7 +2,7 @@ This content is produced and maintained by the Eclipse MOSAIC project. - * Project home: https://projects.eclipse.org/projects/technology.mosaic + * Project home: https://projects.eclipse.org/projects/automotive.mosaic ## Trademarks @@ -11,7 +11,7 @@ Eclipse, and the Eclipse Logo are registered trademarks of the Eclipse Foundatio ## Copyright -* Copyright 2020-2023 Fraunhofer FOKUS +* Copyright 2020-2024 Fraunhofer FOKUS All rights reserved. All content is the property of the respective authors or their employers. For more information regarding authorship of content, please consult the listed source code repository logs. diff --git a/bundle/src/assembly/mosaic-bundle.xml b/bundle/src/assembly/mosaic-bundle.xml index 6fcba6a40..e2ea83099 100644 --- a/bundle/src/assembly/mosaic-bundle.xml +++ b/bundle/src/assembly/mosaic-bundle.xml @@ -134,24 +134,14 @@ commons-cli:commons-cli - + com.google.code.gson:gson - org.leadpony.justify:justify - jakarta.json:jakarta.json-api - org.apache.johnzon:johnzon-core - - - - com.fasterxml.jackson.dataformat:jackson-dataformat-xml + com.networknt:json-schema-validator + com.ethlo.time:itu com.fasterxml.jackson.core:jackson-core com.fasterxml.jackson.core:jackson-annotations com.fasterxml.jackson.core:jackson-databind - com.fasterxml.jackson.module:jackson-module-jaxb-annotations - jakarta.xml.bind:jakarta.xml.bind-api - jakarta.activation:jakarta.activation-api - org.codehaus.woodstox:stax2-api - com.fasterxml.woodstox:woodstox-core - + com.graphhopper:graphhopper-web-api @@ -161,7 +151,7 @@ org.locationtech.jts:jts-core - com.jcraft:jsch + com.github.mwiede:jsch com.google.protobuf:protobuf-java org.xerial:sqlite-jdbc org.java-websocket:Java-WebSocket diff --git a/bundle/src/assembly/resources/etc/logback.xml b/bundle/src/assembly/resources/etc/logback.xml index f8d8ace26..98cca0d1d 100644 --- a/bundle/src/assembly/resources/etc/logback.xml +++ b/bundle/src/assembly/resources/etc/logback.xml @@ -209,6 +209,8 @@ + + diff --git a/bundle/src/assembly/resources/fed/ns3/ns3_installer.sh b/bundle/src/assembly/resources/fed/ns3/ns3_installer.sh index 340727623..36c33560c 100644 --- a/bundle/src/assembly/resources/fed/ns3/ns3_installer.sh +++ b/bundle/src/assembly/resources/fed/ns3/ns3_installer.sh @@ -69,7 +69,8 @@ ns3_scratch="${ns3_simulator_folder}/scratch" ns3_source="${ns3_simulator_folder}/src" ####### semi automatic parameters ######## -ns3_federate_url="https://github.com/mosaic-addons/ns3-federate/archive/refs/tags/23.1.zip" +#ns3_federate_url="https://github.com/mosaic-addons/ns3-federate/archive/refs/tags/23.1.zip" +ns3_federate_url="https://github.com/mosaic-addons/ns3-federate/archive/refs/heads/main.zip" ns3_url="https://www.nsnam.org/releases/$ns3_version_affix.tar.bz2" ###### more automatic parameters ######### diff --git a/bundle/src/assembly/resources/fed/omnetpp/Dockerfile b/bundle/src/assembly/resources/fed/omnetpp/Dockerfile index d89735ed8..8fb5607f6 100644 --- a/bundle/src/assembly/resources/fed/omnetpp/Dockerfile +++ b/bundle/src/assembly/resources/fed/omnetpp/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:bionic +FROM ubuntu:jammy LABEL \ description="Docker image containing the MOSAIC adapted OMNeT++ federate" \ @@ -14,10 +14,10 @@ RUN \ libprotobuf-dev \ protobuf-compiler \ libxml2-dev \ - python \ + python3 \ + python-is-python3 \ unzip \ - wget \ - zlib1g-dev + wget WORKDIR /home/mosaic/bin/fed/omnetpp diff --git a/bundle/src/assembly/resources/fed/omnetpp/omnet_installer.sh b/bundle/src/assembly/resources/fed/omnetpp/omnet_installer.sh index 3965d5314..adaabfbe8 100644 --- a/bundle/src/assembly/resources/fed/omnetpp/omnet_installer.sh +++ b/bundle/src/assembly/resources/fed/omnetpp/omnet_installer.sh @@ -46,7 +46,8 @@ check_shell required_programs=( unzip tar bison flex protoc gcc python ) required_libraries=( "libprotobuf-dev >= 3.7.0" "libxml2-dev" ) -omnet_federate_url="https://github.com/mosaic-addons/omnetpp-federate/archive/refs/tags/23.1.zip" +#omnet_federate_url="https://github.com/mosaic-addons/omnetpp-federate/archive/refs/tags/23.1.zip" +omnet_federate_url="https://github.com/mosaic-addons/omnetpp-federate/archive/refs/heads/main.zip" omnet_src_url="https://github.com/omnetpp/omnetpp/releases/download/omnetpp-5.5.1/omnetpp-5.5.1-src-linux.tgz" inet_src_url="https://github.com/inet-framework/inet/releases/download/v4.1.1/inet-4.1.1-src.tgz" diff --git a/fed/mosaic-application/src/test/resources/logback-test.xml b/fed/mosaic-application/src/test/resources/logback-test.xml new file mode 100644 index 000000000..6f53dc1fd --- /dev/null +++ b/fed/mosaic-application/src/test/resources/logback-test.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/fed/mosaic-cell/src/test/resources/logback-test.xml b/fed/mosaic-cell/src/test/resources/logback-test.xml index c75d693ec..86ed7605d 100644 --- a/fed/mosaic-cell/src/test/resources/logback-test.xml +++ b/fed/mosaic-cell/src/test/resources/logback-test.xml @@ -6,6 +6,8 @@ + + diff --git a/fed/mosaic-environment/src/test/java/org/eclipse/mosaic/fed/environment/config/CEnvironmentTest.java b/fed/mosaic-environment/src/test/java/org/eclipse/mosaic/fed/environment/config/CEnvironmentTest.java index ec8f9b1df..c9a3b2df8 100644 --- a/fed/mosaic-environment/src/test/java/org/eclipse/mosaic/fed/environment/config/CEnvironmentTest.java +++ b/fed/mosaic-environment/src/test/java/org/eclipse/mosaic/fed/environment/config/CEnvironmentTest.java @@ -140,7 +140,7 @@ public void readInvalidConfig_assertExceptions() { // ASSERT assertThat( instantiationException.getMessage(), - startsWith("The CEnvironment config is not valid: [21,9][/events/0] The object must have a property whose name is \"time\".") + startsWith("The CEnvironment config is not valid: $.events[0]: required property 'time' not found") ); // checking that proper Exception is thrown } } diff --git a/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidCPrototypeTest.java b/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidCPrototypeTest.java index 976c83b73..9b0a8cd15 100644 --- a/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidCPrototypeTest.java +++ b/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidCPrototypeTest.java @@ -40,7 +40,7 @@ public void missingProperties() { "/mapping/invalid/prototype/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/prototypes/0] The object must have a property whose name is \"name\"")); + assertTrue(e.getMessage().contains("$.prototypes[0]: required property 'name' not found")); } assertNull(mapping); } diff --git a/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidChargingStationTest.java b/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidChargingStationTest.java index c020bf46e..6b86f839c 100644 --- a/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidChargingStationTest.java +++ b/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidChargingStationTest.java @@ -41,8 +41,8 @@ public void missingProperties() { try { mapping = new ObjectInstantiation<>(CMappingAmbassador.class).read(getClass().getResourceAsStream("/mapping/invalid/chargingStation/MissingProperties.json")); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/chargingStations/0] The object must have a property whose name is \"position\"")); - assertTrue(e.getMessage().contains("[/chargingStations/0] The object must have a property whose name is \"chargingSpots\"")); + assertTrue(e.getMessage().contains("$.chargingStations[0]: required property 'position' not found")); + assertTrue(e.getMessage().contains("$.chargingStations[0]: required property 'chargingSpots' not found")); } assertNull(mapping); } @@ -61,8 +61,7 @@ public void missingChargingSpotProperties() { "/mapping/invalid/chargingStation/chargingSpot/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/chargingStations/0/chargingSpots/0]" - + " The object must have a property whose name is \"chargingType\"")); + assertTrue(e.getMessage().contains("$.chargingStations[0].chargingSpots[0]: required property 'chargingType' not found")); } assertNull(mapping); } diff --git a/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidMatrixMapperTest.java b/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidMatrixMapperTest.java index e0498f261..5460ab7ba 100644 --- a/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidMatrixMapperTest.java +++ b/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidMatrixMapperTest.java @@ -41,8 +41,8 @@ public void missingProperties() { "/mapping/invalid/matrixMapper/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/matrixMappers/0] The object must have a property whose name is \"points\"")); - assertTrue(e.getMessage().contains("[/matrixMappers/0] The object must have a property whose name is \"odValues\"")); + assertTrue(e.getMessage().contains("$.matrixMappers[0]: required property 'points' not found")); + assertTrue(e.getMessage().contains("$.matrixMappers[0]: required property 'odValues' not found")); } assertNull(mapping); } @@ -61,8 +61,8 @@ public void missingPointProperties() { "/mapping/invalid/matrixMapper/point/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/matrixMappers/0/points/0] The object must have a property whose name is \"name\"")); - assertTrue(e.getMessage().contains("[/matrixMappers/0/points/0] The object must have a property whose name is \"position\"")); + assertTrue(e.getMessage().contains("$.matrixMappers[0].points[0]: required property 'name' not found")); + assertTrue(e.getMessage().contains("$.matrixMappers[0].points[0]: required property 'position' not found")); } assertNull(mapping); } @@ -81,8 +81,8 @@ public void missingPositionProperties() { "/mapping/invalid/matrixMapper/point/position/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/matrixMappers/0/points/0/position] The object must have a property whose name is \"radius\"")); - assertTrue(e.getMessage().contains("[/matrixMappers/0/points/0/position] The object must have a property whose name is \"center\"")); + assertTrue(e.getMessage().contains("$.matrixMappers[0].points[0].position: required property 'radius' not found")); + assertTrue(e.getMessage().contains("$.matrixMappers[0].points[0].position: required property 'center' not found")); } assertNull(mapping); } @@ -101,8 +101,9 @@ public void missingCenterProperties() { "/mapping/invalid/matrixMapper/point/position/center/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/matrixMappers/0/points/0/position/center] The object must have a property whose name is \"longitude\"")); - assertTrue(e.getMessage().contains("[/matrixMappers/0/points/0/position/center] The object must have a property whose name is \"latitude\"")); + e.printStackTrace(); + assertTrue(e.getMessage().contains("$.matrixMappers[0].points[0].position.center: required property 'longitude' not found")); + assertTrue(e.getMessage().contains("$.matrixMappers[0].points[0].position.center: required property 'latitude' not found")); } assertNull(mapping); } diff --git a/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidRsuTest.java b/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidRsuTest.java index 6d7dc5b99..bf3f5c61d 100644 --- a/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidRsuTest.java +++ b/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidRsuTest.java @@ -42,7 +42,7 @@ public void missingProperties() { "/mapping/invalid/rsu/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/rsus/0] The object must have a property whose name is \"position\"")); + assertTrue(e.getMessage().contains("$.rsus[0]: required property 'position' not found")); } assertNull(mapping); } diff --git a/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidVehicleTest.java b/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidVehicleTest.java index ef7a7f920..7bee53bd5 100644 --- a/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidVehicleTest.java +++ b/fed/mosaic-mapping/src/test/java/org/eclipse/mosaic/fed/mapping/config/InvalidVehicleTest.java @@ -41,7 +41,7 @@ public void missingProperties() { "/mapping/invalid/vehicle/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("Exactly one of the following sets of problems must be resolved.")); + assertTrue(e.getMessage().contains("$.vehicles[0]: should be valid to one and only one schema, but 0 are valid")); } assertNull(mapping); } @@ -57,7 +57,7 @@ public void emptyTypes() { "/mapping/invalid/vehicle/type/EmptyTypes.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/vehicles/0/types] The array must have at least 1 element(s), but actual number is 0.")); + assertTrue(e.getMessage().contains("$.vehicles[0].types: expected at least 1 items but found 0")); } assertNull(mapping); } @@ -75,7 +75,7 @@ public void missingTypesItemProperties() { "/mapping/invalid/vehicle/type/EmptyTypesItem.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/vehicles/0/types/0] The object must have a property whose name is \"name\"")); + assertTrue(e.getMessage().contains("$.vehicles[0].types[0]: required property 'name' not found")); } assertNull(mapping); } @@ -94,9 +94,9 @@ public void missingOriginProperties() { "/mapping/invalid/vehicle/origin/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/vehicles/0/origin] The object must have a property whose name is \"radius\"")); - assertTrue(e.getMessage().contains("[/vehicles/0/origin] The object must have a property whose name is \"center\"")); - assertTrue(e.getMessage().contains("Exactly one of the following sets of problems must be resolved.")); + assertTrue(e.getMessage().contains("$.vehicles[0].origin: required property 'radius' not found")); + assertTrue(e.getMessage().contains("$.vehicles[0].origin: required property 'center' not found")); + assertTrue(e.getMessage().contains("$.vehicles[0]: should be valid to one and only one schema, but 0 are valid")); } assertNull(mapping); } @@ -115,9 +115,9 @@ public void missingOriginCenterProperties() { "/mapping/invalid/vehicle/origin/center/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/vehicles/0/origin/center] The object must have a property whose name is \"longitude\"")); - assertTrue(e.getMessage().contains("[/vehicles/0/origin/center] The object must have a property whose name is \"latitude\"")); - assertTrue(e.getMessage().contains("Exactly one of the following sets of problems must be resolved.")); + assertTrue(e.getMessage().contains("$.vehicles[0].origin.center: required property 'longitude' not found")); + assertTrue(e.getMessage().contains("$.vehicles[0].origin.center: required property 'latitude' not found")); + assertTrue(e.getMessage().contains("$.vehicles[0]: should be valid to one and only one schema, but 0 are valid")); } assertNull(mapping); } @@ -136,9 +136,9 @@ public void missingDestinationProperties() { "/mapping/invalid/vehicle/destination/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/vehicles/0/destination] The object must have a property whose name is \"radius\"")); - assertTrue(e.getMessage().contains("[/vehicles/0/destination] The object must have a property whose name is \"center\"")); - assertTrue(e.getMessage().contains("Exactly one of the following sets of problems must be resolved.")); + assertTrue(e.getMessage().contains("$.vehicles[0].destination: required property 'radius' not found")); + assertTrue(e.getMessage().contains("$.vehicles[0].destination: required property 'center' not found")); + assertTrue(e.getMessage().contains("$.vehicles[0]: should be valid to one and only one schema, but 0 are valid")); } assertNull(mapping); } @@ -157,9 +157,10 @@ public void missingDestinationCenterProperties() { "/mapping/invalid/vehicle/destination/center/MissingProperties.json" )); } catch (InstantiationException e) { - assertTrue(e.getMessage().contains("[/vehicles/0/destination/center] The object must have a property whose name is \"longitude\"")); - assertTrue(e.getMessage().contains("[/vehicles/0/destination/center] The object must have a property whose name is \"latitude\"")); - assertTrue(e.getMessage().contains("Exactly one of the following sets of problems must be resolved.")); + e.printStackTrace(); + assertTrue(e.getMessage().contains("$.vehicles[0].destination.center: required property 'longitude' not found")); + assertTrue(e.getMessage().contains("$.vehicles[0].destination.center: required property 'latitude' not found")); + assertTrue(e.getMessage().contains("$.vehicles[0]: should be valid to one and only one schema, but 0 are valid")); } assertNull(mapping); } diff --git a/fed/mosaic-sns/src/test/java/org/eclipse/mosaic/fed/sns/config/CSnsTest.java b/fed/mosaic-sns/src/test/java/org/eclipse/mosaic/fed/sns/config/CSnsTest.java index bef035642..73cf4b84b 100644 --- a/fed/mosaic-sns/src/test/java/org/eclipse/mosaic/fed/sns/config/CSnsTest.java +++ b/fed/mosaic-sns/src/test/java/org/eclipse/mosaic/fed/sns/config/CSnsTest.java @@ -95,7 +95,7 @@ public void readInvalidConfigWithWrongDelay_assertExceptions() { fail("Expected InstantiationException"); } catch (JsonParseException | InstantiationException e) { String message = e.getMessage(); - assertThat(message, startsWith("The CSns config is not valid: Exactly one of the following sets of problems must be resolved")); + assertThat(message, startsWith("The CSns config is not valid: $.singlehopDelay: should be valid to one and only one schema, but 0 are valid")); } } diff --git a/fed/mosaic-sumo/src/test/java/org/eclipse/mosaic/fed/sumo/config/CSumoTest.java b/fed/mosaic-sumo/src/test/java/org/eclipse/mosaic/fed/sumo/config/CSumoTest.java index 6e31c51ed..f726619d9 100644 --- a/fed/mosaic-sumo/src/test/java/org/eclipse/mosaic/fed/sumo/config/CSumoTest.java +++ b/fed/mosaic-sumo/src/test/java/org/eclipse/mosaic/fed/sumo/config/CSumoTest.java @@ -73,8 +73,7 @@ public void readInvalidConfig_assertExceptions() { assertThat( instantiationException.getMessage(), startsWith( - "The CSumo config is not valid: [7,31][/additionalVehicleTypeParameters/car/carFollowModel]" - + " The value must be of string type, but actual type is integer." + "The CSumo config is not valid: $.additionalVehicleTypeParameters.car.carFollowModel: integer found, string expected" ) ); // checking that proper Exception is thrown } diff --git a/legal/templates/licenses-merge-file b/legal/templates/licenses-merge-file index d6bac264e..82c61b6f0 100644 --- a/legal/templates/licenses-merge-file +++ b/legal/templates/licenses-merge-file @@ -1,33 +1,12 @@ -Apache-2.0|The Apache Software License, Version 2.0 -Apache-2.0|Apache License, Version 2.0 -Apache-2.0|Apache Public License 2.0 -Apache-2.0|The Apache License, Version 2.0 -Apache-2.0|Apache License 2.0 -Apache-2.0|Apache 2 -Apache-2.0|Apache 2.0 -Apache-2.0|ASL 2.0 -Apache-2.0|ASL, version 2 -Apache-2.0|Apache -Apache-2.0|the Apache License, ASL Version 2.0 -Apache-2.0|APL2 -EDl-1.0|Eclipse Distribution License - v 1.0 -EPL-1.0|Eclipse Public License - v 1.0 -EPL-1.0|Eclipse Public License 1.0 -EPL-1.0|Eclipse Public License - Version 1.0 -EPL-2.0|Eclipse Public License - Version 2.0 -EPL-2.0|Eclipse Public License - v 2.0 -BSD-3-Clause|BSD-style -BSD-3-Clause|BSD -BSD-3-Clause|BSD 3-clause -BSD-3-Clause|BSD 3-Clause -BSD-3-Clause|New BSD License -BSD-3-Clause|The BSD 3-Clause License -BSD-2-Clause|BSD 2-Clause License -GPL-2.0|GNU General Public License (GPL), version 2, with the Classpath exception -GPL-2.0|GPL v2 -LGPL-2.1|GNU Lesser General Public License -MIT|MIT license -MIT|MIT License -MIT|The MIT License -CC0|Public Domain, per Creative Commons CC0 -MPL-2.0|Mozilla Public License, Version 2.0 \ No newline at end of file +Apache-2.0|The Apache License, Version 2.0|Apache License|Apache License Version 2|Apache License Version 2.0|Apache Software License - Version 2.0|Apache 2.0 License|Apache License 2.0|ASL|Apache 2|Apache 2.0|the Apache License, ASL Version 2.0|The Apache Software License, Version 2.0|Apache License, Version 2.0|Apache Public License 2.0|ASF 2.0|Apache License v2.0|Apache V2 +BSD-2-Clause|Two-clause BSD-style license +BSD-3-Clause|BSD|The BSD 3-Clause License|The BSD License|Modified BSD License|New BSD License|New BSD license|BSD License|BSD license|BSD licence|BSD New|The New BSD License|BSD 3-Clause|BSD 3-clause|3-Clause BSD License|Revised BSD +BSD-3-Clause (Eclipse Distribution License)|Eclipse Distribution License 1.0|Eclipse Distribution License - v 1.0 +CDDL|CDDL+GPL|CDDL+GPL License|CDDL + GPLv2 with classpath exception|CDDL/GPLv2+CE|CDDL License|CDDL 1.0|CDDL 1.1|COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0|Common Development and Distribution License (CDDL) v1.0 +EPL-1.0|Eclipse Public License - v 1.0|Eclipse Public License 1.0|Eclipse Public License - Version 1.0|Eclipse Public License +EPL-2.0|Eclipse Public License - v 2.0|Eclipse Public License 2.0|Eclipse Public License - Version 2.0 +GPL-2.0-with-classpath-exception|GPL2 w/ CPE|GPLv2+CE|GNU General Public Library|GNU General Public License, version 2 with the GNU Classpath Exception|GPLv2 license, includes the CLASSPATH exception +GPL-2.0-or-later|GNU General Public License, version 2 or later +LGPL-2.1|LGPL 2.1|LGPL, version 2.1|GNU Library or Lesser General Public License (LGPL) V2.1|GNU Lesser General Public License (LGPL), Version 2.1|GNU Lesser General Public License, Version 2.1|GNU Lesser General Public License|GNU Lesser General Public Licence|GNU Lesser Public License|GNU Lesser General Public License, Version 2.1, February 1999 +MIT|MIT License|MIT license|The MIT License|The MIT License(MIT) +Zlib diff --git a/lib/mosaic-network/src/main/java/org/eclipse/mosaic/lib/coupling/ClientServerChannel.java b/lib/mosaic-network/src/main/java/org/eclipse/mosaic/lib/coupling/ClientServerChannel.java index a863eee14..abe356f4f 100644 --- a/lib/mosaic-network/src/main/java/org/eclipse/mosaic/lib/coupling/ClientServerChannel.java +++ b/lib/mosaic-network/src/main/java/org/eclipse/mosaic/lib/coupling/ClientServerChannel.java @@ -378,6 +378,7 @@ public int writeRemoveNodesMessage(long time, List ids) throws IOExcept } // @param channelId the channelID //TODO:make enum from + /** * Write send message header to stream. * Not used in eWorld visualizer. @@ -406,7 +407,7 @@ public int writeSendMessage(long time, int srcNodeId, //builder for rectangular addresses rectangleAddress.setIpAddress(buffer.getInt()); //write the ip address as flat integer into the builder //convert coordinates etc. - CartesianRectangle projectedRectangle = ((GeoRectangle)dac.getGeoArea()).toCartesian(); + CartesianRectangle projectedRectangle = ((GeoRectangle) dac.getGeoArea()).toCartesian(); //write the coordinates of the area into the builder rectangleAddress.setAX(projectedRectangle.getA().getX()); rectangleAddress.setAY(projectedRectangle.getA().getY()); @@ -418,7 +419,7 @@ public int writeSendMessage(long time, int srcNodeId, SendMessageMessage.GeoCircleAddress.Builder circleAddress = SendMessageMessage.GeoCircleAddress.newBuilder(); circleAddress.setIpAddress(buffer.getInt()); - CartesianCircle projectedCircle = ((GeoCircle)dac.getGeoArea()).toCartesian(); + CartesianCircle projectedCircle = ((GeoCircle) dac.getGeoArea()).toCartesian(); //write area into the address object circleAddress.setCenterX(projectedCircle.getCenter().getX()); circleAddress.setCenterY(projectedCircle.getCenter().getY()); @@ -428,7 +429,7 @@ public int writeSendMessage(long time, int srcNodeId, } else { throw new IllegalArgumentException("Addressing does support GeoCircle and GeoRectangle only."); } - } else if (dac.getTimeToLive() > -1){ //Topocast addresses + } else if (dac.getTimeToLive() > -1) { //Topocast addresses SendMessageMessage.TopoAddress.Builder topoAddress = SendMessageMessage.TopoAddress.newBuilder(); topoAddress.setIpAddress(buffer.getInt()); //Add IP as flat int topoAddress.setTtl(dac.getTimeToLive()); //add time to live diff --git a/lib/mosaic-utils/pom.xml b/lib/mosaic-utils/pom.xml index 8f737f61b..53b0c1626 100644 --- a/lib/mosaic-utils/pom.xml +++ b/lib/mosaic-utils/pom.xml @@ -47,19 +47,8 @@ commons-cli - org.leadpony.justify - justify - - - com.ibm.icu - icu4j - - - - - org.apache.johnzon - johnzon-core - compile + com.networknt + json-schema-validator diff --git a/lib/mosaic-utils/src/main/java/org/eclipse/mosaic/lib/util/objects/ObjectInstantiation.java b/lib/mosaic-utils/src/main/java/org/eclipse/mosaic/lib/util/objects/ObjectInstantiation.java index 58b693f1f..b45dcf03c 100644 --- a/lib/mosaic-utils/src/main/java/org/eclipse/mosaic/lib/util/objects/ObjectInstantiation.java +++ b/lib/mosaic-utils/src/main/java/org/eclipse/mosaic/lib/util/objects/ObjectInstantiation.java @@ -15,12 +15,16 @@ package org.eclipse.mosaic.lib.util.objects; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.MissingNode; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.stream.JsonReader; -import org.leadpony.justify.api.JsonSchema; -import org.leadpony.justify.api.JsonValidationService; -import org.leadpony.justify.api.ProblemHandler; +import com.networknt.schema.JsonSchema; +import com.networknt.schema.JsonSchemaFactory; +import com.networknt.schema.SpecVersion; +import com.networknt.schema.ValidationMessage; import org.slf4j.Logger; import java.io.ByteArrayInputStream; @@ -34,10 +38,9 @@ import java.io.Reader; import java.lang.reflect.InvocationTargetException; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; +import java.util.Collection; +import java.util.Locale; import javax.annotation.Nonnull; -import javax.json.stream.JsonParser; /** * Instantiate Java objects using a file contains a JSON encoded object. @@ -166,14 +169,10 @@ public T read(InputStream inputStream, @Nonnull GsonBuilder gsonBuilder) throws } private T handleParserResult(T obj) throws InstantiationException { - if (obj != null) { - debug("File has been loaded into the destination object."); - } else { - obj = createWithDefaultDefaultConstructor(); - if (obj == null) { - throw new InstantiationException("Could not read or instantiate the object."); - } + if (obj == null) { + return createWithDefaultDefaultConstructor(); } + debug("File has been loaded into the destination object."); return obj; } @@ -201,7 +200,6 @@ private T createWithDefaultDefaultConstructor() throws InstantiationException { debug("Object instantiated using the default constructor."); return obj; } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { - throw new InstantiationException(e.getMessage()); } } @@ -221,25 +219,29 @@ private String shorten(String json, int maxLength) { } private void validateFile(InputStream input, InputStream schemaInput) throws InstantiationException { - final JsonValidationService service = JsonValidationService.newInstance(); - final JsonSchema schema = service.readSchema(schemaInput); - - final List problems = new ArrayList<>(); - final ProblemHandler handler = service.createProblemPrinter(problems::add); + final Locale defaultLocale = Locale.getDefault(); + try { + Locale.setDefault(Locale.ENGLISH); + final JsonSchemaFactory factory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7); + final JsonSchema jsonSchema = factory.getSchema(schemaInput); + final JsonNode json = new ObjectMapper().readTree(input); + if (json instanceof MissingNode) { + return; + } - try (JsonParser parser = service.createParser(input, schema, handler)) { - while (parser.hasNext()) { - parser.next(); - // ignore, we let GSON do the parsing later. + final Collection problems = jsonSchema.validate(json); + if (!problems.isEmpty()) { + StringBuilder errorMessage = new StringBuilder(); + problems.forEach((p) -> { + errorMessage.append(p.getMessage()); + errorMessage.append(NEWLINE); + }); + throw new InstantiationException("The " + clazz.getSimpleName() + " config is not valid: " + errorMessage); } - } - if (!problems.isEmpty()) { - StringBuilder errorMessage = new StringBuilder(); - problems.forEach((p) -> { - errorMessage.append(p); - errorMessage.append(NEWLINE); - }); - throw new InstantiationException("The " + clazz.getSimpleName() + " config is not valid: " + errorMessage); + } catch (IOException e) { + throw new InstantiationException("The input JSON is not valid: " + e.getMessage()); + } finally { + Locale.setDefault(defaultLocale); } } diff --git a/pom.xml b/pom.xml index 4ad71cdcf..76840c08a 100644 --- a/pom.xml +++ b/pom.xml @@ -84,12 +84,12 @@ 11 true true - 1.4 + 1.6.0 2.5 - 2.6 + 2.15.0 1.3 - 3.13.0 - 1.2 + 3.14.0 + 1.3.0 3.6.1 1.6 1.3.9-1 @@ -97,21 +97,23 @@ 2.10.1 32.1.1-jre 0.8.1 - 1.19.0 - 2.15.0 + 2.16.1 1.3.9 2.7.5 1.1.13 0.1.51 + 1.3.1 + 1.19.0 4.13.2 1.1.0 1.3.8 + 3.1.11 + 0.2.16 + 1.5.0 5.6.0 - 3.8.0 - 2.0.9 + 3.23.2 + 2.0.12 3.42.0.0 - 4.2.1 - 5.1.0 1.18.0 @@ -160,6 +162,12 @@ org.codehaus.janino janino ${version.janino} + + + org.apache.ant + ant + + @@ -225,7 +233,7 @@ ${version.commons-configuration2} - + commons-logging commons-logging ${version.commons-logging} @@ -262,69 +270,43 @@ ${version.commons-io} + - - org.leadpony.justify - justify - ${version.justify} + com.networknt + json-schema-validator + ${version.json-schema-validator} - com.ibm.icu - icu4j + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml - - - org.apache.johnzon - johnzon-core - ${version.johnzon-core} - + - - com.jcraft - jsch - ${version.jsch} - - - - - org.xerial - sqlite-jdbc - ${version.sqlite-jdbc} - - - com.fasterxml.jackson.core jackson-core ${version.jackson} - com.fasterxml.jackson.core jackson-databind ${version.jackson} + - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${version.jackson} - - - - org.codehaus.woodstox - stax2-api - - ${version.stax2-api} + + com.github.mwiede + jsch + ${version.jsch} + - - com.fasterxml.woodstox - woodstox-core-asl - - ${version.woodstox-core} + + org.xerial + sqlite-jdbc + ${version.sqlite-jdbc} @@ -359,6 +341,14 @@ org.apache.xmlgraphics xmlgraphics-commons + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + @@ -685,16 +675,13 @@ LICENSE - - parent.dir - org.codehaus.mojo license-maven-plugin - 2.1.0 + 2.4.0 false @@ -710,7 +697,7 @@ true NOTICE-THIRD-PARTY.md ${parent.dir}/legal/templates/third-party-file.ftl - ${parent.dir}/legal/templates/licenses-merges-file + file:///${parent.dir}/legal/templates/licenses-merge-file ${parent.dir}/legal/templates/missing-licenses.properties @@ -724,17 +711,14 @@ LICENSE - - - parent.dir - + org.codehaus.mojo license-maven-plugin - 2.1.0 + 2.4.0 false @@ -751,7 +735,7 @@ true NOTICE-THIRD-PARTY.md ${parent.dir}/legal/templates/third-party-file.ftl - ${parent.dir}/legal/templates/licenses-merges-file + file:///${parent.dir}/legal/templates/licenses-merge-file ${parent.dir}/legal/templates/missing-licenses.properties diff --git a/rti/mosaic-rti-core/pom.xml b/rti/mosaic-rti-core/pom.xml index 9896e8fbf..58ad3f890 100644 --- a/rti/mosaic-rti-core/pom.xml +++ b/rti/mosaic-rti-core/pom.xml @@ -33,7 +33,7 @@ logback-classic - com.jcraft + com.github.mwiede jsch diff --git a/rti/mosaic-starter/pom.xml b/rti/mosaic-starter/pom.xml index d29a60f06..a97a672e3 100644 --- a/rti/mosaic-starter/pom.xml +++ b/rti/mosaic-starter/pom.xml @@ -26,11 +26,6 @@ logback-core - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - - org.eclipse.mosaic mosaic-rti-api diff --git a/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/MosaicStarter.java b/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/MosaicStarter.java index 364c555cf..439c87d84 100644 --- a/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/MosaicStarter.java +++ b/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/MosaicStarter.java @@ -24,7 +24,9 @@ import org.eclipse.mosaic.starter.config.CRuntime; import org.eclipse.mosaic.starter.config.CScenario; +import ch.qos.logback.classic.Level; import ch.qos.logback.classic.LoggerContext; +import com.networknt.schema.JsonValidator; import org.apache.commons.cli.ParseException; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.SystemUtils; @@ -97,6 +99,8 @@ public void execute(String[] arguments) throws ExecutionException { final Path scenarioConfigurationFile = findScenarioConfigurationFile(params); final Path scenarioDirectory = extractScenarioDirectory(scenarioConfigurationFile); + disableLoggingOfJsonValidation(); + final Path runtimeConfigurationFile = params.runtimeConfiguration != null ? Paths.get(params.runtimeConfiguration) : RUNTIME_CONFIG; final CRuntime runtimeConfiguration = loadRuntimeConfiguration(runtimeConfigurationFile); @@ -191,6 +195,14 @@ private Path extractScenarioDirectory(Path scenarioConfigurationFile) throws Exe return parent; } + /** + * Disables logging of JSON Schema Validation. This is required for any JSON loading (e.g. CRuntime), before configuring logback with + * a logback.xml. + */ + private void disableLoggingOfJsonValidation() { + ((ch.qos.logback.classic.Logger) LoggerFactory.getLogger(JsonValidator.class.getPackageName())).setLevel(Level.OFF); + } + protected CHosts loadHostsConfiguration(Path hostConfigurationFile) { final CHosts hostConfiguration = loadJsonConfiguration(hostConfigurationFile, new CHosts()); if (hostConfiguration.localHosts.isEmpty()) { diff --git a/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/config/CRuntime.java b/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/config/CRuntime.java index f6d861697..58b7fc972 100644 --- a/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/config/CRuntime.java +++ b/rti/mosaic-starter/src/main/java/org/eclipse/mosaic/starter/config/CRuntime.java @@ -17,14 +17,9 @@ import org.eclipse.mosaic.rti.api.parameters.FederatePriority; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - import java.util.ArrayList; import java.util.List; -@JacksonXmlRootElement(localName = "configuration") public class CRuntime { /** @@ -39,24 +34,18 @@ public class CRuntime { public int threads = 1; - @JacksonXmlElementWrapper(localName = "federates") - @JacksonXmlProperty(localName = "federate") public List federates = new ArrayList<>(); public static class CFederate { public String id; - @JacksonXmlProperty(localName = "class", isAttribute = true) public String classname; - @JacksonXmlProperty(localName = "config") public String configuration; - @JacksonXmlProperty(localName = "configDeployPath") public String configurationDeployPath; - @JacksonXmlProperty(localName = "priority", isAttribute = true) public byte priority = FederatePriority.DEFAULT; public String dockerImage; @@ -67,16 +56,11 @@ public static class CFederate { public boolean deploy = false; public boolean start = false; - @JacksonXmlElementWrapper(localName = "subscriptions") - @JacksonXmlProperty(localName = "subscription") public List subscriptions = new ArrayList<>(); - @JacksonXmlProperty(localName = "customJavaArgument") public String javaCustomArgument; public Integer javaMemorySizeXmx; - @JacksonXmlElementWrapper(localName = "javaClasspathEntries") - @JacksonXmlProperty(localName = "classpath") public List javaClasspathEntries = new ArrayList<>(); } diff --git a/rti/mosaic-starter/src/test/resources/logback-test.xml b/rti/mosaic-starter/src/test/resources/logback-test.xml index 90865a640..08cad1f21 100644 --- a/rti/mosaic-starter/src/test/resources/logback-test.xml +++ b/rti/mosaic-starter/src/test/resources/logback-test.xml @@ -1,5 +1,7 @@ + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n diff --git a/test/mosaic-integration-tests/src/test/java/org/eclipse/mosaic/test/junit/MosaicSimulationRule.java b/test/mosaic-integration-tests/src/test/java/org/eclipse/mosaic/test/junit/MosaicSimulationRule.java index 3c7dd85b7..cb1a741ba 100644 --- a/test/mosaic-integration-tests/src/test/java/org/eclipse/mosaic/test/junit/MosaicSimulationRule.java +++ b/test/mosaic-integration-tests/src/test/java/org/eclipse/mosaic/test/junit/MosaicSimulationRule.java @@ -33,7 +33,6 @@ import com.google.common.base.Charsets; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; -import org.codehaus.janino.util.Producer; import org.junit.rules.TemporaryFolder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -60,6 +59,7 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; +import java.util.function.Supplier; public class MosaicSimulationRule extends TemporaryFolder { @@ -312,9 +312,9 @@ protected void resetSingletons() { * @return the object the given {@link Callable} produced if the timeout has not been exceeded. * @throws AssertionError if the timeout has exceeded. */ - private MosaicSimulation.SimulationResult timeout(Producer execution) { + private MosaicSimulation.SimulationResult timeout(Supplier execution) { ExecutorService executor = Executors.newCachedThreadPool(); - Future future = executor.submit(() -> (MosaicSimulation.SimulationResult) execution.produce()); + Future future = executor.submit(execution::get); try { return future.get(this.timeout, TimeUnit.NANOSECONDS); } catch (Throwable e) {