You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2019/05/13 13:50:36 UTC
[airavata] branch develop updated: AIRAVATA-3038 Don't allow
updating creationTime
This is an automated email from the ASF dual-hosted git repository.
machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/develop by this push:
new 7e1d84c AIRAVATA-3038 Don't allow updating creationTime
7e1d84c is described below
commit 7e1d84cf4271321fa7a5c8cfe8e7778398e21054
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon May 13 09:50:13 2019 -0400
AIRAVATA-3038 Don't allow updating creationTime
---
.../appcatalog/GroupResourceProfileEntity.java | 2 +-
.../GroupResourceProfileRepositoryTest.java | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GroupResourceProfileEntity.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GroupResourceProfileEntity.java
index a4af08e..4396818 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GroupResourceProfileEntity.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GroupResourceProfileEntity.java
@@ -49,7 +49,7 @@ public class GroupResourceProfileEntity implements Serializable {
private String groupResourceProfileName;
// TODO: change these timestamp to actual Timestamp
- @Column(name = "CREATION_TIME")
+ @Column(name = "CREATION_TIME", updatable = false)
private Long creationTime;
@Column(name = "UPDATE_TIME")
diff --git a/modules/registry/registry-core/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepositoryTest.java b/modules/registry/registry-core/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepositoryTest.java
index 4a871ce..6c0be31 100644
--- a/modules/registry/registry-core/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepositoryTest.java
+++ b/modules/registry/registry-core/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepositoryTest.java
@@ -24,6 +24,7 @@ import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescr
import org.apache.airavata.model.appcatalog.groupresourceprofile.*;
import org.apache.airavata.registry.core.repositories.common.TestBase;
import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.junit.Assert;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -249,4 +250,23 @@ public class GroupResourceProfileRepositoryTest extends TestBase {
computeResourceRepository.removeComputeResource(resourceId2);
}
+
+ @Test
+ public void testUpdatingGroupResourceProfileWithoutCreationTime() throws AppCatalogException {
+ GroupResourceProfile groupResourceProfile = new GroupResourceProfile();
+ groupResourceProfile.setGatewayId(gatewayId);
+ groupResourceProfile.setGroupResourceProfileName("TEST_GROUP_PROFILE_NAME");
+ groupResourceProfile.setDefaultCredentialStoreToken("test-cred-store-token");
+
+ // Simulate what is like for a client that only gets back the id from
+ // the create operation but not any fields, like creation time, that are
+ // populated by the create operation
+ GroupResourceProfile cloneGroupResourceProfile = groupResourceProfile.deepCopy();
+ String groupResourceProfileId = groupResourceProfileRepository.addGroupResourceProfile(groupResourceProfile);
+ long creationTime = groupResourceProfileRepository.getGroupResourceProfile(groupResourceProfileId).getCreationTime();
+ cloneGroupResourceProfile.setGroupResourceProfileId(groupResourceProfileId);
+ groupResourceProfileRepository.updateGroupResourceProfile(cloneGroupResourceProfile);
+ long creationTimeAfterUpdate = groupResourceProfileRepository.getGroupResourceProfile(groupResourceProfileId).getCreationTime();
+ Assert.assertEquals("creationTime should be the same after update", creationTime, creationTimeAfterUpdate);
+ }
}