Added tests for software management
- while at it I renamed also a few methods to fit into the overall pattern
This commit is contained in:
@@ -226,7 +226,7 @@ public class SoftwareModuleResource implements SoftwareModuleRestAPI {
|
||||
// check if distribution set exists otherwise throw exception
|
||||
// immediately
|
||||
final SoftwareModule sw = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null);
|
||||
final SoftwareModuleMetadata findOne = softwareManagement.findOne(new SwMetadataCompositeKey(sw, metadataKey));
|
||||
final SoftwareModuleMetadata findOne = softwareManagement.findSoftwareModuleMetadata(new SwMetadataCompositeKey(sw, metadataKey));
|
||||
return ResponseEntity.<MetadataRest> ok(SoftwareModuleMapper.toResponseSwMetadata(findOne));
|
||||
}
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ public class SoftwareModuleTypeResource implements SoftwareModuleTypeRestApi {
|
||||
final List<SoftwareModuleTypeRequestBodyPost> softwareModuleTypes) {
|
||||
|
||||
final List<SoftwareModuleType> createdSoftwareModules = this.softwareManagement
|
||||
.createSoftwareModuleTypes(SoftwareModuleTypeMapper.smFromRequest(softwareModuleTypes));
|
||||
.createSoftwareModuleType(SoftwareModuleTypeMapper.smFromRequest(softwareModuleTypes));
|
||||
|
||||
return new ResponseEntity<>(SoftwareModuleTypeMapper.toTypesResponse(createdSoftwareModules),
|
||||
HttpStatus.CREATED);
|
||||
|
||||
@@ -930,8 +930,8 @@ public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongo
|
||||
.andExpect(jsonPath("[1]key", equalTo(knownKey2)))
|
||||
.andExpect(jsonPath("[1]value", equalTo(knownValue2)));
|
||||
|
||||
final SoftwareModuleMetadata metaKey1 = softwareManagement.findOne(new SwMetadataCompositeKey(sm, knownKey1));
|
||||
final SoftwareModuleMetadata metaKey2 = softwareManagement.findOne(new SwMetadataCompositeKey(sm, knownKey2));
|
||||
final SoftwareModuleMetadata metaKey1 = softwareManagement.findSoftwareModuleMetadata(new SwMetadataCompositeKey(sm, knownKey1));
|
||||
final SoftwareModuleMetadata metaKey2 = softwareManagement.findSoftwareModuleMetadata(new SwMetadataCompositeKey(sm, knownKey2));
|
||||
|
||||
assertThat(metaKey1.getValue()).as("Metadata key is wrong").isEqualTo(knownValue1);
|
||||
assertThat(metaKey2.getValue()).as("Metadata key is wrong").isEqualTo(knownValue2);
|
||||
@@ -957,7 +957,7 @@ public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongo
|
||||
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
|
||||
.andExpect(jsonPath("key", equalTo(knownKey))).andExpect(jsonPath("value", equalTo(updateValue)));
|
||||
|
||||
final SoftwareModuleMetadata assertDS = softwareManagement.findOne(new SwMetadataCompositeKey(sm, knownKey));
|
||||
final SoftwareModuleMetadata assertDS = softwareManagement.findSoftwareModuleMetadata(new SwMetadataCompositeKey(sm, knownKey));
|
||||
assertThat(assertDS.getValue()).as("Metadata is wrong").isEqualTo(updateValue);
|
||||
}
|
||||
|
||||
@@ -976,7 +976,7 @@ public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongo
|
||||
.andDo(MockMvcResultPrinter.print()).andExpect(status().isOk());
|
||||
|
||||
try {
|
||||
softwareManagement.findOne(new SwMetadataCompositeKey(sm, knownKey));
|
||||
softwareManagement.findSoftwareModuleMetadata(new SwMetadataCompositeKey(sm, knownKey));
|
||||
fail("expected EntityNotFoundException but didn't throw");
|
||||
} catch (final EntityNotFoundException e) {
|
||||
// ok as expected
|
||||
|
||||
Reference in New Issue
Block a user