Spring Boot 2.0 (#721)

* Migration to Boot 2.0.

Signed-off-by: Kai Zimmermann <kai.zimmermann@microsoft.com>
This commit is contained in:
Kai Zimmermann
2019-01-31 07:29:27 +01:00
committed by GitHub
parent b42b009f9e
commit d52a720480
263 changed files with 2874 additions and 2692 deletions

View File

@@ -54,7 +54,7 @@
|org.apache.tomcat|tomcat-juli|8.0.28| [CQ10618](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10618) |
|org.flywaydb|flyway-core|4.0.3| [CQ12947](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12947) |
|org.glassfish|javax.json|1.0.4| [CQ10619](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10619) |
|org.hibernate|hibernate-validator|6.0.7.Final| [CQ15540](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=15540) |
|org.hibernate.validator|hibernate-validator|6.0.7.Final| [CQ15540](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=15540) |
|org.jboss.logging|jboss-logging|3.2.1.Final| [CQ10621](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10621) |
|org.jsoup|jsoup|1.8.3| [CQ12936](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12936) |
|org.ow2.asm|asm-commons|5.0.1| [CQ12945](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12945) |

198
.3rd-party/Release_0_3_0.md vendored Normal file
View File

@@ -0,0 +1,198 @@
# 3rd party dependencies for Release 0.3.0
## Eclipse CQs - Provided/compile
| Group ID | Artifact ID | Version | CQ |
| ------------------------------------ | ------------------------------ | -------------- | ---------------------------------------------------------------- |
| ch.qos.logback | logback-classic | 1.2.3 | [CQ17369](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=17369) |
| ch.qos.logback | logback-core | 1.2.3 | [CQ17370](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=17370) |
| com.cronutils | cron-utils | 5.0.5 | [CQ15762](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=15762) |
| com.esotericsoftware | kryo-shaded | 3.0.3 | [CQ17372](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=17372) |
| com.esotericsoftware | minlog | 1.3.0 | [CQ17371](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=17371) |
| com.fasterxml | classmate | 1.3.4 | [CQ10239](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10239) |
| com.fasterxml.jackson.core | jackson-annotations | 2.9.0 | [CQ18146](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18146) |
| com.fasterxml.jackson.core | jackson-core | 2.9.7 | [CQ18147](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18147) |
| com.fasterxml.jackson.core | jackson-databind | 2.9.7 | [CQ18145](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18145) |
| com.github.ben-manes.caffeine | caffeine | 2.6.2 | [CQ17377](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=17377) |
| com.github.gwtd3 | gwt-d3-api | 1.2.0 | [CQ13029](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=13029) |
| com.github.gwtd3 | gwt-d3-js | 3.5.11 | [CQ13030](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=13030) |
| com.google.guava | guava | 25.0-jre | [CQ16201](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=16201) |
| com.h2database | h2 | 1.4.197 | [CQ10365](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10365) |
| com.microsoft.sqlserver | mssql-jdbc | 6.4.0 | [CQ15896](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=15896) |
| commons-io | commons-io | 2.5 | [CQ17374](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=17374) |
| com.rabbitmq | amqp-client | 5.4.3 | [CQ18173](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18173) |
| com.vaadin.external.atmosphere | atmosphere-runtime | 2.2.9.vaadin2 | [CQ10714](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10714) |
| com.vaadin.external.flute | flute | 1.3.0.gg2 | [CQ11039](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=11039) |
| com.vaadin.external.gwt | gwt-elemental | 2.7.0.vaadin4 | [CQ13031](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=13031) |
| com.vaadin.external.gwt | gwt-user | 2.7.0.vaadin4 | [CQ13033](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=13033) |
| com.vaadin.external.slf4j | vaadin-slf4j-jdk14 | 1.6.1 | [CQ10715](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10715) |
| com.vaadin | vaadin-client | 7.7.7 | [CQ12956](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12956) |
| com.vaadin | vaadin-push | 7.7.7 | [CQ12957](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12957) |
| com.vaadin | vaadin-sass-compiler | 0.9.12 | [CQ12958](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12958) |
| com.vaadin | vaadin-server | 7.7.7 | [CQ12959](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12959) |
| com.vaadin | vaadin-shared | 7.7.7 | [CQ12960](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12960) |
| com.vaadin | vaadin-spring-boot | 1.2.0 | [CQ18180](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18180) |
| com.vaadin | vaadin-spring | 1.2.0 | [CQ18181](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18181) |
| com.vaadin | vaadin-themes | 7.7.7 | [CQ12961](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12961) |
| com.zaxxer | HikariCP | 3.2.0 | [CQ18175](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18175) |
| cz.jirutka.rsql | rsql-parser | 2.1.0 | [CQ12964](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12964) |
| io.projectreactor | reactor-core | 3.2.2.RELEASE | [CQ18176](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18176) |
| io.protostuff | protostuff-api | 1.5.6 | [CQ12965](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12965) |
| io.protostuff | protostuff-collectionschema | 1.5.6 | [CQ12966](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12966) |
| io.protostuff | protostuff-core | 1.5.6 | [CQ12967](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12967) |
| io.protostuff | protostuff-runtime | 1.5.6 | [CQ12968](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12968) |
| javax.annotation | javax.annotation-api | 1.3.2 | [CQ17375](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=17375) |
| org.glassfish | javax.json | 1.0.4 | [CQ10619](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10619) |
| javax.servlet | javax.servlet-api | 4.0.1 | [CQ18011](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18011) |
| javax.transaction | javax.transaction-api | 1.3 | [CQ18178](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18178) |
| javax.validation | validation-api | 2.0.1.Final | [CQ18177](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18177) |
| javax.websocket | javax.websocket-api | 1.1 | [CQ16449](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=16449) |
| org.apache.commons | commons-lang3 | 3.7 | [CQ18140](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18140) |
| org.flywaydb | flyway-core | 5.2.1 | [CQ18182](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18182) |
| org.hibernate.validator | hibernate-validator | 6.0.13.Final | [CQ15540](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=15540) |
| org.jboss.logging | jboss-logging | 3.3.2.Final | [CQ10621](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10621) |
| org.jsoup | jsoup | 1.8.3 | [CQ12936](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12936) |
| org.mortbay.jasper | apache-el | 8.5.33 | [CQ18233](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18233) |
| org.ow2.asm | asm-analysis | 6.2 | [CQ18183](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18183) |
| org.ow2.asm | asm-commons | 6.2 | [CQ18183](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18183) |
| org.ow2.asm | asm | 6.2 | [CQ18183](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18183) |
| org.ow2.asm | asm-tree | 6.2 | [CQ18183](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18183) |
| org.reactivestreams | reactive-streams | 1.0.2 | [CQ18184](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18184) |
| org.slf4j | jul-to-slf4j | 1.7.25 | [CQ12937](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12937) |
| org.slf4j | slf4j-api | 1.7.25 | [CQ12940](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12940) |
| org.springframework.amqp | spring-amqp | 2.1.0.RELEASE | [CQ18141](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18141) |
| org.springframework.amqp | spring-rabbit | 2.1.0.RELEASE | [CQ18142](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18142) |
| org.springframework.boot | spring-boot-autoconfigure | 2.1.0.RELEASE | [CQ18143](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18143) |
| org.springframework.boot | spring-boot | 2.1.0.RELEASE | [CQ18192](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18192) |
| org.springframework.boot | spring-boot-starter-aop | 2.1.0.RELEASE | [CQ18198](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18198) |
| org.springframework.boot | spring-boot-starter-data-jpa | 2.1.0.RELEASE | [CQ18200](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18200) |
| org.springframework.boot | spring-boot-starter | 2.1.0.RELEASE | [CQ18204](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18204) |
| org.springframework.boot | spring-boot-starter-jdbc | 2.1.0.RELEASE | [CQ18205](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18205) |
| org.springframework.boot | spring-boot-starter-jetty | 2.1.0.RELEASE | [CQ18206](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18206) |
| org.springframework.boot | spring-boot-starter-json | 2.1.0.RELEASE | [CQ18209](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18209) |
| org.springframework.boot | spring-boot-starter-logging | 2.1.0.RELEASE | [CQ18210](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18210) |
| org.springframework.boot | spring-boot-starter-validation | 2.1.0.RELEASE | [CQ18211](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18211) |
| org.springframework.boot | spring-boot-starter-web | 2.1.0.RELEASE | [CQ18212](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18212) |
| org.springframework.cloud | spring-cloud-bus | 2.1.0.RELEASE | [CQ18799](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18799) |
| org.springframework.cloud | spring-cloud-commons | 2.1.0.RELEASE | [CQ18800](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18800) |
| org.springframework.cloud | spring-cloud-context | 2.1.0.RELEASE | [CQ18801](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18801) |
| org.springframework.cloud | spring-cloud-stream | 2.1.0.RELEASE | [CQ18802](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18802) |
| org.springframework.data | spring-data-commons | 2.1.2.RELEASE | [CQ18213](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18213) |
| org.springframework.data | spring-data-jpa | 2.1.2.RELEASE | [CQ18214](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18214) |
| org.springframework.hateoas | spring-hateoas | 0.25.0.RELEASE | [CQ18228](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18228) |
| org.springframework.integration | spring-integration-core | 5.1.0.RELEASE | [CQ18229](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18229) |
| org.springframework.integration | spring-integration-jmx | 5.1.0.RELEASE | [CQ18230](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18230) |
| org.springframework.integration | spring-integration-tuple | 1.0.0.RELEASE | [CQ12996](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12996) |
| org.springframework.plugin | spring-plugin-core | 1.2.0.RELEASE | [CQ12997](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12997) |
| org.springframework.retry | spring-retry | 1.2.2.RELEASE | [CQ18231](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18231) |
| org.springframework.security | spring-security-aspects | 5.1.1.RELEASE | [CQ18350](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18350) |
| org.springframework.security | spring-security-config | 5.1.1.RELEASE | [CQ18351](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18351) |
| org.springframework.security | spring-security-core | 5.1.1.RELEASE | [CQ18352](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18352) |
| org.springframework.security | spring-security-crypto | 5.1.1.RELEASE | [CQ18353](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18353) |
| org.springframework.security | spring-security-web | 5.1.1.RELEASE | [CQ18354](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18354) |
| org.springframework | spring-aop | 5.1.2.RELEASE | [CQ18355](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18355) |
| org.springframework | spring-aspects | 5.1.2.RELEASE | [CQ18356](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18356) |
| org.springframework | spring-beans | 5.1.2.RELEASE | [CQ18357](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18357) |
| org.springframework | spring-context | 5.1.2.RELEASE | [CQ18358](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18358) |
| org.springframework | spring-context-support | 5.1.2.RELEASE | [CQ18359](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18359) |
| org.springframework | spring-core | 5.1.2.RELEASE | [CQ18360](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18360) |
| org.springframework | spring-expression | 5.1.2.RELEASE | [CQ18361](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18361) |
| org.springframework | spring-jcl | 5.1.2.RELEASE | [CQ18362](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18362) |
| org.springframework | spring-jdbc | 5.1.2.RELEASE | [CQ18363](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18363) |
| org.springframework | spring-messaging | 5.1.2.RELEASE | [CQ18364](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18364) |
| org.springframework | spring-orm | 5.1.2.RELEASE | [CQ18365](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18365) |
| org.springframework | spring-tuple | 1.0.0.RELEASE | [CQ12998](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12998) |
| org.springframework | spring-tx | 5.1.2.RELEASE | [CQ18366](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18366) |
| org.springframework | spring-web | 5.1.2.RELEASE | [CQ18367](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18367) |
| org.springframework | spring-webmvc | 5.1.2.RELEASE | [CQ18368](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18368) |
| org.vaadin.addons.lazyquerycontainer | vaadin-lazyquerycontainer | 7.6.1.3 | [CQ13025](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=13025) |
| org.vaadin.addons | flexibleoptiongroup | 2.2.0 | [CQ11050](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=11050) |
| org.vaadin.addons | tokenfield | 7.0.1 | [CQ11051](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=11051) |
| org.vaadin.alump.distributionbar | dbar-addon | 2.0.0 | [CQ13026](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=13026) |
| org.vaadin.spring.addons | vaadin-spring-addon-eventbus | 0.0.6.RELEASE | [CQ11047](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=11047) |
| org.vaadin.spring.extensions | vaadin-spring-ext-core | 0.0.6.RELEASE | [CQ11048](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=11048) |
| org.vaadin.spring.extensions | vaadin-spring-ext-security | 0.0.6.RELEASE | [CQ11049](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=11049) |
| org.w3c.css | sac | 1.3 | [CQ11052](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=11052) |
## Test and build dependencies
CQ: [CQ18804](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=18804)
| Group ID | Artifact ID | Version |
| ------------------------------- | -------------------------------- | -------------------- |
| ant | ant | 1.6.5 |
| colt | colt | 1.2.0 |
| com.fasterxml.jackson.module | jackson-module-jaxb-annotations | 2.9.8 |
| com.google.code.gson | gson | 2.8.5 |
| com.google.gwt.gwtmockito | gwtmockito | 1.1.8 |
| com.google.gwt | gwt-dev | 2.8.0 |
| com.google.gwt | gwt-user | 2.8.0 |
| com.google.jsinterop | jsinterop-annotations | 1.0.1 |
| com.google.jsinterop | jsinterop-annotations | sources |
| com.ibm.icu | icu4j | 50.1.1 |
| com.jayway.jsonpath | json-path | 2.4.0 |
| com.rabbitmq | http-client | 2.1.0.RELEASE |
| com.vaadin.external.google | android-json | 0.0.20131108.vaadin1 |
| commons-codec | commons-codec | 1.11 |
| commons-collections | commons-collections | 3.2.2 |
| commons-net | commons-net | 3.6 |
| io.qameta.allure | allure-java-commons | 2.7.0 |
| io.qameta.allure | allure-junit4 | 2.7.0 |
| io.qameta.allure | allure2-model-api | 1.0.0 |
| io.qameta.allure | allure2-model-jackson | 1.0.0 |
| io.qameta.allure | allure2-model-pojo | 1.0.0 |
| javax.el | javax.el-api | 2.2.4 |
| junit | junit | 4.12 |
| net.\_01001111 | jlorem | 1.1 |
| net.bytebuddy | byte-buddy-agent | 1.9.7 |
| net.bytebuddy | byte-buddy | 1.9.7 |
| net.minidev | accessors-smart | 1.2 |
| net.minidev | json-smart | 2.3 |
| net.sourceforge.htmlunit | htmlunit-core-js | 2.33 |
| net.sourceforge.htmlunit | htmlunit-cssparser | 1.2.0 |
| net.sourceforge.htmlunit | htmlunit | 2.33 |
| net.sourceforge.htmlunit | neko-htmlunit | 2.33 |
| org.apache.commons | commons-text | 1.4 |
| org.apache.httpcomponents | httpclient | 4.5.6 |
| org.apache.httpcomponents | httpcore | 4.4.10 |
| org.apache.httpcomponents | httpmime | 4.5.6 |
| org.apache.tika | tika-core | 1.14 |
| org.apache.tomcat.embed | tomcat-embed-el | 9.0.14 |
| org.aspectj | aspectjrt | 1.9.2 |
| org.aspectj | aspectjweaver | 1.9.2 |
| org.assertj | assertj-core | 3.11.1 |
| org.awaitility | awaitility | 3.1.2 |
| org.hamcrest | hamcrest-all | 1.3 |
| org.hamcrest | hamcrest-core | 1.3 |
| org.hamcrest | hamcrest-library | 1.3 |
| org.javassist | javassist | 3.22.0-GA |
| org.jooq | joor-java-8 | 0.9.9 |
| org.mariadb.jdbc | mariadb-java-client | 2.3.0 |
| org.mockito | mockito-core | 2.23.4 |
| org.mortbay.jasper | apache-jsp | 8.5.33.1 |
| org.objenesis | objenesis | 2.6 |
| org.ow2.asm | asm-commons | 5.0.3 |
| org.ow2.asm | asm-tree | 5.0.3 |
| org.ow2.asm | asm-util | 5.0.3 |
| org.ow2.asm | asm | 5.0.3 |
| org.ow2.asm | asm | 5.0.4 |
| org.skyscreamer | jsonassert | 1.5.0 |
| org.springframework.amqp | spring-rabbit-junit | 2.1.3.RELEASE |
| org.springframework.amqp | spring-rabbit-test | 2.1.3.RELEASE |
| org.springframework.boot | spring-boot-starter-test | 2.1.2.RELEASE |
| org.springframework.boot | spring-boot-test-autoconfigure | 2.1.2.RELEASE |
| org.springframework.boot | spring-boot-test | 2.1.2.RELEASE |
| org.springframework.cloud | spring-cloud-stream-binder-test | 2.1.0.RELEASE |
| org.springframework.cloud | spring-cloud-stream-test-support | 2.1.0.RELEASE |
| org.springframework.integration | spring-integration-test-support | 5.1.2.RELEASE |
| org.springframework.integration | spring-integration-test | 5.1.2.RELEASE |
| org.springframework.restdocs | spring-restdocs-core | 2.0.3.RELEASE |
| org.springframework.restdocs | spring-restdocs-mockmvc | 2.0.3.RELEASE |
| org.springframework | spring-test | 5.1.4.RELEASE |
| org.xmlunit | xmlunit-core | 2.6.2 |
| org.yaml | snakeyaml | 1.23 |
| tapestry | tapestry | 4.0.2 |
| xalan | serializer | 2.7.2 |
| xalan | xalan | 2.7.2 |
| xerces | xercesImpl | 2.12.0 |
| xml-apis | xml-apis | 1.4.01 |

232
.3rd-party/compile.txt vendored
View File

@@ -1,115 +1,117 @@
aopalliance:aopalliance:jar:1.0:compile
ch.qos.logback:logback-classic:jar:1.1.11:compile
ch.qos.logback:logback-core:jar:1.1.11:compile
com.cronutils:cron-utils:jar:5.0.5:compile
com.fasterxml.jackson.core:jackson-annotations:jar:2.8.9:compile
com.fasterxml.jackson.core:jackson-core:jar:2.8.9:compile
com.fasterxml.jackson.core:jackson-databind:jar:2.8.9:compile
com.fasterxml:classmate:jar:1.3.3:compile
com.github.ben-manes.caffeine:caffeine:jar:2.3.5:compile
com.github.gwtd3:gwt-d3-api:jar:1.2.0:compile
com.github.gwtd3:gwt-d3-js:jar:3.5.11:compile
com.github.gwtd3:gwt-d3-js:jar:sources:3.5.11:compile
com.google.guava:guava:jar:25.0-jre:compile
com.h2database:h2:jar:1.4.195:compile
com.microsoft.sqlserver:mssql-jdbc:jar:6.4.0.jre8:compile
com.rabbitmq:amqp-client:jar:4.0.3:compile
com.rabbitmq:http-client:jar:1.3.1.RELEASE:compile
com.vaadin.external.atmosphere:atmosphere-runtime:jar:2.2.9.vaadin2:compile
com.vaadin.external.flute:flute:jar:1.3.0.gg2:compile
com.vaadin.external.gwt:gwt-elemental:jar:2.7.0.vaadin6:compile
com.vaadin.external.gwt:gwt-user:jar:2.7.0.vaadin6:compile
com.vaadin.external.slf4j:vaadin-slf4j-jdk14:jar:1.6.1:compile
com.vaadin:vaadin-client:jar:7.7.13:compile
com.vaadin:vaadin-push:jar:7.7.13:compile
com.vaadin:vaadin-sass-compiler:jar:0.9.13:compile
com.vaadin:vaadin-server:jar:7.7.13:compile
com.vaadin:vaadin-shared:jar:7.7.13:compile
com.vaadin:vaadin-spring-boot:jar:1.1.1:compile
com.vaadin:vaadin-spring:jar:1.1.1:compile
com.vaadin:vaadin-themes:jar:7.7.13:compile
commons-codec:commons-codec:jar:1.10:compile
commons-io:commons-io:jar:2.4:compile
cz.jirutka.rsql:rsql-parser:jar:2.1.0:compile
io.protostuff:protostuff-api:jar:1.5.6:compile
io.protostuff:protostuff-collectionschema:jar:1.5.6:compile
io.protostuff:protostuff-core:jar:1.5.6:compile
io.protostuff:protostuff-runtime:jar:1.5.6:compile
javax.annotation:javax.annotation-api:jar:1.2:compile
javax.servlet:javax.servlet-api:jar:3.1.0:compile
javax.transaction:javax.transaction-api:jar:1.2:compile
javax.validation:validation-api:jar:2.0.1.Final:compile
javax.validation:validation-api:jar:sources:1.0.0.GA:compile
javax.websocket:javax.websocket-api:jar:1.0:compile
org.apache.commons:commons-lang3:jar:3.4:compile
org.apache.httpcomponents:httpclient:jar:4.5.3:compile
org.apache.httpcomponents:httpcore:jar:4.4.6:compile
org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.28:compile
org.apache.tomcat:tomcat-jdbc:jar:8.0.28:compile
org.apache.tomcat:tomcat-juli:jar:8.0.28:compile
org.aspectj:aspectjweaver:jar:1.8.10:compile
org.flywaydb:flyway-core:jar:4.0.3:compile
org.glassfish:javax.json:jar:1.0.4:compile
org.hibernate.validator:hibernate-validator:jar:6.0.7.Final:compile
org.jboss.logging:jboss-logging:jar:3.2.1.Final:compile
org.jsoup:jsoup:jar:1.8.3:compile
org.mortbay.jasper:apache-el:jar:8.0.33:compile
org.ow2.asm:asm-commons:jar:5.0.1:compile
org.ow2.asm:asm-tree:jar:5.0.1:compile
org.ow2.asm:asm:jar:5.0.1:compile
org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
org.slf4j:jul-to-slf4j:jar:1.7.25:compile
org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
org.slf4j:slf4j-api:jar:1.7.25:compile
org.springframework.amqp:spring-amqp:jar:1.7.6.RELEASE:compile
org.springframework.amqp:spring-rabbit:jar:1.7.6.RELEASE:compile
org.springframework.boot:spring-boot-actuator:jar:1.4.7.RELEASE:compile
org.springframework.boot:spring-boot-autoconfigure:jar:1.4.7.RELEASE:compile
org.springframework.boot:spring-boot-starter-actuator:jar:1.4.7.RELEASE:compile
org.springframework.boot:spring-boot-starter-aop:jar:1.4.7.RELEASE:compile
org.springframework.boot:spring-boot-starter-data-jpa:jar:1.4.7.RELEASE:compile
org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.7.RELEASE:compile
org.springframework.boot:spring-boot-starter-jetty:jar:1.4.7.RELEASE:compile
org.springframework.boot:spring-boot-starter-logging:jar:1.4.7.RELEASE:compile
org.springframework.boot:spring-boot-starter-validation:jar:1.4.7.RELEASE:compile
org.springframework.boot:spring-boot-starter-web:jar:1.4.7.RELEASE:compile
org.springframework.boot:spring-boot-starter:jar:1.4.7.RELEASE:compile
org.springframework.boot:spring-boot:jar:1.4.7.RELEASE:compile
org.springframework.cloud:spring-cloud-bus:jar:1.2.2.RELEASE:compile
org.springframework.cloud:spring-cloud-context:jar:1.1.8.RELEASE:compile
org.springframework.cloud:spring-cloud-stream:jar:1.1.2.RELEASE:compile
org.springframework.data:spring-data-commons:jar:1.12.11.RELEASE:compile
org.springframework.data:spring-data-jpa:jar:1.10.11.RELEASE:compile
org.springframework.hateoas:spring-hateoas:jar:0.23.0.RELEASE:compile
org.springframework.integration:spring-integration-core:jar:4.3.10.RELEASE:compile
org.springframework.integration:spring-integration-jmx:jar:4.3.10.RELEASE:compile
org.springframework.integration:spring-integration-tuple:jar:1.0.0.RELEASE:compile
org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
org.springframework.retry:spring-retry:jar:1.1.5.RELEASE:compile
org.springframework.security:spring-security-aspects:jar:4.1.4.RELEASE:compile
org.springframework.security:spring-security-config:jar:4.1.4.RELEASE:compile
org.springframework.security:spring-security-core:jar:4.1.4.RELEASE:compile
org.springframework.security:spring-security-crypto:jar:4.1.4.RELEASE:compile
org.springframework.security:spring-security-web:jar:4.1.4.RELEASE:compile
org.springframework:spring-aop:jar:4.3.9.RELEASE:compile
org.springframework:spring-aspects:jar:4.3.9.RELEASE:compile
org.springframework:spring-beans:jar:4.3.9.RELEASE:compile
org.springframework:spring-context-support:jar:4.3.9.RELEASE:compile
org.springframework:spring-context:jar:4.3.9.RELEASE:compile
org.springframework:spring-core:jar:4.3.9.RELEASE:compile
org.springframework:spring-expression:jar:4.3.9.RELEASE:compile
org.springframework:spring-jdbc:jar:4.3.9.RELEASE:compile
org.springframework:spring-messaging:jar:4.3.9.RELEASE:compile
org.springframework:spring-orm:jar:4.3.9.RELEASE:compile
org.springframework:spring-tuple:jar:1.0.0.RELEASE:compile
org.springframework:spring-tx:jar:4.3.9.RELEASE:compile
org.springframework:spring-web:jar:4.3.9.RELEASE:compile
org.springframework:spring-webmvc:jar:4.3.9.RELEASE:compile
org.vaadin.addons.lazyquerycontainer:vaadin-lazyquerycontainer:jar:7.6.1.3:compile
org.vaadin.addons:flexibleoptiongroup:jar:2.2.0:compile
org.vaadin.addons:tokenfield:jar:7.0.1:compile
org.vaadin.alump.distributionbar:dbar-addon:jar:2.0.0:compile
org.vaadin.spring.addons:vaadin-spring-addon-eventbus:jar:0.0.6.RELEASE:compile
org.vaadin.spring.extensions:vaadin-spring-ext-core:jar:0.0.6.RELEASE:compile
org.vaadin.spring.extensions:vaadin-spring-ext-security:jar:0.0.6.RELEASE:compile
org.w3c.css:sac:jar:1.3:compile
ch.qos.logback:logback-classic:jar:1.2.3:compile
ch.qos.logback:logback-core:jar:1.2.3:compile
com.cronutils:cron-utils:jar:5.0.5:compile
com.esotericsoftware:kryo-shaded:jar:3.0.3:compile
com.esotericsoftware:minlog:jar:1.3.0:compile
com.fasterxml.jackson.core:jackson-annotations:jar:2.9.0:compile
com.fasterxml.jackson.core:jackson-core:jar:2.9.8:compile
com.fasterxml.jackson.core:jackson-databind:jar:2.9.8:compile
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.9.8:compile
com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.9.8:compile
com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.9.8:compile
com.fasterxml:classmate:jar:1.3.4:compile
com.github.ben-manes.caffeine:caffeine:jar:2.6.2:compile
com.github.gwtd3:gwt-d3-api:jar:1.2.0:compile
com.github.gwtd3:gwt-d3-js:jar:3.5.11:compile
com.github.gwtd3:gwt-d3-js:jar:sources:3.5.11:compile
com.google.guava:guava:jar:25.0-jre:compile
com.h2database:h2:jar:1.4.197:compile
com.microsoft.sqlserver:mssql-jdbc:jar:6.4.0.jre8:compile
com.rabbitmq:amqp-client:jar:5.4.3:compile
com.vaadin.external.atmosphere:atmosphere-runtime:jar:2.2.9.vaadin2:compile
com.vaadin.external.flute:flute:jar:1.3.0.gg2:compile
com.vaadin.external.gwt:gwt-elemental:jar:2.7.0.vaadin6:compile
com.vaadin.external.gwt:gwt-user:jar:2.7.0.vaadin6:compile
com.vaadin.external.slf4j:vaadin-slf4j-jdk14:jar:1.6.1:compile
com.vaadin:vaadin-client:jar:7.7.13:compile
com.vaadin:vaadin-push:jar:7.7.13:compile
com.vaadin:vaadin-sass-compiler:jar:0.9.13:compile
com.vaadin:vaadin-server:jar:7.7.13:compile
com.vaadin:vaadin-shared:jar:7.7.13:compile
com.vaadin:vaadin-spring-boot:jar:1.2.0:compile
com.vaadin:vaadin-spring:jar:1.2.0:compile
com.vaadin:vaadin-themes:jar:7.7.13:compile
com.zaxxer:HikariCP:jar:3.2.0:compile
commons-io:commons-io:jar:2.5:compile
cz.jirutka.rsql:rsql-parser:jar:2.1.0:compile
io.projectreactor:reactor-core:jar:3.2.5.RELEASE:compile
io.protostuff:protostuff-api:jar:1.5.6:compile
io.protostuff:protostuff-collectionschema:jar:1.5.6:compile
io.protostuff:protostuff-core:jar:1.5.6:compile
io.protostuff:protostuff-runtime:jar:1.5.6:compile
javax.annotation:javax.annotation-api:jar:1.3.2:compile
javax.json:javax.json-api:jar:1.1.4:compile
javax.servlet:javax.servlet-api:jar:4.0.1:compile
javax.transaction:javax.transaction-api:jar:1.3:compile
javax.validation:validation-api:jar:2.0.1.Final:compile
javax.validation:validation-api:jar:sources:1.0.0.GA:compile
javax.websocket:javax.websocket-api:jar:1.1:compile
org.apache.commons:commons-lang3:jar:3.7:compile
org.apache.logging.log4j:log4j-api:jar:2.11.1:compile
org.apache.logging.log4j:log4j-to-slf4j:jar:2.11.1:compile
org.flywaydb:flyway-core:jar:5.2.4:compile
org.hibernate.validator:hibernate-validator:jar:6.0.14.Final:compile
org.jboss.logging:jboss-logging:jar:3.3.2.Final:compile
org.jsoup:jsoup:jar:1.8.3:compile
org.mortbay.jasper:apache-el:jar:8.5.35.1:compile
org.ow2.asm:asm-analysis:jar:7.0:compile
org.ow2.asm:asm-commons:jar:7.0:compile
org.ow2.asm:asm-tree:jar:7.0:compile
org.ow2.asm:asm:jar:7.0:compile
org.reactivestreams:reactive-streams:jar:1.0.2:compile
org.slf4j:jul-to-slf4j:jar:1.7.25:compile
org.slf4j:slf4j-api:jar:1.7.25:compile
org.springframework.amqp:spring-amqp:jar:2.1.3.RELEASE:compile
org.springframework.amqp:spring-rabbit:jar:2.1.3.RELEASE:compile
org.springframework.boot:spring-boot-autoconfigure:jar:2.1.2.RELEASE:compile
org.springframework.boot:spring-boot-starter-aop:jar:2.1.2.RELEASE:compile
org.springframework.boot:spring-boot-starter-data-jpa:jar:2.1.2.RELEASE:compile
org.springframework.boot:spring-boot-starter-jdbc:jar:2.1.2.RELEASE:compile
org.springframework.boot:spring-boot-starter-jetty:jar:2.1.2.RELEASE:compile
org.springframework.boot:spring-boot-starter-json:jar:2.1.2.RELEASE:compile
org.springframework.boot:spring-boot-starter-logging:jar:2.1.2.RELEASE:compile
org.springframework.boot:spring-boot-starter-validation:jar:2.1.2.RELEASE:compile
org.springframework.boot:spring-boot-starter-web:jar:2.1.2.RELEASE:compile
org.springframework.boot:spring-boot-starter:jar:2.1.2.RELEASE:compile
org.springframework.boot:spring-boot:jar:2.1.2.RELEASE:compile
org.springframework.cloud:spring-cloud-bus:jar:2.1.0.RELEASE:compile
org.springframework.cloud:spring-cloud-commons:jar:2.1.0.RELEASE:compile
org.springframework.cloud:spring-cloud-context:jar:2.1.0.RELEASE:compile
org.springframework.cloud:spring-cloud-starter:jar:2.1.0.RELEASE:compile
org.springframework.cloud:spring-cloud-stream:jar:2.1.0.RELEASE:compile
org.springframework.data:spring-data-commons:jar:2.1.4.RELEASE:compile
org.springframework.data:spring-data-jpa:jar:2.1.4.RELEASE:compile
org.springframework.hateoas:spring-hateoas:jar:0.25.0.RELEASE:compile
org.springframework.integration:spring-integration-core:jar:5.1.2.RELEASE:compile
org.springframework.integration:spring-integration-jmx:jar:5.1.2.RELEASE:compile
org.springframework.integration:spring-integration-tuple:jar:1.0.0.RELEASE:compile
org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
org.springframework.retry:spring-retry:jar:1.2.3.RELEASE:compile
org.springframework.security:spring-security-aspects:jar:5.1.3.RELEASE:compile
org.springframework.security:spring-security-config:jar:5.1.3.RELEASE:compile
org.springframework.security:spring-security-core:jar:5.1.3.RELEASE:compile
org.springframework.security:spring-security-crypto:jar:5.1.3.RELEASE:compile
org.springframework.security:spring-security-web:jar:5.1.3.RELEASE:compile
org.springframework:spring-aop:jar:5.1.4.RELEASE:compile
org.springframework:spring-aspects:jar:5.1.4.RELEASE:compile
org.springframework:spring-beans:jar:5.1.4.RELEASE:compile
org.springframework:spring-context-support:jar:5.1.4.RELEASE:compile
org.springframework:spring-context:jar:5.1.4.RELEASE:compile
org.springframework:spring-core:jar:5.1.4.RELEASE:compile
org.springframework:spring-expression:jar:5.1.4.RELEASE:compile
org.springframework:spring-jcl:jar:5.1.4.RELEASE:compile
org.springframework:spring-jdbc:jar:5.1.4.RELEASE:compile
org.springframework:spring-messaging:jar:5.1.4.RELEASE:compile
org.springframework:spring-orm:jar:5.1.4.RELEASE:compile
org.springframework:spring-tuple:jar:1.0.0.RELEASE:compile
org.springframework:spring-tx:jar:5.1.4.RELEASE:compile
org.springframework:spring-web:jar:5.1.4.RELEASE:compile
org.springframework:spring-webmvc:jar:5.1.4.RELEASE:compile
org.vaadin.addons.lazyquerycontainer:vaadin-lazyquerycontainer:jar:7.6.1.3:compile
org.vaadin.addons:flexibleoptiongroup:jar:2.2.0:compile
org.vaadin.addons:tokenfield:jar:7.0.1:compile
org.vaadin.alump.distributionbar:dbar-addon:jar:2.0.0:compile
org.vaadin.spring.addons:vaadin-spring-addon-eventbus:jar:0.0.6.RELEASE:compile
org.vaadin.spring.extensions:vaadin-spring-ext-core:jar:0.0.6.RELEASE:compile
org.vaadin.spring.extensions:vaadin-spring-ext-security:jar:0.0.6.RELEASE:compile
org.w3c.css:sac:jar:1.3:compile

View File

@@ -10,13 +10,13 @@
cd ..
# Provided and compile (excludes the test modules)
mvn dependency:list -DexcludeGroupIds=org.eclipse -pl !org.eclipse.hawkbit:hawkbit-repository-test,!org.eclipse.hawkbit:hawkbit-dmf-rabbitmq-test -Dsort=true -DoutputFile=dependencies.txt
find . -name dependencies.txt|while read i; do cat $i;done|grep '.*:.*:compile'|sort|uniq > .3rd-party/compile.txt
find . -name dependencies.txt|while read i; do cat $i;done|grep '.*:.*:provided'|sort|uniq > .3rd-party/provided.txt
mvn dependency:list -DexcludeGroupIds=org.eclipse,org.aspectj -pl '!org.eclipse.hawkbit:hawkbit-repository-test,!org.eclipse.hawkbit:hawkbit-dmf-rabbitmq-test' -Dsort=true -DoutputFile=dependencies.txt
find . -name dependencies.txt|while read i; do cat $i;done|grep '.*:.*:compile'| tr -d '[:blank:]'| sed -e 's/(optional)//'|sort|uniq > .3rd-party/compile.txt
find . -name dependencies.txt|while read i; do cat $i;done|grep '.*:.*:provided'| tr -d '[:blank:]'| sed -e 's/(optional)//'|sort|uniq > .3rd-party/provided.txt
# Test dependencies
mvn dependency:list -DexcludeGroupIds=org.eclipse -Dsort=true -DoutputFile=dependencies.txt
find . -name dependencies.txt|while read i; do cat $i;done|grep '.*:.*:test'|sort|uniq > .3rd-party/test.txt
find . -name dependencies.txt|while read i; do cat $i;done|grep '.*:.*:test'| tr -d '[:blank:]'| sed -e 's/(optional)//'|sort|uniq > .3rd-party/test.txt
# Cleanup temp files
find . -name dependencies.txt|while read i; do rm $i;done

View File

@@ -1 +1 @@
javax.servlet:javax.servlet-api:jar:3.1.0:provided
javax.servlet:javax.servlet-api:jar:4.0.1:provided

150
.3rd-party/test.txt vendored
View File

@@ -1,72 +1,78 @@
ant:ant:jar:1.6.5:test
asm:asm:jar:3.3.1:test
cglib:cglib-nodep:jar:3.1:test
colt:colt:jar:1.2.0:test
com.esotericsoftware:kryo-shaded:jar:3.0.3:test
com.esotericsoftware:minlog:jar:1.3.0:test
com.google.code.gson:gson:jar:2.7:test
com.google.gwt.gwtmockito:gwtmockito:jar:1.1.8:test
com.google.gwt:gwt-dev:jar:2.8.0:test
com.google.gwt:gwt-user:jar:2.8.0:test
com.google.jsinterop:jsinterop-annotations:jar:1.0.1:test
com.google.jsinterop:jsinterop-annotations:jar:sources:1.0.1:test
com.ibm.icu:icu4j:jar:50.1.1:test
com.jayway.awaitility:awaitility:jar:1.7.0:test
com.jayway.jsonpath:json-path:jar:2.0.0:test
commons-collections:commons-collections:jar:3.2.2:test
javax.el:javax.el-api:jar:2.2.4:test
junit:junit:jar:4.12:test
net._01001111:jlorem:jar:1.1:test
net.minidev:asm:jar:1.0.2:test
net.minidev:json-smart:jar:2.1.1:test
net.sourceforge.cssparser:cssparser:jar:0.9.18:test
net.sourceforge.htmlunit:htmlunit-core-js:jar:2.17:test
net.sourceforge.htmlunit:htmlunit:jar:2.21:test
net.sourceforge.htmlunit:neko-htmlunit:jar:2.21:test
org.apache.httpcomponents:httpmime:jar:4.5.3:test
org.apache.tika:tika-core:jar:1.7:test
org.aspectj:aspectjrt:jar:1.8.10:test
org.assertj:assertj-core:jar:3.6.2:test
org.hamcrest:hamcrest-all:jar:1.3:test
org.hamcrest:hamcrest-core:jar:1.3:test
org.hamcrest:hamcrest-library:jar:1.3:test
org.javassist:javassist:jar:3.20.0-GA:test
org.json:json:jar:20141113:test
org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.9.3:test
org.mariadb.jdbc:mariadb-java-client:jar:2.0.2:test
org.mockito:mockito-core:jar:1.10.19:test
org.mortbay.jasper:apache-jsp:jar:8.0.33:test
org.objenesis:objenesis:jar:2.1:test
org.ow2.asm:asm-commons:jar:5.0.3:test
org.ow2.asm:asm-tree:jar:5.0.3:test
org.ow2.asm:asm-util:jar:5.0.3:test
org.ow2.asm:asm:jar:5.0.3:test
org.powermock:powermock-api-mockito-common:jar:1.6.5:test
org.powermock:powermock-api-mockito:jar:1.6.5:test
org.powermock:powermock-api-support:jar:1.6.5:test
org.powermock:powermock-core:jar:1.6.5:test
org.powermock:powermock-module-junit4-common:jar:1.6.5:test
org.powermock:powermock-module-junit4:jar:1.6.5:test
org.powermock:powermock-reflect:jar:1.6.5:test
org.skyscreamer:jsonassert:jar:1.3.0:test
org.springframework.amqp:spring-rabbit-junit:jar:1.7.6.RELEASE:test
org.springframework.amqp:spring-rabbit-test:jar:1.7.6.RELEASE:test
org.springframework.boot:spring-boot-starter-test:jar:1.4.7.RELEASE:test
org.springframework.boot:spring-boot-test-autoconfigure:jar:1.4.7.RELEASE:test
org.springframework.boot:spring-boot-test:jar:1.4.7.RELEASE:test
org.springframework.cloud:spring-cloud-stream-binder-test:jar:1.1.2.RELEASE:test
org.springframework.cloud:spring-cloud-stream-test-support:jar:1.1.2.RELEASE:test
org.springframework.integration:spring-integration-test:jar:4.3.10.RELEASE:test
org.springframework:spring-test:jar:4.3.9.RELEASE:test
org.yaml:snakeyaml:jar:1.17:test
ru.qatools.commons:properties:jar:2.0.RC5:test
ru.yandex.qatools.allure:allure-java-adaptor-api:jar:1.5.4:test
ru.yandex.qatools.allure:allure-java-annotations:jar:1.5.4:test
ru.yandex.qatools.allure:allure-java-aspects:jar:1.5.4:test
ru.yandex.qatools.allure:allure-junit-adaptor:jar:1.5.4:test
ru.yandex.qatools.allure:allure-model:jar:1.5.4:test
tapestry:tapestry:jar:4.0.2:test
xalan:serializer:jar:2.7.2:test
xalan:xalan:jar:2.7.2:test
xerces:xercesImpl:jar:2.11.0:test
xml-apis:xml-apis:jar:1.4.01:test
ant:ant:jar:1.6.5:test
colt:colt:jar:1.2.0:test
com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.9.8:test
com.google.code.gson:gson:jar:2.8.5:test
com.google.gwt.gwtmockito:gwtmockito:jar:1.1.8:test
com.google.gwt:gwt-dev:jar:2.8.0:test
com.google.gwt:gwt-user:jar:2.8.0:test
com.google.jsinterop:jsinterop-annotations:jar:1.0.1:test
com.google.jsinterop:jsinterop-annotations:jar:sources:1.0.1:test
com.ibm.icu:icu4j:jar:50.1.1:test
com.jayway.jsonpath:json-path:jar:2.4.0:test
com.rabbitmq:http-client:jar:2.1.0.RELEASE:test
com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
commons-codec:commons-codec:jar:1.11:test
commons-collections:commons-collections:jar:3.2.2:test
commons-net:commons-net:jar:3.6:test
io.qameta.allure:allure-java-commons:jar:2.7.0:test
io.qameta.allure:allure-junit4:jar:2.7.0:test
io.qameta.allure:allure2-model-api:jar:1.0.0:test
io.qameta.allure:allure2-model-jackson:jar:1.0.0:test
io.qameta.allure:allure2-model-pojo:jar:1.0.0:test
javax.el:javax.el-api:jar:2.2.4:test
junit:junit:jar:4.12:test
net._01001111:jlorem:jar:1.1:test
net.bytebuddy:byte-buddy-agent:jar:1.9.7:test
net.bytebuddy:byte-buddy:jar:1.9.7:test
net.minidev:accessors-smart:jar:1.2:test
net.minidev:json-smart:jar:2.3:test
net.sourceforge.htmlunit:htmlunit-core-js:jar:2.33:test
net.sourceforge.htmlunit:htmlunit-cssparser:jar:1.2.0:test
net.sourceforge.htmlunit:htmlunit:jar:2.33:test
net.sourceforge.htmlunit:neko-htmlunit:jar:2.33:test
org.apache.commons:commons-text:jar:1.4:test
org.apache.httpcomponents:httpclient:jar:4.5.6:test
org.apache.httpcomponents:httpcore:jar:4.4.10:test
org.apache.httpcomponents:httpmime:jar:4.5.6:test
org.apache.tika:tika-core:jar:1.14:test
org.apache.tomcat.embed:tomcat-embed-el:jar:9.0.14:test
org.aspectj:aspectjrt:jar:1.9.2:test
org.aspectj:aspectjweaver:jar:1.9.2:test
org.assertj:assertj-core:jar:3.11.1:test
org.awaitility:awaitility:jar:3.1.2:test
org.hamcrest:hamcrest-all:jar:1.3:test
org.hamcrest:hamcrest-core:jar:1.3:test
org.hamcrest:hamcrest-library:jar:1.3:test
org.javassist:javassist:jar:3.22.0-GA:test
org.jooq:joor-java-8:jar:0.9.9:test
org.mariadb.jdbc:mariadb-java-client:jar:2.3.0:test
org.mockito:mockito-core:jar:2.23.4:test
org.mortbay.jasper:apache-jsp:jar:8.5.33.1:test
org.objenesis:objenesis:jar:2.6:test
org.ow2.asm:asm-commons:jar:5.0.3:test
org.ow2.asm:asm-tree:jar:5.0.3:test
org.ow2.asm:asm-util:jar:5.0.3:test
org.ow2.asm:asm:jar:5.0.3:test
org.ow2.asm:asm:jar:5.0.4:test
org.skyscreamer:jsonassert:jar:1.5.0:test
org.springframework.amqp:spring-rabbit-junit:jar:2.1.3.RELEASE:test
org.springframework.amqp:spring-rabbit-test:jar:2.1.3.RELEASE:test
org.springframework.boot:spring-boot-starter-test:jar:2.1.2.RELEASE:test
org.springframework.boot:spring-boot-test-autoconfigure:jar:2.1.2.RELEASE:test
org.springframework.boot:spring-boot-test:jar:2.1.2.RELEASE:test
org.springframework.cloud:spring-cloud-function-context:jar:2.0.0.RELEASE:test
org.springframework.cloud:spring-cloud-function-core:jar:2.0.0.RELEASE:test
org.springframework.cloud:spring-cloud-stream-binder-test:jar:2.1.0.RELEASE:test
org.springframework.cloud:spring-cloud-stream-test-support:jar:2.1.0.RELEASE:test
org.springframework.integration:spring-integration-test-support:jar:5.1.2.RELEASE:test
org.springframework.integration:spring-integration-test:jar:5.1.2.RELEASE:test
org.springframework.restdocs:spring-restdocs-core:jar:2.0.3.RELEASE:test
org.springframework.restdocs:spring-restdocs-mockmvc:jar:2.0.3.RELEASE:test
org.springframework:spring-test:jar:5.1.4.RELEASE:test
org.xmlunit:xmlunit-core:jar:2.6.2:test
org.yaml:snakeyaml:jar:1.23:test
tapestry:tapestry:jar:4.0.2:test
xalan:serializer:jar:2.7.2:test
xalan:xalan:jar:2.7.2:test
xerces:xercesImpl:jar:2.12.0:test
xml-apis:xml-apis:jar:1.4.01:test

View File

@@ -56,4 +56,4 @@ jobs:
notify:
webhooks:
# Gitter hook
- url: https://webhooks.gitter.im/e/a20a6bc2bda5a8a77d39
- url: https://webhooks.gitter.im/e/a20a6bc2bda5a8a77d39

View File

@@ -33,6 +33,7 @@ We offer a sandbox installation that is free for everyone to try out hawkBit. Ho
In addition the following vendors offer free trial accounts for their hawkBit compatible products:
- [Bosch IoT Rollouts](https://www.bosch-iot-suite.com/rollouts/)
- [Kynetics Update Factory](https://www.kynetics.com/iot-platform-update-factory)
# Device Integration

View File

@@ -5,24 +5,26 @@ weight: 31
---
In this guide we describe how to run a full featured hawkBit setup based on a production ready infrastructure. It is based on the hawkBit example modules and update server.
<!--more-->
<!--more-->
{{% note %}}
The update server can in fact be run stand alone. However, only with an embedded H2, no Device Management Federation API and no artifact storage.
{{% /note %}}
## System Architecture
This guide describes a target architecture that is more like one that you will expect in a production system.
- hawkBit [Update Server](https://github.com/eclipse/hawkbit/tree/master/hawkbit-runtime/hawkbit-update-server).
- [MariaDB](https://mariadb.org) for the repository.
- [RabbitMQ](https://www.rabbitmq.com) for DMF communication.
- For testing and demonstration purposes we will also use:
- [hawkBit Device Simulator](https://github.com/eclipse/hawkbit-examples/tree/master/hawkbit-device-simulator).
- [hawkBit Management API example client](https://github.com/eclipse/hawkbit-examples/tree/master/hawkbit-mgmt-api-client).
- [hawkBit Device Simulator](https://github.com/eclipse/hawkbit-examples/tree/master/hawkbit-device-simulator).
- [hawkBit Management API example client](https://github.com/eclipse/hawkbit-examples/tree/master/hawkbit-mgmt-api-client).
## Prerequisites
- You have a working [hawkBit core build](https://github.com/eclipse/hawkbit).
- You have a working [hawkBit examples build](https://github.com/eclipse/hawkbit-examples).
@@ -31,18 +33,20 @@ This guide describes a target architecture that is more like one that you will e
As mentioned you can create your own application with hawkBit inside or adapt the existing example app. The second option will be shown here.
### Set MariaDB dependency to compile in the [update server POM](https://github.com/eclipse/hawkbit/blob/master/hawkbit-runtime/hawkbit-update-server/pom.xml)
```xml
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<scope>compile</scope>
</dependency>
```
```
### Configure MariaDB/MySQL connection settings.
For this you can either edit the existing *application.properties* or create a [new profile](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config-profile-specific-properties).
For this you can either edit the existing _application.properties_ or create a [new profile](http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-external-config-profile-specific-properties).
```
```properties
spring.jpa.database=MYSQL
spring.datasource.url=jdbc:mysql://localhost:3306/YOUR_SCHEMA
spring.datasource.username=YOUR_USER
@@ -54,7 +58,7 @@ spring.datasource.driverClassName=org.mariadb.jdbc.Driver
We provide already defaults that should work with a standard Rabbit installation. Otherwise configure the following in the `application.properties` of the two services:
```
```properties
spring.rabbitmq.username=guest
spring.rabbitmq.password=guest
spring.rabbitmq.virtualHost=/
@@ -67,30 +71,33 @@ spring.rabbitmq.port=5672
Should only be necessary if your system does not run on localhost or uses a different port than the example app.
Adapt `application.properties` in this case:
```
```properties
hawkbit.url=localhost:8080
```
or provide the parameter on command line:
```
```properties
hawkbit-example-mgmt-simulator-##VERSION##.jar --hawkbit.url=YOUR_HOST:PORT
```
## Compile & Run
### Compile & Run your _"production ready"_ app.
### Compile & Run your _"production ready"_ app
see [update server](https://github.com/eclipse/hawkbit/tree/master/hawkbit-runtime/hawkbit-update-server)
### Compile & Run example scenario [creation script](https://github.com/eclipse/hawkbit-examples/tree/master/hawkbit-example-mgmt-simulator) (optional).
### Compile & Run example scenario [creation script](https://github.com/eclipse/hawkbit-examples/tree/master/hawkbit-example-mgmt-simulator) (optional)
This has to be done before the device simulator is started. hawkBit creates the mandatory tenant metadata with first login into either _Management UI_ or API (which is done by this client).
However, this is not done by _DMF_ which is in fact used by the device simulator, i.e. without calling _Management API_ first hawkBit would drop all _DMF_ messages as the tenant is unknown.
### Compile & Run device simulator (optional).
### Compile & Run device simulator (optional)
see [device simulator](https://github.com/eclipse/hawkbit-examples/tree/master/hawkbit-device-simulator)
# Enjoy hawkBit with a real database, artifact storage and all [interfaces](../../apis/) available.
# Enjoy hawkBit with a real database, artifact storage and all [interfaces](../../apis/) available
![](../../images/hawkbit_ui.png)

View File

@@ -11,13 +11,21 @@ package org.eclipse.hawkbit.artifact.repository;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.util.Random;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.assertj.core.api.Assertions;
import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.io.Files;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
@@ -26,12 +34,32 @@ import io.qameta.allure.Story;
@Feature("Unit Tests - Artifact File System Repository")
@Story("Test storing artifact binaries in the file-system")
public class ArtifactFilesystemRepositoryTest {
private static final Logger LOG = LoggerFactory.getLogger(ArtifactFilesystemRepositoryTest.class);
private static final String TENANT = "test_tenant";
private final ArtifactFilesystemProperties artifactResourceProperties = new ArtifactFilesystemProperties();
private static ArtifactFilesystemProperties artifactResourceProperties;
private final ArtifactFilesystemRepository artifactFilesystemRepository = new ArtifactFilesystemRepository(
artifactResourceProperties);
private static ArtifactFilesystemRepository artifactFilesystemRepository;
@BeforeClass
public static void setup() {
artifactResourceProperties = new ArtifactFilesystemProperties();
artifactResourceProperties.setPath(Files.createTempDir().getAbsolutePath());
artifactFilesystemRepository = new ArtifactFilesystemRepository(artifactResourceProperties);
}
@AfterClass
public static void afterClass() {
if (new File(artifactResourceProperties.getPath()).exists()) {
try {
FileUtils.deleteDirectory(new File(artifactResourceProperties.getPath()));
} catch (final IOException | IllegalArgumentException e) {
LOG.warn("Cannot delete file-directory", e);
}
}
}
@Test
@Description("Verfies that an artifact can be successfully stored in the file-system repository")

View File

@@ -41,7 +41,7 @@ public class PropertyHostnameResolverAutoConfiguration {
*/
@Bean
@ConditionalOnMissingBean(value = HostnameResolver.class)
public HostnameResolver hostnameResolver(final HawkbitServerProperties serverProperties) {
HostnameResolver hostnameResolver(final HawkbitServerProperties serverProperties) {
return () -> {
try {
return new URL(serverProperties.getUrl());
@@ -58,7 +58,7 @@ public class PropertyHostnameResolverAutoConfiguration {
*/
@Bean
@ConditionalOnMissingBean(ArtifactUrlHandler.class)
public PropertyBasedArtifactUrlHandler propertyBasedArtifactUrlHandler(
PropertyBasedArtifactUrlHandler propertyBasedArtifactUrlHandler(
final ArtifactUrlHandlerProperties urlHandlerProperties) {
return new PropertyBasedArtifactUrlHandler(urlHandlerProperties);
}

View File

@@ -8,28 +8,20 @@
*/
package org.eclipse.hawkbit.autoconfigure.cache;
import java.util.Collection;
import java.util.concurrent.Callable;
import java.util.stream.Collectors;
import org.eclipse.hawkbit.cache.TenancyCacheManager;
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.guava.GuavaCacheManager;
import org.springframework.cache.interceptor.CacheOperationInvocationContext;
import org.springframework.cache.interceptor.SimpleCacheResolver;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import com.google.common.cache.CacheBuilder;
import com.github.benmanes.caffeine.cache.Caffeine;
/**
* A configuration for configuring the spring {@link CacheManager} for specific
@@ -43,13 +35,6 @@ import com.google.common.cache.CacheBuilder;
@EnableCaching
public class CacheAutoConfiguration {
@Autowired
private TenantAware tenantAware;
@Autowired
@Qualifier("directCacheManager")
private CacheManager directCacheManager;
/**
* @return the default cache manager bean if none other cache manager is
* existing.
@@ -57,7 +42,8 @@ public class CacheAutoConfiguration {
@Bean
@ConditionalOnMissingBean
@Primary
public TenancyCacheManager cacheManager() {
TenancyCacheManager cacheManager(@Qualifier("directCacheManager") final CacheManager directCacheManager,
final TenantAware tenantAware) {
return new TenantAwareCacheManager(directCacheManager, tenantAware);
}
@@ -70,9 +56,6 @@ public class CacheAutoConfiguration {
@EnableConfigurationProperties(CacheProperties.class)
static class DirectCacheManagerConfiguration {
@Autowired
private CacheProperties cacheProperties;
/**
* @return the direct cache manager to access without tenant aware
* check, cause in sometimes it's necessary to access the cache
@@ -81,143 +64,17 @@ public class CacheAutoConfiguration {
*/
@Bean(name = "directCacheManager")
@ConditionalOnMissingBean(name = "directCacheManager")
public CacheManager directCacheManager() {
final GuavaCacheManager cacheManager = new GuavaCacheManager();
public CacheManager directCacheManager(final CacheProperties cacheProperties) {
final CaffeineCacheManager cacheManager = new CaffeineCacheManager();
if (cacheProperties.getTtl() > 0) {
final CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder()
final Caffeine<Object, Object> cacheBuilder = Caffeine.newBuilder()
.expireAfterWrite(cacheProperties.getTtl(), cacheProperties.getTtlUnit());
cacheManager.setCacheBuilder(cacheBuilder);
cacheManager.setCaffeine(cacheBuilder);
}
return cacheManager;
}
}
/**
* A {@link SimpleCacheResolver} implementation which includes the
* {@link TenantAware#getCurrentTenant()} into the cache name before
* resolving it.
*/
public class TenantCacheResolver extends SimpleCacheResolver {
@Override
public Collection<Cache> resolveCaches(final CacheOperationInvocationContext<?> context) {
return super.resolveCaches(context).stream().map(TenantCacheWrapper::new).collect(Collectors.toList());
}
@Override
protected Collection<String> getCacheNames(final CacheOperationInvocationContext<?> context) {
return super.getCacheNames(context).stream()
.map(cacheName -> tenantAware.getCurrentTenant() + "." + cacheName).collect(Collectors.toList());
}
}
/**
* An {@link Cache} wrapper which returns the name of the cache include the
* {@link TenantAware#getCurrentTenant()}.
*
*
*
*
*/
public class TenantCacheWrapper implements Cache {
private final Cache delegate;
/**
* @param delegate
*/
public TenantCacheWrapper(final Cache delegate) {
this.delegate = delegate;
}
/**
* @return
* @see org.springframework.cache.Cache#getName()
*/
@Override
public String getName() {
return tenantAware.getCurrentTenant() + "." + delegate.getName();
}
/**
* @return
* @see org.springframework.cache.Cache#getNativeCache()
*/
@Override
public Object getNativeCache() {
return delegate.getNativeCache();
}
/**
* @param key
* @return
* @see org.springframework.cache.Cache#get(java.lang.Object)
*/
@Override
public ValueWrapper get(final Object key) {
return delegate.get(key);
}
/**
* @param key
* @param type
* @return
* @see org.springframework.cache.Cache#get(java.lang.Object,
* java.lang.Class)
*/
@Override
public <T> T get(final Object key, final Class<T> type) {
return delegate.get(key, type);
}
/**
* @param key
* @param value
* @see org.springframework.cache.Cache#put(java.lang.Object,
* java.lang.Object)
*/
@Override
public void put(final Object key, final Object value) {
delegate.put(key, value);
}
/**
* @param key
* @param value
* @return
* @see org.springframework.cache.Cache#putIfAbsent(java.lang.Object,
* java.lang.Object)
*/
@Override
public ValueWrapper putIfAbsent(final Object key, final Object value) {
return delegate.putIfAbsent(key, value);
}
/**
* @param key
* @see org.springframework.cache.Cache#evict(java.lang.Object)
*/
@Override
public void evict(final Object key) {
delegate.evict(key);
}
/**
*
* @see org.springframework.cache.Cache#clear()
*/
@Override
public void clear() {
delegate.clear();
}
@Override
public <T> T get(final Object key, final Callable<T> valueLoader) {
return delegate.get(key, valueLoader);
}
}
}

View File

@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.autoconfigure.cache;
import org.eclipse.hawkbit.cache.DefaultDownloadIdCache;
import org.eclipse.hawkbit.cache.DownloadIdCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
@@ -24,9 +23,6 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class DownloadIdCacheAutoConfiguration {
@Autowired
private CacheManager cacheManager;
/**
* Bean for the downloadId cache that returns the DefaultDownloadIdCache.
* The DefaultDownloadIdCache cannot be used within a cluster because the
@@ -38,7 +34,7 @@ public class DownloadIdCacheAutoConfiguration {
*/
@Bean
@ConditionalOnMissingBean
public DownloadIdCache downloadIdCache() {
public DownloadIdCache downloadIdCache(final CacheManager cacheManager) {
return new DefaultDownloadIdCache(cacheManager);
}

View File

@@ -22,6 +22,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.cloud.bus.ConditionalOnBusEnabled;
import org.springframework.cloud.bus.ServiceMatcher;
import org.springframework.cloud.bus.jackson.RemoteApplicationEventScan;
import org.springframework.cloud.stream.annotation.StreamMessageConverter;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -43,14 +44,6 @@ import io.protostuff.Schema;
@RemoteApplicationEventScan(basePackages = "org.eclipse.hawkbit.repository.event.remote")
@PropertySource("classpath:/hawkbit-eventbus-defaults.properties")
public class EventPublisherAutoConfiguration {
@Autowired
@Qualifier("asyncExecutor")
private Executor executor;
@Autowired
private TenantAware tenantAware;
/**
* Server internal event publisher that allows parallel event processing if
* the event listener is marked as so.
@@ -58,7 +51,8 @@ public class EventPublisherAutoConfiguration {
* @return publisher bean
*/
@Bean(name = AbstractApplicationContext.APPLICATION_EVENT_MULTICASTER_BEAN_NAME)
public ApplicationEventMulticaster applicationEventMulticaster() {
ApplicationEventMulticaster applicationEventMulticaster(@Qualifier("asyncExecutor") final Executor executor,
final TenantAware tenantAware) {
final SimpleApplicationEventMulticaster simpleApplicationEventMulticaster = new TenantAwareApplicationEventPublisher(
tenantAware, applicationEventFilter());
simpleApplicationEventMulticaster.setTaskExecutor(executor);
@@ -72,7 +66,7 @@ public class EventPublisherAutoConfiguration {
* @return the singleton instance of the {@link EventPublisherHolder}
*/
@Bean
public EventPublisherHolder eventBusHolder() {
EventPublisherHolder eventBusHolder() {
return EventPublisherHolder.getInstance();
}
@@ -82,7 +76,7 @@ public class EventPublisherAutoConfiguration {
*/
@Bean
@ConditionalOnMissingBean
public ApplicationEventFilter applicationEventFilter() {
ApplicationEventFilter applicationEventFilter() {
return e -> false;
}
@@ -144,6 +138,7 @@ public class EventPublisherAutoConfiguration {
* @return the protostuff io message converter
*/
@Bean
@StreamMessageConverter
public MessageConverter busProtoBufConverter() {
return new BusProtoStuffMessageConverter();
}

View File

@@ -14,7 +14,6 @@ import org.eclipse.hawkbit.im.authentication.MultitenancyIndicator;
import org.eclipse.hawkbit.im.authentication.PermissionUtils;
import org.eclipse.hawkbit.im.authentication.TenantAwareAuthenticationDetails;
import org.eclipse.hawkbit.im.authentication.UserPrincipal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.context.annotation.Bean;
@@ -22,7 +21,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.authentication.configurers.GlobalAuthenticationConfigurerAdapter;
import org.springframework.security.config.annotation.authentication.configuration.GlobalAuthenticationConfigurerAdapter;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
@@ -37,8 +36,11 @@ import org.springframework.security.provisioning.InMemoryUserDetailsManager;
@ConditionalOnMissingBean(UserDetailsService.class)
public class InMemoryUserManagementAutoConfiguration extends GlobalAuthenticationConfigurerAdapter {
@Autowired
private SecurityProperties securityProperties;
private final SecurityProperties securityProperties;
InMemoryUserManagementAutoConfiguration(final SecurityProperties securityProperties) {
this.securityProperties = securityProperties;
}
@Override
public void configure(final AuthenticationManagerBuilder auth) throws Exception {
@@ -52,7 +54,7 @@ public class InMemoryUserManagementAutoConfiguration extends GlobalAuthenticatio
*/
@Bean
@ConditionalOnMissingBean
public UserDetailsService userDetailsService() {
UserDetailsService userDetailsService() {
final InMemoryUserDetailsManager inMemoryUserDetailsManager = new InMemoryUserPrincipalDetailsManager();
inMemoryUserDetailsManager.setAuthenticationManager(null);
inMemoryUserDetailsManager.createUser(new User(securityProperties.getUser().getName(),
@@ -65,7 +67,7 @@ public class InMemoryUserManagementAutoConfiguration extends GlobalAuthenticatio
*/
@Bean
@ConditionalOnMissingBean
public MultitenancyIndicator multiTenancyIndicator() {
MultitenancyIndicator multiTenancyIndicator() {
return () -> false;
}

View File

@@ -52,7 +52,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.context.annotation.AdviceMode;
@@ -108,9 +107,6 @@ public class SecurityManagedConfiguration {
private static final int DOS_FILTER_ORDER = -200;
@Autowired
private AuthenticationConfiguration configuration;
/**
* @return the {@link UserAuthenticationFilter} to include into the hawkBit
* security configuration.
@@ -122,7 +118,8 @@ public class SecurityManagedConfiguration {
@ConditionalOnMissingBean
// Exception squid:S00112 - Is aspectJ proxy
@SuppressWarnings({ "squid:S00112" })
public UserAuthenticationFilter userAuthenticationFilter() throws Exception {
UserAuthenticationFilter userAuthenticationFilter(final AuthenticationConfiguration configuration)
throws Exception {
return new UserAuthenticationFilterBasicAuth(configuration.getAuthenticationManager());
}
@@ -154,19 +151,19 @@ public class SecurityManagedConfiguration {
private final TenantConfigurationManagement tenantConfigurationManagement;
private final TenantAware tenantAware;
private final DdiSecurityProperties ddiSecurityConfiguration;
private final SecurityProperties springSecurityProperties;
private final HawkbitSecurityProperties securityProperties;
private final SystemSecurityContext systemSecurityContext;
@Autowired
ControllerSecurityConfigurationAdapter(final ControllerManagement controllerManagement,
final TenantConfigurationManagement tenantConfigurationManagement, final TenantAware tenantAware,
final DdiSecurityProperties ddiSecurityConfiguration, final SecurityProperties springSecurityProperties,
final SystemSecurityContext systemSecurityContext) {
final DdiSecurityProperties ddiSecurityConfiguration,
final HawkbitSecurityProperties securityProperties, final SystemSecurityContext systemSecurityContext) {
this.controllerManagement = controllerManagement;
this.tenantConfigurationManagement = tenantConfigurationManagement;
this.tenantAware = tenantAware;
this.ddiSecurityConfiguration = ddiSecurityConfiguration;
this.springSecurityProperties = springSecurityProperties;
this.securityProperties = securityProperties;
this.systemSecurityContext = systemSecurityContext;
}
@@ -219,7 +216,7 @@ public class SecurityManagedConfiguration {
HttpSecurity httpSec = http.csrf().disable();
if (springSecurityProperties.isRequireSsl()) {
if (securityProperties.isRequireSsl()) {
httpSec = httpSec.requiresChannel().anyRequest().requiresSecure().and();
}
@@ -270,19 +267,19 @@ public class SecurityManagedConfiguration {
private final TenantConfigurationManagement tenantConfigurationManagement;
private final TenantAware tenantAware;
private final DdiSecurityProperties ddiSecurityConfiguration;
private final SecurityProperties springSecurityProperties;
private final HawkbitSecurityProperties securityProperties;
private final SystemSecurityContext systemSecurityContext;
@Autowired
ControllerDownloadSecurityConfigurationAdapter(final ControllerManagement controllerManagement,
final TenantConfigurationManagement tenantConfigurationManagement, final TenantAware tenantAware,
final DdiSecurityProperties ddiSecurityConfiguration, final SecurityProperties springSecurityProperties,
final SystemSecurityContext systemSecurityContext) {
final DdiSecurityProperties ddiSecurityConfiguration,
final HawkbitSecurityProperties securityProperties, final SystemSecurityContext systemSecurityContext) {
this.controllerManagement = controllerManagement;
this.tenantConfigurationManagement = tenantConfigurationManagement;
this.tenantAware = tenantAware;
this.ddiSecurityConfiguration = ddiSecurityConfiguration;
this.springSecurityProperties = springSecurityProperties;
this.securityProperties = securityProperties;
this.systemSecurityContext = systemSecurityContext;
}
@@ -341,7 +338,7 @@ public class SecurityManagedConfiguration {
HttpSecurity httpSec = http.csrf().disable();
if (springSecurityProperties.isRequireSsl()) {
if (securityProperties.isRequireSsl()) {
httpSec = httpSec.requiresChannel().anyRequest().requiresSecure().and();
}
@@ -465,7 +462,7 @@ public class SecurityManagedConfiguration {
private SystemManagement systemManagement;
@Autowired
private SecurityProperties springSecurityProperties;
private HawkbitSecurityProperties securityProperties;
@Autowired
private SystemSecurityContext systemSecurityContext;
@@ -497,10 +494,10 @@ public class SecurityManagedConfiguration {
protected void configure(final HttpSecurity http) throws Exception {
final BasicAuthenticationEntryPoint basicAuthEntryPoint = new BasicAuthenticationEntryPoint();
basicAuthEntryPoint.setRealmName(springSecurityProperties.getBasic().getRealm());
basicAuthEntryPoint.setRealmName(securityProperties.getBasicRealm());
HttpSecurity httpSec = http.regexMatcher("\\/rest.*|\\/system/admin.*").csrf().disable();
if (springSecurityProperties.isRequireSsl()) {
if (securityProperties.isRequireSsl()) {
httpSec = httpSec.requiresChannel().anyRequest().requiresSecure().and();
}
@@ -545,9 +542,6 @@ public class SecurityManagedConfiguration {
@Autowired
private VaadinSecurityContext vaadinSecurityContext;
@Autowired
private SecurityProperties springSecurityProperties;
@Autowired
private HawkbitSecurityProperties hawkbitSecurityProperties;
@@ -635,7 +629,7 @@ public class SecurityManagedConfiguration {
// disable as CSRF is handled by Vaadin
.csrf().disable();
if (springSecurityProperties.isRequireSsl()) {
if (hawkbitSecurityProperties.isRequireSsl()) {
httpSec = httpSec.requiresChannel().anyRequest().requiresSecure().and();
} else {

View File

@@ -7,12 +7,9 @@
# http://www.eclipse.org/legal/epl-v10.html
#
# Displayed basic auth realm
security.basic.realm=HawkBit
# User Security
security.user.name=admin
security.user.password=admin
spring.security.user.name=admin
spring.security.user.password={noop}admin
# DDI and download security
hawkbit.server.ddi.security.authentication.header.enabled=false

View File

@@ -10,10 +10,6 @@ package org.eclipse.hawkbit.tenancy;
/**
* Interface for components that are aware of the application's current tenant.
*
*
*
*
*/
public interface TenantAware {

View File

@@ -59,9 +59,9 @@
<artifactId>spring-boot</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>

View File

@@ -20,7 +20,7 @@ import com.google.common.collect.Maps;
* Bean which holds the necessary properties for configuring the AMQP deadletter
* queue.
*/
@ConfigurationProperties("hawkbit.dmf.rabbitmq.deadLetter")
@ConfigurationProperties("hawkbit.dmf.rabbitmq.dead-letter")
public class AmqpDeadletterProperties {
private static final int THREE_WEEKS = 21;

View File

@@ -35,8 +35,8 @@ import org.eclipse.hawkbit.repository.SoftwareModuleManagement;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.event.remote.TargetAssignDistributionSetEvent;
import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
import org.eclipse.hawkbit.repository.event.remote.TargetAttributesRequestedEvent;
import org.eclipse.hawkbit.repository.event.remote.TargetDeletedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.model.Artifact;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
@@ -140,7 +140,7 @@ public class AmqpMessageDispatcherService extends BaseAmqpService {
.forEach(
module -> modules.put(module,
softwareModuleManagement.findMetaDataBySoftwareModuleIdAndTargetVisible(
new PageRequest(0, RepositoryConstants.MAX_META_DATA_COUNT), module.getId())
PageRequest.of(0, RepositoryConstants.MAX_META_DATA_COUNT), module.getId())
.getContent()));
targetManagement.getByControllerID(assignedEvent.getActions().keySet())

View File

@@ -9,11 +9,9 @@
package org.eclipse.hawkbit.amqp;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
@@ -43,7 +41,6 @@ import org.springframework.amqp.AmqpRejectAndDontRequeueException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.messaging.converter.MessageConversionException;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.Authentication;
@@ -271,7 +268,7 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
if (isCorrelationIdNotEmpty(message)) {
messages.add(RepositoryConstants.SERVER_MESSAGE_PREFIX + "DMF message correlation-id "
+ convertCorrelationId(message));
+ message.getMessageProperties().getCorrelationId());
}
final Status status = mapStatus(message, actionUpdateStatus, action);
@@ -287,8 +284,7 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
}
private static boolean isCorrelationIdNotEmpty(final Message message) {
return message.getMessageProperties().getCorrelationId() != null
&& message.getMessageProperties().getCorrelationId().length > 0;
return StringUtils.hasLength(message.getMessageProperties().getCorrelationId());
}
// Exception squid:MethodCyclomaticComplexity - false positive, is a simple
@@ -341,10 +337,6 @@ public class AmqpMessageHandlerService extends BaseAmqpService {
return null;
}
private static String convertCorrelationId(final Message message) {
return new String(message.getMessageProperties().getCorrelationId(), StandardCharsets.UTF_8);
}
private Action getUpdateActionStatus(final Status status, final ActionStatusCreate actionStatus) {
if (Status.CANCELED.equals(status)) {
return controllerManagement.addCancelActionStatus(actionStatus);

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.amqp;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.listener.RabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpoint;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.util.ErrorHandler;
@@ -44,8 +45,9 @@ public class ConfigurableRabbitListenerContainerFactory extends SimpleRabbitList
// Exception squid:UnusedProtectedMethod - called by
// AbstractRabbitListenerContainerFactory
@SuppressWarnings("squid:UnusedProtectedMethod")
protected void initializeContainer(final SimpleMessageListenerContainer instance) {
super.initializeContainer(instance);
protected void initializeContainer(final SimpleMessageListenerContainer instance,
final RabbitListenerEndpoint endpoint) {
super.initializeContainer(instance, endpoint);
instance.setDeclarationRetries(declarationRetries);
}
}

View File

@@ -9,15 +9,15 @@
package org.eclipse.hawkbit.amqp;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.UUID;
import org.eclipse.hawkbit.util.IpUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.support.CorrelationData;
import org.springframework.util.StringUtils;
/**
* A default implementation for the sender service. The service sends all amqp
@@ -47,7 +47,7 @@ public class DefaultAmqpMessageSenderService extends BaseAmqpService implements
final String correlationId = UUID.randomUUID().toString();
if (isCorrelationIdEmpty(message)) {
message.getMessageProperties().setCorrelationId(correlationId.getBytes(StandardCharsets.UTF_8));
message.getMessageProperties().setCorrelationId(correlationId);
}
if (LOGGER.isTraceEnabled()) {
@@ -60,8 +60,7 @@ public class DefaultAmqpMessageSenderService extends BaseAmqpService implements
}
protected static boolean isCorrelationIdEmpty(final Message message) {
return message.getMessageProperties().getCorrelationId() == null
|| message.getMessageProperties().getCorrelationId().length <= 0;
return !StringUtils.hasLength(message.getMessageProperties().getCorrelationId());
}
}

View File

@@ -10,9 +10,9 @@ package org.eclipse.hawkbit.amqp;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -51,7 +51,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
@@ -164,7 +164,6 @@ public class AmqpControllerAuthenticationTest {
final AbstractDbArtifact artifact = new ArtifactFilesystem(new File("does not exist"), SHA1,
new DbArtifactHash(SHA1, "md5 test"), ARTIFACT_SIZE, null);
when(artifactManagementMock.loadArtifactBinary(SHA1)).thenReturn(Optional.of(artifact));
amqpMessageHandlerService = new AmqpMessageHandlerService(rabbitTemplate,
mock(AmqpMessageDispatcherService.class), controllerManagementMock, new JpaEntityFactory());

View File

@@ -12,9 +12,9 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.eq;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
import java.io.File;
@@ -59,7 +59,7 @@ import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.AbstractJavaTypeMapper;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import io.qameta.allure.Description;
@@ -69,7 +69,7 @@ import io.qameta.allure.Story;
@ActiveProfiles({ "test" })
@Feature("Component Tests - Device Management Federation API")
@Story("AmqpMessage Dispatcher Service Test")
@SpringApplicationConfiguration(classes = { RepositoryApplicationConfiguration.class })
@SpringBootTest(classes = { RepositoryApplicationConfiguration.class })
public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
private static final String TENANT = "default";
@@ -214,7 +214,7 @@ public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTest {
});
}
}
@Test
@Description("Verifies that sending update controller attributes event works.")
public void sendUpdateAttributesRequest() {

View File

@@ -10,10 +10,10 @@ package org.eclipse.hawkbit.amqp;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyBoolean;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
@@ -43,7 +43,6 @@ import org.eclipse.hawkbit.repository.EntityFactory;
import org.eclipse.hawkbit.repository.UpdateMode;
import org.eclipse.hawkbit.repository.builder.ActionStatusBuilder;
import org.eclipse.hawkbit.repository.builder.ActionStatusCreate;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.model.helper.SecurityTokenGeneratorHolder;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status;
@@ -60,7 +59,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.amqp.AmqpRejectAndDontRequeueException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
@@ -392,8 +391,6 @@ public class AmqpMessageHandlerServiceTest {
final Artifact localArtifactMock = mock(Artifact.class);
when(artifactManagementMock.findFirstBySHA1(anyString())).thenReturn(Optional.of(localArtifactMock));
when(controllerManagementMock.getActionForDownloadByTargetAndSoftwareModule(anyString(), anyLong()))
.thenThrow(EntityNotFoundException.class);
// test
final Message onMessage = amqpAuthenticationMessageHandlerService.onAuthenticationRequest(message);
@@ -515,15 +512,11 @@ public class AmqpMessageHandlerServiceTest {
final Target targetMock = mock(Target.class);
final DistributionSet distributionSetMock = mock(DistributionSet.class);
when(distributionSetMock.getId()).thenReturn(1L);
when(actionMock.getDistributionSet()).thenReturn(distributionSetMock);
when(actionMock.getId()).thenReturn(targetId);
when(actionMock.getStatus()).thenReturn(status);
when(actionMock.getTenant()).thenReturn("DEFAULT");
when(actionMock.getTarget()).thenReturn(targetMock);
when(targetMock.getControllerId()).thenReturn("target1");
when(targetMock.getSecurityToken()).thenReturn("securityToken");
when(targetMock.getAddress()).thenReturn(null);
return actionMock;
}

View File

@@ -39,6 +39,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetAssignmentResult;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.repository.test.TestConfiguration;
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
import org.eclipse.hawkbit.util.IpUtil;
import org.junit.Assert;
@@ -49,7 +50,8 @@ import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.test.RabbitListenerTestHarness;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.test.binder.TestSupportBinderAutoConfiguration;
import org.springframework.test.context.ContextConfiguration;
import io.qameta.allure.Step;
@@ -58,9 +60,10 @@ import io.qameta.allure.Step;
* Common class for {@link AmqpMessageHandlerServiceIntegrationTest} and
* {@link AmqpMessageDispatcherServiceIntegrationTest}.
*/
@SpringApplicationConfiguration(classes = { RepositoryApplicationConfiguration.class, AmqpTestConfiguration.class,
DmfApiConfiguration.class, DmfTestConfiguration.class })
public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegrationTest {
@ContextConfiguration(classes = { DmfApiConfiguration.class, DmfTestConfiguration.class,
RepositoryApplicationConfiguration.class, AmqpTestConfiguration.class, TestConfiguration.class,
TestSupportBinderAutoConfiguration.class })
public abstract class AbstractAmqpServiceIntegrationTest extends AbstractAmqpIntegrationTest {
protected static final String TENANT_EXIST = "DEFAULT";
protected static final String CREATED_BY = "CONTROLLER_PLUG_AND_PLAY";
@@ -99,7 +102,7 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
}
protected void verifyDeadLetterMessages(final int expectedMessages) {
createConditionFactory().until(() -> {
createConditionFactory().untilAsserted(() -> {
Mockito.verify(getDeadletterListener(), Mockito.times(expectedMessages)).handleMessage(Mockito.any());
});
}
@@ -165,8 +168,7 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
final Map<String, Object> headers = replyMessage.getMessageProperties().getHeaders();
assertThat(headers.get(MessageHeaderKey.TENANT)).isEqualTo(TENANT_EXIST);
assertThat(correlationId)
.isEqualTo(new String(replyMessage.getMessageProperties().getCorrelationId(), StandardCharsets.UTF_8));
assertThat(correlationId).isEqualTo(replyMessage.getMessageProperties().getCorrelationId());
assertThat(headers.get(MessageHeaderKey.TYPE)).isEqualTo(MessageType.PING_RESPONSE.toString());
assertThat(Long.valueOf(new String(replyMessage.getBody(), StandardCharsets.UTF_8)))
.isLessThanOrEqualTo(System.currentTimeMillis());
@@ -213,7 +215,7 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
}
protected void verifyReplyToListener() {
createConditionFactory().until(() -> {
createConditionFactory().untilAsserted(() -> {
Mockito.verify(replyToListener, Mockito.atLeast(1)).handleMessage(Mockito.any());
});
}
@@ -306,7 +308,7 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
protected Message createPingMessage(final String correlationId, final String tenant) {
final MessageProperties messageProperties = createMessagePropertiesWithTenant(tenant);
messageProperties.getHeaders().put(MessageHeaderKey.TYPE, MessageType.PING.toString());
messageProperties.setCorrelationId(correlationId.getBytes());
messageProperties.setCorrelationId(correlationId);
messageProperties.setReplyTo(DmfTestConfiguration.REPLY_TO_EXCHANGE);
return createMessage(null, messageProperties);
@@ -354,7 +356,7 @@ public abstract class AmqpServiceIntegrationTest extends AbstractAmqpIntegration
protected void assertUpdateAttributes(final String controllerId, final Map<String, String> attributes) {
waitUntilIsPresent(() -> controllerManagement.getByControllerId(controllerId));
createConditionFactory().until(() -> {
createConditionFactory().untilAsserted(() -> {
try {
final Map<String, String> controllerAttributes = securityRule
.runAsPrivileged(() -> targetManagement.getControllerAttributes(controllerId));

View File

@@ -19,8 +19,6 @@ import org.eclipse.hawkbit.amqp.DmfApiConfiguration;
import org.eclipse.hawkbit.dmf.amqp.api.AmqpSettings;
import org.eclipse.hawkbit.dmf.json.model.DmfDownloadResponse;
import org.eclipse.hawkbit.rabbitmq.test.AbstractAmqpIntegrationTest;
import org.eclipse.hawkbit.rabbitmq.test.AmqpTestConfiguration;
import org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration;
import org.eclipse.hawkbit.repository.model.Artifact;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
@@ -35,7 +33,7 @@ import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.HttpStatus;
import org.springframework.util.StringUtils;
@@ -45,8 +43,7 @@ import io.qameta.allure.Story;
@Feature("Component Tests - Device Management Federation API")
@Story("Amqp Authentication Message Handler")
@SpringApplicationConfiguration(classes = { RepositoryApplicationConfiguration.class, AmqpTestConfiguration.class,
DmfApiConfiguration.class })
@SpringBootTest(classes = { DmfApiConfiguration.class })
public class AmqpAuthenticationMessageHandlerIntegrationTest extends AbstractAmqpIntegrationTest {
private static final String TARGET_SECRUITY_TOKEN = "12345";

View File

@@ -40,7 +40,7 @@ import io.qameta.allure.Story;
@Feature("Component Tests - Device Management Federation API")
@Story("Amqp Message Dispatcher Service")
public class AmqpMessageDispatcherServiceIntegrationTest extends AmqpServiceIntegrationTest {
public class AmqpMessageDispatcherServiceIntegrationTest extends AbstractAmqpServiceIntegrationTest {
private static final String TARGET_PREFIX = "Dmf_disp_";
@Test

View File

@@ -58,7 +58,7 @@ import io.qameta.allure.Story;
@Feature("Component Tests - Device Management Federation API")
@Story("Amqp Message Handler Service")
public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegrationTest {
public class AmqpMessageHandlerServiceIntegrationTest extends AbstractAmqpServiceIntegrationTest {
private static final String CORRELATION_ID = UUID.randomUUID().toString();
private static final String TARGET_PREFIX = "Dmf_hand_";
@@ -836,7 +836,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
}
private void assertAction(final Long actionId, final int messages, final Status... expectedActionStates) {
createConditionFactory().await().until(() -> {
createConditionFactory().await().untilAsserted(() -> {
try {
securityRule.runAsPrivileged(() -> {
final List<ActionStatus> actionStatusList = deploymentManagement
@@ -870,7 +870,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
final MessageProperties messageProperties = createMessagePropertiesWithTenant(tenant);
messageProperties.getHeaders().put(MessageHeaderKey.TYPE, MessageType.EVENT.toString());
messageProperties.getHeaders().put(MessageHeaderKey.TOPIC, eventTopic.toString());
messageProperties.setCorrelationId(CORRELATION_ID.getBytes());
messageProperties.setCorrelationId(CORRELATION_ID);
return createMessage(payload, messageProperties);
}
@@ -896,7 +896,7 @@ public class AmqpMessageHandlerServiceIntegrationTest extends AmqpServiceIntegra
private void verifyNumberOfDeadLetterMessages(final int numberOfInvocations) {
assertEmptyReceiverQueueCount();
createConditionFactory().until(() -> Mockito.verify(getDeadletterListener(), Mockito.times(numberOfInvocations))
.handleMessage(Mockito.any()));
createConditionFactory().untilAsserted(() -> Mockito
.verify(getDeadletterListener(), Mockito.times(numberOfInvocations)).handleMessage(Mockito.any()));
}
}

View File

@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.integration.listener;
import static org.junit.Assert.fail;
import java.nio.charset.StandardCharsets;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
@@ -53,9 +52,7 @@ public class ReplyToListener implements TestRabbitListener {
}
if (messageType == MessageType.PING_RESPONSE) {
final String correlationId = new String(message.getMessageProperties().getCorrelationId(),
StandardCharsets.UTF_8);
pingResponseMessages.put(correlationId, message);
pingResponseMessages.put(message.getMessageProperties().getCorrelationId(), message);
return;
}

View File

@@ -9,58 +9,74 @@
-->
<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.hawkbit</groupId>
<artifactId>hawkbit-dmf-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
</parent>
<artifactId>hawkbit-dmf-rabbitmq-test</artifactId>
<name>hawkBit :: DMF :: RabbitMq Test module</name>
<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.hawkbit</groupId>
<artifactId>hawkbit-dmf-parent</artifactId>
<version>0.3.0-SNAPSHOT</version>
</parent>
<artifactId>hawkbit-dmf-rabbitmq-test</artifactId>
<name>hawkBit :: DMF :: RabbitMq Test module</name>
<dependencies>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-jpa</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-dmf-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit-junit</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit-test</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-test</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-jpa</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-dmf-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit-junit</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>http-client</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit-test</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.hawkbit</groupId>
<artifactId>hawkbit-repository-test</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@@ -8,9 +8,13 @@
*/
package org.eclipse.hawkbit.rabbitmq.test;
import java.time.Duration;
import java.util.concurrent.TimeUnit;
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionFactory;
import org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration;
import org.eclipse.hawkbit.repository.test.TestConfiguration;
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTest;
import org.junit.Before;
import org.junit.Rule;
@@ -22,18 +26,18 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.junit.BrokerRunning;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.test.binder.TestSupportBinderAutoConfiguration;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import com.jayway.awaitility.Awaitility;
import com.jayway.awaitility.core.ConditionFactory;
@SpringApplicationConfiguration(classes = { RepositoryApplicationConfiguration.class, AmqpTestConfiguration.class })
@ContextConfiguration(classes = { RepositoryApplicationConfiguration.class, AmqpTestConfiguration.class,
TestConfiguration.class, TestSupportBinderAutoConfiguration.class })
// Dirty context is necessary to create a new vhost and recreate all necessary
// beans after every test class.
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
public abstract class AbstractAmqpIntegrationTest extends AbstractIntegrationTest {
private static final Duration TIMEOUT = Duration.ofSeconds(5);
@Rule
@Autowired
@@ -59,7 +63,7 @@ public abstract class AbstractAmqpIntegrationTest extends AbstractIntegrationTes
}
protected ConditionFactory createConditionFactory() {
return Awaitility.await().atMost(5, TimeUnit.SECONDS);
return Awaitility.await().atMost(TIMEOUT.toMillis(), TimeUnit.MILLISECONDS);
}
protected Message createMessage(final Object payload, final MessageProperties messageProperties) {

View File

@@ -26,8 +26,9 @@ import com.rabbitmq.http.client.domain.UserPermissions;
* Creates and deletes a new virtual host if the rabbit mq management api is
* available.
*
*
*/
// exception squid:S2068 - Test instance passwd
@SuppressWarnings("squid:S2068")
public class RabbitMqSetupService {
private static final String GUEST = "guest";
@@ -44,7 +45,7 @@ public class RabbitMqSetupService {
private String password;
public RabbitMqSetupService(RabbitProperties properties) {
public RabbitMqSetupService(final RabbitProperties properties) {
hostname = properties.getHost();
username = properties.getUsername();
if (StringUtils.isEmpty(username)) {
@@ -118,7 +119,7 @@ public class RabbitMqSetupService {
static class AlivenessException extends RuntimeException {
private static final long serialVersionUID = 1L;
public AlivenessException(String hostname) {
public AlivenessException(final String hostname) {
super("Aliveness test failed for " + hostname
+ ":15672 guest/quest; rabbit mq management api not available");
}

View File

@@ -42,8 +42,20 @@
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>com.esotericsoftware</groupId>
<artifactId>kryo-shaded</artifactId>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-rsa</artifactId>
</exclusion>
<exclusion>
<groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-el</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-context</artifactId>
</exclusion>
</exclusions>
</dependency>

View File

@@ -24,8 +24,8 @@ import org.eclipse.hawkbit.repository.builder.ActionStatusCreate;
import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException;
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.exception.QuotaExceededException;
import org.eclipse.hawkbit.repository.exception.InvalidTargetAttributeException;
import org.eclipse.hawkbit.repository.exception.QuotaExceededException;
import org.eclipse.hawkbit.repository.model.Action;
import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.ActionStatus;
@@ -400,9 +400,9 @@ public interface ControllerManagement {
/**
* Cancels given {@link Action} for this {@link Target}. However, it might
* be possible that the controller will continue to work on the cancelation.
* The controller needs to acknowledge or reject the cancelation using
* {@link DdiRootController#postCancelActionFeedback}.
* be possible that the controller will continue to work on the
* cancellation. The controller needs to acknowledge or reject the
* cancellation using {@link DdiRootController#postCancelActionFeedback}.
*
* @param actionId
* to be canceled

View File

@@ -21,7 +21,7 @@ import org.springframework.data.domain.Sort;
public final class OffsetBasedPageRequest extends PageRequest {
private static final long serialVersionUID = 1L;
private final int offset;
private final long offset;
/**
* Creates a new {@link OffsetBasedPageRequest}. Offsets are zero indexed,
@@ -32,8 +32,8 @@ public final class OffsetBasedPageRequest extends PageRequest {
* @param limit
* the limit of the page to be returned.
*/
public OffsetBasedPageRequest(final int offset, final int limit) {
this(offset, limit, null);
public OffsetBasedPageRequest(final long offset, final int limit) {
this(offset, limit, Sort.unsorted());
}
/**
@@ -47,13 +47,13 @@ public final class OffsetBasedPageRequest extends PageRequest {
* @param sort
* sort can be {@literal null}.
*/
public OffsetBasedPageRequest(final int offset, final int limit, final Sort sort) {
public OffsetBasedPageRequest(final long offset, final int limit, final Sort sort) {
super(0, limit, sort);
this.offset = offset;
}
@Override
public int getOffset() {
public long getOffset() {
return offset;
}
@@ -67,7 +67,7 @@ public final class OffsetBasedPageRequest extends PageRequest {
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + offset;
result = prime * result + (int) (offset ^ (offset >>> 32));
return result;
}
@@ -79,11 +79,14 @@ public final class OffsetBasedPageRequest extends PageRequest {
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof OffsetBasedPageRequest)) {
if (getClass() != obj.getClass()) {
return false;
}
final OffsetBasedPageRequest other = (OffsetBasedPageRequest) obj;
return offset == other.offset;
if (offset != other.offset) {
return false;
}
return true;
}
}

View File

@@ -631,6 +631,7 @@ public interface TargetManagement {
* @throws EntityNotFoundException
* if target with given ID does not exist
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Map<String, String> getControllerAttributes(@NotEmpty String controllerId);
/**
@@ -642,6 +643,7 @@ public interface TargetManagement {
* @throws EntityNotFoundException
* if target with given ID does not exist
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
void requestControllerAttributes(@NotEmpty String controllerId);
/**
@@ -652,8 +654,33 @@ public interface TargetManagement {
* @return {@code true}: update of controller attributes triggered.
* {@code false}: update of controller attributes not requested.
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
boolean isControllerAttributesRequested(@NotEmpty String controllerId);
/**
* Retrieves {@link Target}s where
* {@link #isControllerAttributesRequested(String)}.
*
* @param pageReq
* page parameter
*
* @return the found {@link Target}s
*
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
Page<Target> findByControllerAttributesRequested(@NotNull Pageable pageReq);
/**
* Verifies that {@link Target} with given controller ID exists in the
* repository.
*
* @param controllerId
* of target
* @return {@code true} if target with given ID exists
*/
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
boolean existsByControllerId(@NotEmpty String controllerId);
/**
* Creates a list of target meta data entries.
*

View File

@@ -40,7 +40,7 @@ public class RemoteTenantAwareEvent extends RemoteApplicationEvent implements Te
* the applicationId
*/
public RemoteTenantAwareEvent(final Object source, final String tenant, final String applicationId) {
super(source, applicationId, "**");
super(source, applicationId);
this.tenant = tenant;
}

View File

@@ -25,7 +25,7 @@ public final class ArtifactBinaryNotFoundException extends AbstractServerRtExcep
/**
* Creates a new FileUploadFailedException with
* {@link SpServerError#SP_REST_BODY_NOT_READABLE} error.
* {@link SpServerError#SP_ARTIFACT_LOAD_FAILED} error.
*/
public ArtifactBinaryNotFoundException() {
super(SpServerError.SP_ARTIFACT_LOAD_FAILED);

View File

@@ -26,7 +26,7 @@ public final class ArtifactDeleteFailedException extends AbstractServerRtExcepti
/**
* Creates a new FileUploadFailedException with
* {@link SpServerError#SP_REST_BODY_NOT_READABLE} error.
* {@link SpServerError#SP_ARTIFACT_DELETE_FAILED} error.
*/
public ArtifactDeleteFailedException() {
super(SpServerError.SP_ARTIFACT_DELETE_FAILED);

View File

@@ -22,7 +22,7 @@ public final class ArtifactUploadFailedException extends AbstractServerRtExcepti
/**
* Creates a new FileUploadFailedException with
* {@link SpServerError#SP_REST_BODY_NOT_READABLE} error.
* {@link SpServerError#SP_ARTIFACT_UPLOAD_FAILED} error.
*/
public ArtifactUploadFailedException() {
super(SpServerError.SP_ARTIFACT_UPLOAD_FAILED);

View File

@@ -8,13 +8,15 @@
*/
package org.eclipse.hawkbit.repository.rsql;
import java.io.Serializable;
/**
* Implementations map a placeholder to the associated value.
* <p>
* This is used in context of string replacement.
*/
@FunctionalInterface
public interface VirtualPropertyReplacer {
public interface VirtualPropertyReplacer extends Serializable {
/**
* Looks up a placeholders and replaces them

View File

@@ -9,7 +9,7 @@
package org.eclipse.hawkbit.repository.model.helper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.cloud.bus.BusProperties;
import org.springframework.context.ApplicationEventPublisher;
/**
@@ -26,7 +26,7 @@ public final class EventPublisherHolder {
private ApplicationEventPublisher eventPublisher;
@Autowired
private ApplicationContext applicationContext;
private BusProperties bus;
private EventPublisherHolder() {
@@ -47,7 +47,7 @@ public final class EventPublisherHolder {
}
public String getApplicationId() {
return applicationContext.getId();
return bus.getId();
}
}

View File

@@ -42,10 +42,12 @@ import org.eclipse.hawkbit.repository.TimestampCalculator;
*/
public class VirtualPropertyResolver extends StrLookup<String> implements VirtualPropertyReplacer {
private StrSubstitutor substitutor;
private static final long serialVersionUID = 1L;
private transient StrSubstitutor substitutor;
@Override
public String lookup(String rhs) {
public String lookup(final String rhs) {
String resolved = null;
if ("now_ts".equalsIgnoreCase(rhs)) {
@@ -57,7 +59,7 @@ public class VirtualPropertyResolver extends StrLookup<String> implements Virtua
}
@Override
public String replace(String input) {
public String replace(final String input) {
if (substitutor == null) {
substitutor = new StrSubstitutor(this, StrSubstitutor.DEFAULT_PREFIX, StrSubstitutor.DEFAULT_SUFFIX,
StrSubstitutor.DEFAULT_ESCAPE);

View File

@@ -21,7 +21,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.cloud.bus.event.RemoteApplicationEvent;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageHeaders;

View File

@@ -103,16 +103,6 @@
<artifactId>allure-junit4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@@ -121,7 +111,7 @@
<plugin>
<groupId>com.ethlo.persistence.tools</groupId>
<artifactId>eclipselink-maven-plugin</artifactId>
<version>2.7.0</version>
<version>2.7.1.1</version>
<executions>
<execution>
<id>modelgen</id>

View File

@@ -34,7 +34,7 @@ import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.cloud.bus.BusProperties;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.util.CollectionUtils;
@@ -50,19 +50,19 @@ public abstract class AbstractDsAssignmentStrategy {
protected final TargetRepository targetRepository;
protected final AfterTransactionCommitExecutor afterCommit;
protected final ApplicationEventPublisher eventPublisher;
protected final ApplicationContext applicationContext;
protected final BusProperties bus;
private final ActionRepository actionRepository;
private final ActionStatusRepository actionStatusRepository;
private final QuotaManagement quotaManagement;
AbstractDsAssignmentStrategy(final TargetRepository targetRepository,
final AfterTransactionCommitExecutor afterCommit, final ApplicationEventPublisher eventPublisher,
final ApplicationContext applicationContext, final ActionRepository actionRepository,
final BusProperties bus, final ActionRepository actionRepository,
final ActionStatusRepository actionStatusRepository, final QuotaManagement quotaManagement) {
this.targetRepository = targetRepository;
this.afterCommit = afterCommit;
this.eventPublisher = eventPublisher;
this.applicationContext = applicationContext;
this.bus = bus;
this.actionRepository = actionRepository;
this.actionStatusRepository = actionStatusRepository;
this.quotaManagement = quotaManagement;
@@ -138,14 +138,12 @@ public abstract class AbstractDsAssignmentStrategy {
return;
}
afterCommit.afterCommit(
() -> eventPublisher.publishEvent(new TargetAssignDistributionSetEvent(tenant, distributionSetId,
actions, applicationContext.getId(), actions.get(0).isMaintenanceWindowAvailable())));
afterCommit.afterCommit(() -> eventPublisher.publishEvent(new TargetAssignDistributionSetEvent(tenant,
distributionSetId, actions, bus.getId(), actions.get(0).isMaintenanceWindowAvailable())));
}
protected void sendTargetUpdatedEvent(final JpaTarget target) {
afterCommit.afterCommit(
() -> eventPublisher.publishEvent(new TargetUpdatedEvent(target, applicationContext.getId())));
afterCommit.afterCommit(() -> eventPublisher.publishEvent(new TargetUpdatedEvent(target, bus.getId())));
}
/**
@@ -216,8 +214,8 @@ public abstract class AbstractDsAssignmentStrategy {
* the action id of the assignment
*/
void cancelAssignDistributionSetEvent(final Target target, final Long actionId) {
afterCommit.afterCommit(() -> eventPublisher
.publishEvent(new CancelTargetAssignmentEvent(target, actionId, applicationContext.getId())));
afterCommit.afterCommit(
() -> eventPublisher.publishEvent(new CancelTargetAssignmentEvent(target, actionId, bus.getId())));
}
JpaAction createTargetAction(final Map<String, TargetWithActionType> targetsWithActionMap, final JpaTarget target,

View File

@@ -147,7 +147,7 @@ public interface DistributionSetRepository
@Override
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477
@Query("SELECT d FROM JpaDistributionSet d WHERE d.id IN ?1")
List<JpaDistributionSet> findAll(Iterable<Long> ids);
List<JpaDistributionSet> findAllById(Iterable<Long> ids);
/**
* Deletes all {@link TenantAwareBaseEntity} of a given tenant. For safety

View File

@@ -86,5 +86,5 @@ public interface DistributionSetTagRepository
@Override
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477
@Query("SELECT d FROM JpaDistributionSetTag d WHERE d.id IN ?1")
List<JpaDistributionSetTag> findAll(Iterable<Long> ids);
List<JpaDistributionSetTag> findAllById(Iterable<Long> ids);
}

View File

@@ -93,7 +93,7 @@ public interface DistributionSetTypeRepository
*/
@Override
@Query("SELECT d FROM JpaDistributionSetType d WHERE d.id IN ?1")
List<JpaDistributionSetType> findAll(Iterable<Long> ids);
List<JpaDistributionSetType> findAllById(Iterable<Long> ids);
/**
* Counts the {@link SoftwareModuleType}s which are associated with the

View File

@@ -193,12 +193,12 @@ public class JpaArtifactManagement implements ArtifactManagement {
((JpaSoftwareModule) existing.getSoftwareModule()).removeArtifact(existing);
softwareModuleRepository.save((JpaSoftwareModule) existing.getSoftwareModule());
localArtifactRepository.delete(id);
localArtifactRepository.deleteById(id);
}
@Override
public Optional<Artifact> get(final long id) {
return Optional.ofNullable(localArtifactRepository.findOne(id));
return Optional.ofNullable(localArtifactRepository.findById(id).orElse(null));
}
@Override
@@ -226,7 +226,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
}
private void throwExceptionIfSoftwareModuleDoesNotExist(final Long swId) {
if (!softwareModuleRepository.exists(swId)) {
if (!softwareModuleRepository.existsById(swId)) {
throw new EntityNotFoundException(SoftwareModule.class, swId);
}
}
@@ -256,13 +256,8 @@ public class JpaArtifactManagement implements ArtifactManagement {
}
private SoftwareModule getModuleAndThrowExceptionIfThatFails(final Long moduleId) {
final SoftwareModule softwareModule = softwareModuleRepository.findOne(moduleId);
if (softwareModule == null) {
LOG.debug("no software module with ID {} exists", moduleId);
throw new EntityNotFoundException(SoftwareModule.class, moduleId);
}
return softwareModule;
return softwareModuleRepository.findById(moduleId)
.orElseThrow(() -> new EntityNotFoundException(SoftwareModule.class, moduleId));
}
}

View File

@@ -40,10 +40,10 @@ import org.eclipse.hawkbit.repository.MaintenanceScheduleHelper;
import org.eclipse.hawkbit.repository.QuotaManagement;
import org.eclipse.hawkbit.repository.RepositoryConstants;
import org.eclipse.hawkbit.repository.RepositoryProperties;
import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
import org.eclipse.hawkbit.repository.UpdateMode;
import org.eclipse.hawkbit.repository.builder.ActionStatusCreate;
import org.eclipse.hawkbit.repository.event.remote.TargetAttributesRequestedEvent;
import org.eclipse.hawkbit.repository.event.remote.TargetPollEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.CancelTargetAssignmentEvent;
import org.eclipse.hawkbit.repository.exception.CancelActionNotAllowedException;
@@ -76,7 +76,7 @@ import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.T
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.cloud.bus.BusProperties;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.dao.ConcurrencyFailureException;
import org.springframework.data.domain.Page;
@@ -94,7 +94,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.validation.annotation.Validated;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
@@ -119,9 +118,6 @@ public class JpaControllerManagement implements ControllerManagement {
@Autowired
private TargetRepository targetRepository;
@Autowired
private TargetManagement targetManagement;
@Autowired
private SoftwareModuleRepository softwareModuleRepository;
@@ -144,7 +140,7 @@ public class JpaControllerManagement implements ControllerManagement {
private ApplicationEventPublisher eventPublisher;
@Autowired
private ApplicationContext applicationContext;
private BusProperties bus;
@Autowired
private AfterTransactionCommitExecutor afterCommit;
@@ -215,7 +211,7 @@ public class JpaControllerManagement implements ControllerManagement {
return getPollingTime();
}
return (new EventTimer(getPollingTime(), getMinPollingTime(), ChronoUnit.SECONDS))
return new EventTimer(getPollingTime(), getMinPollingTime(), ChronoUnit.SECONDS)
.timeToNextEvent(getMaintenanceWindowPollCount(), action.getMaintenanceWindowStartTime().orElse(null));
}
@@ -324,13 +320,13 @@ public class JpaControllerManagement implements ControllerManagement {
}
private void throwExceptionIfTargetDoesNotExist(final Long targetId) {
if (!targetRepository.exists(targetId)) {
if (!targetRepository.existsById(targetId)) {
throw new EntityNotFoundException(Target.class, targetId);
}
}
private void throwExceptionIfSoftwareModuleDoesNotExist(final Long moduleId) {
if (!softwareModuleRepository.exists(moduleId)) {
if (!softwareModuleRepository.existsById(moduleId)) {
throw new EntityNotFoundException(SoftwareModule.class, moduleId);
}
}
@@ -372,21 +368,20 @@ public class JpaControllerManagement implements ControllerManagement {
final Specification<JpaTarget> spec = (targetRoot, query, cb) -> cb
.equal(targetRoot.get(JpaTarget_.controllerId), controllerId);
final JpaTarget target = targetRepository.findOne(spec);
final Optional<JpaTarget> target = targetRepository.findOne(spec);
if (target == null) {
if (!target.isPresent()) {
final Target result = targetRepository.save((JpaTarget) entityFactory.target().create()
.controllerId(controllerId).description("Plug and Play target: " + controllerId).name(controllerId)
.status(TargetUpdateStatus.REGISTERED).lastTargetQuery(System.currentTimeMillis())
.address(Optional.ofNullable(address).map(URI::toString).orElse(null)).build());
afterCommit.afterCommit(
() -> eventPublisher.publishEvent(new TargetPollEvent(result, applicationContext.getId())));
afterCommit.afterCommit(() -> eventPublisher.publishEvent(new TargetPollEvent(result, bus.getId())));
return result;
}
return updateTargetStatus(target, address);
return updateTargetStatus(target.get(), address);
}
/**
@@ -433,8 +428,8 @@ public class JpaControllerManagement implements ControllerManagement {
pollChunks.forEach(chunk -> {
setLastTargetQuery(tenant, System.currentTimeMillis(), chunk);
chunk.forEach(controllerId -> afterCommit.afterCommit(() -> eventPublisher
.publishEvent(new TargetPollEvent(controllerId, tenant, applicationContext.getId()))));
chunk.forEach(controllerId -> afterCommit.afterCommit(
() -> eventPublisher.publishEvent(new TargetPollEvent(controllerId, tenant, bus.getId()))));
});
return null;
@@ -468,7 +463,7 @@ public class JpaControllerManagement implements ControllerManagement {
}
private static String formatQueryInStatementParams(final Collection<String> paramNames) {
return "#" + Joiner.on(",#").join(paramNames);
return "#" + String.join(",#", paramNames);
}
/**
@@ -488,8 +483,7 @@ public class JpaControllerManagement implements ControllerManagement {
toUpdate.setAddress(address.toString());
toUpdate.setLastTargetQuery(System.currentTimeMillis());
afterCommit.afterCommit(
() -> eventPublisher.publishEvent(new TargetPollEvent(toUpdate, applicationContext.getId())));
afterCommit.afterCommit(() -> eventPublisher.publishEvent(new TargetPollEvent(toUpdate, bus.getId())));
return targetRepository.save(toUpdate);
}
@@ -583,7 +577,7 @@ public class JpaControllerManagement implements ControllerManagement {
private boolean actionIsNotActiveButIntermediateFeedbackStillAllowed(final ActionStatus actionStatus,
final boolean actionActive) {
return !actionActive && (repositoryProperties.isRejectActionStatusForClosedAction()
|| (Status.ERROR.equals(actionStatus.getStatus()) || Status.FINISHED.equals(actionStatus.getStatus())));
|| Status.ERROR.equals(actionStatus.getStatus()) || Status.FINISHED.equals(actionStatus.getStatus()));
}
/**
@@ -615,12 +609,23 @@ public class JpaControllerManagement implements ControllerManagement {
final Action savedAction = actionRepository.save(action);
if (controllerId != null) {
targetManagement.requestControllerAttributes(controllerId);
requestControllerAttributes(controllerId);
}
return savedAction;
}
private void requestControllerAttributes(final String controllerId) {
final JpaTarget target = (JpaTarget) getByControllerId(controllerId)
.orElseThrow(() -> new EntityNotFoundException(Target.class, controllerId));
target.setRequestControllerAttributes(true);
eventPublisher.publishEvent(new TargetAttributesRequestedEvent(tenantAware.getCurrentTenant(), target.getId(),
target.getControllerId(), target.getAddress() != null ? target.getAddress().toString() : null,
JpaTarget.class.getName(), bus.getId()));
}
private void handleErrorOnAction(final JpaAction mergedAction, final JpaTarget mergedTarget) {
mergedAction.setActive(false);
mergedAction.setStatus(Status.ERROR);
@@ -823,12 +828,12 @@ public class JpaControllerManagement implements ControllerManagement {
@Override
public Optional<Target> get(final long targetId) {
return Optional.ofNullable(targetRepository.findOne(targetId));
return targetRepository.findById(targetId).map(t -> (Target) t);
}
@Override
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final long actionId) {
if (!actionRepository.exists(actionId)) {
if (!actionRepository.existsById(actionId)) {
throw new EntityNotFoundException(Action.class, actionId);
}
@@ -848,7 +853,7 @@ public class JpaControllerManagement implements ControllerManagement {
? RepositoryConstants.MAX_ACTION_HISTORY_MSG_COUNT
: messageCount;
final PageRequest pageable = new PageRequest(0, limit, new Sort(Direction.DESC, "occurredAt"));
final PageRequest pageable = PageRequest.of(0, limit, new Sort(Direction.DESC, "occurredAt"));
final Page<String> messages = actionStatusRepository.findMessagesByActionIdAndMessageNotLike(pageable, actionId,
RepositoryConstants.SERVER_MESSAGE_PREFIX + "%");
@@ -860,7 +865,7 @@ public class JpaControllerManagement implements ControllerManagement {
@Override
public Optional<SoftwareModule> getSoftwareModule(final long id) {
return Optional.ofNullable(softwareModuleRepository.findOne(id));
return softwareModuleRepository.findById(id).map(s -> (SoftwareModule) s);
}
@Override
@@ -868,7 +873,7 @@ public class JpaControllerManagement implements ControllerManagement {
final Collection<Long> moduleId) {
return softwareModuleMetadataRepository
.findBySoftwareModuleIdInAndTargetVisible(new PageRequest(0, RepositoryConstants.MAX_META_DATA_COUNT),
.findBySoftwareModuleIdInAndTargetVisible(PageRequest.of(0, RepositoryConstants.MAX_META_DATA_COUNT),
moduleId, true)
.getContent().stream().collect(Collectors.groupingBy(o -> (Long) o[0],
Collectors.mapping(o -> (SoftwareModuleMetadata) o[1], Collectors.toList())));
@@ -896,8 +901,8 @@ public class JpaControllerManagement implements ControllerManagement {
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((controllerId == null) ? 0 : controllerId.hashCode());
result = prime * result + ((tenant == null) ? 0 : tenant.hashCode());
result = prime * result + (controllerId == null ? 0 : controllerId.hashCode());
result = prime * result + (tenant == null ? 0 : tenant.hashCode());
return result;
}
@@ -980,7 +985,7 @@ public class JpaControllerManagement implements ControllerManagement {
}
private void cancelAssignDistributionSetEvent(final JpaTarget target, final Long actionId) {
afterCommit.afterCommit(() -> eventPublisher
.publishEvent(new CancelTargetAssignmentEvent(target, actionId, applicationContext.getId())));
afterCommit.afterCommit(
() -> eventPublisher.publishEvent(new CancelTargetAssignmentEvent(target, actionId, bus.getId())));
}
}

View File

@@ -69,7 +69,7 @@ import org.eclipse.hawkbit.tenancy.TenantAware;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.cloud.bus.BusProperties;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.dao.ConcurrencyFailureException;
import org.springframework.data.domain.AuditorAware;
@@ -88,7 +88,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
/**
@@ -125,7 +124,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
private final TargetManagement targetManagement;
private final AuditorAware<String> auditorProvider;
private final ApplicationEventPublisher eventPublisher;
private final ApplicationContext applicationContext;
private final BusProperties bus;
private final AfterTransactionCommitExecutor afterCommit;
private final VirtualPropertyReplacer virtualPropertyReplacer;
private final PlatformTransactionManager txManager;
@@ -141,7 +140,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
final DistributionSetRepository distributionSetRepository, final TargetRepository targetRepository,
final ActionStatusRepository actionStatusRepository, final TargetManagement targetManagement,
final AuditorAware<String> auditorProvider, final ApplicationEventPublisher eventPublisher,
final ApplicationContext applicationContext, final AfterTransactionCommitExecutor afterCommit,
final BusProperties bus, final AfterTransactionCommitExecutor afterCommit,
final VirtualPropertyReplacer virtualPropertyReplacer, final PlatformTransactionManager txManager,
final TenantConfigurationManagement tenantConfigurationManagement, final QuotaManagement quotaManagement,
final SystemSecurityContext systemSecurityContext, final TenantAware tenantAware, final Database database) {
@@ -153,14 +152,14 @@ public class JpaDeploymentManagement implements DeploymentManagement {
this.targetManagement = targetManagement;
this.auditorProvider = auditorProvider;
this.eventPublisher = eventPublisher;
this.applicationContext = applicationContext;
this.bus = bus;
this.afterCommit = afterCommit;
this.virtualPropertyReplacer = virtualPropertyReplacer;
this.txManager = txManager;
onlineDsAssignmentStrategy = new OnlineDsAssignmentStrategy(targetRepository, afterCommit, eventPublisher,
applicationContext, actionRepository, actionStatusRepository, quotaManagement);
onlineDsAssignmentStrategy = new OnlineDsAssignmentStrategy(targetRepository, afterCommit, eventPublisher, bus,
actionRepository, actionStatusRepository, quotaManagement);
offlineDsAssignmentStrategy = new OfflineDsAssignmentStrategy(targetRepository, afterCommit, eventPublisher,
applicationContext, actionRepository, actionStatusRepository, quotaManagement);
bus, actionRepository, actionStatusRepository, quotaManagement);
this.tenantConfigurationManagement = tenantConfigurationManagement;
this.quotaManagement = quotaManagement;
this.systemSecurityContext = systemSecurityContext;
@@ -367,7 +366,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
private void setAssignedDistributionSetAndTargetUpdateStatus(final AbstractDsAssignmentStrategy assignmentStrategy,
final JpaDistributionSet set, final List<List<Long>> targetIdsChunks) {
final String currentUser = auditorProvider != null ? auditorProvider.getCurrentAuditor() : null;
final String currentUser = auditorProvider.getCurrentAuditor().orElse(null);
assignmentStrategy.updateTargetStatus(set, targetIdsChunks, currentUser);
}
@@ -385,7 +384,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
private void createActionsStatus(final Collection<JpaAction> actions,
final AbstractDsAssignmentStrategy assignmentStrategy, final String actionMessage) {
actionStatusRepository
.save(actions.stream().map(action -> assignmentStrategy.createActionStatus(action, actionMessage))
.saveAll(actions.stream().map(action -> assignmentStrategy.createActionStatus(action, actionMessage))
.collect(Collectors.toList()));
}
@@ -493,7 +492,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
if (!CollectionUtils.isEmpty(targetAssignments)) {
afterCommit.afterCommit(() -> eventPublisher.publishEvent(new TargetAssignDistributionSetEvent(tenant,
distributionSetId, targetAssignments, applicationContext.getId(), maintenanceWindowAvailable)));
distributionSetId, targetAssignments, bus.getId(), maintenanceWindowAvailable)));
}
return rolloutGroupActions.getTotalElements();
@@ -503,7 +502,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
private Page<Action> findActionsByRolloutAndRolloutGroupParent(final Long rolloutId,
final Long rolloutGroupParentId, final int limit) {
final PageRequest pageRequest = new PageRequest(0, limit);
final PageRequest pageRequest = PageRequest.of(0, limit);
if (rolloutGroupParentId == null) {
return actionRepository.findByRolloutIdAndRolloutGroupParentIsNullAndStatus(pageRequest, rolloutId,
Action.Status.SCHEDULED);
@@ -577,7 +576,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
@Override
public Optional<Action> findAction(final long actionId) {
return Optional.ofNullable(actionRepository.findOne(actionId));
return actionRepository.findById(actionId).map(a -> (Action) a);
}
@Override
@@ -644,7 +643,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
}
private void throwExceptionIfDistributionSetDoesNotExist(final Long dsId) {
if (!distributionSetRepository.exists(dsId)) {
if (!distributionSetRepository.existsById(dsId)) {
throw new EntityNotFoundException(DistributionSet.class, dsId);
}
}
@@ -666,7 +665,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
@Override
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final long actionId) {
if (!actionRepository.exists(actionId)) {
if (!actionRepository.existsById(actionId)) {
throw new EntityNotFoundException(Action.class, actionId);
}
@@ -690,7 +689,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
final CriteriaQuery<String> selMsgQuery = msgQuery.select(join);
selMsgQuery.where(cb.equal(as.get(JpaActionStatus_.id), actionStatusId));
final List<String> result = entityManager.createQuery(selMsgQuery).setFirstResult(pageable.getOffset())
final List<String> result = entityManager.createQuery(selMsgQuery).setFirstResult((int) pageable.getOffset())
.setMaxResults(pageable.getPageSize()).getResultList().stream().collect(Collectors.toList());
return new PageImpl<>(result, pageable, totalCount);
@@ -777,7 +776,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
}
private static String formatInClause(final Collection<String> elements) {
return "#" + Joiner.on(",#").join(elements);
return "#" + String.join(",#", elements);
}
protected ActionRepository getActionRepository() {

View File

@@ -57,7 +57,7 @@ import org.eclipse.hawkbit.repository.model.MetaData;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyReplacer;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.springframework.context.ApplicationContext;
import org.springframework.cloud.bus.BusProperties;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.dao.ConcurrencyFailureException;
import org.springframework.data.domain.Page;
@@ -105,7 +105,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
private final ApplicationEventPublisher eventPublisher;
private final ApplicationContext applicationContext;
private final BusProperties bus;
private final TenantAware tenantAware;
@@ -126,7 +126,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
final DistributionSetMetadataRepository distributionSetMetadataRepository,
final TargetFilterQueryRepository targetFilterQueryRepository, final ActionRepository actionRepository,
final NoCountPagingRepository criteriaNoCountDao, final ApplicationEventPublisher eventPublisher,
final ApplicationContext applicationContext, final TenantAware tenantAware,
final BusProperties bus, final TenantAware tenantAware,
final VirtualPropertyReplacer virtualPropertyReplacer,
final SoftwareModuleRepository softwareModuleRepository,
final DistributionSetTagRepository distributionSetTagRepository,
@@ -142,7 +142,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
this.actionRepository = actionRepository;
this.criteriaNoCountDao = criteriaNoCountDao;
this.eventPublisher = eventPublisher;
this.applicationContext = applicationContext;
this.bus = bus;
this.tenantAware = tenantAware;
this.virtualPropertyReplacer = virtualPropertyReplacer;
this.softwareModuleRepository = softwareModuleRepository;
@@ -153,7 +153,8 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
@Override
public Optional<DistributionSet> getWithDetails(final long distid) {
return Optional.ofNullable(distributionSetRepository.findOne(DistributionSetSpecification.byId(distid)));
return distributionSetRepository.findOne(DistributionSetSpecification.byId(distid))
.map(d -> (DistributionSet) d);
}
@Override
@@ -242,7 +243,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
}
private JpaSoftwareModule findSoftwareModuleAndThrowExceptionIfNotFound(final Long moduleId) {
return Optional.ofNullable(softwareModuleRepository.findOne(moduleId))
return softwareModuleRepository.findById(moduleId)
.orElseThrow(() -> new EntityNotFoundException(SoftwareModule.class, moduleId));
}
@@ -282,7 +283,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
afterCommit.afterCommit(() -> distributionSetIDs.forEach(
dsId -> eventPublisher.publishEvent(new DistributionSetDeletedEvent(tenantAware.getCurrentTenant(),
dsId, JpaDistributionSet.class.getName(), applicationContext.getId()))));
dsId, JpaDistributionSet.class.getName(), bus.getId()))));
}
@Override
@@ -370,12 +371,12 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
* @return a single DistributionSet which is either installed or assigned to
* a specific target or {@code null}.
*/
private DistributionSet findDistributionSetsByFiltersAndInstalledOrAssignedTarget(
private Optional<JpaDistributionSet> findDistributionSetsByFiltersAndInstalledOrAssignedTarget(
final DistributionSetFilter distributionSetFilter) {
final List<Specification<JpaDistributionSet>> specList = buildDistributionSetSpecifications(
distributionSetFilter);
if (CollectionUtils.isEmpty(specList)) {
return null;
return Optional.empty();
}
return distributionSetRepository.findOne(SpecificationsBuilder.combineWithAnd(specList));
}
@@ -400,12 +401,12 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
final DistributionSetFilter filterWithInstalledTargets = distributionSetFilterBuilder
.setInstalledTargetId(assignedOrInstalled).setAssignedTargetId(null).build();
final DistributionSet installedDS = findDistributionSetsByFiltersAndInstalledOrAssignedTarget(
final Optional<JpaDistributionSet> installedDS = findDistributionSetsByFiltersAndInstalledOrAssignedTarget(
filterWithInstalledTargets);
final DistributionSetFilter filterWithAssignedTargets = distributionSetFilterBuilder.setInstalledTargetId(null)
.setAssignedTargetId(assignedOrInstalled).build();
final DistributionSet assignedDS = findDistributionSetsByFiltersAndInstalledOrAssignedTarget(
final Optional<JpaDistributionSet> assignedDS = findDistributionSetsByFiltersAndInstalledOrAssignedTarget(
filterWithAssignedTargets);
final DistributionSetFilter dsFilterWithNoTargetLinked = distributionSetFilterBuilder.setInstalledTargetId(null)
@@ -417,20 +418,20 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
final List<DistributionSet> resultSet = new ArrayList<>(findDistributionSetsByFilters.getContent());
int orderIndex = 0;
if (installedDS != null) {
final boolean remove = resultSet.remove(installedDS);
if (installedDS.isPresent()) {
final boolean remove = resultSet.remove(installedDS.get());
if (!remove) {
resultSet.remove(resultSet.size() - 1);
}
resultSet.add(orderIndex, installedDS);
resultSet.add(orderIndex, installedDS.get());
orderIndex++;
}
if (assignedDS != null && !assignedDS.equals(installedDS)) {
final boolean remove = resultSet.remove(assignedDS);
if (assignedDS.isPresent() && !assignedDS.equals(installedDS)) {
final boolean remove = resultSet.remove(assignedDS.get());
if (!remove) {
resultSet.remove(resultSet.size() - 1);
}
resultSet.add(orderIndex, assignedDS);
resultSet.add(orderIndex, assignedDS.get());
}
return new PageImpl<>(resultSet, pageable, findDistributionSetsByFilters.getTotalElements());
@@ -440,7 +441,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
public Optional<DistributionSet> getByNameAndVersion(final String distributionName, final String version) {
final Specification<JpaDistributionSet> spec = DistributionSetSpecification
.equalsNameAndVersionIgnoreCase(distributionName, version);
return Optional.ofNullable(distributionSetRepository.findOne(spec));
return distributionSetRepository.findOne(spec).map(d -> (DistributionSet) d);
}
@@ -508,7 +509,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
() -> new EntityNotFoundException(DistributionSetMetadata.class, distributionSetId, key));
touch(metadata.getDistributionSet());
distributionSetMetadataRepository.delete(metadata.getId());
distributionSetMetadataRepository.deleteById(metadata.getId());
}
/**
@@ -579,12 +580,13 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
public Optional<DistributionSetMetadata> getMetaDataByDistributionSetId(final long setId, final String key) {
throwExceptionIfDistributionSetDoesNotExist(setId);
return Optional.ofNullable(distributionSetMetadataRepository.findOne(new DsMetadataCompositeKey(setId, key)));
return distributionSetMetadataRepository.findById(new DsMetadataCompositeKey(setId, key))
.map(dmd -> (DistributionSetMetadata) dmd);
}
@Override
public Optional<DistributionSet> getByAction(final long actionId) {
if (!actionRepository.exists(actionId)) {
if (!actionRepository.existsById(actionId)) {
throw new EntityNotFoundException(Action.class, actionId);
}
@@ -676,7 +678,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
}
private void checkAndThrowIfDistributionSetMetadataAlreadyExists(final DsMetadataCompositeKey metadataId) {
if (distributionSetMetadataRepository.exists(metadataId)) {
if (distributionSetMetadataRepository.existsById(metadataId)) {
throw new EntityAlreadyExistsException(
"Metadata entry with key '" + metadataId.getKey() + "' already exists");
}
@@ -738,14 +740,14 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
}
private void throwExceptionIfDistributionSetDoesNotExist(final Long setId) {
if (!distributionSetRepository.exists(setId)) {
if (!distributionSetRepository.existsById(setId)) {
throw new EntityNotFoundException(DistributionSet.class, setId);
}
}
@Override
public List<DistributionSet> get(final Collection<Long> ids) {
return Collections.unmodifiableList(distributionSetRepository.findAll(ids));
return Collections.unmodifiableList(distributionSetRepository.findAllById(ids));
}
@Override
@@ -757,7 +759,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
}
private void throwEntityNotFoundExceptionIfDsTagDoesNotExist(final Long tagId) {
if (!distributionSetTagRepository.exists(tagId)) {
if (!distributionSetTagRepository.existsById(tagId)) {
throw new EntityNotFoundException(DistributionSetTag.class, tagId);
}
}
@@ -791,12 +793,12 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
@Override
public Optional<DistributionSet> get(final long id) {
return Optional.ofNullable(distributionSetRepository.findOne(id));
return distributionSetRepository.findById(id).map(d -> (DistributionSet) d);
}
@Override
public boolean exists(final long id) {
return distributionSetRepository.exists(id);
return distributionSetRepository.existsById(id);
}
}

View File

@@ -142,7 +142,7 @@ public class JpaDistributionSetTagManagement implements DistributionSetTagManage
@Override
public Page<DistributionSetTag> findByDistributionSet(final Pageable pageable, final long setId) {
if (!distributionSetRepository.exists(setId)) {
if (!distributionSetRepository.existsById(setId)) {
throw new EntityNotFoundException(DistributionSet.class, setId);
}
@@ -165,24 +165,24 @@ public class JpaDistributionSetTagManagement implements DistributionSetTagManage
@Retryable(include = {
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
public void delete(final Collection<Long> ids) {
final List<JpaDistributionSetTag> setsFound = distributionSetTagRepository.findAll(ids);
final List<JpaDistributionSetTag> setsFound = distributionSetTagRepository.findAllById(ids);
if (setsFound.size() < ids.size()) {
throw new EntityNotFoundException(DistributionSetTag.class, ids,
setsFound.stream().map(DistributionSetTag::getId).collect(Collectors.toList()));
}
distributionSetTagRepository.delete(setsFound);
distributionSetTagRepository.deleteAll(setsFound);
}
@Override
public List<DistributionSetTag> get(final Collection<Long> ids) {
return Collections.unmodifiableList(distributionSetTagRepository.findAll(ids));
return Collections.unmodifiableList(distributionSetTagRepository.findAllById(ids));
}
@Override
public Optional<DistributionSetTag> get(final long id) {
return Optional.ofNullable(distributionSetTagRepository.findOne(id));
return distributionSetTagRepository.findById(id).map(dst -> (DistributionSetTag) dst);
}
@Override
@@ -190,12 +190,12 @@ public class JpaDistributionSetTagManagement implements DistributionSetTagManage
@Retryable(include = {
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
public void delete(final long id) {
distributionSetTagRepository.delete(id);
distributionSetTagRepository.deleteById(id);
}
@Override
public boolean exists(final long id) {
return distributionSetTagRepository.exists(id);
return distributionSetTagRepository.existsById(id);
}
@Override

View File

@@ -99,9 +99,9 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
checkDistributionSetTypeSoftwareModuleTypesIsAllowedToModify(update.getId());
update.getMandatory().ifPresent(
mand -> softwareModuleTypeRepository.findAll(mand).forEach(type::addMandatoryModuleType));
update.getOptional()
.ifPresent(opt -> softwareModuleTypeRepository.findAll(opt).forEach(type::addOptionalModuleType));
mand -> softwareModuleTypeRepository.findAllById(mand).forEach(type::addMandatoryModuleType));
update.getOptional().ifPresent(
opt -> softwareModuleTypeRepository.findAllById(opt).forEach(type::addOptionalModuleType));
}
return distributionSetTypeRepository.save(type);
@@ -113,7 +113,8 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
public DistributionSetType assignMandatorySoftwareModuleTypes(final long dsTypeId,
final Collection<Long> softwareModulesTypeIds) {
final Collection<JpaSoftwareModuleType> modules = softwareModuleTypeRepository.findAll(softwareModulesTypeIds);
final Collection<JpaSoftwareModuleType> modules = softwareModuleTypeRepository
.findAllById(softwareModulesTypeIds);
if (modules.size() < softwareModulesTypeIds.size()) {
throw new EntityNotFoundException(SoftwareModuleType.class, softwareModulesTypeIds,
@@ -136,7 +137,8 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
public DistributionSetType assignOptionalSoftwareModuleTypes(final long dsTypeId,
final Collection<Long> softwareModulesTypeIds) {
final Collection<JpaSoftwareModuleType> modules = softwareModuleTypeRepository.findAll(softwareModulesTypeIds);
final Collection<JpaSoftwareModuleType> modules = softwareModuleTypeRepository
.findAllById(softwareModulesTypeIds);
if (modules.size() < softwareModulesTypeIds.size()) {
throw new EntityNotFoundException(SoftwareModuleType.class, softwareModulesTypeIds,
@@ -206,13 +208,14 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
@Override
public Optional<DistributionSetType> getByName(final String name) {
return Optional
.ofNullable(distributionSetTypeRepository.findOne(DistributionSetTypeSpecification.byName(name)));
return distributionSetTypeRepository.findOne(DistributionSetTypeSpecification.byName(name))
.map(dst -> (DistributionSetType) dst);
}
@Override
public Optional<DistributionSetType> getByKey(final String key) {
return Optional.ofNullable(distributionSetTypeRepository.findOne(DistributionSetTypeSpecification.byKey(key)));
return distributionSetTypeRepository.findOne(DistributionSetTypeSpecification.byKey(key))
.map(dst -> (DistributionSetType) dst);
}
@Override
@@ -238,7 +241,7 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
toDelete.setDeleted(true);
distributionSetTypeRepository.save(toDelete);
} else {
distributionSetTypeRepository.delete(typeId);
distributionSetTypeRepository.deleteById(typeId);
}
}
@@ -291,29 +294,29 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
@Retryable(include = {
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
public void delete(final Collection<Long> ids) {
final List<JpaDistributionSetType> setsFound = distributionSetTypeRepository.findAll(ids);
final List<JpaDistributionSetType> setsFound = distributionSetTypeRepository.findAllById(ids);
if (setsFound.size() < ids.size()) {
throw new EntityNotFoundException(DistributionSetType.class, ids,
setsFound.stream().map(DistributionSetType::getId).collect(Collectors.toList()));
}
distributionSetTypeRepository.delete(setsFound);
distributionSetTypeRepository.deleteAll(setsFound);
}
@Override
public List<DistributionSetType> get(final Collection<Long> ids) {
return Collections.unmodifiableList(distributionSetTypeRepository.findAll(ids));
return Collections.unmodifiableList(distributionSetTypeRepository.findAllById(ids));
}
@Override
public Optional<DistributionSetType> get(final long id) {
return Optional.ofNullable(distributionSetTypeRepository.findOne(id));
return distributionSetTypeRepository.findById(id).map(dst -> (DistributionSetType) dst);
}
@Override
public boolean exists(final long id) {
return distributionSetTypeRepository.exists(id);
return distributionSetTypeRepository.existsById(id);
}
}

View File

@@ -96,7 +96,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
@Override
public Optional<RolloutGroup> get(final long rolloutGroupId) {
return Optional.ofNullable(rolloutGroupRepository.findOne(rolloutGroupId));
return rolloutGroupRepository.findById(rolloutGroupId).map(rg -> (RolloutGroup) rg);
}
@Override
@@ -128,7 +128,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
}
private void throwEntityNotFoundExceptionIfRolloutDoesNotExist(final Long rolloutId) {
if (!rolloutRepository.exists(rolloutId)) {
if (!rolloutRepository.existsById(rolloutId)) {
throw new EntityNotFoundException(Rollout.class, rolloutId);
}
}
@@ -265,7 +265,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
.where(cb.equal(targetRoot.get(RolloutTargetGroup_.rolloutGroup).get(JpaRolloutGroup_.id),
rolloutGroupId));
final List<TargetWithActionStatus> targetWithActionStatus = entityManager.createQuery(multiselect)
.setFirstResult(pageRequest.getOffset()).setMaxResults(pageRequest.getPageSize()).getResultList()
.setFirstResult((int) pageRequest.getOffset()).setMaxResults(pageRequest.getPageSize()).getResultList()
.stream().map(o -> new TargetWithActionStatus((Target) o[0], (Action.Status) o[1]))
.collect(Collectors.toList());
@@ -285,7 +285,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
}
private void throwExceptionIfRolloutGroupDoesNotExist(final Long rolloutGroupId) {
if (!rolloutGroupRepository.exists(rolloutGroupId)) {
if (!rolloutGroupRepository.existsById(rolloutGroupId)) {
throw new EntityNotFoundException(RolloutGroup.class, rolloutGroupId);
}
}

View File

@@ -77,6 +77,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.bus.BusProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.dao.ConcurrencyFailureException;
@@ -149,20 +150,21 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
@Autowired
private RolloutStatusCache rolloutStatusCache;
@Autowired
private ApplicationContext applicationContext;
private final BusProperties bus;
private final Database database;
JpaRolloutManagement(final TargetManagement targetManagement, final DeploymentManagement deploymentManagement,
final RolloutGroupManagement rolloutGroupManagement,
final DistributionSetManagement distributionSetManagement, final ApplicationContext context,
final ApplicationEventPublisher eventPublisher, final VirtualPropertyReplacer virtualPropertyReplacer,
final PlatformTransactionManager txManager, final TenantAware tenantAware, final LockRegistry lockRegistry,
final Database database, final RolloutApprovalStrategy rolloutApprovalStrategy) {
final BusProperties bus, final ApplicationEventPublisher eventPublisher,
final VirtualPropertyReplacer virtualPropertyReplacer, final PlatformTransactionManager txManager,
final TenantAware tenantAware, final LockRegistry lockRegistry, final Database database,
final RolloutApprovalStrategy rolloutApprovalStrategy) {
super(targetManagement, deploymentManagement, rolloutGroupManagement, distributionSetManagement, context,
eventPublisher, virtualPropertyReplacer, txManager, tenantAware, lockRegistry, rolloutApprovalStrategy);
this.database = database;
this.bus = bus;
}
@Override
@@ -194,7 +196,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
@Override
public Optional<Rollout> get(final long rolloutId) {
return Optional.ofNullable(rolloutRepository.findOne(rolloutId));
return rolloutRepository.findById(rolloutId).map(r -> (Rollout) r);
}
@Override
@@ -337,7 +339,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
LOGGER.debug("handleCreateRollout called for rollout {}", rollout.getId());
final List<RolloutGroup> rolloutGroups = rolloutGroupManagement.findByRollout(
new PageRequest(0, quotaManagement.getMaxRolloutGroupsPerRollout(), new Sort(Direction.ASC, "id")),
PageRequest.of(0, quotaManagement.getMaxRolloutGroupsPerRollout(), new Sort(Direction.ASC, "id")),
rollout.getId()).getContent();
int readyGroups = 0;
@@ -431,7 +433,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
final String targetFilter, final long limit) {
return DeploymentHelper.runInNewTransaction(txManager, "assignTargetsToRolloutGroup", status -> {
final PageRequest pageRequest = new PageRequest(0, Math.toIntExact(limit));
final PageRequest pageRequest = PageRequest.of(0, Math.toIntExact(limit));
final List<Long> readyGroups = RolloutHelper.getGroupsByStatusIncludingGroup(rollout.getRolloutGroups(),
RolloutGroupStatus.READY, group);
final Page<Target> targets = targetManagement.findByTargetFilterQueryAndNotInRolloutGroups(pageRequest,
@@ -582,9 +584,11 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
private Long createActionsForTargetsInNewTransaction(final long rolloutId, final long groupId, final int limit) {
return DeploymentHelper.runInNewTransaction(txManager, "createActionsForTargets", status -> {
final PageRequest pageRequest = new PageRequest(0, limit);
final Rollout rollout = rolloutRepository.findOne(rolloutId);
final RolloutGroup group = rolloutGroupRepository.findOne(groupId);
final PageRequest pageRequest = PageRequest.of(0, limit);
final Rollout rollout = rolloutRepository.findById(rolloutId)
.orElseThrow(() -> new EntityNotFoundException(Rollout.class, rolloutId));
final RolloutGroup group = rolloutGroupRepository.findById(groupId)
.orElseThrow(() -> new EntityNotFoundException(RolloutGroup.class, groupId));
final DistributionSet distributionSet = rollout.getDistributionSet();
final ActionType actionType = rollout.getActionType();
@@ -832,9 +836,10 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
}
}
private long executeFittingHandler(final Long rolloutId) {
private long executeFittingHandler(final long rolloutId) {
LOGGER.debug("handle rollout {}", rolloutId);
final JpaRollout rollout = rolloutRepository.findOne(rolloutId);
final JpaRollout rollout = rolloutRepository.findById(rolloutId)
.orElseThrow(() -> new EntityNotFoundException(Rollout.class, rolloutId));
switch (rollout.getStatus()) {
case CREATING:
@@ -882,7 +887,8 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
@Retryable(include = {
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
public void delete(final long rolloutId) {
final JpaRollout jpaRollout = rolloutRepository.findOne(rolloutId);
final JpaRollout jpaRollout = rolloutRepository.findById(rolloutId)
.orElseThrow(() -> new EntityNotFoundException(Rollout.class, rolloutId));
if (jpaRollout == null) {
throw new EntityNotFoundException(Rollout.class, rolloutId);
@@ -945,7 +951,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
afterCommit.afterCommit(() -> groupIds.forEach(rolloutGroupId -> eventPublisher
.publishEvent(new RolloutGroupDeletedEvent(tenantAware.getCurrentTenant(), rolloutGroupId,
JpaRolloutGroup.class.getName(), applicationContext.getId()))));
JpaRolloutGroup.class.getName(), bus.getId()))));
}
private void hardDeleteRollout(final JpaRollout rollout) {
@@ -971,7 +977,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
}
private Slice<JpaAction> findScheduledActionsByRollout(final JpaRollout rollout) {
return actionRepository.findByRolloutIdAndStatus(new PageRequest(0, TRANSACTION_ACTIONS), rollout.getId(),
return actionRepository.findByRolloutIdAndStatus(PageRequest.of(0, TRANSACTION_ACTIONS), rollout.getId(),
Status.SCHEDULED);
}
@@ -1071,7 +1077,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
@Override
public boolean exists(final long rolloutId) {
return rolloutRepository.exists(rolloutId);
return rolloutRepository.existsById(rolloutId);
}
private Map<Long, List<TotalTargetCountActionStatus>> getStatusCountItemForRollout(final List<Long> rollouts) {

View File

@@ -180,7 +180,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
}
private void throwExceptionIfSoftwareModuleTypeDoesNotExist(final Long typeId) {
if (!softwareModuleTypeRepository.exists(typeId)) {
if (!softwareModuleTypeRepository.existsById(typeId)) {
throw new EntityNotFoundException(SoftwareModuleType.class, typeId);
}
}
@@ -201,7 +201,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
@Override
public Optional<SoftwareModule> get(final long id) {
return Optional.ofNullable(softwareModuleRepository.findOne(id));
return softwareModuleRepository.findById(id).map(sm -> (SoftwareModule) sm);
}
@Override
@@ -252,7 +252,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
deleteGridFsArtifacts(swModule);
if (isUnassigned(swModule.getId())) {
softwareModuleRepository.delete(swModule.getId());
softwareModuleRepository.deleteById(swModule.getId());
} else {
assignedModuleIds.add(swModule.getId());
}
@@ -261,7 +261,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
if (!assignedModuleIds.isEmpty()) {
String currentUser = null;
if (auditorProvider != null) {
currentUser = auditorProvider.getCurrentAuditor();
currentUser = auditorProvider.getCurrentAuditor().orElse(null);
}
softwareModuleRepository.deleteSoftwareModule(System.currentTimeMillis(), currentUser,
assignedModuleIds.toArray(new Long[0]));
@@ -374,7 +374,8 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
// map result
if (pageable.getOffset() < assignedSoftwareModules.size()) {
assignedSoftwareModules
.subList(pageable.getOffset(), Math.min(assignedSoftwareModules.size(), pageable.getPageSize()))
.subList((int) pageable.getOffset(),
Math.min(assignedSoftwareModules.size(), pageable.getPageSize()))
.forEach(sw -> resultList.add(new AssignedSoftwareModule(sw, true)));
}
@@ -401,7 +402,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
unassignedQuery.orderBy(cb.asc(unassignedRoot.get(JpaSoftwareModule_.name)),
cb.asc(unassignedRoot.get(JpaSoftwareModule_.version)));
final List<JpaSoftwareModule> unassignedSoftwareModules = entityManager.createQuery(unassignedQuery)
.setFirstResult(Math.max(0, pageable.getOffset() - assignedSoftwareModules.size()))
.setFirstResult((int) Math.max(0, pageable.getOffset() - assignedSoftwareModules.size()))
.setMaxResults(pageSize).getResultList();
// map result
unassignedSoftwareModules.forEach(sw -> resultList.add(new AssignedSoftwareModule(sw, false)));
@@ -456,7 +457,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
@Override
public Page<SoftwareModule> findByAssignedTo(final Pageable pageable, final long setId) {
if (!distributionSetRepository.exists(setId)) {
if (!distributionSetRepository.existsById(setId)) {
throw new EntityNotFoundException(DistributionSet.class, setId);
}
@@ -527,7 +528,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
private void assertSoftwareModuleMetadataDoesNotExist(final Long moduleId,
final JpaSoftwareModuleMetadataCreate md) {
if (softwareModuleMetadataRepository.exists(new SwMetadataCompositeKey(moduleId, md.getKey()))) {
if (softwareModuleMetadataRepository.existsById(new SwMetadataCompositeKey(moduleId, md.getKey()))) {
throwMetadataKeyAlreadyExists(md.getKey());
}
}
@@ -607,11 +608,11 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
key).orElseThrow(() -> new EntityNotFoundException(SoftwareModuleMetadata.class, moduleId, key));
touch(metadata.getSoftwareModule());
softwareModuleMetadataRepository.delete(metadata.getId());
softwareModuleMetadataRepository.deleteById(metadata.getId());
}
private void throwExceptionIfSoftwareModuleDoesNotExist(final Long swId) {
if (!softwareModuleRepository.exists(swId)) {
if (!softwareModuleRepository.existsById(swId)) {
throw new EntityNotFoundException(SoftwareModule.class, swId);
}
}
@@ -654,7 +655,8 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
public Optional<SoftwareModuleMetadata> getMetaDataBySoftwareModuleId(final long moduleId, final String key) {
throwExceptionIfSoftwareModuleDoesNotExist(moduleId);
return Optional.ofNullable(softwareModuleMetadataRepository.findOne(new SwMetadataCompositeKey(moduleId, key)));
return softwareModuleMetadataRepository.findById(new SwMetadataCompositeKey(moduleId, key))
.map(smmd -> (SoftwareModuleMetadata) smmd);
}
private static void throwMetadataKeyAlreadyExists(final String metadataKey) {
@@ -671,7 +673,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
@Override
public boolean exists(final long id) {
return softwareModuleRepository.exists(id);
return softwareModuleRepository.existsById(id);
}
@Override
@@ -680,7 +682,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
throwExceptionIfSoftwareModuleDoesNotExist(moduleId);
return convertMdPage(softwareModuleMetadataRepository.findBySoftwareModuleIdAndTargetVisible(
new PageRequest(0, RepositoryConstants.MAX_META_DATA_COUNT), moduleId, true), pageable);
PageRequest.of(0, RepositoryConstants.MAX_META_DATA_COUNT), moduleId, true), pageable);
}
}

View File

@@ -168,29 +168,29 @@ public class JpaSoftwareModuleTypeManagement implements SoftwareModuleTypeManage
@Retryable(include = {
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
public void delete(final Collection<Long> ids) {
final List<JpaSoftwareModuleType> setsFound = softwareModuleTypeRepository.findAll(ids);
final List<JpaSoftwareModuleType> setsFound = softwareModuleTypeRepository.findAllById(ids);
if (setsFound.size() < ids.size()) {
throw new EntityNotFoundException(SoftwareModuleType.class, ids,
setsFound.stream().map(SoftwareModuleType::getId).collect(Collectors.toList()));
}
softwareModuleTypeRepository.delete(setsFound);
softwareModuleTypeRepository.deleteAll(setsFound);
}
@Override
public List<SoftwareModuleType> get(final Collection<Long> ids) {
return Collections.unmodifiableList(softwareModuleTypeRepository.findAll(ids));
return Collections.unmodifiableList(softwareModuleTypeRepository.findAllById(ids));
}
@Override
public Optional<SoftwareModuleType> get(final long id) {
return Optional.ofNullable(softwareModuleTypeRepository.findOne(id));
return softwareModuleTypeRepository.findById(id).map(smt -> (SoftwareModuleType) smt);
}
@Override
public boolean exists(final long id) {
return softwareModuleTypeRepository.exists(id);
return softwareModuleTypeRepository.existsById(id);
}
}

View File

@@ -20,6 +20,7 @@ import org.eclipse.hawkbit.cache.TenancyCacheManager;
import org.eclipse.hawkbit.repository.RolloutStatusCache;
import org.eclipse.hawkbit.repository.SystemManagement;
import org.eclipse.hawkbit.repository.TenantStatsManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.jpa.configuration.Constants;
import org.eclipse.hawkbit.repository.jpa.configuration.MultiTenantJpaTransactionManager;
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType;
@@ -160,7 +161,7 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
}
private void usageStatsPerTenant(final SystemUsageReportWithTenants report) {
final List<String> tenants = findTenants(new PageRequest(0, MAX_TENANTS_QUERY)).getContent();
final List<String> tenants = findTenants(PageRequest.of(0, MAX_TENANTS_QUERY)).getContent();
tenants.forEach(tenant -> tenantAware.runAsTenant(tenant, () -> {
report.addTenantData(systemStatsManagement.getStatsOfTenant());
@@ -276,7 +277,8 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
public TenantMetaData updateTenantMetadata(final long defaultDsType) {
final JpaTenantMetaData data = (JpaTenantMetaData) getTenantMetadata();
data.setDefaultDsType(distributionSetTypeRepository.findOne(defaultDsType));
data.setDefaultDsType(distributionSetTypeRepository.findById(defaultDsType)
.orElseThrow(() -> new EntityNotFoundException(DistributionSetType.class, defaultDsType)));
return tenantMetaDataRepository.save(data);
}
@@ -312,15 +314,19 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
@Override
public TenantMetaData getTenantMetadata(final long tenantId) {
return tenantMetaDataRepository.findOne(tenantId);
return tenantMetaDataRepository.findById(tenantId)
.orElseThrow(() -> new EntityNotFoundException(TenantMetaData.class, tenantId));
}
@Override
@Transactional(propagation = Propagation.NOT_SUPPORTED)
// Exception squid:S2229 - calling findTenants without transaction is
// intended in this case
@SuppressWarnings("squid:S2229")
public void forEachTenant(final Consumer<String> consumer) {
Page<String> tenants;
Pageable query = new PageRequest(0, MAX_TENANTS_QUERY);
Pageable query = PageRequest.of(0, MAX_TENANTS_QUERY);
do {
tenants = findTenants(query);
tenants.forEach(tenant -> tenantAware.runAsTenant(tenant, () -> {

View File

@@ -39,7 +39,6 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.domain.Specifications;
import org.springframework.orm.jpa.vendor.Database;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
@@ -99,11 +98,11 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
@Retryable(include = {
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
public void delete(final long targetFilterQueryId) {
if (!targetFilterQueryRepository.exists(targetFilterQueryId)) {
if (!targetFilterQueryRepository.existsById(targetFilterQueryId)) {
throw new EntityNotFoundException(TargetFilterQuery.class, targetFilterQueryId);
}
targetFilterQueryRepository.delete(targetFilterQueryId);
targetFilterQueryRepository.deleteById(targetFilterQueryId);
}
@Override
@@ -178,7 +177,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
return targetFilterQueryRepository.findAll(pageable);
}
final Specifications<JpaTargetFilterQuery> specs = SpecificationsBuilder.combineWithAnd(specList);
final Specification<JpaTargetFilterQuery> specs = SpecificationsBuilder.combineWithAnd(specList);
return targetFilterQueryRepository.findAll(specs, pageable);
}
@@ -189,7 +188,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
@Override
public Optional<TargetFilterQuery> get(final long targetFilterQueryId) {
return Optional.ofNullable(targetFilterQueryRepository.findOne(targetFilterQueryId));
return targetFilterQueryRepository.findById(targetFilterQueryId).map(tfq -> (TargetFilterQuery) tfq);
}
@Override

View File

@@ -64,7 +64,7 @@ import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.repository.rsql.VirtualPropertyReplacer;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.springframework.context.ApplicationContext;
import org.springframework.cloud.bus.BusProperties;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.dao.ConcurrencyFailureException;
import org.springframework.data.domain.Page;
@@ -111,7 +111,7 @@ public class JpaTargetManagement implements TargetManagement {
private final ApplicationEventPublisher eventPublisher;
private final ApplicationContext applicationContext;
private final BusProperties bus;
private final TenantAware tenantAware;
@@ -127,9 +127,9 @@ public class JpaTargetManagement implements TargetManagement {
final DistributionSetRepository distributionSetRepository,
final TargetFilterQueryRepository targetFilterQueryRepository,
final TargetTagRepository targetTagRepository, final NoCountPagingRepository criteriaNoCountDao,
final ApplicationEventPublisher eventPublisher, final ApplicationContext applicationContext,
final TenantAware tenantAware, final AfterTransactionCommitExecutor afterCommit,
final VirtualPropertyReplacer virtualPropertyReplacer, final Database database) {
final ApplicationEventPublisher eventPublisher, final BusProperties bus, final TenantAware tenantAware,
final AfterTransactionCommitExecutor afterCommit, final VirtualPropertyReplacer virtualPropertyReplacer,
final Database database) {
this.entityManager = entityManager;
this.quotaManagement = quotaManagement;
this.targetRepository = targetRepository;
@@ -140,7 +140,7 @@ public class JpaTargetManagement implements TargetManagement {
this.targetTagRepository = targetTagRepository;
this.criteriaNoCountDao = criteriaNoCountDao;
this.eventPublisher = eventPublisher;
this.applicationContext = applicationContext;
this.bus = bus;
this.tenantAware = tenantAware;
this.afterCommit = afterCommit;
this.virtualPropertyReplacer = virtualPropertyReplacer;
@@ -190,13 +190,13 @@ public class JpaTargetManagement implements TargetManagement {
// TargetUpdatedEvent is not sent within the touch() method due to the
// "lastModifiedAt" field being ignored in JpaTarget
eventPublisher.publishEvent(new TargetUpdatedEvent(updatedTarget, applicationContext.getId()));
eventPublisher.publishEvent(new TargetUpdatedEvent(updatedTarget, bus.getId()));
return createdMetadata;
}
private void checkAndThrowIfTargetMetadataAlreadyExists(final TargetMetadataCompositeKey metadataId) {
if (targetMetadataRepository.exists(metadataId)) {
if (targetMetadataRepository.existsById(metadataId)) {
throw new EntityAlreadyExistsException(
"Metadata entry with key '" + metadataId.getKey() + "' already exists");
}
@@ -230,8 +230,8 @@ public class JpaTargetManagement implements TargetManagement {
// check if exists otherwise throw entity not found exception
final JpaTargetMetadata updatedMetadata = (JpaTargetMetadata) getMetaDataByControllerId(controllerId,
md.getKey())
.orElseThrow(() -> new EntityNotFoundException(TargetMetadata.class, controllerId, md.getKey()));
md.getKey()).orElseThrow(
() -> new EntityNotFoundException(TargetMetadata.class, controllerId, md.getKey()));
updatedMetadata.setValue(md.getValue());
// touch it to update the lock revision because we are modifying the
// target indirectly
@@ -239,7 +239,7 @@ public class JpaTargetManagement implements TargetManagement {
final JpaTargetMetadata matadata = targetMetadataRepository.save(updatedMetadata);
// target update event is set to ignore "lastModifiedAt" field so it is
// not send automatically within the touch() method
eventPublisher.publishEvent(new TargetUpdatedEvent(target, applicationContext.getId()));
eventPublisher.publishEvent(new TargetUpdatedEvent(target, bus.getId()));
return matadata;
}
@@ -252,10 +252,10 @@ public class JpaTargetManagement implements TargetManagement {
.orElseThrow(() -> new EntityNotFoundException(TargetMetadata.class, controllerId, key));
final JpaTarget target = touch(controllerId);
targetMetadataRepository.delete(metadata.getId());
targetMetadataRepository.deleteById(metadata.getId());
// target update event is set to ignore "lastModifiedAt" field so it is
// not send automatically within the touch() method
eventPublisher.publishEvent(new TargetUpdatedEvent(target, applicationContext.getId()));
eventPublisher.publishEvent(new TargetUpdatedEvent(target, bus.getId()));
}
@Override
@@ -294,7 +294,8 @@ public class JpaTargetManagement implements TargetManagement {
public Optional<TargetMetadata> getMetaDataByControllerId(final String controllerId, final String key) {
final Long targetId = getByControllerIdAndThrowIfNotFound(controllerId).getId();
return Optional.ofNullable(targetMetadataRepository.findOne(new TargetMetadataCompositeKey(targetId, key)));
return targetMetadataRepository.findById(new TargetMetadataCompositeKey(targetId, key))
.map(t -> (TargetMetadata) t);
}
@Override
@@ -344,7 +345,7 @@ public class JpaTargetManagement implements TargetManagement {
@Retryable(include = {
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
public void delete(final Collection<Long> targetIDs) {
final List<JpaTarget> targets = targetRepository.findAll(targetIDs);
final List<JpaTarget> targets = targetRepository.findAllById(targetIDs);
if (targets.size() < targetIDs.size()) {
throw new EntityNotFoundException(Target.class, targetIDs,
@@ -356,7 +357,7 @@ public class JpaTargetManagement implements TargetManagement {
afterCommit.afterCommit(() -> targets.forEach(target -> eventPublisher.publishEvent(
new TargetDeletedEvent(tenantAware.getCurrentTenant(), target.getId(), target.getControllerId(),
Optional.ofNullable(target.getAddress()).map(URI::toString).orElse(null),
JpaTarget.class.getName(), applicationContext.getId()))));
JpaTarget.class.getName(), bus.getId()))));
}
@Override
@@ -366,7 +367,7 @@ public class JpaTargetManagement implements TargetManagement {
public void deleteByControllerID(final String controllerID) {
final Target target = getByControllerIdAndThrowIfNotFound(controllerID);
targetRepository.delete(target.getId());
targetRepository.deleteById(target.getId());
}
@Override
@@ -394,7 +395,7 @@ public class JpaTargetManagement implements TargetManagement {
}
private void throwEntityNotFoundIfDsDoesNotExist(final Long distributionSetID) {
if (!distributionSetRepository.exists(distributionSetID)) {
if (!distributionSetRepository.existsById(distributionSetID)) {
throw new EntityNotFoundException(DistributionSet.class, distributionSetID);
}
}
@@ -452,7 +453,7 @@ public class JpaTargetManagement implements TargetManagement {
private List<Specification<JpaTarget>> buildSpecificationList(final FilterParams filterParams) {
final List<Specification<JpaTarget>> specList = new ArrayList<>();
if (filterParams.getFilterByStatus() != null && !filterParams.getFilterByStatus().isEmpty()) {
if ((filterParams.getFilterByStatus() != null) && !filterParams.getFilterByStatus().isEmpty()) {
specList.add(TargetSpecifications.hasTargetUpdateStatus(filterParams.getFilterByStatus()));
}
if (filterParams.getOverdueState() != null) {
@@ -475,8 +476,8 @@ public class JpaTargetManagement implements TargetManagement {
}
private static boolean isHasTagsFilterActive(final FilterParams filterParams) {
return filterParams.getSelectTargetWithNoTag() != null && (filterParams.getSelectTargetWithNoTag()
|| (filterParams.getFilterByTagNames() != null && filterParams.getFilterByTagNames().length > 0));
return ((filterParams.getSelectTargetWithNoTag() != null) && filterParams.getSelectTargetWithNoTag())
|| ((filterParams.getFilterByTagNames() != null) && (filterParams.getFilterByTagNames().length > 0));
}
private Slice<Target> findByCriteriaAPI(final Pageable pageable, final List<Specification<JpaTarget>> specList) {
@@ -617,7 +618,7 @@ public class JpaTargetManagement implements TargetManagement {
// index of the array and
// the 2nd contains the selectCase int value.
final int pageSize = pageable.getPageSize();
final List<JpaTarget> resultList = entityManager.createQuery(query).setFirstResult(pageable.getOffset())
final List<JpaTarget> resultList = entityManager.createQuery(query).setFirstResult((int) pageable.getOffset())
.setMaxResults(pageSize + 1).getResultList();
final boolean hasNext = resultList.size() > pageSize;
return new SliceImpl<>(Collections.unmodifiableList(resultList), pageable, hasNext);
@@ -676,7 +677,7 @@ public class JpaTargetManagement implements TargetManagement {
@Override
public Page<Target> findByInRolloutGroupWithoutAction(final Pageable pageRequest, final long group) {
if (!rolloutGroupRepository.exists(group)) {
if (!rolloutGroupRepository.existsById(group)) {
throw new EntityNotFoundException(RolloutGroup.class, group);
}
@@ -733,7 +734,7 @@ public class JpaTargetManagement implements TargetManagement {
}
private void throwEntityNotFoundExceptionIfTagDoesNotExist(final Long tagId) {
if (!targetTagRepository.exists(tagId)) {
if (!targetTagRepository.existsById(tagId)) {
throw new EntityNotFoundException(TargetTag.class, tagId);
}
}
@@ -773,12 +774,12 @@ public class JpaTargetManagement implements TargetManagement {
@Override
public Optional<Target> get(final long id) {
return Optional.ofNullable(targetRepository.findOne(id));
return targetRepository.findById(id).map(t -> (Target) t);
}
@Override
public List<Target> get(final Collection<Long> ids) {
return Collections.unmodifiableList(targetRepository.findAll(ids));
return Collections.unmodifiableList(targetRepository.findAllById(ids));
}
@Override
@@ -796,7 +797,7 @@ public class JpaTargetManagement implements TargetManagement {
eventPublisher.publishEvent(new TargetAttributesRequestedEvent(tenantAware.getCurrentTenant(), target.getId(),
target.getControllerId(), target.getAddress() != null ? target.getAddress().toString() : null,
JpaTarget.class.getName(), applicationContext.getId()));
JpaTarget.class.getName(), bus.getId()));
}
@Override
@@ -806,4 +807,14 @@ public class JpaTargetManagement implements TargetManagement {
return target.isRequestControllerAttributes();
}
@Override
public boolean existsByControllerId(final String controllerId) {
return targetRepository.existsByControllerId(controllerId);
}
@Override
public Page<Target> findByControllerAttributesRequested(final Pageable pageReq) {
return targetRepository.findByRequestControllerAttributesIsTrue(pageReq);
}
}

View File

@@ -138,7 +138,7 @@ public class JpaTargetTagManagement implements TargetTagManagement {
@Override
public Optional<TargetTag> get(final long id) {
return Optional.ofNullable(targetTagRepository.findOne(id));
return targetTagRepository.findById(id).map(tt -> (TargetTag) tt);
}
@Override

View File

@@ -103,7 +103,7 @@ public class NoCountPagingRepository {
@Override
protected Page<T> readPage(final TypedQuery<T> query, final Pageable pageable, final Specification<T> spec) {
query.setFirstResult(pageable.getOffset());
query.setFirstResult((int) pageable.getOffset());
query.setMaxResults(pageable.getPageSize());
final List<T> content = query.getResultList();

View File

@@ -29,7 +29,7 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
import org.springframework.context.ApplicationContext;
import org.springframework.cloud.bus.BusProperties;
import org.springframework.context.ApplicationEventPublisher;
import com.google.common.collect.Lists;
@@ -43,10 +43,10 @@ public class OfflineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
OfflineDsAssignmentStrategy(final TargetRepository targetRepository,
final AfterTransactionCommitExecutor afterCommit, final ApplicationEventPublisher eventPublisher,
final ApplicationContext applicationContext, final ActionRepository actionRepository,
final BusProperties bus, final ActionRepository actionRepository,
final ActionStatusRepository actionStatusRepository, final QuotaManagement quotaManagement) {
super(targetRepository, afterCommit, eventPublisher, applicationContext, actionRepository,
actionStatusRepository, quotaManagement);
super(targetRepository, afterCommit, eventPublisher, bus, actionRepository, actionStatusRepository,
quotaManagement);
}
@Override

View File

@@ -28,7 +28,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
import org.springframework.context.ApplicationContext;
import org.springframework.cloud.bus.BusProperties;
import org.springframework.context.ApplicationEventPublisher;
import com.google.common.collect.Lists;
@@ -41,10 +41,10 @@ public class OnlineDsAssignmentStrategy extends AbstractDsAssignmentStrategy {
OnlineDsAssignmentStrategy(final TargetRepository targetRepository,
final AfterTransactionCommitExecutor afterCommit, final ApplicationEventPublisher eventPublisher,
final ApplicationContext applicationContext, final ActionRepository actionRepository,
final BusProperties bus, final ActionRepository actionRepository,
final ActionStatusRepository actionStatusRepository, final QuotaManagement quotaManagement) {
super(targetRepository, afterCommit, eventPublisher, applicationContext, actionRepository,
actionStatusRepository, quotaManagement);
super(targetRepository, afterCommit, eventPublisher, bus, actionRepository, actionStatusRepository,
quotaManagement);
}
@Override

View File

@@ -63,6 +63,7 @@ import org.eclipse.hawkbit.repository.jpa.builder.JpaSoftwareModuleMetadataBuild
import org.eclipse.hawkbit.repository.jpa.builder.JpaTargetFilterQueryBuilder;
import org.eclipse.hawkbit.repository.jpa.configuration.MultiTenantJpaTransactionManager;
import org.eclipse.hawkbit.repository.jpa.event.JpaEventEntityManager;
import org.eclipse.hawkbit.repository.jpa.executor.AfterTransactionCommitDefaultServiceExecutor;
import org.eclipse.hawkbit.repository.jpa.executor.AfterTransactionCommitExecutor;
import org.eclipse.hawkbit.repository.jpa.model.helper.AfterTransactionCommitExecutorHolder;
import org.eclipse.hawkbit.repository.jpa.model.helper.EntityInterceptorHolder;
@@ -70,6 +71,10 @@ import org.eclipse.hawkbit.repository.jpa.model.helper.SecurityTokenGeneratorHol
import org.eclipse.hawkbit.repository.jpa.model.helper.SystemSecurityContextHolder;
import org.eclipse.hawkbit.repository.jpa.model.helper.TenantAwareHolder;
import org.eclipse.hawkbit.repository.jpa.rollout.RolloutScheduler;
import org.eclipse.hawkbit.repository.jpa.rollout.condition.PauseRolloutGroupAction;
import org.eclipse.hawkbit.repository.jpa.rollout.condition.StartNextGroupRolloutGroupSuccessAction;
import org.eclipse.hawkbit.repository.jpa.rollout.condition.ThresholdRolloutGroupErrorCondition;
import org.eclipse.hawkbit.repository.jpa.rollout.condition.ThresholdRolloutGroupSuccessCondition;
import org.eclipse.hawkbit.repository.jpa.rsql.RsqlParserValidationOracle;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetType;
@@ -87,16 +92,18 @@ import org.eclipse.hawkbit.security.SystemSecurityContext;
import org.eclipse.hawkbit.tenancy.TenantAware;
import org.eclipse.persistence.config.PersistenceUnitProperties;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
import org.springframework.boot.orm.jpa.EntityScan;
import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers;
import org.springframework.cloud.bus.BusProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.annotation.Import;
@@ -123,23 +130,71 @@ import com.google.common.collect.Maps;
* General configuration for hawkBit's Repository.
*
*/
@EnableJpaRepositories(basePackages = { "org.eclipse.hawkbit.repository.jpa" })
@EnableJpaRepositories("org.eclipse.hawkbit.repository.jpa")
@EnableTransactionManagement
@EnableJpaAuditing
@EnableAspectJAutoProxy
@Configuration
@ComponentScan
@EnableScheduling
@EnableRetry
@EntityScan("org.eclipse.hawkbit.repository.jpa.model")
@PropertySource("classpath:/hawkbit-jpa-defaults.properties")
@Import({ RepositoryDefaultConfiguration.class })
@Import({ RepositoryDefaultConfiguration.class, DataSourceAutoConfiguration.class,
SystemManagementCacheKeyGenerator.class })
@AutoConfigureAfter(DataSourceAutoConfiguration.class)
public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
@Autowired
RepositoryApplicationConfiguration(final DataSource dataSource, final JpaProperties jpaProperties,
final ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider) {
super(dataSource, jpaProperties, jtaTransactionManagerProvider);
protected RepositoryApplicationConfiguration(final DataSource dataSource, final JpaProperties properties,
final ObjectProvider<JtaTransactionManager> jtaTransactionManagerProvider,
final ObjectProvider<TransactionManagerCustomizers> transactionManagerCustomizers) {
super(dataSource, properties, jtaTransactionManagerProvider, transactionManagerCustomizers);
}
@Bean
@ConditionalOnMissingBean
PauseRolloutGroupAction pauseRolloutGroupAction(final RolloutManagement rolloutManagement,
final RolloutGroupRepository rolloutGroupRepository, final SystemSecurityContext systemSecurityContext) {
return new PauseRolloutGroupAction(rolloutManagement, rolloutGroupRepository, systemSecurityContext);
}
@Bean
@ConditionalOnMissingBean
StartNextGroupRolloutGroupSuccessAction startNextRolloutGroupAction(
final RolloutGroupRepository rolloutGroupRepository, final DeploymentManagement deploymentManagement,
final SystemSecurityContext systemSecurityContext) {
return new StartNextGroupRolloutGroupSuccessAction(rolloutGroupRepository, deploymentManagement,
systemSecurityContext);
}
@Bean
@ConditionalOnMissingBean
ThresholdRolloutGroupErrorCondition thresholdRolloutGroupErrorCondition(final ActionRepository actionRepository) {
return new ThresholdRolloutGroupErrorCondition(actionRepository);
}
@Bean
@ConditionalOnMissingBean
ThresholdRolloutGroupSuccessCondition thresholdRolloutGroupSuccessCondition(
final ActionRepository actionRepository) {
return new ThresholdRolloutGroupSuccessCondition(actionRepository);
}
@Bean
@ConditionalOnMissingBean
SystemManagementCacheKeyGenerator systemManagementCacheKeyGenerator() {
return new SystemManagementCacheKeyGenerator();
}
@Bean
@ConditionalOnMissingBean
AfterTransactionCommitDefaultServiceExecutor afterTransactionCommitDefaultServiceExecutor() {
return new AfterTransactionCommitDefaultServiceExecutor();
}
@Bean
@ConditionalOnMissingBean
NoCountPagingRepository noCountPagingRepository() {
return new NoCountPagingRepository();
}
@Bean
@@ -163,7 +218,7 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
@Bean
@ConditionalOnMissingBean
ApplicationEventFilter applicationEventFilter(final RepositoryProperties repositoryProperties) {
return e -> (e instanceof TargetPollEvent) && !repositoryProperties.isPublishTargetPollEvent();
return e -> e instanceof TargetPollEvent && !repositoryProperties.isPublishTargetPollEvent();
}
/**
@@ -389,16 +444,16 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
final DistributionSetMetadataRepository distributionSetMetadataRepository,
final TargetFilterQueryRepository targetFilterQueryRepository, final ActionRepository actionRepository,
final NoCountPagingRepository criteriaNoCountDao, final ApplicationEventPublisher eventPublisher,
final ApplicationContext applicationContext, final TenantAware tenantAware,
final BusProperties bus, final TenantAware tenantAware,
final VirtualPropertyReplacer virtualPropertyReplacer,
final SoftwareModuleRepository softwareModuleRepository,
final DistributionSetTagRepository distributionSetTagRepository,
final AfterTransactionCommitExecutor afterCommit, final JpaProperties properties) {
return new JpaDistributionSetManagement(entityManager, distributionSetRepository, distributionSetTagManagement,
systemManagement, distributionSetTypeManagement, quotaManagement, distributionSetMetadataRepository,
targetFilterQueryRepository, actionRepository, criteriaNoCountDao, eventPublisher, applicationContext,
tenantAware, virtualPropertyReplacer, softwareModuleRepository, distributionSetTagRepository,
afterCommit, properties.getDatabase());
targetFilterQueryRepository, actionRepository, criteriaNoCountDao, eventPublisher, bus, tenantAware,
virtualPropertyReplacer, softwareModuleRepository, distributionSetTagRepository, afterCommit,
properties.getDatabase());
}
@@ -455,13 +510,13 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
final DistributionSetRepository distributionSetRepository,
final TargetFilterQueryRepository targetFilterQueryRepository,
final TargetTagRepository targetTagRepository, final NoCountPagingRepository criteriaNoCountDao,
final ApplicationEventPublisher eventPublisher, final ApplicationContext applicationContext,
final TenantAware tenantAware, final AfterTransactionCommitExecutor afterCommit,
final VirtualPropertyReplacer virtualPropertyReplacer, final JpaProperties properties) {
final ApplicationEventPublisher eventPublisher, final BusProperties bus, final TenantAware tenantAware,
final AfterTransactionCommitExecutor afterCommit, final VirtualPropertyReplacer virtualPropertyReplacer,
final JpaProperties properties) {
return new JpaTargetManagement(entityManager, quotaManagement, targetRepository, targetMetadataRepository,
rolloutGroupRepository, distributionSetRepository, targetFilterQueryRepository, targetTagRepository,
criteriaNoCountDao, eventPublisher, applicationContext, tenantAware, afterCommit,
virtualPropertyReplacer, properties.getDatabase());
criteriaNoCountDao, eventPublisher, bus, tenantAware, afterCommit, virtualPropertyReplacer,
properties.getDatabase());
}
/**
@@ -565,12 +620,13 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
RolloutManagement rolloutManagement(final TargetManagement targetManagement,
final DeploymentManagement deploymentManagement, final RolloutGroupManagement rolloutGroupManagement,
final DistributionSetManagement distributionSetManagement, final ApplicationContext context,
final ApplicationEventPublisher eventPublisher, final VirtualPropertyReplacer virtualPropertyReplacer,
final PlatformTransactionManager txManager, final TenantAware tenantAware, final LockRegistry lockRegistry,
final JpaProperties properties, final RolloutApprovalStrategy rolloutApprovalStrategy) {
final BusProperties bus, final ApplicationEventPublisher eventPublisher,
final VirtualPropertyReplacer virtualPropertyReplacer, final PlatformTransactionManager txManager,
final TenantAware tenantAware, final LockRegistry lockRegistry, final JpaProperties properties,
final RolloutApprovalStrategy rolloutApprovalStrategy) {
return new JpaRolloutManagement(targetManagement, deploymentManagement, rolloutGroupManagement,
distributionSetManagement, context, eventPublisher, virtualPropertyReplacer, txManager, tenantAware,
lockRegistry, properties.getDatabase(), rolloutApprovalStrategy);
distributionSetManagement, context, bus, eventPublisher, virtualPropertyReplacer, txManager,
tenantAware, lockRegistry, properties.getDatabase(), rolloutApprovalStrategy);
}
/**
@@ -614,15 +670,15 @@ public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
final ActionRepository actionRepository, final DistributionSetRepository distributionSetRepository,
final TargetRepository targetRepository, final ActionStatusRepository actionStatusRepository,
final TargetManagement targetManagement, final AuditorAware<String> auditorProvider,
final ApplicationEventPublisher eventPublisher, final ApplicationContext applicationContext,
final ApplicationEventPublisher eventPublisher, final BusProperties bus,
final AfterTransactionCommitExecutor afterCommit, final VirtualPropertyReplacer virtualPropertyReplacer,
final PlatformTransactionManager txManager,
final TenantConfigurationManagement tenantConfigurationManagement, final QuotaManagement quotaManagement,
final SystemSecurityContext systemSecurityContext, final TenantAware tenantAware,
final JpaProperties properties) {
return new JpaDeploymentManagement(entityManager, actionRepository, distributionSetRepository, targetRepository,
actionStatusRepository, targetManagement, auditorProvider, eventPublisher, applicationContext,
afterCommit, virtualPropertyReplacer, txManager, tenantConfigurationManagement, quotaManagement,
actionStatusRepository, targetManagement, auditorProvider, eventPublisher, bus, afterCommit,
virtualPropertyReplacer, txManager, tenantConfigurationManagement, quotaManagement,
systemSecurityContext, tenantAware, properties.getDatabase());
}

View File

@@ -84,5 +84,5 @@ public interface SoftwareModuleTypeRepository
@Override
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477
@Query("SELECT d FROM JpaSoftwareModuleType d WHERE d.id IN ?1")
List<JpaSoftwareModuleType> findAll(Iterable<Long> ids);
List<JpaSoftwareModuleType> findAllById(Iterable<Long> ids);
}

View File

@@ -15,13 +15,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.cache.interceptor.SimpleKeyGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
/**
* Implementation of {@link CurrentTenantCacheKeyGenerator}.
*
*/
@Service
public class SystemManagementCacheKeyGenerator implements CurrentTenantCacheKeyGenerator {
@Autowired

View File

@@ -177,6 +177,18 @@ public interface TargetRepository extends BaseEntityRepository<JpaTarget, Long>,
*/
Page<Target> findByAssignedDistributionSetId(Pageable pageable, Long setID);
/**
* retrieves {@link Target}s where
* {@link JpaTarget#isRequestControllerAttributes()}.
*
* @param pageReq
* page parameter
*
* @return the found {@link Target}s
*
*/
Page<Target> findByRequestControllerAttributesIsTrue(Pageable pageable);
/**
* Counts number of targets with given distribution set Id.
*
@@ -209,7 +221,7 @@ public interface TargetRepository extends BaseEntityRepository<JpaTarget, Long>,
@Override
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=349477
@Query("SELECT t FROM JpaTarget t WHERE t.id IN ?1")
List<JpaTarget> findAll(Iterable<Long> ids);
List<JpaTarget> findAllById(Iterable<Long> ids);
/**
*

View File

@@ -102,7 +102,7 @@ public class AutoAssignChecker {
public void check() {
LOGGER.debug("Auto assigned check call");
final PageRequest pageRequest = new PageRequest(0, PAGE_SIZE);
final PageRequest pageRequest = PageRequest.of(0, PAGE_SIZE);
final Page<TargetFilterQuery> filterQueries = targetFilterQueryManagement
.findWithAutoAssignDS(pageRequest);
@@ -176,7 +176,7 @@ public class AutoAssignChecker {
private List<TargetWithActionType> getTargetsWithActionType(final String targetFilterQuery, final Long dsId,
final int count) {
final Page<Target> targets = targetManagement
.findByTargetFilterQueryAndNonDS(new PageRequest(0, count), dsId, targetFilterQuery);
.findByTargetFilterQueryAndNonDS(PageRequest.of(0, count), dsId, targetFilterQuery);
return targets.getContent().stream().map(t -> new TargetWithActionType(t.getControllerId(),
Action.ActionType.FORCED, RepositoryModelConstants.NO_FORCE_TIME)).collect(Collectors.toList());

View File

@@ -13,7 +13,6 @@ import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.support.TransactionSynchronizationAdapter;
import org.springframework.transaction.support.TransactionSynchronizationManager;
@@ -22,7 +21,6 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
* A Service which calls register runnable. This runnables will executed after a
* successful spring transaction commit.The class is thread safe.
*/
@Service
public class AfterTransactionCommitDefaultServiceExecutor extends TransactionSynchronizationAdapter
implements AfterTransactionCommitExecutor {
private static final Logger LOGGER = LoggerFactory.getLogger(AfterTransactionCommitDefaultServiceExecutor.class);

View File

@@ -77,8 +77,8 @@ public class JpaTenantMetaData extends AbstractJpaBaseEntity implements TenantMe
return defaultDsType;
}
public void setDefaultDsType(final DistributionSetType defaultDsType) {
this.defaultDsType = (JpaDistributionSetType) defaultDsType;
public void setDefaultDsType(final JpaDistributionSetType defaultDsType) {
this.defaultDsType = defaultDsType;
}
@Override

View File

@@ -15,24 +15,25 @@ import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
import org.eclipse.hawkbit.security.SystemSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Error action evaluator which pauses the whole {@link Rollout} and sets the
* current {@link RolloutGroup} to error.
*/
@Component("pauseRolloutGroupAction")
public class PauseRolloutGroupAction implements RolloutGroupActionEvaluator {
@Autowired
private RolloutManagement rolloutManagement;
private final RolloutManagement rolloutManagement;
@Autowired
private RolloutGroupRepository rolloutGroupRepository;
private final RolloutGroupRepository rolloutGroupRepository;
@Autowired
private SystemSecurityContext systemSecurityContext;
private final SystemSecurityContext systemSecurityContext;
public PauseRolloutGroupAction(final RolloutManagement rolloutManagement,
final RolloutGroupRepository rolloutGroupRepository, final SystemSecurityContext systemSecurityContext) {
this.rolloutManagement = rolloutManagement;
this.rolloutGroupRepository = rolloutGroupRepository;
this.systemSecurityContext = systemSecurityContext;
}
@Override
public boolean verifyExpression(final String expression) {

View File

@@ -19,25 +19,26 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
import org.eclipse.hawkbit.security.SystemSecurityContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Success action which starts the next following {@link RolloutGroup}.
*/
@Component("startNextRolloutGroupAction")
public class StartNextGroupRolloutGroupSuccessAction implements RolloutGroupActionEvaluator {
private static final Logger logger = LoggerFactory.getLogger(StartNextGroupRolloutGroupSuccessAction.class);
@Autowired
private RolloutGroupRepository rolloutGroupRepository;
private final RolloutGroupRepository rolloutGroupRepository;
@Autowired
private DeploymentManagement deploymentManagement;
private final DeploymentManagement deploymentManagement;
@Autowired
private SystemSecurityContext systemSecurityContext;
private final SystemSecurityContext systemSecurityContext;
public StartNextGroupRolloutGroupSuccessAction(final RolloutGroupRepository rolloutGroupRepository,
final DeploymentManagement deploymentManagement, final SystemSecurityContext systemSecurityContext) {
this.rolloutGroupRepository = rolloutGroupRepository;
this.deploymentManagement = deploymentManagement;
this.systemSecurityContext = systemSecurityContext;
}
@Override
public boolean verifyExpression(final String expression) {

View File

@@ -16,19 +16,19 @@ import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
*/
@Component("thresholdRolloutGroupErrorCondition")
public class ThresholdRolloutGroupErrorCondition implements RolloutGroupConditionEvaluator {
private static final Logger LOGGER = LoggerFactory.getLogger(ThresholdRolloutGroupErrorCondition.class);
@Autowired
private ActionRepository actionRepository;
private final ActionRepository actionRepository;
public ThresholdRolloutGroupErrorCondition(final ActionRepository actionRepository) {
this.actionRepository = actionRepository;
}
@Override
public boolean eval(final Rollout rollout, final RolloutGroup rolloutGroup, final String expression) {

View File

@@ -14,19 +14,19 @@ import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.RolloutGroup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* Threshold to calculate if rollout group success condition is reached and the
* next rollout group can get started.
*/
@Component("thresholdRolloutGroupSuccessCondition")
public class ThresholdRolloutGroupSuccessCondition implements RolloutGroupConditionEvaluator {
private static final Logger LOGGER = LoggerFactory.getLogger(ThresholdRolloutGroupSuccessCondition.class);
@Autowired
private ActionRepository actionRepository;
private final ActionRepository actionRepository;
public ThresholdRolloutGroupSuccessCondition(final ActionRepository actionRepository) {
this.actionRepository = actionRepository;
}
@Override
public boolean eval(final Rollout rollout, final RolloutGroup rolloutGroup, final String expression) {

View File

@@ -159,6 +159,8 @@ public final class RSQLUtility {
private static final class RSQLSpecification<A extends Enum<A> & FieldNameProvider, T> implements Specification<T> {
private static final long serialVersionUID = 1L;
private final String rsql;
private final Class<A> enumType;
private final VirtualPropertyReplacer virtualPropertyReplacer;

View File

@@ -76,7 +76,7 @@ public class RsqlParserValidationOracle implements RsqlValidationOracle {
context.setSyntaxErrorContext(errorContext);
try {
targetManagement.findByRsql(new PageRequest(0, 1), rsqlQuery);
targetManagement.findByRsql(PageRequest.of(0, 1), rsqlQuery);
context.setSyntaxError(false);
suggestionContext.getSuggestions().addAll(getLogicalOperatorSuggestion(rsqlQuery));
} catch (final RSQLParameterSyntaxException | RSQLParserException ex) {

View File

@@ -11,7 +11,6 @@ package org.eclipse.hawkbit.repository.jpa.specifications;
import java.util.List;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.domain.Specifications;
/**
* Helper class to easily combine {@link Specification} instances.
@@ -31,11 +30,11 @@ public final class SpecificationsBuilder {
* all specification which will combine
* @return <null> if the given specification list is empty
*/
public static <T> Specifications<T> combineWithAnd(final List<Specification<T>> specList) {
public static <T> Specification<T> combineWithAnd(final List<Specification<T>> specList) {
if (specList.isEmpty()) {
return null;
}
Specifications<T> specs = Specifications.where(specList.get(0));
Specification<T> specs = Specification.where(specList.get(0));
for (final Specification<T> specification : specList.subList(1, specList.size())) {
specs = specs.and(specification);
}

View File

@@ -7,6 +7,8 @@
# http://www.eclipse.org/legal/epl-v10.html
#
spring.main.allow-bean-definition-overriding=true
### JPA / Datasource - START
spring.jpa.database=H2
spring.jpa.show-sql=false
@@ -17,8 +19,9 @@ spring.jpa.properties.eclipselink.logging.level=off
spring.datasource.eclipselink.query-results-cache=false
spring.datasource.eclipselink.cache.shared.default=false
# Flyway DDL
flyway.enabled=true
flyway.initOnMigrate=true
flyway.cleanDisabled=true
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
spring.flyway.enabled=true
spring.flyway.init-on-migrate=true
spring.flyway.clean-disabled=true
spring.flyway.sql-migration-suffixes=${spring.jpa.database}.sql
spring.flyway.table=schema_version
### JPA / Datasource - END

View File

@@ -47,7 +47,7 @@ public abstract class AbstractRemoteEventTest extends AbstractJpaIntegrationTest
@Before
public void setup() throws Exception {
final BusJacksonAutoConfiguration autoConfiguration = new BusJacksonAutoConfiguration();
this.jacksonMessageConverter = autoConfiguration.busJsonConverter();
this.jacksonMessageConverter = autoConfiguration.busJsonConverter(null);
ReflectionTestUtils.setField(jacksonMessageConverter, "packagesToScan",
new String[] { "org.eclipse.hawkbit.repository.event.remote",
ClassUtils.getPackageName(RemoteApplicationEvent.class) });

View File

@@ -26,23 +26,25 @@ import org.eclipse.hawkbit.repository.model.Rollout;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
import org.eclipse.hawkbit.repository.test.TestConfiguration;
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTest;
import org.eclipse.hawkbit.repository.test.util.RolloutTestApprovalStrategy;
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.test.binder.TestSupportBinderAutoConfiguration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.collect.Lists;
@SpringApplicationConfiguration(classes = {
org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration.class })
@ContextConfiguration(classes = { RepositoryApplicationConfiguration.class, TestConfiguration.class,
TestSupportBinderAutoConfiguration.class })
@TestPropertySource(locations = "classpath:/jpa-test.properties")
public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest {
protected static final String INVALID_TEXT_HTML = "</noscript><br><script>";
protected static final String NOT_EXIST_ID = "1234";
protected static final String NOT_EXIST_ID = "12345678990";
protected static final long NOT_EXIST_IDL = Long.parseLong(NOT_EXIST_ID);
@PersistenceContext

View File

@@ -82,8 +82,9 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTest {
NOT_EXIST_IDL, "xxx", null, null, false, null, artifactSize)),
"SoftwareModule");
verifyThrownExceptionBy(() -> artifactManagement.create(
new ArtifactUpload(IOUtils.toInputStream(artifactData, "UTF-8"), 1234L, "xxx", false, artifactSize)),
verifyThrownExceptionBy(
() -> artifactManagement.create(new ArtifactUpload(IOUtils.toInputStream(artifactData, "UTF-8"),
NOT_EXIST_IDL, "xxx", null, null, false, null, artifactSize)),
"SoftwareModule");
verifyThrownExceptionBy(() -> artifactManagement.delete(NOT_EXIST_IDL), "Artifact");
@@ -120,7 +121,8 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTest {
final Artifact artifact1 = createArtifactForSoftwareModule("file1", sm.getId(), artifactSize, inputStream1);
createArtifactForSoftwareModule("file11", sm.getId(), artifactSize, inputStream2);
createArtifactForSoftwareModule("file12", sm.getId(), artifactSize, inputStream3);
final Artifact artifact2 = createArtifactForSoftwareModule("file2", sm2.getId(), artifactSize, inputStream4);
final Artifact artifact2 = createArtifactForSoftwareModule("file2", sm2.getId(), artifactSize,
inputStream4);
assertThat(artifact1).isInstanceOf(Artifact.class);
assertThat(artifact1.getSoftwareModule().getId()).isEqualTo(sm.getId());
@@ -152,9 +154,9 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTest {
final long smID = softwareModuleRepository
.save(new JpaSoftwareModule(osType, "smIllegalFilenameTest", "1.0", null, null)).getId();
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(() -> artifactManagement.create(
new ArtifactUpload(IOUtils.toInputStream(artifactData, "UTF-8"), smID, illegalFilename, false,
artifactSize)));
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
() -> artifactManagement.create(new ArtifactUpload(IOUtils.toInputStream(artifactData, "UTF-8"), smID,
illegalFilename, false, artifactSize)));
assertThat(softwareModuleManagement.get(smID).get().getArtifacts()).hasSize(0);
}
@@ -284,7 +286,8 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTest {
final InputStream inputStream2 = new RandomGeneratedInputStream(artifactSize)) {
final Artifact artifact1 = createArtifactForSoftwareModule("file1", sm.getId(), artifactSize, inputStream1);
final Artifact artifact2 = createArtifactForSoftwareModule("file2", sm2.getId(), artifactSize, inputStream2);
final Artifact artifact2 = createArtifactForSoftwareModule("file2", sm2.getId(), artifactSize,
inputStream2);
assertThat(artifactRepository.findAll()).hasSize(2);
@@ -292,16 +295,18 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTest {
assertThat(artifact2.getId()).isNotNull();
assertThat(((JpaArtifact) artifact1).getSha1Hash()).isNotEqualTo(((JpaArtifact) artifact2).getSha1Hash());
assertThat(binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact1.getSha1Hash()))
.isNotNull();
assertThat(
binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact1.getSha1Hash()))
.isNotNull();
assertThat(
binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact2.getSha1Hash()))
.isNotNull();
artifactManagement.delete(artifact1.getId());
assertThat(binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact1.getSha1Hash()))
.isNull();
assertThat(
binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact1.getSha1Hash()))
.isNull();
assertThat(
binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact2.getSha1Hash()))
.isNotNull();
@@ -331,22 +336,26 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTest {
try (final InputStream inputStream1 = new ByteArrayInputStream(randomBytes);
final InputStream inputStream2 = new ByteArrayInputStream(randomBytes)) {
final Artifact artifact1 = createArtifactForSoftwareModule("file1", sm.getId(), artifactSize, inputStream1);
final Artifact artifact2 = createArtifactForSoftwareModule("file2", sm2.getId(), artifactSize, inputStream2);
final Artifact artifact2 = createArtifactForSoftwareModule("file2", sm2.getId(), artifactSize,
inputStream2);
assertThat(artifactRepository.findAll()).hasSize(2);
assertThat(artifact1.getId()).isNotNull();
assertThat(artifact2.getId()).isNotNull();
assertThat(((JpaArtifact) artifact1).getSha1Hash()).isEqualTo(((JpaArtifact) artifact2).getSha1Hash());
assertThat(binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact1.getSha1Hash()))
.isNotNull();
assertThat(
binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact1.getSha1Hash()))
.isNotNull();
artifactManagement.delete(artifact1.getId());
assertThat(binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact1.getSha1Hash()))
.isNotNull();
assertThat(
binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact1.getSha1Hash()))
.isNotNull();
artifactManagement.delete(artifact2.getId());
assertThat(binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact1.getSha1Hash()))
.isNull();
assertThat(
binaryArtifactRepository.getArtifactBySha1(tenantAware.getCurrentTenant(), artifact1.getSha1Hash()))
.isNull();
}
}

View File

@@ -688,8 +688,8 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
// populated;
final List<JpaTarget> allFoundTargets = targetRepository.findAll();
final List<JpaTarget> deployedTargetsFromDB = targetRepository.findAll(deployedTargetIDs);
final List<JpaTarget> undeployedTargetsFromDB = targetRepository.findAll(undeployedTargetIDs);
final List<JpaTarget> deployedTargetsFromDB = targetRepository.findAllById(deployedTargetIDs);
final List<JpaTarget> undeployedTargetsFromDB = targetRepository.findAllById(undeployedTargetIDs);
// test that number of Targets
assertThat(allFoundTargets.spliterator().getExactSizeIfKnown()).as("number of target is wrong")
@@ -721,7 +721,7 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
+ "from target/controller. Expected behaviour is that in case of OK finished update the target will go to "
+ "IN_SYNC status and installed DS is set to the assigned DS entry.")
public void assignDistributionSetAndAddFinishedActionStatus() {
final PageRequest pageRequest = new PageRequest(0, 100, Direction.ASC, ActionStatusFields.ID.getFieldName());
final PageRequest pageRequest = PageRequest.of(0, 100, Direction.ASC, ActionStatusFields.ID.getFieldName());
final DeploymentResult deployResWithDsA = prepareComplexRepo("undep-A-T", 2, "dep-A-T", 4, 1, "dsA");
final DeploymentResult deployResWithDsB = prepareComplexRepo("undep-B-T", 3, "dep-B-T", 5, 1, "dsB");
@@ -815,7 +815,7 @@ public class DeploymentManagementTest extends AbstractJpaIntegrationTest {
+ "if the DS is assigned to a target and a hard delete if the DS is not in use at all.")
public void deleteDistributionSet() {
final PageRequest pageRequest = new PageRequest(0, 100, Direction.ASC, "id");
final PageRequest pageRequest = PageRequest.of(0, 100, Direction.ASC, "id");
final String undeployedTargetPrefix = "undep-T";
final int noOfUndeployedTargets = 2;

View File

@@ -868,10 +868,10 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
}
final Page<DistributionSetMetadata> metadataOfDs1 = distributionSetManagement
.findMetaDataByDistributionSetId(new PageRequest(0, 100), ds1.getId());
.findMetaDataByDistributionSetId(PageRequest.of(0, 100), ds1.getId());
final Page<DistributionSetMetadata> metadataOfDs2 = distributionSetManagement
.findMetaDataByDistributionSetId(new PageRequest(0, 100), ds2.getId());
.findMetaDataByDistributionSetId(PageRequest.of(0, 100), ds2.getId());
assertThat(metadataOfDs1.getNumberOfElements()).isEqualTo(10);
assertThat(metadataOfDs1.getTotalElements()).isEqualTo(10);

View File

@@ -59,15 +59,12 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
@ExpectEvents({ @Expect(type = DistributionSetTagUpdatedEvent.class, count = 0),
@Expect(type = TargetTagUpdatedEvent.class, count = 0) })
public void entityQueriesReferringToNotExistingEntitiesThrowsException() {
verifyThrownExceptionBy(() -> distributionSetTagManagement.delete(NOT_EXIST_ID),
"DistributionSetTag");
verifyThrownExceptionBy(() -> distributionSetTagManagement.delete(NOT_EXIST_ID), "DistributionSetTag");
verifyThrownExceptionBy(
() -> distributionSetTagManagement.findByDistributionSet(PAGE, NOT_EXIST_IDL),
verifyThrownExceptionBy(() -> distributionSetTagManagement.findByDistributionSet(PAGE, NOT_EXIST_IDL),
"DistributionSet");
verifyThrownExceptionBy(
() -> distributionSetTagManagement.update(entityFactory.tag().update(NOT_EXIST_IDL)),
verifyThrownExceptionBy(() -> distributionSetTagManagement.update(entityFactory.tag().update(NOT_EXIST_IDL)),
"DistributionSetTag");
}
@@ -82,16 +79,11 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
final Collection<DistributionSet> dsBCs = testdataFactory.createDistributionSets("DS-BC", 13);
final Collection<DistributionSet> dsABCs = testdataFactory.createDistributionSets("DS-ABC", 9);
final DistributionSetTag tagA = distributionSetTagManagement
.create(entityFactory.tag().create().name("A"));
final DistributionSetTag tagB = distributionSetTagManagement
.create(entityFactory.tag().create().name("B"));
final DistributionSetTag tagC = distributionSetTagManagement
.create(entityFactory.tag().create().name("C"));
final DistributionSetTag tagX = distributionSetTagManagement
.create(entityFactory.tag().create().name("X"));
final DistributionSetTag tagY = distributionSetTagManagement
.create(entityFactory.tag().create().name("Y"));
final DistributionSetTag tagA = distributionSetTagManagement.create(entityFactory.tag().create().name("A"));
final DistributionSetTag tagB = distributionSetTagManagement.create(entityFactory.tag().create().name("B"));
final DistributionSetTag tagC = distributionSetTagManagement.create(entityFactory.tag().create().name("C"));
final DistributionSetTag tagX = distributionSetTagManagement.create(entityFactory.tag().create().name("X"));
final DistributionSetTag tagY = distributionSetTagManagement.create(entityFactory.tag().create().name("Y"));
toggleTagAssignment(dsAs, tagA);
toggleTagAssignment(dsBs, tagB);
@@ -210,8 +202,8 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
assertThat(result.getAssigned()).isEqualTo(0);
assertThat(result.getAssignedEntity()).isEmpty();
assertThat(result.getUnassigned()).isEqualTo(40);
assertThat(result.getUnassignedEntity()).containsAll(distributionSetManagement.get(
concat(groupB, groupA).stream().map(DistributionSet::getId).collect(Collectors.toList())));
assertThat(result.getUnassignedEntity()).containsAll(distributionSetManagement
.get(concat(groupB, groupA).stream().map(DistributionSet::getId).collect(Collectors.toList())));
assertThat(result.getDistributionSetTag()).isEqualTo(tag);
}
@@ -219,15 +211,15 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
@Test
@Description("Ensures that a created tag is persisted in the repository as defined.")
public void createDistributionSetTag() {
final Tag tag = distributionSetTagManagement.create(
entityFactory.tag().create().name("kai1").description("kai2").colour("colour"));
final Tag tag = distributionSetTagManagement
.create(entityFactory.tag().create().name("kai1").description("kai2").colour("colour"));
assertThat(distributionSetTagRepository.findByNameEquals("kai1").get().getDescription()).as("wrong tag found")
.isEqualTo("kai2");
assertThat(distributionSetTagManagement.getByName("kai1").get().getColour()).as("wrong tag found")
.isEqualTo("colour");
assertThat(distributionSetTagManagement.get(tag.getId()).get().getColour())
.as("wrong tag found").isEqualTo("colour");
assertThat(distributionSetTagManagement.get(tag.getId()).get().getColour()).as("wrong tag found")
.isEqualTo("colour");
}
@Test
@@ -238,7 +230,7 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
final DistributionSetTag toDelete = tags.iterator().next();
for (final DistributionSet set : distributionSetRepository.findAll()) {
assertThat(distributionSetRepository.findOne(set.getId()).getTags()).as("Wrong tag found")
assertThat(distributionSetRepository.findById(set.getId()).get().getTags()).as("Wrong tag found")
.contains(toDelete);
}
@@ -246,12 +238,13 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
distributionSetTagManagement.delete(tags.iterator().next().getName());
// check
assertThat(distributionSetTagRepository.findOne(toDelete.getId())).as("Deleted tag should be null").isNull();
assertThat(distributionSetTagManagement.findAll(PAGE).getContent())
.as("Wrong size of tags after deletion").hasSize(19);
assertThat(distributionSetTagRepository.findById(toDelete.getId())).as("Deleted tag should be null")
.isNotPresent();
assertThat(distributionSetTagManagement.findAll(PAGE).getContent()).as("Wrong size of tags after deletion")
.hasSize(19);
for (final DistributionSet set : distributionSetRepository.findAll()) {
assertThat(distributionSetRepository.findOne(set.getId()).getTags()).as("Wrong found tags")
assertThat(distributionSetRepository.findById(set.getId()).get().getTags()).as("Wrong found tags")
.doesNotContain(toDelete);
}
}
@@ -272,8 +265,7 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
@Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).")
public void failedDuplicateDsTagNameExceptionAfterUpdate() {
distributionSetTagManagement.create(entityFactory.tag().create().name("A"));
final DistributionSetTag tag = distributionSetTagManagement
.create(entityFactory.tag().create().name("B"));
final DistributionSetTag tag = distributionSetTagManagement.create(entityFactory.tag().create().name("B"));
try {
distributionSetTagManagement.update(entityFactory.tag().update(tag.getId()).name("A"));
@@ -294,14 +286,13 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
final DistributionSetTag savedAssigned = tags.iterator().next();
// persist
distributionSetTagManagement
.update(entityFactory.tag().update(savedAssigned.getId()).name("test123"));
distributionSetTagManagement.update(entityFactory.tag().update(savedAssigned.getId()).name("test123"));
// check data
assertThat(distributionSetTagManagement.findAll(PAGE).getContent())
.as("Wrong size of ds tags").hasSize(tags.size());
assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).as("Wrong ds tag found")
.isEqualTo("test123");
assertThat(distributionSetTagManagement.findAll(PAGE).getContent()).as("Wrong size of ds tags")
.hasSize(tags.size());
assertThat(distributionSetTagRepository.findById(savedAssigned.getId()).get().getName())
.as("Wrong ds tag found").isEqualTo("test123");
}
@Test

View File

@@ -72,7 +72,7 @@ public class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTes
testdataFactory.findOrCreateDistributionSetType("xxx", "xxx").getId(), Arrays.asList(NOT_EXIST_IDL)),
"SoftwareModuleType");
verifyThrownExceptionBy(() -> distributionSetTypeManagement.assignOptionalSoftwareModuleTypes(1234L,
verifyThrownExceptionBy(() -> distributionSetTypeManagement.assignOptionalSoftwareModuleTypes(NOT_EXIST_IDL,
Arrays.asList(osType.getId())), "DistributionSetType");
verifyThrownExceptionBy(() -> distributionSetTypeManagement.assignOptionalSoftwareModuleTypes(
testdataFactory.findOrCreateDistributionSetType("xxx", "xxx").getId(), Arrays.asList(NOT_EXIST_IDL)),

View File

@@ -8,6 +8,8 @@
*/
package org.eclipse.hawkbit.repository.jpa;
import static org.assertj.core.api.Assertions.assertThat;
import org.eclipse.hawkbit.repository.event.remote.RolloutDeletedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetCreatedEvent;
import org.eclipse.hawkbit.repository.event.remote.entity.RolloutCreatedEvent;
@@ -20,8 +22,6 @@ import org.eclipse.hawkbit.repository.test.matcher.Expect;
import org.eclipse.hawkbit.repository.test.matcher.ExpectEvents;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
import io.qameta.allure.Description;
import io.qameta.allure.Feature;
import io.qameta.allure.Story;

View File

@@ -17,6 +17,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -1547,41 +1548,40 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
}
@Test
@Description("Creating a rollout with approval role or approval engine disabled results in the rollout being in " +
"READY state.")
@Description("Creating a rollout with approval role or approval engine disabled results in the rollout being in "
+ "READY state.")
public void createdRolloutWithApprovalRoleOrApprovalDisabledTransitionsToReadyState() {
approvalStrategy.setApprovalNeeded(false);
final String successCondition = "50";
final String errorCondition = "80";
final Rollout rollout = createSimpleTestRolloutWithTargetsAndDistributionSet(10, 10,
5, successCondition, errorCondition);
final Rollout rollout = createSimpleTestRolloutWithTargetsAndDistributionSet(10, 10, 5, successCondition,
errorCondition);
assertThat(rollout.getStatus()).isEqualTo(Rollout.RolloutStatus.READY);
}
@Test
@Description("Creating a rollout without approver role and approval enabled leads to transition to " +
"WAITING_FOR_APPROVAL state.")
@Description("Creating a rollout without approver role and approval enabled leads to transition to "
+ "WAITING_FOR_APPROVAL state.")
public void createdRolloutWithoutApprovalRoleTransitionsToWaitingForApprovalState() {
approvalStrategy.setApprovalNeeded(true);
final String successCondition = "50";
final String errorCondition = "80";
final Rollout rollout = createSimpleTestRolloutWithTargetsAndDistributionSet(10, 10,
5, successCondition, errorCondition);
final Rollout rollout = createSimpleTestRolloutWithTargetsAndDistributionSet(10, 10, 5, successCondition,
errorCondition);
assertThat(rollout.getStatus()).isEqualTo(Rollout.RolloutStatus.WAITING_FOR_APPROVAL);
}
@Test
@Description("Approving a rollout leads to transition to READY state.")
public void approvedRolloutTransitionsToReadyState() {
approvalStrategy.setApprovalNeeded(true);
final String successCondition = "50";
final String errorCondition = "80";
final Rollout rollout = createSimpleTestRolloutWithTargetsAndDistributionSet(10, 10,
5, successCondition, errorCondition);
final Rollout rollout = createSimpleTestRolloutWithTargetsAndDistributionSet(10, 10, 5, successCondition,
errorCondition);
assertThat(rollout.getStatus()).isEqualTo(Rollout.RolloutStatus.WAITING_FOR_APPROVAL);
rolloutManagement.approveOrDeny(rollout.getId(), Rollout.ApprovalDecision.APPROVED);
final Rollout resultingRollout = rolloutRepository.findOne(rollout.getId());
final Rollout resultingRollout = rolloutRepository.findById(rollout.getId()).get();
assertThat(resultingRollout.getStatus()).isEqualTo(Rollout.RolloutStatus.READY);
}
@@ -1591,11 +1591,11 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
approvalStrategy.setApprovalNeeded(true);
final String successCondition = "50";
final String errorCondition = "80";
final Rollout rollout = createSimpleTestRolloutWithTargetsAndDistributionSet(10, 10,
5, successCondition, errorCondition);
final Rollout rollout = createSimpleTestRolloutWithTargetsAndDistributionSet(10, 10, 5, successCondition,
errorCondition);
assertThat(rollout.getStatus()).isEqualTo(Rollout.RolloutStatus.WAITING_FOR_APPROVAL);
rolloutManagement.approveOrDeny(rollout.getId(), Rollout.ApprovalDecision.DENIED);
final Rollout resultingRollout = rolloutRepository.findOne(rollout.getId());
final Rollout resultingRollout = rolloutRepository.findById(rollout.getId()).get();
assertThat(resultingRollout.getStatus()).isEqualTo(RolloutStatus.APPROVAL_DENIED);
}
@@ -1622,8 +1622,8 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
rolloutManagement.handleRollouts();
// verify
final JpaRollout deletedRollout = rolloutRepository.findOne(createdRollout.getId());
assertThat(deletedRollout).isNull();
final Optional<JpaRollout> deletedRollout = rolloutRepository.findById(createdRollout.getId());
assertThat(deletedRollout).isNotPresent();
assertThat(rolloutGroupRepository.count()).isZero();
assertThat(rolloutTargetGroupRepository.count()).isZero();
}
@@ -1663,7 +1663,7 @@ public class RolloutManagementTest extends AbstractJpaIntegrationTest {
rolloutManagement.handleRollouts();
// verify
final JpaRollout deletedRollout = rolloutRepository.findOne(createdRollout.getId());
final JpaRollout deletedRollout = rolloutRepository.findById(createdRollout.getId()).get();
assertThat(deletedRollout).isNotNull();
assertThat(deletedRollout.getStatus()).isEqualTo(RolloutStatus.DELETED);

View File

@@ -284,8 +284,8 @@ public class SoftwareModuleManagementTest extends AbstractJpaIntegrationTest {
assertArtifactNull(artifact1, artifact2);
// verify: meta data of artifact is deleted
assertThat(artifactRepository.findOne(artifact1.getId())).isNull();
assertThat(artifactRepository.findOne(artifact2.getId())).isNull();
assertThat(artifactRepository.findById(artifact1.getId())).isNotPresent();
assertThat(artifactRepository.findById(artifact2.getId())).isNotPresent();
}
@Test
@@ -315,8 +315,8 @@ public class SoftwareModuleManagementTest extends AbstractJpaIntegrationTest {
assertArtifactNull(artifact1, artifact2);
// verify: artifact meta data is still available
assertThat(artifactRepository.findOne(artifact1.getId())).isNotNull();
assertThat(artifactRepository.findOne(artifact2.getId())).isNotNull();
assertThat(artifactRepository.findById(artifact1.getId())).isNotNull();
assertThat(artifactRepository.findById(artifact2.getId())).isNotNull();
}
@Test
@@ -355,8 +355,8 @@ public class SoftwareModuleManagementTest extends AbstractJpaIntegrationTest {
assertArtifactNull(artifact1, artifact2);
// verify: artifact meta data is still available
assertThat(artifactRepository.findOne(artifact1.getId())).isNotNull();
assertThat(artifactRepository.findOne(artifact2.getId())).isNotNull();
assertThat(artifactRepository.findById(artifact1.getId())).isNotNull();
assertThat(artifactRepository.findById(artifact2.getId())).isNotNull();
}
@Test
@@ -398,10 +398,11 @@ public class SoftwareModuleManagementTest extends AbstractJpaIntegrationTest {
assertArtifactNotNull(artifactY);
// verify: meta data of artifactX is deleted
assertThat(artifactRepository.findOne(artifactX.getId())).isNull();
assertThat(artifactRepository.findById(artifactX.getId())).isNotPresent();
// verify: meta data of artifactY is not deleted
assertThat(artifactRepository.findOne(artifactY.getId())).isNotNull();
assertThat(artifactRepository.findById(artifactY.getId())).isPresent();
}
@Test
@@ -459,7 +460,7 @@ public class SoftwareModuleManagementTest extends AbstractJpaIntegrationTest {
assertArtifactNull(artifactX, artifactY);
// verify: meta data of artifactX and artifactY is not deleted
assertThat(artifactRepository.findOne(artifactY.getId())).isNotNull();
assertThat(artifactRepository.findById(artifactY.getId())).isNotNull();
}
private SoftwareModule createSoftwareModuleWithArtifacts(final SoftwareModuleType type, final String name,
@@ -488,7 +489,7 @@ public class SoftwareModuleManagementTest extends AbstractJpaIntegrationTest {
assertArtifactNotNull(artifacts.toArray(new Artifact[artifacts.size()]));
}
artifacts.forEach(artifact -> assertThat(artifactRepository.findOne(artifact.getId())).isNotNull());
artifacts.forEach(artifact -> assertThat(artifactRepository.findById(artifact.getId())).isNotNull());
return softwareModule;
}
@@ -791,13 +792,15 @@ public class SoftwareModuleManagementTest extends AbstractJpaIntegrationTest {
ah = softwareModuleManagement.get(ah.getId()).get();
assertThat(softwareModuleManagement.findMetaDataBySoftwareModuleId(new PageRequest(0, 10), ah.getId())
.getContent()).as("Contains the created metadata element")
assertThat(
softwareModuleManagement.findMetaDataBySoftwareModuleId(PageRequest.of(0, 10), ah.getId()).getContent())
.as("Contains the created metadata element")
.containsExactly(new JpaSoftwareModuleMetadata(knownKey1, ah, knownValue1));
softwareModuleManagement.deleteMetaData(ah.getId(), knownKey1);
assertThat(softwareModuleManagement.findMetaDataBySoftwareModuleId(new PageRequest(0, 10), ah.getId())
.getContent()).as("Metadata elemenets are").isEmpty();
assertThat(
softwareModuleManagement.findMetaDataBySoftwareModuleId(PageRequest.of(0, 10), ah.getId()).getContent())
.as("Metadata elemenets are").isEmpty();
}
@Test
@@ -835,10 +838,10 @@ public class SoftwareModuleManagementTest extends AbstractJpaIntegrationTest {
}
Page<SoftwareModuleMetadata> metadataSw1 = softwareModuleManagement
.findMetaDataBySoftwareModuleId(new PageRequest(0, 100), sw1.getId());
.findMetaDataBySoftwareModuleId(PageRequest.of(0, 100), sw1.getId());
Page<SoftwareModuleMetadata> metadataSw2 = softwareModuleManagement
.findMetaDataBySoftwareModuleId(new PageRequest(0, 100), sw2.getId());
.findMetaDataBySoftwareModuleId(PageRequest.of(0, 100), sw2.getId());
assertThat(metadataSw1.getNumberOfElements()).isEqualTo(metadataCountSw1);
assertThat(metadataSw1.getTotalElements()).isEqualTo(metadataCountSw1);
@@ -846,10 +849,10 @@ public class SoftwareModuleManagementTest extends AbstractJpaIntegrationTest {
assertThat(metadataSw2.getNumberOfElements()).isEqualTo(metadataCountSw2);
assertThat(metadataSw2.getTotalElements()).isEqualTo(metadataCountSw2);
metadataSw1 = softwareModuleManagement.findMetaDataBySoftwareModuleIdAndTargetVisible(new PageRequest(0, 100),
metadataSw1 = softwareModuleManagement.findMetaDataBySoftwareModuleIdAndTargetVisible(PageRequest.of(0, 100),
sw1.getId());
metadataSw2 = softwareModuleManagement.findMetaDataBySoftwareModuleIdAndTargetVisible(new PageRequest(0, 100),
metadataSw2 = softwareModuleManagement.findMetaDataBySoftwareModuleIdAndTargetVisible(PageRequest.of(0, 100),
sw2.getId());
assertThat(metadataSw1.getNumberOfElements()).isEqualTo(metadataCountSw1);

View File

@@ -49,20 +49,18 @@ public class SoftwareModuleTypeManagementTest extends AbstractJpaIntegrationTest
+ " by means of throwing EntityNotFoundException.")
@ExpectEvents({ @Expect(type = SoftwareModuleCreatedEvent.class, count = 0) })
public void entityQueriesReferringToNotExistingEntitiesThrowsException() {
verifyThrownExceptionBy(() -> softwareModuleTypeManagement.delete(NOT_EXIST_IDL),
"SoftwareModuleType");
verifyThrownExceptionBy(() -> softwareModuleTypeManagement.delete(NOT_EXIST_IDL), "SoftwareModuleType");
verifyThrownExceptionBy(
() -> softwareModuleTypeManagement
.update(entityFactory.softwareModuleType().update(1234L)),
() -> softwareModuleTypeManagement.update(entityFactory.softwareModuleType().update(NOT_EXIST_IDL)),
"SoftwareModuleType");
}
@Test
@Description("Calling update without changing fields results in no recorded change in the repository including unchanged audit fields.")
public void updateNothingResultsInUnchangedRepositoryForType() {
final SoftwareModuleType created = softwareModuleTypeManagement.create(
entityFactory.softwareModuleType().create().key("test-key").name("test-name"));
final SoftwareModuleType created = softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("test-key").name("test-name"));
final SoftwareModuleType updated = softwareModuleTypeManagement
.update(entityFactory.softwareModuleType().update(created.getId()));
@@ -75,8 +73,8 @@ public class SoftwareModuleTypeManagementTest extends AbstractJpaIntegrationTest
@Test
@Description("Calling update for changed fields results in change in the repository.")
public void updateSoftareModuleTypeFieldsToNewValue() {
final SoftwareModuleType created = softwareModuleTypeManagement.create(
entityFactory.softwareModuleType().create().key("test-key").name("test-name"));
final SoftwareModuleType created = softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("test-key").name("test-name"));
final SoftwareModuleType updated = softwareModuleTypeManagement.update(
entityFactory.softwareModuleType().update(created.getId()).description("changed").colour("changed"));
@@ -106,39 +104,34 @@ public class SoftwareModuleTypeManagementTest extends AbstractJpaIntegrationTest
@Test
@Description("Tests the successfull deletion of software module types. Both unused (hard delete) and used ones (soft delete).")
public void deleteAssignedAndUnassignedSoftwareModuleTypes() {
assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType,
runtimeType, appType);
assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType, runtimeType, appType);
SoftwareModuleType type = softwareModuleTypeManagement.create(
entityFactory.softwareModuleType().create().key("bundle").name("OSGi Bundle"));
SoftwareModuleType type = softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("bundle").name("OSGi Bundle"));
assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(4).contains(osType,
runtimeType, appType, type);
assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(4).contains(osType, runtimeType, appType, type);
// delete unassigned
softwareModuleTypeManagement.delete(type.getId());
assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType,
runtimeType, appType);
assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType, runtimeType, appType);
assertThat(softwareModuleTypeRepository.findAll()).hasSize(3).contains((JpaSoftwareModuleType) osType,
(JpaSoftwareModuleType) runtimeType, (JpaSoftwareModuleType) appType);
type = softwareModuleTypeManagement.create(
entityFactory.softwareModuleType().create().key("bundle2").name("OSGi Bundle2"));
type = softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("bundle2").name("OSGi Bundle2"));
assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(4).contains(osType,
runtimeType, appType, type);
assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(4).contains(osType, runtimeType, appType, type);
softwareModuleManagement.create(
entityFactory.softwareModule().create().type(type).name("Test SM").version("1.0"));
softwareModuleManagement
.create(entityFactory.softwareModule().create().type(type).name("Test SM").version("1.0"));
// delete assigned
softwareModuleTypeManagement.delete(type.getId());
assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType,
runtimeType, appType);
assertThat(softwareModuleTypeManagement.findAll(PAGE)).hasSize(3).contains(osType, runtimeType, appType);
assertThat(softwareModuleTypeRepository.findAll()).hasSize(4).contains((JpaSoftwareModuleType) osType,
(JpaSoftwareModuleType) runtimeType, (JpaSoftwareModuleType) appType,
softwareModuleTypeRepository.findOne(type.getId()));
softwareModuleTypeRepository.findById(type.getId()).get());
}
@Test
@@ -147,21 +140,19 @@ public class SoftwareModuleTypeManagementTest extends AbstractJpaIntegrationTest
testdataFactory.createSoftwareModuleOs();
final SoftwareModuleType found = softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("thetype").name("thename"));
softwareModuleTypeManagement.create(
entityFactory.softwareModuleType().create().key("thetype2").name("anothername"));
softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("thetype2").name("anothername"));
assertThat(softwareModuleTypeManagement.getByName("thename").get())
.as("Type with given name").isEqualTo(found);
assertThat(softwareModuleTypeManagement.getByName("thename").get()).as("Type with given name").isEqualTo(found);
}
@Test
@Description("Verfies that it is not possible to create a type that alrady exists.")
public void createSoftwareModuleTypeFailsWithExistingEntity() {
softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("thetype").name("thename"));
softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create().key("thetype").name("thename"));
try {
softwareModuleTypeManagement.create(
entityFactory.softwareModuleType().create().key("thetype").name("thename"));
softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("thetype").name("thename"));
fail("should not have worked as module type already exists");
} catch (final EntityAlreadyExistsException e) {
@@ -172,11 +163,10 @@ public class SoftwareModuleTypeManagementTest extends AbstractJpaIntegrationTest
@Test
@Description("Verfies that it is not possible to create a list of types where one already exists.")
public void createSoftwareModuleTypesFailsWithExistingEntity() {
softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("thetype").name("thename"));
softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create().key("thetype").name("thename"));
try {
softwareModuleTypeManagement.create(
Arrays.asList(entityFactory.softwareModuleType().create().key("thetype").name("thename"),
softwareModuleTypeManagement
.create(Arrays.asList(entityFactory.softwareModuleType().create().key("thetype").name("thename"),
entityFactory.softwareModuleType().create().key("anothertype").name("anothername")));
fail("should not have worked as module type already exists");
} catch (final EntityAlreadyExistsException e) {
@@ -188,8 +178,8 @@ public class SoftwareModuleTypeManagementTest extends AbstractJpaIntegrationTest
@Description("Verifies that the creation of a softwareModuleType is failing because of invalid max assignment")
public void createSoftwareModuleTypesFailsWithInvalidMaxAssignment() {
try {
softwareModuleTypeManagement.create(
entityFactory.softwareModuleType().create().key("type").name("name").maxAssignments(0));
softwareModuleTypeManagement
.create(entityFactory.softwareModuleType().create().key("type").name("name").maxAssignments(0));
fail("should not have worked as max assignment is invalid. Should be greater than 0.");
} catch (final ConstraintViolationException e) {
@@ -199,13 +189,12 @@ public class SoftwareModuleTypeManagementTest extends AbstractJpaIntegrationTest
@Test
@Description("Verfies that multiple types are created as requested.")
public void createMultipleSoftwareModuleTypes() {
final List<SoftwareModuleType> created = softwareModuleTypeManagement.create(
Arrays.asList(entityFactory.softwareModuleType().create().key("thetype").name("thename"),
final List<SoftwareModuleType> created = softwareModuleTypeManagement
.create(Arrays.asList(entityFactory.softwareModuleType().create().key("thetype").name("thename"),
entityFactory.softwareModuleType().create().key("thetype2").name("thename2")));
assertThat(created.size()).as("Number of created types").isEqualTo(2);
assertThat(softwareModuleTypeManagement.count()).as("Number of types in repository")
.isEqualTo(5);
assertThat(softwareModuleTypeManagement.count()).as("Number of types in repository").isEqualTo(5);
}
}

View File

@@ -81,7 +81,7 @@ public class TargetFilterQueryManagementTest extends AbstractJpaIntegrationTest
verifyThrownExceptionBy(
() -> targetFilterQueryManagement.updateAutoAssignDS(targetFilterQuery.getId(), NOT_EXIST_IDL),
"DistributionSet");
verifyThrownExceptionBy(() -> targetFilterQueryManagement.updateAutoAssignDS(1234L, set.getId()),
verifyThrownExceptionBy(() -> targetFilterQueryManagement.updateAutoAssignDS(NOT_EXIST_IDL, set.getId()),
"TargetFilterQuery");
verifyThrownExceptionBy(
() -> targetFilterQueryManagement.updateAutoAssignDS(targetFilterQuery.getId(), NOT_EXIST_IDL),
@@ -123,7 +123,7 @@ public class TargetFilterQueryManagementTest extends AbstractJpaIntegrationTest
entityFactory.targetFilterQuery().create().name("someOtherFilter").query("name==PendingTargets002"));
final List<TargetFilterQuery> results = targetFilterQueryManagement
.findByRsql(new PageRequest(0, 10), "name==" + filterName).getContent();
.findByRsql(PageRequest.of(0, 10), "name==" + filterName).getContent();
assertEquals("Search result should have 1 result", 1, results.size());
assertEquals("Retrieved newly created custom target filter", targetFilterQuery, results.get(0));
}
@@ -132,7 +132,7 @@ public class TargetFilterQueryManagementTest extends AbstractJpaIntegrationTest
@Description("Test searching a target filter query with an invalid filter.")
public void searchTargetFilterQueryInvalidField() {
// Should throw an exception
targetFilterQueryManagement.findByRsql(new PageRequest(0, 10), "unknownField==testValue").getContent();
targetFilterQueryManagement.findByRsql(PageRequest.of(0, 10), "unknownField==testValue").getContent();
}
@@ -316,7 +316,7 @@ public class TargetFilterQueryManagementTest extends AbstractJpaIntegrationTest
assertEquals(4L, targetFilterQueryManagement.count());
// check if find works
Page<TargetFilterQuery> tfqList = targetFilterQueryManagement.findByAutoAssignDSAndRsql(new PageRequest(0, 500),
Page<TargetFilterQuery> tfqList = targetFilterQueryManagement.findByAutoAssignDSAndRsql(PageRequest.of(0, 500),
distributionSet.getId(), null);
assertThat(1L).as("Target filter query").isEqualTo(tfqList.getTotalElements());
@@ -325,22 +325,22 @@ public class TargetFilterQueryManagementTest extends AbstractJpaIntegrationTest
targetFilterQueryManagement.updateAutoAssignDS(tfq2.getId(), distributionSet.getId());
// check if find works for two
tfqList = targetFilterQueryManagement.findByAutoAssignDSAndRsql(new PageRequest(0, 500),
distributionSet.getId(), null);
tfqList = targetFilterQueryManagement.findByAutoAssignDSAndRsql(PageRequest.of(0, 500), distributionSet.getId(),
null);
assertThat(2L).as("Target filter query count").isEqualTo(tfqList.getTotalElements());
Iterator<TargetFilterQuery> iterator = tfqList.iterator();
assertEquals("Returns correct target filter query 1", tfq.getId(), iterator.next().getId());
assertEquals("Returns correct target filter query 2", tfq2.getId(), iterator.next().getId());
// check if find works with name filter
tfqList = targetFilterQueryManagement.findByAutoAssignDSAndRsql(new PageRequest(0, 500),
distributionSet.getId(), "name==" + filterName);
tfqList = targetFilterQueryManagement.findByAutoAssignDSAndRsql(PageRequest.of(0, 500), distributionSet.getId(),
"name==" + filterName);
assertThat(1L).as("Target filter query count").isEqualTo(tfqList.getTotalElements());
assertEquals("Returns correct target filter query", tfq2.getId(), tfqList.iterator().next().getId());
// check if find works for all with auto assign DS
tfqList = targetFilterQueryManagement.findWithAutoAssignDS(new PageRequest(0, 500));
tfqList = targetFilterQueryManagement.findWithAutoAssignDS(PageRequest.of(0, 500));
assertThat(2L).as("Target filter query count").isEqualTo(tfqList.getTotalElements());
iterator = tfqList.iterator();
assertEquals("Returns correct target filter query 1", tfq.getId(), iterator.next().getId());

View File

@@ -419,8 +419,10 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
target = createTargetWithAttributes("4711");
assertThat(targetManagement.count()).as("target count is wrong").isEqualTo(1);
assertThat(targetManagement.existsByControllerId("4711")).isTrue();
targetManagement.delete(Collections.singletonList(target.getId()));
assertThat(targetManagement.count()).as("target count is wrong").isEqualTo(0);
assertThat(targetManagement.existsByControllerId("4711")).isFalse();
final List<Long> targets = new ArrayList<>();
for (int i = 0; i < 5; i++) {
@@ -664,7 +666,7 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
targetManagement.delete(targetsIdsToDelete);
final List<Target> targetsLeft = targetManagement.findAll(new PageRequest(0, 200)).getContent();
final List<Target> targetsLeft = targetManagement.findAll(PageRequest.of(0, 200)).getContent();
assertThat(firstList.spliterator().getExactSizeIfKnown() - numberToDelete).as("Size of split list")
.isEqualTo(targetsLeft.spliterator().getExactSizeIfKnown());
@@ -905,12 +907,18 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
@Test
@Description("Verify that the flag for requesting controller attributes is set correctly.")
public void verifyRequestControllerAttributes() {
final String knownTargetId = "KnownControllerId";
createTargetWithAttributes(knownTargetId);
final String knownControllerId = "KnownControllerId";
final Target target = createTargetWithAttributes(knownControllerId);
assertThat(targetManagement.isControllerAttributesRequested(knownTargetId)).isFalse();
targetManagement.requestControllerAttributes(knownTargetId);
assertThat(targetManagement.isControllerAttributesRequested(knownTargetId)).isTrue();
assertThat(targetManagement.findByControllerAttributesRequested(PAGE)).isEmpty();
assertThat(targetManagement.isControllerAttributesRequested(knownControllerId)).isFalse();
targetManagement.requestControllerAttributes(knownControllerId);
final Target updated = targetManagement.getByControllerID(knownControllerId).get();
assertThat(target.isRequestControllerAttributes()).isFalse();
assertThat(targetManagement.findByControllerAttributesRequested(PAGE).getContent()).contains(updated);
assertThat(targetManagement.isControllerAttributesRequested(knownControllerId)).isTrue();
}

View File

@@ -245,7 +245,7 @@ public class TargetTagManagementTest extends AbstractJpaIntegrationTest {
assertThat(targetTagManagement.findByTarget(PAGE, target.getControllerId()).getContent())
.doesNotContain(toDelete);
}
assertThat(targetTagRepository.findOne(toDelete.getId())).as("No tag should be found").isNull();
assertThat(targetTagRepository.findById(toDelete.getId())).as("No tag should be found").isNotPresent();
assertThat(targetTagRepository.findAll()).as("Wrong target tag size").hasSize(19);
}
@@ -262,9 +262,9 @@ public class TargetTagManagementTest extends AbstractJpaIntegrationTest {
// check data
assertThat(targetTagRepository.findAll()).as("Wrong target tag size").hasSize(tags.size());
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getName()).as("wrong target tag is saved")
assertThat(targetTagRepository.findById(savedAssigned.getId()).get().getName()).as("wrong target tag is saved")
.isEqualTo("test123");
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getOptLockRevision())
assertThat(targetTagRepository.findById(savedAssigned.getId()).get().getOptLockRevision())
.as("wrong target tag is saved").isEqualTo(2);
}

View File

@@ -34,7 +34,7 @@ import org.eclipse.hawkbit.repository.model.Target;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.event.EventListener;
@@ -44,7 +44,7 @@ import io.qameta.allure.Story;
@Feature("Component Tests - Repository")
@Story("Entity Events")
@SpringApplicationConfiguration(classes = RepositoryTestConfiguration.class)
@SpringBootTest(classes = { RepositoryTestConfiguration.class })
public class RepositoryEntityEventTest extends AbstractJpaIntegrationTest {
@Autowired

View File

@@ -90,7 +90,7 @@ public class RSQLActionFieldsTest extends AbstractJpaIntegrationTest {
private void assertRSQLQuery(final String rsqlParam, final long expectedEntities) {
final Slice<Action> findEnitity = deploymentManagement.findActionsByTarget(rsqlParam, target.getControllerId(),
new PageRequest(0, 100));
PageRequest.of(0, 100));
final long countAllEntities = deploymentManagement.countActionsByTarget(rsqlParam, target.getControllerId());
assertThat(findEnitity).isNotNull();
assertThat(countAllEntities).isEqualTo(expectedEntities);

Some files were not shown because too many files have changed in this diff Show More