Extended tests for tag toggle and fixed a typo on the assigment result

classes.

Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-03-27 10:39:29 +02:00
parent c9566e61ce
commit 8a26ded4c4
22 changed files with 232 additions and 183 deletions

View File

@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.repository.TagManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.DistributionSet;
import org.eclipse.hawkbit.repository.model.DistributionSetTag;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssigmentResult;
import org.eclipse.hawkbit.repository.model.DistributionSetTagAssignmentResult;
import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
import org.eclipse.hawkbit.rest.resource.api.DistributionSetTagRestApi;
import org.eclipse.hawkbit.rest.resource.model.distributionset.DistributionSetRest;
@@ -135,7 +135,7 @@ public class DistributionSetTagResource implements DistributionSetTagRestApi {
final DistributionSetTag tag = findDistributionTagById(distributionsetTagId);
final DistributionSetTagAssigmentResult assigmentResult = this.distributionSetManagement
final DistributionSetTagAssignmentResult assigmentResult = this.distributionSetManagement
.toggleTagAssignment(findDistributionSetIds(assignedDSRequestBodies), tag.getName());
final DistributionSetTagAssigmentResultRest tagAssigmentResultRest = new DistributionSetTagAssigmentResultRest();

View File

@@ -17,7 +17,7 @@ import org.eclipse.hawkbit.repository.TargetManagement;
import org.eclipse.hawkbit.repository.exception.EntityNotFoundException;
import org.eclipse.hawkbit.repository.model.Target;
import org.eclipse.hawkbit.repository.model.TargetTag;
import org.eclipse.hawkbit.repository.model.TargetTagAssigmentResult;
import org.eclipse.hawkbit.repository.model.TargetTagAssignmentResult;
import org.eclipse.hawkbit.repository.rsql.RSQLUtility;
import org.eclipse.hawkbit.rest.resource.api.TargetTagRestApi;
import org.eclipse.hawkbit.rest.resource.model.tag.AssignedTargetRequestBody;
@@ -130,7 +130,7 @@ public class TargetTagResource implements TargetTagRestApi {
LOG.debug("Toggle Target assignment {} for target tag {}", assignedTargetRequestBodies.size(), targetTagId);
final TargetTag targetTag = findTargetTagById(targetTagId);
final TargetTagAssigmentResult assigmentResult = this.targetManagement
final TargetTagAssignmentResult assigmentResult = this.targetManagement
.toggleTagAssignment(findTargetControllerIds(assignedTargetRequestBodies), targetTag.getName());
final TargetTagAssigmentResultRest tagAssigmentResultRest = new TargetTagAssigmentResultRest();

View File

@@ -169,7 +169,7 @@ public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongo
artifactManagement
.loadLocalArtifactBinary((LocalArtifact) softwareManagement
.findSoftwareModuleWithDetails(sm.getId()).getArtifacts().get(0))
.getFileInputStream()));
.getFileInputStream()));
// hashes
assertThat(artifactManagement.findLocalArtifactByFilename("origFilename").get(0).getSha1Hash())
@@ -773,12 +773,12 @@ public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongo
.andExpect(jsonPath("[2].createdBy", equalTo("uploadTester")))
.andExpect(jsonPath("[2].createdAt", not(equalTo(0)))).andReturn();
final SoftwareModule osCreated = softwareManagement.findSoftwareModuleByNameAndVersion("name1", "version1")
.get(0);
final SoftwareModule jvmCreated = softwareManagement.findSoftwareModuleByNameAndVersion("name2", "version1")
.get(0);
final SoftwareModule ahCreated = softwareManagement.findSoftwareModuleByNameAndVersion("name3", "version1")
.get(0);
final SoftwareModule osCreated = softwareManagement.findSoftwareModuleByNameAndVersion("name1", "version1",
osType);
final SoftwareModule jvmCreated = softwareManagement.findSoftwareModuleByNameAndVersion("name2", "version1",
runtimeType);
final SoftwareModule ahCreated = softwareManagement.findSoftwareModuleByNameAndVersion("name3", "version1",
appType);
assertThat(
JsonPath.compile("[0]_links.self.href").read(mvcResult.getResponse().getContentAsString()).toString())
@@ -930,8 +930,10 @@ public class SoftwareModuleResourceTest extends AbstractIntegrationTestWithMongo
.andExpect(jsonPath("[1]key", equalTo(knownKey2)))
.andExpect(jsonPath("[1]value", equalTo(knownValue2)));
final SoftwareModuleMetadata metaKey1 = softwareManagement.findSoftwareModuleMetadata(new SwMetadataCompositeKey(sm, knownKey1));
final SoftwareModuleMetadata metaKey2 = softwareManagement.findSoftwareModuleMetadata(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 +959,8 @@ 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.findSoftwareModuleMetadata(new SwMetadataCompositeKey(sm, knownKey));
final SoftwareModuleMetadata assertDS = softwareManagement
.findSoftwareModuleMetadata(new SwMetadataCompositeKey(sm, knownKey));
assertThat(assertDS.getValue()).as("Metadata is wrong").isEqualTo(updateValue);
}