Spring Boot 2.0 (#721)

* Migration to Boot 2.0.

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

View File

@@ -12,16 +12,23 @@ import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration;
import org.eclipse.hawkbit.repository.model.BaseEntity;
import org.eclipse.hawkbit.repository.model.NamedEntity;
import org.eclipse.hawkbit.repository.model.NamedVersionedEntity;
import org.eclipse.hawkbit.repository.model.Tag;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.test.TestConfiguration;
import org.eclipse.hawkbit.rest.AbstractRestIntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.eclipse.hawkbit.rest.RestConfiguration;
import org.springframework.cloud.stream.test.binder.TestSupportBinderAutoConfiguration;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.web.servlet.ResultMatcher;
@SpringApplicationConfiguration(classes = { MgmtApiConfiguration.class })
@ContextConfiguration(classes = { MgmtApiConfiguration.class, RestConfiguration.class,
RepositoryApplicationConfiguration.class, TestConfiguration.class, TestSupportBinderAutoConfiguration.class })
@TestPropertySource(locations = "classpath:/mgmt-test.properties")
public abstract class AbstractManagementApiIntegrationTest extends AbstractRestIntegrationTest {
protected static ResultMatcher applyBaseEntityMatcherOnArrayResult(final BaseEntity entity,
@@ -41,13 +48,13 @@ public abstract class AbstractManagementApiIntegrationTest extends AbstractRestI
protected static ResultMatcher applyTargetEntityMatcherOnArrayResult(final Target entity, final String arrayElement)
throws Exception {
return mvcResult -> {
jsonPath("$." + arrayElement + ".[?(@.controllerId==" + entity.getControllerId() + ")].createdBy",
jsonPath("$." + arrayElement + ".[?(@.controllerId=='" + entity.getControllerId() + "')].createdBy",
contains(entity.getCreatedBy())).match(mvcResult);
jsonPath("$." + arrayElement + ".[?(@.controllerId==" + entity.getControllerId() + ")].createdAt",
jsonPath("$." + arrayElement + ".[?(@.controllerId=='" + entity.getControllerId() + "')].createdAt",
contains(entity.getCreatedAt())).match(mvcResult);
jsonPath("$." + arrayElement + ".[?(@.controllerId==" + entity.getControllerId() + ")].lastModifiedBy",
jsonPath("$." + arrayElement + ".[?(@.controllerId=='" + entity.getControllerId() + "')].lastModifiedBy",
contains(entity.getLastModifiedBy())).match(mvcResult);
jsonPath("$." + arrayElement + ".[?(@.controllerId==" + entity.getControllerId() + ")].lastModifiedAt",
jsonPath("$." + arrayElement + ".[?(@.controllerId=='" + entity.getControllerId() + "')].lastModifiedAt",
contains(entity.getLastModifiedAt())).match(mvcResult);
};
}
@@ -104,13 +111,13 @@ public abstract class AbstractManagementApiIntegrationTest extends AbstractRestI
protected static ResultMatcher applyTargetEntityMatcherOnArrayResult(final Target entity) throws Exception {
return mvcResult -> {
jsonPath("$.[?(@.controllerId==" + entity.getControllerId() + ")].createdBy",
jsonPath("$.[?(@.controllerId=='" + entity.getControllerId() + "')].createdBy",
contains(entity.getCreatedBy())).match(mvcResult);
jsonPath("$.[?(@.controllerId==" + entity.getControllerId() + ")].createdAt",
jsonPath("$.[?(@.controllerId=='" + entity.getControllerId() + "')].createdAt",
contains(entity.getCreatedAt())).match(mvcResult);
jsonPath("$.[?(@.controllerId==" + entity.getControllerId() + ")].lastModifiedBy",
jsonPath("$.[?(@.controllerId=='" + entity.getControllerId() + "')].lastModifiedBy",
contains(entity.getLastModifiedBy())).match(mvcResult);
jsonPath("$.[?(@.controllerId==" + entity.getControllerId() + ")].lastModifiedAt",
jsonPath("$.[?(@.controllerId=='" + entity.getControllerId() + "')].lastModifiedAt",
contains(entity.getLastModifiedAt())).match(mvcResult);
};
}
@@ -119,8 +126,8 @@ public abstract class AbstractManagementApiIntegrationTest extends AbstractRestI
return mvcResult -> {
applyBaseEntityMatcherOnPagedResult(entity);
jsonPath("$.[?(@.id==" + entity.getId() + ")].name", contains(entity.getName())).match(mvcResult);
jsonPath("$.[?(@.id==" + entity.getId() + ")].description", contains(entity.getDescription()))
jsonPath("$.[?(@.id=='" + entity.getId() + "')].name", contains(entity.getName())).match(mvcResult);
jsonPath("$.[?(@.id=='" + entity.getId() + "')].description", contains(entity.getDescription()))
.match(mvcResult);
};
}
@@ -130,7 +137,7 @@ public abstract class AbstractManagementApiIntegrationTest extends AbstractRestI
return mvcResult -> {
applyNamedEntityMatcherOnPagedResult(entity);
jsonPath("$.[?(@.id==" + entity.getId() + ")].version", contains(entity.getVersion())).match(mvcResult);
jsonPath("$.[?(@.id=='" + entity.getId() + "')].version", contains(entity.getVersion())).match(mvcResult);
};
}
@@ -138,14 +145,14 @@ public abstract class AbstractManagementApiIntegrationTest extends AbstractRestI
return mvcResult -> {
applyNamedEntityMatcherOnPagedResult(entity);
jsonPath("$.[?(@.id==" + entity.getId() + ")].colour", contains(entity.getColour())).match(mvcResult);
jsonPath("$.[?(@.id=='" + entity.getId() + "')].colour", contains(entity.getColour())).match(mvcResult);
};
}
protected static ResultMatcher applySelfLinkMatcherOnArrayResult(final BaseEntity entity, final String link)
throws Exception {
return mvcResult -> {
jsonPath("$.[?(@.id==" + entity.getId() + ")]._links.self.href", contains(link)).match(mvcResult);
jsonPath("$.[?(@.id=='" + entity.getId() + "')]._links.self.href", contains(link)).match(mvcResult);
};
}

View File

@@ -39,12 +39,12 @@ import org.eclipse.hawkbit.repository.model.DistributionSetMetadata;
import org.eclipse.hawkbit.repository.model.SoftwareModule;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetWithActionType;
import org.eclipse.hawkbit.repository.test.util.AbstractIntegrationTest;
import org.eclipse.hawkbit.repository.test.util.TestdataFactory;
import org.eclipse.hawkbit.repository.test.util.WithUser;
import org.eclipse.hawkbit.rest.util.JsonBuilder;
import org.eclipse.hawkbit.rest.util.MockMvcResultPrinter;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Test;
import org.springframework.data.domain.PageRequest;
@@ -305,7 +305,13 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
final DistributionSet ds = testdataFactory.createDistributionSet();
final JSONArray payload = new JSONArray();
targets.forEach(trg -> payload.put(new JSONObject().put("id", trg.getId())));
targets.forEach(trg -> {
try {
payload.put(new JSONObject().put("id", trg.getId()));
} catch (final JSONException e) {
e.printStackTrace();
}
});
mvc.perform(post(MgmtRestConstants.DISTRIBUTIONSET_V1_REQUEST_MAPPING + "/" + ds.getId() + "/assignedTargets")
.contentType(MediaType.APPLICATION_JSON).content(payload.toString())).andExpect(status().isForbidden());
@@ -344,7 +350,13 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
final DistributionSet createdDs = testdataFactory.createDistributionSet();
final List<Target> targets = testdataFactory.createTargets(5);
final JSONArray list = new JSONArray();
targets.forEach(target -> list.put(new JSONObject().put("id", target.getControllerId())));
targets.forEach(target -> {
try {
list.put(new JSONObject().put("id", target.getControllerId()));
} catch (final JSONException e) {
e.printStackTrace();
}
});
// assign already one target to DS
assignDistributionSet(createdDs.getId(), targets.get(0).getControllerId());
@@ -373,7 +385,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
for (final String targetId : knownTargetIds) {
testdataFactory.createTarget(targetId);
list.put(new JSONObject().put("id", Long.valueOf(targetId)).put("maintenanceWindow",
AbstractIntegrationTest.getMaintenanceWindow(AbstractIntegrationTest.getTestSchedule(0), "", "")));
new JSONObject().put("schedule", getTestSchedule(0))));
}
// assign already one target to DS
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
@@ -396,7 +408,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
for (final String targetId : knownTargetIds) {
testdataFactory.createTarget(targetId);
list.put(new JSONObject().put("id", Long.valueOf(targetId)).put("maintenanceWindow",
AbstractIntegrationTest.getMaintenanceWindow("", AbstractIntegrationTest.getTestDuration(10), "")));
new JSONObject().put("duration", getTestDuration(10))));
}
// assign already one target to DS
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
@@ -419,8 +431,8 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
for (final String targetId : knownTargetIds) {
testdataFactory.createTarget(targetId);
list.put(new JSONObject().put("id", Long.valueOf(targetId)).put("maintenanceWindow",
AbstractIntegrationTest.getMaintenanceWindow(AbstractIntegrationTest.getTestSchedule(10),
AbstractIntegrationTest.getTestDuration(10), AbstractIntegrationTest.getTestTimeZone())));
new JSONObject().put("schedule", getTestSchedule(10)).put("duration", getTestDuration(10))
.put("timezone", getTestTimeZone())));
}
// assign already one target to DS
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
@@ -443,8 +455,8 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
for (final String targetId : knownTargetIds) {
testdataFactory.createTarget(targetId);
list.put(new JSONObject().put("id", Long.valueOf(targetId)).put("maintenanceWindow",
AbstractIntegrationTest.getMaintenanceWindow(AbstractIntegrationTest.getTestSchedule(-30),
AbstractIntegrationTest.getTestDuration(5), AbstractIntegrationTest.getTestTimeZone())));
new JSONObject().put("schedule", getTestSchedule(-30)).put("duration", getTestDuration(5))
.put("timezone", getTestTimeZone())));
}
// assign already one target to DS
assignDistributionSet(createdDs.getId(), knownTargetIds[0]);
@@ -468,9 +480,8 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
testdataFactory.createTarget(targetId);
if (Integer.parseInt(targetId) % 2 == 0) {
list.put(new JSONObject().put("id", Long.valueOf(targetId)).put("maintenanceWindow",
AbstractIntegrationTest.getMaintenanceWindow(AbstractIntegrationTest.getTestSchedule(10),
AbstractIntegrationTest.getTestDuration(5),
AbstractIntegrationTest.getTestTimeZone())));
new JSONObject().put("schedule", getTestSchedule(10)).put("duration", getTestDuration(5))
.put("timezone", getTestTimeZone())));
} else {
list.put(new JSONObject().put("id", Long.valueOf(targetId)));
}
@@ -690,11 +701,11 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
.andExpect(jsonPath("$.content.[0].lastModifiedBy", equalTo(set.getLastModifiedBy())))
.andExpect(jsonPath("$.content.[0].lastModifiedAt", equalTo(set.getLastModifiedAt())))
.andExpect(jsonPath("$.content.[0].version", equalTo(set.getVersion())))
.andExpect(jsonPath("$.content.[0].modules.[?(@.type==" + runtimeType.getKey() + ")].id",
.andExpect(jsonPath("$.content.[0].modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
contains(set.findFirstModuleByType(runtimeType).get().getId().intValue())))
.andExpect(jsonPath("$.content.[0].modules.[?(@.type==" + appType.getKey() + ")].id",
.andExpect(jsonPath("$.content.[0].modules.[?(@.type=='" + appType.getKey() + "')].id",
contains(set.findFirstModuleByType(appType).get().getId().intValue())))
.andExpect(jsonPath("$.content.[0].modules.[?(@.type==" + osType.getKey() + ")].id",
.andExpect(jsonPath("$.content.[0].modules.[?(@.type=='" + osType.getKey() + "')].id",
contains(getOsModule(set).intValue())));
}
@@ -722,11 +733,11 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
.andExpect(jsonPath("$.lastModifiedBy", equalTo(set.getLastModifiedBy())))
.andExpect(jsonPath("$.lastModifiedAt", equalTo(set.getLastModifiedAt())))
.andExpect(jsonPath("$.version", equalTo(set.getVersion())))
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].id",
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
contains(set.findFirstModuleByType(runtimeType).get().getId().intValue())))
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].id",
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].id",
contains(set.findFirstModuleByType(appType).get().getId().intValue())))
.andExpect(jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].id",
.andExpect(jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].id",
contains(getOsModule(set).intValue())));
}
@@ -808,11 +819,11 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
.andExpect(jsonPath("[0]version", equalTo(one.getVersion())))
.andExpect(jsonPath("[0]complete", equalTo(Boolean.TRUE)))
.andExpect(jsonPath("[0]requiredMigrationStep", equalTo(one.isRequiredMigrationStep())))
.andExpect(jsonPath("[0].modules.[?(@.type==" + runtimeType.getKey() + ")].id",
.andExpect(jsonPath("[0].modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
contains(one.findFirstModuleByType(runtimeType).get().getId().intValue())))
.andExpect(jsonPath("[0].modules.[?(@.type==" + appType.getKey() + ")].id",
.andExpect(jsonPath("[0].modules.[?(@.type=='" + appType.getKey() + "')].id",
contains(one.findFirstModuleByType(appType).get().getId().intValue())))
.andExpect(jsonPath("[0].modules.[?(@.type==" + osType.getKey() + ")].id",
.andExpect(jsonPath("[0].modules.[?(@.type=='" + osType.getKey() + "')].id",
contains(one.findFirstModuleByType(osType).get().getId().intValue())))
.andExpect(jsonPath("[1]name", equalTo(two.getName())))
.andExpect(jsonPath("[1]description", equalTo(two.getDescription())))
@@ -820,11 +831,11 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
.andExpect(jsonPath("[1]type", equalTo(standardDsType.getKey())))
.andExpect(jsonPath("[1]createdBy", equalTo("uploadTester")))
.andExpect(jsonPath("[1]version", equalTo(two.getVersion())))
.andExpect(jsonPath("[1].modules.[?(@.type==" + runtimeType.getKey() + ")].id",
.andExpect(jsonPath("[1].modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
contains(two.findFirstModuleByType(runtimeType).get().getId().intValue())))
.andExpect(jsonPath("[1].modules.[?(@.type==" + appType.getKey() + ")].id",
.andExpect(jsonPath("[1].modules.[?(@.type=='" + appType.getKey() + "')].id",
contains(two.findFirstModuleByType(appType).get().getId().intValue())))
.andExpect(jsonPath("[1].modules.[?(@.type==" + osType.getKey() + ")].id",
.andExpect(jsonPath("[1].modules.[?(@.type=='" + osType.getKey() + "')].id",
contains(two.findFirstModuleByType(osType).get().getId().intValue())))
.andExpect(jsonPath("[1]requiredMigrationStep", equalTo(two.isRequiredMigrationStep())))
.andExpect(jsonPath("[2]name", equalTo(three.getName())))
@@ -833,11 +844,11 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
.andExpect(jsonPath("[2]type", equalTo(standardDsType.getKey())))
.andExpect(jsonPath("[2]createdBy", equalTo("uploadTester")))
.andExpect(jsonPath("[2]version", equalTo(three.getVersion())))
.andExpect(jsonPath("[2].modules.[?(@.type==" + runtimeType.getKey() + ")].id",
.andExpect(jsonPath("[2].modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
contains(three.findFirstModuleByType(runtimeType).get().getId().intValue())))
.andExpect(jsonPath("[2].modules.[?(@.type==" + appType.getKey() + ")].id",
.andExpect(jsonPath("[2].modules.[?(@.type=='" + appType.getKey() + "')].id",
contains(three.findFirstModuleByType(appType).get().getId().intValue())))
.andExpect(jsonPath("[2].modules.[?(@.type==" + osType.getKey() + ")].id",
.andExpect(jsonPath("[2].modules.[?(@.type=='" + osType.getKey() + "')].id",
contains(three.findFirstModuleByType(osType).get().getId().intValue())))
.andExpect(jsonPath("[2]requiredMigrationStep", equalTo(three.isRequiredMigrationStep()))).andReturn();
}
@@ -1045,7 +1056,7 @@ public class MgmtDistributionSetResourceTest extends AbstractManagementApiIntegr
// verify that the number of meta data entries has not changed
// (we cannot use the PAGE constant here as it tries to sort by ID)
assertThat(distributionSetManagement
.findMetaDataByDistributionSetId(new PageRequest(0, Integer.MAX_VALUE), testDS.getId())
.findMetaDataByDistributionSetId(PageRequest.of(0, Integer.MAX_VALUE), testDS.getId())
.getTotalElements()).isEqualTo(metaData1.length());
}

View File

@@ -72,22 +72,22 @@ public class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIn
mvc.perform(get("/rest/v1/distributionsettypes").accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.content.[?(@.key==" + standardDsType.getKey() + ")]$..name",
.andExpect(jsonPath("$.content.[?(@.key=='" + standardDsType.getKey() + "')].name",
contains(standardDsType.getName())))
.andExpect(jsonPath("$.content.[?(@.key==" + standardDsType.getKey() + ")]$..description",
.andExpect(jsonPath("$.content.[?(@.key=='" + standardDsType.getKey() + "')].description",
contains(standardDsType.getDescription())))
.andExpect(jsonPath("$.content.[?(@.key==" + standardDsType.getKey() + ")]$..key",
.andExpect(jsonPath("$.content.[?(@.key=='" + standardDsType.getKey() + "')].key",
contains(standardDsType.getKey())))
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..id", contains(testType.getId().intValue())))
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..name", contains("TestName123")))
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..description", contains("Desc1234")))
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..createdBy", contains("uploadTester")))
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..createdAt", contains(testType.getCreatedAt())))
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..lastModifiedBy", contains("uploadTester")))
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..lastModifiedAt",
.andExpect(jsonPath("$.content.[?(@.key=='test123')].id", contains(testType.getId().intValue())))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].name", contains("TestName123")))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].description", contains("Desc1234")))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].createdBy", contains("uploadTester")))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].createdAt", contains(testType.getCreatedAt())))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].lastModifiedBy", contains("uploadTester")))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].lastModifiedAt",
contains(testType.getLastModifiedAt())))
.andExpect(jsonPath("$.content.[?(@.key==test123)]$..key", contains("test123")))
.andExpect(jsonPath("$.content.[?(@.key==test123)]$.._links.self.href",
.andExpect(jsonPath("$.content.[?(@.key=='test123')].key", contains("test123")))
.andExpect(jsonPath("$.content.[?(@.key=='test123')]._links.self.href",
contains("http://localhost/rest/v1/distributionsettypes/" + testType.getId())))
.andExpect(jsonPath("$.total", equalTo(5)));
}

View File

@@ -625,9 +625,9 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
.successCondition(RolloutGroupSuccessCondition.THRESHOLD, "100").build());
final RolloutGroup firstGroup = rolloutGroupManagement
.findByRollout(new PageRequest(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
.findByRollout(PageRequest.of(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
final RolloutGroup secondGroup = rolloutGroupManagement
.findByRollout(new PageRequest(1, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
.findByRollout(PageRequest.of(1, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
retrieveAndVerifyRolloutGroupInCreating(rollout, firstGroup);
retrieveAndVerifyRolloutGroupInReady(rollout, firstGroup);
@@ -720,7 +720,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
final Rollout rollout = createRollout("rollout1", 2, dsA.getId(), "controllerId==rollout*");
final RolloutGroup firstGroup = rolloutGroupManagement
.findByRollout(new PageRequest(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
.findByRollout(PageRequest.of(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
// retrieve targets from the first rollout group with known ID
mvc.perform(
@@ -743,7 +743,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
final Rollout rollout = createRollout("rollout1", 2, dsA.getId(), "controllerId==rollout*");
final RolloutGroup firstGroup = rolloutGroupManagement
.findByRollout(new PageRequest(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
.findByRollout(PageRequest.of(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
final String targetInGroup = rolloutGroupManagement.findTargetsOfRolloutGroup(PAGE, firstGroup.getId())
.getContent().get(0).getControllerId();
@@ -774,7 +774,7 @@ public class MgmtRolloutResourceTest extends AbstractManagementApiIntegrationTes
rolloutManagement.handleRollouts();
final RolloutGroup firstGroup = rolloutGroupManagement
.findByRollout(new PageRequest(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
.findByRollout(PageRequest.of(0, 1, Direction.ASC, "id"), rollout.getId()).getContent().get(0);
// retrieve targets from the first rollout group with known ID
mvc.perform(

View File

@@ -53,6 +53,7 @@ import org.json.JSONObject;
import org.junit.Before;
import org.junit.Test;
import org.springframework.data.domain.PageRequest;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.TestPropertySource;
@@ -294,10 +295,9 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
final MockMultipartFile file = new MockMultipartFile("file", "origFilename", null, random);
// upload
mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file)
.param("filename", "customFilename").accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
mvc.perform(fileUpload("/rest/v1/softwaremodules/{smId}/artifacts", sm.getId()).file(file).param("filename",
"customFilename")).andDo(MockMvcResultPrinter.print()).andExpect(status().isCreated())
.andExpect(content().contentType(MediaTypes.HAL_JSON_UTF8))
.andExpect(jsonPath("$.providedFilename", equalTo("customFilename"))).andExpect(status().isCreated());
// check result in db...
@@ -979,7 +979,7 @@ public class MgmtSoftwareModuleResourceTest extends AbstractManagementApiIntegra
// verify that the number of meta data entries has not changed
// (we cannot use the PAGE constant here as it tries to sort by ID)
assertThat(softwareModuleManagement
.findMetaDataBySoftwareModuleId(new PageRequest(0, Integer.MAX_VALUE), sm.getId()).getTotalElements())
.findMetaDataBySoftwareModuleId(PageRequest.of(0, Integer.MAX_VALUE), sm.getId()).getTotalElements())
.isEqualTo(metaData1.length());
}

View File

@@ -59,33 +59,34 @@ public class MgmtSoftwareModuleTypeResourceTest extends AbstractManagementApiInt
mvc.perform(get("/rest/v1/softwaremoduletypes").accept(MediaType.APPLICATION_JSON))
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.content.[?(@.key==" + osType.getKey() + ")].name", contains(osType.getName())))
.andExpect(jsonPath("$.content.[?(@.key==" + osType.getKey() + ")].description",
.andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].name", contains(osType.getName())))
.andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].description",
contains(osType.getDescription())))
.andExpect(jsonPath("$.content.[?(@.key==" + osType.getKey() + ")].maxAssignments", contains(1)))
.andExpect(jsonPath("$.content.[?(@.key==" + osType.getKey() + ")].key", contains("os")))
.andExpect(jsonPath("$.content.[?(@.key==" + runtimeType.getKey() + ")].name",
.andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].maxAssignments", contains(1)))
.andExpect(jsonPath("$.content.[?(@.key=='" + osType.getKey() + "')].key", contains("os")))
.andExpect(jsonPath("$.content.[?(@.key=='" + runtimeType.getKey() + "')].name",
contains(runtimeType.getName())))
.andExpect(jsonPath("$.content.[?(@.key==" + runtimeType.getKey() + ")].description",
.andExpect(jsonPath("$.content.[?(@.key=='" + runtimeType.getKey() + "')].description",
contains(runtimeType.getDescription())))
.andExpect(jsonPath("$.content.[?(@.key==" + runtimeType.getKey() + ")].maxAssignments", contains(1)))
.andExpect(jsonPath("$.content.[?(@.key==" + runtimeType.getKey() + ")].key", contains("runtime")))
.andExpect(jsonPath("$.content.[?(@.key==" + appType.getKey() + ")].name", contains(appType.getName())))
.andExpect(jsonPath("$.content.[?(@.key==" + appType.getKey() + ")].description",
.andExpect(jsonPath("$.content.[?(@.key=='" + runtimeType.getKey() + "')].maxAssignments", contains(1)))
.andExpect(jsonPath("$.content.[?(@.key=='" + runtimeType.getKey() + "')].key", contains("runtime")))
.andExpect(
jsonPath("$.content.[?(@.key=='" + appType.getKey() + "')].name", contains(appType.getName())))
.andExpect(jsonPath("$.content.[?(@.key=='" + appType.getKey() + "')].description",
contains(appType.getDescription())))
.andExpect(jsonPath("$.content.[?(@.key==" + appType.getKey() + ")].maxAssignments",
.andExpect(jsonPath("$.content.[?(@.key=='" + appType.getKey() + "')].maxAssignments",
contains(Integer.MAX_VALUE)))
.andExpect(jsonPath("$.content.[?(@.key==" + appType.getKey() + ")].key", contains("application")))
.andExpect(jsonPath("$.content.[?(@.key==test123)].id", contains(testType.getId().intValue())))
.andExpect(jsonPath("$.content.[?(@.key==test123)].name", contains("TestName123")))
.andExpect(jsonPath("$.content.[?(@.key==test123)].description", contains("Desc1234")))
.andExpect(jsonPath("$.content.[?(@.key==test123)].createdBy", contains("uploadTester")))
.andExpect(jsonPath("$.content.[?(@.key==test123)].createdAt", contains(testType.getCreatedAt())))
.andExpect(jsonPath("$.content.[?(@.key==test123)].lastModifiedBy", contains("uploadTester")))
.andExpect(jsonPath("$.content.[?(@.key==test123)].lastModifiedAt",
.andExpect(jsonPath("$.content.[?(@.key=='" + appType.getKey() + "')].key", contains("application")))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].id", contains(testType.getId().intValue())))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].name", contains("TestName123")))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].description", contains("Desc1234")))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].createdBy", contains("uploadTester")))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].createdAt", contains(testType.getCreatedAt())))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].lastModifiedBy", contains("uploadTester")))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].lastModifiedAt",
contains(testType.getLastModifiedAt())))
.andExpect(jsonPath("$.content.[?(@.key==test123)].maxAssignments", contains(5)))
.andExpect(jsonPath("$.content.[?(@.key==test123)].key", contains("test123")))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].maxAssignments", contains(5)))
.andExpect(jsonPath("$.content.[?(@.key=='test123')].key", contains("test123")))
.andExpect(jsonPath("$.total", equalTo(4)));
}

View File

@@ -164,14 +164,14 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(knownTargetAmount)))
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(knownTargetAmount)))
// idA
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].name", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].query", contains(testQuery)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].name", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].query", contains(testQuery)))
// idB
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].name", contains(idB)))
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].query", contains(testQuery)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].name", contains(idB)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].query", contains(testQuery)))
// idC
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].name", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].query", contains(testQuery)));
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].name", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].query", contains(testQuery)));
}
@Test
@@ -195,8 +195,8 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(limitSize)))
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(limitSize)))
// idA
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].name", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].query", contains(testQuery)));
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].name", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].query", contains(testQuery)));
}
@Test
@@ -224,14 +224,14 @@ public class MgmtTargetFilterQueryResourceTest extends AbstractManagementApiInte
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(expectedSize)))
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(expectedSize)))
// idA
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].name", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].query", contains(testQuery)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].name", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].query", contains(testQuery)))
// idB
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].name", contains(idD)))
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].query", contains(testQuery)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].name", contains(idD)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].query", contains(testQuery)))
// idC
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].name", contains(idE)))
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].query", contains(testQuery)));
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].name", contains(idE)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].query", contains(testQuery)));
}
@Test

