Hibernate versioning made to start from 1 to be EclipseLink compatible (#2156)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -15,7 +15,6 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.eclipse.hawkbit.mgmt.json.model.distributionset.MgmtActionType;
|
||||
import org.eclipse.hawkbit.repository.jpa.Jpa;
|
||||
import org.eclipse.hawkbit.repository.jpa.RepositoryApplicationConfiguration;
|
||||
import org.eclipse.hawkbit.repository.jpa.model.JpaDistributionSet;
|
||||
import org.eclipse.hawkbit.repository.model.BaseEntity;
|
||||
@@ -205,12 +204,4 @@ public abstract class AbstractManagementApiIntegrationTest extends AbstractRestI
|
||||
((JpaDistributionSet) set).lock();
|
||||
}
|
||||
}
|
||||
|
||||
// version is 1, 2 ... based
|
||||
protected int version(final int version) {
|
||||
return switch (Jpa.JPA_VENDOR) {
|
||||
case ECLIPSELINK -> version;
|
||||
case HIBERNATE -> version - 1;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -214,7 +214,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
|
||||
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
|
||||
.create().key("testType").name("testType").description("testType").colour("col12"));
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(version(1));
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(1);
|
||||
|
||||
for (int i = 0; i < moduleTypeIds.size() - 1; ++i) {
|
||||
mvc.perform(post("/rest/v1/distributionsettypes/{dstID}/optionalmoduletypes", testType.getId())
|
||||
@@ -235,7 +235,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
|
||||
final DistributionSetType testType2 = distributionSetTypeManagement.create(entityFactory.distributionSetType()
|
||||
.create().key("testType2").name("testType2").description("testType2").colour("col12"));
|
||||
assertThat(testType2.getOptLockRevision()).isEqualTo(version(1));
|
||||
assertThat(testType2.getOptLockRevision()).isEqualTo(1);
|
||||
|
||||
for (int i = 0; i < moduleTypeIds.size() - 1; ++i) {
|
||||
mvc.perform(post("/rest/v1/distributionsettypes/{dstID}/mandatorymoduletypes", testType2.getId())
|
||||
@@ -741,7 +741,7 @@ class MgmtDistributionSetTypeResourceTest extends AbstractManagementApiIntegrati
|
||||
final DistributionSetType testType = distributionSetTypeManagement.create(entityFactory.distributionSetType()
|
||||
.create().key("test123").name("TestName123").description("Desc123").colour("col")
|
||||
.mandatory(Collections.singletonList(osType.getId())).optional(Collections.singletonList(appType.getId())));
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(version(1));
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(1);
|
||||
assertThat(testType.getOptionalModuleTypes()).containsExactly(appType);
|
||||
assertThat(testType.getMandatoryModuleTypes()).containsExactly(osType);
|
||||
return testType;
|
||||
|
||||
@@ -321,7 +321,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
void addDistributionSetTypeToTargetType() throws Exception {
|
||||
String typeName = "TestTypeAddDs";
|
||||
TargetType testType = createTestTargetTypeInDB(typeName);
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(version(1));
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(1);
|
||||
|
||||
mvc.perform(post(TARGETTYPE_DSTYPES_ENDPOINT, testType.getId())
|
||||
.content("[{\"id\":" + standardDsType.getId() + "}]").contentType(MediaType.APPLICATION_JSON))
|
||||
@@ -330,7 +330,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
testType = targetTypeManagement.get(testType.getId()).get();
|
||||
assertThat(testType.getLastModifiedBy()).isEqualTo(TEST_USER);
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(version(2));
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(2);
|
||||
assertThat(testType.getCompatibleDistributionSetTypes()).containsExactly(standardDsType);
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
testType = targetTypeManagement.get(testType.getId()).get();
|
||||
assertThat(testType.getLastModifiedBy()).isEqualTo(TEST_USER);
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(version(2));
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(2);
|
||||
assertThat(testType.getCompatibleDistributionSetTypes()).isEmpty();
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
|
||||
testType = targetTypeManagement.get(testType.getId()).get();
|
||||
assertThat(testType.getLastModifiedBy()).isEqualTo(TEST_USER);
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(version(2));
|
||||
assertThat(testType.getOptLockRevision()).isEqualTo(2);
|
||||
assertThat(testType.getCompatibleDistributionSetTypes()).isEmpty();
|
||||
assertThat(distributionSetTypeManagement.getByKey(standardDsType.getKey())).isEmpty();
|
||||
}
|
||||
@@ -641,7 +641,7 @@ class MgmtTargetTypeResourceTest extends AbstractManagementApiIntegrationTest {
|
||||
@Step
|
||||
private TargetType createTestTargetTypeInDB(String name, List<DistributionSetType> dsTypes) {
|
||||
TargetType targetType = testdataFactory.createTargetType(name, dsTypes);
|
||||
assertThat(targetType.getOptLockRevision()).isEqualTo(version(1));
|
||||
assertThat(targetType.getOptLockRevision()).isEqualTo(1);
|
||||
return targetType;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user