Merge branch 'master' into Stabilise_tests

This commit is contained in:
asharani-murugesh
2016-03-11 15:59:10 +01:00
43 changed files with 735 additions and 458 deletions

View File

@@ -1,74 +1,95 @@
aopalliance:aopalliance:jar:1.0:compile aopalliance:aopalliance:jar:1.0:compile
com.fasterxml.jackson.core:jackson-annotations:jar:2.5.0:compile ch.qos.logback:logback-classic:jar:1.1.3:compile
com.fasterxml.jackson.core:jackson-core:jar:2.5.0:compile ch.qos.logback:logback-core:jar:1.1.3:compile
com.fasterxml.jackson.core:jackson-databind:jar:2.5.0:compile com.fasterxml.jackson.core:jackson-annotations:jar:2.5.5:compile
com.fasterxml:classmate:jar:1.3.0:compile com.fasterxml.jackson.core:jackson-core:jar:2.5.5:compile
com.google.guava:guava:jar:18.0:compile com.fasterxml.jackson.core:jackson-databind:jar:2.5.5:compile
com.h2database:h2:jar:1.4.186:compile com.fasterxml:classmate:jar:1.1.0:compile
com.fasterxml:classmate:jar:1.2.0:compile
com.google.collections:google-collections:jar:1.0-rc2:compile
com.google.guava:guava:jar:19.0:compile
com.h2database:h2:jar:1.4.190:compile
com.jayway.jsonpath:json-path:jar:0.9.1:compile
com.netflix.feign:feign-core:jar:8.12.1:compile
com.netflix.feign:feign-core:jar:8.14.2:compile
com.netflix.feign:feign-jackson:jar:8.14.1:compile
com.netflix.feign:feign-ribbon:jar:8.1.1:compile
com.netflix.feign:feign-slf4j:jar:8.1.1:compile
com.netflix.ribbon:ribbon-core:jar:2.0.0:compile
com.netflix.ribbon:ribbon-httpclient:jar:2.0.0:compile
com.netflix.ribbon:ribbon-loadbalancer:jar:2.0.0:compile
com.netflix.ribbon:ribbon:jar:2.0.0:compile
com.rabbitmq:amqp-client:jar:3.5.5:compile com.rabbitmq:amqp-client:jar:3.5.5:compile
com.vaadin.external.atmosphere:atmosphere-runtime:jar:2.2.7.vaadin1:compile com.vaadin.external.atmosphere:atmosphere-runtime:jar:2.2.7.vaadin1:compile
com.vaadin.external.flute:flute:jar:1.3.0.gg2:compile com.vaadin.external.flute:flute:jar:1.3.0.gg2:compile
com.vaadin.external.google:guava:jar:16.0.1.vaadin1:compile com.vaadin.external.google:guava:jar:16.0.1.vaadin1:compile
com.vaadin.external.slf4j:vaadin-slf4j-jdk14:jar:1.6.1:compile com.vaadin.external.slf4j:vaadin-slf4j-jdk14:jar:1.6.1:compile
com.vaadin.external.streamhtmlparser:streamhtmlparser-jsilver:jar:0.0.10.vaadin1:compile com.vaadin.external.streamhtmlparser:streamhtmlparser-jsilver:jar:0.0.10.vaadin1:compile
com.vaadin:vaadin-push:jar:7.5.7:compile com.vaadin:vaadin-client-compiled:jar:7.6.3:compile
com.vaadin:vaadin-sass-compiler:jar:0.9.12:compile com.vaadin:vaadin-push:jar:7.6.3:compile
com.vaadin:vaadin-server:jar:7.5.7:compile com.vaadin:vaadin-sass-compiler:jar:0.9.13:compile
com.vaadin:vaadin-shared:jar:7.5.7:compile com.vaadin:vaadin-server:jar:7.6.3:compile
com.vaadin:vaadin-shared:jar:7.6.3:compile
com.vaadin:vaadin-spring-boot-starter:jar:1.0.0:compile
com.vaadin:vaadin-spring-boot:jar:1.0.0:compile com.vaadin:vaadin-spring-boot:jar:1.0.0:compile
com.vaadin:vaadin-spring:jar:1.0.0:compile com.vaadin:vaadin-spring:jar:1.0.0:compile
com.vaadin:vaadin-themes:jar:7.5.7:compile com.vaadin:vaadin-themes:jar:7.6.3:compile
com.yahoo.platform.yui:yuicompressor:jar:2.4.8:compile
commons-io:commons-io:jar:2.4:compile commons-io:commons-io:jar:2.4:compile
cz.jirutka.rsql:rsql-parser:jar:2.0.0:compile cz.jirutka.rsql:rsql-parser:jar:2.0.0:compile
io.reactivex:rxjava:jar:1.0.11:compile
io.springfox:springfox-core:jar:2.0.3:compile io.springfox:springfox-core:jar:2.0.3:compile
io.springfox:springfox-schema:jar:2.0.3:compile
io.springfox:springfox-spi:jar:2.0.3:compile
io.springfox:springfox-spring-web:jar:2.0.3:compile
io.springfox:springfox-swagger-common:jar:2.0.3:compile
io.springfox:springfox-swagger2:jar:2.0.3:compile
io.swagger:swagger-annotations:jar:1.5.0:compile
io.swagger:swagger-models:jar:1.5.0:compile
javax.servlet:javax.servlet-api:jar:3.1.0:compile javax.servlet:javax.servlet-api:jar:3.1.0:compile
javax.transaction:javax.transaction-api:jar:1.2:compile javax.transaction:javax.transaction-api:jar:1.2:compile
javax.validation:validation-api:jar:1.1.0.Final:compile javax.validation:validation-api:jar:1.1.0.Final:compile
joda-time:joda-time:jar:2.5:compile joda-time:joda-time:jar:2.5:compile
net._01001111:jlorem:jar:1.1:compile net._01001111:jlorem:jar:1.1:compile
net.minidev:json-smart:jar:1.2:compile
org.apache.commons:commons-lang3:jar:3.4:compile org.apache.commons:commons-lang3:jar:3.4:compile
org.apache.commons:commons-pool2:jar:2.2:compile org.apache.commons:commons-pool2:jar:2.2:compile
org.apache.logging.log4j:log4j-api:jar:2.1:compile org.apache.logging.log4j:log4j-api:jar:2.1:compile
org.apache.logging.log4j:log4j-core:jar:2.1:compile org.apache.logging.log4j:log4j-core:jar:2.1:compile
org.apache.logging.log4j:log4j-slf4j-impl:jar:2.1:compile org.apache.logging.log4j:log4j-slf4j-impl:jar:2.1:compile
org.apache.tomcat:tomcat-jdbc:jar:8.0.28:compile org.apache.tomcat:tomcat-jdbc:jar:8.0.30:compile
org.apache.tomcat:tomcat-juli:jar:8.0.28:compile org.apache.tomcat:tomcat-juli:jar:8.0.30:compile
org.aspectj:aspectjrt:jar:1.8.5:compile org.aspectj:aspectjrt:jar:1.8.5:compile
org.aspectj:aspectjweaver:jar:1.8.5:compile org.aspectj:aspectjweaver:jar:1.8.5:compile
org.eclipse.persistence:javax.persistence:jar:2.1.0:compile org.eclipse.persistence:javax.persistence:jar:2.1.1:compile
org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.6.0:compile org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.6.2:compile
org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.6.0:compile org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.6.2:compile
org.eclipse.persistence:org.eclipse.persistence.core:jar:2.6.0:compile org.eclipse.persistence:org.eclipse.persistence.core:jar:2.6.2:compile
org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:jar:2.6.0:compile org.eclipse.persistence:org.eclipse.persistence.jpa.jpql:jar:2.6.2:compile
org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.6.0:compile org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.6.2:compile
org.flywaydb:flyway-core:jar:3.1:compile org.flywaydb:flyway-core:jar:3.1:compile
org.glassfish:javax.json:jar:1.0.4:compile org.glassfish:javax.json:jar:1.0.4:compile
org.hibernate:hibernate-validator:jar:5.2.2.Final:compile org.hibernate:hibernate-validator:jar:5.2.4.Final:compile
org.jboss.logging:jboss-logging:jar:3.2.1.Final:compile org.jboss.logging:jboss-logging:jar:3.2.1.Final:compile
org.jsoup:jsoup:jar:1.8.1:compile org.json:json:jar:20141113:compile
org.mapstruct:mapstruct:jar:1.0.0.Beta4:compile org.jsoup:jsoup:jar:1.8.3:compile
org.mongodb:mongo-java-driver:jar:3.0.2:compile org.mongodb:mongo-java-driver:jar:3.2.2:compile
org.objenesis:objenesis:jar:2.1:compile org.objenesis:objenesis:jar:2.1:compile
org.slf4j:jcl-over-slf4j:jar:1.7.12:compile org.slf4j:jcl-over-slf4j:jar:1.7.13:compile
org.slf4j:jul-to-slf4j:jar:1.7.12:compile org.slf4j:jul-to-slf4j:jar:1.7.13:compile
org.slf4j:slf4j-api:jar:1.7.7:compile org.slf4j:log4j-over-slf4j:jar:1.7.13:compile
org.slf4j:slf4j-api:jar:1.7.13:compile
org.springframework.amqp:spring-amqp:jar:1.4.6.RELEASE:compile org.springframework.amqp:spring-amqp:jar:1.4.6.RELEASE:compile
org.springframework.amqp:spring-rabbit:jar:1.4.6.RELEASE:compile org.springframework.amqp:spring-rabbit:jar:1.4.6.RELEASE:compile
org.springframework.boot:spring-boot-autoconfigure:jar:1.2.7.RELEASE:compile org.springframework.boot:spring-boot-autoconfigure:jar:1.2.8.RELEASE:compile
org.springframework.boot:spring-boot-starter-aop:jar:1.2.7.RELEASE:compile org.springframework.boot:spring-boot-configuration-processor:jar:1.2.8.RELEASE:compile
org.springframework.boot:spring-boot-starter-data-jpa:jar:1.2.7.RELEASE:compile org.springframework.boot:spring-boot-starter-aop:jar:1.2.8.RELEASE:compile
org.springframework.boot:spring-boot-starter-jdbc:jar:1.2.7.RELEASE:compile org.springframework.boot:spring-boot-starter-data-jpa:jar:1.2.8.RELEASE:compile
org.springframework.boot:spring-boot-starter-log4j2:jar:1.2.7.RELEASE:compile org.springframework.boot:spring-boot-starter-jdbc:jar:1.2.8.RELEASE:compile
org.springframework.boot:spring-boot-starter-web:jar:1.2.7.RELEASE:compile org.springframework.boot:spring-boot-starter-log4j2:jar:1.2.8.RELEASE:compile
org.springframework.boot:spring-boot-starter:jar:1.2.7.RELEASE:compile org.springframework.boot:spring-boot-starter-logging:jar:1.2.8.RELEASE:compile
org.springframework.boot:spring-boot:jar:1.2.7.RELEASE:compile org.springframework.boot:spring-boot-starter-web:jar:1.2.8.RELEASE:compile
org.springframework.boot:spring-boot-starter:jar:1.2.8.RELEASE:compile
org.springframework.boot:spring-boot:jar:1.2.8.RELEASE:compile
org.springframework.cloud:spring-cloud-commons:jar:1.0.5.RELEASE:compile
org.springframework.cloud:spring-cloud-context:jar:1.0.5.RELEASE:compile
org.springframework.cloud:spring-cloud-netflix-core:jar:1.0.7.RELEASE:compile
org.springframework.cloud:spring-cloud-starter-feign:jar:1.0.6.RELEASE:compile
org.springframework.cloud:spring-cloud-starter-ribbon:jar:1.0.6.RELEASE:compile
org.springframework.cloud:spring-cloud-starter:jar:1.0.5.RELEASE:compile
org.springframework.data:spring-data-commons:jar:1.10.1.RELEASE:compile org.springframework.data:spring-data-commons:jar:1.10.1.RELEASE:compile
org.springframework.data:spring-data-jpa:jar:1.8.1.RELEASE:compile org.springframework.data:spring-data-jpa:jar:1.8.1.RELEASE:compile
org.springframework.data:spring-data-mongodb:jar:1.7.1.RELEASE:compile org.springframework.data:spring-data-mongodb:jar:1.7.1.RELEASE:compile
@@ -77,29 +98,33 @@
org.springframework.plugin:spring-plugin-core:jar:1.1.0.RELEASE:compile org.springframework.plugin:spring-plugin-core:jar:1.1.0.RELEASE:compile
org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile org.springframework.plugin:spring-plugin-metadata:jar:1.2.0.RELEASE:compile
org.springframework.retry:spring-retry:jar:1.1.2.RELEASE:compile org.springframework.retry:spring-retry:jar:1.1.2.RELEASE:compile
org.springframework.security:spring-security-aspects:jar:3.2.8.RELEASE:compile org.springframework.security:spring-security-aspects:jar:3.2.9.RELEASE:compile
org.springframework.security:spring-security-config:jar:3.2.8.RELEASE:compile org.springframework.security:spring-security-config:jar:3.2.9.RELEASE:compile
org.springframework.security:spring-security-core:jar:3.2.8.RELEASE:compile org.springframework.security:spring-security-core:jar:3.2.9.RELEASE:compile
org.springframework.security:spring-security-web:jar:3.2.8.RELEASE:compile org.springframework.security:spring-security-crypto:jar:3.2.9.RELEASE:compile
org.springframework:spring-aop:jar:4.1.8.RELEASE:compile org.springframework.security:spring-security-web:jar:3.2.9.RELEASE:compile
org.springframework:spring-aspects:jar:4.1.8.RELEASE:compile org.springframework:spring-aop:jar:4.1.9.RELEASE:compile
org.springframework:spring-beans:jar:4.1.8.RELEASE:compile org.springframework:spring-aspects:jar:4.1.9.RELEASE:compile
org.springframework:spring-context-support:jar:4.1.8.RELEASE:compile org.springframework:spring-beans:jar:4.1.9.RELEASE:compile
org.springframework:spring-context:jar:4.1.8.RELEASE:compile org.springframework:spring-context-support:jar:4.1.9.RELEASE:compile
org.springframework:spring-core:jar:4.1.8.RELEASE:compile org.springframework:spring-context:jar:4.1.9.RELEASE:compile
org.springframework:spring-expression:jar:4.1.8.RELEASE:compile org.springframework:spring-core:jar:4.1.9.RELEASE:compile
org.springframework:spring-jdbc:jar:4.1.8.RELEASE:compile org.springframework:spring-expression:jar:4.1.9.RELEASE:compile
org.springframework:spring-messaging:jar:4.1.8.RELEASE:compile org.springframework:spring-jdbc:jar:4.1.9.RELEASE:compile
org.springframework:spring-orm:jar:4.1.8.RELEASE:compile org.springframework:spring-messaging:jar:4.1.9.RELEASE:compile
org.springframework:spring-tx:jar:4.1.8.RELEASE:compile org.springframework:spring-orm:jar:4.1.9.RELEASE:compile
org.springframework:spring-web:jar:4.1.8.RELEASE:compile org.springframework:spring-tx:jar:4.1.9.RELEASE:compile
org.springframework:spring-webmvc:jar:4.1.8.RELEASE:compile org.springframework:spring-web:jar:4.1.9.RELEASE:compile
org.springframework:spring-webmvc:jar:4.1.9.RELEASE:compile
org.vaadin.addons.lazyquerycontainer:vaadin-lazyquerycontainer:jar:7.4.0.1:compile org.vaadin.addons.lazyquerycontainer:vaadin-lazyquerycontainer:jar:7.4.0.1:compile
org.vaadin.addons:contextmenu:jar:4.5:compile
org.vaadin.addons:flexibleoptiongroup:jar:2.2.0:compile org.vaadin.addons:flexibleoptiongroup:jar:2.2.0:compile
org.vaadin.addons:tokenfield:jar:7.0.1:compile org.vaadin.addons:tokenfield:jar:7.0.1:compile
org.vaadin.alump.distributionbar:dbar-addon:jar:1.2.0:compile
org.vaadin.spring.addons:vaadin-spring-addon-eventbus:jar:0.0.6.RELEASE: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-core:jar:0.0.6.RELEASE:compile
org.vaadin.spring.extensions:vaadin-spring-ext-security: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 org.w3c.css:sac:jar:1.3:compile
org.yaml:snakeyaml:jar:1.14:compile org.yaml:snakeyaml:jar:1.14:compile
redis.clients:jedis:jar:2.5.2:compile redis.clients:jedis:jar:2.5.2:compile
rhino:js:jar:1.7R2:compile

