Improvements repository validation constraints (#626)
* Add html tag Validator on strings. Add string trim. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Revert unintended changes. Sonar issues. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Remove weired comment. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Raise EclipseLink due to validation problem. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix permission. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Colour field test. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com> * Fix sonar issues. Signed-off-by: kaizimmerm <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -52,7 +52,7 @@
|
||||
|org.apache.tomcat|tomcat-juli|8.0.28| [CQ10618](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10618) |
|
||||
|org.flywaydb|flyway-core|4.0.3| [CQ12947](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12947) |
|
||||
|org.glassfish|javax.json|1.0.4| [CQ10619](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10619) |
|
||||
|org.hibernate|hibernate-validator|5.2.2.Final| [CQ10371](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10371) |
|
||||
|org.hibernate|hibernate-validator|6.0.7.Final| [CQ15540](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=15540) |
|
||||
|org.jboss.logging|jboss-logging|3.2.1.Final| [CQ10621](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=10621) |
|
||||
|org.jsoup|jsoup|1.8.3| [CQ12936](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12936) |
|
||||
|org.ow2.asm|asm-commons|5.0.1| [CQ12945](https://dev.eclipse.org/ipzilla/show_bug.cgi?id=12945) |
|
||||
|
||||
@@ -1,41 +1,42 @@
|
||||
aopalliance:aopalliance:jar:1.0:compile
|
||||
ch.qos.logback:logback-classic:jar:1.1.3:compile
|
||||
ch.qos.logback:logback-core:jar:1.1.3:compile
|
||||
com.fasterxml.jackson.core:jackson-annotations:jar:2.8.2:compile
|
||||
com.fasterxml.jackson.core:jackson-core:jar:2.8.2:compile
|
||||
com.fasterxml.jackson.core:jackson-databind:jar:2.8.2:compile
|
||||
com.fasterxml:classmate:jar:1.3.0:compile
|
||||
ch.qos.logback:logback-classic:jar:1.1.11:compile
|
||||
ch.qos.logback:logback-core:jar:1.1.11:compile
|
||||
com.fasterxml.jackson.core:jackson-annotations:jar:2.8.9:compile
|
||||
com.fasterxml.jackson.core:jackson-core:jar:2.8.9:compile
|
||||
com.fasterxml.jackson.core:jackson-databind:jar:2.8.9:compile
|
||||
com.fasterxml:classmate:jar:1.3.3:compile
|
||||
com.github.ben-manes.caffeine:caffeine:jar:2.3.5:compile
|
||||
com.github.gwtd3:gwt-d3-api:jar:1.2.0:compile
|
||||
com.github.gwtd3:gwt-d3-js:jar:3.5.11:compile
|
||||
com.github.gwtd3:gwt-d3-js:jar:sources:3.5.11:compile
|
||||
com.google.guava:guava:jar:19.0:compile
|
||||
com.h2database:h2:jar:1.4.186:compile
|
||||
com.rabbitmq:amqp-client:jar:4.0.2:compile
|
||||
com.h2database:h2:jar:1.4.195:compile
|
||||
com.rabbitmq:amqp-client:jar:4.0.3:compile
|
||||
com.rabbitmq:http-client:jar:1.1.1.RELEASE:compile
|
||||
com.vaadin.external.atmosphere:atmosphere-runtime:jar:2.2.9.vaadin2:compile
|
||||
com.vaadin.external.flute:flute:jar:1.3.0.gg2:compile
|
||||
com.vaadin.external.gwt:gwt-elemental:jar:2.7.0.vaadin4:compile
|
||||
com.vaadin.external.gwt:gwt-user:jar:2.7.0.vaadin4:compile
|
||||
com.vaadin.external.gwt:gwt-elemental:jar:2.7.0.vaadin5:compile
|
||||
com.vaadin.external.gwt:gwt-user:jar:2.7.0.vaadin5:compile
|
||||
com.vaadin.external.slf4j:vaadin-slf4j-jdk14:jar:1.6.1:compile
|
||||
com.vaadin:vaadin-client:jar:7.7.7:compile
|
||||
com.vaadin:vaadin-push:jar:7.7.7:compile
|
||||
com.vaadin:vaadin-client:jar:7.7.9:compile
|
||||
com.vaadin:vaadin-push:jar:7.7.9:compile
|
||||
com.vaadin:vaadin-sass-compiler:jar:0.9.13:compile
|
||||
com.vaadin:vaadin-server:jar:7.7.7:compile
|
||||
com.vaadin:vaadin-shared:jar:7.7.7:compile
|
||||
com.vaadin:vaadin-server:jar:7.7.9:compile
|
||||
com.vaadin:vaadin-shared:jar:7.7.9:compile
|
||||
com.vaadin:vaadin-spring-boot:jar:1.1.1:compile
|
||||
com.vaadin:vaadin-spring:jar:1.1.1:compile
|
||||
com.vaadin:vaadin-themes:jar:7.7.7:compile
|
||||
com.vaadin:vaadin-themes:jar:7.7.9:compile
|
||||
commons-codec:commons-codec:jar:1.10:compile
|
||||
commons-io:commons-io:jar:2.4:compile
|
||||
cz.jirutka.rsql:rsql-parser:jar:2.1.0:compile
|
||||
io.protostuff:protostuff-api:jar:1.5.3:compile
|
||||
io.protostuff:protostuff-collectionschema:jar:1.5.3:compile
|
||||
io.protostuff:protostuff-core:jar:1.5.3:compile
|
||||
io.protostuff:protostuff-runtime:jar:1.5.3:compile
|
||||
io.protostuff:protostuff-api:jar:1.5.6:compile
|
||||
io.protostuff:protostuff-collectionschema:jar:1.5.6:compile
|
||||
io.protostuff:protostuff-core:jar:1.5.6:compile
|
||||
io.protostuff:protostuff-runtime:jar:1.5.6:compile
|
||||
javax.annotation:javax.annotation-api:jar:1.2:compile
|
||||
javax.servlet:javax.servlet-api:jar:3.1.0:compile
|
||||
javax.transaction:javax.transaction-api:jar:1.2:compile
|
||||
javax.validation:validation-api:jar:1.1.0.Final:compile
|
||||
javax.validation:validation-api:jar:2.0.1.Final:compile
|
||||
javax.validation:validation-api:jar:sources:1.0.0.GA:compile
|
||||
javax.websocket:javax.websocket-api:jar:1.0:compile
|
||||
org.apache.commons:commons-lang3:jar:3.4:compile
|
||||
@@ -44,64 +45,64 @@
|
||||
org.apache.tomcat.embed:tomcat-embed-el:jar:8.0.28:compile
|
||||
org.apache.tomcat:tomcat-jdbc:jar:8.0.28:compile
|
||||
org.apache.tomcat:tomcat-juli:jar:8.0.28:compile
|
||||
org.aspectj:aspectjweaver:jar:1.8.9:compile
|
||||
org.aspectj:aspectjweaver:jar:1.8.10:compile
|
||||
org.flywaydb:flyway-core:jar:4.0.3:compile
|
||||
org.glassfish:javax.json:jar:1.0.4:compile
|
||||
org.hibernate:hibernate-validator:jar:5.2.2.Final:compile
|
||||
org.hibernate.validator:hibernate-validator:jar:6.0.7.Final:compile
|
||||
org.jboss.logging:jboss-logging:jar:3.2.1.Final:compile
|
||||
org.jsoup:jsoup:jar:1.8.3:compile
|
||||
org.mortbay.jasper:apache-el:jar:8.0.33:compile
|
||||
org.ow2.asm:asm-commons:jar:5.0.1:compile
|
||||
org.ow2.asm:asm-tree:jar:5.0.1:compile
|
||||
org.ow2.asm:asm:jar:5.0.1:compile
|
||||
org.slf4j:jcl-over-slf4j:jar:1.7.22:compile
|
||||
org.slf4j:jul-to-slf4j:jar:1.7.22:compile
|
||||
org.slf4j:log4j-over-slf4j:jar:1.7.22:compile
|
||||
org.slf4j:slf4j-api:jar:1.7.22:compile
|
||||
org.springframework.amqp:spring-amqp:jar:1.7.1.RELEASE:compile
|
||||
org.springframework.amqp:spring-rabbit:jar:1.7.1.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-actuator:jar:1.4.5.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-autoconfigure:jar:1.4.5.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-actuator:jar:1.4.5.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-aop:jar:1.4.5.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-data-jpa:jar:1.4.5.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.5.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-jetty:jar:1.4.5.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-logging:jar:1.4.5.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-validation:jar:1.4.5.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-web:jar:1.4.5.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter:jar:1.4.5.RELEASE:compile
|
||||
org.springframework.boot:spring-boot:jar:1.4.5.RELEASE:compile
|
||||
org.slf4j:jcl-over-slf4j:jar:1.7.25:compile
|
||||
org.slf4j:jul-to-slf4j:jar:1.7.25:compile
|
||||
org.slf4j:log4j-over-slf4j:jar:1.7.25:compile
|
||||
org.slf4j:slf4j-api:jar:1.7.25:compile
|
||||
org.springframework.amqp:spring-amqp:jar:1.7.4.RELEASE:compile
|
||||
org.springframework.amqp:spring-rabbit:jar:1.7.4.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-actuator:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-autoconfigure:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-actuator:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-aop:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-data-jpa:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-jdbc:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-jetty:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-logging:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-validation:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter-web:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.boot:spring-boot-starter:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.boot:spring-boot:jar:1.4.7.RELEASE:compile
|
||||
org.springframework.cloud:spring-cloud-bus:jar:1.2.2.RELEASE:compile
|
||||
org.springframework.cloud:spring-cloud-context:jar:1.1.8.RELEASE:compile
|
||||
org.springframework.cloud:spring-cloud-stream:jar:1.1.2.RELEASE:compile
|
||||
org.springframework.data:spring-data-commons:jar:1.12.8.RELEASE:compile
|
||||
org.springframework.data:spring-data-jpa:jar:1.10.8.RELEASE:compile
|
||||
org.springframework.data:spring-data-commons:jar:1.12.11.RELEASE:compile
|
||||
org.springframework.data:spring-data-jpa:jar:1.10.11.RELEASE:compile
|
||||
org.springframework.hateoas:spring-hateoas:jar:0.23.0.RELEASE:compile
|
||||
org.springframework.integration:spring-integration-core:jar:4.3.8.RELEASE:compile
|
||||
org.springframework.integration:spring-integration-jmx:jar:4.3.8.RELEASE:compile
|
||||
org.springframework.integration:spring-integration-core:jar:4.3.10.RELEASE:compile
|
||||
org.springframework.integration:spring-integration-jmx:jar:4.3.10.RELEASE:compile
|
||||
org.springframework.integration:spring-integration-tuple:jar:1.0.0.RELEASE:compile
|
||||
org.springframework.plugin:spring-plugin-core:jar:1.2.0.RELEASE:compile
|
||||
org.springframework.retry:spring-retry:jar:1.1.2.RELEASE:compile
|
||||
org.springframework.retry:spring-retry:jar:1.1.5.RELEASE:compile
|
||||
org.springframework.security:spring-security-aspects:jar:4.1.4.RELEASE:compile
|
||||
org.springframework.security:spring-security-config:jar:4.1.4.RELEASE:compile
|
||||
org.springframework.security:spring-security-core:jar:4.1.4.RELEASE:compile
|
||||
org.springframework.security:spring-security-crypto:jar:4.1.4.RELEASE:compile
|
||||
org.springframework.security:spring-security-web:jar:4.1.4.RELEASE:compile
|
||||
org.springframework:spring-aop:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-aspects:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-beans:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-context-support:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-context:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-core:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-expression:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-jdbc:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-messaging:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-orm:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-aop:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-aspects:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-beans:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-context-support:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-context:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-core:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-expression:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-jdbc:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-messaging:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-orm:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-tuple:jar:1.0.0.RELEASE:compile
|
||||
org.springframework:spring-tx:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-web:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-webmvc:jar:4.3.7.RELEASE:compile
|
||||
org.springframework:spring-tx:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-web:jar:4.3.9.RELEASE:compile
|
||||
org.springframework:spring-webmvc:jar:4.3.9.RELEASE:compile
|
||||
org.vaadin.addons.lazyquerycontainer:vaadin-lazyquerycontainer:jar:7.6.1.3:compile
|
||||
org.vaadin.addons:flexibleoptiongroup:jar:2.2.0:compile
|
||||
org.vaadin.addons:tokenfield:jar:7.0.1:compile
|
||||
|
||||
@@ -32,10 +32,6 @@
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
|
||||
@@ -10,11 +10,11 @@ package org.eclipse.hawkbit.artifact.repository;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
|
||||
import org.eclipse.hawkbit.artifact.repository.model.DbArtifactHash;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* ArtifactRepository service interface.
|
||||
|
||||
@@ -48,20 +48,26 @@ public class DownloadArtifactCache {
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj)
|
||||
if (this == obj) {
|
||||
return true;
|
||||
if (obj == null)
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final DownloadArtifactCache other = (DownloadArtifactCache) obj;
|
||||
if (downloadType != other.downloadType)
|
||||
if (downloadType != other.downloadType) {
|
||||
return false;
|
||||
}
|
||||
if (id == null) {
|
||||
if (other.id != null)
|
||||
if (other.id != null) {
|
||||
return false;
|
||||
} else if (!id.equals(other.id))
|
||||
}
|
||||
} else if (!id.equals(other.id)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,11 +90,11 @@ public class TenantAwareCacheManager implements TenancyCacheManager {
|
||||
getCacheNames(tenant).forEach(cachename -> delegate.getCache(buildKey(tenant, cachename)).clear());
|
||||
}
|
||||
|
||||
private boolean isTenantInvalid(final String tenant) {
|
||||
private static boolean isTenantInvalid(final String tenant) {
|
||||
return tenant == null || tenant.contains(TENANT_CACHE_DELIMITER);
|
||||
}
|
||||
|
||||
private String buildKey(final String tenant, final String cacheName) {
|
||||
private static String buildKey(final String tenant, final String cacheName) {
|
||||
return tenant + TENANT_CACHE_DELIMITER + cacheName;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ package org.eclipse.hawkbit.ddi.json.model;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.lang.annotation.Target;
|
||||
import java.util.List;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiActionFeedback;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiArtifact;
|
||||
@@ -20,7 +21,6 @@ import org.eclipse.hawkbit.ddi.json.model.DdiCancel;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiConfigData;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiControllerBase;
|
||||
import org.eclipse.hawkbit.ddi.json.model.DdiDeploymentBase;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.hateoas.MediaTypes;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
|
||||
@@ -80,8 +80,7 @@ public final class DataConversionHelper {
|
||||
return key;
|
||||
}
|
||||
|
||||
static List<DdiArtifact> createArtifacts(final Target target,
|
||||
final org.eclipse.hawkbit.repository.model.SoftwareModule module,
|
||||
static List<DdiArtifact> createArtifacts(final Target target, final SoftwareModule module,
|
||||
final ArtifactUrlHandler artifactUrlHandler, final SystemManagement systemManagement,
|
||||
final HttpRequest request) {
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import org.eclipse.hawkbit.api.ArtifactUrlHandler;
|
||||
import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
|
||||
@@ -54,7 +55,6 @@ import org.eclipse.hawkbit.rest.util.RequestResponseContextHolder;
|
||||
import org.eclipse.hawkbit.security.HawkbitSecurityProperties;
|
||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||
import org.eclipse.hawkbit.util.IpUtil;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -552,13 +552,13 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
mvc.perform(post("/{tenant}/controller/v1/4712/deploymentBase/" + action.getId() + "/feedback",
|
||||
tenantAware.getCurrentTenant()).content(feedback).contentType(MediaType.APPLICATION_JSON)
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isOk());
|
||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||
}
|
||||
|
||||
mvc.perform(post("/{tenant}/controller/v1/4712/deploymentBase/" + action.getId() + "/feedback",
|
||||
tenantAware.getCurrentTenant()).content(feedback).contentType(MediaType.APPLICATION_JSON)
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isForbidden());
|
||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isForbidden());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -582,7 +582,7 @@ public class DdiDeploymentBaseTest extends AbstractDDiApiIntegrationTest {
|
||||
mvc.perform(post("/{tenant}/controller/v1/4712/deploymentBase/" + action.getId() + "/feedback",
|
||||
tenantAware.getCurrentTenant()).content(feedback).contentType(MediaType.APPLICATION_JSON)
|
||||
.accept(MediaType.APPLICATION_JSON))
|
||||
.andExpect(status().isForbidden());
|
||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isForbidden());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ import org.eclipse.hawkbit.security.ControllerPreAuthenticatedAnonymousFilter;
|
||||
import org.eclipse.hawkbit.security.ControllerPreAuthenticatedGatewaySecurityTokenFilter;
|
||||
import org.eclipse.hawkbit.security.ControllerPreAuthenticatedSecurityHeaderFilter;
|
||||
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
||||
import org.eclipse.hawkbit.security.DmfTenantSecurityToken;
|
||||
import org.eclipse.hawkbit.security.PreAuthTokenSourceTrustAuthenticationProvider;
|
||||
import org.eclipse.hawkbit.security.PreAuthenticationFilter;
|
||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||
import org.eclipse.hawkbit.security.DmfTenantSecurityToken;
|
||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class DelayedRequeueExceptionStrategy extends ConditionalRejectingErrorHa
|
||||
* @param delay
|
||||
* in {@link TimeUnit#MILLISECONDS} before requeue.
|
||||
*/
|
||||
public DelayedRequeueExceptionStrategy(final long delay) {
|
||||
DelayedRequeueExceptionStrategy(final long delay) {
|
||||
this.delay = delay;
|
||||
}
|
||||
|
||||
@@ -62,23 +62,23 @@ public class DelayedRequeueExceptionStrategy extends ConditionalRejectingErrorHa
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean invalidMessage(final Throwable cause) {
|
||||
private static boolean invalidMessage(final Throwable cause) {
|
||||
return doesNotExist(cause) || quotaHit(cause) || invalidContent(cause) || invalidState(cause);
|
||||
}
|
||||
|
||||
private boolean invalidState(final Throwable cause) {
|
||||
private static boolean invalidState(final Throwable cause) {
|
||||
return cause instanceof CancelActionNotAllowedException;
|
||||
}
|
||||
|
||||
private boolean quotaHit(final Throwable cause) {
|
||||
private static boolean quotaHit(final Throwable cause) {
|
||||
return cause instanceof QuotaExceededException;
|
||||
}
|
||||
|
||||
private boolean doesNotExist(final Throwable cause) {
|
||||
private static boolean doesNotExist(final Throwable cause) {
|
||||
return cause instanceof TenantNotExistException || cause instanceof EntityNotFoundException;
|
||||
}
|
||||
|
||||
private boolean invalidContent(final Throwable cause) {
|
||||
private static boolean invalidContent(final Throwable cause) {
|
||||
return cause instanceof ConstraintViolationException || cause instanceof InvalidTargetAddressException
|
||||
|| cause instanceof MessageConversionException || cause instanceof MessageHandlingException;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.amqp;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyObject;
|
||||
import static org.mockito.Matchers.anyLong;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
@@ -277,7 +277,7 @@ public class AmqpMessageHandlerServiceTest {
|
||||
@Test
|
||||
@Description("Tests the update of an action of a target without a exist action id")
|
||||
public void updateActionStatusWithoutActionId() {
|
||||
when(controllerManagementMock.findActionWithDetails(any())).thenReturn(Optional.empty());
|
||||
when(controllerManagementMock.findActionWithDetails(anyLong())).thenReturn(Optional.empty());
|
||||
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
|
||||
messageProperties.setHeader(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
|
||||
final DmfActionUpdateStatus actionUpdateStatus = new DmfActionUpdateStatus(1L, DmfActionStatus.DOWNLOAD);
|
||||
@@ -297,7 +297,7 @@ public class AmqpMessageHandlerServiceTest {
|
||||
public void updateActionStatusWithoutExistActionId() {
|
||||
final MessageProperties messageProperties = createMessageProperties(MessageType.EVENT);
|
||||
messageProperties.setHeader(MessageHeaderKey.TOPIC, EventTopic.UPDATE_ACTION_STATUS.name());
|
||||
when(controllerManagementMock.findActionWithDetails(any())).thenReturn(Optional.empty());
|
||||
when(controllerManagementMock.findActionWithDetails(anyLong())).thenReturn(Optional.empty());
|
||||
|
||||
final DmfActionUpdateStatus actionUpdateStatus = createActionUpdateStatus(DmfActionStatus.DOWNLOAD);
|
||||
final Message message = amqpMessageHandlerService.getMessageConverter().toMessage(actionUpdateStatus,
|
||||
@@ -342,7 +342,7 @@ public class AmqpMessageHandlerServiceTest {
|
||||
|
||||
final Artifact localArtifactMock = mock(Artifact.class);
|
||||
when(artifactManagementMock.findFirstBySHA1(anyString())).thenReturn(Optional.of(localArtifactMock));
|
||||
when(controllerManagementMock.getActionForDownloadByTargetAndSoftwareModule(anyObject(), anyObject()))
|
||||
when(controllerManagementMock.getActionForDownloadByTargetAndSoftwareModule(anyString(), anyLong()))
|
||||
.thenThrow(EntityNotFoundException.class);
|
||||
|
||||
// test
|
||||
@@ -396,7 +396,7 @@ public class AmqpMessageHandlerServiceTest {
|
||||
|
||||
// Mock
|
||||
final Action action = createActionWithTarget(22L, Status.FINISHED);
|
||||
when(controllerManagementMock.findActionWithDetails(any())).thenReturn(Optional.of(action));
|
||||
when(controllerManagementMock.findActionWithDetails(anyLong())).thenReturn(Optional.of(action));
|
||||
when(controllerManagementMock.addUpdateActionStatus(any())).thenReturn(action);
|
||||
final ActionStatusBuilder builder = mock(ActionStatusBuilder.class);
|
||||
final ActionStatusCreate create = mock(ActionStatusCreate.class);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class AmqpAuthenticationMessageHandlerIntegrationTest extends AbstractAmq
|
||||
|
||||
@Before
|
||||
public void testSetup() {
|
||||
enableTargetTokenAuthentification();
|
||||
enableTargetTokenAuthentication();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -393,7 +393,7 @@ public class AmqpAuthenticationMessageHandlerIntegrationTest extends AbstractAmq
|
||||
TenantConfigurationKey.AUTHENTICATION_MODE_TARGET_SECURITY_TOKEN_ENABLED, false);
|
||||
}
|
||||
|
||||
private void enableTargetTokenAuthentification() {
|
||||
private void enableTargetTokenAuthentication() {
|
||||
tenantConfigurationManagement.addOrUpdateConfiguration(TenantConfigurationKey.ANONYMOUS_DOWNLOAD_MODE_ENABLED,
|
||||
false);
|
||||
tenantConfigurationManagement.addOrUpdateConfiguration(
|
||||
|
||||
@@ -728,7 +728,8 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
|
||||
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
final DistributionSet toLongName = testdataFactory.generateDistributionSet(RandomStringUtils.randomAscii(80));
|
||||
final DistributionSet toLongName = testdataFactory
|
||||
.generateDistributionSet(RandomStringUtils.randomAlphanumeric(80));
|
||||
mvc.perform(post("/rest/v1/distributionsets").content(JsonBuilder.distributionSets(Arrays.asList(toLongName)))
|
||||
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
@@ -539,7 +539,7 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
final DistributionSetType toLongName = entityFactory.distributionSetType().create().key("test123")
|
||||
.name(RandomStringUtils.randomAscii(80)).build();
|
||||
.name(RandomStringUtils.randomAlphanumeric(80)).build();
|
||||
mvc.perform(post("/rest/v1/distributionsettypes")
|
||||
.content(JsonBuilder.distributionSetTypes(Arrays.asList(toLongName)))
|
||||
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
|
||||
@@ -431,7 +431,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
final SoftwareModule toLongName = entityFactory.softwareModule().create().type(osType)
|
||||
.name(RandomStringUtils.randomAscii(80)).build();
|
||||
.name(RandomStringUtils.randomAlphanumeric(80)).build();
|
||||
mvc.perform(post("/rest/v1/softwaremodules").content(JsonBuilder.softwareModules(Arrays.asList(toLongName)))
|
||||
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
@@ -90,11 +90,10 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
}
|
||||
|
||||
private SoftwareModuleType createTestType() {
|
||||
SoftwareModuleType testType = softwareModuleTypeManagement
|
||||
.create(entityFactory.softwareModuleType().create().key("test123").name("TestName123")
|
||||
.description("Desc123").maxAssignments(5));
|
||||
testType = softwareModuleTypeManagement.update(
|
||||
entityFactory.softwareModuleType().update(testType.getId()).description("Desc1234"));
|
||||
SoftwareModuleType testType = softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create()
|
||||
.key("test123").name("TestName123").description("Desc123").maxAssignments(5));
|
||||
testType = softwareModuleTypeManagement
|
||||
.update(entityFactory.softwareModuleType().update(testType.getId()).description("Desc1234"));
|
||||
return testType;
|
||||
}
|
||||
|
||||
@@ -251,8 +250,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
@Description("Checks the correct behaviour of /rest/v1/softwaremoduletypes/{ID} DELETE requests (soft delete scenario).")
|
||||
public void deleteSoftwareModuleTypeUsed() throws Exception {
|
||||
final SoftwareModuleType testType = createTestType();
|
||||
softwareModuleManagement.create(
|
||||
entityFactory.softwareModule().create().type(testType).name("name").version("version"));
|
||||
softwareModuleManagement
|
||||
.create(entityFactory.softwareModule().create().type(testType).name("name").version("version"));
|
||||
|
||||
assertThat(softwareModuleTypeManagement.count()).isEqualTo(4);
|
||||
|
||||
@@ -340,14 +339,13 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
mvc.perform(post("/rest/v1/softwaremoduletypes")
|
||||
.content(
|
||||
"[{\"description\":\"Desc123\",\"id\":9223372036854775807,\"key\":\"test123\",\"maxAssignments\":5}]")
|
||||
mvc.perform(post("/rest/v1/softwaremoduletypes").content(
|
||||
"[{\"description\":\"Desc123\",\"id\":9223372036854775807,\"key\":\"test123\",\"maxAssignments\":5}]")
|
||||
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
|
||||
.andExpect(status().isBadRequest());
|
||||
|
||||
final SoftwareModuleType toLongName = entityFactory.softwareModuleType().create().key("test123")
|
||||
.name(RandomStringUtils.randomAscii(80)).build();
|
||||
.name(RandomStringUtils.randomAlphanumeric(80)).build();
|
||||
mvc.perform(
|
||||
post("/rest/v1/softwaremoduletypes").content(JsonBuilder.softwareModuleTypes(Arrays.asList(toLongName)))
|
||||
.contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -372,8 +370,8 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
|
||||
public void searchSoftwareModuleTypeRsql() throws Exception {
|
||||
softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create().key("test123")
|
||||
.name("TestName123").description("Desc123").maxAssignments(5));
|
||||
softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create()
|
||||
.key("test1234").name("TestName1234").description("Desc1234").maxAssignments(5));
|
||||
softwareModuleTypeManagement.create(entityFactory.softwareModuleType().create().key("test1234")
|
||||
.name("TestName1234").description("Desc1234").maxAssignments(5));
|
||||
|
||||
final String rsqlFindLikeDs1OrDs2 = "name==TestName123,name==TestName1234";
|
||||
|
||||
|
||||
@@ -713,8 +713,8 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
|
||||
@Test
|
||||
@Description("Verfies that a properties of new targets are validated as in allowed size range.")
|
||||
public void createTargetWithInvalidPropertyBadRequest() throws Exception {
|
||||
final Target test1 = entityFactory.target().create().controllerId("id1").name(RandomStringUtils.randomAscii(80))
|
||||
.build();
|
||||
final Target test1 = entityFactory.target().create().controllerId("id1")
|
||||
.name(RandomStringUtils.randomAlphanumeric(80)).build();
|
||||
|
||||
final MvcResult mvcResult = mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING)
|
||||
.content(JsonBuilder.targets(Arrays.asList(test1), true)).contentType(MediaType.APPLICATION_JSON))
|
||||
|
||||
@@ -29,10 +29,6 @@
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.hateoas</groupId>
|
||||
<artifactId>spring-hateoas</artifactId>
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository;
|
||||
import java.io.InputStream;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
|
||||
@@ -23,7 +24,6 @@ import org.eclipse.hawkbit.repository.exception.InvalidMD5HashException;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidSHA1HashException;
|
||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.hateoas.Identifiable;
|
||||
@@ -62,8 +62,8 @@ public interface ArtifactManagement {
|
||||
* @throws EntityNotFoundException
|
||||
* if given software module does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
Artifact create(@NotNull InputStream inputStream, @NotNull Long moduleId, final String filename,
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
Artifact create(@NotNull InputStream inputStream, long moduleId, final String filename,
|
||||
final boolean overrideExisting);
|
||||
|
||||
/**
|
||||
@@ -99,8 +99,8 @@ public interface ArtifactManagement {
|
||||
* if check against provided SHA1 checksum failed
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
Artifact create(@NotNull InputStream stream, @NotNull Long moduleId, @NotEmpty String filename,
|
||||
String providedMd5Sum, String providedSha1Sum, boolean overrideExisting, String contentType);
|
||||
Artifact create(@NotNull InputStream stream, long moduleId, @NotEmpty String filename, String providedMd5Sum,
|
||||
String providedSha1Sum, boolean overrideExisting, String contentType);
|
||||
|
||||
/**
|
||||
* Garbage collects artifact binaries if only referenced by given
|
||||
@@ -116,7 +116,7 @@ public interface ArtifactManagement {
|
||||
* @return <code>true</code> if an binary was actually garbage collected
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
boolean clearArtifactBinary(@NotEmpty String artifactSha1Hash, @NotNull Long moduleId);
|
||||
boolean clearArtifactBinary(@NotEmpty String artifactSha1Hash, long moduleId);
|
||||
|
||||
/**
|
||||
* Deletes {@link Artifact} based on given id.
|
||||
@@ -129,7 +129,7 @@ public interface ArtifactManagement {
|
||||
* if artifact with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void delete(@NotNull Long id);
|
||||
void delete(long id);
|
||||
|
||||
/**
|
||||
* Searches for {@link Artifact} with given {@link Identifiable}.
|
||||
@@ -140,7 +140,7 @@ public interface ArtifactManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Artifact> get(@NotNull Long id);
|
||||
Optional<Artifact> get(long id);
|
||||
|
||||
/**
|
||||
* Find by artifact by software module id and filename.
|
||||
@@ -156,7 +156,7 @@ public interface ArtifactManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Artifact> getByFilenameAndSoftwareModule(@NotNull String filename, @NotNull Long softwareModuleId);
|
||||
Optional<Artifact> getByFilenameAndSoftwareModule(@NotNull String filename, long softwareModuleId);
|
||||
|
||||
/**
|
||||
* Find all local artifact by sha1 and return the first artifact.
|
||||
@@ -193,7 +193,7 @@ public interface ArtifactManagement {
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<Artifact> findBySoftwareModule(@NotNull Pageable pageReq, @NotNull Long swId);
|
||||
Page<Artifact> findBySoftwareModule(@NotNull Pageable pageReq, long swId);
|
||||
|
||||
/**
|
||||
* Loads {@link AbstractDbArtifact} from store for given {@link Artifact}.
|
||||
|
||||
@@ -15,6 +15,8 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -30,7 +32,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -64,7 +65,7 @@ public interface ControllerManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Action addCancelActionStatus(@NotNull ActionStatusCreate create);
|
||||
Action addCancelActionStatus(@NotNull @Valid ActionStatusCreate create);
|
||||
|
||||
/**
|
||||
* Retrieves assigned {@link SoftwareModule} of a target.
|
||||
@@ -74,7 +75,7 @@ public interface ControllerManagement {
|
||||
* @return {@link SoftwareModule} identified by ID
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<SoftwareModule> getSoftwareModule(@NotNull Long moduleId);
|
||||
Optional<SoftwareModule> getSoftwareModule(long moduleId);
|
||||
|
||||
/**
|
||||
* Retrieves {@link SoftwareModuleMetadata} where
|
||||
@@ -108,7 +109,7 @@ public interface ControllerManagement {
|
||||
* {@link ActionStatusCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
ActionStatus addInformationalActionStatus(@NotNull ActionStatusCreate create);
|
||||
ActionStatus addInformationalActionStatus(@NotNull @Valid ActionStatusCreate create);
|
||||
|
||||
/**
|
||||
* Adds an {@link ActionStatus} entry for an update {@link Action} including
|
||||
@@ -130,7 +131,7 @@ public interface ControllerManagement {
|
||||
* {@link ActionStatusCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Action addUpdateActionStatus(@NotNull ActionStatusCreate create);
|
||||
Action addUpdateActionStatus(@NotNull @Valid ActionStatusCreate create);
|
||||
|
||||
/**
|
||||
* Retrieves oldest {@link Action} that is active and assigned to a
|
||||
@@ -146,7 +147,7 @@ public interface ControllerManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Action> findOldestActiveActionByTarget(@NotNull String controllerId);
|
||||
Optional<Action> findOldestActiveActionByTarget(@NotEmpty String controllerId);
|
||||
|
||||
/**
|
||||
* Get the {@link Action} entity for given actionId with all lazy
|
||||
@@ -157,7 +158,7 @@ public interface ControllerManagement {
|
||||
* @return the corresponding {@link Action}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Action> findActionWithDetails(@NotNull Long actionId);
|
||||
Optional<Action> findActionWithDetails(long actionId);
|
||||
|
||||
/**
|
||||
* Retrieves all the {@link ActionStatus} entries of the given
|
||||
@@ -173,7 +174,7 @@ public interface ControllerManagement {
|
||||
* if action with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, @NotNull Long actionId);
|
||||
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, long actionId);
|
||||
|
||||
/**
|
||||
* Register new target in the repository (plug-and-play) and in case it
|
||||
@@ -207,8 +208,7 @@ public interface ControllerManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Optional<Action> getActionForDownloadByTargetAndSoftwareModule(@NotEmpty String controllerId,
|
||||
@NotNull Long moduleId);
|
||||
Optional<Action> getActionForDownloadByTargetAndSoftwareModule(@NotEmpty String controllerId, long moduleId);
|
||||
|
||||
/**
|
||||
* @return current {@link TenantConfigurationKey#POLLING_TIME_INTERVAL}.
|
||||
@@ -258,7 +258,7 @@ public interface ControllerManagement {
|
||||
* if target with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
boolean hasTargetArtifactAssigned(@NotNull Long targetId, @NotEmpty String sha1Hash);
|
||||
boolean hasTargetArtifactAssigned(long targetId, @NotEmpty String sha1Hash);
|
||||
|
||||
/**
|
||||
* Registers retrieved status for given {@link Target} and {@link Action} if
|
||||
@@ -275,7 +275,7 @@ public interface ControllerManagement {
|
||||
* if action with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
Action registerRetrieved(@NotNull Long actionId, String message);
|
||||
Action registerRetrieved(long actionId, String message);
|
||||
|
||||
/**
|
||||
* Updates attributes of the controller.
|
||||
@@ -321,7 +321,7 @@ public interface ControllerManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||
Optional<Target> get(@NotNull Long targetId);
|
||||
Optional<Target> get(long targetId);
|
||||
|
||||
/**
|
||||
* Retrieves the specified number of messages from action history of the
|
||||
@@ -348,5 +348,5 @@ public interface ControllerManagement {
|
||||
* @return action history.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||
List<String> getActionHistoryMessages(@NotNull Long actionId, final int messageCount);
|
||||
List<String> getActionHistoryMessages(long actionId, int messageCount);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -31,7 +32,6 @@ import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -68,7 +68,7 @@ public interface DeploymentManagement {
|
||||
* do not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID, @NotNull ActionType actionType,
|
||||
DistributionSetAssignmentResult assignDistributionSet(long dsID, @NotNull ActionType actionType,
|
||||
long forcedTimestamp, @NotEmpty Collection<String> controllerIDs);
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ public interface DeploymentManagement {
|
||||
* do not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID,
|
||||
DistributionSetAssignmentResult assignDistributionSet(long dsID,
|
||||
@NotEmpty Collection<TargetWithActionType> targets);
|
||||
|
||||
/**
|
||||
@@ -114,7 +114,7 @@ public interface DeploymentManagement {
|
||||
* do not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||
DistributionSetAssignmentResult assignDistributionSet(@NotNull Long dsID,
|
||||
DistributionSetAssignmentResult assignDistributionSet(long dsID,
|
||||
@NotEmpty Collection<TargetWithActionType> targets, String actionMessage);
|
||||
|
||||
/**
|
||||
@@ -167,7 +167,7 @@ public interface DeploymentManagement {
|
||||
* if action with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
Action cancelAction(@NotNull Long actionId);
|
||||
Action cancelAction(long actionId);
|
||||
|
||||
/**
|
||||
* counts all actions associated to a specific target.
|
||||
@@ -223,7 +223,7 @@ public interface DeploymentManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<Action> findAction(@NotNull Long actionId);
|
||||
Optional<Action> findAction(long actionId);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link Action}s from repository.
|
||||
@@ -251,7 +251,7 @@ public interface DeploymentManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Slice<Action> findActionsByDistributionSet(@NotNull Pageable pageable, @NotNull Long distributionSetId);
|
||||
Slice<Action> findActionsByDistributionSet(@NotNull Pageable pageable, long distributionSetId);
|
||||
|
||||
/**
|
||||
* Retrieves all {@link Action}s assigned to a specific {@link Target} and a
|
||||
@@ -304,7 +304,7 @@ public interface DeploymentManagement {
|
||||
* if action with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, @NotNull Long actionId);
|
||||
Page<ActionStatus> findActionStatusByAction(@NotNull Pageable pageReq, long actionId);
|
||||
|
||||
/**
|
||||
* Retrieves all messages for an {@link ActionStatus}.
|
||||
@@ -317,7 +317,7 @@ public interface DeploymentManagement {
|
||||
* @return a page of messages by a specific {@link ActionStatus} id
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<String> findMessagesByActionStatusId(@NotNull Pageable pageable, @NotNull Long actionStatusId);
|
||||
Page<String> findMessagesByActionStatusId(@NotNull Pageable pageable, long actionStatusId);
|
||||
|
||||
/**
|
||||
* Get the {@link Action} entity for given actionId with all lazy attributes
|
||||
@@ -328,7 +328,7 @@ public interface DeploymentManagement {
|
||||
* @return the corresponding {@link Action}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<Action> findActionWithDetails(@NotNull Long actionId);
|
||||
Optional<Action> findActionWithDetails(long actionId);
|
||||
|
||||
/**
|
||||
* Retrieves all active {@link Action}s of a specific target ordered by
|
||||
@@ -380,7 +380,7 @@ public interface DeploymentManagement {
|
||||
* if action with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
Action forceQuitAction(@NotNull Long actionId);
|
||||
Action forceQuitAction(long actionId);
|
||||
|
||||
/**
|
||||
* Updates a {@link Action} and forces the {@link Action} if it's not
|
||||
@@ -394,7 +394,7 @@ public interface DeploymentManagement {
|
||||
* if action with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
Action forceTargetAction(@NotNull Long actionId);
|
||||
Action forceTargetAction(long actionId);
|
||||
|
||||
/**
|
||||
* Starts all scheduled actions of an RolloutGroup parent.
|
||||
@@ -407,7 +407,7 @@ public interface DeploymentManagement {
|
||||
* @return the amount of started actions
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
long startScheduledActionsByRolloutGroupParent(@NotNull Long rolloutId, @NotNull Long distributionSetId,
|
||||
long startScheduledActionsByRolloutGroupParent(long rolloutId, long distributionSetId,
|
||||
Long rolloutGroupParentId);
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -33,7 +34,6 @@ import org.eclipse.hawkbit.repository.model.MetaData;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.Tag;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -66,7 +66,7 @@ public interface DistributionSetManagement
|
||||
* {@link DistributionSet#getType()}.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSet assignSoftwareModules(@NotNull Long setId, @NotEmpty Collection<Long> moduleIds);
|
||||
DistributionSet assignSoftwareModules(long setId, @NotEmpty Collection<Long> moduleIds);
|
||||
|
||||
/**
|
||||
* Assign a {@link DistributionSetTag} assignment to given
|
||||
@@ -83,7 +83,7 @@ public interface DistributionSetManagement
|
||||
* distribution sets.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
List<DistributionSet> assignTag(@NotEmpty Collection<Long> setIds, @NotNull Long tagId);
|
||||
List<DistributionSet> assignTag(@NotEmpty Collection<Long> setIds, long tagId);
|
||||
|
||||
/**
|
||||
* creates a list of distribution set meta data entries.
|
||||
@@ -102,7 +102,7 @@ public interface DistributionSetManagement
|
||||
* specific key
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
List<DistributionSetMetadata> createMetaData(@NotNull Long setId, @NotEmpty Collection<MetaData> metadata);
|
||||
List<DistributionSetMetadata> createMetaData(long setId, @NotEmpty Collection<MetaData> metadata);
|
||||
|
||||
/**
|
||||
* deletes a distribution set meta data entry.
|
||||
@@ -116,7 +116,7 @@ public interface DistributionSetManagement
|
||||
* if given set does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
void deleteMetaData(@NotNull Long setId, @NotEmpty String key);
|
||||
void deleteMetaData(long setId, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* retrieves the distribution set for a given action.
|
||||
@@ -129,7 +129,7 @@ public interface DistributionSetManagement
|
||||
* if action with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSet> getByAction(@NotNull Long actionId);
|
||||
Optional<DistributionSet> getByAction(long actionId);
|
||||
|
||||
/**
|
||||
* Find {@link DistributionSet} based on given ID including (lazy loaded)
|
||||
@@ -143,7 +143,7 @@ public interface DistributionSetManagement
|
||||
* @return {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSet> getWithDetails(@NotNull Long setId);
|
||||
Optional<DistributionSet> getWithDetails(long setId);
|
||||
|
||||
/**
|
||||
* Find distribution set by name and version.
|
||||
@@ -172,7 +172,7 @@ public interface DistributionSetManagement
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetMetadata> findMetaDataByDistributionSetId(@NotNull Pageable pageable, @NotNull Long setId);
|
||||
Page<DistributionSetMetadata> findMetaDataByDistributionSetId(@NotNull Pageable pageable, long setId);
|
||||
|
||||
/**
|
||||
* finds all meta data by the given distribution set id.
|
||||
@@ -198,7 +198,7 @@ public interface DistributionSetManagement
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetMetadata> findMetaDataByDistributionSetIdAndRsql(@NotNull Pageable pageable,
|
||||
@NotNull Long setId, @NotNull String rsqlParam);
|
||||
long setId, @NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* finds all {@link DistributionSet}s.
|
||||
@@ -273,7 +273,7 @@ public interface DistributionSetManagement
|
||||
* of distribution set tag with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findByTag(@NotNull Pageable pageable, @NotNull Long tagId);
|
||||
Page<DistributionSet> findByTag(@NotNull Pageable pageable, long tagId);
|
||||
|
||||
/**
|
||||
* retrieves {@link DistributionSet}s by filtering on the given parameters.
|
||||
@@ -290,7 +290,7 @@ public interface DistributionSetManagement
|
||||
* of distribution set tag with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSet> findByRsqlAndTag(@NotNull Pageable pageable, @NotNull String rsqlParam, @NotNull Long tagId);
|
||||
Page<DistributionSet> findByRsqlAndTag(@NotNull Pageable pageable, @NotNull String rsqlParam, long tagId);
|
||||
|
||||
/**
|
||||
* finds a single distribution set meta data by its id.
|
||||
@@ -305,7 +305,7 @@ public interface DistributionSetManagement
|
||||
* is set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<DistributionSetMetadata> getMetaDataByDistributionSetId(@NotNull Long setId, @NotEmpty String key);
|
||||
Optional<DistributionSetMetadata> getMetaDataByDistributionSetId(long setId, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* Checks if a {@link DistributionSet} is currently in use by a target in
|
||||
@@ -317,7 +317,7 @@ public interface DistributionSetManagement
|
||||
* @return <code>true</code> if in use
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
boolean isInUse(@NotNull Long setId);
|
||||
boolean isInUse(long setId);
|
||||
|
||||
/**
|
||||
* Toggles {@link DistributionSetTag} assignment to given
|
||||
@@ -356,7 +356,7 @@ public interface DistributionSetManagement
|
||||
* the DS is already in use.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSet unassignSoftwareModule(@NotNull Long setId, @NotNull Long moduleId);
|
||||
DistributionSet unassignSoftwareModule(long setId, long moduleId);
|
||||
|
||||
/**
|
||||
* Unassign a {@link DistributionSetTag} assignment to given
|
||||
@@ -372,7 +372,7 @@ public interface DistributionSetManagement
|
||||
* if set or tag with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSet unAssignTag(@NotNull Long setId, @NotNull Long tagId);
|
||||
DistributionSet unAssignTag(long setId, long tagId);
|
||||
|
||||
/**
|
||||
* updates a distribution set meta data value if corresponding entry exists.
|
||||
@@ -388,7 +388,7 @@ public interface DistributionSetManagement
|
||||
* updated
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetMetadata updateMetaData(@NotNull Long setId, @NotNull MetaData metadata);
|
||||
DistributionSetMetadata updateMetaData(long setId, @NotNull MetaData metadata);
|
||||
|
||||
/**
|
||||
* Count all {@link DistributionSet}s in the repository that are not marked
|
||||
@@ -403,6 +403,6 @@ public interface DistributionSetManagement
|
||||
* if type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
long countByTypeId(@NotNull Long typeId);
|
||||
long countByTypeId(long typeId);
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -20,7 +21,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -68,6 +68,6 @@ public interface DistributionSetTagManagement extends RepositoryManagement<Distr
|
||||
* if {@link DistributionSet} with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<DistributionSetTag> findByDistributionSet(@NotNull Pageable pageable, @NotNull Long setId);
|
||||
Page<DistributionSetTag> findByDistributionSet(@NotNull Pageable pageable, long setId);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ package org.eclipse.hawkbit.repository;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.DistributionSetTypeCreate;
|
||||
@@ -21,7 +21,6 @@ import org.eclipse.hawkbit.repository.exception.EntityReadOnlyException;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
@@ -66,7 +65,7 @@ public interface DistributionSetTypeManagement
|
||||
* by a {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetType assignOptionalSoftwareModuleTypes(@NotNull Long dsTypeId,
|
||||
DistributionSetType assignOptionalSoftwareModuleTypes(long dsTypeId,
|
||||
@NotEmpty Collection<Long> softwareModuleTypeIds);
|
||||
|
||||
/**
|
||||
@@ -87,7 +86,7 @@ public interface DistributionSetTypeManagement
|
||||
* by a {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetType assignMandatorySoftwareModuleTypes(@NotNull Long dsTypeId,
|
||||
DistributionSetType assignMandatorySoftwareModuleTypes(long dsTypeId,
|
||||
@NotEmpty Collection<Long> softwareModuleTypes);
|
||||
|
||||
/**
|
||||
@@ -109,6 +108,6 @@ public interface DistributionSetTypeManagement
|
||||
* by a {@link DistributionSet}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
DistributionSetType unassignSoftwareModuleType(@NotNull Long dsTypeId, @NotNull Long softwareModuleId);
|
||||
DistributionSetType unassignSoftwareModuleType(long dsTypeId, long softwareModuleId);
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,8 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -22,7 +24,6 @@ import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -52,7 +53,7 @@ public interface RepositoryManagement<T, C, U> {
|
||||
* {@link BaseEntity} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
List<T> create(@NotNull Collection<C> creates);
|
||||
List<T> create(@NotNull @Valid Collection<C> creates);
|
||||
|
||||
/**
|
||||
* Creates new {@link SoftwareModuleType}.
|
||||
@@ -66,7 +67,7 @@ public interface RepositoryManagement<T, C, U> {
|
||||
* {@link BaseEntity} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_REPOSITORY)
|
||||
T create(@NotNull C create);
|
||||
T create(@NotNull @Valid C create);
|
||||
|
||||
/**
|
||||
* Updates existing {@link BaseEntity}.
|
||||
@@ -87,7 +88,7 @@ public interface RepositoryManagement<T, C, U> {
|
||||
* {@link BaseEntity} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
T update(@NotNull U update);
|
||||
T update(@NotNull @Valid U update);
|
||||
|
||||
/**
|
||||
* @return number of {@link BaseEntity}s in the repository.
|
||||
@@ -105,7 +106,7 @@ public interface RepositoryManagement<T, C, U> {
|
||||
* BaseEntity with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_REPOSITORY)
|
||||
void delete(@NotNull Long id);
|
||||
void delete(long id);
|
||||
|
||||
/**
|
||||
* Delete {@link BaseEntity}s by their IDs. That is either a soft delete of
|
||||
@@ -139,7 +140,7 @@ public interface RepositoryManagement<T, C, U> {
|
||||
* @return <code>true</code> if entity with given ID exists
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
boolean exists(@NotNull Long id);
|
||||
boolean exists(long id);
|
||||
|
||||
/**
|
||||
* Retrieve {@link BaseEntity}
|
||||
@@ -150,7 +151,7 @@ public interface RepositoryManagement<T, C, U> {
|
||||
* {@link BaseEntity#getId()}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<T> get(@NotNull Long id);
|
||||
Optional<T> get(long id);
|
||||
|
||||
/**
|
||||
* Retrieves {@link Page} of all {@link BaseEntity} of given type.
|
||||
|
||||
@@ -45,7 +45,7 @@ public interface RolloutGroupManagement {
|
||||
* of rollout with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Page<RolloutGroup> findByRolloutWithDetailedStatus(@NotNull Pageable pageable, @NotNull Long rolloutId);
|
||||
Page<RolloutGroup> findByRolloutWithDetailedStatus(@NotNull Pageable pageable, long rolloutId);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -65,7 +65,7 @@ public interface RolloutGroupManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
|
||||
Page<TargetWithActionStatus> findAllTargetsOfRolloutGroupWithActionStatus(@NotNull Pageable pageable,
|
||||
@NotNull Long rolloutGroupId);
|
||||
long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Retrieves a single {@link RolloutGroup} by its ID.
|
||||
@@ -77,7 +77,7 @@ public interface RolloutGroupManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Optional<RolloutGroup> get(@NotNull Long rolloutGroupId);
|
||||
Optional<RolloutGroup> get(long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Retrieves a page of {@link RolloutGroup}s filtered by a given
|
||||
@@ -100,7 +100,7 @@ public interface RolloutGroupManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Page<RolloutGroup> findByRolloutAndRsql(@NotNull Pageable pageable, @NotNull Long rolloutId,
|
||||
Page<RolloutGroup> findByRolloutAndRsql(@NotNull Pageable pageable, long rolloutId,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ public interface RolloutGroupManagement {
|
||||
* @return a page of found {@link RolloutGroup}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Page<RolloutGroup> findByRollout(@NotNull Pageable pageable, @NotNull Long rolloutId);
|
||||
Page<RolloutGroup> findByRollout(@NotNull Pageable pageable, long rolloutId);
|
||||
|
||||
/**
|
||||
* Retrieves a page of {@link RolloutGroup}s filtered by a given
|
||||
@@ -128,7 +128,7 @@ public interface RolloutGroupManagement {
|
||||
* @return a page of found {@link RolloutGroup}s
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
long countByRollout(@NotNull Long rolloutId);
|
||||
long countByRollout(long rolloutId);
|
||||
|
||||
/**
|
||||
* Get targets of specified rollout group.
|
||||
@@ -144,7 +144,7 @@ public interface RolloutGroupManagement {
|
||||
* if group with ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
|
||||
Page<Target> findTargetsOfRolloutGroup(@NotNull Pageable pageable, @NotNull Long rolloutGroupId);
|
||||
Page<Target> findTargetsOfRolloutGroup(@NotNull Pageable pageable, long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Get targets of specified rollout group.
|
||||
@@ -165,7 +165,7 @@ public interface RolloutGroupManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
|
||||
Page<Target> findTargetsOfRolloutGroupByRsql(@NotNull Pageable pageable, @NotNull Long rolloutGroupId,
|
||||
Page<Target> findTargetsOfRolloutGroupByRsql(@NotNull Pageable pageable, long rolloutGroupId,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
@@ -177,7 +177,7 @@ public interface RolloutGroupManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Optional<RolloutGroup> getWithDetailedStatus(@NotNull Long rolloutGroupId);
|
||||
Optional<RolloutGroup> getWithDetailedStatus(long rolloutGroupId);
|
||||
|
||||
/**
|
||||
* Count targets of rollout group.
|
||||
@@ -190,5 +190,5 @@ public interface RolloutGroupManagement {
|
||||
* if rollout group with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
long countTargetsOfRolloutsGroup(@NotNull Long rolloutGroupId);
|
||||
long countTargetsOfRolloutsGroup(long rolloutGroupId);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -31,7 +33,6 @@ import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroupsValidation;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -158,7 +159,7 @@ public interface RolloutManagement {
|
||||
* if rollout or group parameters are invalid
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_CREATE)
|
||||
Rollout create(@NotNull RolloutCreate rollout, @NotNull List<RolloutGroupCreate> groups,
|
||||
Rollout create(@NotNull @Valid RolloutCreate rollout, @NotNull @Valid List<RolloutGroupCreate> groups,
|
||||
RolloutGroupConditions conditions);
|
||||
|
||||
/**
|
||||
@@ -179,7 +180,7 @@ public interface RolloutManagement {
|
||||
* {@link RolloutGroupCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ_AND_TARGET_READ)
|
||||
ListenableFuture<RolloutGroupsValidation> validateTargetsInGroups(List<RolloutGroupCreate> groups,
|
||||
ListenableFuture<RolloutGroupsValidation> validateTargetsInGroups(@Valid List<RolloutGroupCreate> groups,
|
||||
String targetFilter, Long createdAt);
|
||||
|
||||
/**
|
||||
@@ -253,7 +254,7 @@ public interface RolloutManagement {
|
||||
* not exists
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Optional<Rollout> get(@NotNull Long rolloutId);
|
||||
Optional<Rollout> get(long rolloutId);
|
||||
|
||||
/**
|
||||
* Retrieves a specific rollout by its name.
|
||||
@@ -278,7 +279,7 @@ public interface RolloutManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_READ)
|
||||
Optional<Rollout> getWithDetailedStatus(@NotNull Long rolloutId);
|
||||
Optional<Rollout> getWithDetailedStatus(long rolloutId);
|
||||
|
||||
/**
|
||||
* Checks if rollout with given ID exists.
|
||||
@@ -288,7 +289,7 @@ public interface RolloutManagement {
|
||||
*
|
||||
* @return <code>true</code> if rollout exists
|
||||
*/
|
||||
boolean exists(@NotNull Long rolloutId);
|
||||
boolean exists(long rolloutId);
|
||||
|
||||
/**
|
||||
* Pauses a rollout which is currently running. The Rollout switches
|
||||
@@ -313,7 +314,7 @@ public interface RolloutManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_HANDLE)
|
||||
void pauseRollout(@NotNull Long rolloutId);
|
||||
void pauseRollout(long rolloutId);
|
||||
|
||||
/**
|
||||
* Resumes a paused rollout. The rollout switches back to
|
||||
@@ -330,7 +331,7 @@ public interface RolloutManagement {
|
||||
* paused rollouts can be resumed.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_HANDLE)
|
||||
void resumeRollout(@NotNull Long rolloutId);
|
||||
void resumeRollout(long rolloutId);
|
||||
|
||||
/**
|
||||
* Starts a rollout which has been created. The rollout must be in
|
||||
@@ -351,7 +352,7 @@ public interface RolloutManagement {
|
||||
* ready rollouts can be started.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_HANDLE)
|
||||
Rollout start(@NotNull Long rolloutId);
|
||||
Rollout start(long rolloutId);
|
||||
|
||||
/**
|
||||
* Update rollout details.
|
||||
@@ -369,7 +370,7 @@ public interface RolloutManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_UPDATE)
|
||||
Rollout update(@NotNull RolloutUpdate update);
|
||||
Rollout update(@NotNull @Valid RolloutUpdate update);
|
||||
|
||||
/**
|
||||
* Deletes a rollout. A rollout might be deleted asynchronously by
|
||||
@@ -380,6 +381,6 @@ public interface RolloutManagement {
|
||||
* the ID of the rollout to be deleted
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_ROLLOUT_MANAGEMENT_DELETE)
|
||||
void delete(@NotNull Long rolloutId);
|
||||
void delete(long rolloutId);
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -28,7 +30,6 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -71,7 +72,7 @@ public interface SoftwareModuleManagement
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
List<SoftwareModuleMetadata> createMetaData(@NotNull Collection<SoftwareModuleMetadataCreate> metadata);
|
||||
List<SoftwareModuleMetadata> createMetaData(@NotNull @Valid Collection<SoftwareModuleMetadataCreate> metadata);
|
||||
|
||||
/**
|
||||
* creates or updates a single software module meta data entry.
|
||||
@@ -86,7 +87,7 @@ public interface SoftwareModuleManagement
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
SoftwareModuleMetadata createMetaData(@NotNull SoftwareModuleMetadataCreate metadata);
|
||||
SoftwareModuleMetadata createMetaData(@NotNull @Valid SoftwareModuleMetadataCreate metadata);
|
||||
|
||||
/**
|
||||
* deletes a software module meta data entry.
|
||||
@@ -100,9 +101,11 @@ public interface SoftwareModuleManagement
|
||||
* of module or metadata entry does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
void deleteMetaData(@NotNull Long moduleId, @NotEmpty String key);
|
||||
void deleteMetaData(long moduleId, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* returns all modules assigned to given {@link DistributionSet}.
|
||||
*
|
||||
* @param pageable
|
||||
* the page request to page the result set
|
||||
* @param setId
|
||||
@@ -114,7 +117,7 @@ public interface SoftwareModuleManagement
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModule> findByAssignedTo(@NotNull Pageable pageable, @NotNull Long setId);
|
||||
Page<SoftwareModule> findByAssignedTo(@NotNull Pageable pageable, long setId);
|
||||
|
||||
/**
|
||||
* Filter {@link SoftwareModule}s with given
|
||||
@@ -150,8 +153,7 @@ public interface SoftwareModuleManagement
|
||||
* if software module type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModule> getByNameAndVersionAndType(@NotEmpty String name, @NotEmpty String version,
|
||||
@NotNull Long typeId);
|
||||
Optional<SoftwareModule> getByNameAndVersionAndType(@NotEmpty String name, @NotEmpty String version, long typeId);
|
||||
|
||||
/**
|
||||
* finds a single software module meta data by its id.
|
||||
@@ -166,7 +168,7 @@ public interface SoftwareModuleManagement
|
||||
* is module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Optional<SoftwareModuleMetadata> getMetaDataBySoftwareModuleId(@NotNull Long moduleId, @NotEmpty String key);
|
||||
Optional<SoftwareModuleMetadata> getMetaDataBySoftwareModuleId(long moduleId, @NotEmpty String key);
|
||||
|
||||
/**
|
||||
* finds all meta data by the given software module id.
|
||||
@@ -183,7 +185,7 @@ public interface SoftwareModuleManagement
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(@NotNull Pageable pageable, @NotNull Long moduleId);
|
||||
Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(@NotNull Pageable pageable, long moduleId);
|
||||
|
||||
/**
|
||||
* finds all meta data by the given software module id where
|
||||
@@ -202,7 +204,7 @@ public interface SoftwareModuleManagement
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleIdAndTargetVisible(@NotNull Pageable pageable,
|
||||
@NotNull Long moduleId);
|
||||
long moduleId);
|
||||
|
||||
/**
|
||||
* finds all meta data by the given software module id.
|
||||
@@ -226,7 +228,7 @@ public interface SoftwareModuleManagement
|
||||
* if software module with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Page<SoftwareModuleMetadata> findMetaDataByRsql(@NotNull Pageable pageable, @NotNull Long moduleId,
|
||||
Page<SoftwareModuleMetadata> findMetaDataByRsql(@NotNull Pageable pageable, long moduleId,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
@@ -254,7 +256,7 @@ public interface SoftwareModuleManagement
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Slice<AssignedSoftwareModule> findAllOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
|
||||
@NotNull Pageable pageable, @NotNull Long orderByDistributionId, String searchText, Long typeId);
|
||||
@NotNull Pageable pageable, long orderByDistributionId, String searchText, Long typeId);
|
||||
|
||||
/**
|
||||
* retrieves the {@link SoftwareModule}s by their {@link SoftwareModuleType}
|
||||
@@ -270,7 +272,7 @@ public interface SoftwareModuleManagement
|
||||
* if software module type with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
Slice<SoftwareModule> findByType(@NotNull Pageable pageable, @NotNull Long typeId);
|
||||
Slice<SoftwareModule> findByType(@NotNull Pageable pageable, long typeId);
|
||||
|
||||
/**
|
||||
* updates a distribution set meta data value if corresponding entry exists.
|
||||
@@ -285,5 +287,5 @@ public interface SoftwareModuleManagement
|
||||
* updated
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_REPOSITORY)
|
||||
SoftwareModuleMetadata updateMetaData(@NotNull SoftwareModuleMetadataUpdate update);
|
||||
SoftwareModuleMetadata updateMetaData(@NotNull @Valid SoftwareModuleMetadataUpdate update);
|
||||
}
|
||||
|
||||
@@ -10,11 +10,12 @@ package org.eclipse.hawkbit.repository;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeCreate;
|
||||
import org.eclipse.hawkbit.repository.builder.SoftwareModuleTypeUpdate;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
|
||||
/**
|
||||
|
||||
@@ -117,7 +117,7 @@ public interface SystemManagement {
|
||||
* @return updated {@link TenantMetaData} entity
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_TENANT_CONFIGURATION)
|
||||
TenantMetaData updateTenantMetadata(@NotNull Long defaultDsType);
|
||||
TenantMetaData updateTenantMetadata(long defaultDsType);
|
||||
|
||||
/**
|
||||
* Returns {@link TenantMetaData} of given tenant ID.
|
||||
@@ -127,6 +127,6 @@ public interface SystemManagement {
|
||||
* @return {@link TenantMetaData} of given tenant
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.IS_SYSTEM_CODE)
|
||||
TenantMetaData getTenantMetadata(@NotNull Long tenantId);
|
||||
TenantMetaData getTenantMetadata(long tenantId);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ package org.eclipse.hawkbit.repository;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -41,7 +42,7 @@ public interface TargetFilterQueryManagement {
|
||||
* {@link TargetFilterQueryCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
TargetFilterQuery create(@NotNull TargetFilterQueryCreate create);
|
||||
TargetFilterQuery create(@NotNull @Valid TargetFilterQueryCreate create);
|
||||
|
||||
/**
|
||||
* Delete target filter query.
|
||||
@@ -53,7 +54,7 @@ public interface TargetFilterQueryManagement {
|
||||
* if filter with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
||||
void delete(@NotNull Long targetFilterQueryId);
|
||||
void delete(long targetFilterQueryId);
|
||||
|
||||
/**
|
||||
* Verifies provided filter syntax.
|
||||
@@ -145,7 +146,7 @@ public interface TargetFilterQueryManagement {
|
||||
* if DS with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<TargetFilterQuery> findByAutoAssignDSAndRsql(@NotNull Pageable pageable, @NotNull Long setId,
|
||||
Page<TargetFilterQuery> findByAutoAssignDSAndRsql(@NotNull Pageable pageable, long setId,
|
||||
String rsqlParam);
|
||||
|
||||
/**
|
||||
@@ -168,7 +169,7 @@ public interface TargetFilterQueryManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<TargetFilterQuery> get(@NotNull Long targetFilterQueryId);
|
||||
Optional<TargetFilterQuery> get(long targetFilterQueryId);
|
||||
|
||||
/**
|
||||
* Find target filter query by name.
|
||||
@@ -197,7 +198,7 @@ public interface TargetFilterQueryManagement {
|
||||
* {@link TargetFilterQueryUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
TargetFilterQuery update(@NotNull TargetFilterQueryUpdate update);
|
||||
TargetFilterQuery update(@NotNull @Valid TargetFilterQueryUpdate update);
|
||||
|
||||
/**
|
||||
* updates the {@link TargetFilterQuery#getAutoAssignDistributionSet()}.
|
||||
@@ -213,6 +214,6 @@ public interface TargetFilterQueryManagement {
|
||||
* provided but not found
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
TargetFilterQuery updateAutoAssignDS(@NotNull Long queryId, Long dsId);
|
||||
TargetFilterQuery updateAutoAssignDS(long queryId, Long dsId);
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -31,7 +33,6 @@ import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Slice;
|
||||
@@ -56,7 +57,7 @@ public interface TargetManagement {
|
||||
* if given tagId or at least one of the targets do not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_UPDATE_TARGET)
|
||||
List<Target> assignTag(@NotEmpty Collection<String> controllerIds, @NotNull Long tagId);
|
||||
List<Target> assignTag(@NotEmpty Collection<String> controllerIds, long tagId);
|
||||
|
||||
/**
|
||||
* Counts number of targets with given
|
||||
@@ -72,7 +73,7 @@ public interface TargetManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
long countByAssignedDistributionSet(@NotNull Long distId);
|
||||
long countByAssignedDistributionSet(long distId);
|
||||
|
||||
/**
|
||||
* Count {@link Target}s for all the given filter parameters.
|
||||
@@ -120,7 +121,7 @@ public interface TargetManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET + SpringEvalExpressions.HAS_AUTH_OR
|
||||
+ SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY)
|
||||
long countByInstalledDistributionSet(@NotNull Long distId);
|
||||
long countByInstalledDistributionSet(long distId);
|
||||
|
||||
/**
|
||||
* Count {@link TargetFilterQuery}s for given target filter query.
|
||||
@@ -143,7 +144,7 @@ public interface TargetManagement {
|
||||
* if {@link TargetFilterQuery} with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
long countByTargetFilterQuery(@NotNull Long targetFilterQueryId);
|
||||
long countByTargetFilterQuery(long targetFilterQueryId);
|
||||
|
||||
/**
|
||||
* Counts all {@link Target}s in the repository.
|
||||
@@ -168,7 +169,7 @@ public interface TargetManagement {
|
||||
*
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
Target create(@NotNull TargetCreate create);
|
||||
Target create(@NotNull @Valid TargetCreate create);
|
||||
|
||||
/**
|
||||
* creates multiple {@link Target}s. If some of the given {@link Target}s
|
||||
@@ -187,7 +188,7 @@ public interface TargetManagement {
|
||||
* {@link TargetCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
List<Target> create(@NotNull Collection<TargetCreate> creates);
|
||||
List<Target> create(@NotNull @Valid Collection<TargetCreate> creates);
|
||||
|
||||
/**
|
||||
* Deletes all targets with the given IDs.
|
||||
@@ -230,7 +231,7 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findByTargetFilterQueryAndNonDS(@NotNull Pageable pageRequest, @NotNull Long distributionSetId,
|
||||
Page<Target> findByTargetFilterQueryAndNonDS(@NotNull Pageable pageRequest, long distributionSetId,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
@@ -248,7 +249,7 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
long countByRsqlAndNonDS(@NotNull Long distributionSetId, @NotNull String rsqlParam);
|
||||
long countByRsqlAndNonDS(long distributionSetId, @NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
* Finds all targets for all the given parameter {@link TargetFilterQuery}
|
||||
@@ -293,7 +294,7 @@ public interface TargetManagement {
|
||||
* if rollout group with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findByInRolloutGroupWithoutAction(@NotNull Pageable pageRequest, @NotNull Long group);
|
||||
Page<Target> findByInRolloutGroupWithoutAction(@NotNull Pageable pageRequest, long group);
|
||||
|
||||
/**
|
||||
* retrieves {@link Target}s by the assigned {@link DistributionSet}.
|
||||
@@ -310,7 +311,7 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
|
||||
Page<Target> findByAssignedDistributionSet(@NotNull Pageable pageReq, @NotNull Long distributionSetID);
|
||||
Page<Target> findByAssignedDistributionSet(@NotNull Pageable pageReq, long distributionSetID);
|
||||
|
||||
/**
|
||||
* Retrieves {@link Target}s by the assigned {@link DistributionSet}
|
||||
@@ -333,7 +334,7 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
|
||||
Page<Target> findByAssignedDistributionSetAndRsql(@NotNull Pageable pageReq, @NotNull Long distributionSetID,
|
||||
Page<Target> findByAssignedDistributionSetAndRsql(@NotNull Pageable pageReq, long distributionSetID,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
@@ -388,7 +389,7 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
|
||||
Page<Target> findByInstalledDistributionSet(@NotNull Pageable pageReq, @NotNull Long distributionSetID);
|
||||
Page<Target> findByInstalledDistributionSet(@NotNull Pageable pageReq, long distributionSetID);
|
||||
|
||||
/**
|
||||
* retrieves {@link Target}s by the installed {@link DistributionSet}
|
||||
@@ -413,7 +414,7 @@ public interface TargetManagement {
|
||||
* if distribution set with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY_AND_READ_TARGET)
|
||||
Page<Target> findByInstalledDistributionSetAndRsql(@NotNull Pageable pageReq, @NotNull Long distributionSetId,
|
||||
Page<Target> findByInstalledDistributionSetAndRsql(@NotNull Pageable pageReq, long distributionSetId,
|
||||
@NotNull String rsqlParam);
|
||||
|
||||
/**
|
||||
@@ -478,7 +479,7 @@ public interface TargetManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Slice<Target> findByTargetFilterQuery(@NotNull Pageable pageable, @NotNull Long targetFilterQueryId);
|
||||
Slice<Target> findByTargetFilterQuery(@NotNull Pageable pageable, long targetFilterQueryId);
|
||||
|
||||
/**
|
||||
* method retrieves all {@link Target}s from the repo in the following
|
||||
@@ -508,7 +509,7 @@ public interface TargetManagement {
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Slice<Target> findByFilterOrderByLinkedDistributionSet(@NotNull Pageable pageable,
|
||||
@NotNull Long orderByDistributionId, @NotNull FilterParams filterParams);
|
||||
long orderByDistributionId, @NotNull FilterParams filterParams);
|
||||
|
||||
/**
|
||||
* Find targets by tag name.
|
||||
@@ -523,7 +524,7 @@ public interface TargetManagement {
|
||||
* if target tag with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findByTag(@NotNull Pageable pageable, @NotNull Long tagId);
|
||||
Page<Target> findByTag(@NotNull Pageable pageable, long tagId);
|
||||
|
||||
/**
|
||||
* Find targets by tag name.
|
||||
@@ -546,7 +547,7 @@ public interface TargetManagement {
|
||||
* if the RSQL syntax is wrong
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Page<Target> findByRsqlAndTag(@NotNull Pageable pageable, @NotNull String rsqlParam, @NotNull Long tagId);
|
||||
Page<Target> findByRsqlAndTag(@NotNull Pageable pageable, @NotNull String rsqlParam, long tagId);
|
||||
|
||||
/**
|
||||
* Toggles {@link TargetTag} assignment to given {@link Target}s by means
|
||||
@@ -579,7 +580,7 @@ public interface TargetManagement {
|
||||
* if TAG with given ID does not exist
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
Target unAssignTag(@NotEmpty String controllerID, @NotNull Long targetTagId);
|
||||
Target unAssignTag(@NotEmpty String controllerID, long targetTagId);
|
||||
|
||||
/**
|
||||
* updates the {@link Target}.
|
||||
@@ -596,7 +597,7 @@ public interface TargetManagement {
|
||||
* {@link TargetUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
Target update(@NotNull TargetUpdate update);
|
||||
Target update(@NotNull @Valid TargetUpdate update);
|
||||
|
||||
/**
|
||||
* Find a {@link Target} based a given ID.
|
||||
@@ -606,7 +607,7 @@ public interface TargetManagement {
|
||||
* @return {@link Target}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<Target> get(@NotNull Long id);
|
||||
Optional<Target> get(long id);
|
||||
|
||||
/**
|
||||
* Retrieves all targets.
|
||||
|
||||
@@ -13,6 +13,8 @@ import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||
@@ -24,7 +26,6 @@ import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -58,7 +59,7 @@ public interface TargetTagManagement {
|
||||
* {@link TagCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
TargetTag create(@NotNull TagCreate create);
|
||||
TargetTag create(@NotNull @Valid TagCreate create);
|
||||
|
||||
/**
|
||||
* created multiple {@link TargetTag}s.
|
||||
@@ -74,7 +75,7 @@ public interface TargetTagManagement {
|
||||
* {@link TagCreate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_CREATE_TARGET)
|
||||
List<TargetTag> create(@NotNull Collection<TagCreate> creates);
|
||||
List<TargetTag> create(@NotNull @Valid Collection<TagCreate> creates);
|
||||
|
||||
/**
|
||||
* Deletes {@link TargetTag} with given name.
|
||||
@@ -117,6 +118,7 @@ public interface TargetTagManagement {
|
||||
|
||||
/**
|
||||
* Retrieves all target tags based on the given specification.
|
||||
*
|
||||
* @param pageable
|
||||
* pagination parameter
|
||||
* @param rsqlParam
|
||||
@@ -151,7 +153,7 @@ public interface TargetTagManagement {
|
||||
* @return the found {@link TargetTag}
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||
Optional<TargetTag> get(@NotNull Long id);
|
||||
Optional<TargetTag> get(long id);
|
||||
|
||||
/**
|
||||
* updates the {@link TargetTag}.
|
||||
@@ -168,6 +170,6 @@ public interface TargetTagManagement {
|
||||
* {@link TagUpdate} for field constraints.
|
||||
*/
|
||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_UPDATE_TARGET)
|
||||
TargetTag update(@NotNull TagUpdate update);
|
||||
TargetTag update(@NotNull @Valid TagUpdate update);
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public interface ActionStatusCreate {
|
||||
* for {@link ActionStatus#getOccurredAt()}
|
||||
* @return updated {@link ActionStatusCreate} object
|
||||
*/
|
||||
ActionStatusCreate occurredAt(Long occurredAt);
|
||||
ActionStatusCreate occurredAt(long occurredAt);
|
||||
|
||||
/**
|
||||
* @param messages
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* Builder for {@link Target}.
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.exception;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* The {@link #InvalidTenantConfigurationKeyException} is thrown when an invalid
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.tenancy.configuration.validator;
|
||||
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
import org.eclipse.hawkbit.exception.AbstractServerRtException;
|
||||
import org.eclipse.hawkbit.exception.SpServerError;
|
||||
|
||||
/**
|
||||
* Exception which is thrown, when the validation of the configuration value has
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
* 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;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
|
||||
import org.hibernate.validator.constraints.SafeHtml;
|
||||
import org.hibernate.validator.constraints.SafeHtml.WhiteListType;
|
||||
|
||||
/**
|
||||
* Constraint for strings submitted into the repository.
|
||||
*
|
||||
*/
|
||||
@Constraint(validatedBy = {})
|
||||
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR,
|
||||
ElementType.PARAMETER, ElementType.TYPE_USE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@SafeHtml(whitelistType = WhiteListType.NONE)
|
||||
public @interface ValidString {
|
||||
|
||||
String message() default "Invalid characters in string";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
|
||||
}
|
||||
@@ -10,9 +10,13 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
@@ -23,7 +27,9 @@ import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
public abstract class AbstractActionStatusCreate<T> {
|
||||
protected Status status;
|
||||
protected Long occurredAt;
|
||||
protected Collection<String> messages;
|
||||
|
||||
protected List<@ValidString String> messages;
|
||||
|
||||
protected Long actionId;
|
||||
|
||||
public Long getActionId() {
|
||||
@@ -36,7 +42,7 @@ public abstract class AbstractActionStatusCreate<T> {
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T occurredAt(final Long occurredAt) {
|
||||
public T occurredAt(final long occurredAt) {
|
||||
this.occurredAt = occurredAt;
|
||||
|
||||
return (T) this;
|
||||
@@ -44,9 +50,9 @@ public abstract class AbstractActionStatusCreate<T> {
|
||||
|
||||
public T messages(final Collection<String> messages) {
|
||||
if (this.messages == null) {
|
||||
this.messages = messages;
|
||||
this.messages = messages.stream().map(StringUtils::trimWhitespace).collect(Collectors.toList());
|
||||
} else {
|
||||
this.messages.addAll(messages);
|
||||
this.messages.addAll(messages.stream().map(StringUtils::trimWhitespace).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
return (T) this;
|
||||
@@ -56,7 +62,7 @@ public abstract class AbstractActionStatusCreate<T> {
|
||||
if (this.messages == null) {
|
||||
this.messages = new ArrayList<>();
|
||||
}
|
||||
this.messages.add(message);
|
||||
this.messages.add(StringUtils.trimWhitespace(message));
|
||||
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,9 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
@@ -20,8 +22,11 @@ import org.springframework.util.CollectionUtils;
|
||||
* update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractDistributionSetTypeUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
@ValidString
|
||||
protected String colour;
|
||||
@ValidString
|
||||
protected String key;
|
||||
|
||||
protected Collection<Long> mandatory;
|
||||
protected Collection<Long> optional;
|
||||
|
||||
@@ -52,7 +57,7 @@ public abstract class AbstractDistributionSetTypeUpdateCreate<T> extends Abstrac
|
||||
}
|
||||
|
||||
public T colour(final String colour) {
|
||||
this.colour = colour;
|
||||
this.colour = StringUtils.trimWhitespace(colour);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@@ -61,7 +66,7 @@ public abstract class AbstractDistributionSetTypeUpdateCreate<T> extends Abstrac
|
||||
}
|
||||
|
||||
public T key(final String key) {
|
||||
this.key = key;
|
||||
this.key = StringUtils.trimWhitespace(key);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,9 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
@@ -18,8 +21,11 @@ import java.util.Optional;
|
||||
* update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractDistributionSetUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
@ValidString
|
||||
protected String version;
|
||||
protected Boolean requiredMigrationStep;
|
||||
|
||||
@ValidString
|
||||
protected String type;
|
||||
protected Collection<Long> modules;
|
||||
|
||||
@@ -33,7 +39,7 @@ public abstract class AbstractDistributionSetUpdateCreate<T> extends AbstractNam
|
||||
}
|
||||
|
||||
public T type(final String type) {
|
||||
this.type = type;
|
||||
this.type = StringUtils.trimWhitespace(type);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@@ -51,7 +57,7 @@ public abstract class AbstractDistributionSetUpdateCreate<T> extends AbstractNam
|
||||
}
|
||||
|
||||
public T version(final String version) {
|
||||
this.version = version;
|
||||
this.version = StringUtils.trimWhitespace(version);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
@@ -17,11 +20,14 @@ import java.util.Optional;
|
||||
* update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractMetadataUpdateCreate<T> {
|
||||
@ValidString
|
||||
protected String key;
|
||||
|
||||
@ValidString
|
||||
protected String value;
|
||||
|
||||
public T key(final String key) {
|
||||
this.key = key;
|
||||
this.key = StringUtils.trimWhitespace(key);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@@ -30,7 +36,7 @@ public abstract class AbstractMetadataUpdateCreate<T> {
|
||||
}
|
||||
|
||||
public T value(final String value) {
|
||||
this.value = value;
|
||||
this.value = StringUtils.trimWhitespace(value);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,18 +10,24 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
public abstract class AbstractNamedEntityBuilder<T> extends AbstractBaseEntityBuilder {
|
||||
|
||||
@ValidString
|
||||
protected String name;
|
||||
|
||||
@ValidString
|
||||
protected String description;
|
||||
|
||||
public T name(final String name) {
|
||||
this.name = name;
|
||||
this.name = StringUtils.trimWhitespace(name);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public T description(final String description) {
|
||||
this.description = description;
|
||||
this.description = StringUtils.trimWhitespace(description);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Create builder DTO.
|
||||
@@ -17,12 +19,13 @@ import org.eclipse.hawkbit.repository.model.RolloutGroupConditions;
|
||||
* update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractRolloutGroupCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
@ValidString
|
||||
protected String targetFilterQuery;
|
||||
protected Float targetPercentage;
|
||||
protected RolloutGroupConditions conditions;
|
||||
|
||||
public T targetFilterQuery(final String targetFilterQuery) {
|
||||
this.targetFilterQuery = targetFilterQuery;
|
||||
this.targetFilterQuery = StringUtils.trimWhitespace(targetFilterQuery);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,9 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
@@ -20,7 +22,10 @@ import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
*/
|
||||
public abstract class AbstractRolloutUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
protected Long set;
|
||||
|
||||
@ValidString
|
||||
protected String targetFilterQuery;
|
||||
|
||||
protected ActionType actionType;
|
||||
protected Long forcedTime;
|
||||
protected Long startAt;
|
||||
@@ -31,7 +36,7 @@ public abstract class AbstractRolloutUpdateCreate<T> extends AbstractNamedEntity
|
||||
}
|
||||
|
||||
public T targetFilterQuery(final String targetFilterQuery) {
|
||||
this.targetFilterQuery = targetFilterQuery;
|
||||
this.targetFilterQuery = StringUtils.trimWhitespace(targetFilterQuery);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
@@ -17,8 +20,11 @@ import java.util.Optional;
|
||||
* update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractSoftwareModuleTypeUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
@ValidString
|
||||
protected String colour;
|
||||
@ValidString
|
||||
protected String key;
|
||||
|
||||
protected int maxAssignments = 1;
|
||||
|
||||
public T maxAssignments(final int maxAssignments) {
|
||||
@@ -31,7 +37,7 @@ public abstract class AbstractSoftwareModuleTypeUpdateCreate<T> extends Abstract
|
||||
}
|
||||
|
||||
public T colour(final String colour) {
|
||||
this.colour = colour;
|
||||
this.colour = StringUtils.trimWhitespace(colour);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@@ -40,7 +46,7 @@ public abstract class AbstractSoftwareModuleTypeUpdateCreate<T> extends Abstract
|
||||
}
|
||||
|
||||
public T key(final String key) {
|
||||
this.key = key;
|
||||
this.key = StringUtils.trimWhitespace(key);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
@@ -17,12 +20,17 @@ import java.util.Optional;
|
||||
* update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractSoftwareModuleUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
@ValidString
|
||||
protected String version;
|
||||
|
||||
@ValidString
|
||||
protected String vendor;
|
||||
|
||||
@ValidString
|
||||
protected String type;
|
||||
|
||||
public T type(final String type) {
|
||||
this.type = type;
|
||||
this.type = StringUtils.trimWhitespace(type);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@@ -31,7 +39,7 @@ public abstract class AbstractSoftwareModuleUpdateCreate<T> extends AbstractName
|
||||
}
|
||||
|
||||
public T vendor(final String vendor) {
|
||||
this.vendor = vendor;
|
||||
this.vendor = StringUtils.trimWhitespace(vendor);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@@ -40,7 +48,7 @@ public abstract class AbstractSoftwareModuleUpdateCreate<T> extends AbstractName
|
||||
}
|
||||
|
||||
public T version(final String version) {
|
||||
this.version = version;
|
||||
this.version = StringUtils.trimWhitespace(version);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
@@ -17,10 +20,11 @@ import java.util.Optional;
|
||||
* update or create builder interface
|
||||
*/
|
||||
public class AbstractTagUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
@ValidString
|
||||
protected String colour;
|
||||
|
||||
public T colour(final String colour) {
|
||||
this.colour = colour;
|
||||
this.colour = StringUtils.trimWhitespace(colour);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
*
|
||||
@@ -17,8 +20,12 @@ import java.util.Optional;
|
||||
* update or create builder interface
|
||||
*/
|
||||
public abstract class AbstractTargetFilterQueryUpdateCreate<T> extends AbstractBaseEntityBuilder {
|
||||
@ValidString
|
||||
protected String name;
|
||||
|
||||
@ValidString
|
||||
protected String query;
|
||||
|
||||
protected Long set;
|
||||
|
||||
public T set(final long set) {
|
||||
@@ -31,7 +38,7 @@ public abstract class AbstractTargetFilterQueryUpdateCreate<T> extends AbstractB
|
||||
}
|
||||
|
||||
public T name(final String name) {
|
||||
this.name = name;
|
||||
this.name = StringUtils.trimWhitespace(name);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@@ -40,7 +47,7 @@ public abstract class AbstractTargetFilterQueryUpdateCreate<T> extends AbstractB
|
||||
}
|
||||
|
||||
public T query(final String query) {
|
||||
this.query = query;
|
||||
this.query = StringUtils.trimWhitespace(query);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@ package org.eclipse.hawkbit.repository.builder;
|
||||
import java.net.URI;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.ValidString;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidTargetAddressException;
|
||||
import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Create and update builder DTO.
|
||||
@@ -21,14 +23,19 @@ import org.eclipse.hawkbit.repository.model.TargetUpdateStatus;
|
||||
* update or create builder interface
|
||||
*/
|
||||
public class AbstractTargetUpdateCreate<T> extends AbstractNamedEntityBuilder<T> {
|
||||
@ValidString
|
||||
protected String controllerId;
|
||||
|
||||
protected String address;
|
||||
|
||||
@ValidString
|
||||
protected String securityToken;
|
||||
|
||||
protected Long lastTargetQuery;
|
||||
protected TargetUpdateStatus status;
|
||||
|
||||
protected AbstractTargetUpdateCreate(final String controllerId) {
|
||||
this.controllerId = controllerId;
|
||||
this.controllerId = StringUtils.trimWhitespace(controllerId);
|
||||
}
|
||||
|
||||
public T status(final TargetUpdateStatus status) {
|
||||
@@ -40,7 +47,7 @@ public class AbstractTargetUpdateCreate<T> extends AbstractNamedEntityBuilder<T>
|
||||
// check if this is a real URI
|
||||
if (address != null) {
|
||||
try {
|
||||
URI.create(address);
|
||||
URI.create(StringUtils.trimWhitespace(address));
|
||||
} catch (final IllegalArgumentException e) {
|
||||
throw new InvalidTargetAddressException(
|
||||
"The given address " + address + " violates the RFC-2396 specification", e);
|
||||
@@ -51,7 +58,7 @@ public class AbstractTargetUpdateCreate<T> extends AbstractNamedEntityBuilder<T>
|
||||
}
|
||||
|
||||
public T securityToken(final String securityToken) {
|
||||
this.securityToken = securityToken;
|
||||
this.securityToken = StringUtils.trimWhitespace(securityToken);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
@@ -61,7 +68,7 @@ public class AbstractTargetUpdateCreate<T> extends AbstractNamedEntityBuilder<T>
|
||||
}
|
||||
|
||||
public TargetCreate controllerId(final String controllerId) {
|
||||
this.controllerId = controllerId;
|
||||
this.controllerId = StringUtils.trimWhitespace(controllerId);
|
||||
return (TargetCreate) this;
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,10 @@
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
|
||||
@@ -85,7 +85,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Artifact create(final InputStream stream, final Long moduleId, final String filename,
|
||||
public Artifact create(final InputStream stream, final long moduleId, final String filename,
|
||||
final String providedMd5Sum, final String providedSha1Sum, final boolean overrideExisting,
|
||||
final String contentType) {
|
||||
AbstractDbArtifact result = null;
|
||||
@@ -117,7 +117,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public boolean clearArtifactBinary(final String sha1Hash, final Long moduleId) {
|
||||
public boolean clearArtifactBinary(final String sha1Hash, final long moduleId) {
|
||||
|
||||
if (localArtifactRepository.existsWithSha1HashAndSoftwareModuleIdIsNot(sha1Hash, moduleId)) {
|
||||
// there are still other artifacts that need the binary
|
||||
@@ -137,7 +137,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long id) {
|
||||
public void delete(final long id) {
|
||||
final JpaArtifact existing = (JpaArtifact) get(id)
|
||||
.orElseThrow(() -> new EntityNotFoundException(Artifact.class, id));
|
||||
|
||||
@@ -149,12 +149,12 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Artifact> get(final Long id) {
|
||||
public Optional<Artifact> get(final long id) {
|
||||
return Optional.ofNullable(localArtifactRepository.findOne(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Artifact> getByFilenameAndSoftwareModule(final String filename, final Long softwareModuleId) {
|
||||
public Optional<Artifact> getByFilenameAndSoftwareModule(final String filename, final long softwareModuleId) {
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(softwareModuleId);
|
||||
|
||||
return localArtifactRepository.findFirstByFilenameAndSoftwareModuleId(filename, softwareModuleId);
|
||||
@@ -171,7 +171,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Artifact> findBySoftwareModule(final Pageable pageReq, final Long swId) {
|
||||
public Page<Artifact> findBySoftwareModule(final Pageable pageReq, final long swId) {
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(swId);
|
||||
|
||||
return localArtifactRepository.findBySoftwareModuleId(pageReq, swId);
|
||||
@@ -206,7 +206,7 @@ public class JpaArtifactManagement implements ArtifactManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Artifact create(final InputStream inputStream, final Long moduleId, final String filename,
|
||||
public Artifact create(final InputStream inputStream, final long moduleId, final String filename,
|
||||
final boolean overrideExisting) {
|
||||
return create(inputStream, moduleId, filename, null, null, overrideExisting, null);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
|
||||
@Override
|
||||
public Optional<Action> getActionForDownloadByTargetAndSoftwareModule(final String controllerId,
|
||||
final Long moduleId) {
|
||||
final long moduleId) {
|
||||
throwExceptionIfTargetDoesNotExist(controllerId);
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(moduleId);
|
||||
|
||||
@@ -215,7 +215,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTargetArtifactAssigned(final Long targetId, final String sha1Hash) {
|
||||
public boolean hasTargetArtifactAssigned(final long targetId, final String sha1Hash) {
|
||||
throwExceptionIfTargetDoesNotExist(targetId);
|
||||
return actionRepository.count(ActionSpecifications.hasTargetAssignedArtifact(targetId, sha1Hash)) > 0;
|
||||
}
|
||||
@@ -233,7 +233,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Action> findActionWithDetails(final Long actionId) {
|
||||
public Optional<Action> findActionWithDetails(final long actionId) {
|
||||
return actionRepository.getById(actionId);
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Action registerRetrieved(final Long actionId, final String message) {
|
||||
public Action registerRetrieved(final long actionId, final String message) {
|
||||
return handleRegisterRetrieved(actionId, message);
|
||||
}
|
||||
|
||||
@@ -640,12 +640,12 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Target> get(final Long targetId) {
|
||||
public Optional<Target> get(final long targetId) {
|
||||
return Optional.ofNullable(targetRepository.findOne(targetId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final Long actionId) {
|
||||
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final long actionId) {
|
||||
if (!actionRepository.exists(actionId)) {
|
||||
throw new EntityNotFoundException(Action.class, actionId);
|
||||
}
|
||||
@@ -654,7 +654,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getActionHistoryMessages(final Long actionId, final int messageCount) {
|
||||
public List<String> getActionHistoryMessages(final long actionId, final int messageCount) {
|
||||
// Just return empty list in case messageCount is zero.
|
||||
if (messageCount == 0) {
|
||||
return Collections.emptyList();
|
||||
@@ -676,7 +676,7 @@ public class JpaControllerManagement implements ControllerManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoftwareModule> getSoftwareModule(final Long id) {
|
||||
public Optional<SoftwareModule> getSoftwareModule(final long id) {
|
||||
return Optional.ofNullable(softwareModuleRepository.findOne(id));
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional(isolation = Isolation.READ_COMMITTED)
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID, final ActionType actionType,
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final long dsID, final ActionType actionType,
|
||||
final long forcedTimestamp, final Collection<String> controllerIDs) {
|
||||
|
||||
return assignDistributionSetToTargets(dsID,
|
||||
@@ -176,7 +176,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional(isolation = Isolation.READ_COMMITTED)
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID,
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final long dsID,
|
||||
final Collection<TargetWithActionType> targets) {
|
||||
|
||||
return assignDistributionSetToTargets(dsID, targets, null, onlineDsAssignmentStrategy);
|
||||
@@ -186,7 +186,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional(isolation = Isolation.READ_COMMITTED)
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final Long dsID,
|
||||
public DistributionSetAssignmentResult assignDistributionSet(final long dsID,
|
||||
final Collection<TargetWithActionType> targets, final String actionMessage) {
|
||||
|
||||
return assignDistributionSetToTargets(dsID, targets, actionMessage, onlineDsAssignmentStrategy);
|
||||
@@ -319,7 +319,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional(isolation = Isolation.READ_COMMITTED)
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Action cancelAction(final Long actionId) {
|
||||
public Action cancelAction(final long actionId) {
|
||||
LOG.debug("cancelAction({})", actionId);
|
||||
|
||||
final JpaAction action = actionRepository.findById(actionId)
|
||||
@@ -349,7 +349,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional(isolation = Isolation.READ_COMMITTED)
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Action forceQuitAction(final Long actionId) {
|
||||
public Action forceQuitAction(final long actionId) {
|
||||
final JpaAction action = actionRepository.findById(actionId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(Action.class, actionId));
|
||||
|
||||
@@ -374,7 +374,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long startScheduledActionsByRolloutGroupParent(final Long rolloutId, final Long distributionSetId,
|
||||
public long startScheduledActionsByRolloutGroupParent(final long rolloutId, final long distributionSetId,
|
||||
final Long rolloutGroupParentId) {
|
||||
long totalActionsCount = 0L;
|
||||
long lastStartedActionsCount;
|
||||
@@ -483,12 +483,12 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Action> findAction(final Long actionId) {
|
||||
public Optional<Action> findAction(final long actionId) {
|
||||
return Optional.ofNullable(actionRepository.findOne(actionId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Action> findActionWithDetails(final Long actionId) {
|
||||
public Optional<Action> findActionWithDetails(final long actionId) {
|
||||
return actionRepository.getById(actionId);
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Action forceTargetAction(final Long actionId) {
|
||||
public Action forceTargetAction(final long actionId) {
|
||||
final JpaAction action = actionRepository.findById(actionId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(Action.class, actionId));
|
||||
|
||||
@@ -574,7 +574,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final Long actionId) {
|
||||
public Page<ActionStatus> findActionStatusByAction(final Pageable pageReq, final long actionId) {
|
||||
if (!actionRepository.exists(actionId)) {
|
||||
throw new EntityNotFoundException(Action.class, actionId);
|
||||
}
|
||||
@@ -583,7 +583,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<String> findMessagesByActionStatusId(final Pageable pageable, final Long actionStatusId) {
|
||||
public Page<String> findMessagesByActionStatusId(final Pageable pageable, final long actionStatusId) {
|
||||
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
|
||||
|
||||
final CriteriaQuery<Long> countMsgQuery = cb.createQuery(Long.class);
|
||||
@@ -625,7 +625,7 @@ public class JpaDeploymentManagement implements DeploymentManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Slice<Action> findActionsByDistributionSet(final Pageable pageable, final Long dsId) {
|
||||
public Slice<Action> findActionsByDistributionSet(final Pageable pageable, final long dsId) {
|
||||
throwExceptionIfDistributionSetDoesNotExist(dsId);
|
||||
|
||||
return actionRepository.findByDistributionSetId(pageable, dsId);
|
||||
|
||||
@@ -131,12 +131,12 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
private AfterTransactionCommitExecutor afterCommit;
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSet> getWithDetails(final Long distid) {
|
||||
public Optional<DistributionSet> getWithDetails(final long distid) {
|
||||
return Optional.ofNullable(distributionSetRepository.findOne(DistributionSetSpecification.byId(distid)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByTypeId(final Long typeId) {
|
||||
public long countByTypeId(final long typeId) {
|
||||
if (!distributionSetTypeManagement.exists(typeId)) {
|
||||
throw new EntityNotFoundException(DistributionSetType.class, typeId);
|
||||
}
|
||||
@@ -304,7 +304,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSet assignSoftwareModules(final Long setId, final Collection<Long> moduleIds) {
|
||||
public DistributionSet assignSoftwareModules(final long setId, final Collection<Long> moduleIds) {
|
||||
|
||||
final Collection<JpaSoftwareModule> modules = softwareModuleRepository.findByIdIn(moduleIds);
|
||||
|
||||
@@ -325,7 +325,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSet unassignSoftwareModule(final Long setId, final Long moduleId) {
|
||||
public DistributionSet unassignSoftwareModule(final long setId, final long moduleId) {
|
||||
final JpaDistributionSet set = findDistributionSetAndThrowExceptionIfNotFound(setId);
|
||||
final JpaSoftwareModule module = findSoftwareModuleAndThrowExceptionIfNotFound(moduleId);
|
||||
|
||||
@@ -446,7 +446,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public List<DistributionSetMetadata> createMetaData(final Long dsId, final Collection<MetaData> md) {
|
||||
public List<DistributionSetMetadata> createMetaData(final long dsId, final Collection<MetaData> md) {
|
||||
|
||||
md.forEach(meta -> checkAndThrowAlreadyIfDistributionSetMetadataExists(
|
||||
new DsMetadataCompositeKey(dsId, meta.getKey())));
|
||||
@@ -463,7 +463,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetMetadata updateMetaData(final Long dsId, final MetaData md) {
|
||||
public DistributionSetMetadata updateMetaData(final long dsId, final MetaData md) {
|
||||
|
||||
// check if exists otherwise throw entity not found exception
|
||||
final JpaDistributionSetMetadata toUpdate = (JpaDistributionSetMetadata) getMetaDataByDistributionSetId(dsId,
|
||||
@@ -480,7 +480,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void deleteMetaData(final Long distributionSetId, final String key) {
|
||||
public void deleteMetaData(final long distributionSetId, final String key) {
|
||||
final JpaDistributionSetMetadata metadata = (JpaDistributionSetMetadata) getMetaDataByDistributionSetId(
|
||||
distributionSetId, key).orElseThrow(
|
||||
() -> new EntityNotFoundException(DistributionSetMetadata.class, distributionSetId, key));
|
||||
@@ -521,7 +521,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
|
||||
@Override
|
||||
public Page<DistributionSetMetadata> findMetaDataByDistributionSetId(final Pageable pageable,
|
||||
final Long distributionSetId) {
|
||||
final long distributionSetId) {
|
||||
throwExceptionIfDistributionSetDoesNotExist(distributionSetId);
|
||||
|
||||
return convertMdPage(distributionSetMetadataRepository
|
||||
@@ -533,7 +533,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
|
||||
@Override
|
||||
public Page<DistributionSetMetadata> findMetaDataByDistributionSetIdAndRsql(final Pageable pageable,
|
||||
final Long distributionSetId, final String rsqlParam) {
|
||||
final long distributionSetId, final String rsqlParam) {
|
||||
|
||||
throwExceptionIfDistributionSetDoesNotExist(distributionSetId);
|
||||
|
||||
@@ -555,14 +555,14 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSetMetadata> getMetaDataByDistributionSetId(final Long setId, final String key) {
|
||||
public Optional<DistributionSetMetadata> getMetaDataByDistributionSetId(final long setId, final String key) {
|
||||
throwExceptionIfDistributionSetDoesNotExist(setId);
|
||||
|
||||
return Optional.ofNullable(distributionSetMetadataRepository.findOne(new DsMetadataCompositeKey(setId, key)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSet> getByAction(final Long actionId) {
|
||||
public Optional<DistributionSet> getByAction(final long actionId) {
|
||||
if (!actionRepository.exists(actionId)) {
|
||||
throw new EntityNotFoundException(Action.class, actionId);
|
||||
}
|
||||
@@ -571,7 +571,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInUse(final Long setId) {
|
||||
public boolean isInUse(final long setId) {
|
||||
throwExceptionIfDistributionSetDoesNotExist(setId);
|
||||
|
||||
return actionRepository.countByDistributionSetId(setId) > 0;
|
||||
@@ -665,7 +665,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public List<DistributionSet> assignTag(final Collection<Long> dsIds, final Long dsTagId) {
|
||||
public List<DistributionSet> assignTag(final Collection<Long> dsIds, final long dsTagId) {
|
||||
final List<JpaDistributionSet> allDs = findDistributionSetListWithDetails(dsIds);
|
||||
|
||||
if (allDs.size() < dsIds.size()) {
|
||||
@@ -690,7 +690,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSet unAssignTag(final Long dsId, final Long dsTagId) {
|
||||
public DistributionSet unAssignTag(final long dsId, final long dsTagId) {
|
||||
final JpaDistributionSet set = (JpaDistributionSet) getWithDetails(dsId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(DistributionSet.class, dsId));
|
||||
|
||||
@@ -710,7 +710,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long setId) {
|
||||
public void delete(final long setId) {
|
||||
throwExceptionIfDistributionSetDoesNotExist(setId);
|
||||
|
||||
delete(Arrays.asList(setId));
|
||||
@@ -728,7 +728,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DistributionSet> findByTag(final Pageable pageable, final Long tagId) {
|
||||
public Page<DistributionSet> findByTag(final Pageable pageable, final long tagId) {
|
||||
throwEntityNotFoundExceptionIfDsTagDoesNotExist(tagId);
|
||||
|
||||
return convertDsPage(distributionSetRepository.findByTag(pageable, tagId), pageable);
|
||||
@@ -742,7 +742,7 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DistributionSet> findByRsqlAndTag(final Pageable pageable, final String rsqlParam, final Long tagId) {
|
||||
public Page<DistributionSet> findByRsqlAndTag(final Pageable pageable, final String rsqlParam, final long tagId) {
|
||||
throwEntityNotFoundExceptionIfDsTagDoesNotExist(tagId);
|
||||
|
||||
final Specification<JpaDistributionSet> spec = RSQLUtility.parse(rsqlParam, DistributionSetFields.class,
|
||||
@@ -769,12 +769,12 @@ public class JpaDistributionSetManagement implements DistributionSetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSet> get(final Long id) {
|
||||
public Optional<DistributionSet> get(final long id) {
|
||||
return Optional.ofNullable(distributionSetRepository.findOne(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long id) {
|
||||
public boolean exists(final long id) {
|
||||
return distributionSetRepository.exists(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ public class JpaDistributionSetTagManagement implements DistributionSetTagManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DistributionSetTag> findByDistributionSet(final Pageable pageable, final Long setId) {
|
||||
public Page<DistributionSetTag> findByDistributionSet(final Pageable pageable, final long setId) {
|
||||
if (!distributionSetRepository.exists(setId)) {
|
||||
throw new EntityNotFoundException(DistributionSet.class, setId);
|
||||
}
|
||||
@@ -176,7 +176,7 @@ public class JpaDistributionSetTagManagement implements DistributionSetTagManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSetTag> get(final Long id) {
|
||||
public Optional<DistributionSetTag> get(final long id) {
|
||||
return Optional.ofNullable(distributionSetTagRepository.findOne(id));
|
||||
}
|
||||
|
||||
@@ -184,12 +184,12 @@ public class JpaDistributionSetTagManagement implements DistributionSetTagManage
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long id) {
|
||||
public void delete(final long id) {
|
||||
distributionSetTagRepository.delete(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long id) {
|
||||
public boolean exists(final long id) {
|
||||
return distributionSetTagRepository.exists(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetType assignMandatorySoftwareModuleTypes(final Long dsTypeId,
|
||||
public DistributionSetType assignMandatorySoftwareModuleTypes(final long dsTypeId,
|
||||
final Collection<Long> softwareModulesTypeIds) {
|
||||
final Collection<JpaSoftwareModuleType> modules = softwareModuleTypeRepository.findAll(softwareModulesTypeIds);
|
||||
|
||||
@@ -122,7 +122,7 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetType assignOptionalSoftwareModuleTypes(final Long dsTypeId,
|
||||
public DistributionSetType assignOptionalSoftwareModuleTypes(final long dsTypeId,
|
||||
final Collection<Long> softwareModulesTypeIds) {
|
||||
|
||||
final Collection<JpaSoftwareModuleType> modules = softwareModuleTypeRepository.findAll(softwareModulesTypeIds);
|
||||
@@ -143,7 +143,7 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public DistributionSetType unassignSoftwareModuleType(final Long dsTypeId, final Long softwareModuleTypeId) {
|
||||
public DistributionSetType unassignSoftwareModuleType(final long dsTypeId, final long softwareModuleTypeId) {
|
||||
final JpaDistributionSetType type = findDistributionSetTypeAndThrowExceptionIfNotFound(dsTypeId);
|
||||
|
||||
checkDistributionSetTypeSoftwareModuleTypesIsAllowedToModify(dsTypeId);
|
||||
@@ -197,7 +197,7 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long typeId) {
|
||||
public void delete(final long typeId) {
|
||||
|
||||
final JpaDistributionSetType toDelete = distributionSetTypeRepository.findById(typeId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(DistributionSetType.class, typeId));
|
||||
@@ -275,12 +275,12 @@ public class JpaDistributionSetTypeManagement implements DistributionSetTypeMana
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<DistributionSetType> get(final Long id) {
|
||||
public Optional<DistributionSetType> get(final long id) {
|
||||
return Optional.ofNullable(distributionSetTypeRepository.findOne(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long id) {
|
||||
public boolean exists(final long id) {
|
||||
return distributionSetTypeRepository.exists(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ import javax.persistence.criteria.Join;
|
||||
import javax.persistence.criteria.JoinType;
|
||||
import javax.persistence.criteria.ListJoin;
|
||||
import javax.persistence.criteria.Root;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupFields;
|
||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||
@@ -85,12 +84,12 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
private RolloutStatusCache rolloutStatusCache;
|
||||
|
||||
@Override
|
||||
public Optional<RolloutGroup> get(final Long rolloutGroupId) {
|
||||
public Optional<RolloutGroup> get(final long rolloutGroupId) {
|
||||
return Optional.ofNullable(rolloutGroupRepository.findOne(rolloutGroupId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<RolloutGroup> findByRollout(final Pageable pageable, final Long rolloutId) {
|
||||
public Page<RolloutGroup> findByRollout(final Pageable pageable, final long rolloutId) {
|
||||
throwEntityNotFoundExceptionIfRolloutDoesNotExist(rolloutId);
|
||||
|
||||
return convertPage(rolloutGroupRepository.findByRolloutId(rolloutId, pageable), pageable);
|
||||
@@ -105,7 +104,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<RolloutGroup> findByRolloutAndRsql(final Pageable pageable, final Long rolloutId,
|
||||
public Page<RolloutGroup> findByRolloutAndRsql(final Pageable pageable, final long rolloutId,
|
||||
final String rsqlParam) {
|
||||
throwEntityNotFoundExceptionIfRolloutDoesNotExist(rolloutId);
|
||||
|
||||
@@ -130,7 +129,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<RolloutGroup> findByRolloutWithDetailedStatus(final Pageable pageable, final Long rolloutId) {
|
||||
public Page<RolloutGroup> findByRolloutWithDetailedStatus(final Pageable pageable, final long rolloutId) {
|
||||
throwEntityNotFoundExceptionIfRolloutDoesNotExist(rolloutId);
|
||||
|
||||
final Page<JpaRolloutGroup> rolloutGroups = rolloutGroupRepository.findByRolloutId(rolloutId, pageable);
|
||||
@@ -155,7 +154,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<RolloutGroup> getWithDetailedStatus(final Long rolloutGroupId) {
|
||||
public Optional<RolloutGroup> getWithDetailedStatus(final long rolloutGroupId) {
|
||||
final Optional<RolloutGroup> rolloutGroup = get(rolloutGroupId);
|
||||
|
||||
if (!rolloutGroup.isPresent()) {
|
||||
@@ -201,7 +200,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findTargetsOfRolloutGroupByRsql(final Pageable pageable, final Long rolloutGroupId,
|
||||
public Page<Target> findTargetsOfRolloutGroupByRsql(final Pageable pageable, final long rolloutGroupId,
|
||||
final String rsqlParam) {
|
||||
|
||||
throwExceptionIfRolloutGroupDoesNotExist(rolloutGroupId);
|
||||
@@ -219,7 +218,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findTargetsOfRolloutGroup(final Pageable page, final Long rolloutGroupId) {
|
||||
public Page<Target> findTargetsOfRolloutGroup(final Pageable page, final long rolloutGroupId) {
|
||||
final JpaRolloutGroup rolloutGroup = rolloutGroupRepository.findById(rolloutGroupId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(RolloutGroup.class, rolloutGroupId));
|
||||
|
||||
@@ -238,7 +237,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
|
||||
@Override
|
||||
public Page<TargetWithActionStatus> findAllTargetsOfRolloutGroupWithActionStatus(final Pageable pageRequest,
|
||||
final Long rolloutGroupId) {
|
||||
final long rolloutGroupId) {
|
||||
throwExceptionIfRolloutGroupDoesNotExist(rolloutGroupId);
|
||||
|
||||
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
|
||||
@@ -269,7 +268,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countTargetsOfRolloutsGroup(@NotNull final Long rolloutGroupId) {
|
||||
public long countTargetsOfRolloutsGroup(final long rolloutGroupId) {
|
||||
throwExceptionIfRolloutGroupDoesNotExist(rolloutGroupId);
|
||||
|
||||
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
|
||||
@@ -287,7 +286,7 @@ public class JpaRolloutGroupManagement implements RolloutGroupManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByRollout(final Long rolloutId) {
|
||||
public long countByRollout(final long rolloutId) {
|
||||
throwEntityNotFoundExceptionIfRolloutDoesNotExist(rolloutId);
|
||||
|
||||
return rolloutGroupRepository.countByRolloutId(rolloutId);
|
||||
|
||||
@@ -186,7 +186,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Rollout> get(final Long rolloutId) {
|
||||
public Optional<Rollout> get(final long rolloutId) {
|
||||
return Optional.ofNullable(rolloutRepository.findOne(rolloutId));
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Rollout start(final Long rolloutId) {
|
||||
public Rollout start(final long rolloutId) {
|
||||
LOGGER.debug("startRollout called for rollout {}", rolloutId);
|
||||
|
||||
final JpaRollout rollout = getRolloutAndThrowExceptionIfNotFound(rolloutId);
|
||||
@@ -571,7 +571,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void pauseRollout(final Long rolloutId) {
|
||||
public void pauseRollout(final long rolloutId) {
|
||||
final JpaRollout rollout = getRolloutAndThrowExceptionIfNotFound(rolloutId);
|
||||
if (!RolloutStatus.RUNNING.equals(rollout.getStatus())) {
|
||||
throw new RolloutIllegalStateException("Rollout can only be paused in state running but current state is "
|
||||
@@ -590,7 +590,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void resumeRollout(final Long rolloutId) {
|
||||
public void resumeRollout(final long rolloutId) {
|
||||
final JpaRollout rollout = getRolloutAndThrowExceptionIfNotFound(rolloutId);
|
||||
if (!(RolloutStatus.PAUSED.equals(rollout.getStatus()))) {
|
||||
throw new RolloutIllegalStateException("Rollout can only be resumed in state paused but current state is "
|
||||
@@ -818,7 +818,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long rolloutId) {
|
||||
public void delete(final long rolloutId) {
|
||||
final JpaRollout jpaRollout = rolloutRepository.findOne(rolloutId);
|
||||
|
||||
if (jpaRollout == null) {
|
||||
@@ -982,7 +982,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Rollout> getWithDetailedStatus(final Long rolloutId) {
|
||||
public Optional<Rollout> getWithDetailedStatus(final long rolloutId) {
|
||||
final Optional<Rollout> rollout = get(rolloutId);
|
||||
|
||||
if (!rollout.isPresent()) {
|
||||
@@ -1041,7 +1041,7 @@ public class JpaRolloutManagement extends AbstractRolloutManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long rolloutId) {
|
||||
public boolean exists(final long rolloutId) {
|
||||
return rolloutRepository.exists(rolloutId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Slice<SoftwareModule> findByType(final Pageable pageable, final Long typeId) {
|
||||
public Slice<SoftwareModule> findByType(final Pageable pageable, final long typeId) {
|
||||
throwExceptionIfSoftwareModuleTypeDoesNotExist(typeId);
|
||||
|
||||
final List<Specification<JpaSoftwareModule>> specList = Lists.newArrayListWithExpectedSize(2);
|
||||
@@ -181,13 +181,13 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoftwareModule> get(final Long id) {
|
||||
public Optional<SoftwareModule> get(final long id) {
|
||||
return Optional.ofNullable(softwareModuleRepository.findOne(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoftwareModule> getByNameAndVersionAndType(final String name, final String version,
|
||||
final Long typeId) {
|
||||
final long typeId) {
|
||||
|
||||
throwExceptionIfSoftwareModuleTypeDoesNotExist(typeId);
|
||||
|
||||
@@ -325,7 +325,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
|
||||
@Override
|
||||
public Slice<AssignedSoftwareModule> findAllOrderBySetAssignmentAndModuleNameAscModuleVersionAsc(
|
||||
final Pageable pageable, final Long orderByDistributionId, final String searchText, final Long typeId) {
|
||||
final Pageable pageable, final long orderByDistributionId, final String searchText, final Long typeId) {
|
||||
|
||||
final List<AssignedSoftwareModule> resultList = new ArrayList<>();
|
||||
final int pageSize = pageable.getPageSize();
|
||||
@@ -436,7 +436,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SoftwareModule> findByAssignedTo(final Pageable pageable, final Long setId) {
|
||||
public Page<SoftwareModule> findByAssignedTo(final Pageable pageable, final long setId) {
|
||||
if (!distributionSetRepository.exists(setId)) {
|
||||
throw new EntityNotFoundException(DistributionSet.class, setId);
|
||||
}
|
||||
@@ -526,7 +526,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void deleteMetaData(final Long moduleId, final String key) {
|
||||
public void deleteMetaData(final long moduleId, final String key) {
|
||||
final JpaSoftwareModuleMetadata metadata = (JpaSoftwareModuleMetadata) getMetaDataBySoftwareModuleId(moduleId,
|
||||
key).orElseThrow(() -> new EntityNotFoundException(SoftwareModuleMetadata.class, moduleId, key));
|
||||
|
||||
@@ -541,7 +541,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SoftwareModuleMetadata> findMetaDataByRsql(final Pageable pageable, final Long softwareModuleId,
|
||||
public Page<SoftwareModuleMetadata> findMetaDataByRsql(final Pageable pageable, final long softwareModuleId,
|
||||
final String rsqlParam) {
|
||||
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(softwareModuleId);
|
||||
@@ -565,7 +565,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(final Pageable pageable, final Long swId) {
|
||||
public Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleId(final Pageable pageable, final long swId) {
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(swId);
|
||||
|
||||
return convertMdPage(softwareModuleMetadataRepository.findAll(
|
||||
@@ -575,7 +575,7 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoftwareModuleMetadata> getMetaDataBySoftwareModuleId(final Long moduleId, final String key) {
|
||||
public Optional<SoftwareModuleMetadata> getMetaDataBySoftwareModuleId(final long moduleId, final String key) {
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(moduleId);
|
||||
|
||||
return Optional.ofNullable(softwareModuleMetadataRepository.findOne(new SwMetadataCompositeKey(moduleId, key)));
|
||||
@@ -589,18 +589,18 @@ public class JpaSoftwareModuleManagement implements SoftwareModuleManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long moduleId) {
|
||||
public void delete(final long moduleId) {
|
||||
delete(Arrays.asList(moduleId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long id) {
|
||||
public boolean exists(final long id) {
|
||||
return softwareModuleRepository.exists(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SoftwareModuleMetadata> findMetaDataBySoftwareModuleIdAndTargetVisible(final Pageable pageable,
|
||||
final Long moduleId) {
|
||||
final long moduleId) {
|
||||
throwExceptionIfSoftwareModuleDoesNotExist(moduleId);
|
||||
|
||||
return convertMdPage(softwareModuleMetadataRepository.findBySoftwareModuleIdAndTargetVisible(
|
||||
|
||||
@@ -128,7 +128,7 @@ public class JpaSoftwareModuleTypeManagement implements SoftwareModuleTypeManage
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long typeId) {
|
||||
public void delete(final long typeId) {
|
||||
final JpaSoftwareModuleType toDelete = softwareModuleTypeRepository.findById(typeId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(SoftwareModuleType.class, typeId));
|
||||
|
||||
@@ -180,12 +180,12 @@ public class JpaSoftwareModuleTypeManagement implements SoftwareModuleTypeManage
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<SoftwareModuleType> get(final Long id) {
|
||||
public Optional<SoftwareModuleType> get(final long id) {
|
||||
return Optional.ofNullable(softwareModuleTypeRepository.findOne(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean exists(final Long id) {
|
||||
public boolean exists(final long id) {
|
||||
return softwareModuleTypeRepository.exists(id);
|
||||
}
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public TenantMetaData updateTenantMetadata(final Long defaultDsType) {
|
||||
public TenantMetaData updateTenantMetadata(final long defaultDsType) {
|
||||
final JpaTenantMetaData data = (JpaTenantMetaData) getTenantMetadata();
|
||||
|
||||
data.setDefaultDsType(distributionSetTypeRepository.findOne(defaultDsType));
|
||||
@@ -319,7 +319,7 @@ public class JpaSystemManagement implements CurrentTenantCacheKeyGenerator, Syst
|
||||
}
|
||||
|
||||
@Override
|
||||
public TenantMetaData getTenantMetadata(final Long tenantId) {
|
||||
public TenantMetaData getTenantMetadata(final long tenantId) {
|
||||
return tenantMetaDataRepository.findOne(tenantId);
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public void delete(final Long targetFilterQueryId) {
|
||||
public void delete(final long targetFilterQueryId) {
|
||||
if (!targetFilterQueryRepository.exists(targetFilterQueryId)) {
|
||||
throw new EntityNotFoundException(TargetFilterQuery.class, targetFilterQueryId);
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<TargetFilterQuery> findByAutoAssignDSAndRsql(final Pageable pageable, final Long setId,
|
||||
public Page<TargetFilterQuery> findByAutoAssignDSAndRsql(final Pageable pageable, final long setId,
|
||||
final String rsqlFilter) {
|
||||
final List<Specification<JpaTargetFilterQuery>> specList = Lists.newArrayListWithExpectedSize(2);
|
||||
|
||||
@@ -173,7 +173,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<TargetFilterQuery> get(final Long targetFilterQueryId) {
|
||||
public Optional<TargetFilterQuery> get(final long targetFilterQueryId) {
|
||||
return Optional.ofNullable(targetFilterQueryRepository.findOne(targetFilterQueryId));
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TargetFilterQuery updateAutoAssignDS(final Long queryId, final Long dsId) {
|
||||
public TargetFilterQuery updateAutoAssignDS(final long queryId, final Long dsId) {
|
||||
final JpaTargetFilterQuery targetFilterQuery = findTargetFilterQueryOrThrowExceptionIfNotFound(queryId);
|
||||
|
||||
targetFilterQuery.setAutoAssignDistributionSet(
|
||||
|
||||
@@ -24,7 +24,6 @@ import javax.persistence.criteria.CriteriaQuery;
|
||||
import javax.persistence.criteria.Expression;
|
||||
import javax.persistence.criteria.Predicate;
|
||||
import javax.persistence.criteria.Root;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.eclipse.hawkbit.repository.FilterParams;
|
||||
import org.eclipse.hawkbit.repository.TargetFields;
|
||||
@@ -137,7 +136,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Slice<Target> findByTargetFilterQuery(final Pageable pageable, final Long targetFilterQueryId) {
|
||||
public Slice<Target> findByTargetFilterQuery(final Pageable pageable, final long targetFilterQueryId) {
|
||||
final TargetFilterQuery targetFilterQuery = targetFilterQueryRepository.findById(targetFilterQueryId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(TargetFilterQuery.class, targetFilterQueryId));
|
||||
|
||||
@@ -205,14 +204,14 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByAssignedDistributionSet(final Pageable pageReq, final Long distributionSetID) {
|
||||
public Page<Target> findByAssignedDistributionSet(final Pageable pageReq, final long distributionSetID) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetID);
|
||||
|
||||
return targetRepository.findByAssignedDistributionSetId(pageReq, distributionSetID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByAssignedDistributionSetAndRsql(final Pageable pageReq, final Long distributionSetID,
|
||||
public Page<Target> findByAssignedDistributionSetAndRsql(final Pageable pageReq, final long distributionSetID,
|
||||
final String rsqlParam) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetID);
|
||||
|
||||
@@ -242,13 +241,13 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByInstalledDistributionSet(final Pageable pageReq, final Long distributionSetID) {
|
||||
public Page<Target> findByInstalledDistributionSet(final Pageable pageReq, final long distributionSetID) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetID);
|
||||
return targetRepository.findByInstalledDistributionSetId(pageReq, distributionSetID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByInstalledDistributionSetAndRsql(final Pageable pageable, final Long distributionSetId,
|
||||
public Page<Target> findByInstalledDistributionSetAndRsql(final Pageable pageable, final long distributionSetId,
|
||||
final String rsqlParam) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetId);
|
||||
|
||||
@@ -372,7 +371,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public List<Target> assignTag(final Collection<String> controllerIds, final Long tagId) {
|
||||
public List<Target> assignTag(final Collection<String> controllerIds, final long tagId) {
|
||||
|
||||
final List<JpaTarget> allTargets = targetRepository
|
||||
.findAll(TargetSpecifications.byControllerIdWithTagsInJoin(controllerIds));
|
||||
@@ -399,7 +398,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
@Transactional
|
||||
@Retryable(include = {
|
||||
ConcurrencyFailureException.class }, maxAttempts = Constants.TX_RT_MAX, backoff = @Backoff(delay = Constants.TX_RT_DELAY))
|
||||
public Target unAssignTag(final String controllerID, final Long targetTagId) {
|
||||
public Target unAssignTag(final String controllerID, final long targetTagId) {
|
||||
final JpaTarget target = (JpaTarget) targetRepository.findByControllerId(controllerID)
|
||||
.orElseThrow(() -> new EntityNotFoundException(Target.class, controllerID));
|
||||
|
||||
@@ -417,7 +416,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
|
||||
@Override
|
||||
public Slice<Target> findByFilterOrderByLinkedDistributionSet(final Pageable pageable,
|
||||
final Long orderByDistributionId, final FilterParams filterParams) {
|
||||
final long orderByDistributionId, final FilterParams filterParams) {
|
||||
final CriteriaBuilder cb = entityManager.getCriteriaBuilder();
|
||||
final CriteriaQuery<JpaTarget> query = cb.createQuery(JpaTarget.class);
|
||||
final Root<JpaTarget> targetRoot = query.from(JpaTarget.class);
|
||||
@@ -470,21 +469,21 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByAssignedDistributionSet(final Long distId) {
|
||||
public long countByAssignedDistributionSet(final long distId) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distId);
|
||||
|
||||
return targetRepository.countByAssignedDistributionSetId(distId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByInstalledDistributionSet(final Long distId) {
|
||||
public long countByInstalledDistributionSet(final long distId) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distId);
|
||||
|
||||
return targetRepository.countByInstalledDistributionSetId(distId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByTargetFilterQueryAndNonDS(final Pageable pageRequest, final Long distributionSetId,
|
||||
public Page<Target> findByTargetFilterQueryAndNonDS(final Pageable pageRequest, final long distributionSetId,
|
||||
final String targetFilterQuery) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetId);
|
||||
|
||||
@@ -512,8 +511,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByInRolloutGroupWithoutAction(@NotNull final Pageable pageRequest,
|
||||
@NotNull final Long group) {
|
||||
public Page<Target> findByInRolloutGroupWithoutAction(final Pageable pageRequest, final long group) {
|
||||
if (!rolloutGroupRepository.exists(group)) {
|
||||
throw new EntityNotFoundException(RolloutGroup.class, group);
|
||||
}
|
||||
@@ -534,7 +532,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByRsqlAndNonDS(final Long distributionSetId, final String targetFilterQuery) {
|
||||
public long countByRsqlAndNonDS(final long distributionSetId, final String targetFilterQuery) {
|
||||
throwEntityNotFoundIfDsDoesNotExist(distributionSetId);
|
||||
|
||||
final Specification<JpaTarget> spec = RSQLUtility.parse(targetFilterQuery, TargetFields.class,
|
||||
@@ -564,7 +562,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByTag(final Pageable pageable, final Long tagId) {
|
||||
public Page<Target> findByTag(final Pageable pageable, final long tagId) {
|
||||
throwEntityNotFoundExceptionIfTagDoesNotExist(tagId);
|
||||
|
||||
return convertPage(targetRepository.findByTag(pageable, tagId), pageable);
|
||||
@@ -577,7 +575,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Target> findByRsqlAndTag(final Pageable pageable, final String rsqlParam, final Long tagId) {
|
||||
public Page<Target> findByRsqlAndTag(final Pageable pageable, final String rsqlParam, final long tagId) {
|
||||
|
||||
throwEntityNotFoundExceptionIfTagDoesNotExist(tagId);
|
||||
|
||||
@@ -589,7 +587,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public long countByTargetFilterQuery(final Long targetFilterQueryId) {
|
||||
public long countByTargetFilterQuery(final long targetFilterQueryId) {
|
||||
final TargetFilterQuery targetFilterQuery = targetFilterQueryRepository.findById(targetFilterQueryId)
|
||||
.orElseThrow(() -> new EntityNotFoundException(TargetFilterQuery.class, targetFilterQueryId));
|
||||
|
||||
@@ -609,7 +607,7 @@ public class JpaTargetManagement implements TargetManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Target> get(final Long id) {
|
||||
public Optional<Target> get(final long id) {
|
||||
return Optional.ofNullable(targetRepository.findOne(id));
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ public class JpaTargetTagManagement implements TargetTagManagement {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<TargetTag> get(final Long id) {
|
||||
public Optional<TargetTag> get(final long id) {
|
||||
return Optional.ofNullable(targetTagRepository.findOne(id));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,13 +18,13 @@ import javax.persistence.Index;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.artifact.repository.model.AbstractDbArtifact;
|
||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* JPA implementation of {@link LocalArtifact}.
|
||||
|
||||
@@ -17,12 +17,12 @@ import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.NamedEntity;
|
||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* Stored target filter.
|
||||
|
||||
@@ -13,11 +13,11 @@ import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import org.eclipse.hawkbit.repository.model.TenantConfiguration;
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* A JPA entity which stores the tenant specific configuration.
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.google.common.collect.Lists;
|
||||
@TestPropertySource(locations = "classpath:/jpa-test.properties")
|
||||
public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest {
|
||||
|
||||
protected static final String INVALID_TEXT_HTML = "</noscript><br><script>";
|
||||
protected static final String NOT_EXIST_ID = "1234";
|
||||
protected static final long NOT_EXIST_IDL = Long.parseLong(NOT_EXIST_ID);
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTest {
|
||||
@ExpectEvents({ @Expect(type = SoftwareModuleDeletedEvent.class, count = 0) })
|
||||
public void entityQueriesReferringToNotExistingEntitiesThrowsException() throws URISyntaxException {
|
||||
|
||||
verifyThrownExceptionBy(() -> artifactManagement.create(IOUtils.toInputStream("test", "UTF-8"),
|
||||
NOT_EXIST_IDL, "xxx", null, null, false, null), "SoftwareModule");
|
||||
verifyThrownExceptionBy(() -> artifactManagement.create(IOUtils.toInputStream("test", "UTF-8"), NOT_EXIST_IDL,
|
||||
"xxx", null, null, false, null), "SoftwareModule");
|
||||
|
||||
verifyThrownExceptionBy(
|
||||
() -> artifactManagement.create(IOUtils.toInputStream("test", "UTF-8"), 1234L, "xxx", false),
|
||||
@@ -76,8 +76,7 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
verifyThrownExceptionBy(() -> artifactManagement.delete(NOT_EXIST_IDL), "Artifact");
|
||||
|
||||
verifyThrownExceptionBy(() -> artifactManagement.findBySoftwareModule(PAGE, NOT_EXIST_IDL),
|
||||
"SoftwareModule");
|
||||
verifyThrownExceptionBy(() -> artifactManagement.findBySoftwareModule(PAGE, NOT_EXIST_IDL), "SoftwareModule");
|
||||
assertThat(artifactManagement.getByFilename(NOT_EXIST_ID).isPresent()).isFalse();
|
||||
|
||||
verifyThrownExceptionBy(() -> artifactManagement.getByFilenameAndSoftwareModule("xxx", NOT_EXIST_IDL),
|
||||
@@ -102,12 +101,11 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
final byte random[] = RandomStringUtils.random(5 * 1024).getBytes();
|
||||
|
||||
final Artifact result = artifactManagement.create(new ByteArrayInputStream(random), sm.getId(), "file1",
|
||||
false);
|
||||
final Artifact result = artifactManagement.create(new ByteArrayInputStream(random), sm.getId(), "file1", false);
|
||||
artifactManagement.create(new ByteArrayInputStream(random), sm.getId(), "file11", false);
|
||||
artifactManagement.create(new ByteArrayInputStream(random), sm.getId(), "file12", false);
|
||||
final Artifact result2 = artifactManagement.create(new ByteArrayInputStream(random), sm2.getId(),
|
||||
"file2", false);
|
||||
final Artifact result2 = artifactManagement.create(new ByteArrayInputStream(random), sm2.getId(), "file2",
|
||||
false);
|
||||
|
||||
assertThat(result).isInstanceOf(Artifact.class);
|
||||
assertThat(result.getSoftwareModule().getId()).isEqualTo(sm.getId());
|
||||
@@ -162,10 +160,10 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
assertThat(artifactRepository.findAll()).isEmpty();
|
||||
|
||||
final Artifact result = artifactManagement.create(new RandomGeneratedInputStream(5 * 1024), sm.getId(),
|
||||
"file1", false);
|
||||
final Artifact result2 = artifactManagement.create(new RandomGeneratedInputStream(5 * 1024),
|
||||
sm2.getId(), "file2", false);
|
||||
final Artifact result = artifactManagement.create(new RandomGeneratedInputStream(5 * 1024), sm.getId(), "file1",
|
||||
false);
|
||||
final Artifact result2 = artifactManagement.create(new RandomGeneratedInputStream(5 * 1024), sm2.getId(),
|
||||
"file2", false);
|
||||
|
||||
assertThat(artifactRepository.findAll()).hasSize(2);
|
||||
|
||||
@@ -204,10 +202,9 @@ public class ArtifactManagementTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
final byte random[] = RandomStringUtils.random(5 * 1024).getBytes();
|
||||
|
||||
final Artifact result = artifactManagement.create(new ByteArrayInputStream(random), sm.getId(), "file1",
|
||||
final Artifact result = artifactManagement.create(new ByteArrayInputStream(random), sm.getId(), "file1", false);
|
||||
final Artifact result2 = artifactManagement.create(new ByteArrayInputStream(random), sm2.getId(), "file2",
|
||||
false);
|
||||
final Artifact result2 = artifactManagement.create(new ByteArrayInputStream(random), sm2.getId(),
|
||||
"file2", false);
|
||||
|
||||
assertThat(artifactRepository.findAll()).hasSize(2);
|
||||
assertThat(result.getId()).isNotNull();
|
||||
|
||||
@@ -15,6 +15,7 @@ import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -146,6 +147,33 @@ public class ControllerManagementTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(6);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Controller confirmation failes with invalid messages.")
|
||||
@ExpectEvents({ @Expect(type = TargetCreatedEvent.class, count = 1),
|
||||
@Expect(type = DistributionSetCreatedEvent.class, count = 1),
|
||||
@Expect(type = ActionCreatedEvent.class, count = 1), @Expect(type = TargetUpdatedEvent.class, count = 1),
|
||||
@Expect(type = TargetAssignDistributionSetEvent.class, count = 1),
|
||||
@Expect(type = SoftwareModuleCreatedEvent.class, count = 3) })
|
||||
public void controllerConfirmationFailsWithInvalidMessages() {
|
||||
final Long actionId = createTargetAndAssignDs();
|
||||
|
||||
simulateIntermediateStatusOnUpdate(actionId);
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> controllerManagement.addUpdateActionStatus(entityFactory.actionStatus()
|
||||
.create(actionId).status(Action.Status.FINISHED).message(INVALID_TEXT_HTML)))
|
||||
.as("set invalid description text should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> controllerManagement.addUpdateActionStatus(
|
||||
entityFactory.actionStatus().create(actionId).status(Action.Status.FINISHED)
|
||||
.messages(Arrays.asList("this is valid.", INVALID_TEXT_HTML))))
|
||||
.as("set invalid description text should not be created");
|
||||
|
||||
assertThat(actionStatusRepository.count()).isEqualTo(5);
|
||||
assertThat(controllerManagement.findActionStatusByAction(PAGE, actionId).getNumberOfElements()).isEqualTo(5);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Controller confirms successfull update with FINISHED status on a action that is on canceling. "
|
||||
+ "Reason: The decission to ignore the cancellation is in fact up to the controller.")
|
||||
|
||||
@@ -66,6 +66,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
@Features("Component Tests - Repository")
|
||||
@Stories("DistributionSet Management")
|
||||
public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
@Test
|
||||
@Description("Verifies that management get access react as specfied on calls for non existing entities by means "
|
||||
+ "of Optional not present.")
|
||||
@@ -77,7 +78,6 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
||||
assertThat(distributionSetManagement.getWithDetails(NOT_EXIST_IDL)).isNotPresent();
|
||||
assertThat(distributionSetManagement.getByNameAndVersion(NOT_EXIST_ID, NOT_EXIST_ID)).isNotPresent();
|
||||
assertThat(distributionSetManagement.getMetaDataByDistributionSetId(set.getId(), NOT_EXIST_ID)).isNotPresent();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -192,11 +192,21 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
||||
.version("a").description(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.as("entity with too long description should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.create(
|
||||
entityFactory.distributionSet().create().name("a").version("a").description(INVALID_TEXT_HTML)))
|
||||
.as("entity with invalid description should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
||||
.description(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.as("entity with too long description should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement
|
||||
.update(entityFactory.distributionSet().update(set.getId()).description(INVALID_TEXT_HTML)))
|
||||
.as("entity with invalid characters should not be updated");
|
||||
|
||||
}
|
||||
|
||||
@Step
|
||||
@@ -209,13 +219,23 @@ public class DistributionSetManagementTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||
() -> distributionSetManagement.create(entityFactory.distributionSet().create().version("a").name("")))
|
||||
.as("entity with too long name should not be created");
|
||||
.as("entity with too short name should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement
|
||||
.create(entityFactory.distributionSet().create().version("a").name(INVALID_TEXT_HTML)))
|
||||
.as("entity with invalid characters in name should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
||||
.name(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("entity with too long name should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement
|
||||
.update(entityFactory.distributionSet().update(set.getId()).name(INVALID_TEXT_HTML)))
|
||||
.as("entity with invalid characters should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||
() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId()).name("")))
|
||||
.as("entity with too short name should not be updated");
|
||||
|
||||
@@ -95,28 +95,42 @@ public class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTes
|
||||
private void createAndUpdateDistributionSetWithInvalidDescription(final DistributionSet set) {
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet()
|
||||
.create().name("a").version("a").description(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet().create().name("a")
|
||||
.version("a").description(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.as("set with too long description should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet()
|
||||
.update(set.getId()).description(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.isThrownBy(() -> distributionSetManagement.create(
|
||||
entityFactory.distributionSet().create().name("a").version("a").description(INVALID_TEXT_HTML)))
|
||||
.as("set invalid description text should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
||||
.description(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.as("set with too long description should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement
|
||||
.update(entityFactory.distributionSet().update(set.getId()).description(INVALID_TEXT_HTML)))
|
||||
.as("set with invalid description should not be updated");
|
||||
|
||||
}
|
||||
|
||||
@Step
|
||||
private void createAndUpdateDistributionSetWithInvalidName(final DistributionSet set) {
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet()
|
||||
.create().version("a").name(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet().create().version("a")
|
||||
.name(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("set with too long name should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement
|
||||
.create(entityFactory.distributionSet().create().version("a").name("")))
|
||||
.create(entityFactory.distributionSet().create().version("a").name(INVALID_TEXT_HTML)))
|
||||
.as("set with invalid name should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||
() -> distributionSetManagement.create(entityFactory.distributionSet().create().version("a").name("")))
|
||||
.as("set with too short name should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
@@ -125,13 +139,17 @@ public class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTes
|
||||
.as("set with null name should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet()
|
||||
.update(set.getId()).name(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
||||
.name(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("set with too long name should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement
|
||||
.update(entityFactory.distributionSet().update(set.getId()).name("")))
|
||||
.update(entityFactory.distributionSet().update(set.getId()).name(INVALID_TEXT_HTML)))
|
||||
.as("set with invalid name should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||
() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId()).name("")))
|
||||
.as("set with too short name should not be updated");
|
||||
}
|
||||
|
||||
@@ -139,29 +157,37 @@ public class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTes
|
||||
private void createAndUpdateDistributionSetWithInvalidVersion(final DistributionSet set) {
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet()
|
||||
.create().name("a").version(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("set with too long name should not be created");
|
||||
.isThrownBy(() -> distributionSetManagement.create(entityFactory.distributionSet().create().name("a")
|
||||
.version(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("set with too long version should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement
|
||||
.create(entityFactory.distributionSet().create().name("a").version("")))
|
||||
.as("set with too short name should not be created");
|
||||
.create(entityFactory.distributionSet().create().name("a").version(INVALID_TEXT_HTML)))
|
||||
.as("set with invalid version should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||
() -> distributionSetManagement.create(entityFactory.distributionSet().create().name("a").version("")))
|
||||
.as("set with too short version should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement
|
||||
.create(entityFactory.distributionSet().create().name("a").version(null)))
|
||||
.as("set with null name should not be created");
|
||||
.as("set with null version should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet()
|
||||
.update(set.getId()).version(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("set with too long name should not be updated");
|
||||
.isThrownBy(() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId())
|
||||
.version(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("set with too long version should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> distributionSetManagement
|
||||
.update(entityFactory.distributionSet().update(set.getId()).version("")))
|
||||
.as("set with too short name should not be updated");
|
||||
.update(entityFactory.distributionSet().update(set.getId()).version(INVALID_TEXT_HTML)))
|
||||
.as("set with invalid version should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||
() -> distributionSetManagement.update(entityFactory.distributionSet().update(set.getId()).version("")))
|
||||
.as("set with too short version should not be updated");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -195,8 +221,8 @@ public class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTes
|
||||
final DistributionSetType nonUpdatableType = distributionSetTypeManagement.create(entityFactory
|
||||
.distributionSetType().create().key("updatableType").name("to be deleted").colour("test123"));
|
||||
assertThat(distributionSetTypeManagement.getByKey("updatableType").get().getMandatoryModuleTypes()).isEmpty();
|
||||
distributionSetManagement.create(entityFactory.distributionSet().create().name("newtypesoft")
|
||||
.version("1").type(nonUpdatableType.getKey()));
|
||||
distributionSetManagement.create(entityFactory.distributionSet().create().name("newtypesoft").version("1")
|
||||
.type(nonUpdatableType.getKey()));
|
||||
|
||||
distributionSetTypeManagement.update(
|
||||
entityFactory.distributionSetType().update(nonUpdatableType.getId()).description("a new description"));
|
||||
@@ -212,8 +238,8 @@ public class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTes
|
||||
final DistributionSetType nonUpdatableType = distributionSetTypeManagement
|
||||
.create(entityFactory.distributionSetType().create().key("updatableType").name("to be deleted"));
|
||||
assertThat(distributionSetTypeManagement.getByKey("updatableType").get().getMandatoryModuleTypes()).isEmpty();
|
||||
distributionSetManagement.create(entityFactory.distributionSet().create().name("newtypesoft")
|
||||
.version("1").type(nonUpdatableType.getKey()));
|
||||
distributionSetManagement.create(entityFactory.distributionSet().create().name("newtypesoft").version("1")
|
||||
.type(nonUpdatableType.getKey()));
|
||||
|
||||
assertThatThrownBy(() -> distributionSetTypeManagement
|
||||
.assignMandatorySoftwareModuleTypes(nonUpdatableType.getId(), Sets.newHashSet(osType.getId())))
|
||||
@@ -229,8 +255,8 @@ public class DistributionSetTypeManagementTest extends AbstractJpaIntegrationTes
|
||||
|
||||
nonUpdatableType = distributionSetTypeManagement.assignMandatorySoftwareModuleTypes(nonUpdatableType.getId(),
|
||||
Sets.newHashSet(osType.getId()));
|
||||
distributionSetManagement.create(entityFactory.distributionSet().create().name("newtypesoft")
|
||||
.version("1").type(nonUpdatableType.getKey()));
|
||||
distributionSetManagement.create(entityFactory.distributionSet().create().name("newtypesoft").version("1")
|
||||
.type(nonUpdatableType.getKey()));
|
||||
|
||||
final Long typeId = nonUpdatableType.getId();
|
||||
assertThatThrownBy(() -> distributionSetTypeManagement.unassignSoftwareModuleType(typeId, osType.getId()))
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetTagCreatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.exception.InvalidTargetAddressException;
|
||||
import org.eclipse.hawkbit.repository.exception.TenantNotExistException;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTarget;
|
||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||
@@ -208,11 +209,21 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
||||
.description(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.as("target with too long description should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement
|
||||
.create(entityFactory.target().create().controllerId("a").description(INVALID_TEXT_HTML)))
|
||||
.as("target with invalid description should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement.update(entityFactory.target().update(target.getControllerId())
|
||||
.description(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.as("target with too long description should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement
|
||||
.update(entityFactory.target().update(target.getControllerId()).description(INVALID_TEXT_HTML)))
|
||||
.as("target with invalid description should not be updated");
|
||||
|
||||
}
|
||||
|
||||
@Step
|
||||
@@ -223,11 +234,21 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
||||
.name(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("target with too long name should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement
|
||||
.create(entityFactory.target().create().controllerId("a").name(INVALID_TEXT_HTML)))
|
||||
.as("target with invalidname should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement.update(entityFactory.target().update(target.getControllerId())
|
||||
.name(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("target with too long name should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement
|
||||
.update(entityFactory.target().update(target.getControllerId()).name(INVALID_TEXT_HTML)))
|
||||
.as("target with invalid name should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(
|
||||
() -> targetManagement.update(entityFactory.target().update(target.getControllerId()).name("")))
|
||||
@@ -243,11 +264,21 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
||||
.securityToken(RandomStringUtils.randomAlphanumeric(129))))
|
||||
.as("target with too long token should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement
|
||||
.create(entityFactory.target().create().controllerId("a").securityToken(INVALID_TEXT_HTML)))
|
||||
.as("target with invalid token should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement.update(entityFactory.target().update(target.getControllerId())
|
||||
.securityToken(RandomStringUtils.randomAlphanumeric(129))))
|
||||
.as("target with too long token should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement.update(
|
||||
entityFactory.target().update(target.getControllerId()).securityToken(INVALID_TEXT_HTML)))
|
||||
.as("target with invalid token should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement
|
||||
.update(entityFactory.target().update(target.getControllerId()).securityToken("")))
|
||||
@@ -262,10 +293,20 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
||||
.address(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.as("target with too long address should not be created");
|
||||
|
||||
assertThatExceptionOfType(InvalidTargetAddressException.class)
|
||||
.isThrownBy(() -> targetManagement
|
||||
.create(entityFactory.target().create().controllerId("a").address(INVALID_TEXT_HTML)))
|
||||
.as("target with invalid should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement.update(entityFactory.target().update(target.getControllerId())
|
||||
.address(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.as("target with too long address should not be updated");
|
||||
|
||||
assertThatExceptionOfType(InvalidTargetAddressException.class)
|
||||
.isThrownBy(() -> targetManagement
|
||||
.update(entityFactory.target().update(target.getControllerId()).address(INVALID_TEXT_HTML)))
|
||||
.as("target with invalid address should not be updated");
|
||||
}
|
||||
|
||||
@Step
|
||||
@@ -283,18 +324,15 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
||||
.create(entityFactory.target().create().controllerId(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("target with too long controller id should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(
|
||||
() -> targetManagement.create(entityFactory.target().create().controllerId(INVALID_TEXT_HTML)))
|
||||
.as("target with invalid controller id should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement.create(entityFactory.target().create().controllerId(" ")))
|
||||
.as(WHITESPACE_ERROR);
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement.create(entityFactory.target().create().controllerId(" a")))
|
||||
.as(WHITESPACE_ERROR);
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement.create(entityFactory.target().create().controllerId("a ")))
|
||||
.as(WHITESPACE_ERROR);
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetManagement.create(entityFactory.target().create().controllerId("a b")))
|
||||
.as(WHITESPACE_ERROR);
|
||||
@@ -330,8 +368,7 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
||||
final List<Target> assignedTargets = targetManagement.assignTag(assignTarget, targetTag.getId());
|
||||
assertThat(assignedTargets.size()).as("Assigned targets are wrong").isEqualTo(4);
|
||||
assignedTargets.forEach(target -> assertThat(
|
||||
targetTagManagement.findByTarget(PAGE, target.getControllerId()).getNumberOfElements())
|
||||
.isEqualTo(1));
|
||||
targetTagManagement.findByTarget(PAGE, target.getControllerId()).getNumberOfElements()).isEqualTo(1));
|
||||
|
||||
TargetTag findTargetTag = targetTagManagement.getByName("Tag1").get();
|
||||
assertThat(assignedTargets.size()).as("Assigned targets are wrong")
|
||||
@@ -339,8 +376,8 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
final Target unAssignTarget = targetManagement.unAssignTag("targetId123", findTargetTag.getId());
|
||||
assertThat(unAssignTarget.getControllerId()).as("Controller id is wrong").isEqualTo("targetId123");
|
||||
assertThat(targetTagManagement.findByTarget(PAGE, unAssignTarget.getControllerId()))
|
||||
.as("Tag size is wrong").isEmpty();
|
||||
assertThat(targetTagManagement.findByTarget(PAGE, unAssignTarget.getControllerId())).as("Tag size is wrong")
|
||||
.isEmpty();
|
||||
findTargetTag = targetTagManagement.getByName("Tag1").get();
|
||||
assertThat(targetManagement.findByTag(PAGE, targetTag.getId())).as("Assigned targets are wrong").hasSize(3);
|
||||
assertThat(targetManagement.findByRsqlAndTag(PAGE, "controllerId==targetId123", targetTag.getId()))
|
||||
@@ -631,16 +668,16 @@ public class TargetManagementTest extends AbstractJpaIntegrationTest {
|
||||
t2Tags.forEach(tag -> targetManagement.assignTag(Arrays.asList(t2.getControllerId()), tag.getId()));
|
||||
|
||||
final Target t11 = targetManagement.getByControllerID(t1.getControllerId()).get();
|
||||
assertThat(targetTagManagement.findByTarget(PAGE, t11.getControllerId()).getContent())
|
||||
.as("Tag size is wrong").hasSize(noT1Tags).containsAll(t1Tags);
|
||||
assertThat(targetTagManagement.findByTarget(PAGE, t11.getControllerId()).getContent())
|
||||
.as("Tag size is wrong").hasSize(noT1Tags).doesNotContain(Iterables.toArray(t2Tags, TargetTag.class));
|
||||
assertThat(targetTagManagement.findByTarget(PAGE, t11.getControllerId()).getContent()).as("Tag size is wrong")
|
||||
.hasSize(noT1Tags).containsAll(t1Tags);
|
||||
assertThat(targetTagManagement.findByTarget(PAGE, t11.getControllerId()).getContent()).as("Tag size is wrong")
|
||||
.hasSize(noT1Tags).doesNotContain(Iterables.toArray(t2Tags, TargetTag.class));
|
||||
|
||||
final Target t21 = targetManagement.getByControllerID(t2.getControllerId()).get();
|
||||
assertThat(targetTagManagement.findByTarget(PAGE, t21.getControllerId()).getContent())
|
||||
.as("Tag size is wrong").hasSize(noT2Tags).containsAll(t2Tags);
|
||||
assertThat(targetTagManagement.findByTarget(PAGE, t21.getControllerId()).getContent())
|
||||
.as("Tag size is wrong").hasSize(noT2Tags).doesNotContain(Iterables.toArray(t1Tags, TargetTag.class));
|
||||
assertThat(targetTagManagement.findByTarget(PAGE, t21.getControllerId()).getContent()).as("Tag size is wrong")
|
||||
.hasSize(noT2Tags).containsAll(t2Tags);
|
||||
assertThat(targetTagManagement.findByTarget(PAGE, t21.getControllerId()).getContent()).as("Tag size is wrong")
|
||||
.hasSize(noT2Tags).doesNotContain(Iterables.toArray(t1Tags, TargetTag.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
package org.eclipse.hawkbit.repository.jpa;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -17,6 +18,9 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.validation.ConstraintViolationException;
|
||||
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.DistributionSetTagUpdatedEvent;
|
||||
import org.eclipse.hawkbit.repository.event.remote.entity.TargetCreatedEvent;
|
||||
@@ -33,6 +37,7 @@ import org.junit.Test;
|
||||
|
||||
import ru.yandex.qatools.allure.annotations.Description;
|
||||
import ru.yandex.qatools.allure.annotations.Features;
|
||||
import ru.yandex.qatools.allure.annotations.Step;
|
||||
import ru.yandex.qatools.allure.annotations.Stories;
|
||||
|
||||
/**
|
||||
@@ -66,6 +71,89 @@ public class TargetTagManagementTest extends AbstractJpaIntegrationTest {
|
||||
verifyThrownExceptionBy(() -> targetTagManagement.findByTarget(PAGE, NOT_EXIST_ID), "Target");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that a tag with with invalid properties cannot be created or updated")
|
||||
public void createAndUpdateTagWithInvalidFields() {
|
||||
final TargetTag tag = targetTagManagement
|
||||
.create(entityFactory.tag().create().name("tag1").description("tagdesc1"));
|
||||
|
||||
createAndUpdateTagWithInvalidDescription(tag);
|
||||
createAndUpdateTagWithInvalidColour(tag);
|
||||
createAndUpdateTagWithInvalidName(tag);
|
||||
}
|
||||
|
||||
@Step
|
||||
private void createAndUpdateTagWithInvalidDescription(final Tag tag) {
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetTagManagement.create(
|
||||
entityFactory.tag().create().name("a").description(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.as("tag with too long description should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||
() -> targetTagManagement.create(entityFactory.tag().create().name("a").description(INVALID_TEXT_HTML)))
|
||||
.as("tag with invalid description should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetTagManagement.update(
|
||||
entityFactory.tag().update(tag.getId()).description(RandomStringUtils.randomAlphanumeric(513))))
|
||||
.as("tag with too long description should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetTagManagement
|
||||
.update(entityFactory.tag().update(tag.getId()).description(INVALID_TEXT_HTML)))
|
||||
.as("tag with invalid description should not be updated");
|
||||
}
|
||||
|
||||
@Step
|
||||
private void createAndUpdateTagWithInvalidColour(final Tag tag) {
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetTagManagement.create(
|
||||
entityFactory.tag().create().name("a").colour(RandomStringUtils.randomAlphanumeric(17))))
|
||||
.as("tag with too long colour should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||
() -> targetTagManagement.create(entityFactory.tag().create().name("a").colour(INVALID_TEXT_HTML)))
|
||||
.as("tag with invalid colour should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetTagManagement.update(
|
||||
entityFactory.tag().update(tag.getId()).colour(RandomStringUtils.randomAlphanumeric(17))))
|
||||
.as("tag with too long colour should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||
() -> targetTagManagement.update(entityFactory.tag().update(tag.getId()).colour(INVALID_TEXT_HTML)))
|
||||
.as("tag with invalid colour should not be updated");
|
||||
}
|
||||
|
||||
@Step
|
||||
private void createAndUpdateTagWithInvalidName(final Tag tag) {
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetTagManagement
|
||||
.create(entityFactory.tag().create().name(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("tag with too long name should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetTagManagement.create(entityFactory.tag().create().name(INVALID_TEXT_HTML)))
|
||||
.as("tag with invalidname should not be created");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetTagManagement
|
||||
.update(entityFactory.tag().update(tag.getId()).name(RandomStringUtils.randomAlphanumeric(65))))
|
||||
.as("tag with too long name should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class).isThrownBy(
|
||||
() -> targetTagManagement.update(entityFactory.tag().update(tag.getId()).name(INVALID_TEXT_HTML)))
|
||||
.as("tag with invalid name should not be updated");
|
||||
|
||||
assertThatExceptionOfType(ConstraintViolationException.class)
|
||||
.isThrownBy(() -> targetTagManagement.update(entityFactory.tag().update(tag.getId()).name("")))
|
||||
.as("tag with too short name should not be updated");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verifies the toogle mechanism by means on assigning tag if at least on target in the list does not have"
|
||||
+ "the tag yet. Unassign if all of them have the tag already.")
|
||||
@@ -80,8 +168,8 @@ public class TargetTagManagementTest extends AbstractJpaIntegrationTest {
|
||||
TargetTagAssignmentResult result = toggleTagAssignment(groupA, tag);
|
||||
assertThat(result.getAlreadyAssigned()).isEqualTo(0);
|
||||
assertThat(result.getAssigned()).isEqualTo(20);
|
||||
assertThat(result.getAssignedEntity()).containsAll(targetManagement.getByControllerID(
|
||||
groupA.stream().map(target -> target.getControllerId()).collect(Collectors.toList())));
|
||||
assertThat(result.getAssignedEntity()).containsAll(targetManagement
|
||||
.getByControllerID(groupA.stream().map(Target::getControllerId).collect(Collectors.toList())));
|
||||
assertThat(result.getUnassigned()).isEqualTo(0);
|
||||
assertThat(result.getUnassignedEntity()).isEmpty();
|
||||
assertThat(result.getTargetTag()).isEqualTo(tag);
|
||||
@@ -90,8 +178,8 @@ public class TargetTagManagementTest extends AbstractJpaIntegrationTest {
|
||||
result = toggleTagAssignment(concat(groupA, groupB), tag);
|
||||
assertThat(result.getAlreadyAssigned()).isEqualTo(20);
|
||||
assertThat(result.getAssigned()).isEqualTo(20);
|
||||
assertThat(result.getAssignedEntity()).containsAll(targetManagement.getByControllerID(
|
||||
groupB.stream().map(target -> target.getControllerId()).collect(Collectors.toList())));
|
||||
assertThat(result.getAssignedEntity()).containsAll(targetManagement
|
||||
.getByControllerID(groupB.stream().map(Target::getControllerId).collect(Collectors.toList())));
|
||||
assertThat(result.getUnassigned()).isEqualTo(0);
|
||||
assertThat(result.getUnassignedEntity()).isEmpty();
|
||||
assertThat(result.getTargetTag()).isEqualTo(tag);
|
||||
@@ -132,10 +220,8 @@ public class TargetTagManagementTest extends AbstractJpaIntegrationTest {
|
||||
|
||||
assertThat(targetTagRepository.findByNameEquals("kai1").get().getDescription()).as("wrong tag ed")
|
||||
.isEqualTo("kai2");
|
||||
assertThat(targetTagManagement.getByName("kai1").get().getColour()).as("wrong tag found")
|
||||
.isEqualTo("colour");
|
||||
assertThat(targetTagManagement.get(tag.getId()).get().getColour()).as("wrong tag found")
|
||||
.isEqualTo("colour");
|
||||
assertThat(targetTagManagement.getByName("kai1").get().getColour()).as("wrong tag found").isEqualTo("colour");
|
||||
assertThat(targetTagManagement.get(tag.getId()).get().getColour()).as("wrong tag found").isEqualTo("colour");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -21,7 +21,6 @@ import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.eclipse.hawkbit.rest.filter.ExcludePathAwareShallowETagFilter;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
|
||||
@@ -207,7 +207,8 @@ public abstract class JsonBuilder {
|
||||
* @throws JSONException
|
||||
*/
|
||||
public static String deploymentActionFeedback(final String id, final String execution) throws JSONException {
|
||||
return deploymentActionFeedback(id, execution, "none", Arrays.asList(RandomStringUtils.randomAscii(1000)));
|
||||
return deploymentActionFeedback(id, execution, "none",
|
||||
Arrays.asList(RandomStringUtils.randomAlphanumeric(1000)));
|
||||
|
||||
}
|
||||
|
||||
@@ -516,7 +517,7 @@ public abstract class JsonBuilder {
|
||||
}
|
||||
|
||||
public static String cancelActionFeedback(final String id, final String execution) throws JSONException {
|
||||
return cancelActionFeedback(id, execution, RandomStringUtils.randomAscii(1000));
|
||||
return cancelActionFeedback(id, execution, RandomStringUtils.randomAlphanumeric(1000));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,14 @@ public class UiProperties implements Serializable {
|
||||
|
||||
private boolean gravatar;
|
||||
|
||||
private final Links links = new Links();
|
||||
|
||||
private final Login login = new Login();
|
||||
|
||||
private final Demo demo = new Demo();
|
||||
|
||||
private final Event event = new Event();
|
||||
|
||||
public boolean isGravatar() {
|
||||
return gravatar;
|
||||
}
|
||||
@@ -316,14 +324,6 @@ public class UiProperties implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
private final Links links = new Links();
|
||||
|
||||
private final Login login = new Login();
|
||||
|
||||
private final Demo demo = new Demo();
|
||||
|
||||
private final Event event = new Event();
|
||||
|
||||
public Demo getDemo() {
|
||||
return demo;
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ package org.eclipse.hawkbit.ui.common.tagdetails;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.model.Target;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.SPUILabelDefinitions;
|
||||
import org.eclipse.hawkbit.ui.utils.UIComponentIdProvider;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.vaadin.spring.events.EventBus.UIEventBus;
|
||||
import org.vaadin.spring.events.EventScope;
|
||||
import org.vaadin.spring.events.annotation.EventBusListenerMethod;
|
||||
|
||||
@@ -29,8 +29,8 @@ import java.util.concurrent.Executor;
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||
import org.eclipse.hawkbit.repository.model.Action.ActionType;
|
||||
import org.eclipse.hawkbit.ui.common.tagdetails.AbstractTagToken.TagData;
|
||||
|
||||
@@ -14,8 +14,8 @@ import java.util.concurrent.Executor;
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
import org.eclipse.hawkbit.ui.common.builder.TextAreaBuilder;
|
||||
|
||||
@@ -15,8 +15,8 @@ import java.util.concurrent.Executor;
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
|
||||
@@ -13,8 +13,8 @@ import java.util.concurrent.Executor;
|
||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||
import org.eclipse.hawkbit.repository.TargetTagManagement;
|
||||
import org.eclipse.hawkbit.ui.SpPermissionChecker;
|
||||
import org.eclipse.hawkbit.ui.UiProperties;
|
||||
import org.eclipse.hawkbit.ui.common.table.AbstractTableLayout;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
package org.eclipse.hawkbit.ui.tenantconfiguration.authentication;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||
import org.eclipse.hawkbit.security.SecurityTokenGenerator;
|
||||
import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationProperties.TenantConfigurationKey;
|
||||
@@ -17,6 +16,7 @@ import org.eclipse.hawkbit.ui.components.SPUIComponentProvider;
|
||||
import org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleSmall;
|
||||
import org.eclipse.hawkbit.ui.tenantconfiguration.generic.AbstractBooleanTenantConfigurationItem;
|
||||
import org.eclipse.hawkbit.ui.utils.VaadinMessageSource;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.vaadin.server.FontAwesome;
|
||||
import com.vaadin.ui.Button;
|
||||
|
||||
12
pom.xml
12
pom.xml
@@ -129,6 +129,8 @@
|
||||
<!-- Avoid extra CQs through transitive dependencies -->
|
||||
<jboss-logging.version>3.2.1.Final</jboss-logging.version>
|
||||
<tomcat.version>8.0.28</tomcat.version>
|
||||
|
||||
<hibernate-validator.version>6.0.7.Final</hibernate-validator.version>
|
||||
<!-- Spring boot version overrides - END -->
|
||||
|
||||
<!-- Vaadin versions - START -->
|
||||
@@ -147,9 +149,10 @@
|
||||
<maven.scm.plugin.version>1.9.4</maven.scm.plugin.version>
|
||||
|
||||
<!-- Misc libraries versions - START -->
|
||||
<validation-api.version>1.1.0.Final</validation-api.version>
|
||||
<jsoup.version>1.8.3</jsoup.version>
|
||||
<validation-api.version>2.0.1.Final</validation-api.version>
|
||||
<allure.version>1.5.4</allure.version>
|
||||
<eclipselink.version>2.6.4</eclipselink.version>
|
||||
<eclipselink.version>2.7.1</eclipselink.version>
|
||||
<org.powermock.version>1.6.5</org.powermock.version>
|
||||
<gwtmockito.version>1.1.6</gwtmockito.version>
|
||||
<pl.pragmatists.version>1.0.2</pl.pragmatists.version>
|
||||
@@ -563,6 +566,11 @@
|
||||
</dependency>
|
||||
|
||||
<!-- Misc -->
|
||||
<dependency>
|
||||
<groupId>org.jsoup</groupId>
|
||||
<artifactId>jsoup</artifactId>
|
||||
<version>${jsoup.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user