airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata] branch develop updated: AIRAVATA-2876 Delete inputs/outputs when removed
Date Tue, 04 Sep 2018 21:36:21 GMT
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 36f795c  AIRAVATA-2876 Delete inputs/outputs when removed
36f795c is described below

commit 36f795c14e20f428d1d6cf93e9da37e3fbe0f98c
Author: Marcus Christie <machristie@apache.org>
AuthorDate: Tue Sep 4 17:35:30 2018 -0400

    AIRAVATA-2876 Delete inputs/outputs when removed
---
 .../appcatalog/ApplicationInterfaceEntity.java     |  4 +-
 .../ApplicationInterfaceRepositoryTest.java        | 61 ++++++++++++++++++++++
 2 files changed, 63 insertions(+), 2 deletions(-)

diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ApplicationInterfaceEntity.java
b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ApplicationInterfaceEntity.java
index 55ab8a9..cec6a0c 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ApplicationInterfaceEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ApplicationInterfaceEntity.java
@@ -65,11 +65,11 @@ public class ApplicationInterfaceEntity implements Serializable {
 	@Column(name = "MODULE_ID")
 	private List<String> applicationModules;
 
-	@OneToMany(targetEntity = ApplicationInputEntity.class, cascade = CascadeType.ALL,
+	@OneToMany(targetEntity = ApplicationInputEntity.class, cascade = CascadeType.ALL, orphanRemoval
= true,
 			mappedBy = "applicationInterface", fetch = FetchType.EAGER)
 	private List<ApplicationInputEntity> applicationInputs;
 
-	@OneToMany(targetEntity = ApplicationOutputEntity.class, cascade = CascadeType.ALL,
+	@OneToMany(targetEntity = ApplicationOutputEntity.class, cascade = CascadeType.ALL, orphanRemoval
= true,
 			mappedBy = "applicationInterface", fetch = FetchType.EAGER)
 	private List<ApplicationOutputEntity> applicationOutputs;
 
diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepositoryTest.java
b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepositoryTest.java
index 18968bc..614a138 100644
--- a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepositoryTest.java
+++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/ApplicationInterfaceRepositoryTest.java
@@ -244,6 +244,67 @@ public class ApplicationInterfaceRepositoryTest extends TestBase {
     }
 
     @Test
+    public void addAndRemoveInputsOutputsToInterfaceTest() throws AppCatalogException {
+
+        ApplicationInterfaceDescription applicationInterfaceDescription = new ApplicationInterfaceDescription();
+        applicationInterfaceDescription.setApplicationInterfaceId("interface1");
+        applicationInterfaceDescription.setApplicationName("app interface 1");
+
+        String interfaceId = applicationInterfaceRepository.addApplicationInterface(applicationInterfaceDescription,
gatewayId);
+
+        InputDataObjectType input = new InputDataObjectType();
+        input.setName("input1");
+        input.setApplicationArgument("Arg");
+        input.setDataStaged(true);
+        input.setInputOrder(0);
+        input.setIsReadOnly(true);
+        input.setIsRequired(true);
+        input.setRequiredToAddedToCommandLine(true);
+        input.setType(DataType.FLOAT);
+        input.setUserFriendlyDescription("User friendly description");
+        input.setValue("113");
+        input.setMetaData("Metadata");
+        input.setStandardInput(true);
+
+        InputDataObjectType input2 = new InputDataObjectType();
+        input2.setName("input2");
+        input2.setInputOrder(1);
+
+        OutputDataObjectType output = new OutputDataObjectType();
+        output.setName("output1");
+        output.setValue("value");
+        output.setType(DataType.FLOAT);
+        output.setApplicationArgument("Argument");
+        output.setDataMovement(true);
+        output.setIsRequired(true);
+        output.setLocation("/home/");
+        output.setSearchQuery("Search query");
+        output.setRequiredToAddedToCommandLine(true);
+        output.setOutputStreaming(true);
+
+        OutputDataObjectType output2 = new OutputDataObjectType();
+        output2.setName("output2");
+
+        applicationInterfaceDescription.setApplicationInputs(Arrays.asList(input, input2));
+        applicationInterfaceDescription.setApplicationOutputs(Arrays.asList(output, output2));
+
+        applicationInterfaceRepository.updateApplicationInterface(interfaceId, applicationInterfaceDescription);
+
+        ApplicationInterfaceDescription savedInterface = applicationInterfaceRepository.getApplicationInterface(interfaceId);
+        Assert.assertEquals(2, savedInterface.getApplicationInputsSize());
+        Assert.assertEquals(2, savedInterface.getApplicationOutputsSize());
+
+        savedInterface.setApplicationInputs(Arrays.asList(input));
+        savedInterface.setApplicationOutputs(Arrays.asList(output));
+
+        applicationInterfaceRepository.updateApplicationInterface(interfaceId, savedInterface);
+        ApplicationInterfaceDescription updatedInterface = applicationInterfaceRepository.getApplicationInterface(interfaceId);
+        Assert.assertEquals(1, updatedInterface.getApplicationInputsSize());
+        Assert.assertEquals(1, updatedInterface.getApplicationOutputsSize());
+
+    }
+
+    @Test
     public void filterApplicationInterfacesTest() throws AppCatalogException {
 
         List<ApplicationInterfaceDescription> interfaces = new ArrayList<>();


Mime
View raw message