View File

@@ -6,3 +6,6 @@ find . -name dependencies.txt|while read i; do cat $i;done|grep '.*:.*:test'|sor
find . -name dependencies.txt|while read i; do cat $i;done|grep '.*:.*:provided'|sort|uniq > 3rd-dependencies/provided.txt find . -name dependencies.txt|while read i; do cat $i;done|grep '.*:.*:provided'|sort|uniq > 3rd-dependencies/provided.txt
find . -name dependencies.txt|while read i; do rm $i;done find . -name dependencies.txt|while read i; do rm $i;done
cd 3rd-dependencies/ cd 3rd-dependencies/
cat compile.txt provided.txt|cut -d':' -f1-4|while read i; do grep -h $i test.txt;done|sort|uniq|while read x; do sed -i.bak -e s/$x// test.txt ;done
sed -i.bak '/^[[:space:]]*$/d' test.txt
rm *.bak

View File

@@ -1,6 +1,6 @@
javax.servlet:javax.servlet-api:jar:3.1.0:provided javax.servlet:javax.servlet-api:jar:3.1.0:provided
org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.28:provided org.apache.tomcat.embed:tomcat-embed-core:jar:8.0.30:provided
org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.28:provided org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.30:provided
org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.28:provided org.apache.tomcat.embed:tomcat-embed-logging-juli:jar:8.0.30:provided
org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.28:provided org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.0.30:provided
org.springframework.boot:spring-boot-starter-tomcat:jar:1.2.7.RELEASE:provided org.springframework.boot:spring-boot-starter-tomcat:jar:1.2.8.RELEASE:provided

View File

@@ -1,55 +1,36 @@
com.fasterxml.jackson.core:jackson-core:jar:2.5.0:test
com.fasterxml.jackson.core:jackson-databind:jar:2.5.0:test
com.github.fge:btf:jar:1.2:test com.github.fge:btf:jar:1.2:test
com.github.fge:jackson-coreutils:jar:1.6:test com.github.fge:jackson-coreutils:jar:1.6:test
com.github.fge:json-patch:jar:1.7:test com.github.fge:json-patch:jar:1.7:test
com.github.fge:msg-simple:jar:1.1:test com.github.fge:msg-simple:jar:1.1:test
com.google.code.findbugs:jsr305:jar:2.0.1:test com.google.code.findbugs:jsr305:jar:2.0.1:test
com.h2database:h2:jar:1.4.186:test com.sun.jersey:jersey-client:jar:1.18.1:test
com.jayway.jsonpath:json-path:jar:0.9.1:test com.sun.jersey:jersey-core:jar:1.13:test
commons-beanutils:commons-beanutils-core:jar:1.8.3:test commons-beanutils:commons-beanutils-core:jar:1.8.3:test
commons-io:commons-io:jar:2.4:test
commons-logging:commons-logging:jar:1.1.1:test commons-logging:commons-logging:jar:1.1.1:test
de.flapdoodle.embed:de.flapdoodle.embed.mongo:jar:1.50.0:test de.flapdoodle.embed:de.flapdoodle.embed.mongo:jar:1.50.2:test
de.flapdoodle.embed:de.flapdoodle.embed.process:jar:1.50.0:test de.flapdoodle.embed:de.flapdoodle.embed.process:jar:1.50.1:test
io.swagger:swagger-annotations:jar:1.5.0:test
javax.el:javax.el-api:jar:2.2.4:test javax.el:javax.el-api:jar:2.2.4:test
junit:junit:jar:4.12:test junit:junit:jar:4.12:test
net.java.dev.jna:jna-platform:jar:4.0.0:test net.java.dev.jna:jna-platform:jar:4.0.0:test
net.java.dev.jna:jna:jar:3.3.0:test
net.java.dev.jna:jna:jar:4.0.0:test net.java.dev.jna:jna:jar:4.0.0:test
net.java.dev.jna:jna:jar:platform:3.3.0:test
net.minidev:json-smart:jar:1.2:test
org.apache.commons:commons-compress:jar:1.3:test org.apache.commons:commons-compress:jar:1.3:test
org.apache.commons:commons-lang3:jar:3.1:test
org.apache.tika:tika-core:jar:1.7:test org.apache.tika:tika-core:jar:1.7:test
org.aspectj:aspectjrt:jar:1.8.5:test
org.atteo:evo-inflector:jar:1.2.1:test org.atteo:evo-inflector:jar:1.2.1:test
org.easytesting:fest-assert-core:jar:2.0M10:test org.easytesting:fest-assert-core:jar:2.0M10:test
org.easytesting:fest-assert:jar:1.4:test org.easytesting:fest-assert:jar:1.4:test
org.easytesting:fest-util:jar:1.2.5:test org.easytesting:fest-util:jar:1.2.5:test
org.hamcrest:hamcrest-core:jar:1.3:test org.hamcrest:hamcrest-core:jar:1.3:test
org.hamcrest:hamcrest-library:jar:1.3:test org.hamcrest:hamcrest-library:jar:1.3:test
org.json:json:jar:20141113:test
org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.9.3:test org.jvnet.jaxb2_commons:jaxb2-basics-runtime:jar:0.9.3:test
org.mariadb.jdbc:mariadb-java-client:jar:1.2.3:test org.mariadb.jdbc:mariadb-java-client:jar:1.3.5:test
org.mockito:mockito-core:jar:1.10.19:test org.mockito:mockito-core:jar:1.10.19:test
org.objenesis:objenesis:jar:2.1:test org.springframework.boot:spring-boot-starter-test:jar:1.2.8.RELEASE:test
org.springframework.boot:spring-boot-starter-test:jar:1.2.7.RELEASE:test
org.springframework.data:spring-data-rest-core:jar:2.3.1.RELEASE:test org.springframework.data:spring-data-rest-core:jar:2.3.1.RELEASE:test
org.springframework.data:spring-data-rest-webmvc:jar:2.3.1.RELEASE:test org.springframework.data:spring-data-rest-webmvc:jar:2.3.1.RELEASE:test
org.springframework.hateoas:spring-hateoas:jar:0.16.0.RELEASE:test org.springframework:spring-test:jar:4.1.9.RELEASE:test
org.springframework.plugin:spring-plugin-core:jar:1.1.0.RELEASE:test ru.yandex.qatools.allure:allure-java-adaptor-api:jar:1.4.22:test
org.springframework.security:spring-security-aspects:jar:3.2.8.RELEASE:test ru.yandex.qatools.allure:allure-java-annotations:jar:1.4.22:test
org.springframework.security:spring-security-config:jar:3.2.8.RELEASE:test ru.yandex.qatools.allure:allure-java-aspects:jar:1.4.22:test
org.springframework.security:spring-security-web:jar:3.2.8.RELEASE:test ru.yandex.qatools.allure:allure-junit-adaptor:jar:1.4.22:test
org.springframework:spring-context-support:jar:4.1.8.RELEASE:test ru.yandex.qatools.allure:allure-model:jar:1.4.22:test
org.springframework:spring-test:jar:4.1.8.RELEASE:test
org.springframework:spring-web:jar:4.1.8.RELEASE:test
org.springframework:spring-webmvc:jar:4.1.8.RELEASE:test
ru.yandex.qatools.allure:allure-java-adaptor-api:jar:1.4.15:test
ru.yandex.qatools.allure:allure-java-annotations:jar:1.4.15:test
ru.yandex.qatools.allure:allure-java-aspects:jar:1.4.15:test
ru.yandex.qatools.allure:allure-junit-adaptor:jar:1.4.15:test
ru.yandex.qatools.allure:allure-model:jar:1.4.15:test
ru.yandex.qatools.properties:properties-loader:jar:1.5:test ru.yandex.qatools.properties:properties-loader:jar:1.5:test

View File

@@ -62,8 +62,9 @@ public class DeviceSimulatorUpdater {
device.setProgress(0.0); device.setProgress(0.0);
device.setSwversion(swVersion); device.setSwversion(swVersion);
eventbus.post(new InitUpdate(device)); eventbus.post(new InitUpdate(device));
threadPool.schedule(new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback), threadPool.schedule(new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback),
2000, TimeUnit.MILLISECONDS); 2_000, TimeUnit.MILLISECONDS);
} }
private static final class DeviceSimulatorUpdateThread implements Runnable { private static final class DeviceSimulatorUpdateThread implements Runnable {
@@ -91,7 +92,7 @@ public class DeviceSimulatorUpdater {
if (newProgress < 1.0) { if (newProgress < 1.0) {
threadPool.schedule( threadPool.schedule(
new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback), new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback),
rndSleep.nextInt(3000), TimeUnit.MILLISECONDS); rndSleep.nextInt(5_000), TimeUnit.MILLISECONDS);
} else { } else {
callback.updateFinished(device, actionId); callback.updateFinished(device, actionId);
} }

View File

@@ -13,11 +13,8 @@ import java.util.Map;
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic; import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey; import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey;
import org.eclipse.hawkbit.dmf.amqp.api.MessageType; import org.eclipse.hawkbit.dmf.amqp.api.MessageType;
import org.eclipse.hawkbit.dmf.json.model.ActionStatus;
import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest; import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest;
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice;
import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater; import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater;
import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater.UpdaterCallback;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
@@ -139,31 +136,22 @@ public class SpReceiverService extends ReceiverService {
DownloadAndUpdateRequest.class); DownloadAndUpdateRequest.class);
final Long actionId = downloadAndUpdateRequest.getActionId(); final Long actionId = downloadAndUpdateRequest.getActionId();
try { deviceUpdater.startUpdate(tenant, thingId, actionId,
Thread.sleep(1_000); downloadAndUpdateRequest.getSoftwareModules().get(0).getModuleVersion(), (device, actionId1) -> {
} catch (final InterruptedException e) {
LOGGER.error("Sleep interrupted", e);
}
spSenderService.sendActionStatusMessage(tenant, ActionStatus.RUNNING,
"device Simulator retrieved update request. proceeding with simulation.", actionId);
deviceUpdater.startUpdate(tenant, thingId, actionId, downloadAndUpdateRequest.getSoftwareModules().get(0)
.getModuleVersion(), new UpdaterCallback() {
@Override
public void updateFinished(final AbstractSimulatedDevice device, final Long actionId) {
switch (device.getResponseStatus()) { switch (device.getResponseStatus()) {
case SUCCESSFUL: case SUCCESSFUL:
spSenderService.finishUpdateProcess(new SimulatedUpdate(device.getTenant(), device.getId(), spSenderService.finishUpdateProcess(
actionId), "Simulation complete!"); new SimulatedUpdate(device.getTenant(), device.getId(), actionId1),
"Simulation complete!");
break; break;
case ERROR: case ERROR:
spSenderService.finishUpdateProcessWithError(new SimulatedUpdate(device.getTenant(), spSenderService.finishUpdateProcessWithError(
device.getId(), actionId), "Simulation complete with error!"); new SimulatedUpdate(device.getTenant(), device.getId(), actionId1),
"Simulation complete with error!");
break; break;
default: default:
break; break;
} }
}
}); });
} }
} }

View File

