Fixed broken usage of metadata addition. Fixed equals of two elements.
This commit is contained in:
@@ -139,6 +139,9 @@ public class DistributionSet extends NamedVersionedEntity {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return immutable list of meta data elements.
|
||||
*/
|
||||
public List<DistributionSetMetadata> getMetadata() {
|
||||
return Collections.unmodifiableList(metadata);
|
||||
}
|
||||
|
||||
@@ -220,6 +220,9 @@ public class SoftwareModule extends NamedVersionedEntity {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return immutable list of meta data elements.
|
||||
*/
|
||||
public List<SoftwareModuleMetadata> getMetadata() {
|
||||
return Collections.unmodifiableList(metadata);
|
||||
}
|
||||
|
||||
@@ -102,9 +102,8 @@ public class SoftwareModuleMetadata implements Serializable {
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (key == null ? 0 : key.hashCode());
|
||||
result = prime * result + (softwareModule == null ? 0 : softwareModule.hashCode());
|
||||
result = prime * result + (value == null ? 0 : value.hashCode());
|
||||
result = prime * result + ((key == null) ? 0 : key.hashCode());
|
||||
result = prime * result + ((softwareModule == null) ? 0 : softwareModule.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -116,7 +115,7 @@ public class SoftwareModuleMetadata implements Serializable {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
if (!(obj instanceof SoftwareModuleMetadata)) {
|
||||
return false;
|
||||
}
|
||||
final SoftwareModuleMetadata other = (SoftwareModuleMetadata) obj;
|
||||
@@ -134,13 +133,6 @@ public class SoftwareModuleMetadata implements Serializable {
|
||||
} else if (!softwareModule.equals(other.softwareModule)) {
|
||||
return false;
|
||||
}
|
||||
if (value == null) {
|
||||
if (other.value != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!value.equals(other.value)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -320,7 +320,8 @@ public class TargetInfo implements Persistable<Long>, Serializable {
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (target == null ? 0 : target.hashCode());
|
||||
result = prime * result + ((target == null) ? 0 : target.hashCode());
|
||||
result = prime * result + ((targetId == null) ? 0 : targetId.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -343,7 +344,13 @@ public class TargetInfo implements Persistable<Long>, Serializable {
|
||||
} else if (!target.equals(other.target)) {
|
||||
return false;
|
||||
}
|
||||
if (targetId == null) {
|
||||
if (other.targetId != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!targetId.equals(other.targetId)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ package org.eclipse.hawkbit.repository.rsql;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
||||
import org.eclipse.hawkbit.TestDataUtil;
|
||||
import org.eclipse.hawkbit.repository.DistributionSetMetadataFields;
|
||||
@@ -35,13 +38,13 @@ public class RSQLDistributionSetMetadataFieldsTest extends AbstractIntegrationTe
|
||||
final DistributionSet distributionSet = TestDataUtil.generateDistributionSet("DS", softwareManagement,
|
||||
distributionSetManagement);
|
||||
distributionSetId = distributionSet.getId();
|
||||
|
||||
final List<DistributionSetMetadata> metadata = new ArrayList<>();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
final DistributionSetMetadata distributionSetMetadata = new DistributionSetMetadata("" + i, distributionSet,
|
||||
"" + i);
|
||||
distributionSet.getMetadata().add(distributionSetMetadata);
|
||||
metadata.add(new DistributionSetMetadata("" + i, distributionSet, "" + i));
|
||||
}
|
||||
|
||||
distributionSetManagement.updateDistributionSet(distributionSet);
|
||||
distributionSetManagement.createDistributionSetMetadata(metadata);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -28,8 +28,7 @@ import ru.yandex.qatools.allure.annotations.Stories;
|
||||
public class RSQLSoftwareModuleFieldTest extends AbstractIntegrationTest {
|
||||
|
||||
@Before
|
||||
public void seuptBeforeTest() {
|
||||
|
||||
public void setupBeforeTest() {
|
||||
final SoftwareModule ah = softwareManagement
|
||||
.createSoftwareModule(new SoftwareModule(appType, "agent-hub", "1.0.1", "agent-hub", ""));
|
||||
softwareManagement.createSoftwareModule(new SoftwareModule(runtimeType, "oracle-jre", "1.7.2", "aa", ""));
|
||||
@@ -40,14 +39,9 @@ public class RSQLSoftwareModuleFieldTest extends AbstractIntegrationTest {
|
||||
|
||||
final SoftwareModuleMetadata softwareModuleMetadata = new SoftwareModuleMetadata("metaKey", ah, "metaValue");
|
||||
softwareManagement.createSoftwareModuleMetadata(softwareModuleMetadata);
|
||||
ah.getMetadata().add(softwareModuleMetadata);
|
||||
softwareManagement.updateSoftwareModule(ah);
|
||||
|
||||
final SoftwareModuleMetadata softwareModuleMetadata2 = new SoftwareModuleMetadata("metaKey", ah2, "value");
|
||||
softwareManagement.createSoftwareModuleMetadata(softwareModuleMetadata2);
|
||||
ah2.getMetadata().add(softwareModuleMetadata2);
|
||||
softwareManagement.updateSoftwareModule(ah2);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -10,6 +10,9 @@ package org.eclipse.hawkbit.repository.rsql;
|
||||
|
||||
import static org.fest.assertions.api.Assertions.assertThat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.hawkbit.AbstractIntegrationTest;
|
||||
import org.eclipse.hawkbit.TestDataUtil;
|
||||
import org.eclipse.hawkbit.repository.SoftwareModuleMetadataFields;
|
||||
@@ -37,13 +40,13 @@ public class RSQLSoftwareModuleMetadataFieldsTest extends AbstractIntegrationTes
|
||||
"application", "1.0.0", "Desc", "vendor Limited, California"));
|
||||
softwareModuleId = softwareModule.getId();
|
||||
|
||||
final List<SoftwareModuleMetadata> metadata = new ArrayList<>();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
final SoftwareModuleMetadata metadata = new SoftwareModuleMetadata("" + i, softwareModule, "" + i);
|
||||
softwareModule.getMetadata().add(metadata);
|
||||
softwareModuleMetadataRepository.save(metadata);
|
||||
metadata.add(new SoftwareModuleMetadata("" + i, softwareModule, "" + i));
|
||||
}
|
||||
|
||||
softwareManagement.updateSoftwareModule(softwareModule);
|
||||
softwareManagement.createSoftwareModuleMetadata(metadata);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user