View File

@@ -119,7 +119,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
controllerManagement.addUpdateActionStatus(
entityFactory.actionStatus().create(actions.get(0).getId()).status(Status.FINISHED).message("test"));
final PageRequest pageRequest = new PageRequest(0, 1000, Direction.ASC, ActionFields.ID.getFieldName());
final PageRequest pageRequest = PageRequest.of(0, 1000, Direction.ASC, ActionFields.ID.getFieldName());
final Action action = deploymentManagement.findActionsByTarget(knownTargetId, pageRequest).getContent().get(0);
final ActionStatus status = deploymentManagement.findActionStatusByAction(PAGE, action.getId()).getContent()
@@ -179,13 +179,13 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
mvc.perform(get(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING)).andDo(MockMvcResultPrinter.print())
.andExpect(status().isOk()).andExpect(jsonPath("total", equalTo(2)))
.andExpect(jsonPath("size", equalTo(2)))
.andExpect(jsonPath("$.content.[?(@.controllerId==" + knownControllerId1 + ")].ipAddress",
.andExpect(jsonPath("$.content.[?(@.controllerId=='" + knownControllerId1 + "')].ipAddress",
contains("127.0.0.1")))
.andExpect(jsonPath("$.content.[?(@.controllerId==" + knownControllerId2 + ")].ipAddress",
.andExpect(jsonPath("$.content.[?(@.controllerId=='" + knownControllerId2 + "')].ipAddress",
contains("127.0.0.1")))
.andExpect(jsonPath("$.content.[?(@.controllerId==" + knownControllerId1 + ")].address",
.andExpect(jsonPath("$.content.[?(@.controllerId=='" + knownControllerId1 + "')].address",
contains(IpUtil.createHttpUri("127.0.0.1").toString())))
.andExpect(jsonPath("$.content.[?(@.controllerId==" + knownControllerId2 + ")].address",
.andExpect(jsonPath("$.content.[?(@.controllerId=='" + knownControllerId2 + "')].address",
contains(IpUtil.createHttpUri("127.0.0.1").toString())));
}
@@ -443,32 +443,32 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(knownTargetAmount)))
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(knownTargetAmount)))
// idA
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")]._links.self.href",
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')]._links.self.href",
contains(linksHrefPrefix + idA)))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].name", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].description", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].controllerId", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].updateStatus", contains("registered")))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].lastControllerRequestAt", notNullValue()))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].name", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].description", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].controllerId", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].updateStatus", contains("registered")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].lastControllerRequestAt", notNullValue()))
// idB
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")]._links.self.href",
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')]._links.self.href",
contains(linksHrefPrefix + idB)))
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].name", contains(idB)))
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].description", contains(idB)))
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].controllerId", contains(idB)))
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name==" + idB + ")].updateStatus", contains("registered")))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].lastControllerRequestAt", notNullValue()))
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].name", contains(idB)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].description", contains(idB)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].controllerId", contains(idB)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idB + "')].updateStatus", contains("registered")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].lastControllerRequestAt", notNullValue()))
// idC
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")]._links.self.href",
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')]._links.self.href",
contains(linksHrefPrefix + idC)))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].name", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].description", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].controllerId", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].updateStatus", contains("registered")))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].lastControllerRequestAt", notNullValue()));
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].name", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].description", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].controllerId", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].updateStatus", contains("registered")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].lastControllerRequestAt", notNullValue()));
}
@Test
@@ -487,13 +487,13 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(limitSize)))
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(limitSize)))
// idA
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")]._links.self.href",
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')]._links.self.href",
contains(linksHrefPrefix + idA)))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].name", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].description", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].controllerId", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name==" + idA + ")].updateStatus", contains("registered")));
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].name", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].description", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].controllerId", contains(idA)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idA + "')].updateStatus", contains("registered")));
}
@Test
@@ -516,29 +516,29 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_SIZE, equalTo(expectedSize)))
.andExpect(jsonPath(JSON_PATH_PAGED_LIST_CONTENT, hasSize(expectedSize)))
// idA
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")]._links.self.href",
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')]._links.self.href",
contains(linksHrefPrefix + idC)))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].name", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].description", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].controllerId", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name==" + idC + ")].updateStatus", contains("registered")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].name", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].description", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].controllerId", contains(idC)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idC + "')].updateStatus", contains("registered")))
// idB
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")]._links.self.href",
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')]._links.self.href",
contains(linksHrefPrefix + idD)))
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].name", contains(idD)))
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].description", contains(idD)))
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].controllerId", contains(idD)))
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name==" + idD + ")].updateStatus", contains("registered")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].name", contains(idD)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].description", contains(idD)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].controllerId", contains(idD)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idD + "')].updateStatus", contains("registered")))
// idC
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")]._links.self.href",
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')]._links.self.href",
contains(linksHrefPrefix + idE)))
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].name", contains(idE)))
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].description", contains(idE)))
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].controllerId", contains(idE)))
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name==" + idE + ")].updateStatus", contains("registered")));
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].name", contains(idE)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].description", contains(idE)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].controllerId", contains(idE)))
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].createdBy", contains("bumlux")))
.andExpect(jsonPath("$.content.[?(@.name=='" + idE + "')].updateStatus", contains("registered")));
}
@Test
@@ -617,38 +617,39 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
.andExpect(jsonPath(JSON_PATH_NAME, equalTo(ds.getName())))
.andExpect(jsonPath(JSON_PATH_DESCRIPTION, equalTo(ds.getDescription())))
// os
.andExpect(
jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].id", contains(os.getId().intValue())))
.andExpect(jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].name", contains(os.getName())))
.andExpect(jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].description",
.andExpect(jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].id",
contains(os.getId().intValue())))
.andExpect(jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].name", contains(os.getName())))
.andExpect(jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].description",
contains(os.getDescription())))
.andExpect(
jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].version", contains(os.getVersion())))
.andExpect(jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].vendor", contains(os.getVendor())))
.andExpect(jsonPath("$.modules.[?(@.type==" + osType.getKey() + ")].type", contains("os")))
jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].version", contains(os.getVersion())))
.andExpect(
jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].vendor", contains(os.getVendor())))
.andExpect(jsonPath("$.modules.[?(@.type=='" + osType.getKey() + "')].type", contains("os")))
// jvm
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].id",
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].id",
contains(jvm.getId().intValue())))
.andExpect(
jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].name", contains(jvm.getName())))
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].description",
jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].name", contains(jvm.getName())))
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].description",
contains(jvm.getDescription())))
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].version",
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].version",
contains(jvm.getVersion())))
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].vendor",
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].vendor",
contains(jvm.getVendor())))
.andExpect(jsonPath("$.modules.[?(@.type==" + runtimeType.getKey() + ")].type", contains("runtime")))
.andExpect(jsonPath("$.modules.[?(@.type=='" + runtimeType.getKey() + "')].type", contains("runtime")))
// baseApp
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].id",
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].id",
contains(bApp.getId().intValue())))
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].name", contains(bApp.getName())))
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].description",
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].name", contains(bApp.getName())))
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].description",
contains(bApp.getDescription())))
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].version",
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].version",
contains(bApp.getVersion())))
.andExpect(
jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].vendor", contains(bApp.getVendor())))
.andExpect(jsonPath("$.modules.[?(@.type==" + appType.getKey() + ")].type", contains("application")));
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].vendor",
contains(bApp.getVendor())))
.andExpect(jsonPath("$.modules.[?(@.type=='" + appType.getKey() + "')].type", contains("application")));
}
@@ -808,7 +809,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
.contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
.andExpect(status().is2xxSuccessful());
final Slice<Target> findTargetsAll = targetManagement.findAll(new PageRequest(0, 100));
final Slice<Target> findTargetsAll = targetManagement.findAll(PageRequest.of(0, 100));
final Target target = findTargetsAll.getContent().get(0);
assertThat(targetManagement.count()).isEqualTo(1);
assertThat(target.getControllerId()).isEqualTo(knownControllerId);
@@ -1348,7 +1349,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
final DistributionSet set = testdataFactory.createDistributionSet("one");
final String body = new JSONObject().put("id", set.getId()).put("type", "forced")
.put("maintenanceWindow", getMaintenanceWindow(getTestSchedule(0), "", "")).toString();
.put("maintenanceWindow", new JSONObject().put("schedule", getTestSchedule(0))).toString();
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
.content(body).contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())
@@ -1363,7 +1364,7 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
final DistributionSet set = testdataFactory.createDistributionSet("one");
final String body = new JSONObject().put("id", set.getId()).put("type", "forced")
.put("maintenanceWindow", getMaintenanceWindow("", getTestDuration(10), "")).toString();
.put("maintenanceWindow", new JSONObject().put("duration", getTestDuration(10))).toString();
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
.content(body).contentType(MediaTypes.HAL_JSON_VALUE)).andDo(MockMvcResultPrinter.print())
@@ -1378,8 +1379,8 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
final DistributionSet set = testdataFactory.createDistributionSet("one");
final String body = new JSONObject().put("id", set.getId()).put("type", "forced").put("forcetime", "0")
.put("maintenanceWindow",
getMaintenanceWindow(getTestSchedule(10), getTestDuration(10), getTestTimeZone()))
.put("maintenanceWindow", new JSONObject().put("schedule", getTestSchedule(10))
.put("duration", getTestDuration(10)).put("timezone", getTestTimeZone()))
.toString();
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
@@ -1395,9 +1396,9 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
final DistributionSet set = testdataFactory.createDistributionSet("one");
final long nextExecutionStart = System.currentTimeMillis();
final String body = new JSONObject().put("id", set.getId())
.put("maintenanceWindow", getMaintenanceWindowWithNextStart(getTestSchedule(10), getTestDuration(10),
getTestTimeZone(), nextExecutionStart))
final String body = new JSONObject().put("id", set.getId()).put("maintenanceWindow",
new JSONObject().put("schedule", getTestSchedule(10)).put("duration", getTestDuration(10))
.put("timezone", getTestTimeZone()).put("nextStartAt", String.valueOf(nextExecutionStart)))
.toString();
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
@@ -1416,8 +1417,10 @@ public class MgmtTargetResourceTest extends AbstractManagementApiIntegrationTest
final Target target = testdataFactory.createTarget("fsdfsd");
final DistributionSet set = testdataFactory.createDistributionSet("one");
final String body = new JSONObject().put("id", set.getId()).put("type", "forced").put("maintenanceWindow",
getMaintenanceWindow(getTestSchedule(-30), getTestDuration(5), getTestTimeZone())).toString();
final String body = new JSONObject().put("id", set.getId()).put("type", "forced")
.put("maintenanceWindow", new JSONObject().put("schedule", getTestSchedule(-30))
.put("duration", getTestDuration(5)).put("timezone", getTestTimeZone()))
.toString();
mvc.perform(post(MgmtRestConstants.TARGET_V1_REQUEST_MAPPING + "/" + target.getControllerId() + "/assignedDS")
.content(body).contentType(MediaType.APPLICATION_JSON)).andDo(MockMvcResultPrinter.print())

View File

@@ -0,0 +1,12 @@
#
# Copyright (c) 2018 Microsoft 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
#
# Logging START - activate to see request/response details
#logging.level.org.eclipse.hawkbit.rest.util.MockMvcResultPrinter=DEBUG
# Logging END