@@ -9,14 +9,12 @@
package org.eclipse.hawkbit.mgmt.client; package org.eclipse.hawkbit.mgmt.client;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/** /**
* Configuration bean which holds the configuration of the client e.g. the base * Configuration bean which holds the configuration of the client e.g. the base
* URL of the hawkbit-server and the credentials to use the RESTful Management * URL of the hawkbit-server and the credentials to use the RESTful Management
* API. * API.
*/ */
@Component
@ConfigurationProperties(prefix = "hawkbit") @ConfigurationProperties(prefix = "hawkbit")
public class ClientConfigurationProperties { public class ClientConfigurationProperties {

View File

@@ -1,6 +1,3 @@
<!-- Copyright (c) 2015 Bosch Software Innovations GmbH and others. All rights reserved. This program and the accompanying
materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and
is available at http://www.eclipse.org/legal/epl-v10.html -->
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--

View File

@@ -20,7 +20,7 @@ import java.util.Map;
*/ */
public interface FieldNameProvider { public interface FieldNameProvider {
/** /**
* Seperator for the sub attributes * Separator for the sub attributes
*/ */
public static final String SUB_ATTRIBUTE_SEPERATOR = "."; public static final String SUB_ATTRIBUTE_SEPERATOR = ".";

View File

@@ -36,7 +36,7 @@ public enum SoftwareModuleTypeFields implements FieldNameProvider {
/** /**
* The max ds assignments field. * The max ds assignments field.
*/ */
MAX("maxAssignments"); MAXASSIGNMENTS("maxAssignments");
private final String fieldName; private final String fieldName;

View File

@@ -58,8 +58,8 @@ public class BaseAmqpService {
* @return the converted object * @return the converted object
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected <T> T convertMessage(final Message message, final Class<T> clazz) { public <T> T convertMessage(final Message message, final Class<T> clazz) {
if (message == null) { if (message == null || message.getBody() == null) {
return null; return null;
} }
message.getMessageProperties().getHeaders().put(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME, message.getMessageProperties().getHeaders().put(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME,
@@ -78,8 +78,8 @@ public class BaseAmqpService {
* @return the list of converted objects * @return the list of converted objects
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected <T> List<T> convertMessageList(final Message message, final Class<T> clazz) { public <T> List<T> convertMessageList(final Message message, final Class<T> clazz) {
if (message == null) { if (message == null || message.getBody() == null) {
return Collections.emptyList(); return Collections.emptyList();
} }
message.getMessageProperties().getHeaders().put(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME, message.getMessageProperties().getHeaders().put(AbstractJavaTypeMapper.DEFAULT_CLASSID_FIELD_NAME,
@@ -99,6 +99,7 @@ public class BaseAmqpService {
final Object value = header.get(key); final Object value = header.get(key);
if (value == null) { if (value == null) {
logAndThrowMessageError(message, errorMessageIfNull); logAndThrowMessageError(message, errorMessageIfNull);
return null;
} }
return value.toString(); return value.toString();
} }

View File

@@ -116,6 +116,7 @@ public class AmqpMessageHandlerServiceTest {
} }
@Test
@Description("Tests not allowed content-type in message") @Description("Tests not allowed content-type in message")
public void testWrongContentType() { public void testWrongContentType() {
final MessageProperties messageProperties = new MessageProperties(); final MessageProperties messageProperties = new MessageProperties();

View File

@@ -0,0 +1,103 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.amqp;
import static org.fest.assertions.api.Assertions.assertThat;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.hawkbit.dmf.json.model.ActionUpdateStatus;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Stories;
@RunWith(MockitoJUnitRunner.class)
@Features("Component Tests - Device Management Federation API")
@Stories("Base Amqp Service Test")
public class BaseAmqpServiceTest {
@Mock
private RabbitTemplate rabbitTemplate;
private BaseAmqpService baseAmqpService;
@Before
public void setup() {
when(rabbitTemplate.getMessageConverter()).thenReturn(new Jackson2JsonMessageConverter());
baseAmqpService = new BaseAmqpService(rabbitTemplate);
}
@Test
@Description("Verify that the message conversion works")
public void convertMessageTest() {
final ActionUpdateStatus actionUpdateStatus = new ActionUpdateStatus();
actionUpdateStatus.setActionId(1L);
actionUpdateStatus.setSoftwareModuleId(2L);
final Message message = rabbitTemplate.getMessageConverter().toMessage(actionUpdateStatus,
new MessageProperties());
ActionUpdateStatus convertedActionUpdateStatus = baseAmqpService.convertMessage(message,
ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted Action Status is wrong")
.isEqualsToByComparingFields(actionUpdateStatus);
convertedActionUpdateStatus = baseAmqpService.convertMessage(null, ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted Object should be null when message is null").isNull();
convertedActionUpdateStatus = baseAmqpService.convertMessage(new Message(null, new MessageProperties()),
ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted Object should be null when message body is null")
.isNull();
}
@Test
@Description("Verify that a conversion of a list from a message works")
public void convertMessageListTest() {
final List<ActionUpdateStatus> actionUpdateStatusList = new ArrayList<>();
for (int i = 0; i < 5; i++) {
final ActionUpdateStatus actionUpdateStatus = new ActionUpdateStatus();
actionUpdateStatus.setActionId(Long.valueOf(i));
actionUpdateStatus.setSoftwareModuleId(Long.valueOf(i));
actionUpdateStatusList.add(actionUpdateStatus);
}
final Message message = rabbitTemplate.getMessageConverter().toMessage(actionUpdateStatusList,
new MessageProperties());
List<ActionUpdateStatus> convertedActionUpdateStatus = baseAmqpService.convertMessageList(message,
ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted Action Status list is wrong")
.hasSameClassAs(actionUpdateStatusList);
assertThat(convertedActionUpdateStatus).as("Converted Action Status list is wrong")
.hasSameSizeAs(actionUpdateStatusList);
convertedActionUpdateStatus = baseAmqpService.convertMessageList(null, ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted list should be empty when message is null").isEmpty();
convertedActionUpdateStatus = baseAmqpService.convertMessageList(new Message(null, new MessageProperties()),
ActionUpdateStatus.class);
assertThat(convertedActionUpdateStatus).as("Converted list should be empty when message body is null")
.isEmpty();
}
}

View File

@@ -572,7 +572,7 @@ public class DeploymentManagement {
@Modifying @Modifying
@Transactional @Transactional
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET) @PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
public Action forceQuitAction(@NotNull final Action action, @NotNull final Target target) { public Action forceQuitAction(@NotNull final Action action) {
final Action mergedAction = entityManager.merge(action); final Action mergedAction = entityManager.merge(action);
if (!mergedAction.isCancelingOrCanceled()) { if (!mergedAction.isCancelingOrCanceled()) {

View File

@@ -81,7 +81,7 @@ public class Target extends NamedEntity implements Persistable<Long> {
private String controllerId; private String controllerId;
@Transient @Transient
private boolean isNew = false; private boolean entityNew = false;
@ManyToMany(targetEntity = TargetTag.class) @ManyToMany(targetEntity = TargetTag.class)
@JoinTable(name = "sp_target_target_tag", joinColumns = { @JoinTable(name = "sp_target_target_tag", joinColumns = {
@@ -217,15 +217,15 @@ public class Target extends NamedEntity implements Persistable<Long> {
@Override @Override
@Transient @Transient
public boolean isNew() { public boolean isNew() {
return isNew; return entityNew;
} }
/** /**
* @param isNew * @param isNew
* the isNew to set * the isNew to set
*/ */
public void setNew(final boolean isNew) { public void setNew(final boolean entityNew) {
this.isNew = isNew; this.entityNew = entityNew;
} }
/** /**

View File

@@ -73,7 +73,7 @@ public class TargetInfo implements Persistable<Long>, Serializable {
private Long targetId; private Long targetId;
@Transient @Transient
private boolean isNew = false; private boolean entityNew = false;
@CascadeOnDelete @CascadeOnDelete
@OneToOne(cascade = { CascadeType.MERGE, CascadeType.REMOVE }, fetch = FetchType.LAZY, targetEntity = Target.class) @OneToOne(cascade = { CascadeType.MERGE, CascadeType.REMOVE }, fetch = FetchType.LAZY, targetEntity = Target.class)
@@ -154,15 +154,15 @@ public class TargetInfo implements Persistable<Long>, Serializable {
@Override @Override
@Transient @Transient
public boolean isNew() { public boolean isNew() {
return isNew; return entityNew;
} }
/** /**
* @param isNew * @param isNew
* the isNew to set * the isNew to set
*/ */
public void setNew(final boolean isNew) { public void setNew(final boolean entityNew) {
this.isNew = isNew; this.entityNew = entityNew;
} }
/** /**

View File

@@ -11,7 +11,6 @@ package org.eclipse.hawkbit;
import static org.fest.assertions.api.Assertions.assertThat; import static org.fest.assertions.api.Assertions.assertThat;
import java.util.List; import java.util.List;
import java.util.Properties;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
@@ -31,6 +30,7 @@ import org.eclipse.hawkbit.repository.LocalArtifactRepository;
import org.eclipse.hawkbit.repository.RolloutGroupManagement; import org.eclipse.hawkbit.repository.RolloutGroupManagement;
import org.eclipse.hawkbit.repository.RolloutGroupRepository; import org.eclipse.hawkbit.repository.RolloutGroupRepository;
import org.eclipse.hawkbit.repository.RolloutManagement; import org.eclipse.hawkbit.repository.RolloutManagement;
import org.eclipse.hawkbit.repository.RolloutRepository;
import org.eclipse.hawkbit.repository.SoftwareManagement; import org.eclipse.hawkbit.repository.SoftwareManagement;
import org.eclipse.hawkbit.repository.SoftwareModuleMetadataRepository; import org.eclipse.hawkbit.repository.SoftwareModuleMetadataRepository;
import org.eclipse.hawkbit.repository.SoftwareModuleRepository; import org.eclipse.hawkbit.repository.SoftwareModuleRepository;
@@ -190,6 +190,9 @@ public abstract class AbstractIntegrationTest implements EnvironmentAware {
@Autowired @Autowired
protected RolloutGroupRepository rolloutGroupRepository; protected RolloutGroupRepository rolloutGroupRepository;
@Autowired
protected RolloutRepository rolloutRepository;
protected MockMvc mvc; protected MockMvc mvc;
@Autowired @Autowired
@@ -208,23 +211,6 @@ public abstract class AbstractIntegrationTest implements EnvironmentAware {
private static CIMySqlTestDatabase tesdatabase; private static CIMySqlTestDatabase tesdatabase;
static {
final Properties props = System.getProperties();
// if( props.getProperty( SuiteEmbeddedConfiguration.IM_HOME ) == null )
// {
// props.setProperty( SuiteEmbeddedConfiguration.IM_HOME,
// "./src/test/resources/im" );
// }
}
/*
* (non-Javadoc)
*
* @see org.springframework.context.EnvironmentAware#setEnvironment(org.
* springframework.core.env. Environment)
*/
@Override @Override
public void setEnvironment(final Environment environment) { public void setEnvironment(final Environment environment) {
this.environment = environment; this.environment = environment;
@@ -287,6 +273,8 @@ public abstract class AbstractIntegrationTest implements EnvironmentAware {
assertThat(softwareModuleTypeRepository.findAll()).isEmpty(); assertThat(softwareModuleTypeRepository.findAll()).isEmpty();
assertThat(distributionSetTypeRepository.findAll()).isEmpty(); assertThat(distributionSetTypeRepository.findAll()).isEmpty();
assertThat(tenantMetaDataRepository.findAll()).isEmpty(); assertThat(tenantMetaDataRepository.findAll()).isEmpty();
assertThat(rolloutGroupRepository.findAll()).isEmpty();
assertThat(rolloutRepository.findAll()).isEmpty();
} }
@Transactional @Transactional

View File

@@ -10,7 +10,6 @@ package org.eclipse.hawkbit.repository;
import static org.fest.assertions.api.Assertions.assertThat; import static org.fest.assertions.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.util.ArrayList; import java.util.ArrayList;
@@ -50,7 +49,6 @@ import com.google.common.eventbus.Subscribe;
import ru.yandex.qatools.allure.annotations.Description; import ru.yandex.qatools.allure.annotations.Description;
import ru.yandex.qatools.allure.annotations.Features; import ru.yandex.qatools.allure.annotations.Features;
import ru.yandex.qatools.allure.annotations.Issue;
import ru.yandex.qatools.allure.annotations.Stories; import ru.yandex.qatools.allure.annotations.Stories;
/** /**
@@ -313,7 +311,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
deploymentManagement.cancelAction(assigningAction, target); deploymentManagement.cancelAction(assigningAction, target);
assigningAction = deploymentManagement.findActionWithDetails(assigningAction.getId()); assigningAction = deploymentManagement.findActionWithDetails(assigningAction.getId());
deploymentManagement.forceQuitAction(assigningAction, target); deploymentManagement.forceQuitAction(assigningAction);
assigningAction = deploymentManagement.findActionWithDetails(assigningAction.getId()); assigningAction = deploymentManagement.findActionWithDetails(assigningAction.getId());
@@ -351,8 +349,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
// force quit assignment // force quit assignment
try { try {
deploymentManagement.forceQuitAction(assigningAction, deploymentManagement.forceQuitAction(assigningAction);
targetManagement.findTargetByControllerID(target.getControllerId()));
fail("expected ForceQuitActionNotAllowedException"); fail("expected ForceQuitActionNotAllowedException");
} catch (final ForceQuitActionNotAllowedException ex) { } catch (final ForceQuitActionNotAllowedException ex) {
} }
@@ -765,13 +762,16 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
distributionSetManagement.findDistributionSetByIdWithDetails(dsA.getId()).getOptLockRevision()); distributionSetManagement.findDistributionSetByIdWithDetails(dsA.getId()).getOptLockRevision());
// verifying that the assignment is correct // verifying that the assignment is correct
assertEquals("Active target actions are wrong", 1, deploymentManagement.findActiveActionsByTarget(targ).size()); assertThat(deploymentManagement.findActiveActionsByTarget(targ).size()).as("Active target actions are wrong")
assertEquals("Target actions are wrong", 1, deploymentManagement.findActionsByTarget(targ).size()); .isEqualTo(1);
assertEquals("Target status is wrong", TargetUpdateStatus.PENDING, targ.getTargetInfo().getUpdateStatus()); assertThat(deploymentManagement.findActionsByTarget(targ).size()).as("Target actions are wrong").isEqualTo(1);
assertEquals("Assigned ds is wrong", dsA, targ.getAssignedDistributionSet()); assertThat(targ.getTargetInfo().getUpdateStatus()).as("UpdateStatus of target is wrong")
assertEquals("Active ds is wrong", dsA, .isEqualTo(TargetUpdateStatus.PENDING);
deploymentManagement.findActiveActionsByTarget(targ).get(0).getDistributionSet()); assertThat(targ.getAssignedDistributionSet()).as("Assigned distribution set of target is wrong").isEqualTo(dsA);
assertNull("Installed ds should be null", targ.getTargetInfo().getInstalledDistributionSet()); assertThat(deploymentManagement.findActiveActionsByTarget(targ).get(0).getDistributionSet())
.as("Distribution set of actionn is wrong").isEqualTo(dsA);
assertThat(deploymentManagement.findActiveActionsByTarget(targ).get(0).getDistributionSet())
.as("Installed distribution set of action should be null").isNotNull();
final Page<Action> updAct = actionRepository.findByDistributionSet(pageReq, dsA); final Page<Action> updAct = actionRepository.findByDistributionSet(pageReq, dsA);
final Action action = updAct.getContent().get(0); final Action action = updAct.getContent().get(0);
@@ -781,12 +781,13 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
targ = targetManagement.findTargetByControllerID(targ.getControllerId()); targ = targetManagement.findTargetByControllerID(targ.getControllerId());
assertEquals(0, deploymentManagement.findActiveActionsByTarget(targ).size()); assertEquals("active target actions are wrong", 0, deploymentManagement.findActiveActionsByTarget(targ).size());
assertEquals(1, deploymentManagement.findInActiveActionsByTarget(targ).size()); assertEquals("active actions are wrong", 1, deploymentManagement.findInActiveActionsByTarget(targ).size());
assertEquals(TargetUpdateStatus.IN_SYNC, targ.getTargetInfo().getUpdateStatus()); assertEquals("tagret update status is not correct", TargetUpdateStatus.IN_SYNC,
assertEquals(dsA, targ.getAssignedDistributionSet()); targ.getTargetInfo().getUpdateStatus());
assertEquals(dsA, targ.getTargetInfo().getInstalledDistributionSet()); assertEquals("wrong assigned ds", dsA, targ.getAssignedDistributionSet());
assertEquals("wrong installed ds", dsA, targ.getTargetInfo().getInstalledDistributionSet());
targs = deploymentManagement.assignDistributionSet(dsB.getId(), new String[] { "target-id-A" }) targs = deploymentManagement.assignDistributionSet(dsB.getId(), new String[] { "target-id-A" })
.getAssignedTargets(); .getAssignedTargets();
@@ -796,7 +797,7 @@ public class DeploymentManagementTest extends AbstractIntegrationTest {
assertEquals("active actions are wrong", 1, deploymentManagement.findActiveActionsByTarget(targ).size()); assertEquals("active actions are wrong", 1, deploymentManagement.findActiveActionsByTarget(targ).size());
assertEquals("target status is wrong", TargetUpdateStatus.PENDING, assertEquals("target status is wrong", TargetUpdateStatus.PENDING,
targetManagement.findTargetByControllerID(targ.getControllerId()).getTargetInfo().getUpdateStatus()); targetManagement.findTargetByControllerID(targ.getControllerId()).getTargetInfo().getUpdateStatus());
assertEquals(dsB, targ.getAssignedDistributionSet()); assertEquals("wrong assigned ds", dsB, targ.getAssignedDistributionSet());
assertEquals("Installed ds is wrong", dsA.getId(), assertEquals("Installed ds is wrong", dsA.getId(),
targetManagement.findTargetByControllerIDWithDetails(targ.getControllerId()).getTargetInfo() targetManagement.findTargetByControllerIDWithDetails(targ.getControllerId()).getTargetInfo()
.getInstalledDistributionSet().getId()); .getInstalledDistributionSet().getId());

View File

@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.Callable;
import org.eclipse.hawkbit.AbstractIntegrationTest; import org.eclipse.hawkbit.AbstractIntegrationTest;
import org.eclipse.hawkbit.TestDataUtil; import org.eclipse.hawkbit.TestDataUtil;
@@ -34,6 +35,8 @@ import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus; import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus; import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
import org.eclipse.hawkbit.repository.rsql.RSQLUtility; import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
import org.eclipse.hawkbit.repository.utils.MultipleInvokeHelper;
import org.eclipse.hawkbit.repository.utils.SuccessCondition;
import org.junit.Test; import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Description; import org.springframework.context.annotation.Description;
@@ -859,7 +862,7 @@ public class RolloutManagementTest extends AbstractIntegrationTest {
@Test @Test
@Description("Verify the creation and the start of a rollout in asynchronous mode.") @Description("Verify the creation and the start of a rollout in asynchronous mode.")
public void createAndStartRolloutInAsync() { public void createAndStartRolloutInAsync() throws Exception {
final int amountTargetsForRollout = 500; final int amountTargetsForRollout = 500;
final int amountGroups = 5; final int amountGroups = 5;
@@ -883,31 +886,18 @@ public class RolloutManagementTest extends AbstractIntegrationTest {
myRollout = rolloutManagement.createRolloutAsync(myRollout, amountGroups, conditions); myRollout = rolloutManagement.createRolloutAsync(myRollout, amountGroups, conditions);
int counter = 1; SuccessConditionRolloutStatus conditionRolloutTargetCount = new SuccessConditionRolloutStatus(
int counterMax = 10; RolloutStatus.READY);
while (!isRolloutInGivenStatus(myRollout.getId(), RolloutStatus.READY) && (counter <= counterMax)) { assertThat(MultipleInvokeHelper.doWithTimeout(new RolloutStatusCallable(myRollout.getId()),
try { conditionRolloutTargetCount, 15000, 500)).as("Rollout status").isNotNull();
Thread.sleep(500);
} catch (final InterruptedException e) {
e.printStackTrace();
}
counter++;
}
myRollout = rolloutManagement.findRolloutById(myRollout.getId()); myRollout = rolloutManagement.findRolloutById(myRollout.getId());
assertThat(myRollout.getStatus()).isEqualTo(RolloutStatus.READY); assertThat(myRollout.getStatus()).isEqualTo(RolloutStatus.READY);
rolloutManagement.startRolloutAsync(myRollout); rolloutManagement.startRolloutAsync(myRollout);
counter = 1; conditionRolloutTargetCount = new SuccessConditionRolloutStatus(RolloutStatus.RUNNING);
counterMax = 10; assertThat(MultipleInvokeHelper.doWithTimeout(new RolloutStatusCallable(myRollout.getId()),
while (!isRolloutInGivenStatus(myRollout.getId(), RolloutStatus.RUNNING) && counter <= counterMax) { conditionRolloutTargetCount, 15000, 500)).as("Rollout status").isNotNull();
try {
Thread.sleep(500);
} catch (final InterruptedException e) {
e.printStackTrace();
}
counter++;
}
myRollout = rolloutManagement.findRolloutById(myRollout.getId()); myRollout = rolloutManagement.findRolloutById(myRollout.getId());
assertThat(myRollout.getStatus()).isEqualTo(RolloutStatus.RUNNING); assertThat(myRollout.getStatus()).isEqualTo(RolloutStatus.RUNNING);
@@ -917,14 +907,6 @@ public class RolloutManagementTest extends AbstractIntegrationTest {
validateRolloutActionStatus(myRollout.getId(), expectedTargetCountStatus); validateRolloutActionStatus(myRollout.getId(), expectedTargetCountStatus);
} }
private boolean isRolloutInGivenStatus(final Long rolloutID, final RolloutStatus status) {
final Rollout myRollout = rolloutManagement.findRolloutById(rolloutID);
if (myRollout.getStatus() == status) {
return true;
}
return false;
}
private void validateRolloutGroupActionStatus(final RolloutGroup rolloutGroup, private void validateRolloutGroupActionStatus(final RolloutGroup rolloutGroup,
final Map<TotalTargetCountStatus.Status, Long> expectedTargetCountStatus) { final Map<TotalTargetCountStatus.Status, Long> expectedTargetCountStatus) {
final RolloutGroup rolloutGroupWithDetail = rolloutGroupManagement final RolloutGroup rolloutGroupWithDetail = rolloutGroupManagement
@@ -1021,4 +1003,35 @@ public class RolloutManagementTest extends AbstractIntegrationTest {
return map; return map;
} }
private static class SuccessConditionRolloutStatus implements SuccessCondition<RolloutStatus> {
private final RolloutStatus rolloutStatus;
public SuccessConditionRolloutStatus(final RolloutStatus rolloutStatus) {
this.rolloutStatus = rolloutStatus;
}
@Override
public boolean success(final RolloutStatus result) {
return result.equals(rolloutStatus);
}
}
private class RolloutStatusCallable implements Callable<RolloutStatus> {
final Long rolloutId;
RolloutStatusCallable(final Long rolloutId) {
this.rolloutId = rolloutId;
}
@Override
public RolloutStatus call() throws Exception {
final Rollout myRollout = rolloutManagement.findRolloutById(rolloutId);
return myRollout.getStatus();
}
}
} }

View File

@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.repository;
import static org.fest.assertions.api.Assertions.assertThat; import static org.fest.assertions.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import java.util.List; import java.util.List;
@@ -22,6 +23,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.Tag; import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.repository.model.Target; import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetTag; import org.eclipse.hawkbit.repository.model.TargetTag;
import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -42,6 +44,11 @@ public class TagManagementTest extends AbstractIntegrationTest {
LOG = LoggerFactory.getLogger(TagManagementTest.class); LOG = LoggerFactory.getLogger(TagManagementTest.class);
} }
@Before
public void setup() {
assertThat(targetTagRepository.findAll()).as("Not tags should be available").isEmpty();
}
@Test @Test
@Description("Full DS tag lifecycle tested. Create tags, assign them to sets and delete the tags.") @Description("Full DS tag lifecycle tested. Create tags, assign them to sets and delete the tags.")
public void createAndAssignAndDeleteDistributionSetTags() { public void createAndAssignAndDeleteDistributionSetTags() {
@@ -88,7 +95,7 @@ public class TagManagementTest extends AbstractIntegrationTest {
// search for not deleted // search for not deleted
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true) distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true)
.setTagNames(Lists.newArrayList(tagA.getName())); .setTagNames(Lists.newArrayList(tagA.getName()));
assertEquals( assertEquals("filter works not correct",
dsAs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown() dsAs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown()
+ dsACs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(), + dsACs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(),
distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()) distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build())
@@ -96,7 +103,7 @@ public class TagManagementTest extends AbstractIntegrationTest {
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true) distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true)
.setTagNames(Lists.newArrayList(tagB.getName())); .setTagNames(Lists.newArrayList(tagB.getName()));
assertEquals( assertEquals("filter works not correct",
dsBs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown() dsBs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown()
+ dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(), + dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(),
distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()) distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build())
@@ -104,7 +111,7 @@ public class TagManagementTest extends AbstractIntegrationTest {
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true) distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true)
.setTagNames(Lists.newArrayList(tagC.getName())); .setTagNames(Lists.newArrayList(tagC.getName()));
assertEquals( assertEquals("filter works not correct",
dsCs.spliterator().getExactSizeIfKnown() + dsACs.spliterator().getExactSizeIfKnown() dsCs.spliterator().getExactSizeIfKnown() + dsACs.spliterator().getExactSizeIfKnown()
+ dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(), + dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(),
distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()) distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build())
@@ -112,22 +119,22 @@ public class TagManagementTest extends AbstractIntegrationTest {
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true) distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(true)
.setTagNames(Lists.newArrayList(tagX.getName())); .setTagNames(Lists.newArrayList(tagX.getName()));
assertEquals(0, distributionSetManagement assertEquals("filter works not correct", 0, distributionSetManagement
.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()).getTotalElements()); .findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()).getTotalElements());
assertEquals(5, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); assertEquals("wrong tag size", 5, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
tagManagement.deleteDistributionSetTag(tagY.getName()); tagManagement.deleteDistributionSetTag(tagY.getName());
assertEquals(4, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); assertEquals("wrong tag size", 4, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
tagManagement.deleteDistributionSetTag(tagX.getName()); tagManagement.deleteDistributionSetTag(tagX.getName());
assertEquals(3, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); assertEquals("wrong tag size", 3, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
tagManagement.deleteDistributionSetTag(tagB.getName()); tagManagement.deleteDistributionSetTag(tagB.getName());
assertEquals(2, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown()); assertEquals("wrong tag size", 2, distributionSetTagRepository.findAll().spliterator().getExactSizeIfKnown());
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE) distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
.setTagNames(Lists.newArrayList(tagA.getName())); .setTagNames(Lists.newArrayList(tagA.getName()));
assertEquals( assertEquals("filter works not correct",
dsAs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown() dsAs.spliterator().getExactSizeIfKnown() + dsABs.spliterator().getExactSizeIfKnown()
+ dsACs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(), + dsACs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(),
distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()) distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build())
@@ -135,12 +142,12 @@ public class TagManagementTest extends AbstractIntegrationTest {
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE) distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
.setTagNames(Lists.newArrayList(tagB.getName())); .setTagNames(Lists.newArrayList(tagB.getName()));
assertEquals(0, distributionSetManagement assertEquals("filter works not correct", 0, distributionSetManagement
.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()).getTotalElements()); .findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()).getTotalElements());
distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE) distributionSetFilterBuilder = getDistributionSetFilterBuilder().setIsComplete(Boolean.TRUE)
.setTagNames(Lists.newArrayList(tagC.getName())); .setTagNames(Lists.newArrayList(tagC.getName()));
assertEquals( assertEquals("filter works not correct",
dsCs.spliterator().getExactSizeIfKnown() + dsACs.spliterator().getExactSizeIfKnown() dsCs.spliterator().getExactSizeIfKnown() + dsACs.spliterator().getExactSizeIfKnown()
+ dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(), + dsBCs.spliterator().getExactSizeIfKnown() + dsABCs.spliterator().getExactSizeIfKnown(),
distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build()) distributionSetManagement.findDistributionSetsByFilters(pageReq, distributionSetFilterBuilder.build())
@@ -154,30 +161,25 @@ public class TagManagementTest extends AbstractIntegrationTest {
@Test @Test
@Description("Ensures that all tags are retrieved through repository.") @Description("Ensures that all tags are retrieved through repository.")
public void findAllTargetTags() { public void findAllTargetTags() {
assertThat(targetTagRepository.findAll()).isEmpty();
final List<TargetTag> tags = createTargetsWithTags(); final List<TargetTag> tags = createTargetsWithTags();
assertThat(targetTagRepository.findAll()).isEqualTo(tagManagement.findAllTargetTags()).isEqualTo(tags) assertThat(targetTagRepository.findAll()).isEqualTo(tagManagement.findAllTargetTags()).isEqualTo(tags)
.hasSize(20); .as("Wrong tag size").hasSize(20);
} }
@Test @Test
@Description("Ensures that a created tag is persisted in the repository as defined.") @Description("Ensures that a created tag is persisted in the repository as defined.")
public void createTargetTag() { public void createTargetTag() {
assertThat(targetTagRepository.findAll()).isEmpty();
final Tag tag = tagManagement.createTargetTag(new TargetTag("kai1", "kai2", "colour")); final Tag tag = tagManagement.createTargetTag(new TargetTag("kai1", "kai2", "colour"));
assertThat(targetTagRepository.findByNameEquals("kai1").getDescription()).isEqualTo("kai2"); assertThat(targetTagRepository.findByNameEquals("kai1").getDescription()).as("wrong tag ed").isEqualTo("kai2");
assertThat(tagManagement.findTargetTag("kai1").getColour()).isEqualTo("colour"); assertThat(tagManagement.findTargetTag("kai1").getColour()).as("wrong tag found").isEqualTo("colour");
assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).isEqualTo("colour"); assertThat(tagManagement.findTargetTagById(tag.getId()).getColour()).as("wrong tag found").isEqualTo("colour");
} }
@Test @Test
@Description("Ensures that a deleted tag is removed from the repository as defined.") @Description("Ensures that a deleted tag is removed from the repository as defined.")
public void deleteTargetTas() { public void deleteTargetTas() {
assertThat(targetTagRepository.findAll()).isEmpty();
// create test data // create test data
final Iterable<TargetTag> tags = createTargetsWithTags(); final Iterable<TargetTag> tags = createTargetsWithTags();
@@ -196,16 +198,13 @@ public class TagManagementTest extends AbstractIntegrationTest {
assertThat(targetManagement.findTargetByControllerID(target.getControllerId()).getTags()) assertThat(targetManagement.findTargetByControllerID(target.getControllerId()).getTags())
.doesNotContain(toDelete); .doesNotContain(toDelete);
} }
assertThat(targetTagRepository.findOne(toDelete.getId())).isNull(); assertThat(targetTagRepository.findOne(toDelete.getId())).as("No tag should be found").isNull();
assertThat(tagManagement.findAllTargetTags()).hasSize(19); assertThat(tagManagement.findAllTargetTags()).as("Wrong target tag size").hasSize(19);
} }
@Test @Test
@Description("Tests the name update of a target tag.") @Description("Tests the name update of a target tag.")
public void updateTargetTag() { public void updateTargetTag() {
assertThat(targetTagRepository.findAll()).isEmpty();
// create test data
final List<TargetTag> tags = createTargetsWithTags(); final List<TargetTag> tags = createTargetsWithTags();
// change data // change data
@@ -216,95 +215,104 @@ public class TagManagementTest extends AbstractIntegrationTest {
tagManagement.updateTargetTag(savedAssigned); tagManagement.updateTargetTag(savedAssigned);
// check data // check data
assertThat(tagManagement.findAllTargetTags()).hasSize(tags.size()); assertThat(tagManagement.findAllTargetTags()).as("Wrong target tag size").hasSize(tags.size());
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getName()).isEqualTo("test123"); assertThat(targetTagRepository.findOne(savedAssigned.getId()).getName()).as("wrong target tag is saved")
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getOptLockRevision()).isEqualTo(2); .isEqualTo("test123");
assertThat(targetTagRepository.findOne(savedAssigned.getId()).getOptLockRevision())
.as("wrong target tag is saved").isEqualTo(2);
} }
@Test @Test
@Description("Ensures that a created tag is persisted in the repository as defined.") @Description("Ensures that a created tag is persisted in the repository as defined.")
public void createDistributionSetTag() { public void createDistributionSetTag() {
assertThat(distributionSetTagRepository.findAll()).isEmpty();
final Tag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("kai1", "kai2", "colour")); final Tag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("kai1", "kai2", "colour"));
assertThat(distributionSetTagRepository.findByNameEquals("kai1").getDescription()).isEqualTo("kai2"); assertThat(distributionSetTagRepository.findByNameEquals("kai1").getDescription()).as("wrong tag found")
assertThat(tagManagement.findDistributionSetTag("kai1").getColour()).isEqualTo("colour"); .isEqualTo("kai2");
assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).isEqualTo("colour"); assertThat(tagManagement.findDistributionSetTag("kai1").getColour()).as("wrong tag found").isEqualTo("colour");
assertThat(tagManagement.findDistributionSetTagById(tag.getId()).getColour()).as("wrong tag found")
.isEqualTo("colour");
} }
@Test @Test
@Description("Ensures that a created tags are persisted in the repository as defined.") @Description("Ensures that a created tags are persisted in the repository as defined.")
public void createDistributionSetTags() { public void createDistributionSetTags() {
assertThat(distributionSetTagRepository.findAll()).isEmpty();
final List<DistributionSetTag> tags = createDsSetsWithTags(); final List<DistributionSetTag> tags = createDsSetsWithTags();
assertThat(distributionSetTagRepository.findAll()).hasSize(tags.size()); assertThat(distributionSetTagRepository.findAll()).as("Wrong size of tags created").hasSize(tags.size());
} }
@Test @Test
@Description("Ensures that a deleted tag is removed from the repository as defined.") @Description("Ensures that a deleted tag is removed from the repository as defined.")
public void deleteDistributionSetTag() { public void deleteDistributionSetTag() {
assertThat(distributionSetTagRepository.findAll()).isEmpty();
// create test data // create test data
final Iterable<DistributionSetTag> tags = createDsSetsWithTags(); final Iterable<DistributionSetTag> tags = createDsSetsWithTags();
final DistributionSetTag toDelete = tags.iterator().next(); final DistributionSetTag toDelete = tags.iterator().next();
for (final DistributionSet set : distributionSetRepository.findAll()) { for (final DistributionSet set : distributionSetRepository.findAll()) {
assertThat(distributionSetManagement.findDistributionSetByIdWithDetails(set.getId()).getTags()) assertThat(distributionSetManagement.findDistributionSetByIdWithDetails(set.getId()).getTags())
.contains(toDelete); .as("Wrong tag found").contains(toDelete);
} }
// delete // delete
tagManagement.deleteDistributionSetTag(tags.iterator().next().getName()); tagManagement.deleteDistributionSetTag(tags.iterator().next().getName());
// check // check
assertThat(distributionSetTagRepository.findOne(toDelete.getId())).isNull(); assertThat(distributionSetTagRepository.findOne(toDelete.getId())).as("Deleted tag should be null").isNull();
assertThat(tagManagement.findAllDistributionSetTags()).hasSize(19); assertThat(tagManagement.findAllDistributionSetTags()).as("Wrong size of tags after deletion").hasSize(19);
for (final DistributionSet set : distributionSetRepository.findAll()) { for (final DistributionSet set : distributionSetRepository.findAll()) {
assertThat(distributionSetManagement.findDistributionSetByIdWithDetails(set.getId()).getTags()) assertThat(distributionSetManagement.findDistributionSetByIdWithDetails(set.getId()).getTags())
.doesNotContain(toDelete); .as("Wrong found tags").doesNotContain(toDelete);
} }
} }
@Test(expected = EntityAlreadyExistsException.class)
@Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).") @Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).")
public void failedDuplicateTargetTagNameException() { public void failedDuplicateTargetTagNameException() {
tagManagement.createTargetTag(new TargetTag("A")); tagManagement.createTargetTag(new TargetTag("A"));
try {
tagManagement.createTargetTag(new TargetTag("A")); tagManagement.createTargetTag(new TargetTag("A"));
fail("Expected EntityAlreadyExistsException");
} catch (final EntityAlreadyExistsException e) {
}
} }
@Test(expected = EntityAlreadyExistsException.class)
@Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).") @Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).")
public void failedDuplicateTargetTagNameExceptionAfterUpdate() { public void failedDuplicateTargetTagNameExceptionAfterUpdate() {
tagManagement.createTargetTag(new TargetTag("A")); tagManagement.createTargetTag(new TargetTag("A"));
final TargetTag tag = tagManagement.createTargetTag(new TargetTag("B")); final TargetTag tag = tagManagement.createTargetTag(new TargetTag("B"));
tag.setName("A"); tag.setName("A");
try {
tagManagement.updateTargetTag(tag); tagManagement.updateTargetTag(tag);
fail("Expected EntityAlreadyExistsException");
} catch (final EntityAlreadyExistsException e) {
}
} }
@Test(expected = EntityAlreadyExistsException.class)
@Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).") @Description("Ensures that a tag cannot be created if one exists already with that name (ecpects EntityAlreadyExistsException).")
public void failedDuplicateDsTagNameException() { public void failedDuplicateDsTagNameException() {
tagManagement.createDistributionSetTag(new DistributionSetTag("A")); tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
try {
tagManagement.createDistributionSetTag(new DistributionSetTag("A")); tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
fail("Expected EntityAlreadyExistsException");
} catch (final EntityAlreadyExistsException e) {
}
} }
@Test(expected = EntityAlreadyExistsException.class)
@Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).") @Description("Ensures that a tag cannot be updated to a name that already exists on another tag (ecpects EntityAlreadyExistsException).")
public void failedDuplicateDsTagNameExceptionAfterUpdate() { public void failedDuplicateDsTagNameExceptionAfterUpdate() {
tagManagement.createDistributionSetTag(new DistributionSetTag("A")); tagManagement.createDistributionSetTag(new DistributionSetTag("A"));
final DistributionSetTag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("B")); final DistributionSetTag tag = tagManagement.createDistributionSetTag(new DistributionSetTag("B"));
tag.setName("A"); tag.setName("A");
try {
tagManagement.updateDistributionSetTag(tag); tagManagement.updateDistributionSetTag(tag);
fail("Expected EntityAlreadyExistsException");
} catch (final EntityAlreadyExistsException e) {
}
} }
@Test @Test
@Description("Tests the name update of a target tag.") @Description("Tests the name update of a target tag.")
public void updateDistributionSetTag() { public void updateDistributionSetTag() {
assertThat(distributionSetTagRepository.findAll()).isEmpty();
// create test data // create test data
final List<DistributionSetTag> tags = createDsSetsWithTags(); final List<DistributionSetTag> tags = createDsSetsWithTags();
@@ -317,20 +325,19 @@ public class TagManagementTest extends AbstractIntegrationTest {
tagManagement.updateDistributionSetTag(savedAssigned); tagManagement.updateDistributionSetTag(savedAssigned);
// check data // check data
assertThat(tagManagement.findAllDistributionSetTags()).hasSize(tags.size()); assertThat(tagManagement.findAllDistributionSetTags()).as("Wrong size of ds tags").hasSize(tags.size());
assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).isEqualTo("test123"); assertThat(distributionSetTagRepository.findOne(savedAssigned.getId()).getName()).as("Wrong ds tag found")
.isEqualTo("test123");
} }
@Test @Test
@Description("Ensures that all tags are retrieved through repository.") @Description("Ensures that all tags are retrieved through repository.")
public void findDistributionSetTagsAll() { public void findDistributionSetTagsAll() {
assertThat(distributionSetTagRepository.findAll()).isEmpty();
final List<DistributionSetTag> tags = createDsSetsWithTags(); final List<DistributionSetTag> tags = createDsSetsWithTags();
// test // test
assertThat(tagManagement.findAllDistributionSetTags()).hasSize(tags.size()); assertThat(tagManagement.findAllDistributionSetTags()).as("Wrong size of tags").hasSize(tags.size());
assertThat(distributionSetTagRepository.findAll()).hasSize(20); assertThat(distributionSetTagRepository.findAll()).as("Wrong size of tags").hasSize(20);
} }
private List<TargetTag> createTargetsWithTags() { private List<TargetTag> createTargetsWithTags() {

View File

@@ -98,7 +98,7 @@ public class RSQLDistributionSetFieldTest extends AbstractIntegrationTest {
assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "==true", 4); assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "==true", 4);
try { try {
assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "==noExist*", 0); assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "==noExist*", 0);
fail(); fail("Expected RSQLParameterSyntaxException");
} catch (final RSQLParameterSyntaxException e) { } catch (final RSQLParameterSyntaxException e) {
} }
assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "=in=(true)", 4); assertRSQLQuery(DistributionSetFields.COMPLETE.name() + "=in=(true)", 4);

View File

@@ -55,7 +55,7 @@ public class RSQLSoftwareModuleTypeFieldsTest extends AbstractIntegrationTest {
@Test @Test
@Description("Test filter software module test type by max") @Description("Test filter software module test type by max")
public void testFilterByMaxAssignment() { public void testFilterByMaxAssignment() {
assertRSQLQuery(SoftwareModuleTypeFields.MAX.name() + "==1", 3); assertRSQLQuery(SoftwareModuleTypeFields.MAXASSIGNMENTS.name() + "==1", 3);
} }
private void assertRSQLQuery(final String rsqlParam, final long excpectedEntity) { private void assertRSQLQuery(final String rsqlParam, final long excpectedEntity) {

View File

@@ -0,0 +1,94 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.repository.utils;
import java.util.concurrent.Callable;
/**
* Helper to call a request multiple times regarding a given condition until
* timeout is reached.
*
*/
public final class MultipleInvokeHelper {
/**
* Call with timeout until result is not null.
*
* @param callable
* class
* @param timeout
* value
* @param pollInterval
* value
* @return
* @throws Exception
*/
public static <T> T doWithTimeoutUntilResultIsNotNull(final Callable<T> callable, final long timeout,
final long pollInterval) throws Exception // NOPMD
{
return doWithTimeout(callable, new SuccessCondition<T>() {
@Override
public boolean success(final T result) {
return result != null;
};
}, timeout, pollInterval);
}
/**
* Call with timeout.
*
* @param callable
* class
* @param successCondition
* class
* @param timeout
* value
* @param pollInterval
* value
* @return
* @throws Exception
*/
public static <T> T doWithTimeout(final Callable<T> callable, final SuccessCondition<T> successCondition,
final long timeout, final long pollInterval) throws Exception // NOPMD
{
if (pollInterval < 0) {
throw new IllegalArgumentException("pollInterval must non negative");
}
long duration = 0;
Exception exception = null;
T returnValue = null;
while (untilTimeoutReached(timeout, duration)) {
try {
returnValue = callable.call();
// clear exception
exception = null;
} catch (final Exception ex) {
exception = ex;
}
Thread.sleep(pollInterval);
duration += pollInterval > 0 ? pollInterval : 1;
if (exception == null && successCondition.success(returnValue)) {
return returnValue;
} else {
returnValue = null;
}
}
if (exception != null) {
throw exception;
}
return returnValue;
}
private static boolean untilTimeoutReached(final long timeout, final long duration) {
return duration <= timeout || timeout < 0;
}
}

View File

@@ -0,0 +1,27 @@
/**
* Copyright (c) 2015 Bosch Software Innovations GmbH and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.eclipse.hawkbit.repository.utils;
/**
* SuccessCondition Interface.
*
* @param <T>
* type of the value to get verified
*/
public interface SuccessCondition<T> {
/**
* The implementation of the success condition.
*
* @param result
* @return
*/
boolean success(final T result);
}

View File

@@ -64,7 +64,7 @@ public class DistributionSetTypeResource implements DistributionSetTypeRestApi {
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam); final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
final Sort sorting = PagingUtility.sanitizeSoftwareModuleSortParam(sortParam); final Sort sorting = PagingUtility.sanitizeDistributionSetTypeSortParam(sortParam);
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting); final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);

View File

@@ -12,10 +12,12 @@ import org.eclipse.hawkbit.repository.ActionFields;
import org.eclipse.hawkbit.repository.ActionStatusFields; import org.eclipse.hawkbit.repository.ActionStatusFields;
import org.eclipse.hawkbit.repository.DistributionSetFields; import org.eclipse.hawkbit.repository.DistributionSetFields;
import org.eclipse.hawkbit.repository.DistributionSetMetadataFields; import org.eclipse.hawkbit.repository.DistributionSetMetadataFields;
import org.eclipse.hawkbit.repository.DistributionSetTypeFields;
import org.eclipse.hawkbit.repository.RolloutFields; import org.eclipse.hawkbit.repository.RolloutFields;
import org.eclipse.hawkbit.repository.RolloutGroupFields; import org.eclipse.hawkbit.repository.RolloutGroupFields;
import org.eclipse.hawkbit.repository.SoftwareModuleFields; import org.eclipse.hawkbit.repository.SoftwareModuleFields;
import org.eclipse.hawkbit.repository.SoftwareModuleMetadataFields; import org.eclipse.hawkbit.repository.SoftwareModuleMetadataFields;
import org.eclipse.hawkbit.repository.SoftwareModuleTypeFields;
import org.eclipse.hawkbit.repository.TargetFields; import org.eclipse.hawkbit.repository.TargetFields;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction; import org.springframework.data.domain.Sort.Direction;
@@ -48,103 +50,92 @@ public final class PagingUtility {
} }
static Sort sanitizeTargetSortParam(final String sortParam) { static Sort sanitizeTargetSortParam(final String sortParam) {
final Sort sorting; if (sortParam == null) {
if (sortParam != null) { // default
sorting = new Sort(SortUtility.parse(TargetFields.class, sortParam)); return new Sort(Direction.ASC, TargetFields.NAME.getFieldName());
} else {
// default sort
sorting = new Sort(Direction.ASC, TargetFields.NAME.getFieldName());
} }
return sorting; return new Sort(SortUtility.parse(TargetFields.class, sortParam));
} }
static Sort sanitizeSoftwareModuleSortParam(final String sortParam) { static Sort sanitizeSoftwareModuleSortParam(final String sortParam) {
final Sort sorting; if (sortParam == null) {
if (sortParam != null) { // default
sorting = new Sort(SortUtility.parse(SoftwareModuleFields.class, sortParam)); return new Sort(Direction.ASC, SoftwareModuleFields.NAME.getFieldName());
} else {
// default sort
sorting = new Sort(Direction.ASC, SoftwareModuleFields.NAME.getFieldName());
} }
return sorting; return new Sort(SortUtility.parse(SoftwareModuleFields.class, sortParam));
}
static Sort sanitizeSoftwareModuleTypeSortParam(final String sortParam) {
if (sortParam == null) {
// default
return new Sort(Direction.ASC, SoftwareModuleTypeFields.NAME.getFieldName());
}
return new Sort(SortUtility.parse(SoftwareModuleTypeFields.class, sortParam));
} }
static Sort sanitizeDistributionSetSortParam(final String sortParam) { static Sort sanitizeDistributionSetSortParam(final String sortParam) {
final Sort sorting; if (sortParam == null) {
if (sortParam != null) { // default
sorting = new Sort(SortUtility.parse(DistributionSetFields.class, sortParam)); return new Sort(Direction.ASC, DistributionSetFields.NAME.getFieldName());
} else {
// default sort
sorting = new Sort(Direction.ASC, DistributionSetFields.NAME.getFieldName());
} }
return sorting; return new Sort(SortUtility.parse(DistributionSetFields.class, sortParam));
}
static Sort sanitizeDistributionSetTypeSortParam(final String sortParam) {
if (sortParam == null) {
// default
return new Sort(Direction.ASC, DistributionSetTypeFields.NAME.getFieldName());
}
return new Sort(SortUtility.parse(DistributionSetTypeFields.class, sortParam));
} }
static Sort sanitizeActionSortParam(final String sortParam) { static Sort sanitizeActionSortParam(final String sortParam) {
final Sort sorting; if (sortParam == null) {
if (sortParam != null) {
sorting = new Sort(SortUtility.parse(ActionFields.class, sortParam));
} else {
// default sort is DESC in case of action to match behavior // default sort is DESC in case of action to match behavior
// of management UI (last entry on top) // of management UI (last entry on top)
sorting = new Sort(Direction.DESC, ActionFields.ID.getFieldName()); return new Sort(Direction.DESC, ActionFields.ID.getFieldName());
} }
return sorting; return new Sort(SortUtility.parse(ActionFields.class, sortParam));
} }
static Sort sanitizeActionStatusSortParam(final String sortParam) { static Sort sanitizeActionStatusSortParam(final String sortParam) {
final Sort sorting; if (sortParam == null) {
if (sortParam != null) {
sorting = new Sort(SortUtility.parse(ActionStatusFields.class, sortParam));
} else {
// default sort is DESC in case of action status to match behavior // default sort is DESC in case of action status to match behavior
// of management UI (last entry on top) // of management UI (last entry on top)
sorting = new Sort(Direction.DESC, ActionStatusFields.ID.getFieldName()); return new Sort(Direction.DESC, ActionStatusFields.ID.getFieldName());
} }
return sorting; return new Sort(SortUtility.parse(ActionStatusFields.class, sortParam));
} }
static Sort sanitizeDistributionSetMetadataSortParam(final String sortParam) { static Sort sanitizeDistributionSetMetadataSortParam(final String sortParam) {
final Sort sorting; if (sortParam == null) {
if (sortParam != null) { // default
sorting = new Sort(SortUtility.parse(DistributionSetMetadataFields.class, sortParam)); return new Sort(Direction.ASC, DistributionSetMetadataFields.KEY.getFieldName());
} else {
// default sort
sorting = new Sort(Direction.ASC, DistributionSetMetadataFields.KEY.getFieldName());
} }
return sorting; return new Sort(SortUtility.parse(DistributionSetMetadataFields.class, sortParam));
} }
static Sort sanitizeSoftwareModuleMetadataSortParam(final String sortParam) { static Sort sanitizeSoftwareModuleMetadataSortParam(final String sortParam) {
final Sort sorting; if (sortParam == null) {
if (sortParam != null) { // default
sorting = new Sort(SortUtility.parse(SoftwareModuleMetadataFields.class, sortParam)); return new Sort(Direction.ASC, SoftwareModuleMetadataFields.KEY.getFieldName());
} else {
// default sort
sorting = new Sort(Direction.ASC, SoftwareModuleMetadataFields.KEY.getFieldName());
} }
return sorting; return new Sort(SortUtility.parse(SoftwareModuleMetadataFields.class, sortParam));
} }
static Sort sanitizeRolloutSortParam(final String sortParam) { static Sort sanitizeRolloutSortParam(final String sortParam) {
final Sort sorting; if (sortParam == null) {
if (sortParam != null) { // default
sorting = new Sort(SortUtility.parse(RolloutFields.class, sortParam)); return new Sort(Direction.ASC, RolloutFields.NAME.getFieldName());
} else {
// default sort
sorting = new Sort(Direction.ASC, RolloutFields.NAME.getFieldName());
} }
return sorting; return new Sort(SortUtility.parse(RolloutFields.class, sortParam));
} }
static Sort sanitizeRolloutGroupSortParam(final String sortParam) { static Sort sanitizeRolloutGroupSortParam(final String sortParam) {
final Sort sorting; if (sortParam == null) {
if (sortParam != null) { // default
sorting = new Sort(SortUtility.parse(RolloutGroupFields.class, sortParam)); return new Sort(Direction.ASC, RolloutGroupFields.NAME.getFieldName());
} else {
// default sort
sorting = new Sort(Direction.ASC, RolloutGroupFields.NAME.getFieldName());
} }
return sorting; return new Sort(SortUtility.parse(RolloutGroupFields.class, sortParam));
} }
} }

View File

@@ -48,7 +48,7 @@ public class SoftwareModuleTypeResource implements SoftwareModuleTypeRestApi {
final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam);
final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam); final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam);
final Sort sorting = PagingUtility.sanitizeSoftwareModuleSortParam(sortParam); final Sort sorting = PagingUtility.sanitizeSoftwareModuleTypeSortParam(sortParam);
final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting); final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting);

View File

@@ -209,7 +209,7 @@ public class TargetResource implements TargetRestApi {
final Action action = findActionWithExceptionIfNotFound(actionId); final Action action = findActionWithExceptionIfNotFound(actionId);
if (force) { if (force) {
this.deploymentManagement.forceQuitAction(action, target); this.deploymentManagement.forceQuitAction(action);
} else { } else {
this.deploymentManagement.cancelAction(action, target); this.deploymentManagement.cancelAction(action, target);
} }

View File

@@ -89,6 +89,43 @@ public class DistributionSetTypeResourceTest extends AbstractIntegrationTest {
.andExpect(jsonPath("$total", equalTo(4))); .andExpect(jsonPath("$total", equalTo(4)));
} }
@Test
@WithUser(principal = "uploadTester", allSpPermissions = true)
@Description("Checks the correct behaviour of /rest/v1/distributionsettypes GET requests with sorting by KEY.")
public void getDistributionSetTypesSortedByKey() throws Exception {
DistributionSetType testType = distributionSetManagement
.createDistributionSetType(new DistributionSetType("zzzzz", "TestName123", "Desc123"));
testType.setDescription("Desc1234");
testType = distributionSetManagement.updateDistributionSetType(testType);
// descending
mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON)
.param(RestConstants.REQUEST_PARAMETER_SORTING, "KEY:DESC")).andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$content.[0].id", equalTo(testType.getId().intValue())))
.andExpect(jsonPath("$content.[0].name", equalTo("TestName123")))
.andExpect(jsonPath("$content.[0].description", equalTo("Desc1234")))
.andExpect(jsonPath("$content.[0].createdBy", equalTo("uploadTester")))
.andExpect(jsonPath("$content.[0].createdAt", equalTo(testType.getCreatedAt())))
.andExpect(jsonPath("$content.[0].lastModifiedBy", equalTo("uploadTester")))
.andExpect(jsonPath("$content.[0].lastModifiedAt", equalTo(testType.getLastModifiedAt())))
.andExpect(jsonPath("$content.[0].key", equalTo("zzzzz"))).andExpect(jsonPath("$total", equalTo(4)));
// ascending
mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON)
.param(RestConstants.REQUEST_PARAMETER_SORTING, "KEY:ASC")).andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$content.[3].id", equalTo(testType.getId().intValue())))
.andExpect(jsonPath("$content.[3].name", equalTo("TestName123")))
.andExpect(jsonPath("$content.[3].description", equalTo("Desc1234")))
.andExpect(jsonPath("$content.[3].createdBy", equalTo("uploadTester")))
.andExpect(jsonPath("$content.[3].createdAt", equalTo(testType.getCreatedAt())))
.andExpect(jsonPath("$content.[3].lastModifiedBy", equalTo("uploadTester")))
.andExpect(jsonPath("$content.[3].lastModifiedAt", equalTo(testType.getLastModifiedAt())))
.andExpect(jsonPath("$content.[3].key", equalTo("zzzzz"))).andExpect(jsonPath("$total", equalTo(4)));
}
@Test @Test
@WithUser(principal = "uploadTester", allSpPermissions = true) @WithUser(principal = "uploadTester", allSpPermissions = true)
@Description("Checks the correct behaviour of /rest/v1/distributionsettypes POST requests.") @Description("Checks the correct behaviour of /rest/v1/distributionsettypes POST requests.")

View File

@@ -453,8 +453,8 @@ public class RolloutResourceTest extends AbstractIntegrationTest {
.andExpect(status().isOk()); .andExpect(status().isOk());
// check if running // check if running
assertThat(doWithTimeout(() -> getRollout(rollout.getId()), result -> success(result), 5000, 100)).isNotNull(); assertThat(doWithTimeout(() -> getRollout(rollout.getId()), result -> success(result), 60_000, 100))
.isNotNull();
} }
@Test @Test

View File

@@ -311,7 +311,7 @@ public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongo
.andExpect(header().string("ETag", artifact.getSha1Hash())) .andExpect(header().string("ETag", artifact.getSha1Hash()))
.andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM)).andReturn(); .andExpect(content().contentType(MediaType.APPLICATION_OCTET_STREAM)).andReturn();
assertTrue(Arrays.equals(result.getResponse().getContentAsByteArray(), random)); assertTrue("Wrong response content", Arrays.equals(result.getResponse().getContentAsByteArray(), random));
final MvcResult result2 = mvc final MvcResult result2 = mvc
.perform(get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download", sm.getId(), .perform(get("/rest/v1/softwaremodules/{smId}/artifacts/{artId}/download", sm.getId(),

View File

@@ -90,6 +90,46 @@ public class SoftwareModuleTypeResourceTest extends AbstractIntegrationTest {
.andExpect(jsonPath("$total", equalTo(4))); .andExpect(jsonPath("$total", equalTo(4)));
} }
@Test
@WithUser(principal = "uploadTester", allSpPermissions = true)
@Description("Checks the correct behaviour of /rest/v1/softwaremoduletypes GET requests with sorting by MAXASSIGNMENTS field.")
public void getSoftwareModuleTypesSortedByMaxAssignments() throws Exception {
SoftwareModuleType testType = softwareManagement
.createSoftwareModuleType(new SoftwareModuleType("test123", "TestName123", "Desc123", 5));
testType.setDescription("Desc1234");
testType = softwareManagement.updateSoftwareModuleType(testType);
// descending
mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON)
.param(RestConstants.REQUEST_PARAMETER_SORTING, "MAXASSIGNMENTS:DESC"))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$content.[0].id", equalTo(testType.getId().intValue())))
.andExpect(jsonPath("$content.[0].name", equalTo("TestName123")))
.andExpect(jsonPath("$content.[0].description", equalTo("Desc1234")))
.andExpect(jsonPath("$content.[0].createdBy", equalTo("uploadTester")))
.andExpect(jsonPath("$content.[0].createdAt", equalTo(testType.getCreatedAt())))
.andExpect(jsonPath("$content.[0].lastModifiedBy", equalTo("uploadTester")))
.andExpect(jsonPath("$content.[0].lastModifiedAt", equalTo(testType.getLastModifiedAt())))
.andExpect(jsonPath("$content.[0].maxAssignments", equalTo(5)))
.andExpect(jsonPath("$content.[0].key", equalTo("test123"))).andExpect(jsonPath("$total", equalTo(4)));
// ascending
mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON)
.param(RestConstants.REQUEST_PARAMETER_SORTING, "MAXASSIGNMENTS:ASC"))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$content.[3].id", equalTo(testType.getId().intValue())))
.andExpect(jsonPath("$content.[3].name", equalTo("TestName123")))
.andExpect(jsonPath("$content.[3].description", equalTo("Desc1234")))
.andExpect(jsonPath("$content.[3].createdBy", equalTo("uploadTester")))
.andExpect(jsonPath("$content.[3].createdAt", equalTo(testType.getCreatedAt())))
.andExpect(jsonPath("$content.[3].lastModifiedBy", equalTo("uploadTester")))
.andExpect(jsonPath("$content.[3].lastModifiedAt", equalTo(testType.getLastModifiedAt())))
.andExpect(jsonPath("$content.[3].maxAssignments", equalTo(5)))
.andExpect(jsonPath("$content.[3].key", equalTo("test123"))).andExpect(jsonPath("$total", equalTo(4)));
}
@Test @Test
@WithUser(principal = "uploadTester", allSpPermissions = true) @WithUser(principal = "uploadTester", allSpPermissions = true)
@Description("Checks the correct behaviour of /rest/v1/softwaremoduletypes POST requests.") @Description("Checks the correct behaviour of /rest/v1/softwaremoduletypes POST requests.")

View File

@@ -61,7 +61,7 @@ public class HawkbitUI extends DefaultHawkbitUI implements DetachListener {
private static final String EMPTY_VIEW = ""; private static final String EMPTY_VIEW = "";
private EventPushStrategy pushStrategy; private transient EventPushStrategy pushStrategy;
@Autowired @Autowired
private SpringViewProvider viewProvider; private SpringViewProvider viewProvider;

View File

@@ -438,17 +438,17 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
if (permChecker.hasUpdateDistributionPermission()) { if (permChecker.hasUpdateDistributionPermission()) {
optionValues.add(updateType.getValue()); optionValues.add(updateType.getValue());
} }
createOptionGroup(optionValues); createOptionGroupByValues(optionValues);
} }
private void singleMultiOptionGroup() { private void singleMultiOptionGroup() {
final List<String> optionValues = new ArrayList<>(); final List<String> optionValues = new ArrayList<>();
optionValues.add(singleAssign.getValue()); optionValues.add(singleAssign.getValue());
optionValues.add(multiAssign.getValue()); optionValues.add(multiAssign.getValue());
assignOptionGroup(optionValues); assignOptionGroupByValues(optionValues);
} }
private void createOptionGroup(final List<String> tagOptions) { private void createOptionGroupByValues(final List<String> tagOptions) {
createOptiongroup = new OptionGroup("", tagOptions); createOptiongroup = new OptionGroup("", tagOptions);
createOptiongroup.setStyleName(ValoTheme.OPTIONGROUP_SMALL); createOptiongroup.setStyleName(ValoTheme.OPTIONGROUP_SMALL);
createOptiongroup.addStyleName("custom-option-group"); createOptiongroup.addStyleName("custom-option-group");
@@ -458,7 +458,7 @@ public class CreateUpdateSoftwareTypeLayout extends CustomComponent implements C
} }
} }
private void assignOptionGroup(final List<String> tagOptions) { private void assignOptionGroupByValues(final List<String> tagOptions) {
assignOptiongroup = new OptionGroup("", tagOptions); assignOptiongroup = new OptionGroup("", tagOptions);
assignOptiongroup.setStyleName(ValoTheme.OPTIONGROUP_SMALL); assignOptiongroup.setStyleName(ValoTheme.OPTIONGROUP_SMALL);
assignOptiongroup.addStyleName("custom-option-group"); assignOptiongroup.addStyleName("custom-option-group");

View File

@@ -50,9 +50,9 @@ public class ArtifactUploadState implements Serializable {
private boolean swTypeFilterClosed = Boolean.FALSE; private boolean swTypeFilterClosed = Boolean.FALSE;
private boolean isSwModuleTableMaximized = Boolean.FALSE; private boolean swModuleTableMaximized = Boolean.FALSE;
private boolean isArtifactDetailsMaximized = Boolean.FALSE; private boolean artifactDetailsMaximized = Boolean.FALSE;
private final Set<String> selectedDeleteSWModuleTypes = new HashSet<>(); private final Set<String> selectedDeleteSWModuleTypes = new HashSet<>();
@@ -152,15 +152,15 @@ public class ArtifactUploadState implements Serializable {
* @return the isSwModuleTableMaximized * @return the isSwModuleTableMaximized
*/ */
public boolean isSwModuleTableMaximized() { public boolean isSwModuleTableMaximized() {
return isSwModuleTableMaximized; return swModuleTableMaximized;
} }
/** /**
* @param isSwModuleTableMaximized * @param isSwModuleTableMaximized
* the isSwModuleTableMaximized to set * the isSwModuleTableMaximized to set
*/ */
public void setSwModuleTableMaximized(final boolean isSwModuleTableMaximized) { public void setSwModuleTableMaximized(final boolean swModuleTableMaximized) {
this.isSwModuleTableMaximized = isSwModuleTableMaximized; this.swModuleTableMaximized = swModuleTableMaximized;
} }
public Set<String> getSelectedDeleteSWModuleTypes() { public Set<String> getSelectedDeleteSWModuleTypes() {
@@ -171,15 +171,15 @@ public class ArtifactUploadState implements Serializable {
* @return the isArtifactDetailsMaximized * @return the isArtifactDetailsMaximized
*/ */
public boolean isArtifactDetailsMaximized() { public boolean isArtifactDetailsMaximized() {
return isArtifactDetailsMaximized; return artifactDetailsMaximized;
} }
/** /**
* @param isArtifactDetailsMaximized * @param isArtifactDetailsMaximized
* the isArtifactDetailsMaximized to set * the isArtifactDetailsMaximized to set
*/ */
public void setArtifactDetailsMaximized(final boolean isArtifactDetailsMaximized) { public void setArtifactDetailsMaximized(final boolean artifactDetailsMaximized) {
this.isArtifactDetailsMaximized = isArtifactDetailsMaximized; this.artifactDetailsMaximized = artifactDetailsMaximized;
} }
/** /**

View File

@@ -38,11 +38,9 @@ public class ProxyTarget extends Target {
private TargetIdName targetIdName; private TargetIdName targetIdName;
private Long createdAt; private String assignedDistNameVersion;
private String assignedDistNameVersion = null; private String installedDistNameVersion;
private String installedDistNameVersion = null;
private String pollStatusToolTip; private String pollStatusToolTip;
@@ -251,22 +249,6 @@ public class ProxyTarget extends Target {
this.installedDistributionSet = installedDistributionSet; this.installedDistributionSet = installedDistributionSet;
} }
/**
* @return the createdAt
*/
@Override
public Long getCreatedAt() {
return createdAt;
}
/**
* @param createdAt
* the createdAt to set
*/
public void setCreatedAt(final Long createdAt) {
this.createdAt = createdAt;
}
/** /**
* @return the targetIdName * @return the targetIdName
*/ */

View File

@@ -555,10 +555,10 @@ public class CreateUpdateDistSetTypeLayout extends CustomComponent implements Co
if (permChecker.hasUpdateDistributionPermission()) { if (permChecker.hasUpdateDistributionPermission()) {
optionValues.add(updateDistType.getValue()); optionValues.add(updateDistType.getValue());
} }
createOptionGroup(optionValues); createOptionGroupByValues(optionValues);
} }
private void createOptionGroup(final List<String> typeOptions) { private void createOptionGroupByValues(final List<String> typeOptions) {
createOptiongroup = new OptionGroup("", typeOptions); createOptiongroup = new OptionGroup("", typeOptions);
createOptiongroup.setId(SPUIDefinitions.CREATE_OPTION_GROUP_DISTRIBUTION_SET_TYPE_ID); createOptiongroup.setId(SPUIDefinitions.CREATE_OPTION_GROUP_DISTRIBUTION_SET_TYPE_ID);
createOptiongroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL); createOptiongroup.addStyleName(ValoTheme.OPTIONGROUP_SMALL);

View File

@@ -62,9 +62,9 @@ public class ManageDistUIState implements Serializable {
private final Map<Long, String> deleteSofwareModulesList = new HashMap<>(); private final Map<Long, String> deleteSofwareModulesList = new HashMap<>();
private boolean isSwModuleTableMaximized = Boolean.FALSE; private boolean swModuleTableMaximized = Boolean.FALSE;
private boolean isDsTableMaximized = Boolean.FALSE; private boolean dsTableMaximized = Boolean.FALSE;
private final Map<String, SoftwareModuleIdName> assignedSoftwareModuleDetails = new HashMap<>(); private final Map<String, SoftwareModuleIdName> assignedSoftwareModuleDetails = new HashMap<>();
@@ -219,7 +219,7 @@ public class ManageDistUIState implements Serializable {
* @return boolean * @return boolean
*/ */
public boolean isDsTableMaximized() { public boolean isDsTableMaximized() {
return isDsTableMaximized; return dsTableMaximized;
} }
/*** /***
@@ -227,8 +227,8 @@ public class ManageDistUIState implements Serializable {
* *
* @param isDsModuleTableMaximized * @param isDsModuleTableMaximized
*/ */
public void setDsTableMaximized(final boolean isDsModuleTableMaximized) { public void setDsTableMaximized(final boolean dsModuleTableMaximized) {
isDsTableMaximized = isDsModuleTableMaximized; dsTableMaximized = dsModuleTableMaximized;
} }
public Map<String, SoftwareModuleIdName> getAssignedSoftwareModuleDetails() { public Map<String, SoftwareModuleIdName> getAssignedSoftwareModuleDetails() {
@@ -239,15 +239,15 @@ public class ManageDistUIState implements Serializable {
* @return the isSwModuleTableMaximized * @return the isSwModuleTableMaximized
*/ */
public boolean isSwModuleTableMaximized() { public boolean isSwModuleTableMaximized() {
return isSwModuleTableMaximized; return swModuleTableMaximized;
} }
/** /**
* @param isSwModuleTableMaximized * @param isSwModuleTableMaximized
* the isSwModuleTableMaximized to set * the isSwModuleTableMaximized to set
*/ */
public void setSwModuleTableMaximized(final boolean isSwModuleTableMaximized) { public void setSwModuleTableMaximized(final boolean swModuleTableMaximized) {
this.isSwModuleTableMaximized = isSwModuleTableMaximized; this.swModuleTableMaximized = swModuleTableMaximized;
} }
/** /**

View File

@@ -844,7 +844,7 @@ public class ActionHistoryTable extends TreeTable implements Handler {
if (actionId != null) { if (actionId != null) {
final Action activeAction = deploymentManagement.findAction(actionId); final Action activeAction = deploymentManagement.findAction(actionId);
try { try {
deploymentManagement.forceQuitAction(activeAction, target); deploymentManagement.forceQuitAction(activeAction);
return true; return true;
} catch (final CancelActionNotAllowedException e) { } catch (final CancelActionNotAllowedException e) {
LOG.info("Force Cancel action not allowed exception :{}", e); LOG.info("Force Cancel action not allowed exception :{}", e);

View File

@@ -94,8 +94,8 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
@Autowired @Autowired
private transient TenantMetaDataRepository tenantMetaDataRepository; private transient TenantMetaDataRepository tenantMetaDataRepository;
private Button saveDistribution; private Button saveDistributionBtn;
private Button discardDistribution; private Button discardDistributionBtn;
private TextField distNameTextField; private TextField distNameTextField;
private TextField distVersionTextField; private TextField distVersionTextField;
private Label madatoryLabel; private Label madatoryLabel;
@@ -103,7 +103,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
private CheckBox reqMigStepCheckbox; private CheckBox reqMigStepCheckbox;
private ComboBox distsetTypeNameComboBox; private ComboBox distsetTypeNameComboBox;
private boolean editDistribution = Boolean.FALSE; private boolean editDistribution = Boolean.FALSE;
private Long editDistId = null; private Long editDistId;
private Window addDistributionWindow; private Window addDistributionWindow;
private String originalDistName; private String originalDistName;
private String originalDistVersion; private String originalDistVersion;
@@ -131,9 +131,9 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
final HorizontalLayout buttonsLayout = new HorizontalLayout(); final HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setSizeFull(); buttonsLayout.setSizeFull();
buttonsLayout.setStyleName("dist-buttons-horz-layout"); buttonsLayout.setStyleName("dist-buttons-horz-layout");
buttonsLayout.addComponents(saveDistribution, discardDistribution); buttonsLayout.addComponents(saveDistributionBtn, discardDistributionBtn);
buttonsLayout.setComponentAlignment(saveDistribution, Alignment.BOTTOM_LEFT); buttonsLayout.setComponentAlignment(saveDistributionBtn, Alignment.BOTTOM_LEFT);
buttonsLayout.setComponentAlignment(discardDistribution, Alignment.BOTTOM_RIGHT); buttonsLayout.setComponentAlignment(discardDistributionBtn, Alignment.BOTTOM_RIGHT);
buttonsLayout.addStyleName("window-style"); buttonsLayout.addStyleName("window-style");
/* /*
@@ -186,14 +186,14 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
reqMigStepCheckbox.setId(SPUIComponetIdProvider.DIST_ADD_MIGRATION_CHECK); reqMigStepCheckbox.setId(SPUIComponetIdProvider.DIST_ADD_MIGRATION_CHECK);
/* save or update button */ /* save or update button */
saveDistribution = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_SAVE, "", "", "", true, saveDistributionBtn = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_SAVE, "", "", "", true,
FontAwesome.SAVE, SPUIButtonStyleSmallNoBorder.class); FontAwesome.SAVE, SPUIButtonStyleSmallNoBorder.class);
saveDistribution.addClickListener(event -> saveDistribution()); saveDistributionBtn.addClickListener(event -> saveDistribution());
/* close button */ /* close button */
discardDistribution = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_DISCARD, "", "", "", true, discardDistributionBtn = SPUIComponentProvider.getButton(SPUIComponetIdProvider.DIST_ADD_DISCARD, "", "", "",
FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class); true, FontAwesome.TIMES, SPUIButtonStyleSmallNoBorder.class);
discardDistribution.addClickListener(event -> discardDistribution()); discardDistributionBtn.addClickListener(event -> discardDistribution());
} }
/** /**
@@ -216,7 +216,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
} }
private void enableSaveButton() { private void enableSaveButton() {
saveDistribution.setEnabled(true); saveDistributionBtn.setEnabled(true);
} }
private DistributionSetType getDefaultDistributionSetType() { private DistributionSetType getDefaultDistributionSetType() {
@@ -226,7 +226,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
} }
private void disableSaveButton() { private void disableSaveButton() {
saveDistribution.setEnabled(false); saveDistributionBtn.setEnabled(false);
} }
private void saveDistribution() { private void saveDistribution() {
@@ -415,7 +415,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
distsetTypeNameComboBox.removeStyleName(SPUIStyleDefinitions.SP_COMBOFIELD_ERROR); distsetTypeNameComboBox.removeStyleName(SPUIStyleDefinitions.SP_COMBOFIELD_ERROR);
descTextArea.clear(); descTextArea.clear();
reqMigStepCheckbox.clear(); reqMigStepCheckbox.clear();
saveDistribution.setEnabled(true); saveDistributionBtn.setEnabled(true);
removeListeners(); removeListeners();
changedComponents.clear(); changedComponents.clear();
} }
@@ -497,7 +497,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
public void populateValuesOfDistribution(final Long editDistId) { public void populateValuesOfDistribution(final Long editDistId) {
this.editDistId = editDistId; this.editDistId = editDistId;
editDistribution = Boolean.TRUE; editDistribution = Boolean.TRUE;
saveDistribution.setEnabled(false); saveDistributionBtn.setEnabled(false);
final DistributionSet distSet = distributionSetManagement.findDistributionSetByIdWithDetails(editDistId); final DistributionSet distSet = distributionSetManagement.findDistributionSetByIdWithDetails(editDistId);
if (distSet != null) { if (distSet != null) {
distNameTextField.setValue(distSet.getName()); distNameTextField.setValue(distSet.getName());

View File

@@ -62,20 +62,20 @@ public class ManagementUIState implements Serializable {
private boolean distTagFilterClosed = true; private boolean distTagFilterClosed = true;
private Long targetsTruncated = null; private Long targetsTruncated;
private final AtomicLong targetsCountAll = new AtomicLong(); private final AtomicLong targetsCountAll = new AtomicLong();
private boolean isDsTableMaximized = Boolean.FALSE; private boolean dsTableMaximized = Boolean.FALSE;
// Contains ID and NAme of last selected target // Contains ID and NAme of last selected target
private DistributionSetIdName lastSelectedDsIdName; private DistributionSetIdName lastSelectedDsIdName;
// Contains list of ID and Names of all the selected Targets // Contains list of ID and Names of all the selected Targets
private Set<DistributionSetIdName> selectedDsIdName = Collections.emptySet(); private Set<DistributionSetIdName> selectedDsIdName = Collections.emptySet();
private boolean isTargetTableMaximized = Boolean.FALSE; private boolean targetTableMaximized = Boolean.FALSE;
private boolean isActionHistoryMaximized = Boolean.FALSE; private boolean actionHistoryMaximized = Boolean.FALSE;
private boolean noDataAvilableTarget = Boolean.FALSE; private boolean noDataAvilableTarget = Boolean.FALSE;
@@ -255,11 +255,11 @@ public class ManagementUIState implements Serializable {
} }
public boolean isDsTableMaximized() { public boolean isDsTableMaximized() {
return isDsTableMaximized; return dsTableMaximized;
} }
public void setDsTableMaximized(final boolean isDsTableMaximized) { public void setDsTableMaximized(final boolean isDsTableMaximized) {
this.isDsTableMaximized = isDsTableMaximized; this.dsTableMaximized = isDsTableMaximized;
} }
public DistributionSetIdName getLastSelectedDsIdName() { public DistributionSetIdName getLastSelectedDsIdName() {
@@ -282,7 +282,7 @@ public class ManagementUIState implements Serializable {
* @return the isTargetTableMaximized * @return the isTargetTableMaximized
*/ */
public boolean isTargetTableMaximized() { public boolean isTargetTableMaximized() {
return isTargetTableMaximized; return targetTableMaximized;
} }
/** /**
@@ -290,14 +290,14 @@ public class ManagementUIState implements Serializable {
* the isTargetTableMaximized to set * the isTargetTableMaximized to set
*/ */
public void setTargetTableMaximized(final boolean isTargetTableMaximized) { public void setTargetTableMaximized(final boolean isTargetTableMaximized) {
this.isTargetTableMaximized = isTargetTableMaximized; this.targetTableMaximized = isTargetTableMaximized;
} }
/** /**
* @return the isActionHistoryMaximized * @return the isActionHistoryMaximized
*/ */
public boolean isActionHistoryMaximized() { public boolean isActionHistoryMaximized() {
return isActionHistoryMaximized; return actionHistoryMaximized;
} }
/** /**
@@ -305,7 +305,7 @@ public class ManagementUIState implements Serializable {
* the isActionHistoryMaximized to set * the isActionHistoryMaximized to set
*/ */
public void setActionHistoryMaximized(final boolean isActionHistoryMaximized) { public void setActionHistoryMaximized(final boolean isActionHistoryMaximized) {
this.isActionHistoryMaximized = isActionHistoryMaximized; this.actionHistoryMaximized = isActionHistoryMaximized;
} }
/** /**

View File

@@ -128,9 +128,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private TextArea description; private TextArea description;
private Button saveRollout; private Button saveRolloutBtn;
private Button discardRolllout; private Button discardRollloutBtn;
private OptionGroup errorThresholdOptionGroup; private OptionGroup errorThresholdOptionGroup;
@@ -138,7 +138,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private Window addUpdateRolloutWindow; private Window addUpdateRolloutWindow;
private Boolean editRollout; private Boolean editRolloutEnabled;
private Rollout rolloutForEdit; private Rollout rolloutForEdit;
@@ -167,7 +167,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
* Reset the field values. * Reset the field values.
*/ */
public void resetComponents() { public void resetComponents() {
editRollout = Boolean.FALSE; editRolloutEnabled = Boolean.FALSE;
rolloutName.clear(); rolloutName.clear();
targetFilterQuery.clear(); targetFilterQuery.clear();
resetFields(); resetFields();
@@ -212,7 +212,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
final HorizontalLayout groupLayout = new HorizontalLayout(); final HorizontalLayout groupLayout = new HorizontalLayout();
groupLayout.setSizeFull(); groupLayout.setSizeFull();
groupLayout.addComponents(noOfGroups, groupSizeLabel); groupLayout.addComponents(noOfGroups, groupSizeLabel);
groupLayout.setExpandRatio(noOfGroups, 1.0f); groupLayout.setExpandRatio(noOfGroups, 1.0F);
groupLayout.setComponentAlignment(groupSizeLabel, Alignment.MIDDLE_LEFT); groupLayout.setComponentAlignment(groupSizeLabel, Alignment.MIDDLE_LEFT);
return groupLayout; return groupLayout;
} }
@@ -221,7 +221,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
final HorizontalLayout errorThresoldLayout = new HorizontalLayout(); final HorizontalLayout errorThresoldLayout = new HorizontalLayout();
errorThresoldLayout.setSizeFull(); errorThresoldLayout.setSizeFull();
errorThresoldLayout.addComponents(errorThreshold, errorThresholdOptionGroup); errorThresoldLayout.addComponents(errorThreshold, errorThresholdOptionGroup);
errorThresoldLayout.setExpandRatio(errorThreshold, 1.0f); errorThresoldLayout.setExpandRatio(errorThreshold, 1.0F);
return errorThresoldLayout; return errorThresoldLayout;
} }
@@ -229,9 +229,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
final HorizontalLayout targetFilterLayout = new HorizontalLayout(); final HorizontalLayout targetFilterLayout = new HorizontalLayout();
targetFilterLayout.setSizeFull(); targetFilterLayout.setSizeFull();
targetFilterLayout.addComponents(targetFilterQueryCombo, targetFilterQuery, totalTargetsLabel); targetFilterLayout.addComponents(targetFilterQueryCombo, targetFilterQuery, totalTargetsLabel);
targetFilterLayout.setExpandRatio(targetFilterQueryCombo, 0.71f); targetFilterLayout.setExpandRatio(targetFilterQueryCombo, 0.71F);
targetFilterLayout.setExpandRatio(targetFilterQuery, 0.70f); targetFilterLayout.setExpandRatio(targetFilterQuery, 0.70F);
targetFilterLayout.setExpandRatio(totalTargetsLabel, 0.29f); targetFilterLayout.setExpandRatio(totalTargetsLabel, 0.29F);
targetFilterLayout.setComponentAlignment(totalTargetsLabel, Alignment.MIDDLE_LEFT); targetFilterLayout.setComponentAlignment(totalTargetsLabel, Alignment.MIDDLE_LEFT);
return targetFilterLayout; return targetFilterLayout;
} }
@@ -240,7 +240,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
final HorizontalLayout triggerThresholdLayout = new HorizontalLayout(); final HorizontalLayout triggerThresholdLayout = new HorizontalLayout();
triggerThresholdLayout.setSizeFull(); triggerThresholdLayout.setSizeFull();
triggerThresholdLayout.addComponents(triggerThreshold, getPercentHintLabel()); triggerThresholdLayout.addComponents(triggerThreshold, getPercentHintLabel());
triggerThresholdLayout.setExpandRatio(triggerThreshold, 1.0f); triggerThresholdLayout.setExpandRatio(triggerThreshold, 1.0F);
return triggerThresholdLayout; return triggerThresholdLayout;
} }
@@ -254,9 +254,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private HorizontalLayout getSaveDiscardButtonLayout() { private HorizontalLayout getSaveDiscardButtonLayout() {
final HorizontalLayout buttonsLayout = new HorizontalLayout(); final HorizontalLayout buttonsLayout = new HorizontalLayout();
buttonsLayout.setSizeFull(); buttonsLayout.setSizeFull();
buttonsLayout.addComponents(saveRollout, discardRolllout); buttonsLayout.addComponents(saveRolloutBtn, discardRollloutBtn);
buttonsLayout.setComponentAlignment(saveRollout, Alignment.BOTTOM_LEFT); buttonsLayout.setComponentAlignment(saveRolloutBtn, Alignment.BOTTOM_LEFT);
buttonsLayout.setComponentAlignment(discardRolllout, Alignment.BOTTOM_RIGHT); buttonsLayout.setComponentAlignment(discardRollloutBtn, Alignment.BOTTOM_RIGHT);
buttonsLayout.addStyleName("window-style"); buttonsLayout.addStyleName("window-style");
return buttonsLayout; return buttonsLayout;
} }
@@ -277,8 +277,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
description = createDescription(); description = createDescription();
errorThresholdOptionGroup = createErrorThresholdOptionGroup(); errorThresholdOptionGroup = createErrorThresholdOptionGroup();
setDefaultSaveStartGroupOption(); setDefaultSaveStartGroupOption();
saveRollout = createSaveButton(); saveRolloutBtn = createSaveButton();
discardRolllout = createDiscardButton(); discardRollloutBtn = createDiscardButton();
actionTypeOptionGroupLayout.selectDefaultOption(); actionTypeOptionGroupLayout.selectDefaultOption();
totalTargetsLabel = createTotalTargetsLabel(); totalTargetsLabel = createTotalTargetsLabel();
@@ -383,8 +383,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private Container createTargetFilterComboContainer() { private Container createTargetFilterComboContainer() {
final BeanQueryFactory<TargetFilterBeanQuery> targetFilterQF = new BeanQueryFactory<>( final BeanQueryFactory<TargetFilterBeanQuery> targetFilterQF = new BeanQueryFactory<>(
TargetFilterBeanQuery.class); TargetFilterBeanQuery.class);
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, return new LazyQueryContainer(
SPUILabelDefinitions.VAR_NAME), targetFilterQF); new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_NAME),
targetFilterQF);
} }
@@ -410,7 +411,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
} }
private void onRolloutSave() { private void onRolloutSave() {
if (editRollout) { if (editRolloutEnabled) {
editRollout(); editRollout();
} else { } else {
createRollout(); createRollout();
@@ -422,8 +423,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
rolloutForEdit.setName(rolloutName.getValue()); rolloutForEdit.setName(rolloutName.getValue());
rolloutForEdit.setDescription(description.getValue()); rolloutForEdit.setDescription(description.getValue());
final DistributionSetIdName distributionSetIdName = (DistributionSetIdName) distributionSet.getValue(); final DistributionSetIdName distributionSetIdName = (DistributionSetIdName) distributionSet.getValue();
rolloutForEdit.setDistributionSet(distributionSetManagement.findDistributionSetById(distributionSetIdName rolloutForEdit.setDistributionSet(
.getId())); distributionSetManagement.findDistributionSetById(distributionSetIdName.getId()));
rolloutForEdit.setActionType(getActionType()); rolloutForEdit.setActionType(getActionType());
rolloutForEdit.setForcedTime(getForcedTimeStamp()); rolloutForEdit.setForcedTime(getForcedTimeStamp());
final int amountGroup = Integer.parseInt(noOfGroups.getValue()); final int amountGroup = Integer.parseInt(noOfGroups.getValue());
@@ -453,8 +454,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private long getForcedTimeStamp() { private long getForcedTimeStamp() {
return (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup() return (((ActionTypeOptionGroupLayout.ActionTypeOption) actionTypeOptionGroupLayout.getActionTypeOptionGroup()
.getValue()) == ActionTypeOption.AUTO_FORCED) ? actionTypeOptionGroupLayout.getForcedTimeDateField() .getValue()) == ActionTypeOption.AUTO_FORCED)
.getValue().getTime() : Action.NO_FORCE_TIME; ? actionTypeOptionGroupLayout.getForcedTimeDateField().getValue().getTime()
: Action.NO_FORCE_TIME;
} }
private ActionType getActionType() { private ActionType getActionType() {
@@ -487,8 +489,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
rolloutToCreate.setName(rolloutName.getValue()); rolloutToCreate.setName(rolloutName.getValue());
rolloutToCreate.setDescription(description.getValue()); rolloutToCreate.setDescription(description.getValue());
rolloutToCreate.setTargetFilterQuery(targetFilter); rolloutToCreate.setTargetFilterQuery(targetFilter);
rolloutToCreate.setDistributionSet(distributionSetManagement.findDistributionSetById(distributionSetIdName rolloutToCreate
.getId())); .setDistributionSet(distributionSetManagement.findDistributionSetById(distributionSetIdName.getId()));
rolloutToCreate.setActionType(getActionType()); rolloutToCreate.setActionType(getActionType());
rolloutToCreate.setForcedTime(getForcedTimeStamp()); rolloutToCreate.setForcedTime(getForcedTimeStamp());
@@ -499,8 +501,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private String getTargetFilterQuery() { private String getTargetFilterQuery() {
if (null != targetFilterQueryCombo.getValue() if (null != targetFilterQueryCombo.getValue()
&& HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) != null) { && HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) != null) {
final Item filterItem = targetFilterQueryCombo.getContainerDataSource().getItem( final Item filterItem = targetFilterQueryCombo.getContainerDataSource()
targetFilterQueryCombo.getValue()); .getItem(targetFilterQueryCombo.getValue());
return (String) filterItem.getItemProperty("query").getValue(); return (String) filterItem.getItemProperty("query").getValue();
} }
return null; return null;
@@ -568,8 +570,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private boolean duplicateCheck() { private boolean duplicateCheck() {
if (rolloutManagement.findRolloutByName(getRolloutName()) != null) { if (rolloutManagement.findRolloutByName(getRolloutName()) != null) {
uiNotification.displayValidationError(i18n.get("message.rollout.duplicate.check", uiNotification.displayValidationError(
new Object[] { getRolloutName() })); i18n.get("message.rollout.duplicate.check", new Object[] { getRolloutName() }));
return false; return false;
} }
return true; return true;
@@ -580,9 +582,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
} }
private TextArea createDescription() { private TextArea createDescription() {
final TextArea descriptionField = SPUIComponentProvider.getTextArea("text-area-style", final TextArea descriptionField = SPUIComponentProvider.getTextArea("text-area-style", ValoTheme.TEXTFIELD_TINY,
ValoTheme.TEXTFIELD_TINY, false, null, i18n.get("textfield.description"), false, null, i18n.get("textfield.description"), SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
SPUILabelDefinitions.TEXT_AREA_MAX_LENGTH);
descriptionField.setId(SPUIComponetIdProvider.ROLLOUT_DESCRIPTION_ID); descriptionField.setId(SPUIComponetIdProvider.ROLLOUT_DESCRIPTION_ID);
descriptionField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY); descriptionField.setNullRepresentation(HawkbitCommonUtil.SP_STRING_EMPTY);
descriptionField.setSizeFull(); descriptionField.setSizeFull();
@@ -647,8 +648,9 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
private Container createDsComboContainer() { private Container createDsComboContainer() {
final BeanQueryFactory<DistBeanQuery> distributionQF = new BeanQueryFactory<>(DistBeanQuery.class); final BeanQueryFactory<DistBeanQuery> distributionQF = new BeanQueryFactory<>(DistBeanQuery.class);
return new LazyQueryContainer(new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, return new LazyQueryContainer(
SPUILabelDefinitions.VAR_DIST_ID_NAME), distributionQF); new LazyQueryDefinition(true, SPUIDefinitions.PAGE_SIZE, SPUILabelDefinitions.VAR_DIST_ID_NAME),
distributionQF);
} }
@@ -682,8 +684,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
try { try {
if (HawkbitCommonUtil.trimAndNullIfEmpty(noOfGroups.getValue()) == null if (HawkbitCommonUtil.trimAndNullIfEmpty(noOfGroups.getValue()) == null
|| HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) == null) { || HawkbitCommonUtil.trimAndNullIfEmpty((String) targetFilterQueryCombo.getValue()) == null) {
uiNotification.displayValidationError(i18n uiNotification
.get("message.rollout.noofgroups.or.targetfilter.missing")); .displayValidationError(i18n.get("message.rollout.noofgroups.or.targetfilter.missing"));
} else { } else {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value); new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
final int groupSize = getGroupSize(); final int groupSize = getGroupSize();
@@ -708,8 +710,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
public void validate(final Object value) { public void validate(final Object value) {
try { try {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value); new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 100), 0, 100).validate(Integer new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 100), 0, 100)
.valueOf(value.toString())); .validate(Integer.valueOf(value.toString()));
} catch (final InvalidValueException ex) { } catch (final InvalidValueException ex) {
throw ex; throw ex;
} }
@@ -723,8 +725,8 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
public void validate(final Object value) { public void validate(final Object value) {
try { try {
new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value); new RegexpValidator(NUMBER_REGEXP, i18n.get(MESSAGE_ENTER_NUMBER)).validate(value);
new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 500), 0, 500).validate(Integer new IntegerRangeValidator(i18n.get(MESSAGE_ROLLOUT_FIELD_VALUE_RANGE, 0, 500), 0, 500)
.valueOf(value.toString())); .validate(Integer.valueOf(value.toString()));
} catch (final InvalidValueException ex) { } catch (final InvalidValueException ex) {
throw ex; throw ex;
} }
@@ -740,7 +742,7 @@ public class AddUpdateRolloutWindowLayout extends CustomComponent {
*/ */
public void populateData(final Long rolloutId) { public void populateData(final Long rolloutId) {
resetComponents(); resetComponents();
editRollout = Boolean.TRUE; editRolloutEnabled = Boolean.TRUE;
rolloutForEdit = rolloutManagement.findRolloutById(rolloutId); rolloutForEdit = rolloutManagement.findRolloutById(rolloutId);
rolloutName.setValue(rolloutForEdit.getName()); rolloutName.setValue(rolloutForEdit.getName());
description.setValue(rolloutForEdit.getDescription()); description.setValue(rolloutForEdit.getDescription());

View File

@@ -86,7 +86,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
gatewayTokenNameTextField.setImmediate(true); gatewayTokenNameTextField.setImmediate(true);
// hide text field until we support multiple gateway tokens for a tenan // hide text field until we support multiple gateway tokens for a tenan
gatewayTokenNameTextField.setVisible(false); gatewayTokenNameTextField.setVisible(false);
gatewayTokenNameTextField.addTextChangeListener(event -> keyNameChanged()); gatewayTokenNameTextField.addTextChangeListener(event -> doKeyNameChanged());
final Button gatewaytokenBtn = SPUIComponentProvider.getButton("TODO-ID", "Regenerate Key", "", final Button gatewaytokenBtn = SPUIComponentProvider.getButton("TODO-ID", "Regenerate Key", "",
ValoTheme.BUTTON_TINY + " " + "redicon", true, null, SPUIButtonStyleSmall.class); ValoTheme.BUTTON_TINY + " " + "redicon", true, null, SPUIButtonStyleSmall.class);
@@ -116,10 +116,7 @@ public class GatewaySecurityTokenAuthenticationConfigurationItem extends Abstrac
} }
} }
/** private void doKeyNameChanged() {
* @return
*/
private void keyNameChanged() {
keyNameChanged = true; keyNameChanged = true;
notifyConfigurationChanged(); notifyConfigurationChanged();
} }