aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extra/sql/bulkload/create-tables.sql15
-rw-r--r--pom.xml11
-rw-r--r--src/main/docker/backend/Dockerfile4
-rw-r--r--src/main/java/org/onap/clamp/loop/Loop.java18
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java18
-rw-r--r--src/main/java/org/onap/clamp/loop/service/Service.java137
-rw-r--r--src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java14
-rw-r--r--src/main/script/SelectNpmRepo.groovy4
-rw-r--r--src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java2
-rw-r--r--src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java9
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java4
-rw-r--r--src/test/java/org/onap/clamp/loop/LoopToJsonTest.java28
-rw-r--r--src/test/java/org/onap/clamp/loop/ServiceTest.java55
-rw-r--r--src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java5
-rw-r--r--src/test/resources/tosca/loop.json704
-rw-r--r--src/test/resources/tosca/model-properties.json10
-rw-r--r--src/test/resources/tosca/resource-details.json96
-rw-r--r--src/test/resources/tosca/service-details.json15
-rw-r--r--ui-react/package.json3
-rw-r--r--ui-react/src/LoopUI.js14
-rw-r--r--ui-react/src/api/LoopCache.js4
-rw-r--r--ui-react/src/api/LoopCache_mokeLoopJsonCache.json2
-rw-r--r--ui-react/src/api/example.json2
-rw-r--r--ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.test.js2
-rw-r--r--ui-react/src/components/dialogs/Loop/DeployLoopModal.js (renamed from ui-react/src/components/dialogs/DeployLoop.js)6
-rw-r--r--ui-react/src/components/dialogs/Loop/DeployLoopModal.test.js (renamed from ui-react/src/components/dialogs/DeployLoop.test.js)22
-rw-r--r--ui-react/src/components/dialogs/Loop/LoopPropertiesModal.js (renamed from ui-react/src/components/dialogs/LoopProperties.js)4
-rw-r--r--ui-react/src/components/dialogs/Loop/LoopPropertiesModal.test.js (renamed from ui-react/src/components/dialogs/LoopProperties.test.js)20
-rw-r--r--ui-react/src/components/dialogs/Loop/OpenLoopModal.js (renamed from ui-react/src/components/dialogs/OpenLoop/OpenLoopModal.js)0
-rw-r--r--ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js (renamed from ui-react/src/components/dialogs/OpenLoop/OpenLoopModal.test.js)0
-rw-r--r--ui-react/src/components/dialogs/Loop/__snapshots__/DeployLoopModal.test.js.snap (renamed from ui-react/src/components/dialogs/__snapshots__/DeployLoop.test.js.snap)2
-rw-r--r--ui-react/src/components/dialogs/Loop/__snapshots__/LoopPropertiesModal.test.js.snap (renamed from ui-react/src/components/dialogs/__snapshots__/LoopProperties.test.js.snap)2
-rw-r--r--ui-react/src/components/dialogs/Loop/__snapshots__/OpenLoopModal.test.js.snap (renamed from ui-react/src/components/dialogs/OpenLoop/__snapshots__/OpenLoopModal.test.js.snap)0
-rw-r--r--ui-react/src/components/dialogs/UserInfoModal.js (renamed from ui-react/src/components/dialogs/UserInfo.js)2
-rw-r--r--ui-react/src/components/dialogs/UserInfoModal.test.js (renamed from ui-react/src/components/dialogs/UserInfo.test.js)10
-rw-r--r--ui-react/src/components/dialogs/__snapshots__/UserInfoModal.test.js.snap (renamed from ui-react/src/components/dialogs/__snapshots__/UserInfo.test.js.snap)2
36 files changed, 1149 insertions, 97 deletions
diff --git a/extra/sql/bulkload/create-tables.sql b/extra/sql/bulkload/create-tables.sql
index 0e15d4d3a..dafd80034 100644
--- a/extra/sql/bulkload/create-tables.sql
+++ b/extra/sql/bulkload/create-tables.sql
@@ -23,9 +23,9 @@
dcae_deployment_status_url varchar(255),
global_properties_json json,
last_computed_state varchar(255) not null,
- model_properties_json json,
operational_policy_schema json,
svg_representation MEDIUMTEXT,
+ service_uuid varchar(255),
primary key (name)
) engine=InnoDB;
@@ -52,11 +52,24 @@
primary key (name)
) engine=InnoDB;
+ create table services (
+ service_uuid varchar(255) not null,
+ name varchar(255) not null,
+ resource_details json,
+ service_details json,
+ primary key (service_uuid)
+ ) engine=InnoDB;
+
alter table loop_logs
add constraint FK1j0cda46aickcaoxqoo34khg2
foreign key (loop_id)
references loops (name);
+ alter table loops
+ add constraint FK4b9wnqopxogwek014i1shqw7w
+ foreign key (service_uuid)
+ references services (service_uuid);
+
alter table loops_microservicepolicies
add constraint FKem7tp1cdlpwe28av7ef91j1yl
foreign key (microservicepolicy_id)
diff --git a/pom.xml b/pom.xml
index 06231a079..83bc1d06e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1164,7 +1164,7 @@
</goals>
<phase>deploy</phase>
<configuration>
- <arguments>run-script publish</arguments>
+ <arguments>publish</arguments>
</configuration>
</execution>
</executions>
@@ -1174,10 +1174,15 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
- <source>13</source>
- <target>13</target>
+ <source>11</source>
+ <target>11</target>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.sonarsource.scanner.maven</groupId>
+ <artifactId>sonar-maven-plugin</artifactId>
+ <version>3.7.0.1746</version>
+ </plugin>
</plugins>
</build>
</project>
diff --git a/src/main/docker/backend/Dockerfile b/src/main/docker/backend/Dockerfile
index 625d5a9b9..c2b76b0b5 100644
--- a/src/main/docker/backend/Dockerfile
+++ b/src/main/docker/backend/Dockerfile
@@ -21,7 +21,7 @@
#
###
-FROM openjdk:13-alpine3.10
+FROM alpine:3.10.3
MAINTAINER "The Onap Team"
LABEL Description="This immage contains alpine, openjdk 11 and clamp"
@@ -33,6 +33,8 @@ ENV HTTPS_PROXY=$https_proxy
ENV http_proxy=$HTTP_PROXY
ENV https_proxy=$HTTPS_PROXY
+RUN apk --no-cache add openjdk11 --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community
+
RUN addgroup onap && adduser -D -G onap clamp
VOLUME /opt/clamp/config
RUN mkdir /var/log/onap
diff --git a/src/main/java/org/onap/clamp/loop/Loop.java b/src/main/java/org/onap/clamp/loop/Loop.java
index 37d597eeb..ef70ba80e 100644
--- a/src/main/java/org/onap/clamp/loop/Loop.java
+++ b/src/main/java/org/onap/clamp/loop/Loop.java
@@ -48,6 +48,7 @@ import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
+import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;
@@ -61,6 +62,7 @@ import org.onap.clamp.loop.components.external.DcaeComponent;
import org.onap.clamp.loop.components.external.ExternalComponent;
import org.onap.clamp.loop.components.external.PolicyComponent;
import org.onap.clamp.loop.log.LoopLog;
+import org.onap.clamp.loop.service.Service;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
import org.onap.clamp.policy.operational.OperationalPolicyRepresentationBuilder;
@@ -109,9 +111,9 @@ public class Loop implements Serializable {
private JsonObject globalPropertiesJson;
@Expose
- @Type(type = "json")
- @Column(columnDefinition = "json", name = "model_properties_json")
- private JsonObject modelPropertiesJson;
+ @ManyToOne(fetch = FetchType.EAGER,cascade = CascadeType.ALL)
+ @JoinColumn(name = "service_uuid")
+ private Service modelService;
@Column(columnDefinition = "MEDIUMTEXT", nullable = false, name = "blueprint_yaml")
private String blueprint;
@@ -266,15 +268,15 @@ public class Loop implements Serializable {
this.dcaeBlueprintId = dcaeBlueprintId;
}
- public JsonObject getModelPropertiesJson() {
- return modelPropertiesJson;
+ public Service getModelService() {
+ return modelService;
}
- void setModelPropertiesJson(JsonObject modelPropertiesJson) {
- this.modelPropertiesJson = modelPropertiesJson;
+ void setModelService(Service modelService) {
+ this.modelService = modelService;
try {
this.operationalPolicySchema = OperationalPolicyRepresentationBuilder
- .generateOperationalPolicySchema(this.getModelPropertiesJson());
+ .generateOperationalPolicySchema(this.getModelService());
} catch (JsonSyntaxException | IOException | NullPointerException e) {
logger.error("Unable to generate the operational policy Schema ... ", e);
this.operationalPolicySchema = new JsonObject();
diff --git a/src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java b/src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java
index b8bc1f524..55009bc22 100644
--- a/src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java
+++ b/src/main/java/org/onap/clamp/loop/LoopCsarInstaller.java
@@ -46,6 +46,7 @@ import org.onap.clamp.clds.sdc.controller.installer.CsarInstaller;
import org.onap.clamp.clds.sdc.controller.installer.MicroService;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.drawing.SvgFacade;
+import org.onap.clamp.loop.service.Service;
import org.onap.clamp.policy.Policy;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
@@ -138,7 +139,7 @@ public class LoopCsarInstaller implements CsarInstaller {
if (microServicesChain.isEmpty()) {
microServicesChain = blueprintParser.fallbackToOneMicroService(blueprintArtifact.getDcaeBlueprint());
}
- newLoop.setModelPropertiesJson(createModelPropertiesJson(csar));
+ newLoop.setModelService(createServiceModel(csar));
newLoop.setMicroServicePolicies(
createMicroServicePolicies(microServicesChain, csar, blueprintArtifact, newLoop));
newLoop.setOperationalPolicies(createOperationalPolicies(csar, blueprintArtifact, newLoop));
@@ -219,16 +220,17 @@ public class LoopCsarInstaller implements CsarInstaller {
return resourcesProp;
}
- private static JsonObject createModelPropertiesJson(CsarHandler csar) {
- JsonObject modelProperties = new JsonObject();
- // Add service details
- modelProperties.add("serviceDetails", JsonUtils.GSON.fromJson(
- JsonUtils.GSON.toJson(csar.getSdcCsarHelper().getServiceMetadataAllProperties()), JsonObject.class));
+ private Service createServiceModel(CsarHandler csar) {
+ JsonObject serviceDetails = JsonUtils.GSON.fromJson(
+ JsonUtils.GSON.toJson(csar.getSdcCsarHelper().getServiceMetadataAllProperties()), JsonObject.class);
+
// Add properties details for each type, VfModule, VF, VFC, ....
JsonObject resourcesProp = createServicePropertiesByType(csar);
resourcesProp.add("VFModule", createVfModuleProperties(csar));
- modelProperties.add("resourceDetails", resourcesProp);
- return modelProperties;
+
+ Service modelService = new Service(serviceDetails, resourcesProp);
+
+ return modelService;
}
private JsonObject getAllBlueprintParametersInJson(BlueprintArtifact blueprintArtifact, Loop newLoop) {
diff --git a/src/main/java/org/onap/clamp/loop/service/Service.java b/src/main/java/org/onap/clamp/loop/service/Service.java
new file mode 100644
index 000000000..ac1216b9d
--- /dev/null
+++ b/src/main/java/org/onap/clamp/loop/service/Service.java
@@ -0,0 +1,137 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.loop.service;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.google.gson.JsonObject;
+import com.google.gson.annotations.Expose;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.Transient;
+
+import org.hibernate.annotations.Type;
+import org.hibernate.annotations.TypeDef;
+import org.hibernate.annotations.TypeDefs;
+import org.onap.clamp.dao.model.jsontype.StringJsonUserType;
+
+
+@Entity
+@Table(name = "services")
+@TypeDefs({ @TypeDef(name = "json", typeClass = StringJsonUserType.class) })
+public class Service implements Serializable {
+
+ /**
+ * The serial version id.
+ */
+ private static final long serialVersionUID = 1331119060272760758L;
+
+ @Transient
+ private static final EELFLogger logger = EELFManager.getInstance().getLogger(Service.class);
+
+ @Id
+ @Column(name = "service_uuid", unique = true)
+ private String serviceUuid;
+
+ @Column(nullable = false, name = "name")
+ private String name;
+
+ @Expose
+ @Type(type = "json")
+ @Column(columnDefinition = "json", name = "service_details")
+ private JsonObject serviceDetails;
+
+ @Expose
+ @Type(type = "json")
+ @Column(columnDefinition = "json", name = "resource_details")
+ private JsonObject resourceDetails;
+
+ /**
+ * Public constructor.
+ */
+ public Service() {
+ }
+
+ /**
+ * Constructor.
+ */
+ public Service(JsonObject serviceDetails, JsonObject resourceDetails) {
+ this.name = serviceDetails.get("name").getAsString();
+ this.serviceUuid = serviceDetails.get("UUID").getAsString();
+ this.serviceDetails = serviceDetails;
+ this.resourceDetails = resourceDetails;
+ }
+
+ public String getServiceUuid() {
+ return serviceUuid;
+ }
+
+ public JsonObject getServiceDetails() {
+ return serviceDetails;
+ }
+
+ public JsonObject getResourceDetails() {
+ return resourceDetails;
+ }
+
+ public JsonObject getResourceByType(String type) {
+ return (JsonObject) resourceDetails.get(type);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((serviceUuid == null) ? 0 : serviceUuid.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Service other = (Service) obj;
+ if (serviceUuid == null) {
+ if (other.serviceUuid != null) {
+ return false;
+ }
+ } else if (!serviceUuid.equals(other.serviceUuid)) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java
index f6f3f498d..1d0d99080 100644
--- a/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java
+++ b/src/main/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilder.java
@@ -33,6 +33,7 @@ import java.util.Map.Entry;
import org.onap.clamp.clds.util.JsonUtils;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.loop.service.Service;
public class OperationalPolicyRepresentationBuilder {
@@ -47,7 +48,7 @@ public class OperationalPolicyRepresentationBuilder {
* @throws JsonSyntaxException If the schema template cannot be parsed
* @throws IOException In case of issue when opening the schema template
*/
- public static JsonObject generateOperationalPolicySchema(JsonObject modelJson)
+ public static JsonObject generateOperationalPolicySchema(Service modelJson)
throws JsonSyntaxException, IOException {
JsonObject jsonSchema = JsonUtils.GSON.fromJson(
ResourceFileUtil.getResourceAsString("clds/json-schema/operational_policies/operational_policy.json"),
@@ -78,9 +79,9 @@ public class OperationalPolicyRepresentationBuilder {
return property;
}
- private static JsonArray createVnfSchema(JsonObject modelJson) {
+ private static JsonArray createVnfSchema(Service modelService) {
JsonArray vnfSchemaArray = new JsonArray();
- JsonObject modelVnfs = modelJson.get("resourceDetails").getAsJsonObject().get("VF").getAsJsonObject();
+ JsonObject modelVnfs = modelService.getResourceByType("VF");
for (Entry<String, JsonElement> entry : modelVnfs.entrySet()) {
JsonObject vnfOneOfSchema = new JsonObject();
@@ -96,10 +97,9 @@ public class OperationalPolicyRepresentationBuilder {
return vnfSchemaArray;
}
- private static JsonArray createVfModuleSchema(JsonObject modelJson) {
+ private static JsonArray createVfModuleSchema(Service modelService) {
JsonArray vfModuleOneOfSchemaArray = new JsonArray();
- JsonObject modelVfModules = modelJson.get("resourceDetails").getAsJsonObject().get("VFModule")
- .getAsJsonObject();
+ JsonObject modelVfModules = modelService.getResourceByType("VFModule");
for (Entry<String, JsonElement> entry : modelVfModules.entrySet()) {
JsonObject vfModuleOneOfSchema = new JsonObject();
@@ -137,7 +137,7 @@ public class OperationalPolicyRepresentationBuilder {
return vfModuleOneOfSchemaArray;
}
- private static JsonArray createAnyOfArray(JsonObject modelJson) {
+ private static JsonArray createAnyOfArray(Service modelJson) {
JsonArray targetOneOfStructure = new JsonArray();
targetOneOfStructure.addAll(createVnfSchema(modelJson));
targetOneOfStructure.addAll(createVfModuleSchema(modelJson));
diff --git a/src/main/script/SelectNpmRepo.groovy b/src/main/script/SelectNpmRepo.groovy
index 08a2cb0a2..92371cfe9 100644
--- a/src/main/script/SelectNpmRepo.groovy
+++ b/src/main/script/SelectNpmRepo.groovy
@@ -28,7 +28,7 @@ println project.properties['clamp.project.version'];
if ( project.properties['clamp.project.version'].endsWith("-SNAPSHOT") ) {
project.properties['npm.publish.url']="https://nexus3.onap.org/repository/npm.snapshot/"
} else {
- project.properties['npm.publish.url']="https://nexus3.onap.org/repository/npm.release/"
+ project.properties['npm.publish.url']="https://nexus3.onap.org/repository/npm.snapshot/"
}
-println 'NPM repository: ' + project.properties['npm.publish.url']; \ No newline at end of file
+println 'NPM repository: ' + project.properties['npm.publish.url'];
diff --git a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java
index 072d57712..40cc0650e 100644
--- a/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java
+++ b/src/test/java/org/onap/clamp/clds/it/CldsServiceItCase.java
@@ -104,7 +104,6 @@ public class CldsServiceItCase {
@Test
public void testCldsInfoAuthorized() throws Exception {
- Authentication authentication;
List<GrantedAuthority> authList = new LinkedList<GrantedAuthority>();
authList.add(new SimpleGrantedAuthority("permission-type-cl-manage|dev|*"));
authList.add(new SimpleGrantedAuthority("permission-type-cl|dev|read"));
@@ -113,6 +112,7 @@ public class CldsServiceItCase {
authList.add(new SimpleGrantedAuthority("permission-type-template|dev|update"));
authList.add(new SimpleGrantedAuthority("permission-type-filter-vf|dev|*"));
authList.add(new SimpleGrantedAuthority("permission-type-cl-event|dev|*"));
+ Authentication authentication;
authentication = new UsernamePasswordAuthenticationToken(new User("admin", "", authList), "", authList);
Mockito.when(securityContext.getAuthentication()).thenReturn(authentication);
diff --git a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
index fbf1f2079..e3271c7a6 100644
--- a/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
+++ b/src/test/java/org/onap/clamp/loop/CsarInstallerItCase.java
@@ -202,10 +202,13 @@ public class CsarInstallerItCase {
assertThat(loop.getGlobalPropertiesJson().get("dcaeDeployParameters")).isNotNull();
assertThat(loop.getMicroServicePolicies()).hasSize(1);
assertThat(loop.getOperationalPolicies()).hasSize(1);
- assertThat(loop.getModelPropertiesJson().get("serviceDetails")).isNotNull();
- assertThat(loop.getModelPropertiesJson().get("resourceDetails")).isNotNull();
+ assertThat(loop.getModelService().getServiceUuid()).isEqualTo("63cac700-ab9a-4115-a74f-7eac85e3fce0");
JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"),
- JsonUtils.GSON.toJson(loop.getModelPropertiesJson()), true);
+ JsonUtils.GSON_JPA_MODEL.toJson(loop.getModelService()), true);
+ JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/service-details.json"),
+ JsonUtils.GSON_JPA_MODEL.toJson(loop.getModelService().getServiceDetails()), true);
+ JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/resource-details.json"),
+ JsonUtils.GSON_JPA_MODEL.toJson(loop.getModelService().getResourceDetails()), true);
assertThat(((MicroServicePolicy) (loop.getMicroServicePolicies().toArray()[0])).getModelType()).isNotEmpty();
loop = loopsRepo
diff --git a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
index 1fedc9abe..28a92e371 100644
--- a/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
+++ b/src/test/java/org/onap/clamp/loop/LoopServiceTestItCase.java
@@ -347,8 +347,8 @@ public class LoopServiceTestItCase {
saveTestLoopToDb();
assertThat(microServicePolicyService.isExisting("policyName")).isFalse();
MicroServicePolicy microServicePolicy = new MicroServicePolicy("policyName", "",
- "tosca_definitions_version: tosca_simple_yaml_1_0_0", false,
- JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
+ "tosca_definitions_version: tosca_simple_yaml_1_0_0", false,
+ JsonUtils.GSON.fromJson(EXAMPLE_JSON, JsonObject.class), null);
loopService.updateMicroservicePolicy(EXAMPLE_LOOP_NAME, microServicePolicy);
assertThat(microServicePolicyService.isExisting("policyName")).isTrue();
}
diff --git a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
index 3010fe50b..b68bf48a0 100644
--- a/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
+++ b/src/test/java/org/onap/clamp/loop/LoopToJsonTest.java
@@ -29,7 +29,9 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNotNull;
import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
+import com.google.gson.JsonSyntaxException;
import java.io.IOException;
import java.util.HashSet;
@@ -41,6 +43,7 @@ import org.onap.clamp.clds.util.ResourceFileUtil;
import org.onap.clamp.loop.components.external.PolicyComponent;
import org.onap.clamp.loop.log.LogType;
import org.onap.clamp.loop.log.LoopLog;
+import org.onap.clamp.loop.service.Service;
import org.onap.clamp.policy.microservice.MicroServicePolicy;
import org.onap.clamp.policy.operational.OperationalPolicy;
import org.skyscreamer.jsonassert.JSONAssert;
@@ -54,7 +57,7 @@ public class LoopToJsonTest {
}
private Loop getLoop(String name, String svgRepresentation, String blueprint, String globalPropertiesJson,
- String dcaeId, String dcaeUrl, String dcaeBlueprintId) {
+ String dcaeId, String dcaeUrl, String dcaeBlueprintId) throws JsonSyntaxException, IOException {
Loop loop = new Loop(name, blueprint, svgRepresentation);
loop.setGlobalPropertiesJson(new Gson().fromJson(globalPropertiesJson, JsonObject.class));
loop.setLastComputedState(LoopState.DESIGN);
@@ -116,6 +119,29 @@ public class LoopToJsonTest {
}
@Test
+ public void loopServiceTest() throws IOException {
+ Loop loopTest2 = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
+ "123456789", "https://dcaetest.org", "UUID-blueprint");
+
+ JsonObject jsonModel = new GsonBuilder().create()
+ .fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"), JsonObject.class);
+ Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(),
+ jsonModel.get("resourceDetails").getAsJsonObject());
+ loopTest2.setModelService(service);
+
+ String jsonSerialized = JsonUtils.GSON_JPA_MODEL.toJson(loopTest2);
+ assertThat(jsonSerialized).isNotNull().isNotEmpty();
+ System.out.println(jsonSerialized);
+ JSONAssert.assertEquals(ResourceFileUtil.getResourceAsString("tosca/loop.json"),
+ jsonSerialized, true);
+
+ Loop loopTestDeserialized = JsonUtils.GSON_JPA_MODEL.fromJson(jsonSerialized, Loop.class);
+ assertNotNull(loopTestDeserialized);
+ assertThat(loopTestDeserialized).isEqualToIgnoringGivenFields(loopTest2, "modelService",
+ "svgRepresentation", "blueprint", "components");
+ }
+
+ @Test
public void createPoliciesPayloadPdpGroupTest() throws IOException {
Loop loopTest = getLoop("ControlLoopTest", "<xml></xml>", "yamlcontent", "{\"testname\":\"testvalue\"}",
"123456789", "https://dcaetest.org", "UUID-blueprint");
diff --git a/src/test/java/org/onap/clamp/loop/ServiceTest.java b/src/test/java/org/onap/clamp/loop/ServiceTest.java
new file mode 100644
index 000000000..45de5385e
--- /dev/null
+++ b/src/test/java/org/onap/clamp/loop/ServiceTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.loop;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.google.gson.JsonObject;
+
+import org.junit.Test;
+import org.onap.clamp.clds.util.JsonUtils;
+import org.onap.clamp.loop.service.Service;
+
+public class ServiceTest {
+
+ @Test
+ public void equalMethodTest() {
+ String serviceStr1 = "{\"name\": \"vLoadBalancerMS\", \"UUID\": \"63cac700-ab9a-4115-a74f-7eac85e3fce0\"}";
+ String serviceStr2 = "{\"name\": \"vLoadBalancerMS2\", \"UUID\": \"63cac700-ab9a-4115-a74f-7eac85e3fce0\"}";
+ String serviceStr3 = "{\"name\": \"vLoadBalancerMS\",\"UUID\": \"63cac700-ab9a-4115-a74f-7eac85e3fc11\"}";
+ String resourceStr = "{\"CP\": {}}";
+
+ Service service1 = new Service(JsonUtils.GSON.fromJson(serviceStr1, JsonObject.class),
+ JsonUtils.GSON.fromJson(resourceStr, JsonObject.class));
+
+ Service service2 = new Service(JsonUtils.GSON.fromJson(serviceStr2, JsonObject.class), null);
+
+ Service service3 = new Service(JsonUtils.GSON.fromJson(serviceStr3, JsonObject.class),
+ JsonUtils.GSON.fromJson(resourceStr, JsonObject.class));
+
+ assertThat(service1.equals(service2)).isEqualTo(true);
+ assertThat(service1.equals(service3)).isEqualTo(false);
+ }
+
+}
diff --git a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
index 904525bea..673ac323d 100644
--- a/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
+++ b/src/test/java/org/onap/clamp/policy/operational/OperationalPolicyRepresentationBuilderTest.java
@@ -32,6 +32,7 @@ import java.io.IOException;
import org.junit.Test;
import org.onap.clamp.clds.util.ResourceFileUtil;
+import org.onap.clamp.loop.service.Service;
import org.skyscreamer.jsonassert.JSONAssert;
public class OperationalPolicyRepresentationBuilderTest {
@@ -40,8 +41,10 @@ public class OperationalPolicyRepresentationBuilderTest {
public void testOperationalPolicyPayloadConstruction() throws IOException {
JsonObject jsonModel = new GsonBuilder().create()
.fromJson(ResourceFileUtil.getResourceAsString("tosca/model-properties.json"), JsonObject.class);
+ Service service = new Service(jsonModel.get("serviceDetails").getAsJsonObject(),
+ jsonModel.get("resourceDetails").getAsJsonObject());
- JsonObject jsonSchema = OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(jsonModel);
+ JsonObject jsonSchema = OperationalPolicyRepresentationBuilder.generateOperationalPolicySchema(service);
assertThat(jsonSchema).isNotNull();
diff --git a/src/test/resources/tosca/loop.json b/src/test/resources/tosca/loop.json
new file mode 100644
index 000000000..557fa6f69
--- /dev/null
+++ b/src/test/resources/tosca/loop.json
@@ -0,0 +1,704 @@
+{
+ "name": "ControlLoopTest",
+ "dcaeDeploymentId": "123456789",
+ "dcaeDeploymentStatusUrl": "https://dcaetest.org",
+ "dcaeBlueprintId": "UUID-blueprint",
+ "operationalPolicySchema": {
+ "schema": {
+ "uniqueItems": "true",
+ "format": "tabs",
+ "type": "array",
+ "minItems": 1,
+ "maxItems": 1,
+ "title": "Operational policies",
+ "items": {
+ "type": "object",
+ "title": "Operational Policy Item",
+ "id": "operational_policy_item",
+ "headerTemplate": "{{self.name}}",
+ "required": [
+ "name",
+ "configurationsJson"
+ ],
+ "properties": {
+ "name": {
+ "type": "string",
+ "title": "Operational policy name",
+ "readOnly": "True"
+ },
+ "configurationsJson": {
+ "type": "object",
+ "title": "Configuration",
+ "required": [
+ "operational_policy",
+ "guard_policies"
+ ],
+ "properties": {
+ "operational_policy": {
+ "type": "object",
+ "title": "Related Parameters",
+ "required": [
+ "controlLoop",
+ "policies"
+ ],
+ "properties": {
+ "controlLoop": {
+ "type": "object",
+ "title": "Control Loop details",
+ "required": [
+ "timeout",
+ "abatement",
+ "trigger_policy",
+ "controlLoopName"
+ ],
+ "properties": {
+ "timeout": {
+ "type": "string",
+ "title": "Overall Time Limit",
+ "default": "0",
+ "format": "number"
+ },
+ "abatement": {
+ "type": "string",
+ "title": "Abatement",
+ "enum": [
+ "True",
+ "False"
+ ]
+ },
+ "trigger_policy": {
+ "type": "string",
+ "title": "Policy Decision Entry"
+ },
+ "controlLoopName": {
+ "type": "string",
+ "title": "Control loop name",
+ "readOnly": "True"
+ }
+ }
+ },
+ "policies": {
+ "uniqueItems": "true",
+ "id": "policies_array",
+ "type": "array",
+ "title": "Policy Decision Tree",
+ "format": "tabs-top",
+ "items": {
+ "title": "Policy Decision",
+ "type": "object",
+ "id": "policy_item",
+ "headerTemplate": "{{self.id}} - {{self.recipe}}",
+ "format": "categories",
+ "basicCategoryTitle": "recipe",
+ "required": [
+ "id",
+ "recipe",
+ "retry",
+ "timeout",
+ "actor",
+ "success",
+ "failure",
+ "failure_timeout",
+ "failure_retries",
+ "failure_exception",
+ "failure_guard",
+ "target"
+ ],
+ "properties": {
+ "id": {
+ "default": "Policy 1",
+ "title": "Policy ID",
+ "type": "string"
+ },
+ "recipe": {
+ "title": "Recipe",
+ "type": "string",
+ "enum": [
+ "Restart",
+ "Rebuild",
+ "Migrate",
+ "Health-Check",
+ "ModifyConfig",
+ "VF Module Create",
+ "VF Module Delete",
+ "Reroute"
+ ]
+ },
+ "retry": {
+ "default": "0",
+ "title": "Number of Retry",
+ "type": "string",
+ "format": "number"
+ },
+ "timeout": {
+ "default": "0",
+ "title": "Timeout",
+ "type": "string",
+ "format": "number"
+ },
+ "actor": {
+ "title": "Actor",
+ "type": "string",
+ "enum": [
+ "APPC",
+ "SO",
+ "VFC",
+ "SDNC",
+ "SDNR"
+ ]
+ },
+ "payload": {
+ "title": "Payload (YAML)",
+ "type": "string",
+ "format": "textarea"
+ },
+ "success": {
+ "default": "final_success",
+ "title": "When Success",
+ "type": "string"
+ },
+ "failure": {
+ "default": "final_failure",
+ "title": "When Failure",
+ "type": "string"
+ },
+ "failure_timeout": {
+ "default": "final_failure_timeout",
+ "title": "When Failure Timeout",
+ "type": "string"
+ },
+ "failure_retries": {
+ "default": "final_failure_retries",
+ "title": "When Failure Retries",
+ "type": "string"
+ },
+ "failure_exception": {
+ "default": "final_failure_exception",
+ "title": "When Failure Exception",
+ "type": "string"
+ },
+ "failure_guard": {
+ "default": "final_failure_guard",
+ "title": "When Failure Guard",
+ "type": "string"
+ },
+ "target": {
+ "type": "object",
+ "required": [
+ "type",
+ "resourceID"
+ ],
+ "anyOf": [
+ {
+ "title": "User Defined",
+ "additionalProperties": "True",
+ "properties": {
+ "type": {
+ "title": "Target type",
+ "type": "string",
+ "default": "",
+ "enum": [
+ "VNF",
+ "VFMODULE",
+ "VM"
+ ]
+ },
+ "resourceID": {
+ "title": "Target type",
+ "type": "string",
+ "default": ""
+ }
+ }
+ },
+ {
+ "title": "VNF-vLoadBalancerMS 0",
+ "properties": {
+ "type": {
+ "title": "Type",
+ "type": "string",
+ "default": "VNF",
+ "readOnly": "True"
+ },
+ "resourceID": {
+ "title": "Resource ID",
+ "type": "string",
+ "default": "vLoadBalancerMS",
+ "readOnly": "True"
+ }
+ }
+ },
+ {
+ "title": "VFMODULE-Vloadbalancerms..vpkg..module-1",
+ "properties": {
+ "type": {
+ "title": "Type",
+ "type": "string",
+ "default": "VFMODULE",
+ "readOnly": "True"
+ },
+ "resourceID": {
+ "title": "Resource ID",
+ "type": "string",
+ "default": "Vloadbalancerms..vpkg..module-1",
+ "readOnly": "True"
+ },
+ "modelInvariantId": {
+ "title": "Model Invariant Id (ModelInvariantUUID)",
+ "type": "string",
+ "default": "ca052563-eb92-4b5b-ad41-9111768ce043",
+ "readOnly": "True"
+ },
+ "modelVersionId": {
+ "title": "Model Version Id (ModelUUID)",
+ "type": "string",
+ "default": "1e725ccc-b823-4f67-82b9-4f4367070dbc",
+ "readOnly": "True"
+ },
+ "modelName": {
+ "title": "Model Name",
+ "type": "string",
+ "default": "Vloadbalancerms..vpkg..module-1",
+ "readOnly": "True"
+ },
+ "modelVersion": {
+ "title": "Model Version",
+ "type": "string",
+ "default": "1",
+ "readOnly": "True"
+ },
+ "modelCustomizationId": {
+ "title": "Customization ID",
+ "type": "string",
+ "default": "1bffdc31-a37d-4dee-b65c-dde623a76e52",
+ "readOnly": "True"
+ }
+ }
+ },
+ {
+ "title": "VFMODULE-Vloadbalancerms..vdns..module-3",
+ "properties": {
+ "type": {
+ "title": "Type",
+ "type": "string",
+ "default": "VFMODULE",
+ "readOnly": "True"
+ },
+ "resourceID": {
+ "title": "Resource ID",
+ "type": "string",
+ "default": "Vloadbalancerms..vdns..module-3",
+ "readOnly": "True"
+ },
+ "modelInvariantId": {
+ "title": "Model Invariant Id (ModelInvariantUUID)",
+ "type": "string",
+ "default": "4c10ba9b-f88f-415e-9de3-5d33336047fa",
+ "readOnly": "True"
+ },
+ "modelVersionId": {
+ "title": "Model Version Id (ModelUUID)",
+ "type": "string",
+ "default": "4fa73b49-8a6c-493e-816b-eb401567b720",
+ "readOnly": "True"
+ },
+ "modelName": {
+ "title": "Model Name",
+ "type": "string",
+ "default": "Vloadbalancerms..vdns..module-3",
+ "readOnly": "True"
+ },
+ "modelVersion": {
+ "title": "Model Version",
+ "type": "string",
+ "default": "1",
+ "readOnly": "True"
+ },
+ "modelCustomizationId": {
+ "title": "Customization ID",
+ "type": "string",
+ "default": "bafcdab0-801d-4d81-9ead-f464640a38b1",
+ "readOnly": "True"
+ }
+ }
+ },
+ {
+ "title": "VFMODULE-Vloadbalancerms..base_template..module-0",
+ "properties": {
+ "type": {
+ "title": "Type",
+ "type": "string",
+ "default": "VFMODULE",
+ "readOnly": "True"
+ },
+ "resourceID": {
+ "title": "Resource ID",
+ "type": "string",
+ "default": "Vloadbalancerms..base_template..module-0",
+ "readOnly": "True"
+ },
+ "modelInvariantId": {
+ "title": "Model Invariant Id (ModelInvariantUUID)",
+ "type": "string",
+ "default": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3",
+ "readOnly": "True"
+ },
+ "modelVersionId": {
+ "title": "Model Version Id (ModelUUID)",
+ "type": "string",
+ "default": "63734409-f745-4e4d-a38b-131638a0edce",
+ "readOnly": "True"
+ },
+ "modelName": {
+ "title": "Model Name",
+ "type": "string",
+ "default": "Vloadbalancerms..base_template..module-0",
+ "readOnly": "True"
+ },
+ "modelVersion": {
+ "title": "Model Version",
+ "type": "string",
+ "default": "1",
+ "readOnly": "True"
+ },
+ "modelCustomizationId": {
+ "title": "Customization ID",
+ "type": "string",
+ "default": "86baddea-c730-4fb8-9410-cd2e17fd7f27",
+ "readOnly": "True"
+ }
+ }
+ },
+ {
+ "title": "VFMODULE-Vloadbalancerms..vlb..module-2",
+ "properties": {
+ "type": {
+ "title": "Type",
+ "type": "string",
+ "default": "VFMODULE",
+ "readOnly": "True"
+ },
+ "resourceID": {
+ "title": "Resource ID",
+ "type": "string",
+ "default": "Vloadbalancerms..vlb..module-2",
+ "readOnly": "True"
+ },
+ "modelInvariantId": {
+ "title": "Model Invariant Id (ModelInvariantUUID)",
+ "type": "string",
+ "default": "a772a1f4-0064-412c-833d-4749b15828dd",
+ "readOnly": "True"
+ },
+ "modelVersionId": {
+ "title": "Model Version Id (ModelUUID)",
+ "type": "string",
+ "default": "0f5c3f6a-650a-4303-abb6-fff3e573a07a",
+ "readOnly": "True"
+ },
+ "modelName": {
+ "title": "Model Name",
+ "type": "string",
+ "default": "Vloadbalancerms..vlb..module-2",
+ "readOnly": "True"
+ },
+ "modelVersion": {
+ "title": "Model Version",
+ "type": "string",
+ "default": "1",
+ "readOnly": "True"
+ },
+ "modelCustomizationId": {
+ "title": "Customization ID",
+ "type": "string",
+ "default": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806",
+ "readOnly": "True"
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ },
+ "guard_policies": {
+ "type": "array",
+ "format": "tabs-top",
+ "title": "Associated Guard policies",
+ "items": {
+ "headerTemplate": "{{self.policy-id}} - {{self.content.recipe}}",
+ "anyOf": [
+ {
+ "title": "Guard MinMax",
+ "type": "object",
+ "properties": {
+ "policy-id": {
+ "type": "string",
+ "default": "guard.minmax.new",
+ "pattern": "^(guard.minmax\\..*)$"
+ },
+ "content": {
+ "properties": {
+ "actor": {
+ "type": "string",
+ "enum": [
+ "APPC",
+ "SO",
+ "VFC",
+ "SDNC",
+ "SDNR"
+ ]
+ },
+ "recipe": {
+ "type": "string",
+ "enum": [
+ "Restart",
+ "Rebuild",
+ "Migrate",
+ "Health-Check",
+ "ModifyConfig",
+ "VF Module Create",
+ "VF Module Delete",
+ "Reroute"
+ ]
+ },
+ "targets": {
+ "type": "string",
+ "default": ".*"
+ },
+ "clname": {
+ "type": "string",
+ "template": "{{loopName}}",
+ "watch": {
+ "loopName": "operational_policy_item.configurationsJson.operational_policy.controlLoop.controlLoopName"
+ }
+ },
+ "guardActiveStart": {
+ "type": "string",
+ "default": "00:00:00Z"
+ },
+ "guardActiveEnd": {
+ "type": "string",
+ "default": "10:00:00Z"
+ },
+ "min": {
+ "type": "string",
+ "default": "0"
+ },
+ "max": {
+ "type": "string",
+ "default": "1"
+ }
+ }
+ }
+ }
+ },
+ {
+ "title": "Guard Frequency",
+ "type": "object",
+ "properties": {
+ "policy-id": {
+ "type": "string",
+ "default": "guard.frequency.new",
+ "pattern": "^(guard.frequency\\..*)$"
+ },
+ "content": {
+ "properties": {
+ "actor": {
+ "type": "string",
+ "enum": [
+ "APPC",
+ "SO",
+ "VFC",
+ "SDNC",
+ "SDNR"
+ ]
+ },
+ "recipe": {
+ "type": "string",
+ "enum": [
+ "Restart",
+ "Rebuild",
+ "Migrate",
+ "Health-Check",
+ "ModifyConfig",
+ "VF Module Create",
+ "VF Module Delete",
+ "Reroute"
+ ]
+ },
+ "targets": {
+ "type": "string",
+ "default": ".*"
+ },
+ "clname": {
+ "type": "string",
+ "template": "{{loopName}}",
+ "watch": {
+ "loopName": "operational_policy_item.configurationsJson.operational_policy.controlLoop.controlLoopName"
+ }
+ },
+ "guardActiveStart": {
+ "type": "string",
+ "default": "00:00:00Z"
+ },
+ "guardActiveEnd": {
+ "type": "string",
+ "default": "10:00:00Z"
+ },
+ "limit": {
+ "type": "string"
+ },
+ "timeWindow": {
+ "type": "string"
+ },
+ "timeUnits": {
+ "type": "string",
+ "enum": [
+ "minute",
+ "hour",
+ "day",
+ "week",
+ "month",
+ "year"
+ ]
+ }
+ }
+ }
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "globalPropertiesJson": {
+ "testname": "testvalue"
+ },
+ "modelService": {
+ "serviceDetails": {
+ "serviceType": "",
+ "namingPolicy": "",
+ "environmentContext": "General_Revenue-Bearing",
+ "serviceEcompNaming": "true",
+ "serviceRole": "",
+ "name": "vLoadBalancerMS",
+ "description": "vLBMS",
+ "invariantUUID": "30ec5b59-4799-48d8-ac5f-1058a6b0e48f",
+ "ecompGeneratedNaming": "true",
+ "category": "Network L4+",
+ "type": "Service",
+ "UUID": "63cac700-ab9a-4115-a74f-7eac85e3fce0",
+ "instantiationType": "A-la-carte"
+ },
+ "resourceDetails": {
+ "CP": {},
+ "VL": {},
+ "VF": {
+ "vLoadBalancerMS 0": {
+ "resourceVendor": "Test",
+ "resourceVendorModelNumber": "",
+ "name": "vLoadBalancerMS",
+ "description": "vLBMS",
+ "invariantUUID": "1a31b9f2-e50d-43b7-89b3-a040250cf506",
+ "subcategory": "Load Balancer",
+ "category": "Application L4+",
+ "type": "VF",
+ "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6",
+ "version": "1.0",
+ "resourceVendorRelease": "1.0",
+ "customizationUUID": "465246dc-7748-45f4-a013-308d92922552"
+ }
+ },
+ "CR": {},
+ "VFC": {},
+ "PNF": {},
+ "Service": {},
+ "CVFC": {},
+ "Service Proxy": {},
+ "Configuration": {},
+ "AllottedResource": {},
+ "VFModule": {
+ "Vloadbalancerms..vpkg..module-1": {
+ "vfModuleModelInvariantUUID": "ca052563-eb92-4b5b-ad41-9111768ce043",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vpkg..module-1",
+ "vfModuleModelUUID": "1e725ccc-b823-4f67-82b9-4f4367070dbc",
+ "vfModuleModelCustomizationUUID": "1bffdc31-a37d-4dee-b65c-dde623a76e52",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vpkg",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ },
+ "Vloadbalancerms..vdns..module-3": {
+ "vfModuleModelInvariantUUID": "4c10ba9b-f88f-415e-9de3-5d33336047fa",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vdns..module-3",
+ "vfModuleModelUUID": "4fa73b49-8a6c-493e-816b-eb401567b720",
+ "vfModuleModelCustomizationUUID": "bafcdab0-801d-4d81-9ead-f464640a38b1",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vdns",
+ "max_vf_module_instances": 50,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ },
+ "Vloadbalancerms..base_template..module-0": {
+ "vfModuleModelInvariantUUID": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..base_template..module-0",
+ "vfModuleModelUUID": "63734409-f745-4e4d-a38b-131638a0edce",
+ "vfModuleModelCustomizationUUID": "86baddea-c730-4fb8-9410-cd2e17fd7f27",
+ "min_vf_module_instances": 1,
+ "vf_module_label": "base_template",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Base",
+ "isBase": true,
+ "initial_count": 1,
+ "volume_group": false
+ },
+ "Vloadbalancerms..vlb..module-2": {
+ "vfModuleModelInvariantUUID": "a772a1f4-0064-412c-833d-4749b15828dd",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vlb..module-2",
+ "vfModuleModelUUID": "0f5c3f6a-650a-4303-abb6-fff3e573a07a",
+ "vfModuleModelCustomizationUUID": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vlb",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ }
+ }
+ }
+ },
+ "lastComputedState": "DESIGN",
+ "components": {
+ "POLICY": {
+ "componentState": {
+ "stateName": "UNKNOWN",
+ "description": "The current status is not clear. Need to regresh the status to get the current status."
+ }
+ },
+ "DCAE": {
+ "componentState": {
+ "stateName": "BLUEPRINT_DEPLOYED",
+ "description": "The DCAE blueprint has been found in the DCAE inventory but not yet instancianted for this loop"
+ }
+ }
+ },
+ "operationalPolicies": [],
+ "microServicePolicies": [],
+ "loopLogs": []
+}
diff --git a/src/test/resources/tosca/model-properties.json b/src/test/resources/tosca/model-properties.json
index 9e7db8ebc..e41471b16 100644
--- a/src/test/resources/tosca/model-properties.json
+++ b/src/test/resources/tosca/model-properties.json
@@ -16,10 +16,8 @@
},
"resourceDetails": {
"CP": {
-
},
"VL": {
-
},
"VF": {
"vLoadBalancerMS 0": {
@@ -38,28 +36,20 @@
}
},
"CR": {
-
},
"VFC": {
-
},
"PNF": {
-
},
"Service": {
-
},
"CVFC": {
-
},
"Service Proxy": {
-
},
"Configuration": {
-
},
"AllottedResource": {
-
},
"VFModule": {
"Vloadbalancerms..vpkg..module-1": {
diff --git a/src/test/resources/tosca/resource-details.json b/src/test/resources/tosca/resource-details.json
new file mode 100644
index 000000000..7b53f3972
--- /dev/null
+++ b/src/test/resources/tosca/resource-details.json
@@ -0,0 +1,96 @@
+{
+ "CP": {
+ },
+ "VL": {
+ },
+ "VF": {
+ "vLoadBalancerMS 0": {
+ "resourceVendor": "Test",
+ "resourceVendorModelNumber": "",
+ "name": "vLoadBalancerMS",
+ "description": "vLBMS",
+ "invariantUUID": "1a31b9f2-e50d-43b7-89b3-a040250cf506",
+ "subcategory": "Load Balancer",
+ "category": "Application L4+",
+ "type": "VF",
+ "UUID": "b4c4f3d7-929e-4b6d-a1cd-57e952ddc3e6",
+ "version": "1.0",
+ "resourceVendorRelease": "1.0",
+ "customizationUUID": "465246dc-7748-45f4-a013-308d92922552"
+ }
+ },
+ "CR": {
+ },
+ "VFC": {
+ },
+ "PNF": {
+ },
+ "Service": {
+ },
+ "CVFC": {
+ },
+ "Service Proxy": {
+ },
+ "Configuration": {
+ },
+ "AllottedResource": {
+ },
+ "VFModule": {
+ "Vloadbalancerms..vpkg..module-1": {
+ "vfModuleModelInvariantUUID": "ca052563-eb92-4b5b-ad41-9111768ce043",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vpkg..module-1",
+ "vfModuleModelUUID": "1e725ccc-b823-4f67-82b9-4f4367070dbc",
+ "vfModuleModelCustomizationUUID": "1bffdc31-a37d-4dee-b65c-dde623a76e52",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vpkg",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ },
+ "Vloadbalancerms..vdns..module-3": {
+ "vfModuleModelInvariantUUID": "4c10ba9b-f88f-415e-9de3-5d33336047fa",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vdns..module-3",
+ "vfModuleModelUUID": "4fa73b49-8a6c-493e-816b-eb401567b720",
+ "vfModuleModelCustomizationUUID": "bafcdab0-801d-4d81-9ead-f464640a38b1",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vdns",
+ "max_vf_module_instances": 50,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ },
+ "Vloadbalancerms..base_template..module-0": {
+ "vfModuleModelInvariantUUID": "921f7c96-ebdd-42e6-81b9-1cfc0c9796f3",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..base_template..module-0",
+ "vfModuleModelUUID": "63734409-f745-4e4d-a38b-131638a0edce",
+ "vfModuleModelCustomizationUUID": "86baddea-c730-4fb8-9410-cd2e17fd7f27",
+ "min_vf_module_instances": 1,
+ "vf_module_label": "base_template",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Base",
+ "isBase": true,
+ "initial_count": 1,
+ "volume_group": false
+ },
+ "Vloadbalancerms..vlb..module-2": {
+ "vfModuleModelInvariantUUID": "a772a1f4-0064-412c-833d-4749b15828dd",
+ "vfModuleModelVersion": "1",
+ "vfModuleModelName": "Vloadbalancerms..vlb..module-2",
+ "vfModuleModelUUID": "0f5c3f6a-650a-4303-abb6-fff3e573a07a",
+ "vfModuleModelCustomizationUUID": "96a78aad-4ffb-4ef0-9c4f-deb03bf1d806",
+ "min_vf_module_instances": 0,
+ "vf_module_label": "vlb",
+ "max_vf_module_instances": 1,
+ "vf_module_type": "Expansion",
+ "isBase": false,
+ "initial_count": 0,
+ "volume_group": false
+ }
+ }
+} \ No newline at end of file
diff --git a/src/test/resources/tosca/service-details.json b/src/test/resources/tosca/service-details.json
new file mode 100644
index 000000000..f41eec107
--- /dev/null
+++ b/src/test/resources/tosca/service-details.json
@@ -0,0 +1,15 @@
+{
+ "serviceType": "",
+ "namingPolicy": "",
+ "environmentContext": "General_Revenue-Bearing",
+ "serviceEcompNaming": "true",
+ "serviceRole": "",
+ "name": "vLoadBalancerMS",
+ "description": "vLBMS",
+ "invariantUUID": "30ec5b59-4799-48d8-ac5f-1058a6b0e48f",
+ "ecompGeneratedNaming": "true",
+ "category": "Network L4+",
+ "type": "Service",
+ "UUID": "63cac700-ab9a-4115-a74f-7eac85e3fce0",
+ "instantiationType": "A-la-carte"
+} \ No newline at end of file
diff --git a/ui-react/package.json b/ui-react/package.json
index 2d70e270e..73598ec5a 100644
--- a/ui-react/package.json
+++ b/ui-react/package.json
@@ -15,8 +15,7 @@
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
- "eject": "react-scripts eject",
- "publish": "npm publish"
+ "eject": "react-scripts eject"
},
"files": [
"src/*.js",
diff --git a/ui-react/src/LoopUI.js b/ui-react/src/LoopUI.js
index f767da9a6..58fbce635 100644
--- a/ui-react/src/LoopUI.js
+++ b/ui-react/src/LoopUI.js
@@ -36,17 +36,17 @@ import LoopCache from './api/LoopCache';
import LoopActionService from './api/LoopActionService';
import { Route } from 'react-router-dom'
-import OpenLoopModal from './components/dialogs/OpenLoop/OpenLoopModal';
+import OpenLoopModal from './components/dialogs/Loop/OpenLoopModal';
import OperationalPolicyModal from './components/dialogs/OperationalPolicy/OperationalPolicyModal';
import ConfigurationPolicyModal from './components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal';
-import LoopProperties from './components/dialogs/LoopProperties';
-import UserInfo from './components/dialogs/UserInfo';
+import LoopPropertiesModal from './components/dialogs/Loop/LoopPropertiesModal';
+import UserInfoModal from './components/dialogs/UserInfoModal';
import LoopService from './api/LoopService';
import ViewToscaPolicyModal from './components/dialogs/Tosca/ViewToscaPolicyModal';
import ViewBlueprintMicroServiceTemplatesModal from './components/dialogs/Tosca/ViewBlueprintMicroServiceTemplatesModal';
import PerformAction from './components/dialogs/PerformActions';
import RefreshStatus from './components/dialogs/RefreshStatus';
-import DeployLoop from './components/dialogs/DeployLoop';
+import DeployLoopModal from './components/dialogs/Loop/DeployLoopModal';
import Alert from 'react-bootstrap/Alert';
import { Link } from 'react-router-dom';
@@ -255,15 +255,15 @@ export default class LoopUI extends React.Component {
render={(routeProps) => (<OperationalPolicyModal {...routeProps} loopCache={this.getLoopCache()} loadLoopFunction={this.loadLoop} showAlert={this.showAlert}/>)} />
<Route path="/configurationPolicyModal/:componentName" render={(routeProps) => (<ConfigurationPolicyModal {...routeProps} loopCache={this.getLoopCache()} loadLoopFunction={this.loadLoop}/>)} />
<Route path="/openLoop" render={(routeProps) => (<OpenLoopModal {...routeProps} loadLoopFunction={this.loadLoop} />)} />
- <Route path="/loopProperties" render={(routeProps) => (<LoopProperties {...routeProps} loopCache={this.getLoopCache()} loadLoopFunction={this.loadLoop}/>)} />
- <Route path="/userInfo" render={(routeProps) => (<UserInfo {...routeProps} />)} />
+ <Route path="/loopProperties" render={(routeProps) => (<LoopPropertiesModal {...routeProps} loopCache={this.getLoopCache()} loadLoopFunction={this.loadLoop}/>)} />
+ <Route path="/userInfo" render={(routeProps) => (<UserInfoModal {...routeProps} />)} />
<Route path="/closeLoop" render={this.closeLoop} />
<Route path="/submit" render={(routeProps) => (<PerformAction {...routeProps} loopAction="submit" loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache} showAlert={this.showAlert}/>)} />
<Route path="/stop" render={(routeProps) => (<PerformAction {...routeProps} loopAction="stop" loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache} showAlert={this.showAlert}/>)} />
<Route path="/restart" render={(routeProps) => (<PerformAction {...routeProps} loopAction="restart" loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache} showAlert={this.showAlert}/>)} />
<Route path="/delete" render={(routeProps) => (<PerformAction {...routeProps} loopAction="delete" loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache} showAlert={this.showAlert}/>)} />
<Route path="/undeploy" render={(routeProps) => (<PerformAction {...routeProps} loopAction="undeploy" loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache} showAlert={this.showAlert}/>)} />
- <Route path="/deploy" render={(routeProps) => (<DeployLoop {...routeProps} loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache} showAlert={this.showAlert}/>)} />
+ <Route path="/deploy" render={(routeProps) => (<DeployLoopModal {...routeProps} loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache} showAlert={this.showAlert}/>)} />
<Route path="/refreshStatus" render={(routeProps) => (<RefreshStatus {...routeProps} loopCache={this.getLoopCache()} updateLoopFunction={this.updateLoopCache} showAlert={this.showAlert}/>)} />
<Route path="/logout" render={this.logout} />
<GlobalClampStyle />
diff --git a/ui-react/src/api/LoopCache.js b/ui-react/src/api/LoopCache.js
index dd8c5b520..95eb9310e 100644
--- a/ui-react/src/api/LoopCache.js
+++ b/ui-react/src/api/LoopCache.js
@@ -99,11 +99,11 @@ export default class LoopCache {
}
getResourceDetailsVfProperty() {
- return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VF"];
+ return this.loopJsonCache["modelService"]["resourceDetails"]["VF"];
}
getResourceDetailsVfModuleProperty() {
- return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VFModule"];
+ return this.loopJsonCache["modelService"]["resourceDetails"]["VFModule"];
}
getLoopLogsArray() {
diff --git a/ui-react/src/api/LoopCache_mokeLoopJsonCache.json b/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
index 184eaf7cd..c84b5b691 100644
--- a/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
+++ b/ui-react/src/api/LoopCache_mokeLoopJsonCache.json
@@ -8,7 +8,7 @@
"policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
}
},
- "modelPropertiesJson": {
+ "modelService": {
"serviceDetails": {
"serviceType": "",
"namingPolicy": "",
diff --git a/ui-react/src/api/example.json b/ui-react/src/api/example.json
index 108cf78e2..7b9a95a23 100644
--- a/ui-react/src/api/example.json
+++ b/ui-react/src/api/example.json
@@ -8,7 +8,7 @@
"policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
}
},
- "modelPropertiesJson": {
+ "modelService": {
"serviceDetails": {
"serviceType": "",
"namingPolicy": "",
diff --git a/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.test.js b/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.test.js
index e0aa8c6b0..4fa08e680 100644
--- a/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.test.js
+++ b/ui-react/src/components/dialogs/ConfigurationPolicy/ConfigurationPolicyModal.test.js
@@ -26,7 +26,7 @@ import ConfigurationPolicyModal from './ConfigurationPolicyModal';
import LoopCache from '../../../api/LoopCache';
-describe('Verify DeployLoop', () => {
+describe('Verify ConfigurationPolicyModal', () => {
beforeEach(() => {
fetch.resetMocks();
fetch.mockImplementation(() => {
diff --git a/ui-react/src/components/dialogs/DeployLoop.js b/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
index d71af9240..34304d611 100644
--- a/ui-react/src/components/dialogs/DeployLoop.js
+++ b/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
@@ -21,8 +21,8 @@
*
*/
import React from 'react';
-import LoopActionService from '../../api/LoopActionService';
-import LoopService from '../../api/LoopService';
+import LoopActionService from '../../../api/LoopActionService';
+import LoopService from '../../../api/LoopService';
import Button from 'react-bootstrap/Button';
import Modal from 'react-bootstrap/Modal';
import Form from 'react-bootstrap/Form';
@@ -34,7 +34,7 @@ const ModalStyled = styled(Modal)`
const FormStyled = styled(Form.Group)`
padding: .25rem 1.5rem;
`
-export default class DeployLoop extends React.Component {
+export default class DeployLoopModal extends React.Component {
state = {
loopCache: this.props.loopCache,
temporaryPropertiesJson: JSON.parse(JSON.stringify(this.props.loopCache.getGlobalProperties())),
diff --git a/ui-react/src/components/dialogs/DeployLoop.test.js b/ui-react/src/components/dialogs/Loop/DeployLoopModal.test.js
index 44bc78379..2ebb8c067 100644
--- a/ui-react/src/components/dialogs/DeployLoop.test.js
+++ b/ui-react/src/components/dialogs/Loop/DeployLoopModal.test.js
@@ -22,12 +22,12 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
-import DeployLoop from './DeployLoop';
-import LoopCache from '../../api/LoopCache';
-import LoopActionService from '../../api/LoopActionService';
-import LoopService from '../../api/LoopService';
+import DeployLoopModal from './DeployLoopModal';
+import LoopCache from '../../../api/LoopCache';
+import LoopActionService from '../../../api/LoopActionService';
+import LoopService from '../../../api/LoopService';
-describe('Verify DeployLoop', () => {
+describe('Verify DeployLoopModal', () => {
const loopCache = new LoopCache({
"name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
"globalPropertiesJson": {
@@ -40,7 +40,7 @@ describe('Verify DeployLoop', () => {
it('Test the render method', () => {
const component = shallow(
- <DeployLoop loopCache={loopCache}/>
+ <DeployLoopModal loopCache={loopCache}/>
)
expect(component).toMatchSnapshot();
@@ -48,8 +48,8 @@ describe('Verify DeployLoop', () => {
it('Test handleClose', () => {
const historyMock = { push: jest.fn() };
- const handleClose = jest.spyOn(DeployLoop.prototype,'handleClose');
- const component = shallow(<DeployLoop history={historyMock} loopCache={loopCache}/>)
+ const handleClose = jest.spyOn(DeployLoopModal.prototype,'handleClose');
+ const component = shallow(<DeployLoopModal history={historyMock} loopCache={loopCache}/>)
component.find('[variant="secondary"]').prop('onClick')();
@@ -62,7 +62,7 @@ describe('Verify DeployLoop', () => {
const historyMock = { push: jest.fn() };
const updateLoopFunction = jest.fn();
const showAlert = jest.fn();
- const handleSave = jest.spyOn(DeployLoop.prototype,'handleSave');
+ const handleSave = jest.spyOn(DeployLoopModal.prototype,'handleSave');
LoopService.updateGlobalProperties = jest.fn().mockImplementation(() => {
return Promise.resolve({
ok: true,
@@ -85,7 +85,7 @@ describe('Verify DeployLoop', () => {
});
});
- const component = shallow(<DeployLoop history={historyMock}
+ const component = shallow(<DeployLoopModal history={historyMock}
loopCache={loopCache} updateLoopFunction={updateLoopFunction} showAlert={showAlert} />)
component.find('[variant="primary"]').prop('onClick')();
@@ -100,7 +100,7 @@ describe('Verify DeployLoop', () => {
it('Onchange event', () => {
const event = { target: { name: "location_id", value: "testLocation"} };
- const component = shallow(<DeployLoop loopCache={loopCache}/>);
+ const component = shallow(<DeployLoopModal loopCache={loopCache}/>);
const forms = component.find('StateManager');
component.find('[name="location_id"]').simulate('change', event);
diff --git a/ui-react/src/components/dialogs/LoopProperties.js b/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.js
index 990fe7754..73946f45d 100644
--- a/ui-react/src/components/dialogs/LoopProperties.js
+++ b/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.js
@@ -25,12 +25,12 @@ import Button from 'react-bootstrap/Button';
import Modal from 'react-bootstrap/Modal';
import Form from 'react-bootstrap/Form';
import styled from 'styled-components';
-import LoopService from '../../api/LoopService';
+import LoopService from '../../../api/LoopService';
const ModalStyled = styled(Modal)`
background-color: transparent;
`
-export default class LoopProperties extends React.Component {
+export default class LoopPropertiesModal extends React.Component {
state = {
show: true,
diff --git a/ui-react/src/components/dialogs/LoopProperties.test.js b/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.test.js
index 9b74fe76a..5bbefe228 100644
--- a/ui-react/src/components/dialogs/LoopProperties.test.js
+++ b/ui-react/src/components/dialogs/Loop/LoopPropertiesModal.test.js
@@ -22,11 +22,11 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
-import LoopProperties from './LoopProperties';
-import LoopCache from '../../api/LoopCache';
-import LoopService from '../../api/LoopService';
+import LoopPropertiesModal from './LoopPropertiesModal';
+import LoopCache from '../../../api/LoopCache';
+import LoopService from '../../../api/LoopService';
-describe('Verify LoopProperties', () => {
+describe('Verify LoopPropertiesModal', () => {
const loopCache = new LoopCache({
"name": "LOOP_Jbv1z_v1_0_ResourceInstanceName1_tca",
"globalPropertiesJson": {
@@ -39,7 +39,7 @@ describe('Verify LoopProperties', () => {
it('Test the render method', () => {
const component = shallow(
- <LoopProperties loopCache={loopCache}/>
+ <LoopPropertiesModal loopCache={loopCache}/>
)
component.setState({ show: true,
temporaryPropertiesJson: {
@@ -62,8 +62,8 @@ describe('Verify LoopProperties', () => {
it('Test handleClose', () => {
const historyMock = { push: jest.fn() };
- const handleClose = jest.spyOn(LoopProperties.prototype,'handleClose');
- const component = shallow(<LoopProperties history={historyMock} loopCache={loopCache}/>)
+ const handleClose = jest.spyOn(LoopPropertiesModal.prototype,'handleClose');
+ const component = shallow(<LoopPropertiesModal history={historyMock} loopCache={loopCache}/>)
component.find('[variant="secondary"]').prop('onClick')();
@@ -75,7 +75,7 @@ describe('Verify LoopProperties', () => {
const flushPromises = () => new Promise(setImmediate);
const historyMock = { push: jest.fn() };
const loadLoopFunction = jest.fn();
- const handleSave = jest.spyOn(LoopProperties.prototype,'handleSave');
+ const handleSave = jest.spyOn(LoopPropertiesModal.prototype,'handleSave');
LoopService.updateGlobalProperties = jest.fn().mockImplementation(() => {
return Promise.resolve({
ok: true,
@@ -84,7 +84,7 @@ describe('Verify LoopProperties', () => {
});
});
- const component = shallow(<LoopProperties history={historyMock}
+ const component = shallow(<LoopPropertiesModal history={historyMock}
loopCache={loopCache} loadLoopFunction={loadLoopFunction} />)
component.find('[variant="primary"]').prop('onClick')();
@@ -98,7 +98,7 @@ describe('Verify LoopProperties', () => {
it('Onchange event', () => {
const event = {target:{name:"dcaeDeployParameters", value:"{\"location_id\": \"testLocation\",\"policy_id\": \"TCA_h2NMX_v1_0_ResourceInstanceName1_tca\"}"}};
- const component = shallow(<LoopProperties loopCache={loopCache}/>);
+ const component = shallow(<LoopPropertiesModal loopCache={loopCache}/>);
component.find('FormControl').simulate('change', event);
component.update();
diff --git a/ui-react/src/components/dialogs/OpenLoop/OpenLoopModal.js b/ui-react/src/components/dialogs/Loop/OpenLoopModal.js
index fbfc727eb..fbfc727eb 100644
--- a/ui-react/src/components/dialogs/OpenLoop/OpenLoopModal.js
+++ b/ui-react/src/components/dialogs/Loop/OpenLoopModal.js
diff --git a/ui-react/src/components/dialogs/OpenLoop/OpenLoopModal.test.js b/ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js
index 208c947c3..208c947c3 100644
--- a/ui-react/src/components/dialogs/OpenLoop/OpenLoopModal.test.js
+++ b/ui-react/src/components/dialogs/Loop/OpenLoopModal.test.js
diff --git a/ui-react/src/components/dialogs/__snapshots__/DeployLoop.test.js.snap b/ui-react/src/components/dialogs/Loop/__snapshots__/DeployLoopModal.test.js.snap
index 1fd4b1047..bf06965be 100644
--- a/ui-react/src/components/dialogs/__snapshots__/DeployLoop.test.js.snap
+++ b/ui-react/src/components/dialogs/Loop/__snapshots__/DeployLoopModal.test.js.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Verify DeployLoop Test the render method 1`] = `
+exports[`Verify DeployLoopModal Test the render method 1`] = `
<Styled(Bootstrap(Modal))
onHide={[Function]}
show={true}
diff --git a/ui-react/src/components/dialogs/__snapshots__/LoopProperties.test.js.snap b/ui-react/src/components/dialogs/Loop/__snapshots__/LoopPropertiesModal.test.js.snap
index c7e81c392..fe9aee2ab 100644
--- a/ui-react/src/components/dialogs/__snapshots__/LoopProperties.test.js.snap
+++ b/ui-react/src/components/dialogs/Loop/__snapshots__/LoopPropertiesModal.test.js.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Verify LoopProperties Test the render method 1`] = `
+exports[`Verify LoopPropertiesModal Test the render method 1`] = `
<Styled(Bootstrap(Modal))
onHide={[Function]}
show={true}
diff --git a/ui-react/src/components/dialogs/OpenLoop/__snapshots__/OpenLoopModal.test.js.snap b/ui-react/src/components/dialogs/Loop/__snapshots__/OpenLoopModal.test.js.snap
index 9e7222415..9e7222415 100644
--- a/ui-react/src/components/dialogs/OpenLoop/__snapshots__/OpenLoopModal.test.js.snap
+++ b/ui-react/src/components/dialogs/Loop/__snapshots__/OpenLoopModal.test.js.snap
diff --git a/ui-react/src/components/dialogs/UserInfo.js b/ui-react/src/components/dialogs/UserInfoModal.js
index 7d81b38b3..1273d87c0 100644
--- a/ui-react/src/components/dialogs/UserInfo.js
+++ b/ui-react/src/components/dialogs/UserInfoModal.js
@@ -33,7 +33,7 @@ const ModalStyled = styled(Modal)`
background-color: transparent;
`
-export default class UserInfo extends React.Component {
+export default class UserInfoModal extends React.Component {
constructor(props, context) {
super(props, context);
diff --git a/ui-react/src/components/dialogs/UserInfo.test.js b/ui-react/src/components/dialogs/UserInfoModal.test.js
index beddde148..b5a2b272e 100644
--- a/ui-react/src/components/dialogs/UserInfo.test.js
+++ b/ui-react/src/components/dialogs/UserInfoModal.test.js
@@ -22,9 +22,9 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
-import UserInfo from './UserInfo';
+import UserInfoModal from './UserInfoModal';
-describe('Verify UserInfo', () => {
+describe('Verify UserInfoModal', () => {
beforeEach(() => {
fetch.resetMocks();
@@ -42,7 +42,7 @@ describe('Verify UserInfo', () => {
})
it('Test the render method full permission', () => {
- const component = shallow(<UserInfo />)
+ const component = shallow(<UserInfoModal />)
component.setState({ userInfo: {
"userName": "test",
"cldsVersion": "1.0.0",
@@ -57,7 +57,7 @@ describe('Verify UserInfo', () => {
});
it('Test the render method no permission', () => {
- const component = shallow(<UserInfo />)
+ const component = shallow(<UserInfoModal />)
component.setState({ userInfo: {}
});
@@ -65,7 +65,7 @@ describe('Verify UserInfo', () => {
});
it('Test the render method read permission', () => {
- const component = shallow(<UserInfo />)
+ const component = shallow(<UserInfoModal />)
component.setState({ userInfo: {
"userName": "test",
"cldsVersion": "1.0.0",
diff --git a/ui-react/src/components/dialogs/__snapshots__/UserInfo.test.js.snap b/ui-react/src/components/dialogs/__snapshots__/UserInfoModal.test.js.snap
index 1ae567a2d..fdb24a430 100644
--- a/ui-react/src/components/dialogs/__snapshots__/UserInfo.test.js.snap
+++ b/ui-react/src/components/dialogs/__snapshots__/UserInfoModal.test.js.snap
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`Verify UserInfo Test the render method full permission 1`] = `
+exports[`Verify UserInfoModal Test the render method full permission 1`] = `
<Styled(Bootstrap(Modal))
onHide={[Function]}
show={true}