diff --git a/catalogue/build.gradle b/catalogue/build.gradle index ed8df0f1e..efd4df84f 100644 --- a/catalogue/build.gradle +++ b/catalogue/build.gradle @@ -30,6 +30,7 @@ apply from: '../gradle/gradle/nexus.upload.plugin.gradle' dependencies { compile 'org.springframework.boot:spring-boot-starter-security:'+ springBootVersion compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.2.Final' + compile group: 'org.hibernate', name: 'hibernate-core', version: '5.0.12.Final' compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.6' compile 'org.hibernate:hibernate-validator:5.3.5.Final' diff --git a/catalogue/src/main/java/org/openbaton/catalogue/mano/descriptor/VirtualDeploymentUnit.java b/catalogue/src/main/java/org/openbaton/catalogue/mano/descriptor/VirtualDeploymentUnit.java index 4ea898163..f8c3c455c 100644 --- a/catalogue/src/main/java/org/openbaton/catalogue/mano/descriptor/VirtualDeploymentUnit.java +++ b/catalogue/src/main/java/org/openbaton/catalogue/mano/descriptor/VirtualDeploymentUnit.java @@ -16,6 +16,7 @@ package org.openbaton.catalogue.mano.descriptor; +import java.util.List; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.ElementCollection; @@ -24,6 +25,8 @@ import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.validation.constraints.Min; +import org.hibernate.annotations.Fetch; +import org.hibernate.annotations.FetchMode; import org.openbaton.catalogue.mano.common.HighAvailability; import org.openbaton.catalogue.mano.common.LifecycleEvent; import org.openbaton.catalogue.mano.common.faultmanagement.FaultManagementPolicy; @@ -46,7 +49,8 @@ public class VirtualDeploymentUnit extends BaseEntity { * virtualisation containers as per (ETSI GS NFV-SWA 001 [i.8]). */ @ElementCollection(fetch = FetchType.EAGER) - private Set vm_image; + @Fetch(FetchMode.SELECT) + private List vm_image; /** Reference to the VDU (vnfd:vdu:id) used to instantiate this element. */ private String parent_vdu; /** @@ -126,11 +130,11 @@ public void setVnfc_instance(Set vnfc_instance) { this.vnfc_instance = vnfc_instance; } - public Set getVm_image() { + public List getVm_image() { return vm_image; } - public void setVm_image(Set vm_image) { + public void setVm_image(List vm_image) { this.vm_image = vm_image; } diff --git a/core/core-impl/src/main/java/org/openbaton/nfvo/core/api/VNFPackageManagement.java b/core/core-impl/src/main/java/org/openbaton/nfvo/core/api/VNFPackageManagement.java index d84a85430..8171d12be 100644 --- a/core/core-impl/src/main/java/org/openbaton/nfvo/core/api/VNFPackageManagement.java +++ b/core/core-impl/src/main/java/org/openbaton/nfvo/core/api/VNFPackageManagement.java @@ -610,7 +610,7 @@ public BaseNfvImage handleImage( image = vim.add(vimInstance, image, imageFile); } if (vdu.getVm_image() == null) { - vdu.setVm_image(new LinkedHashSet<>()); + vdu.setVm_image(new ArrayList<>()); } vdu.getVm_image().add(image.getExtId()); vimInstance = vimManagement.refresh(vimInstance, true).get(); @@ -629,7 +629,7 @@ public BaseNfvImage handleImage( .forEach( virtualDeploymentUnit -> { if (virtualDeploymentUnit.getVm_image() == null) { - virtualDeploymentUnit.setVm_image(new LinkedHashSet<>()); + virtualDeploymentUnit.setVm_image(new ArrayList<>()); } if (ids != null) virtualDeploymentUnit.getVm_image().addAll(ids); if (names != null) virtualDeploymentUnit.getVm_image().addAll(names); diff --git a/core/core-impl/src/test/java/org/openbaton/nfvo/core/test/NetworkServiceRecordManagementClassSuiteTest.java b/core/core-impl/src/test/java/org/openbaton/nfvo/core/test/NetworkServiceRecordManagementClassSuiteTest.java index eebe7b66d..4600e8549 100644 --- a/core/core-impl/src/test/java/org/openbaton/nfvo/core/test/NetworkServiceRecordManagementClassSuiteTest.java +++ b/core/core-impl/src/test/java/org/openbaton/nfvo/core/test/NetworkServiceRecordManagementClassSuiteTest.java @@ -494,7 +494,7 @@ private VirtualNetworkFunctionDescriptor createVirtualNetworkFunctionDescriptor( { VirtualDeploymentUnit vdu = new VirtualDeploymentUnit(); vdu.setVm_image( - new LinkedHashSet() { + new ArrayList() { { add("mocked_image"); } @@ -560,7 +560,7 @@ private NetworkServiceRecord createNetworkServiceRecord() { highAvailability.setResiliencyLevel(ResiliencyLevel.ACTIVE_STANDBY_STATELESS); vdu.setHigh_availability(highAvailability); vdu.setVm_image( - new LinkedHashSet() { + new ArrayList() { { add("mocked_image"); } diff --git a/core/core-impl/src/test/java/org/openbaton/nfvo/core/test/VNFLifecycleOperationGrantingClassSuiteTest.java b/core/core-impl/src/test/java/org/openbaton/nfvo/core/test/VNFLifecycleOperationGrantingClassSuiteTest.java index 77e57c7ce..2b33eb568 100644 --- a/core/core-impl/src/test/java/org/openbaton/nfvo/core/test/VNFLifecycleOperationGrantingClassSuiteTest.java +++ b/core/core-impl/src/test/java/org/openbaton/nfvo/core/test/VNFLifecycleOperationGrantingClassSuiteTest.java @@ -23,6 +23,7 @@ import static org.openbaton.nfvo.core.test.TestUtils.createMinQuota; import static org.openbaton.nfvo.core.test.TestUtils.createVimInstance; +import java.util.ArrayList; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Map; @@ -126,7 +127,7 @@ private VirtualDeploymentUnit createVDU(int suffix, BaseVimInstance vimInstance) highAvailability.setResiliencyLevel(ResiliencyLevel.ACTIVE_STANDBY_STATELESS); vdu.setHigh_availability(highAvailability); vdu.setVm_image( - new HashSet() { + new ArrayList() { { add("mocked_image"); } diff --git a/tosca-parser/src/main/java/org/openbaton/tosca/templates/TopologyTemplate/Nodes/VDU/VDUNodeTemplate.java b/tosca-parser/src/main/java/org/openbaton/tosca/templates/TopologyTemplate/Nodes/VDU/VDUNodeTemplate.java index cad46e482..ba7f3e346 100755 --- a/tosca-parser/src/main/java/org/openbaton/tosca/templates/TopologyTemplate/Nodes/VDU/VDUNodeTemplate.java +++ b/tosca-parser/src/main/java/org/openbaton/tosca/templates/TopologyTemplate/Nodes/VDU/VDUNodeTemplate.java @@ -16,9 +16,9 @@ package org.openbaton.tosca.templates.TopologyTemplate.Nodes.VDU; -import java.util.LinkedHashSet; +import java.util.ArrayList; +import java.util.List; import java.util.Map; -import java.util.Set; import org.openbaton.tosca.templates.TopologyTemplate.Nodes.NodeTemplate; @SuppressWarnings({"unsafe", "unchecked"}) @@ -26,7 +26,7 @@ public class VDUNodeTemplate { private String type; private String name; - private Set artifacts = new LinkedHashSet<>(); + private List artifacts = new ArrayList<>(); private VDUProperties properties; public VDUNodeTemplate(NodeTemplate nodeTemplate, String name) { @@ -61,11 +61,11 @@ public void setType(String type) { this.type = type; } - public Set getArtifacts() { + public List getArtifacts() { return artifacts; } - public void setArtifacts(LinkedHashSet vduArtifact) { + public void setArtifacts(ArrayList vduArtifact) { this.artifacts = vduArtifact; } diff --git a/vim-impl/src/test/java/org/openbaton/vim_impl/vim/test/VimTestSuiteClass.java b/vim-impl/src/test/java/org/openbaton/vim_impl/vim/test/VimTestSuiteClass.java index 8ed5ba703..a809f2775 100644 --- a/vim-impl/src/test/java/org/openbaton/vim_impl/vim/test/VimTestSuiteClass.java +++ b/vim-impl/src/test/java/org/openbaton/vim_impl/vim/test/VimTestSuiteClass.java @@ -23,9 +23,10 @@ import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.when; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.LinkedHashSet; +import java.util.List; import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -224,7 +225,7 @@ private VirtualDeploymentUnit createVDU() { monitoring_parameter.add("parameter_3"); vdu.setMonitoring_parameter(monitoring_parameter); vdu.setComputation_requirement("m1.small"); - Set vm_images = new LinkedHashSet<>(); + List vm_images = new ArrayList<>(); vm_images.add("image_1234"); vdu.setVm_image(vm_images); vimInstance.setFlavours(new HashSet<>());