Add test dependencies
Add name of @PathVariable Signed-off-by: SirWayne <dennis.melzer@bosch-si.com>
This commit is contained in:
@@ -8,13 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit.mgmt.client.resource;
|
package org.eclipse.hawkbit.mgmt.client.resource;
|
||||||
|
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestAPI;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
|
||||||
import org.springframework.cloud.netflix.feign.FeignClient;
|
import org.springframework.cloud.netflix.feign.FeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Client binding for the SoftwareModule resource of the management API.
|
* Client binding for the SoftwareModule resource of the management API.
|
||||||
*/
|
*/
|
||||||
@FeignClient(url = "${hawkbit.url:localhost:8080}/rest/v1/softwaremodules")
|
@FeignClient(url = "${hawkbit.url:localhost:8080}/rest/v1/softwaremodules")
|
||||||
public interface SoftwareModuleResourceClient extends MgmtSoftwareModuleRestAPI {
|
public interface SoftwareModuleResourceClient extends MgmtSoftwareModuleRestApi {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,10 @@
|
|||||||
<!-- Test -->
|
<!-- Test -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-rest-core</artifactId>
|
<artifactId>hawkbit-rest-core</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<classifier>test</classifier>
|
<classifier>tests</classifier>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@@ -151,19 +152,4 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>test-jar</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public interface MgmtDownloadRestApi {
|
|||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.GET, value = MgmtRestConstants.DOWNLOAD_ID_V1_REQUEST_MAPPING)
|
@RequestMapping(method = RequestMethod.GET, value = MgmtRestConstants.DOWNLOAD_ID_V1_REQUEST_MAPPING)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
ResponseEntity<Void> downloadArtifactByDownloadId(@PathVariable final String downloadId,
|
ResponseEntity<Void> downloadArtifactByDownloadId(@PathVariable("downloadId") final String downloadId,
|
||||||
final HttpServletResponse response);
|
final HttpServletResponse response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RequestMapping(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)
|
@RequestMapping(MgmtRestConstants.SOFTWAREMODULE_V1_REQUEST_MAPPING)
|
||||||
public interface MgmtSoftwareModuleRestAPI {
|
public interface MgmtSoftwareModuleRestApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles POST request for artifact upload.
|
* Handles POST request for artifact upload.
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<version>0.2.0-SNAPSHOT</version>
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-mgmt-resource</artifactId>
|
<artifactId>hawkbit-mgmt-resource</artifactId>
|
||||||
<name>hawkBit :: REST Resources</name>
|
<name>hawkBit :: REST Managment Resources</name>
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -31,11 +31,12 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Test -->
|
<!-- Test -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-rest-core</artifactId>
|
<artifactId>hawkbit-rest-core</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<classifier>test</classifier>
|
<classifier>tests</classifier>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@@ -136,25 +137,10 @@
|
|||||||
<artifactId>allure-junit-adaptor</artifactId>
|
<artifactId>allure-junit-adaptor</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context-support</artifactId>
|
<artifactId>spring-context-support</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>test-jar</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
</project>
|
||||||
@@ -20,7 +20,7 @@ import org.eclipse.hawkbit.mgmt.json.model.artifact.MgmtArtifactHash;
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
|
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPost;
|
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPost;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestAPI;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleTypeRestApi;
|
||||||
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;
|
||||||
@@ -140,9 +140,9 @@ public final class MgmtSoftwareModuleMapper {
|
|||||||
response.setType(baseSofwareModule.getType().getKey());
|
response.setType(baseSofwareModule.getType().getKey());
|
||||||
response.setVendor(baseSofwareModule.getVendor());
|
response.setVendor(baseSofwareModule.getVendor());
|
||||||
|
|
||||||
response.add(linkTo(methodOn(MgmtSoftwareModuleRestAPI.class).getArtifacts(response.getModuleId()))
|
response.add(linkTo(methodOn(MgmtSoftwareModuleRestApi.class).getArtifacts(response.getModuleId()))
|
||||||
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_ARTIFACT));
|
.withRel(MgmtRestConstants.SOFTWAREMODULE_V1_ARTIFACT));
|
||||||
response.add(linkTo(methodOn(MgmtSoftwareModuleRestAPI.class).getSoftwareModule(response.getModuleId()))
|
response.add(linkTo(methodOn(MgmtSoftwareModuleRestApi.class).getSoftwareModule(response.getModuleId()))
|
||||||
.withRel("self"));
|
.withRel("self"));
|
||||||
|
|
||||||
response.add(linkTo(
|
response.add(linkTo(
|
||||||
@@ -176,7 +176,7 @@ public final class MgmtSoftwareModuleMapper {
|
|||||||
|
|
||||||
MgmtRestModelMapper.mapBaseToBase(artifactRest, artifact);
|
MgmtRestModelMapper.mapBaseToBase(artifactRest, artifact);
|
||||||
|
|
||||||
artifactRest.add(linkTo(methodOn(MgmtSoftwareModuleRestAPI.class).getArtifact(artifact.getSoftwareModule().getId(),
|
artifactRest.add(linkTo(methodOn(MgmtSoftwareModuleRestApi.class).getArtifact(artifact.getSoftwareModule().getId(),
|
||||||
artifact.getId())).withRel("self"));
|
artifact.getId())).withRel("self"));
|
||||||
|
|
||||||
if (artifact instanceof LocalArtifact) {
|
if (artifact instanceof LocalArtifact) {
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModule;
|
|||||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPost;
|
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPost;
|
||||||
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPut;
|
import org.eclipse.hawkbit.mgmt.json.model.softwaremodule.MgmtSoftwareModuleRequestBodyPut;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestAPI;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtSoftwareModuleRestApi;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
import org.eclipse.hawkbit.repository.OffsetBasedPageRequest;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
@@ -51,7 +51,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestAPI {
|
public class MgmtSoftwareModuleResource implements MgmtSoftwareModuleRestApi {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MgmtSoftwareModuleResource.class);
|
private static final Logger LOG = LoggerFactory.getLogger(MgmtSoftwareModuleResource.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|||||||
@@ -30,15 +30,8 @@ import org.eclipse.hawkbit.AbstractIntegrationTest;
|
|||||||
import org.eclipse.hawkbit.TestDataUtil;
|
import org.eclipse.hawkbit.TestDataUtil;
|
||||||
import org.eclipse.hawkbit.WithUser;
|
import org.eclipse.hawkbit.WithUser;
|
||||||
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
import org.eclipse.hawkbit.mgmt.rest.api.MgmtRestConstants;
|
||||||
import org.eclipse.hawkbit.repository.ActionRepository;
|
|
||||||
import org.eclipse.hawkbit.repository.ControllerManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
|
||||||
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
|
||||||
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.DistributionSet;
|
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.DsMetadataCompositeKey;
|
import org.eclipse.hawkbit.repository.model.DsMetadataCompositeKey;
|
||||||
@@ -299,8 +292,8 @@ public class MgmtDistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
// assign knownTargetId to distribution set
|
// assign knownTargetId to distribution set
|
||||||
deploymentManagement.assignDistributionSet(createdDs.getId(), knownTargetId);
|
deploymentManagement.assignDistributionSet(createdDs.getId(), knownTargetId);
|
||||||
// make it in install state
|
// make it in install state
|
||||||
sendUpdateActionStatusToTargets(controllerManagament, targetManagement, actionRepository, createdDs,
|
TestDataUtil.sendUpdateActionStatusToTargets(controllerManagament, targetManagement, actionRepository,
|
||||||
Lists.newArrayList(createTarget), Status.FINISHED, "some message");
|
createdDs, Lists.newArrayList(createTarget), Status.FINISHED, "some message");
|
||||||
|
|
||||||
mvc.perform(get(
|
mvc.perform(get(
|
||||||
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/installedTargets"))
|
MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + createdDs.getId() + "/installedTargets"))
|
||||||
@@ -399,7 +392,8 @@ public class MgmtDistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
@WithUser(principal = "uploadTester", allSpPermissions = true)
|
||||||
@Description("Ensures that single DS requested by ID is listed with expected payload.")
|
@Description("Ensures that single DS requested by ID is listed with expected payload.")
|
||||||
public void getDistributionSet() throws Exception {
|
public void getDistributionSet() throws Exception {
|
||||||
final DistributionSet set = createTestDistributionSet(softwareManagement, distributionSetManagement);
|
final DistributionSet set = TestDataUtil.createTestDistributionSet(softwareManagement,
|
||||||
|
distributionSetManagement);
|
||||||
|
|
||||||
// perform request
|
// perform request
|
||||||
mvc.perform(get("/rest/v1/distributionsets/{dsId}", set.getId()).accept(MediaType.APPLICATION_JSON))
|
mvc.perform(get("/rest/v1/distributionsets/{dsId}", set.getId()).accept(MediaType.APPLICATION_JSON))
|
||||||
@@ -869,54 +863,4 @@ public class MgmtDistributionSetResourceTest extends AbstractIntegrationTest {
|
|||||||
return created;
|
return created;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<Target> sendUpdateActionStatusToTargets(final ControllerManagement controllerManagament,
|
|
||||||
final TargetManagement targetManagement, final ActionRepository actionRepository, final DistributionSet dsA,
|
|
||||||
final Iterable<Target> targs, final Status status, final String... msgs) {
|
|
||||||
final List<Target> result = new ArrayList<Target>();
|
|
||||||
for (final Target t : targs) {
|
|
||||||
final List<Action> findByTarget = actionRepository.findByTarget(t);
|
|
||||||
for (final Action action : findByTarget) {
|
|
||||||
result.add(sendUpdateActionStatusToTarget(controllerManagament, targetManagement, status, action, t,
|
|
||||||
msgs));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Target sendUpdateActionStatusToTarget(final ControllerManagement controllerManagament,
|
|
||||||
final TargetManagement targetManagement, final Status status, final Action updActA, final Target t,
|
|
||||||
final String... msgs) {
|
|
||||||
updActA.setStatus(status);
|
|
||||||
|
|
||||||
final ActionStatus statusMessages = new ActionStatus();
|
|
||||||
statusMessages.setAction(updActA);
|
|
||||||
statusMessages.setOccurredAt(System.currentTimeMillis());
|
|
||||||
statusMessages.setStatus(status);
|
|
||||||
for (final String msg : msgs) {
|
|
||||||
statusMessages.addMessage(msg);
|
|
||||||
}
|
|
||||||
controllerManagament.addUpdateActionStatus(statusMessages, updActA);
|
|
||||||
return targetManagement.findTargetByControllerID(t.getControllerId());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DistributionSet createTestDistributionSet(final SoftwareManagement softwareManagement,
|
|
||||||
final DistributionSetManagement distributionSetManagement) {
|
|
||||||
|
|
||||||
DistributionSet set = TestDataUtil.generateDistributionSet("one", softwareManagement,
|
|
||||||
distributionSetManagement);
|
|
||||||
set.setVersion("anotherVersion");
|
|
||||||
set = distributionSetManagement.updateDistributionSet(set);
|
|
||||||
|
|
||||||
set.getModules().forEach(module -> {
|
|
||||||
module.setDescription("updated description");
|
|
||||||
softwareManagement.updateSoftwareModule(module);
|
|
||||||
});
|
|
||||||
|
|
||||||
// load also lazy stuff
|
|
||||||
set = distributionSetManagement.findDistributionSetByIdWithDetails(set.getId());
|
|
||||||
|
|
||||||
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(1);
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.eclipse.hawkbit;
|
package org.eclipse.hawkbit;
|
||||||
|
|
||||||
|
import static org.fest.assertions.api.Assertions.assertThat;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -16,10 +18,15 @@ import java.util.Random;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.eclipse.hawkbit.repository.ActionRepository;
|
||||||
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
import org.eclipse.hawkbit.repository.ArtifactManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.ControllerManagement;
|
||||||
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
import org.eclipse.hawkbit.repository.DistributionSetManagement;
|
||||||
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
import org.eclipse.hawkbit.repository.SoftwareManagement;
|
||||||
import org.eclipse.hawkbit.repository.TargetManagement;
|
import org.eclipse.hawkbit.repository.TargetManagement;
|
||||||
|
import org.eclipse.hawkbit.repository.model.Action;
|
||||||
|
import org.eclipse.hawkbit.repository.model.Action.Status;
|
||||||
|
import org.eclipse.hawkbit.repository.model.ActionStatus;
|
||||||
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
import org.eclipse.hawkbit.repository.model.DistributionSet;
|
||||||
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;
|
||||||
@@ -27,6 +34,8 @@ import org.eclipse.hawkbit.repository.model.SoftwareModule;
|
|||||||
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
import org.eclipse.hawkbit.repository.model.SoftwareModuleType;
|
||||||
import org.eclipse.hawkbit.repository.model.Target;
|
import org.eclipse.hawkbit.repository.model.Target;
|
||||||
import org.eclipse.hawkbit.repository.model.TargetTag;
|
import org.eclipse.hawkbit.repository.model.TargetTag;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.domain.Pageable;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
@@ -42,6 +51,56 @@ import net._01001111.text.LoremIpsum;
|
|||||||
public class TestDataUtil {
|
public class TestDataUtil {
|
||||||
private static final LoremIpsum LOREM = new LoremIpsum();
|
private static final LoremIpsum LOREM = new LoremIpsum();
|
||||||
|
|
||||||
|
public static DistributionSet createTestDistributionSet(final SoftwareManagement softwareManagement,
|
||||||
|
final DistributionSetManagement distributionSetManagement) {
|
||||||
|
final Pageable pageReq = new PageRequest(0, 400);
|
||||||
|
DistributionSet set = TestDataUtil.generateDistributionSet("one", softwareManagement,
|
||||||
|
distributionSetManagement);
|
||||||
|
set.setVersion("anotherVersion");
|
||||||
|
set = distributionSetManagement.updateDistributionSet(set);
|
||||||
|
|
||||||
|
set.getModules().forEach(module -> {
|
||||||
|
module.setDescription("updated description");
|
||||||
|
softwareManagement.updateSoftwareModule(module);
|
||||||
|
});
|
||||||
|
|
||||||
|
// load also lazy stuff
|
||||||
|
set = distributionSetManagement.findDistributionSetByIdWithDetails(set.getId());
|
||||||
|
|
||||||
|
assertThat(distributionSetManagement.findDistributionSetsAll(pageReq, false, true)).hasSize(1);
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Target> sendUpdateActionStatusToTargets(final ControllerManagement controllerManagament,
|
||||||
|
final TargetManagement targetManagement, final ActionRepository actionRepository, final DistributionSet dsA,
|
||||||
|
final Iterable<Target> targs, final Status status, final String... msgs) {
|
||||||
|
final List<Target> result = new ArrayList<Target>();
|
||||||
|
for (final Target t : targs) {
|
||||||
|
final List<Action> findByTarget = actionRepository.findByTarget(t);
|
||||||
|
for (final Action action : findByTarget) {
|
||||||
|
result.add(sendUpdateActionStatusToTarget(controllerManagament, targetManagement, status, action, t,
|
||||||
|
msgs));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Target sendUpdateActionStatusToTarget(final ControllerManagement controllerManagament,
|
||||||
|
final TargetManagement targetManagement, final Status status, final Action updActA, final Target t,
|
||||||
|
final String... msgs) {
|
||||||
|
updActA.setStatus(status);
|
||||||
|
|
||||||
|
final ActionStatus statusMessages = new ActionStatus();
|
||||||
|
statusMessages.setAction(updActA);
|
||||||
|
statusMessages.setOccurredAt(System.currentTimeMillis());
|
||||||
|
statusMessages.setStatus(status);
|
||||||
|
for (final String msg : msgs) {
|
||||||
|
statusMessages.addMessage(msg);
|
||||||
|
}
|
||||||
|
controllerManagament.addUpdateActionStatus(statusMessages, updActA);
|
||||||
|
return targetManagement.findTargetByControllerID(t.getControllerId());
|
||||||
|
}
|
||||||
|
|
||||||
public static List<DistributionSet> generateDistributionSets(final String suffix, final int number,
|
public static List<DistributionSet> generateDistributionSets(final String suffix, final int number,
|
||||||
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement) {
|
final SoftwareManagement softwareManagement, final DistributionSetManagement distributionSetManagement) {
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<version>0.2.0-SNAPSHOT</version>
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-rest-core</artifactId>
|
<artifactId>hawkbit-rest-core</artifactId>
|
||||||
<name>hawkBit :: REST Resources</name>
|
<name>hawkBit :: REST Core</name>
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -1,63 +0,0 @@
|
|||||||
#
|
|
||||||
# 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
|
|
||||||
#
|
|
||||||
|
|
||||||
# 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
|
|
||||||
hawkbit.server.database=H2
|
|
||||||
hawkbit.server.database.env=TEST
|
|
||||||
spring.main.show_banner=false
|
|
||||||
|
|
||||||
hawkbit.server.ddi.security.authentication.header=true
|
|
||||||
|
|
||||||
hawkbit.server.artifact.repo.upload.maxFileSize=5MB
|
|
||||||
|
|
||||||
hawkbit.server.security.dos.maxStatusEntriesPerAction=100
|
|
||||||
|
|
||||||
hawkbit.server.security.dos.maxAttributeEntriesPerTarget=10
|
|
||||||
|
|
||||||
spring.jpa.database=${hawkbit.server.database}
|
|
||||||
#spring.jpa.show-sql=true
|
|
||||||
|
|
||||||
|
|
||||||
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=
|
|
||||||
|
|
||||||
# SP Controller configuration
|
|
||||||
hawkbit.controller.pollingTime=00:01:00
|
|
||||||
hawkbit.controller.pollingOverdueTime=00:01:00
|
|
||||||
@@ -33,7 +33,7 @@ public interface SystemManagementRestApi {
|
|||||||
* @return HttpStatus.OK
|
* @return HttpStatus.OK
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "/tenants/{tenant}")
|
@RequestMapping(method = RequestMethod.DELETE, value = "/tenants/{tenant}")
|
||||||
ResponseEntity<Void> deleteTenant(@PathVariable final String tenant);
|
ResponseEntity<Void> deleteTenant(@PathVariable("tenant") final String tenant);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collects and returns system usage statistics. It provides a system wide
|
* Collects and returns system usage statistics. It provides a system wide
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<version>0.2.0-SNAPSHOT</version>
|
<version>0.2.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>hawkbit-system-resource</artifactId>
|
<artifactId>hawkbit-system-resource</artifactId>
|
||||||
<name>hawkBit :: REST Resources</name>
|
<name>hawkBit :: System REST Resources</name>
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -33,25 +33,93 @@
|
|||||||
<!-- Test -->
|
<!-- Test -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
<artifactId>hawkbit-rest-core</artifactId>
|
<artifactId>hawkbit-rest-core</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
<classifier>test</classifier>
|
<classifier>tests</classifier>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-logging</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-log4j2</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mariadb.jdbc</groupId>
|
||||||
|
<artifactId>mariadb-java-client</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.el</groupId>
|
||||||
|
<artifactId>javax.el-api</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-config</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-repository</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<classifier>tests</classifier>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.hawkbit</groupId>
|
||||||
|
<artifactId>hawkbit-http-security</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jayway.jsonpath</groupId>
|
||||||
|
<artifactId>json-path</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.json</groupId>
|
||||||
|
<artifactId>json</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-core</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.easytesting</groupId>
|
<groupId>org.springframework.security</groupId>
|
||||||
<artifactId>fest-assert-core</artifactId>
|
<artifactId>spring-security-aspects</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.hawkbit</groupId>
|
<groupId>org.easytesting</groupId>
|
||||||
<artifactId>hawkbit-repository</artifactId>
|
<artifactId>fest-assert-core</artifactId>
|
||||||
<version>${project.version}</version>
|
|
||||||
<classifier>tests</classifier>
|
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -59,10 +127,20 @@
|
|||||||
<artifactId>fest-assert</artifactId>
|
<artifactId>fest-assert</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.flapdoodle.embed</groupId>
|
||||||
|
<artifactId>de.flapdoodle.embed.mongo</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</groupId>
|
||||||
|
<artifactId>spring-context-support</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
Reference in New Issue
Block a user