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