Removed JPA dependencies from runtime. Test only now.
Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -79,6 +79,11 @@
|
|||||||
<artifactId>hawkbit-http-security</artifactId>
|
<artifactId>hawkbit-http-security</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring -->
|
<!-- Spring -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ package org.eclipse.hawkbit.app;
|
|||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.EnableJpaRepository;
|
||||||
import org.eclipse.hawkbit.autoconfigure.security.EnableHawkbitManagedSecurityConfiguration;
|
import org.eclipse.hawkbit.autoconfigure.security.EnableHawkbitManagedSecurityConfiguration;
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@@ -21,6 +22,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
@EnableHawkbitManagedSecurityConfiguration
|
@EnableHawkbitManagedSecurityConfiguration
|
||||||
// Exception squid:S1118 - Spring boot standard behavior
|
// Exception squid:S1118 - Spring boot standard behavior
|
||||||
@SuppressWarnings({ "squid:S1118" })
|
@SuppressWarnings({ "squid:S1118" })
|
||||||
|
@EnableJpaRepository
|
||||||
public class Start {
|
public class Start {
|
||||||
/**
|
/**
|
||||||
* Main method to start the spring-boot application.
|
* Main method to start the spring-boot application.
|
||||||
|
|||||||
@@ -92,6 +92,11 @@
|
|||||||
<artifactId>hawkbit-http-security</artifactId>
|
<artifactId>hawkbit-http-security</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring -->
|
<!-- Spring -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.app;
|
package org.eclipse.hawkbit.app;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.EnableJpaRepository;
|
||||||
import org.eclipse.hawkbit.autoconfigure.security.EnableHawkbitManagedSecurityConfiguration;
|
import org.eclipse.hawkbit.autoconfigure.security.EnableHawkbitManagedSecurityConfiguration;
|
||||||
import org.eclipse.hawkbit.ddi.EnableDdiApi;
|
import org.eclipse.hawkbit.ddi.EnableDdiApi;
|
||||||
import org.eclipse.hawkbit.mgmt.EnableMgmtApi;
|
import org.eclipse.hawkbit.mgmt.EnableMgmtApi;
|
||||||
@@ -23,6 +24,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
@EnableHawkbitManagedSecurityConfiguration
|
@EnableHawkbitManagedSecurityConfiguration
|
||||||
@EnableMgmtApi
|
@EnableMgmtApi
|
||||||
@EnableDdiApi
|
@EnableDdiApi
|
||||||
|
@EnableJpaRepository
|
||||||
// Exception squid:S1118 - Spring boot standard behavior
|
// Exception squid:S1118 - Spring boot standard behavior
|
||||||
@SuppressWarnings({ "squid:S1118" })
|
@SuppressWarnings({ "squid:S1118" })
|
||||||
public class Start {
|
public class Start {
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
<artifactId>hawkbit-repository-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -54,6 +54,12 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-rest-core</artifactId>
|
<artifactId>hawkbit-rest-core</artifactId>
|
||||||
|
|||||||
@@ -17,10 +17,9 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
|
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
|
||||||
import org.eclipse.hawkbit.ddi.dl.rest.api.DdiDlArtifactStoreControllerRestApi;
|
import org.eclipse.hawkbit.ddi.dl.rest.api.DdiDlArtifactStoreControllerRestApi;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
|
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||||
@@ -60,9 +59,6 @@ public class DdiArtifactStoreController implements DdiDlArtifactStoreControllerR
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ControllerManagement controllerManagement;
|
private ControllerManagement controllerManagement;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CacheWriteNotify cacheWriteNotify;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HawkbitSecurityProperties securityProperties;
|
private HawkbitSecurityProperties securityProperties;
|
||||||
|
|
||||||
@@ -101,7 +97,8 @@ public class DdiArtifactStoreController implements DdiDlArtifactStoreControllerR
|
|||||||
requestResponseContextHolder.getHttpServletRequest(), targetid, artifact);
|
requestResponseContextHolder.getHttpServletRequest(), targetid, artifact);
|
||||||
result = RestResourceConversionHelper.writeFileResponse(artifact,
|
result = RestResourceConversionHelper.writeFileResponse(artifact,
|
||||||
requestResponseContextHolder.getHttpServletResponse(),
|
requestResponseContextHolder.getHttpServletResponse(),
|
||||||
requestResponseContextHolder.getHttpServletRequest(), file, cacheWriteNotify, action.getId());
|
requestResponseContextHolder.getHttpServletRequest(), file, controllerManagement,
|
||||||
|
action.getId());
|
||||||
} else {
|
} else {
|
||||||
result = RestResourceConversionHelper.writeFileResponse(artifact,
|
result = RestResourceConversionHelper.writeFileResponse(artifact,
|
||||||
requestResponseContextHolder.getHttpServletResponse(),
|
requestResponseContextHolder.getHttpServletResponse(),
|
||||||
@@ -149,10 +146,11 @@ public class DdiArtifactStoreController implements DdiDlArtifactStoreControllerR
|
|||||||
actionStatus.setStatus(Status.DOWNLOAD);
|
actionStatus.setStatus(Status.DOWNLOAD);
|
||||||
|
|
||||||
if (range != null) {
|
if (range != null) {
|
||||||
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range + " of: "
|
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range
|
||||||
+ request.getRequestURI());
|
+ " of: " + request.getRequestURI());
|
||||||
} else {
|
} else {
|
||||||
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads: " + request.getRequestURI());
|
actionStatus.addMessage(
|
||||||
|
RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads: " + request.getRequestURI());
|
||||||
}
|
}
|
||||||
controllerManagement.addInformationalActionStatus(actionStatus);
|
controllerManagement.addInformationalActionStatus(actionStatus);
|
||||||
return action;
|
return action;
|
||||||
|
|||||||
@@ -29,12 +29,11 @@ import org.eclipse.hawkbit.ddi.json.model.DdiDeploymentBase;
|
|||||||
import org.eclipse.hawkbit.ddi.json.model.DdiResult.FinalResult;
|
import org.eclipse.hawkbit.ddi.json.model.DdiResult.FinalResult;
|
||||||
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
import org.eclipse.hawkbit.ddi.rest.api.DdiRootControllerRestApi;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
|
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
|
|
||||||
import org.eclipse.hawkbit.repository.model.Action;
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
import org.eclipse.hawkbit.repository.model.Action.Status;
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||||
@@ -83,9 +82,6 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ArtifactManagement artifactManagement;
|
private ArtifactManagement artifactManagement;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private CacheWriteNotify cacheWriteNotify;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private HawkbitSecurityProperties securityProperties;
|
private HawkbitSecurityProperties securityProperties;
|
||||||
|
|
||||||
@@ -167,7 +163,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
|||||||
module);
|
module);
|
||||||
result = RestResourceConversionHelper.writeFileResponse(artifact,
|
result = RestResourceConversionHelper.writeFileResponse(artifact,
|
||||||
requestResponseContextHolder.getHttpServletResponse(),
|
requestResponseContextHolder.getHttpServletResponse(),
|
||||||
requestResponseContextHolder.getHttpServletRequest(), file, cacheWriteNotify, action.getId());
|
requestResponseContextHolder.getHttpServletRequest(), file, controllerManagement,
|
||||||
|
action.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -185,10 +182,11 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
|||||||
statusMessage.setStatus(Status.DOWNLOAD);
|
statusMessage.setStatus(Status.DOWNLOAD);
|
||||||
|
|
||||||
if (range != null) {
|
if (range != null) {
|
||||||
statusMessage.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range + " of: "
|
statusMessage.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads range " + range
|
||||||
+ request.getRequestURI());
|
+ " of: " + request.getRequestURI());
|
||||||
} else {
|
} else {
|
||||||
statusMessage.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads " + request.getRequestURI());
|
statusMessage.addMessage(
|
||||||
|
RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target downloads " + request.getRequestURI());
|
||||||
}
|
}
|
||||||
controllerManagement.addInformationalActionStatus(statusMessage);
|
controllerManagement.addInformationalActionStatus(statusMessage);
|
||||||
return action;
|
return action;
|
||||||
@@ -339,8 +337,8 @@ public class DdiRootController implements DdiRootControllerRestApi {
|
|||||||
LOG.debug("Controller reported intermediate status (actionid: {}, targetid: {}) as we got {} report.", actionid,
|
LOG.debug("Controller reported intermediate status (actionid: {}, targetid: {}) as we got {} report.", actionid,
|
||||||
targetid, feedback.getStatus().getExecution());
|
targetid, feedback.getStatus().getExecution());
|
||||||
actionStatus.setStatus(Status.RUNNING);
|
actionStatus.setStatus(Status.RUNNING);
|
||||||
actionStatus
|
actionStatus.addMessage(
|
||||||
.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target reported " + feedback.getStatus().getExecution());
|
RepositoryConstants.SERVER_MESSAGE_PREFIX + "Target reported " + feedback.getStatus().getExecution());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void handleClosedUpdateStatus(final DdiActionFeedback feedback, final String targetid,
|
private static void handleClosedUpdateStatus(final DdiActionFeedback feedback, final String targetid,
|
||||||
|
|||||||
@@ -23,10 +23,10 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
<artifactId>hawkbit-repository-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-core</artifactId>
|
<artifactId>hawkbit-core</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
@@ -41,6 +41,10 @@
|
|||||||
<artifactId>hawkbit-dmf-api</artifactId>
|
<artifactId>hawkbit-dmf-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-autoconfigure</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.amqp</groupId>
|
<groupId>org.springframework.amqp</groupId>
|
||||||
<artifactId>spring-rabbit</artifactId>
|
<artifactId>spring-rabbit</artifactId>
|
||||||
@@ -98,7 +102,7 @@
|
|||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<classifier>tests</classifier>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ru.yandex.qatools.allure</groupId>
|
<groupId>ru.yandex.qatools.allure</groupId>
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ import org.eclipse.hawkbit.dmf.amqp.api.MessageType;
|
|||||||
import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest;
|
import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest;
|
||||||
import org.eclipse.hawkbit.eventbus.event.CancelTargetAssignmentEvent;
|
import org.eclipse.hawkbit.eventbus.event.CancelTargetAssignmentEvent;
|
||||||
import org.eclipse.hawkbit.repository.eventbus.event.TargetAssignDistributionSetEvent;
|
import org.eclipse.hawkbit.repository.eventbus.event.TargetAssignDistributionSetEvent;
|
||||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTestWithMongoDB;
|
|
||||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
import org.eclipse.hawkbit.repository.util.AbstractIntegrationTestWithMongoDB;
|
||||||
import org.eclipse.hawkbit.util.IpUtil;
|
import org.eclipse.hawkbit.util.IpUtil;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.mockito.ArgumentCaptor;
|
import org.mockito.ArgumentCaptor;
|
||||||
@@ -47,6 +47,7 @@ import org.springframework.amqp.core.MessageProperties;
|
|||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
||||||
import org.springframework.amqp.support.converter.AbstractJavaTypeMapper;
|
import org.springframework.amqp.support.converter.AbstractJavaTypeMapper;
|
||||||
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
|
||||||
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||||
import org.springframework.test.context.ActiveProfiles;
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
|
|
||||||
import ru.yandex.qatools.allure.annotations.Description;
|
import ru.yandex.qatools.allure.annotations.Description;
|
||||||
@@ -56,7 +57,8 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
@ActiveProfiles({ "test" })
|
@ActiveProfiles({ "test" })
|
||||||
@Features("Component Tests - Device Management Federation API")
|
@Features("Component Tests - Device Management Federation API")
|
||||||
@Stories("AmqpMessage Dispatcher Service Test")
|
@Stories("AmqpMessage Dispatcher Service Test")
|
||||||
public class AmqpMessageDispatcherServiceTest extends AbstractJpaIntegrationTestWithMongoDB {
|
@SpringApplicationConfiguration(classes = { org.eclipse.hawkbit.RepositoryApplicationConfiguration.class })
|
||||||
|
public class AmqpMessageDispatcherServiceTest extends AbstractIntegrationTestWithMongoDB {
|
||||||
|
|
||||||
private static final String TENANT = "default";
|
private static final String TENANT = "default";
|
||||||
|
|
||||||
|
|||||||
@@ -11,15 +11,12 @@ package org.eclipse.hawkbit.util;
|
|||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.AmqpTestConfiguration;
|
import org.eclipse.hawkbit.AmqpTestConfiguration;
|
||||||
import org.eclipse.hawkbit.RepositoryApplicationConfiguration;
|
|
||||||
import org.eclipse.hawkbit.api.ArtifactUrlHandler;
|
import org.eclipse.hawkbit.api.ArtifactUrlHandler;
|
||||||
import org.eclipse.hawkbit.api.UrlProtocol;
|
import org.eclipse.hawkbit.api.UrlProtocol;
|
||||||
import org.eclipse.hawkbit.repository.jpa.TestConfiguration;
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.util.AbstractIntegrationTestWithMongoDB;
|
import org.eclipse.hawkbit.repository.util.AbstractIntegrationTestWithMongoDB;
|
||||||
import org.eclipse.hawkbit.tenancy.TenantAware;
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -34,18 +31,18 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
|||||||
*/
|
*/
|
||||||
@Features("Component Tests - Artifact URL Handler")
|
@Features("Component Tests - Artifact URL Handler")
|
||||||
@Stories("Test to generate the artifact download URL")
|
@Stories("Test to generate the artifact download URL")
|
||||||
@SpringApplicationConfiguration(classes = { RepositoryApplicationConfiguration.class, TestConfiguration.class,
|
@SpringApplicationConfiguration(classes = { AmqpTestConfiguration.class,
|
||||||
AmqpTestConfiguration.class })
|
org.eclipse.hawkbit.RepositoryApplicationConfiguration.class })
|
||||||
public class PropertyBasedArtifactUrlHandlerTest extends AbstractIntegrationTestWithMongoDB {
|
public class PropertyBasedArtifactUrlHandlerTest extends AbstractIntegrationTestWithMongoDB {
|
||||||
|
|
||||||
private static final String HTTPS_LOCALHOST = "https://localhost:8080/";
|
private static final String HTTPS_LOCALHOST = "https://localhost:8080/";
|
||||||
private static final String HTTP_LOCALHOST = "http://localhost:8080/";
|
private static final String HTTP_LOCALHOST = "http://localhost:8080/";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ArtifactUrlHandler urlHandlerProperties;
|
private ArtifactUrlHandler urlHandlerProperties;
|
||||||
@Autowired
|
|
||||||
private TenantAware tenantAware;
|
|
||||||
private LocalArtifact localArtifact;
|
private LocalArtifact localArtifact;
|
||||||
private final String controllerId = "Test";
|
private static final String CONTROLLER_ID = "Test";
|
||||||
private String fileName;
|
private String fileName;
|
||||||
private Long softwareModuleId;
|
private Long softwareModuleId;
|
||||||
private String sha1Hash;
|
private String sha1Hash;
|
||||||
@@ -65,21 +62,22 @@ public class PropertyBasedArtifactUrlHandlerTest extends AbstractIntegrationTest
|
|||||||
@Description("Tests the generation of http download url.")
|
@Description("Tests the generation of http download url.")
|
||||||
public void testHttpUrl() {
|
public void testHttpUrl() {
|
||||||
|
|
||||||
final String url = urlHandlerProperties.getUrl(controllerId, softwareModuleId, fileName, sha1Hash,
|
final String url = urlHandlerProperties.getUrl(CONTROLLER_ID, softwareModuleId, fileName, sha1Hash,
|
||||||
UrlProtocol.HTTP);
|
UrlProtocol.HTTP);
|
||||||
assertEquals("http is build incorrect",
|
assertEquals("http is build incorrect",
|
||||||
HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/" + controllerId + "/softwaremodules/"
|
HTTP_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/" + CONTROLLER_ID
|
||||||
+ localArtifact.getSoftwareModule().getId() + "/artifacts/" + localArtifact.getFilename(),
|
+ "/softwaremodules/" + localArtifact.getSoftwareModule().getId() + "/artifacts/"
|
||||||
|
+ localArtifact.getFilename(),
|
||||||
url);
|
url);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Description("Tests the generation of https download url.")
|
@Description("Tests the generation of https download url.")
|
||||||
public void testHttpsUrl() {
|
public void testHttpsUrl() {
|
||||||
final String url = urlHandlerProperties.getUrl(controllerId, softwareModuleId, fileName, sha1Hash,
|
final String url = urlHandlerProperties.getUrl(CONTROLLER_ID, softwareModuleId, fileName, sha1Hash,
|
||||||
UrlProtocol.HTTPS);
|
UrlProtocol.HTTPS);
|
||||||
assertEquals("https is build incorrect",
|
assertEquals("https is build incorrect",
|
||||||
HTTPS_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/" + controllerId
|
HTTPS_LOCALHOST + tenantAware.getCurrentTenant() + "/controller/v1/" + CONTROLLER_ID
|
||||||
+ "/softwaremodules/" + localArtifact.getSoftwareModule().getId() + "/artifacts/"
|
+ "/softwaremodules/" + localArtifact.getSoftwareModule().getId() + "/artifacts/"
|
||||||
+ localArtifact.getFilename(),
|
+ localArtifact.getFilename(),
|
||||||
url);
|
url);
|
||||||
@@ -88,10 +86,10 @@ public class PropertyBasedArtifactUrlHandlerTest extends AbstractIntegrationTest
|
|||||||
@Test
|
@Test
|
||||||
@Description("Tests the generation of coap download url.")
|
@Description("Tests the generation of coap download url.")
|
||||||
public void testCoapUrl() {
|
public void testCoapUrl() {
|
||||||
final String url = urlHandlerProperties.getUrl(controllerId, softwareModuleId, fileName, sha1Hash,
|
final String url = urlHandlerProperties.getUrl(CONTROLLER_ID, softwareModuleId, fileName, sha1Hash,
|
||||||
UrlProtocol.COAP);
|
UrlProtocol.COAP);
|
||||||
|
|
||||||
assertEquals("coap is build incorrect", "coap://127.0.0.1:5683/fw/" + tenantAware.getCurrentTenant() + "/"
|
assertEquals("coap is build incorrect", "coap://127.0.0.1:5683/fw/" + tenantAware.getCurrentTenant() + "/"
|
||||||
+ controllerId + "/sha1/" + localArtifact.getSha1Hash(), url);
|
+ CONTROLLER_ID + "/sha1/" + localArtifact.getSha1Hash(), url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#
|
||||||
|
# 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
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# supported: H2, MYSQL
|
||||||
|
hawkbit.server.database=H2
|
||||||
|
|
||||||
|
spring.jpa.database=${hawkbit.server.database}
|
||||||
|
|
||||||
|
|
||||||
|
flyway.sqlMigrationSuffix=${spring.jpa.database}.sql
|
||||||
|
|
||||||
|
# effective DB setting
|
||||||
|
spring.datasource.url=${${hawkbit.server.database}.spring.datasource.url}
|
||||||
|
spring.datasource.driverClassName=${${hawkbit.server.database}.spring.datasource.driverClassName}
|
||||||
|
spring.datasource.username=${${hawkbit.server.database}.spring.datasource.username}
|
||||||
|
spring.datasource.password=${${hawkbit.server.database}.spring.datasource.password}
|
||||||
|
|
||||||
|
# H2
|
||||||
|
##;AUTOCOMMIT=ON
|
||||||
|
H2.spring.datasource.url=jdbc:h2:mem:sp-db;DB_CLOSE_ON_EXIT=FALSE
|
||||||
|
#H2.spring.datasource.url=jdbc:h2:./db/sp-db;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE;MVCC=TRUE
|
||||||
|
H2.spring.datasource.driverClassName=org.h2.Driver
|
||||||
|
H2.spring.datasource.username=sa
|
||||||
|
H2.spring.datasource.password=sa
|
||||||
|
|
||||||
|
# MYSQL
|
||||||
|
MYSQL.spring.datasource.url=jdbc:mysql://localhost:3306/sp_test
|
||||||
|
MYSQL.spring.datasource.driverClassName=org.mariadb.jdbc.Driver
|
||||||
|
MYSQL.spring.datasource.username=root
|
||||||
|
MYSQL.spring.datasource.password=
|
||||||
35
hawkbit-dmf-amqp/src/test/resources/logback.xml
Normal file
35
hawkbit-dmf-amqp/src/test/resources/logback.xml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
-->
|
||||||
|
<configuration>
|
||||||
|
<include resource="org/springframework/boot/logging/logback/base.xml" />
|
||||||
|
|
||||||
|
<logger name="org.eclipse.hawkbit.eventbus.DeadEventListener" level="WARN" />
|
||||||
|
<Logger name="org.springframework.boot.actuate.audit.listener.AuditListener" level="WARN" />
|
||||||
|
|
||||||
|
<Logger name="org.hibernate.validator.internal.util.Version" level="WARN" />
|
||||||
|
|
||||||
|
<Logger name="org.apache.coyote.http11.Http11NioProtocol" level="WARN" />
|
||||||
|
<Logger name="org.apache.tomcat.util.net.NioSelectorPool" level="WARN" />
|
||||||
|
<Logger name="org.apache.tomcat.jdbc.pool.ConnectionPool" level="DEBUG" />
|
||||||
|
<Logger name="org.apache.catalina.startup.DigesterFactory" level="ERROR" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <Logger name="org.eclipse.hawkbit.rest.util.MockMvcResultPrinter" level="DEBUG" /> -->
|
||||||
|
|
||||||
|
<!-- Security Log with hints on potential attacks -->
|
||||||
|
<logger name="server-security" level="INFO" />
|
||||||
|
|
||||||
|
<Root level="INFO">
|
||||||
|
<AppenderRef ref="Console" />
|
||||||
|
</Root>
|
||||||
|
|
||||||
|
</configuration>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
<artifactId>hawkbit-repository-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
<artifactId>hawkbit-repository-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-mgmt-api</artifactId>
|
<artifactId>hawkbit-mgmt-api</artifactId>
|
||||||
@@ -53,6 +53,12 @@
|
|||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-rest-core</artifactId>
|
<artifactId>hawkbit-rest-core</artifactId>
|
||||||
@@ -96,13 +102,6 @@
|
|||||||
<artifactId>spring-security-config</artifactId>
|
<artifactId>spring-security-config</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<classifier>tests</classifier>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-http-security</artifactId>
|
<artifactId>hawkbit-http-security</artifactId>
|
||||||
|
|||||||
@@ -22,9 +22,8 @@ import org.eclipse.hawkbit.repository.EntityFactory;
|
|||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetFields;
|
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.rsql.RSQLUtility;
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
@@ -64,6 +63,9 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DistributionSetManagement distributionSetManagement;
|
private DistributionSetManagement distributionSetManagement;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TargetFilterQueryManagement targetFilterQueryManagement;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EntityFactory entityFactory;
|
private EntityFactory entityFactory;
|
||||||
|
|
||||||
@@ -103,7 +105,7 @@ public class MgmtRolloutResource implements MgmtRolloutRestApi {
|
|||||||
|
|
||||||
// first check the given RSQL query if it's well formed, otherwise and
|
// first check the given RSQL query if it's well formed, otherwise and
|
||||||
// exception is thrown
|
// exception is thrown
|
||||||
RSQLUtility.parse(rolloutRequestBody.getTargetFilterQuery(), TargetFields.class);
|
targetFilterQueryManagement.verifyTargetFilterQuerySyntax(rolloutRequestBody.getTargetFilterQuery());
|
||||||
|
|
||||||
final DistributionSet distributionSet = findDistributionSetOrThrowException(rolloutRequestBody);
|
final DistributionSet distributionSet = findDistributionSetOrThrowException(rolloutRequestBody);
|
||||||
|
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ import org.eclipse.hawkbit.exception.SpServerError;
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact;
|
import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifact;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.HashGeneratorUtils;
|
|
||||||
import org.eclipse.hawkbit.repository.model.Artifact;
|
import org.eclipse.hawkbit.repository.model.Artifact;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata;
|
||||||
|
import org.eclipse.hawkbit.repository.util.HashGeneratorUtils;
|
||||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||||
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTestWithMongoDB;
|
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTestWithMongoDB;
|
||||||
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
|
import org.eclipse.hawkbit.rest.json.model.ExceptionInfo;
|
||||||
|
|||||||
@@ -7,22 +7,8 @@
|
|||||||
# http://www.eclipse.org/legal/epl-v10.html
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
#
|
#
|
||||||
|
|
||||||
# used if IM profile is disabled
|
|
||||||
security.ignored=true
|
|
||||||
|
|
||||||
# IM required for integration tests
|
|
||||||
spring.profiles.active=im,suiteembedded,artifactrepository,redis
|
|
||||||
|
|
||||||
server.port=12222
|
|
||||||
|
|
||||||
spring.data.mongodb.uri=mongodb://localhost/spArtifactRepository${random.value}
|
|
||||||
spring.data.mongodb.port=28017
|
|
||||||
|
|
||||||
|
|
||||||
# supported: H2, MYSQL
|
# supported: H2, MYSQL
|
||||||
hawkbit.server.database=H2
|
hawkbit.server.database=H2
|
||||||
hawkbit.server.database.env=TEST
|
|
||||||
spring.main.show_banner=false
|
|
||||||
|
|
||||||
hawkbit.server.ddi.security.authentication.header=true
|
hawkbit.server.ddi.security.authentication.header=true
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,10 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>hibernate-validator</artifactId>
|
<artifactId>hibernate-validator</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cz.jirutka.rsql</groupId>
|
||||||
|
<artifactId>rsql-parser</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.hateoas</groupId>
|
<groupId>org.springframework.hateoas</groupId>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.eventbus.event.DownloadProgressEvent;
|
||||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
@@ -32,6 +33,8 @@ import org.eclipse.hawkbit.tenancy.configuration.TenantConfigurationKey;
|
|||||||
import org.hibernate.validator.constraints.NotEmpty;
|
import org.hibernate.validator.constraints.NotEmpty;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|
||||||
|
import com.google.common.eventbus.EventBus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service layer for all operations of the DDI API (with access permissions only
|
* Service layer for all operations of the DDI API (with access permissions only
|
||||||
* for the controller).
|
* for the controller).
|
||||||
@@ -54,6 +57,18 @@ public interface ControllerManagement {
|
|||||||
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
Action addCancelActionStatus(@NotNull ActionStatus actionStatus);
|
Action addCancelActionStatus(@NotNull ActionStatus actionStatus);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends the download progress in percentage and notifies the
|
||||||
|
* {@link EventBus} with a {@link DownloadProgressEvent}.
|
||||||
|
*
|
||||||
|
* @param statusId
|
||||||
|
* the ID of the {@link ActionStatus}
|
||||||
|
* @param progressPercent
|
||||||
|
* the progress in percentage which must be between 0-100
|
||||||
|
*/
|
||||||
|
@PreAuthorize(SpringEvalExpressions.IS_CONTROLLER)
|
||||||
|
void downloadProgressPercent(long statusId, int progressPercent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple addition of a new {@link ActionStatus} entry to the {@link Action}
|
* Simple addition of a new {@link ActionStatus} entry to the {@link Action}
|
||||||
* . No state changes.
|
* . No state changes.
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
@@ -330,4 +331,11 @@ public interface EntityFactory {
|
|||||||
*/
|
*/
|
||||||
TargetTag generateTargetTag(String name, String description, String colour);
|
TargetTag generateTargetTag(String name, String description, String colour);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates an empty {@link LocalArtifact} without persisting it.
|
||||||
|
*
|
||||||
|
* @return {@link LocalArtifact} object
|
||||||
|
*/
|
||||||
|
LocalArtifact generateLocalArtifact();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ package org.eclipse.hawkbit.repository;
|
|||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
import org.eclipse.hawkbit.im.authentication.SpPermission.SpringEvalExpressions;
|
||||||
|
import org.eclipse.hawkbit.repository.exception.RSQLParameterSyntaxException;
|
||||||
|
import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
@@ -40,6 +42,23 @@ public interface TargetFilterQueryManagement {
|
|||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_DELETE_TARGET)
|
||||||
void deleteTargetFilterQuery(@NotNull Long targetFilterQueryId);
|
void deleteTargetFilterQuery(@NotNull Long targetFilterQueryId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies provided filter syntax.
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* to verify
|
||||||
|
*
|
||||||
|
* @return <code>true</code> if syntax is valid
|
||||||
|
*
|
||||||
|
* @throws RSQLParameterUnsupportedFieldException
|
||||||
|
* if a field in the RSQL string is used but not provided by the
|
||||||
|
* given {@code fieldNameProvider}
|
||||||
|
* @throws RSQLParameterSyntaxException
|
||||||
|
* if the RSQL syntax is wrong
|
||||||
|
*/
|
||||||
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
|
boolean verifyTargetFilterQuerySyntax(String query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Retrieves all target filter query{@link TargetFilterQuery}.
|
* Retrieves all target filter query{@link TargetFilterQuery}.
|
||||||
|
|||||||
@@ -439,7 +439,14 @@ public interface TargetManagement {
|
|||||||
* in string notation
|
* in string notation
|
||||||
* @param pageable
|
* @param pageable
|
||||||
* pagination parameter
|
* pagination parameter
|
||||||
|
*
|
||||||
* @return the found {@link Target}s, never {@code null}
|
* @return the found {@link Target}s, never {@code null}
|
||||||
|
*
|
||||||
|
* @throws RSQLParameterUnsupportedFieldException
|
||||||
|
* if a field in the RSQL string is used but not provided by the
|
||||||
|
* given {@code fieldNameProvider}
|
||||||
|
* @throws RSQLParameterSyntaxException
|
||||||
|
* if the RSQL syntax is wrong
|
||||||
*/
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
Page<Target> findTargetsAll(@NotNull String targetFilterQuery, @NotNull Pageable pageable);
|
Page<Target> findTargetsAll(@NotNull String targetFilterQuery, @NotNull Pageable pageable);
|
||||||
@@ -455,6 +462,12 @@ public interface TargetManagement {
|
|||||||
* pagination parameter
|
* pagination parameter
|
||||||
*
|
*
|
||||||
* @return the found {@link Target}s, never {@code null}
|
* @return the found {@link Target}s, never {@code null}
|
||||||
|
*
|
||||||
|
* @throws RSQLParameterUnsupportedFieldException
|
||||||
|
* if a field in the RSQL string is used but not provided by the
|
||||||
|
* given {@code fieldNameProvider}
|
||||||
|
* @throws RSQLParameterSyntaxException
|
||||||
|
* if the RSQL syntax is wrong
|
||||||
*/
|
*/
|
||||||
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_TARGET)
|
||||||
Slice<Target> findTargetsAll(@NotNull TargetFilterQuery targetFilterQuery, @NotNull Pageable pageable);
|
Slice<Target> findTargetsAll(@NotNull TargetFilterQuery targetFilterQuery, @NotNull Pageable pageable);
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa.model.helper;
|
package org.eclipse.hawkbit.repository.jpa.model.helper;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.CacheFieldEntityListener;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
import com.google.common.eventbus.EventBus;
|
||||||
@@ -16,7 +15,7 @@ import com.google.common.eventbus.EventBus;
|
|||||||
/**
|
/**
|
||||||
* A singleton bean which holds the {@link EventBus} to have to the cache
|
* A singleton bean which holds the {@link EventBus} to have to the cache
|
||||||
* manager in beans not instantiated by spring e.g. JPA entities or
|
* manager in beans not instantiated by spring e.g. JPA entities or
|
||||||
* {@link CacheFieldEntityListener} which cannot be autowired.
|
* CacheFieldEntityListener which cannot be autowired.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class EventBusHolder {
|
public final class EventBusHolder {
|
||||||
@@ -120,27 +120,12 @@
|
|||||||
<groupId>javax.el</groupId>
|
<groupId>javax.el</groupId>
|
||||||
<artifactId>javax.el-api</artifactId>
|
<artifactId>javax.el-api</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-context-support</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ru.yandex.qatools.allure</groupId>
|
<groupId>ru.yandex.qatools.allure</groupId>
|
||||||
<artifactId>allure-junit-adaptor</artifactId>
|
<artifactId>allure-junit-adaptor</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.security</groupId>
|
|
||||||
<artifactId>spring-security-aspects</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-test</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.easytesting</groupId>
|
<groupId>org.easytesting</groupId>
|
||||||
<artifactId>fest-assert-core</artifactId>
|
<artifactId>fest-assert-core</artifactId>
|
||||||
@@ -151,16 +136,6 @@
|
|||||||
<artifactId>fest-assert</artifactId>
|
<artifactId>fest-assert</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.security</groupId>
|
|
||||||
<artifactId>spring-security-config</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.security</groupId>
|
|
||||||
<artifactId>spring-security-web</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import org.springframework.stereotype.Controller;
|
|||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan
|
|
||||||
@Import(RepositoryApplicationConfiguration.class)
|
@Import(RepositoryApplicationConfiguration.class)
|
||||||
public @interface EnableJpaRepository {
|
public @interface EnableJpaRepository {
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ import org.springframework.validation.beanvalidation.MethodValidationPostProcess
|
|||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@EnableJpaAuditing
|
@EnableJpaAuditing
|
||||||
@EnableAspectJAutoProxy
|
@EnableAspectJAutoProxy
|
||||||
@ComponentScan
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@ComponentScan
|
||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
|
public class RepositoryApplicationConfiguration extends JpaBaseConfiguration {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -19,13 +19,14 @@ import javax.persistence.criteria.CriteriaQuery;
|
|||||||
import javax.persistence.criteria.Root;
|
import javax.persistence.criteria.Root;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
import org.eclipse.hawkbit.repository.TenantConfigurationManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
import org.eclipse.hawkbit.repository.exception.ToManyAttributeEntriesException;
|
import org.eclipse.hawkbit.repository.exception.ToManyAttributeEntriesException;
|
||||||
import org.eclipse.hawkbit.repository.exception.ToManyStatusEntriesException;
|
import org.eclipse.hawkbit.repository.exception.ToManyStatusEntriesException;
|
||||||
|
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaAction;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus_;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaActionStatus_;
|
||||||
@@ -98,6 +99,9 @@ public class JpaControllerManagement implements ControllerManagement {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private TenantConfigurationManagement tenantConfigurationManagement;
|
private TenantConfigurationManagement tenantConfigurationManagement;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CacheWriteNotify cacheWriteNotify;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPollingTime() {
|
public String getPollingTime() {
|
||||||
final TenantConfigurationKey configurationKey = TenantConfigurationKey.POLLING_TIME_INTERVAL;
|
final TenantConfigurationKey configurationKey = TenantConfigurationKey.POLLING_TIME_INTERVAL;
|
||||||
@@ -230,7 +234,8 @@ public class JpaControllerManagement implements ControllerManagement {
|
|||||||
private void handleFinishedCancelation(final ActionStatus actionStatus, final JpaAction action) {
|
private void handleFinishedCancelation(final ActionStatus actionStatus, final JpaAction action) {
|
||||||
// in case of successful cancellation we also report the success at
|
// in case of successful cancellation we also report the success at
|
||||||
// the canceled action itself.
|
// the canceled action itself.
|
||||||
actionStatus.addMessage(RepositoryConstants.SERVER_MESSAGE_PREFIX + "Cancellation completion is finished sucessfully.");
|
actionStatus.addMessage(
|
||||||
|
RepositoryConstants.SERVER_MESSAGE_PREFIX + "Cancellation completion is finished sucessfully.");
|
||||||
DeploymentHelper.successCancellation(action, actionRepository, targetManagement, targetInfoRepository,
|
DeploymentHelper.successCancellation(action, actionRepository, targetManagement, targetInfoRepository,
|
||||||
entityManager);
|
entityManager);
|
||||||
}
|
}
|
||||||
@@ -436,4 +441,9 @@ public class JpaControllerManagement implements ControllerManagement {
|
|||||||
return updateTargetStatus(target, null, System.currentTimeMillis(), address);
|
return updateTargetStatus(target, null, System.currentTimeMillis(), address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void downloadProgressPercent(final long statusId, final int progressPercent) {
|
||||||
|
cacheWriteNotify.downloadProgressPercent(statusId, progressPercent);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
|||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetMetadata;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetMetadata;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetTag;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetTag;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSetType;
|
||||||
|
import org.eclipse.hawkbit.repository.jpa.model.JpaLocalArtifact;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
||||||
@@ -32,6 +33,7 @@ import org.eclipse.hawkbit.repository.model.DistributionSet;
|
|||||||
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.repository.model.Rollout;
|
import org.eclipse.hawkbit.repository.model.Rollout;
|
||||||
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
@@ -198,4 +200,9 @@ public class JpaEntityFactory implements EntityFactory {
|
|||||||
return new JpaActionStatus(action, status, occurredAt);
|
return new JpaActionStatus(action, status, occurredAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LocalArtifact generateLocalArtifact() {
|
||||||
|
return new JpaLocalArtifact();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,11 @@ package org.eclipse.hawkbit.repository.jpa;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.hawkbit.repository.TargetFields;
|
||||||
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
import org.eclipse.hawkbit.repository.TargetFilterQueryManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetFilterQuery;
|
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetFilterQuery;
|
||||||
|
import org.eclipse.hawkbit.repository.jpa.rsql.RSQLUtility;
|
||||||
import org.eclipse.hawkbit.repository.jpa.specifications.SpecificationsBuilder;
|
import org.eclipse.hawkbit.repository.jpa.specifications.SpecificationsBuilder;
|
||||||
import org.eclipse.hawkbit.repository.jpa.specifications.TargetFilterQuerySpecification;
|
import org.eclipse.hawkbit.repository.jpa.specifications.TargetFilterQuerySpecification;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
import org.eclipse.hawkbit.repository.model.TargetFilterQuery;
|
||||||
@@ -109,4 +111,10 @@ public class JpaTargetFilterQueryManagement implements TargetFilterQueryManageme
|
|||||||
return targetFilterQueryRepository.save((JpaTargetFilterQuery) targetFilterQuery);
|
return targetFilterQueryRepository.save((JpaTargetFilterQuery) targetFilterQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean verifyTargetFilterQuerySyntax(final String query) {
|
||||||
|
RSQLUtility.parse(query, TargetFields.class);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,6 +97,8 @@ public abstract class AbstractJpaTenantAwareBaseEntity extends AbstractJpaBaseEn
|
|||||||
* @see org.eclipse.hawkbit.repository.model.BaseEntity#equals(java.lang.Object)
|
* @see org.eclipse.hawkbit.repository.model.BaseEntity#equals(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
// exception squid:S2259 - obj is checked for null in super
|
||||||
|
@SuppressWarnings("squid:S2259")
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
if (!super.equals(obj)) {
|
if (!super.equals(obj)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ public class JpaDistributionSetMetadata extends AbstractJpaMetaData implements D
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
// exception squid:S2259 - obj is checked for null in super
|
||||||
|
@SuppressWarnings("squid:S2259")
|
||||||
public boolean equals(final Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
if (!super.equals(obj)) {
|
if (!super.equals(obj)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -17,8 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||||
import org.springframework.data.mongodb.gridfs.GridFsOperations;
|
import org.springframework.data.mongodb.gridfs.GridFsOperations;
|
||||||
|
|
||||||
@SpringApplicationConfiguration(classes = { org.eclipse.hawkbit.RepositoryApplicationConfiguration.class,
|
@SpringApplicationConfiguration(classes = { org.eclipse.hawkbit.RepositoryApplicationConfiguration.class })
|
||||||
TestConfiguration.class })
|
|
||||||
public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest {
|
public abstract class AbstractJpaIntegrationTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
|
|||||||
@@ -16,8 +16,7 @@ import org.eclipse.hawkbit.repository.util.AbstractIntegrationTestWithMongoDB;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||||
|
|
||||||
@SpringApplicationConfiguration(classes = { org.eclipse.hawkbit.RepositoryApplicationConfiguration.class,
|
@SpringApplicationConfiguration(classes = { org.eclipse.hawkbit.RepositoryApplicationConfiguration.class })
|
||||||
TestConfiguration.class })
|
|
||||||
public abstract class AbstractJpaIntegrationTestWithMongoDB extends AbstractIntegrationTestWithMongoDB {
|
public abstract class AbstractJpaIntegrationTestWithMongoDB extends AbstractIntegrationTestWithMongoDB {
|
||||||
|
|
||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import org.eclipse.hawkbit.repository.model.Artifact;
|
|||||||
import org.eclipse.hawkbit.repository.model.ExternalArtifactProvider;
|
import org.eclipse.hawkbit.repository.model.ExternalArtifactProvider;
|
||||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
import org.eclipse.hawkbit.repository.util.HashGeneratorUtils;
|
||||||
import org.eclipse.hawkbit.repository.util.WithUser;
|
import org.eclipse.hawkbit.repository.util.WithUser;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|||||||
@@ -33,7 +33,11 @@
|
|||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-artifact-repository-mongo</artifactId>
|
<artifactId>hawkbit-artifact-repository-mongo</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.flapdoodle.embed</groupId>
|
<groupId>de.flapdoodle.embed</groupId>
|
||||||
<artifactId>de.flapdoodle.embed.mongo</artifactId>
|
<artifactId>de.flapdoodle.embed.mongo</artifactId>
|
||||||
@@ -55,5 +59,17 @@
|
|||||||
<groupId>org.springframework.security</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>spring-security-config</artifactId>
|
<artifactId>spring-security-config</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-aspects</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-test</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-web</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
@@ -10,11 +10,11 @@ package org.eclipse.hawkbit.repository.util;
|
|||||||
|
|
||||||
import org.eclipse.hawkbit.ExcludePathAwareShallowETagFilter;
|
import org.eclipse.hawkbit.ExcludePathAwareShallowETagFilter;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
import org.eclipse.hawkbit.repository.DeploymentManagement;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
|
import org.eclipse.hawkbit.repository.RepositoryConstants;
|
||||||
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
import org.eclipse.hawkbit.repository.RolloutGroupManagement;
|
||||||
import org.eclipse.hawkbit.repository.RolloutManagement;
|
import org.eclipse.hawkbit.repository.RolloutManagement;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
@@ -39,6 +39,7 @@ import org.junit.runner.RunWith;
|
|||||||
import org.junit.runners.model.FrameworkMethod;
|
import org.junit.runners.model.FrameworkMethod;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||||
import org.springframework.context.EnvironmentAware;
|
import org.springframework.context.EnvironmentAware;
|
||||||
import org.springframework.core.env.Environment;
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.data.auditing.AuditingHandler;
|
import org.springframework.data.auditing.AuditingHandler;
|
||||||
@@ -58,6 +59,7 @@ import org.springframework.web.context.WebApplicationContext;
|
|||||||
@WebAppConfiguration
|
@WebAppConfiguration
|
||||||
@ActiveProfiles({ "test" })
|
@ActiveProfiles({ "test" })
|
||||||
@WithUser(principal = "bumlux", allSpPermissions = true, authorities = "ROLE_CONTROLLER")
|
@WithUser(principal = "bumlux", allSpPermissions = true, authorities = "ROLE_CONTROLLER")
|
||||||
|
@SpringApplicationConfiguration(classes = { TestConfiguration.class })
|
||||||
// destroy the context after each test class because otherwise we get problem
|
// destroy the context after each test class because otherwise we get problem
|
||||||
// when context is
|
// when context is
|
||||||
// refreshed we e.g. get two instances of CacheManager which leads to very
|
// refreshed we e.g. get two instances of CacheManager which leads to very
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa;
|
package org.eclipse.hawkbit.repository.util;
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
@@ -14,13 +14,10 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import com.google.common.io.BaseEncoding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash utility calls copied from
|
* Hash digest utility.
|
||||||
* http://www.codejava.net/coding/how-to-calculate-md5-and-sha-hash-values-in-
|
|
||||||
* java.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public final class HashGeneratorUtils {
|
public final class HashGeneratorUtils {
|
||||||
|
|
||||||
@@ -68,18 +65,11 @@ public final class HashGeneratorUtils {
|
|||||||
try {
|
try {
|
||||||
final MessageDigest digest = MessageDigest.getInstance(algorithm);
|
final MessageDigest digest = MessageDigest.getInstance(algorithm);
|
||||||
final byte[] hashedBytes = digest.digest(message);
|
final byte[] hashedBytes = digest.digest(message);
|
||||||
return convertByteArrayToHexString(hashedBytes);
|
return BaseEncoding.base16().lowerCase().encode(hashedBytes);
|
||||||
} catch (final NoSuchAlgorithmException e) {
|
} catch (final NoSuchAlgorithmException e) {
|
||||||
LOG.error("Algorithm could not be find", e);
|
LOG.error("Algorithm could not be found", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String convertByteArrayToHexString(final byte[] arrayBytes) {
|
|
||||||
final StringBuilder builder = new StringBuilder();
|
|
||||||
for (int i = 0; i < arrayBytes.length; i++) {
|
|
||||||
builder.append(Integer.toString((arrayBytes[i] & 0xff) + 0x100, 16).substring(1));
|
|
||||||
}
|
|
||||||
return builder.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -6,77 +6,18 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa;
|
package org.eclipse.hawkbit.repository.util;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.PersistenceContext;
|
|
||||||
|
|
||||||
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||||
import org.eclipse.hawkbit.repository.util.TestRepositoryManagement;
|
|
||||||
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
import org.eclipse.hawkbit.security.SystemSecurityContext;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.mongodb.gridfs.GridFsOperations;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
public class JpaTestRepositoryManagement implements TestRepositoryManagement {
|
public class JpaTestRepositoryManagement implements TestRepositoryManagement {
|
||||||
|
|
||||||
@PersistenceContext
|
|
||||||
private EntityManager entityManager;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TargetRepository targetRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ActionRepository actionRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DistributionSetRepository distributionSetRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SoftwareModuleRepository softwareModuleRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TenantMetaDataRepository tenantMetaDataRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DistributionSetTypeRepository distributionSetTypeRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SoftwareModuleTypeRepository softwareModuleTypeRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TargetTagRepository targetTagRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DistributionSetTagRepository distributionSetTagRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SoftwareModuleMetadataRepository softwareModuleMetadataRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ActionStatusRepository actionStatusRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ExternalArtifactRepository externalArtifactRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private LocalArtifactRepository artifactRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TargetInfoRepository targetInfoRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private GridFsOperations operations;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RolloutGroupRepository rolloutGroupRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RolloutRepository rolloutRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private TenantAwareCacheManager cacheManager;
|
private TenantAwareCacheManager cacheManager;
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.repository.jpa;
|
package org.eclipse.hawkbit.repository.util;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
@@ -16,8 +16,6 @@ import org.eclipse.hawkbit.cache.CacheConstants;
|
|||||||
import org.eclipse.hawkbit.cache.TenancyCacheManager;
|
import org.eclipse.hawkbit.cache.TenancyCacheManager;
|
||||||
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
import org.eclipse.hawkbit.cache.TenantAwareCacheManager;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.helper.EventBusHolder;
|
import org.eclipse.hawkbit.repository.jpa.model.helper.EventBusHolder;
|
||||||
import org.eclipse.hawkbit.repository.util.TestRepositoryManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.util.TestdataFactory;
|
|
||||||
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
import org.eclipse.hawkbit.security.DdiSecurityProperties;
|
||||||
import org.eclipse.hawkbit.security.SecurityContextTenantAware;
|
import org.eclipse.hawkbit.security.SecurityContextTenantAware;
|
||||||
import org.eclipse.hawkbit.security.SpringSecurityAuditorAware;
|
import org.eclipse.hawkbit.security.SpringSecurityAuditorAware;
|
||||||
@@ -21,6 +21,11 @@
|
|||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
@@ -62,13 +67,7 @@
|
|||||||
<groupId>org.easytesting</groupId>
|
<groupId>org.easytesting</groupId>
|
||||||
<artifactId>fest-assert</artifactId>
|
<artifactId>fest-assert</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
<classifier>tests</classifier>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ru.yandex.qatools.allure</groupId>
|
<groupId>ru.yandex.qatools.allure</groupId>
|
||||||
<artifactId>allure-junit-adaptor</artifactId>
|
<artifactId>allure-junit-adaptor</artifactId>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
|
import org.eclipse.hawkbit.artifact.repository.model.DbArtifact;
|
||||||
import org.eclipse.hawkbit.repository.jpa.cache.CacheWriteNotify;
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -84,7 +84,7 @@ public final class RestResourceConversionHelper {
|
|||||||
* from the client
|
* from the client
|
||||||
* @param file
|
* @param file
|
||||||
* to be write to the client response
|
* to be write to the client response
|
||||||
* @param cacheWriteNotify
|
* @param controllerManagement
|
||||||
* to write progress updates to
|
* to write progress updates to
|
||||||
* @param statusId
|
* @param statusId
|
||||||
* of the UpdateActionStatus
|
* of the UpdateActionStatus
|
||||||
@@ -95,9 +95,9 @@ public final class RestResourceConversionHelper {
|
|||||||
*/
|
*/
|
||||||
public static ResponseEntity<InputStream> writeFileResponse(final LocalArtifact artifact,
|
public static ResponseEntity<InputStream> writeFileResponse(final LocalArtifact artifact,
|
||||||
final HttpServletResponse response, final HttpServletRequest request, final DbArtifact file,
|
final HttpServletResponse response, final HttpServletRequest request, final DbArtifact file,
|
||||||
final CacheWriteNotify cacheWriteNotify, final Long statusId) {
|
final ControllerManagement controllerManagement, final Long statusId) {
|
||||||
|
|
||||||
ResponseEntity<InputStream> result = null;
|
ResponseEntity<InputStream> result;
|
||||||
|
|
||||||
final String etag = artifact.getSha1Hash();
|
final String etag = artifact.getSha1Hash();
|
||||||
final Long lastModified = artifact.getLastModifiedAt() != null ? artifact.getLastModifiedAt()
|
final Long lastModified = artifact.getLastModifiedAt() != null ? artifact.getLastModifiedAt()
|
||||||
@@ -143,19 +143,19 @@ public final class RestResourceConversionHelper {
|
|||||||
// full request - no range
|
// full request - no range
|
||||||
if (ranges.isEmpty() || ranges.get(0).equals(full)) {
|
if (ranges.isEmpty() || ranges.get(0).equals(full)) {
|
||||||
LOG.debug("filename ({}) results into a full request: ", artifact.getFilename());
|
LOG.debug("filename ({}) results into a full request: ", artifact.getFilename());
|
||||||
fullfileRequest(artifact, response, file, cacheWriteNotify, statusId, full);
|
fullfileRequest(artifact, response, file, controllerManagement, statusId, full);
|
||||||
result = new ResponseEntity<>(HttpStatus.OK);
|
result = new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
// standard range request
|
// standard range request
|
||||||
else if (ranges.size() == 1) {
|
else if (ranges.size() == 1) {
|
||||||
LOG.debug("filename ({}) results into a standard range request: ", artifact.getFilename());
|
LOG.debug("filename ({}) results into a standard range request: ", artifact.getFilename());
|
||||||
standardRangeRequest(artifact, response, file, cacheWriteNotify, statusId, ranges);
|
standardRangeRequest(artifact, response, file, controllerManagement, statusId, ranges);
|
||||||
result = new ResponseEntity<>(HttpStatus.PARTIAL_CONTENT);
|
result = new ResponseEntity<>(HttpStatus.PARTIAL_CONTENT);
|
||||||
}
|
}
|
||||||
// multipart range request
|
// multipart range request
|
||||||
else {
|
else {
|
||||||
LOG.debug("filename ({}) results into a multipart range request: ", artifact.getFilename());
|
LOG.debug("filename ({}) results into a multipart range request: ", artifact.getFilename());
|
||||||
multipartRangeRequest(artifact, response, file, cacheWriteNotify, statusId, ranges);
|
multipartRangeRequest(artifact, response, file, controllerManagement, statusId, ranges);
|
||||||
result = new ResponseEntity<>(HttpStatus.PARTIAL_CONTENT);
|
result = new ResponseEntity<>(HttpStatus.PARTIAL_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,14 +164,15 @@ public final class RestResourceConversionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void fullfileRequest(final LocalArtifact artifact, final HttpServletResponse response,
|
private static void fullfileRequest(final LocalArtifact artifact, final HttpServletResponse response,
|
||||||
final DbArtifact file, final CacheWriteNotify cacheWriteNotify, final Long statusId, final ByteRange full) {
|
final DbArtifact file, final ControllerManagement controllerManagement, final Long statusId,
|
||||||
|
final ByteRange full) {
|
||||||
final ByteRange r = full;
|
final ByteRange r = full;
|
||||||
response.setHeader(HttpHeaders.CONTENT_RANGE, "bytes " + r.getStart() + "-" + r.getEnd() + "/" + r.getTotal());
|
response.setHeader(HttpHeaders.CONTENT_RANGE, "bytes " + r.getStart() + "-" + r.getEnd() + "/" + r.getTotal());
|
||||||
response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(r.getLength()));
|
response.setHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(r.getLength()));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
copyStreams(file.getFileInputStream(), response.getOutputStream(), cacheWriteNotify, statusId, r.getStart(),
|
copyStreams(file.getFileInputStream(), response.getOutputStream(), controllerManagement, statusId,
|
||||||
r.getLength());
|
r.getStart(), r.getLength());
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
LOG.error("fullfileRequest of file ({}) failed!", artifact.getFilename(), e);
|
LOG.error("fullfileRequest of file ({}) failed!", artifact.getFilename(), e);
|
||||||
throw new FileSteamingFailedException(artifact.getFilename());
|
throw new FileSteamingFailedException(artifact.getFilename());
|
||||||
@@ -231,7 +232,7 @@ public final class RestResourceConversionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void multipartRangeRequest(final LocalArtifact artifact, final HttpServletResponse response,
|
private static void multipartRangeRequest(final LocalArtifact artifact, final HttpServletResponse response,
|
||||||
final DbArtifact file, final CacheWriteNotify cacheWriteNotify, final Long statusId,
|
final DbArtifact file, final ControllerManagement controllerManagement, final Long statusId,
|
||||||
final List<ByteRange> ranges) {
|
final List<ByteRange> ranges) {
|
||||||
response.setContentType("multipart/byteranges; boundary=" + ByteRange.MULTIPART_BOUNDARY);
|
response.setContentType("multipart/byteranges; boundary=" + ByteRange.MULTIPART_BOUNDARY);
|
||||||
response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
|
response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
|
||||||
@@ -245,7 +246,7 @@ public final class RestResourceConversionHelper {
|
|||||||
.println("Content-Range: bytes " + r.getStart() + "-" + r.getEnd() + "/" + r.getTotal());
|
.println("Content-Range: bytes " + r.getStart() + "-" + r.getEnd() + "/" + r.getTotal());
|
||||||
|
|
||||||
// Copy single part range of multi part range.
|
// Copy single part range of multi part range.
|
||||||
copyStreams(file.getFileInputStream(), response.getOutputStream(), cacheWriteNotify, statusId,
|
copyStreams(file.getFileInputStream(), response.getOutputStream(), controllerManagement, statusId,
|
||||||
r.getStart(), r.getLength());
|
r.getStart(), r.getLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -259,7 +260,7 @@ public final class RestResourceConversionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void standardRangeRequest(final LocalArtifact artifact, final HttpServletResponse response,
|
private static void standardRangeRequest(final LocalArtifact artifact, final HttpServletResponse response,
|
||||||
final DbArtifact file, final CacheWriteNotify cacheWriteNotify, final Long statusId,
|
final DbArtifact file, final ControllerManagement controllerManagement, final Long statusId,
|
||||||
final List<ByteRange> ranges) {
|
final List<ByteRange> ranges) {
|
||||||
final ByteRange r = ranges.get(0);
|
final ByteRange r = ranges.get(0);
|
||||||
response.setHeader(HttpHeaders.CONTENT_RANGE, "bytes " + r.getStart() + "-" + r.getEnd() + "/" + r.getTotal());
|
response.setHeader(HttpHeaders.CONTENT_RANGE, "bytes " + r.getStart() + "-" + r.getEnd() + "/" + r.getTotal());
|
||||||
@@ -267,8 +268,8 @@ public final class RestResourceConversionHelper {
|
|||||||
response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
|
response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
copyStreams(file.getFileInputStream(), response.getOutputStream(), cacheWriteNotify, statusId, r.getStart(),
|
copyStreams(file.getFileInputStream(), response.getOutputStream(), controllerManagement, statusId,
|
||||||
r.getLength());
|
r.getStart(), r.getLength());
|
||||||
} catch (final IOException e) {
|
} catch (final IOException e) {
|
||||||
LOG.error("standardRangeRequest of file ({}) failed!", artifact.getFilename(), e);
|
LOG.error("standardRangeRequest of file ({}) failed!", artifact.getFilename(), e);
|
||||||
throw new FileSteamingFailedException(artifact.getFilename());
|
throw new FileSteamingFailedException(artifact.getFilename());
|
||||||
@@ -276,7 +277,7 @@ public final class RestResourceConversionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static long copyStreams(final InputStream from, final OutputStream to,
|
private static long copyStreams(final InputStream from, final OutputStream to,
|
||||||
final CacheWriteNotify cacheWriteNotify, final Long statusId, final long start, final long length)
|
final ControllerManagement controllerManagement, final Long statusId, final long start, final long length)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
checkNotNull(from);
|
checkNotNull(from);
|
||||||
checkNotNull(to);
|
checkNotNull(to);
|
||||||
@@ -309,13 +310,13 @@ public final class RestResourceConversionHelper {
|
|||||||
toContinue = false;
|
toContinue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cacheWriteNotify != null) {
|
if (controllerManagement != null) {
|
||||||
final int newPercent = DoubleMath.roundToInt(total * 100.0 / length, RoundingMode.DOWN);
|
final int newPercent = DoubleMath.roundToInt(total * 100.0 / length, RoundingMode.DOWN);
|
||||||
|
|
||||||
// every 10 percent an event
|
// every 10 percent an event
|
||||||
if (newPercent == 100 || newPercent > progressPercent + 10) {
|
if (newPercent == 100 || newPercent > progressPercent + 10) {
|
||||||
progressPercent = newPercent;
|
progressPercent = newPercent;
|
||||||
cacheWriteNotify.downloadProgressPercent(statusId, progressPercent);
|
controllerManagement.downloadProgressPercent(statusId, progressPercent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.rest;
|
package org.eclipse.hawkbit.rest;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTest;
|
import org.eclipse.hawkbit.repository.util.AbstractIntegrationTest;
|
||||||
import org.eclipse.hawkbit.rest.configuration.RestConfiguration;
|
import org.eclipse.hawkbit.rest.configuration.RestConfiguration;
|
||||||
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -18,8 +18,9 @@ import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder;
|
|||||||
/**
|
/**
|
||||||
* Abstract Test for Rest tests.
|
* Abstract Test for Rest tests.
|
||||||
*/
|
*/
|
||||||
@SpringApplicationConfiguration(classes = { RestConfiguration.class })
|
@SpringApplicationConfiguration(classes = { RestConfiguration.class,
|
||||||
public abstract class AbstractRestIntegrationTest extends AbstractJpaIntegrationTest {
|
org.eclipse.hawkbit.RepositoryApplicationConfiguration.class })
|
||||||
|
public abstract class AbstractRestIntegrationTest extends AbstractIntegrationTest {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FilterHttpResponse filterHttpResponse;
|
private FilterHttpResponse filterHttpResponse;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.rest;
|
package org.eclipse.hawkbit.rest;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.AbstractJpaIntegrationTestWithMongoDB;
|
import org.eclipse.hawkbit.repository.util.AbstractIntegrationTestWithMongoDB;
|
||||||
import org.eclipse.hawkbit.rest.configuration.RestConfiguration;
|
import org.eclipse.hawkbit.rest.configuration.RestConfiguration;
|
||||||
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
import org.eclipse.hawkbit.rest.util.FilterHttpResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -18,8 +18,9 @@ import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder;
|
|||||||
/**
|
/**
|
||||||
* Abstract Test for Rest tests.
|
* Abstract Test for Rest tests.
|
||||||
*/
|
*/
|
||||||
@SpringApplicationConfiguration(classes = { RestConfiguration.class })
|
@SpringApplicationConfiguration(classes = { RestConfiguration.class,
|
||||||
public abstract class AbstractRestIntegrationTestWithMongoDB extends AbstractJpaIntegrationTestWithMongoDB {
|
org.eclipse.hawkbit.RepositoryApplicationConfiguration.class })
|
||||||
|
public abstract class AbstractRestIntegrationTestWithMongoDB extends AbstractIntegrationTestWithMongoDB {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private FilterHttpResponse filterHttpResponse;
|
private FilterHttpResponse filterHttpResponse;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
<artifactId>hawkbit-repository-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -37,6 +37,12 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- TEST -->
|
<!-- TEST -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
|
|||||||
@@ -151,7 +151,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-repository-jpa</artifactId>
|
<artifactId>hawkbit-repository-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Vaadin -->
|
<!-- Vaadin -->
|
||||||
@@ -229,6 +229,12 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Test -->
|
<!-- Test -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository-jpa</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaLocalArtifact;
|
|
||||||
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
import org.eclipse.hawkbit.repository.model.LocalArtifact;
|
||||||
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
import org.eclipse.hawkbit.ui.utils.HawkbitCommonUtil;
|
||||||
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
import org.eclipse.hawkbit.ui.utils.SPUIDefinitions;
|
||||||
@@ -38,6 +38,7 @@ public class ArtifactBeanQuery extends AbstractBeanQuery<LocalArtifact> {
|
|||||||
private static final long serialVersionUID = -333786310371208962L;
|
private static final long serialVersionUID = -333786310371208962L;
|
||||||
private Sort sort = new Sort(Direction.DESC, "filename");
|
private Sort sort = new Sort(Direction.DESC, "filename");
|
||||||
private transient ArtifactManagement artifactManagement = null;
|
private transient ArtifactManagement artifactManagement = null;
|
||||||
|
private transient EntityFactory entityFactory;
|
||||||
private transient Page<LocalArtifact> firstPagetArtifacts = null;
|
private transient Page<LocalArtifact> firstPagetArtifacts = null;
|
||||||
private Long baseSwModuleId = null;
|
private Long baseSwModuleId = null;
|
||||||
|
|
||||||
@@ -73,7 +74,7 @@ public class ArtifactBeanQuery extends AbstractBeanQuery<LocalArtifact> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected LocalArtifact constructBean() {
|
protected LocalArtifact constructBean() {
|
||||||
return new JpaLocalArtifact();
|
return entityFactory.generateLocalArtifact();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -116,4 +117,11 @@ public class ArtifactBeanQuery extends AbstractBeanQuery<LocalArtifact> {
|
|||||||
}
|
}
|
||||||
return artifactManagement;
|
return artifactManagement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private EntityFactory getEntityFactory() {
|
||||||
|
if (entityFactory == null) {
|
||||||
|
entityFactory = SpringContextHelper.getBean(EntityFactory.class);
|
||||||
|
}
|
||||||
|
return entityFactory;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ package org.eclipse.hawkbit.ui.artifacts.smtable;
|
|||||||
|
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Proxy for software module to display details in Software modules table.
|
* Proxy for software module to display details in Software modules table.
|
||||||
@@ -19,7 +17,7 @@ import org.eclipse.hawkbit.repository.jpa.model.JpaSoftwareModule;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyBaseSoftwareModuleItem extends JpaSoftwareModule {
|
public class ProxyBaseSoftwareModuleItem {
|
||||||
|
|
||||||
private static final long serialVersionUID = -1555306616599140635L;
|
private static final long serialVersionUID = -1555306616599140635L;
|
||||||
|
|
||||||
@@ -39,6 +37,11 @@ public class ProxyBaseSoftwareModuleItem extends JpaSoftwareModule {
|
|||||||
|
|
||||||
private String modifiedByUser;
|
private String modifiedByUser;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String version;
|
||||||
|
private String vendor;
|
||||||
|
private String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
*/
|
*/
|
||||||
@@ -47,6 +50,38 @@ public class ProxyBaseSoftwareModuleItem extends JpaSoftwareModule {
|
|||||||
swId = RANDOM_OBJ.nextLong();
|
swId = RANDOM_OBJ.nextLong();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(final String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(final String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVendor() {
|
||||||
|
return vendor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVendor(final String vendor) {
|
||||||
|
this.vendor = vendor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCreatedByUser() {
|
public String getCreatedByUser() {
|
||||||
return createdByUser;
|
return createdByUser;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,18 @@ public class DistributionSetIdName implements Serializable {
|
|||||||
private final Long id;
|
private final Long id;
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String version;
|
private final String version;
|
||||||
|
|
||||||
public static DistributionSetIdName generate(final DistributionSet distributionSet) {
|
public static DistributionSetIdName generate(final DistributionSet distributionSet) {
|
||||||
return new DistributionSetIdName(distributionSet.getId(), distributionSet.getName(),
|
return new DistributionSetIdName(distributionSet.getId(), distributionSet.getName(),
|
||||||
distributionSet.getVersion());
|
distributionSet.getVersion());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DistributionSetIdName generate(final Long id, final String name, final String version) {
|
||||||
|
return new DistributionSetIdName(id, name, version);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param id
|
* @param id
|
||||||
* the {@link DistributionSet#getId()}
|
* the {@link DistributionSet#getId()}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.components;
|
package org.eclipse.hawkbit.ui.components;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ import org.eclipse.hawkbit.ui.common.DistributionSetIdName;
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyDistribution extends JpaDistributionSet {
|
public class ProxyDistribution {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8891449133620645310L;
|
private static final long serialVersionUID = -8891449133620645310L;
|
||||||
|
|
||||||
@@ -35,6 +34,11 @@ public class ProxyDistribution extends JpaDistributionSet {
|
|||||||
|
|
||||||
private String nameVersion;
|
private String nameVersion;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
private String version;
|
||||||
|
private String description;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the nameVersion
|
* @return the nameVersion
|
||||||
*/
|
*/
|
||||||
@@ -43,7 +47,7 @@ public class ProxyDistribution extends JpaDistributionSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DistributionSetIdName getDistributionSetIdName() {
|
public DistributionSetIdName getDistributionSetIdName() {
|
||||||
return DistributionSetIdName.generate(this);
|
return DistributionSetIdName.generate(id, name, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -102,4 +106,36 @@ public class ProxyDistribution extends JpaDistributionSet {
|
|||||||
this.modifiedByUser = modifiedByUser;
|
this.modifiedByUser = modifiedByUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(final Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(final String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(final String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,14 +8,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.components;
|
package org.eclipse.hawkbit.ui.components;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaTargetFilterQuery;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyTargetFilter extends JpaTargetFilterQuery {
|
public class ProxyTargetFilter {
|
||||||
|
|
||||||
private static final long serialVersionUID = 6622060929679084419L;
|
private static final long serialVersionUID = 6622060929679084419L;
|
||||||
|
|
||||||
@@ -23,6 +21,12 @@ public class ProxyTargetFilter extends JpaTargetFilterQuery {
|
|||||||
|
|
||||||
private String modifiedDate;
|
private String modifiedDate;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private Long id;
|
||||||
|
private String createdBy;
|
||||||
|
private String lastModifiedBy;
|
||||||
|
private String query;
|
||||||
|
|
||||||
public String getCreatedDate() {
|
public String getCreatedDate() {
|
||||||
return createdDate;
|
return createdDate;
|
||||||
}
|
}
|
||||||
@@ -46,4 +50,44 @@ public class ProxyTargetFilter extends JpaTargetFilterQuery {
|
|||||||
this.modifiedDate = modifiedDate;
|
this.modifiedDate = modifiedDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(final String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(final Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastModifiedBy() {
|
||||||
|
return lastModifiedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastModifiedBy(final String lastModifiedBy) {
|
||||||
|
this.lastModifiedBy = lastModifiedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQuery() {
|
||||||
|
return query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuery(final String query) {
|
||||||
|
this.query = query;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreatedBy() {
|
||||||
|
return createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedBy(final String createdBy) {
|
||||||
|
this.createdBy = createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
|||||||
import org.eclipse.hawkbit.repository.EntityFactory;
|
import org.eclipse.hawkbit.repository.EntityFactory;
|
||||||
import org.eclipse.hawkbit.repository.SystemManagement;
|
import org.eclipse.hawkbit.repository.SystemManagement;
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
import org.eclipse.hawkbit.repository.exception.EntityAlreadyExistsException;
|
||||||
import org.eclipse.hawkbit.repository.jpa.TenantMetaDataRepository;
|
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
import org.eclipse.hawkbit.repository.model.DistributionSetType;
|
||||||
import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
import org.eclipse.hawkbit.repository.model.TenantMetaData;
|
||||||
@@ -92,9 +91,6 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private transient SystemManagement systemManagement;
|
private transient SystemManagement systemManagement;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private transient TenantMetaDataRepository tenantMetaDataRepository;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private transient EntityFactory entityFactory;
|
private transient EntityFactory entityFactory;
|
||||||
|
|
||||||
@@ -225,8 +221,7 @@ public class DistributionAddUpdateWindowLayout extends VerticalLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DistributionSetType getDefaultDistributionSetType() {
|
private DistributionSetType getDefaultDistributionSetType() {
|
||||||
final TenantMetaData tenantMetaData = tenantMetaDataRepository
|
final TenantMetaData tenantMetaData = systemManagement.getTenantMetadata();
|
||||||
.findByTenantIgnoreCase(systemManagement.currentTenant());
|
|
||||||
return tenantMetaData.getDefaultDsType();
|
return tenantMetaData.getDefaultDsType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ package org.eclipse.hawkbit.ui.rollout.rollout;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRollout;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
|
import org.eclipse.hawkbit.repository.model.Rollout.RolloutStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
||||||
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
|
|
||||||
import com.vaadin.server.FontAwesome;
|
import com.vaadin.server.FontAwesome;
|
||||||
@@ -20,7 +22,7 @@ import com.vaadin.server.FontAwesome;
|
|||||||
* Proxy rollout with custom properties.
|
* Proxy rollout with custom properties.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyRollout extends JpaRollout {
|
public class ProxyRollout {
|
||||||
|
|
||||||
private static final long serialVersionUID = 4539849939617681918L;
|
private static final long serialVersionUID = 4539849939617681918L;
|
||||||
|
|
||||||
@@ -46,6 +48,17 @@ public class ProxyRollout extends JpaRollout {
|
|||||||
|
|
||||||
private Set<SoftwareModule> swModules;
|
private Set<SoftwareModule> swModules;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
private String version;
|
||||||
|
private String description;
|
||||||
|
private DistributionSet distributionSet;
|
||||||
|
private String createdBy;
|
||||||
|
private String lastModifiedBy;
|
||||||
|
private long forcedTime;
|
||||||
|
private RolloutStatus status;
|
||||||
|
private TotalTargetCountStatus totalTargetCountStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the isRequiredMigrationStep
|
* @return the isRequiredMigrationStep
|
||||||
*/
|
*/
|
||||||
@@ -214,4 +227,83 @@ public class ProxyRollout extends JpaRollout {
|
|||||||
return FontAwesome.CIRCLE_O.getHtml();
|
return FontAwesome.CIRCLE_O.getHtml();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(final Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(final String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(final String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DistributionSet getDistributionSet() {
|
||||||
|
return distributionSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDistributionSet(final DistributionSet distributionSet) {
|
||||||
|
this.distributionSet = distributionSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreatedBy() {
|
||||||
|
return createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedBy(final String createdBy) {
|
||||||
|
this.createdBy = createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastModifiedBy() {
|
||||||
|
return lastModifiedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastModifiedBy(final String lastModifiedBy) {
|
||||||
|
this.lastModifiedBy = lastModifiedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getForcedTime() {
|
||||||
|
return forcedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setForcedTime(final long forcedTime) {
|
||||||
|
this.forcedTime = forcedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RolloutStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(final RolloutStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TotalTargetCountStatus getTotalTargetCountStatus() {
|
||||||
|
return totalTargetCountStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalTargetCountStatus(final TotalTargetCountStatus totalTargetCountStatus) {
|
||||||
|
this.totalTargetCountStatus = totalTargetCountStatus;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,8 +138,6 @@ public class RolloutBeanQuery extends AbstractBeanQuery<ProxyRollout> {
|
|||||||
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
|
final TotalTargetCountStatus totalTargetCountActionStatus = rollout.getTotalTargetCountStatus();
|
||||||
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
|
proxyRollout.setTotalTargetCountStatus(totalTargetCountActionStatus);
|
||||||
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
|
proxyRollout.setTotalTargetsCount(String.valueOf(rollout.getTotalTargets()));
|
||||||
|
|
||||||
proxyRollout.setDescription(distributionSet.getDescription());
|
|
||||||
proxyRollout.setType(distributionSet.getType().getName());
|
proxyRollout.setType(distributionSet.getType().getName());
|
||||||
proxyRollout.setIsRequiredMigrationStep(distributionSet.isRequiredMigrationStep());
|
proxyRollout.setIsRequiredMigrationStep(distributionSet.isRequiredMigrationStep());
|
||||||
proxyRollout.setSwModules(distributionSet.getModules());
|
proxyRollout.setSwModules(distributionSet.getModules());
|
||||||
|
|||||||
@@ -8,14 +8,19 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.ui.rollout.rolloutgroup;
|
package org.eclipse.hawkbit.ui.rollout.rolloutgroup;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.repository.jpa.model.JpaRolloutGroup;
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorAction;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupErrorCondition;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupStatus;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessAction;
|
||||||
|
import org.eclipse.hawkbit.repository.model.RolloutGroup.RolloutGroupSuccessCondition;
|
||||||
|
import org.eclipse.hawkbit.repository.model.TotalTargetCountStatus;
|
||||||
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
import org.eclipse.hawkbit.ui.customrenderers.client.renderers.RolloutRendererData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Proxy rollout group with renderer properties.
|
* Proxy rollout group with renderer properties.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ProxyRolloutGroup extends JpaRolloutGroup {
|
public class ProxyRolloutGroup {
|
||||||
|
|
||||||
private static final long serialVersionUID = -2745056813306692356L;
|
private static final long serialVersionUID = -2745056813306692356L;
|
||||||
|
|
||||||
@@ -41,6 +46,23 @@ public class ProxyRolloutGroup extends JpaRolloutGroup {
|
|||||||
|
|
||||||
private String totalTargetsCount;
|
private String totalTargetsCount;
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private String createdBy;
|
||||||
|
private String lastModifiedBy;
|
||||||
|
private RolloutGroupStatus status;
|
||||||
|
private TotalTargetCountStatus totalTargetCountStatus;
|
||||||
|
|
||||||
|
private RolloutGroupSuccessCondition successCondition;
|
||||||
|
private String successConditionExp;
|
||||||
|
private RolloutGroupSuccessAction successAction;
|
||||||
|
private String successActionExp;
|
||||||
|
private RolloutGroupErrorCondition errorCondition;
|
||||||
|
private String errorConditionExp;
|
||||||
|
private RolloutGroupErrorAction errorAction;
|
||||||
|
private String errorActionExp;
|
||||||
|
|
||||||
private RolloutRendererData rolloutRendererData;
|
private RolloutRendererData rolloutRendererData;
|
||||||
|
|
||||||
public RolloutRendererData getRolloutRendererData() {
|
public RolloutRendererData getRolloutRendererData() {
|
||||||
@@ -216,4 +238,124 @@ public class ProxyRolloutGroup extends JpaRolloutGroup {
|
|||||||
this.totalTargetsCount = totalTargetsCount;
|
this.totalTargetsCount = totalTargetsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(final String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(final Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(final String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreatedBy() {
|
||||||
|
return createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedBy(final String createdBy) {
|
||||||
|
this.createdBy = createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastModifiedBy() {
|
||||||
|
return lastModifiedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastModifiedBy(final String lastModifiedBy) {
|
||||||
|
this.lastModifiedBy = lastModifiedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RolloutGroupStatus getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(final RolloutGroupStatus status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TotalTargetCountStatus getTotalTargetCountStatus() {
|
||||||
|
return totalTargetCountStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotalTargetCountStatus(final TotalTargetCountStatus totalTargetCountStatus) {
|
||||||
|
this.totalTargetCountStatus = totalTargetCountStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RolloutGroupSuccessCondition getSuccessCondition() {
|
||||||
|
return successCondition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccessCondition(final RolloutGroupSuccessCondition successCondition) {
|
||||||
|
this.successCondition = successCondition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSuccessConditionExp() {
|
||||||
|
return successConditionExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccessConditionExp(final String successConditionExp) {
|
||||||
|
this.successConditionExp = successConditionExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RolloutGroupSuccessAction getSuccessAction() {
|
||||||
|
return successAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccessAction(final RolloutGroupSuccessAction successAction) {
|
||||||
|
this.successAction = successAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSuccessActionExp() {
|
||||||
|
return successActionExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccessActionExp(final String successActionExp) {
|
||||||
|
this.successActionExp = successActionExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RolloutGroupErrorCondition getErrorCondition() {
|
||||||
|
return errorCondition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorCondition(final RolloutGroupErrorCondition errorCondition) {
|
||||||
|
this.errorCondition = errorCondition;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getErrorConditionExp() {
|
||||||
|
return errorConditionExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorConditionExp(final String errorConditionExp) {
|
||||||
|
this.errorConditionExp = errorConditionExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RolloutGroupErrorAction getErrorAction() {
|
||||||
|
return errorAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorAction(final RolloutGroupErrorAction errorAction) {
|
||||||
|
this.errorAction = errorAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getErrorActionExp() {
|
||||||
|
return errorActionExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorActionExp(final String errorActionExp) {
|
||||||
|
this.errorActionExp = errorActionExp;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user