summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavi Mantena <rx908f@att.com>2020-12-21 11:31:55 -0500
committerRavi Mantena <rx908f@att.com>2020-12-21 11:32:34 -0500
commita520d00e005db1b232b9dae0c70d4dc5d73b33e1 (patch)
tree9c0e16ce5fab9bc12da138c4d8c613bcff54516b
parent2f551ba584dbb70568a69144b39e6da7c55c517f (diff)
BpGen refactor Code Quality Issue-ID: DCAEGEN2-2502
Issue-ID: DCAEGEN2-2502 Change-Id: If6e08f0bb88c9039fb27898d50d2645f79175ba4 Signed-off-by: Ravi Mantena <rx908f@att.com>
-rw-r--r--mod/bpgenerator/common/pom.xml7
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/config/ObjectMapperConfig.java20
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java19
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/BlueprintException.java10
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/ComponentSpecException.java10
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java10
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/FixesException.java10
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Blueprint.java16
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Node.java11
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java13
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Concat.java11
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/DataRouter.java11
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java21
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetInput.java17
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetProperty.java8
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Imports.java10
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Input.java10
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/MessageRouter.java8
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/Auxilary.java33
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/ComponentSpec.java9
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Artifacts.java13
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Calls.java16
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Constraints.java26
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Container.java12
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/EntrySchema.java22
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/HealthCheck.java22
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Host.java13
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Parameters.java33
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Policy.java13
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/PolicySchema.java25
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Provides.java19
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Publishes.java21
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Reconfigs.java18
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/RequestResponse.java14
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Self.java17
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Streams.java14
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Subscribes.java20
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Volumes.java22
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policies.java22
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesNode.java10
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesProperties.java10
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policy.java11
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyFilter.java18
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyInput.java12
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyNode.java10
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyProperties.java10
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/translate/GetProperty.java10
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java251
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintService.java261
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/FixesService.java284
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/policycreate/exception/PolicyCreateException.java15
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModel.java11
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModelNode.java15
-rw-r--r--mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyProperties.java17
-rw-r--r--mod/bpgenerator/onap/models/Test_Parameters.yml23
-rw-r--r--mod/bpgenerator/onap/pom.xml8
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java51
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalCertificateParameters.java8
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalTlsInfo.java8
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/GetAttribute.java9
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Info.java22
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Interfaces.java11
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Node.java7
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/OnapBlueprint.java10
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNode.java9
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNodeProperties.java8
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModel.java15
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModelNode.java12
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNode.java9
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNodeProperties.java8
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyProperties.java14
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Properties.java48
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ResourceConfig.java14
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Services.java16
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Start.java10
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/StartInputs.java10
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapAuxilary.java8
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapComponentSpec.java8
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/PolicyInfo.java8
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/Services.java15
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/TypePolicy.java8
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/Streams.java35
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/TlsInfo.java8
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java51
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/OnapBlueprintService.java40
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java86
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/CommonUtils.java150
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java10
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/DmaapService.java73
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateDataFactoryService.java14
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateParametersFactoryService.java44
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalTlsInfoFactoryService.java48
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ImportsService.java24
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/InterfacesService.java22
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/NodeService.java139
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PgaasNodeService.java82
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java38
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PropertiesService.java180
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/QuotationService.java21
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java27
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartInputsService.java37
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartService.java24
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/DmaapBlueprintService.java197
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/StreamsService.java34
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelNodeService.java86
-rw-r--r--mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelService.java29
-rw-r--r--mod/bpgenerator/onap/src/main/resources/application.properties4
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java13
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java28
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java122
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java59
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java481
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java28
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java309
-rw-r--r--mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java150
-rw-r--r--mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsFalseAndExternalTlsFalse.json79
-rw-r--r--mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndExternalTlsTrue.json79
-rw-r--r--mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndNoExternalTls.json77
-rw-r--r--mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withoutTlsInfo.json69
-rw-r--r--mod/bpgenerator/onap/src/test/resources/componentspecs/ves.json58
-rw-r--r--mod/bpgenerator/onap/src/test/resources/policyjson/policyInput.json52
-rw-r--r--mod/bpgenerator/onap/version.properties1
-rw-r--r--mod/bpgenerator/pom.xml40
123 files changed, 2985 insertions, 2111 deletions
diff --git a/mod/bpgenerator/common/pom.xml b/mod/bpgenerator/common/pom.xml
index 7f3a622..a0078c2 100644
--- a/mod/bpgenerator/common/pom.xml
+++ b/mod/bpgenerator/common/pom.xml
@@ -23,8 +23,8 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>blueprint-generator-common</artifactId>
@@ -32,7 +32,8 @@
<packaging>jar</packaging>
<name>Common</name>
- <description>This module is used by DCAE and ONAP Applications to generate Blueprints</description>
+ <description>This module is used by DCAE and ONAP Applications to generate Blueprints
+ </description>
<parent>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/config/ObjectMapperConfig.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/config/ObjectMapperConfig.java
index fc546af..5fc646f 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/config/ObjectMapperConfig.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/config/ObjectMapperConfig.java
@@ -42,16 +42,22 @@ import org.springframework.context.annotation.Scope;
@Configuration
public class ObjectMapperConfig {
- @Bean(name="objectMapper")
+ /**
+ * Creates Object Mapper
+ */
+ @Bean(name = "objectMapper")
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
- public ObjectMapper objectMapper(){
+ public ObjectMapper objectMapper() {
return new ObjectMapper();
}
- @Bean(name="yamlObjectMapper")
+ /**
+ * Creates Yaml Object Mapper
+ */
+ @Bean(name = "yamlObjectMapper")
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
- public ObjectMapper yamlObjectMapper(){
- return new ObjectMapper(new YAMLFactory().configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true));
+ public ObjectMapper yamlObjectMapper() {
+ return new ObjectMapper(
+ new YAMLFactory().configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true));
}
-
-} \ No newline at end of file
+}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java
index db12c37..ac654a2 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/constants/Constants.java
@@ -28,7 +28,7 @@ package org.onap.blueprintgenerator.constants;
* @date 10/16/2020
* Application: DCAE/ONAP - Blueprint Generator
* Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Constants: Used in ONAP and DCAE Blueprints
+ * Constants: Used in ONAP Blueprints
*/
public class Constants {
@@ -46,7 +46,8 @@ public class Constants {
public static final String BOOLEAN_TYPE = "boolean";
public static final String STRING_TYPE = "string";
public static final String EMPTY_VALUE = "";
- public static final String DCAE_NODES_CONTAINERIZED_SERVICE_COMPONENT_USING_DMAAP = "dcae.nodes.ContainerizedServiceComponentUsingDmaap";
+ public static final String DCAE_NODES_CONTAINERIZED_SERVICE_COMPONENT_USING_DMAAP =
+ "dcae.nodes.ContainerizedServiceComponentUsingDmaap";
public static final String MEMORY_LIMIT_128Mi = "128Mi";
public static final String CPU_LIMIT_250m = "250m";
public static final String CPU_LIMIT = "cpu_limit";
@@ -56,7 +57,8 @@ public class Constants {
public static final String CLOUDIFY_INTERFACES_LEFECYCLE = "cloudify.interfaces.lifecycle";
public static final String DCAE = "dcae";
- public static final String DCAE_NODES_CONTAINERIZED_SERVICE_COMPONENT = "dcae.nodes.ContainerizedServiceComponent";
+ public static final String DCAE_NODES_CONTAINERIZED_SERVICE_COMPONENT =
+ "dcae.nodes.ContainerizedServiceComponent";
public static final String ONAP_NAME_DCAE = "DCAE";
public static final String POLICIES_POLICYNAME_DCAECONFIG = "DCAE.Config_";
@@ -69,11 +71,12 @@ public class Constants {
public static final String WRITER_FQDN_POSTFIX = "_database_writerfqdn";
public static final boolean USE_EXISTING = true;
public static final String ONAP_INPUT_CPU_LIMIT = "dcae-ves-collector_cpu_limit";
- public static final String ONAP_NODETEMPLATES = "dcae-ves-collector";
- public static final String ONAP_NODETEMPLATES_TYPE = "dcae.nodes.ContainerizedServiceComponent";
+ public static final String ONAP_NODETEMPLATES = "dcae-ves-collector";
+ public static final String ONAP_NODETEMPLATES_TYPE = "dcae.nodes.ContainerizedServiceComponent";
public static final String ONAP_DEFAULT250m = "\"250m\"";
public static final String ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT = "\"\"";
- public static final String DMAAP_NODETEMPLATES_TYPE = "dcae.nodes.ContainerizedServiceComponentUsingDmaap";
+ public static final String DMAAP_NODETEMPLATES_TYPE =
+ "dcae.nodes.ContainerizedServiceComponentUsingDmaap";
public static final String USE_EXTERNAL_TLS_FIELD = "use_external_tls";
public static final String DEFAULT_CA = "RA";
public static final Object DEFAULT_CERT_TYPE = "P12";
@@ -81,7 +84,8 @@ public class Constants {
public static final String EXTERNAL_CERT_DIRECTORY_FIELD = "external_cert_directory";
public static final String CA_NAME_FIELD = "ca_name";
public static final String CERT_TYPE_FIELD = "cert_type";
- public static final String EXTERNAL_CERTIFICATE_PARAMETERS_FIELD = "external_certificate_parameters";
+ public static final String EXTERNAL_CERTIFICATE_PARAMETERS_FIELD =
+ "external_certificate_parameters";
public static final String CERT_DIRECTORY_FIELD = "cert_directory";
public static final String COMMON_NAME_FIELD = "common_name";
public static final String SANS_FIELD = "sans";
@@ -96,5 +100,4 @@ public class Constants {
public static final String TOSCA_DATATYPES_ROOT = "tosca.datatypes.Root";
public static final String TOSCA_NODES_ROOT = "tosca.nodes.Root";
public static final String TOSCA_SIMPLE_YAML = "tosca_simple_yaml_1_0_0";
-
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/BlueprintException.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/BlueprintException.java
index f6ed5c7..747e327 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/BlueprintException.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/BlueprintException.java
@@ -28,15 +28,21 @@ package org.onap.blueprintgenerator.exception;
* @date 10/16/2020
* Application: DCAE/ONAP - Blueprint Generator
* Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Exception: For Blueprint
+ * Exception: To handle error messages for Blueprint
*/
-public class BlueprintException extends RuntimeException{
+public class BlueprintException extends RuntimeException {
+ /**
+ * Handles Blueprint Exception for Error Message
+ */
public BlueprintException(String errorMessage) {
super(errorMessage);
}
+ /**
+ * Handles Blueprint Exception for Error Message and Error
+ */
public BlueprintException(String errorMessage, Throwable err) {
super(errorMessage, err);
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/ComponentSpecException.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/ComponentSpecException.java
index ff0270e..e24af19 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/ComponentSpecException.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/ComponentSpecException.java
@@ -28,15 +28,21 @@ package org.onap.blueprintgenerator.exception;
* @date 10/16/2020
* Application: DCAE/ONAP - Blueprint Generator
* Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Exception: For ComponentSpec
+ * Exception: To handle error messages for ComponentSpec
*/
-public class ComponentSpecException extends RuntimeException{
+public class ComponentSpecException extends RuntimeException {
+ /**
+ * Handles Component Specification Exception for Error Message
+ */
public ComponentSpecException(String errorMessage) {
super(errorMessage);
}
+ /**
+ * Handles Component Specification Exception for Error Message and Error
+ */
public ComponentSpecException(String errorMessage, Throwable err) {
super(errorMessage, err);
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java
index 423da79..2a441bd 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/DatabasesNotFoundException.java
@@ -28,11 +28,15 @@ package org.onap.blueprintgenerator.exception;
* @date 10/16/2020
* Application: DCAE/ONAP - Blueprint Generator
* Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Exception: For Databases Not Found
+ * Exception: To handle error messages for Databases Not Found
*/
public class DatabasesNotFoundException extends RuntimeException {
- public DatabasesNotFoundException(String message) { super(message);}
-
+ /**
+ * Handles Databases NotFound Exception for Error Message
+ */
+ public DatabasesNotFoundException(String message) {
+ super(message);
+ }
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/FixesException.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/FixesException.java
index aa81ede..87c46b5 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/FixesException.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/exception/FixesException.java
@@ -28,15 +28,21 @@ package org.onap.blueprintgenerator.exception;
* @date 10/16/2020
* Application: DCAE/ONAP - Blueprint Generator
* Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Exception: For Fixes
+ * Exception: To handle error messages for Fixes
*/
-public class FixesException extends RuntimeException{
+public class FixesException extends RuntimeException {
+ /**
+ * Handles Fixes NotFound Exception for Error Message
+ */
public FixesException(String errorMessage) {
super(errorMessage);
}
+ /**
+ * Handles Fixes Exception for Error Message and Error
+ */
public FixesException(String errorMessage, Throwable err) {
super(errorMessage, err);
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Blueprint.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Blueprint.java
index a72a00d..03215cf 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Blueprint.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Blueprint.java
@@ -33,23 +33,19 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Base Model: For Blueprint
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Base Model: A model class which represents base Blueprint
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Blueprint {
- private String tosca_definitions_version;
-
- private String description;
+ private String tosca_definitions_version;
- private List<String> imports;
+ private String description;
- private Map<String, LinkedHashMap<String, Object>> inputs;
+ private List<String> imports;
+ private Map<String, LinkedHashMap<String, Object>> inputs;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Node.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Node.java
index c3df820..3f76bb6 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Node.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/base/Node.java
@@ -23,24 +23,19 @@
package org.onap.blueprintgenerator.model.base;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Base Model: For Node
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Base Model: A model class which represents Base Node
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Node {
- private String type;
-
+ private String type;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java
index 3a18b70..5b3cdc6 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Appconfig.java
@@ -33,12 +33,9 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Common Model: For App Config
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Common Model: A model class which represents App Config
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -52,13 +49,11 @@ public class Appconfig {
private Map<String, Object> params;
- @JsonAnyGetter //The Map is persisted as flattened properties of the target POJO.
+ @JsonAnyGetter // The Map is persisted as flattened properties of the target POJO.
public Map<String, Object> getParams() {
return params;
}
- //Used in ONAP
+ // Used in ONAP
private Calls[] service_calls;
-
}
-
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Concat.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Concat.java
index d3b3c01..bf3726d 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Concat.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Concat.java
@@ -31,18 +31,13 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Common Model: For Concat
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Common Model: A model class which represents for Concat
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Concat {
- private List<Object> concat;
-
+ private List<Object> concat;
}
-
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/DataRouter.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/DataRouter.java
index 49e029f..203ddd5 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/DataRouter.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/DataRouter.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.model.common;
-
import org.onap.blueprintgenerator.constants.Constants;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
@@ -31,17 +30,13 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Common Model: For Data Router
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Common Model: A model class which represents Data Router
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class DataRouter extends Dmaap {
- private String type = Constants.DATA_ROUTER;
-
+ private String type = Constants.DATA_ROUTER;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java
index de3b31e..7ed79b3 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Dmaap.java
@@ -23,31 +23,26 @@
package org.onap.blueprintgenerator.model.common;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Common Model: For Dmaap
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Common Model: A model class which represents Dmaap
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Dmaap {
- private Object dmaap_info;
-
- //Below properties are used in ONAP
- private String type;
+ private Object dmaap_info;
- private GetInput pass;
+ // Below properties are used in ONAP
+ private String type;
- private GetInput user;
+ private GetInput pass;
-} \ No newline at end of file
+ private GetInput user;
+}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetInput.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetInput.java
index cc87014..57dab04 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetInput.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetInput.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.model.common;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -33,12 +32,9 @@ import lombok.NoArgsConstructor;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Common Model: For Get Input
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Common Model: A model class which represents Get Input
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -46,9 +42,8 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
public class GetInput {
- //private Object get_input;
-
- @JsonProperty("get_input")
- private Object bpInputName;
+ // private Object get_input;
-} \ No newline at end of file
+ @JsonProperty("get_input")
+ private Object bpInputName;
+}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetProperty.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetProperty.java
index 0514d20..2fe5c55 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetProperty.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/GetProperty.java
@@ -31,17 +31,13 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Common Model: For Get Property
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Common Model: A model class which represents Get Property
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class GetProperty {
private List<String> get_property;
-
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Imports.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Imports.java
index eacf20e..bbeb03f 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Imports.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Imports.java
@@ -30,16 +30,12 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Common Model: For Imports
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Common Model: A model class which represents Imports
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class Imports {
- private List<String> imports;
-
+ private List<String> imports;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Input.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Input.java
index 781ce2e..0f5baf8 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Input.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/Input.java
@@ -31,12 +31,9 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Common Model: For Input
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Common Model: A model class which represents Input
*/
-
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -64,9 +61,8 @@ public class Input {
private boolean useDti;
- //Used in ONAP
+ // Used in ONAP
private String serviceNameOverride;
private String importPath;
-
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/MessageRouter.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/MessageRouter.java
index 7d96785..82cfe00 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/MessageRouter.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/common/MessageRouter.java
@@ -30,12 +30,9 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Common Model: For Message Router
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Common Model: A model class which represents Message Router
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -46,5 +43,4 @@ public class MessageRouter extends Dmaap {
private Object aaf_password;
private Object aaf_username;
-
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/Auxilary.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/Auxilary.java
index 9c37163..4bfc633 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/Auxilary.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/Auxilary.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.model.componentspec.base;
-
import org.onap.blueprintgenerator.model.componentspec.common.HealthCheck;
import org.onap.blueprintgenerator.model.componentspec.common.Policy;
import org.onap.blueprintgenerator.model.componentspec.common.Reconfigs;
@@ -39,36 +38,32 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Auxilary
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Auxilary of
+ * Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@EqualsAndHashCode
public class Auxilary {
- private HealthCheck healthcheck;
-
- private HealthCheck livehealthcheck;
-
- private Policy policy;
+ private HealthCheck healthcheck;
- private Reconfigs reconfigs;
+ private HealthCheck livehealthcheck;
- private List<LinkedHashMap<String, String>> env;
+ private Policy policy;
- @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
- private Map<String, String> databases;
+ private Reconfigs reconfigs;
-/* @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
- private Affinity affinity;*/
+ private List<LinkedHashMap<String, String>> env;
- @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
- private Object hpa_config;
+ @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+ private Map<String, String> databases;
+ /* @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+ private Affinity affinity;*/
+ @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
+ private Object hpa_config;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/ComponentSpec.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/ComponentSpec.java
index e3583e7..3f7e2a6 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/ComponentSpec.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/base/ComponentSpec.java
@@ -33,12 +33,10 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For ComponentSpec
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents base
+ * ComponentSpec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -51,5 +49,4 @@ public class ComponentSpec {
private Parameters[] parameters;
private Artifacts[] artifacts;
-
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Artifacts.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Artifacts.java
index 0ae1c1a..e482ab3 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Artifacts.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Artifacts.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.model.componentspec.common;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@@ -31,19 +30,17 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Artifacts
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Artifacts
+ * used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@EqualsAndHashCode
public class Artifacts {
- private String type;
+ private String type;
- private String uri;
+ private String uri;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Calls.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Calls.java
index 752040d..2b27b76 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Calls.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Calls.java
@@ -23,28 +23,24 @@
package org.onap.blueprintgenerator.model.componentspec.common;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Calls
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Calls used
+ * in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Calls {
- private String config_key;
-
- private RequestResponse request;
+ private String config_key;
- private RequestResponse response;
+ private RequestResponse request;
+ private RequestResponse response;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Constraints.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Constraints.java
index cb248b9..d2b0f7b 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Constraints.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Constraints.java
@@ -29,32 +29,30 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Constraints
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Constraints
+ * used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Constraints {
- private Object equal;
+ private Object equal;
- private int greater_than;
+ private int greater_than;
- private int greater_or_equal;
+ private int greater_or_equal;
- private int less_than;
+ private int less_than;
- private int less_or_equal;
+ private int less_or_equal;
- private Object[] valid_values;
+ private Object[] valid_values;
- private int length;
+ private int length;
- private int min_length;
+ private int min_length;
- private int max_length;
+ private int max_length;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Container.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Container.java
index 3157338..5f56ed6 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Container.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Container.java
@@ -29,18 +29,16 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Container
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Container
+ * used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@EqualsAndHashCode
public class Container {
- private String bind;
+ private String bind;
- private String mode;
+ private String mode;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/EntrySchema.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/EntrySchema.java
index d0355ea..5a5c2c0 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/EntrySchema.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/EntrySchema.java
@@ -23,34 +23,30 @@
package org.onap.blueprintgenerator.model.componentspec.common;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Entry Schema
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Entry Schema
+ * used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class EntrySchema {
- private String name;
-
- private String description;
+ private String name;
- private String type;
+ private String description;
- private String value;
+ private String type;
- private EntrySchema[] entry_schema;
+ private String value;
- private boolean required;
+ private EntrySchema[] entry_schema;
+ private boolean required;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/HealthCheck.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/HealthCheck.java
index 01c1497..8c092a2 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/HealthCheck.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/HealthCheck.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.model.componentspec.common;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@@ -31,28 +30,25 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For HealthCheck
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents HealthCheck
+ * used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@EqualsAndHashCode
public class HealthCheck {
- private String interval;
-
- private String timeout;
+ private String interval;
- private String script;
+ private String timeout;
- private String type;
+ private String script;
- private String endpoint;
+ private String type;
- private String initialDelaySeconds;
+ private String endpoint;
+ private String initialDelaySeconds;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Host.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Host.java
index 6a9d812..6b5021e 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Host.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Host.java
@@ -29,19 +29,16 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Host
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Host used in
+ * Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@EqualsAndHashCode
public class Host {
- private String path;
-
- private String mode;
+ private String path;
+ private String mode;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Parameters.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Parameters.java
index 9c1931c..67de5ef 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Parameters.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Parameters.java
@@ -30,40 +30,37 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Parameters
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Parameters
+ * used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@EqualsAndHashCode
public class Parameters {
- private String name;
-
- private Object value;
+ private String name;
- private String description;
+ private Object value;
- private boolean sourced_at_deployment;
+ private String description;
- private boolean designer_editable;
+ private boolean sourced_at_deployment;
- private boolean policy_editable;
+ private boolean designer_editable;
- private boolean required;
+ private boolean policy_editable;
- private String type;
+ private boolean required;
- private String policy_group;
+ private String type;
- private PolicySchema[] policy_schema;
+ private String policy_group;
- private EntrySchema[] entry_schema;
+ private PolicySchema[] policy_schema;
- private Constraints[] constraints;
+ private EntrySchema[] entry_schema;
+ private Constraints[] constraints;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Policy.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Policy.java
index ea419f3..77f49a3 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Policy.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Policy.java
@@ -29,19 +29,16 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Policy
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Policy used
+ * in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@EqualsAndHashCode
public class Policy {
- private String trigger_type;
-
- private String script_path;
+ private String trigger_type;
+ private String script_path;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/PolicySchema.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/PolicySchema.java
index 2d17086..fc23cb8 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/PolicySchema.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/PolicySchema.java
@@ -29,29 +29,26 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Policy Schema
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Policy
+ * Schema used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class PolicySchema {
- private String name;
-
- private String description;
+ private String name;
- private String type;
+ private String description;
- private String value;
+ private String type;
- private EntrySchema[] entry_schema;
+ private String value;
- private boolean required;
+ private EntrySchema[] entry_schema;
- private Constraints[] constraints;
+ private boolean required;
- }
+ private Constraints[] constraints;
+}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Provides.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Provides.java
index 5301cbe..482ee4a 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Provides.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Provides.java
@@ -29,24 +29,21 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Provides
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Provides
+ * used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Provides {
- private String route;
+ private String route;
- private RequestResponse request;
-
- private RequestResponse response;
+ private RequestResponse request;
- //Used in ONAP
- private String verb;
+ private RequestResponse response;
+ // Used in ONAP
+ private String verb;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Publishes.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Publishes.java
index cd8230e..10e22eb 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Publishes.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Publishes.java
@@ -30,27 +30,24 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Publishes
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Publishes
+ * used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@EqualsAndHashCode
public class Publishes {
- private String config_key;
-
- private String format;
+ private String config_key;
- private String type;
+ private String format;
- private String version;
+ private String type;
- //Used in ONAP
- private String route;
+ private String version;
+ // Used in ONAP
+ private String route;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Reconfigs.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Reconfigs.java
index 96b0fb3..b5a5791 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Reconfigs.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Reconfigs.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.model.componentspec.common;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@@ -31,24 +30,21 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Reconfigs
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Reconfigs
+ * used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@EqualsAndHashCode
public class Reconfigs {
- private String dti;
+ private String dti;
- private String app_reconfig;
+ private String app_reconfig;
- private String policy;
-
- private String streams;
+ private String policy;
+ private String streams;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/RequestResponse.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/RequestResponse.java
index 0376de1..4930757 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/RequestResponse.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/RequestResponse.java
@@ -23,26 +23,22 @@
package org.onap.blueprintgenerator.model.componentspec.common;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Request Response
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Request
+ * Response used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class RequestResponse {
- private String format;
-
- private String version;
+ private String format;
+ private String version;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Self.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Self.java
index b657b16..a918bf2 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Self.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Self.java
@@ -30,24 +30,21 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Self
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Self used in
+ * Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@EqualsAndHashCode
public class Self {
- private String component_type;
-
- private String description;
+ private String component_type;
- private String name;
+ private String description;
- private String version;
+ private String name;
+ private String version;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Streams.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Streams.java
index 3791e32..897184c 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Streams.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Streams.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.model.componentspec.common;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@@ -31,20 +30,17 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Streams
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Streams used
+ * in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@EqualsAndHashCode
public class Streams {
- private Publishes[] publishes;
-
- private Subscribes[] subscribes;
+ private Publishes[] publishes;
+ private Subscribes[] subscribes;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Subscribes.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Subscribes.java
index 668a517..a0a58ae 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Subscribes.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Subscribes.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.model.componentspec.common;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@@ -31,26 +30,23 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Subscribes
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Subscribes
+ * used in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@EqualsAndHashCode
public class Subscribes {
- private String config_key;
-
- private String format;
+ private String config_key;
- private String route;
+ private String format;
- private String type;
+ private String route;
- private String version;
+ private String type;
+ private String version;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Volumes.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Volumes.java
index 6f12b47..9e9f9b1 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Volumes.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/componentspec/common/Volumes.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.model.componentspec.common;
-
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
@@ -31,24 +30,21 @@ import lombok.EqualsAndHashCode;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAP and DCAE Blueprint Applications
- * Component Spec Model: For Volumes
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAP
+ * and DCAE Blueprint Applications Component Spec Model: A model class which represents Volumes used
+ * in Componentspec
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@EqualsAndHashCode
public class Volumes {
- private Container container;
+ private Container container;
+
+ private Host host;
- private Host host;
-
- private String type;
-
- private String name;
+ private String type;
-} \ No newline at end of file
+ private String name;
+}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policies.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policies.java
index 35d210c..4f9221c 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policies.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policies.java
@@ -29,24 +29,20 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Policy Model: To Get Policies
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Policy Model: A model class which represents Policies
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class Policies {
- private String configAttributes;
+ private String configAttributes;
+
+ private String configName;
+
+ private String onapName = Constants.ONAP_NAME_DCAE;
- private String configName;
-
- private String onapName = Constants.ONAP_NAME_DCAE;
-
- private String policyName = Constants.POLICIES_POLICYNAME_DCAECONFIG;
-
- private boolean unique = false;
+ private String policyName = Constants.POLICIES_POLICYNAME_DCAECONFIG;
+ private boolean unique = false;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesNode.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesNode.java
index 7b951cc..986a12e 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesNode.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesNode.java
@@ -29,16 +29,12 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Policy Model: To Get Policies Node
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Policy Model: A model class which represents Policies Node
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class PoliciesNode extends Node {
- private PoliciesProperties properties;
-
+ private PoliciesProperties properties;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesProperties.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesProperties.java
index 11844bf..a4db4ad 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesProperties.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PoliciesProperties.java
@@ -28,16 +28,12 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Policy Model: To Get Policies Properties
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Policy Model: A model class which represents Policies Properties
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class PoliciesProperties {
- private PolicyFilter policy_filter;
-
+ private PolicyFilter policy_filter;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policy.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policy.java
index b5f098c..cf2a9ff 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policy.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/Policy.java
@@ -23,22 +23,17 @@
package org.onap.blueprintgenerator.model.policy;
-
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Policy Model: To Get Policy
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Policy Model: A model class which represents Policy
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class Policy {
- private String policy_id;
-
+ private String policy_id;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyFilter.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyFilter.java
index e49e6c3..96cdfc6 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyFilter.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyFilter.java
@@ -29,24 +29,20 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Policy Model: To Get Policy Filters
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Policy Model: A model class which represents Policy Filters
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class PolicyFilter {
- private String configAttributes = Constants.EMPTY;
+ private String configAttributes = Constants.EMPTY;
- private String configName = Constants.EMPTY;
-
- private String onapName = Constants.ONAP_NAME_DCAE;
+ private String configName = Constants.EMPTY;
- private Object policyName;
+ private String onapName = Constants.ONAP_NAME_DCAE;
- private boolean unique = false;
+ private Object policyName;
+ private boolean unique = false;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyInput.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyInput.java
index ca13cd7..24da65c 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyInput.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyInput.java
@@ -28,18 +28,14 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Policy Model: To Get Policy Input
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Policy Model: A model class which represents Policy Input
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class PolicyInput {
- private Policies[] policies;
-
- private Policy[] policy;
+ private Policies[] policies;
+ private Policy[] policy;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyNode.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyNode.java
index f5ebf05..c3256a1 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyNode.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyNode.java
@@ -29,16 +29,12 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Policy Model: To Get Policy Node
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Policy Model: A model class which represents Policy Node
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class PolicyNode extends Node {
- private PolicyProperties properties;
-
+ private PolicyProperties properties;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyProperties.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyProperties.java
index 8ec4a32..40d66e3 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyProperties.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/policy/PolicyProperties.java
@@ -29,16 +29,12 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Policy Model: To Get Policy Properties
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Policy Model: A model class which represents Policy Properties
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class PolicyProperties {
- private GetInput policy_id;
-
+ private GetInput policy_id;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/translate/GetProperty.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/translate/GetProperty.java
index 47994c3..abbccb9 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/translate/GetProperty.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/model/translate/GetProperty.java
@@ -30,16 +30,12 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Translate Model: To Get Property
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Translate Model: A model class which represents Get Property
*/
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
public class GetProperty {
- private List<String> get_property;
-
+ private List<String> get_property;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java
index 1f6b4f8..db15360 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintHelperService.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.service.base;
-
import org.onap.blueprintgenerator.constants.Constants;
import org.springframework.stereotype.Service;
@@ -31,88 +30,184 @@ import java.util.LinkedHashMap;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Service: For Common Functions used across
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Service: An interface for Common Functions used across Blueprint
*/
-
@Service
public class BlueprintHelperService {
-
- public LinkedHashMap<String, Object> createInputValue(String type, String description, Object defaultValue) {
- LinkedHashMap<String, Object> inputMap = new LinkedHashMap<>();
- inputMap.put("type", type);
- inputMap.put("description", description);
- inputMap.put("default", defaultValue);
- return inputMap;
- }
-
- public LinkedHashMap<String, Object> createInputValue(String type, String description) {
- LinkedHashMap<String, Object> inputMap = new LinkedHashMap<>();
- inputMap.put("type", type);
- inputMap.put("description", description);
- return inputMap;
- }
-
- public LinkedHashMap<String, Object> createInputValue(String type, Object defaultValue) {
- LinkedHashMap<String, Object> inputMap = new LinkedHashMap<>();
- inputMap.put("type", type);
- inputMap.put("default", defaultValue);
- return inputMap;
- }
-
- public LinkedHashMap<String, Object> createIntegerInput(String description, Object defaultValue){
- return createInputValue(Constants.INTEGER_TYPE, description, defaultValue);
- }
-
- public LinkedHashMap<String, Object> createIntegerInput(String description){
- return createInputValue(Constants.INTEGER_TYPE, description);
- }
-
- public LinkedHashMap<String, Object> createIntegerInput(Object defaultValue){
- return createInputValue(Constants.INTEGER_TYPE, defaultValue);
- }
-
- public LinkedHashMap<String, Object> createBooleanInput(String description, Object defaultValue){
- return createInputValue(Constants.BOOLEAN_TYPE, description, defaultValue);
- }
-
- public LinkedHashMap<String, Object> createBooleanInput(String description){
- return createInputValue(Constants.BOOLEAN_TYPE, description);
- }
-
- public LinkedHashMap<String, Object> createBooleanInput(Object defaultValue){
- return createInputValue(Constants.BOOLEAN_TYPE, defaultValue);
- }
-
- public LinkedHashMap<String, Object> createStringInput(String description, Object defaultValue){
- return createInputValue(Constants.STRING_TYPE, description, defaultValue);
- }
-
-/* public LinkedHashMap<String, Object> createStringInput(String description){
+ /**
+ * creates Input value by contatinating Type, Description and Default value
+ *
+ * @param type Input Type
+ * @param description Description
+ * @param defaultValue Default value of Type
+ * @return
+ */
+ public LinkedHashMap<String, Object> createInputValue(
+ String type, String description, Object defaultValue) {
+ LinkedHashMap<String, Object> inputMap = new LinkedHashMap<>();
+ inputMap.put("type", type);
+ inputMap.put("description", description);
+ inputMap.put("default", defaultValue);
+ return inputMap;
+ }
+
+ /**
+ * creates Input value by contatinating Type and Description
+ *
+ * @param type Input Type
+ * @param description Description
+ * @return
+ */
+ public LinkedHashMap<String, Object> createInputValue(String type, String description) {
+ LinkedHashMap<String, Object> inputMap = new LinkedHashMap<>();
+ inputMap.put("type", type);
+ inputMap.put("description", description);
+ return inputMap;
+ }
+
+ /**
+ * creates Input value by contatinating Type and Default value
+ *
+ * @param type Input Type
+ * @param defaultValue Default value of Type
+ * @return
+ */
+ public LinkedHashMap<String, Object> createInputValue(String type, Object defaultValue) {
+ LinkedHashMap<String, Object> inputMap = new LinkedHashMap<>();
+ inputMap.put("type", type);
+ inputMap.put("default", defaultValue);
+ return inputMap;
+ }
+
+ /**
+ * creates Input value by contatinating Description and Default value
+ *
+ * @param description Description
+ * @param defaultValue Default value of Type
+ * @return
+ */
+ public LinkedHashMap<String, Object> createIntegerInput(String description,
+ Object defaultValue) {
+ return createInputValue(Constants.INTEGER_TYPE, description, defaultValue);
+ }
+
+ /**
+ * creates Integer Input value for given Description
+ *
+ * @param description Description
+ * @return
+ */
+ public LinkedHashMap<String, Object> createIntegerInput(String description) {
+ return createInputValue(Constants.INTEGER_TYPE, description);
+ }
+
+ /**
+ * creates Integer Input value for given Default value
+ *
+ * @param defaultValue Default value of Type
+ * @return
+ */
+ public LinkedHashMap<String, Object> createIntegerInput(Object defaultValue) {
+ return createInputValue(Constants.INTEGER_TYPE, defaultValue);
+ }
+
+ /**
+ * creates Integer Input value for given Description and Default value
+ *
+ * @param description Description
+ * @param defaultValue Default value of Type
+ * @return
+ */
+ public LinkedHashMap<String, Object> createBooleanInput(String description,
+ Object defaultValue) {
+ return createInputValue(Constants.BOOLEAN_TYPE, description, defaultValue);
+ }
+
+ /**
+ * creates Boolean Input value for given Description
+ *
+ * @param description Description
+ * @return
+ */
+ public LinkedHashMap<String, Object> createBooleanInput(String description) {
+ return createInputValue(Constants.BOOLEAN_TYPE, description);
+ }
+
+ /**
+ * creates Boolean Input value for given Default value
+ *
+ * @param defaultValue Default value of Type
+ * @return
+ */
+ public LinkedHashMap<String, Object> createBooleanInput(Object defaultValue) {
+ return createInputValue(Constants.BOOLEAN_TYPE, defaultValue);
+ }
+
+ /**
+ * creates String Input value for given Default value
+ * @param description Description
+ * @param defaultValue Default value of Type
+ * @return
+ */
+ public LinkedHashMap<String, Object> createStringInput(String description,
+ Object defaultValue) {
+ return createInputValue(Constants.STRING_TYPE, description, defaultValue);
+ }
+
+ /* public LinkedHashMap<String, Object> createStringInput(String description){
return createInputValue(Constants.STRING_TYPE, description);
}*/
- public LinkedHashMap<String, Object> createStringInput(Object defaultValue){
- return createInputValue(Constants.STRING_TYPE, defaultValue);
- }
-
- public String joinUnderscore(String firstValue, String secondValue){
- return firstValue + "_" + secondValue;
- }
-
- public boolean isDataRouterType(String type) {
- return type.equals(Constants.DATA_ROUTER) || type.equals(Constants.DATAROUTER_VALUE);
- }
-
- public boolean isMessageRouterType(String type) {
- return type.equals(Constants.MESSAGE_ROUTER) || type.equals(Constants.MESSAGEROUTER_VALUE);
- }
-
- public String getNamePrefix(String name) {
- return name.isEmpty() ? "" : name + "_";
- }
-
+ /**
+ * creates String Input value for given Default value
+ *
+ * @param defaultValue Default value of Type
+ * @return
+ */
+ public LinkedHashMap<String, Object> createStringInput(Object defaultValue) {
+ return createInputValue(Constants.STRING_TYPE, defaultValue);
+ }
+
+ /**
+ * Concatenates String Input values with Underscore
+ *
+ * @param firstValue Value
+ * @param secondValue Value
+ * @return
+ */
+ public String joinUnderscore(String firstValue, String secondValue) {
+ return firstValue + "_" + secondValue;
+ }
+
+ /**
+ * Returns if the type is Data Router or not
+ *
+ * @param type Input Type
+ * @return
+ */
+ public boolean isDataRouterType(String type) {
+ return type.equals(Constants.DATA_ROUTER) || type.equals(Constants.DATAROUTER_VALUE);
+ }
+
+ /**
+ * Returns if the type is Message Router or not
+ *
+ * @param type Input Type
+ * @return
+ */
+ public boolean isMessageRouterType(String type) {
+ return type.equals(Constants.MESSAGE_ROUTER) || type.equals(Constants.MESSAGEROUTER_VALUE);
+ }
+
+ /**
+ * Returns name with underscore for empty input
+ *
+ * @param name Name
+ * @return
+ */
+ public String getNamePrefix(String name) {
+ return name.isEmpty() ? "" : name + "_";
+ }
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintService.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintService.java
index 83c43cf..7dd05f2 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintService.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/BlueprintService.java
@@ -23,6 +23,8 @@
package org.onap.blueprintgenerator.service.base;
+import java.io.FileReader;
+import java.nio.file.Paths;
import org.onap.blueprintgenerator.model.base.Blueprint;
import org.onap.blueprintgenerator.model.common.Input;
import org.onap.blueprintgenerator.model.componentspec.base.ComponentSpec;
@@ -33,7 +35,6 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
-
import java.io.File;
import java.io.IOException;
import java.io.FileWriter;
@@ -42,116 +43,176 @@ import java.io.PrintWriter;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Pattern;
+import java.util.Date;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Service: For Adding Quotes and Converting Blueprint to Yaml/String
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Service: For Adding Quotes and Converting Blueprint to
+ * Yaml/String
*/
-
@Service
public abstract class BlueprintService {
- @Autowired
- protected FixesService fixesService;
-
- @Qualifier("objectMapper")
- @Autowired
- protected ObjectMapper objectMapper;
-
- @Qualifier("yamlObjectMapper")
- @Autowired
- protected ObjectMapper yamlObjectMapper;
-
- public void blueprintToYaml(ComponentSpec cs, Blueprint blueprint, Input input) {
- String bluePrintName = input.getBluePrintName();
- String outputPath = input.getOutputPath();
- String comment = "# " + input.getComment() + '\n';
-
- try {
- File outputFile;
- String name = StringUtils.isEmpty(bluePrintName) ? cs.getSelf().getName() : bluePrintName;
- if(name.contains(".")) {
- name = name.replaceAll(Pattern.quote("."), "_");
- }
- if(name.contains(" ")) {
- name = name.replaceAll(" ", "");
- }
- String file = name + ".yaml";
- outputFile = new File(outputPath, file);
- outputFile.getParentFile().mkdirs();
- try {
- outputFile.createNewFile();
- } catch (IOException e) {
- throw new RuntimeException(e);
+ @Autowired
+ protected FixesService fixesService;
+
+ @Qualifier("objectMapper")
+ @Autowired
+ protected ObjectMapper objectMapper;
+
+ @Qualifier("yamlObjectMapper")
+ @Autowired
+ protected ObjectMapper yamlObjectMapper;
+
+ /**
+ * Convertes blueprint to Yaml for given ComponentSpec, Blueprint and input
+ *
+ * @param cs ComponentSpec
+ * @param blueprint Blueprint
+ * @param input Input
+ * @return
+ */
+ public void blueprintToYaml(ComponentSpec cs, Blueprint blueprint, Input input) {
+ String bluePrintName = input.getBluePrintName();
+ String outputPath = input.getOutputPath();
+ String comment = "# " + input.getComment() + '\n';
+
+ try {
+ File outputFile;
+ String name =
+ StringUtils.isEmpty(bluePrintName) ? cs.getSelf().getName() : bluePrintName;
+ if (name.contains(".")) {
+ name = name.replaceAll(Pattern.quote("."), "_");
+ }
+ if (name.contains(" ")) {
+ name = name.replaceAll(" ", "");
+ }
+ String file = name + ".yaml";
+ outputFile = new File(outputPath, file);
+ outputFile.getParentFile().mkdirs();
+ try {
+ outputFile.createNewFile();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ String appVersion = "";
+ try {
+ MavenXpp3Reader reader = new MavenXpp3Reader();
+ Model model = reader.read(new FileReader("pom.xml"));
+ appVersion = "#bpgen_application_version: " + model.getVersion() + '\n';
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ String version = "#blueprint_version: " + cs.getSelf().getVersion() + '\n';
+ String description = "#description: " + cs.getSelf().getDescription() + '\n';
+ String date = "#blueprint_created_date: " + new Date() + '\n';
+
+ BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile, false));
+ writer.write(description);
+ writer.write(version);
+ writer.write(date);
+ writer.write(appVersion);
+
+ if (isBpTypeMatches(input)) {
+ writer.write(comment);
+ }
+
+ writer.close();
+
+ PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(outputFile, true)));
+ yamlObjectMapper.writeValue(out, blueprint);
+ out.close();
+
+ if (isBpTypeMatches(input)) {
+ fixesService.fixDcaeSingleQuotes(outputFile);
+ } else {
+ fixesService.fixOnapSingleQuotes(outputFile);
+ }
+
+ // new Yaml().load(new FileInputStream(outputFile));
+
+ System.out.println("Blueprint is created with valid YAML Format");
+ } catch (Exception ex) {
+ throw new RuntimeException(
+ "Unable to generate YAML file from Blueprint or the generated YAML is not valid",
+ ex);
+ }
}
- String version = "#blueprint_version: " + cs.getSelf().getVersion() + '\n';
- String description = "#description: " + cs.getSelf().getDescription() + '\n';
-
- BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile, false));
- writer.write(description);
- writer.write(version);
-
- if(input.getBpType().equals("dti") || input.getBpType().equals("m") || input.getBpType().equals("k"))
- writer.write(comment);
-
- writer.close();
-
- PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(outputFile, true)));
- yamlObjectMapper.writeValue(out, blueprint);
- out.close();
-
- if(input.getBpType().equals("dti") || input.getBpType().equals("m") || input.getBpType().equals("k"))
- fixesService.fixDcaeSingleQuotes(outputFile);
- else
- fixesService.fixOnapSingleQuotes(outputFile);
-
- //new Yaml().load(new FileInputStream(outputFile));
-
- System.out.println("Blueprint is created with valid YAML Format");
- } catch (Exception ex) {
- throw new RuntimeException("Unable to generate YAML file from Blueprint or the generated YAML is not valid", ex);
+ /**
+ * Add quotes for given input
+ *
+ * @param inputs Inputs
+ * @return
+ */
+ public Map<String, LinkedHashMap<String, Object>> addQuotes(
+ Map<String, LinkedHashMap<String, Object>> inputs) {
+
+ inputs.forEach(
+ (key, value) -> {
+ if (value.get("type") != null) {
+ if (value.get("type").equals("string")
+ && value.get("default") != null
+ && !key.contains("policies")) {
+ value.replace("default", "'" + value.get("default").toString() + "'");
+ } else if (value.get("type").equals("map") || value.get("type")
+ .equals("list")) {
+ // Commented the Code as we need to read the object as is for Map and List. If the
+ // List object is to be converted to string uncomment the below code.
+ /* if(inputs.get(s).get("type").equals("list")) {
+ String temp = inputs.get(s).get("default").toString();
+ inputs.get(s).replace("default", temp);
+ }*/
+ inputs.get(key).remove("type");
+ }
+ }
+ });
+
+ return inputs;
}
- }
-
- // Used for DCAE
- public Map<String, LinkedHashMap<String, Object>> addQuotes(Map<String, LinkedHashMap<String, Object>> inputs) {
-
- inputs.forEach((key,value) -> {
- if(value.get("type") != null){
- if (value.get("type").equals("string") && value.get("default") != null && !key.contains("policies")){
- value.replace("default", "'" + value.get("default").toString() + "'");
- } else if (value.get("type").equals("map") || value.get("type").equals("list")) {
- // Commented the Code as we need to read the object as is for Map and List. If the List object is to be converted to string uncomment the below code.
- /* if(inputs.get(s).get("type").equals("list")) {
- String temp = inputs.get(s).get("default").toString();
- inputs.get(s).replace("default", temp);
- }*/
- inputs.get(key).remove("type");
- }
- }
- });
-
- return inputs;
- }
- public String blueprintToString(ComponentSpec componentSpec, Blueprint blueprint, Input input) {
- String ret = "";
- try {
- ret = yamlObjectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(blueprint);
- } catch (JsonProcessingException e) {
- e.printStackTrace();
+ /**
+ * Converts Blueprint to String format
+ *
+ * @param componentSpec ComponentSpec
+ * @param blueprint Blueprint
+ * @param input Input
+ * @return
+ */
+ public String blueprintToString(ComponentSpec componentSpec, Blueprint blueprint, Input input) {
+ String ret = "";
+ try {
+ ret = yamlObjectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(blueprint);
+ } catch (JsonProcessingException e) {
+ e.printStackTrace();
+ }
+ if (isBpTypeMatches(input)) {
+ ret =
+ "# "
+ + componentSpec.getSelf().getDescription()
+ + "\n"
+ + "# "
+ + componentSpec.getSelf().getVersion()
+ + "\n"
+ + "# "
+ + input.getComment()
+ + "\n"
+ + ret;
+ ret = fixesService.fixStringQuotes(ret);
+ } else {
+ ret = fixesService.applyFixes(ret);
+ }
+ return ret;
}
- if(input.getBpType().equals("dti") || input.getBpType().equals("m") || input.getBpType().equals("k")){
- ret = "# " + componentSpec.getSelf().getDescription() + "\n" + "# " + componentSpec.getSelf().getVersion() + "\n" + "# " + input.getComment() + "\n" + ret;
- ret = fixesService.fixStringQuotes(ret);
- }else
- ret = fixesService.applyFixes(ret);
- return ret;
- }
-
+ private boolean isBpTypeMatches(Input input) {
+ return input.getBpType().equals("dti")
+ || input.getBpType().equals("m")
+ || input.getBpType().equals("k");
+ }
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/FixesService.java b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/FixesService.java
index d848cac..4c6debc 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/FixesService.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/blueprintgenerator/service/base/FixesService.java
@@ -26,7 +26,6 @@ package org.onap.blueprintgenerator.service.base;
import org.onap.blueprintgenerator.exception.FixesException;
import org.springframework.stereotype.Service;
-
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileWriter;
@@ -38,133 +37,166 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Service: For Blueprint Quotes Fixes
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Service: For Blueprint Quotes Fixes
*/
-
@Service
public class FixesService {
- public void fixDcaeSingleQuotes(File file) {
- List<String> lines = new ArrayList<>();
- try {
- FileReader fr = new FileReader(file);
- BufferedReader br = new BufferedReader(fr);
- for (String line = br.readLine(); line != null; line = br.readLine()){
- if(line.contains("'")) {
- line = line.replaceAll("'\\{", "{");
- line = line.replaceAll("}'", "}");
- line = line.replaceAll("'\\[", "[");
- line = line.replaceAll("]'", "]");
- line = line.replaceAll("'''''", "'");
- line = line.replaceAll("'''", "'");
- line = line.replaceAll("'''", "");
- line = line.replaceAll("''\\{", "'{");
- line = line.replaceAll("}''", "}'");
- line = line.replaceAll("''\\[", "'[");
- line = line.replaceAll("]''", "]'");
- line = line.replaceAll("\"''", "'");
- line = line.replaceAll("''\"", "'");
- }
- if(line.contains("get_input") || line.contains("get_secret") || line.contains("envs"))
- line = line.replaceAll("'", "");
-
- lines.add(line);
- }
-
- fr.close();
- br.close();
-
- FileWriter fw = new FileWriter(file);
- PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));
- for(String s: lines) {
- out.println();
- out.write(s);
- out.flush();
- }
- out.close();
- fw.close();
- } catch (Exception e) {
- throw new FixesException("Unable to Fix Single Quotes in Final DCAE Blueprint", e);
- }
- }
-
- public String fixStringQuotes(String string) {
- String sLines[] = string.split("\n");
- String ret = "";
- for(String line: sLines) {
- if(line.contains("get_input") || line.contains("get_secret") || ((line.contains("concat") || line.contains("default: ") || line.contains("description") || line.contains("dmaap") || line.contains(".\"'")) && line.contains("'")))
- line = line.replaceAll("'", "");
-
- if(line.contains("'")) {
- line = line.replaceAll("'\\{", "{");
- line = line.replaceAll("}'", "}");
- line = line.replaceAll("'\\[", "[");
- line = line.replaceAll("]'", "]");
- line = line.replaceAll("'''''", "'");
- line = line.replaceAll("'''", "'");
- line = line.replaceAll("'''", "");
- line = line.replaceAll("''\\{", "'{");
- line = line.replaceAll("}''", "}'");
- line = line.replaceAll("''\\[", "'[");
- line = line.replaceAll("]''", "]'");
- line = line.replaceAll("\"''", "'");
- line = line.replaceAll("''\"", "'");
- }
- ret = ret + "\n" + line;
- }
- return ret;
- }
-
- public void fixOnapSingleQuotes(File file) {
- List<String> lines = new ArrayList<>();
- try {
- FileReader fr = new FileReader(file);
- BufferedReader br = new BufferedReader(fr);
- for (String line = br.readLine(); line != null; line = br.readLine()){
- if(line.contains("'")) {
- line = line.replace("'", "");
- }
- if(line.contains("\"\"") && (line.contains("m") || line.contains("M"))) {
- line = line.replaceAll("\"\"", "\"");
- }
- lines.add(line);
-
- }
- fr.close();
- br.close();
- FileWriter fw = new FileWriter(file);
- PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));
- for(String s: lines) {
- out.println();
- out.write(s);
- out.flush();
- }
-
- out.close();
- fw.close();
-
- } catch (Exception e) {
- throw new FixesException("Unable to Fix Single Quotes in final ONAP Blueprint", e);
- }
- }
-
- private String ensureNoSingleQuotes(String line) {
- if ((line.contains("concat") || line.contains("default: ") || line.contains("description") || line.contains("dmaap") || line.contains(".\"'")) && line.contains("'"))
- return line.replace("'", "");
- else
- return line;
- }
-
- public String applyFixes(String bp) {
- List<String> lines = new ArrayList<>();
- String[] linesPre = bp.split("\n");
- for (String line : linesPre) {
- lines.add(ensureNoSingleQuotes(line));
- }
- return String.join("\n", lines);
- }
-
+ /**
+ * Interface to fix Single Quotes in the generated Blueprint
+ *
+ * @param file File
+ * @return
+ */
+ public void fixDcaeSingleQuotes(File file) {
+ List<String> lines = new ArrayList<>();
+ try {
+ FileReader fr = new FileReader(file);
+ BufferedReader br = new BufferedReader(fr);
+ for (String line = br.readLine(); line != null; line = br.readLine()) {
+ if (line.contains("'")) {
+ line = processLine(line);
+ }
+ if (line.contains("get_input") || line.contains("get_secret") || line
+ .contains("envs")) {
+ line = line.replaceAll("'", "");
+ }
+
+ lines.add(line);
+ }
+
+ fr.close();
+ br.close();
+
+ FileWriter fw = new FileWriter(file);
+ PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));
+ for (String s : lines) {
+ out.println();
+ out.write(s);
+ out.flush();
+ }
+ out.close();
+ fw.close();
+ } catch (Exception e) {
+ throw new FixesException("Unable to Fix Single Quotes in Final DCAE Blueprint", e);
+ }
+ }
+
+ /**
+ * Interface to fix String Quotes in the generated Blueprint
+ *
+ * @param string String
+ * @return
+ */
+ public String fixStringQuotes(String string) {
+ String sLines[] = string.split("\n");
+ String ret = "";
+ for (String line : sLines) {
+ if (line.contains("get_input")
+ || line.contains("get_secret")
+ || ((line.contains("concat")
+ || line.contains("default: ")
+ || line.contains("description")
+ || line.contains("dmaap")
+ || line.contains(".\"'"))
+ && line.contains("'"))) {
+ line = line.replaceAll("'", "");
+ }
+
+ if (line.contains("'")) {
+ line = processLine(line);
+ }
+ ret = ret + "\n" + line;
+ }
+ return ret;
+ }
+
+ /**
+ * Interface to fix Single Quotes in the generated ONAP Blueprint
+ *
+ * @param file File
+ * @return
+ */
+ public void fixOnapSingleQuotes(File file) {
+ List<String> lines = new ArrayList<>();
+ try {
+ FileReader fr = new FileReader(file);
+ BufferedReader br = new BufferedReader(fr);
+ for (String line = br.readLine(); line != null; line = br.readLine()) {
+ if (line.contains("'")) {
+ line = line.replace("'", "");
+ }
+ if (line.contains("\"\"") && (line.contains("m") || line.contains("M"))) {
+ line = line.replaceAll("\"\"", "\"");
+ }
+ lines.add(line);
+ }
+ fr.close();
+ br.close();
+ FileWriter fw = new FileWriter(file);
+ PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(file, true)));
+ for (String s : lines) {
+ out.println();
+ out.write(s);
+ out.flush();
+ }
+
+ out.close();
+ fw.close();
+
+ } catch (Exception e) {
+ throw new FixesException("Unable to Fix Single Quotes in final ONAP Blueprint", e);
+ }
+ }
+
+ /**
+ * Interface to fix Single Quotes for given line
+ *
+ * @param line Line
+ * @return
+ */
+ private String ensureNoSingleQuotes(String line) {
+ if ((line.contains("concat")
+ || line.contains("default: ")
+ || line.contains("description")
+ || line.contains("dmaap")
+ || line.contains(".\"'"))
+ && line.contains("'")) {
+ return line.replace("'", "");
+ } else {
+ return line;
+ }
+ }
+
+ /**
+ * Interface to Applt fixes for Quotes
+ *
+ * @param bp Blueprint
+ * @return
+ */
+ public String applyFixes(String bp) {
+ List<String> lines = new ArrayList<>();
+ String[] linesPre = bp.split("\n");
+ for (String line : linesPre) {
+ lines.add(ensureNoSingleQuotes(line));
+ }
+ return String.join("\n", lines);
+ }
+
+ private String processLine(String line) {
+ return line.replaceAll("'\\{", "{")
+ .replaceAll("}'", "}")
+ .replaceAll("'\\[", "[")
+ .replaceAll("]'", "]")
+ .replaceAll("'''''", "'")
+ .replaceAll("'''", "'")
+ .replaceAll("'''", "")
+ .replaceAll("''\\{", "'{")
+ .replaceAll("}''", "}'")
+ .replaceAll("''\\[", "'[")
+ .replaceAll("]''", "]'")
+ .replaceAll("\"''", "'")
+ .replaceAll("''\"", "'");
+ }
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/exception/PolicyCreateException.java b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/exception/PolicyCreateException.java
index e848437..d18b414 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/exception/PolicyCreateException.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/exception/PolicyCreateException.java
@@ -25,18 +25,21 @@ package org.onap.policycreate.exception;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Exception: For Policy Create
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Exception: To handle error messages for Policy Create exceptions
*/
+public class PolicyCreateException extends RuntimeException {
-public class PolicyCreateException extends RuntimeException{
-
+ /**
+ * Handles Policy Create Exception for Error Message
+ */
public PolicyCreateException(String errorMessage) {
super(errorMessage);
}
+ /**
+ * Handles Policy Create Exception for Error Message and Error
+ */
public PolicyCreateException(String errorMessage, Throwable err) {
super(errorMessage, err);
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModel.java b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModel.java
index 3d8c1a7..009ca1e 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModel.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModel.java
@@ -31,19 +31,14 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Policy Create Model: For Policy Model
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Policy Create Model: A model class which represents Policy Model
*/
-
@Data
-@JsonInclude(value=Include.NON_NULL)
+@JsonInclude(value = Include.NON_NULL)
public class PolicyModel {
private String tosca_definition_version;
private Map<String, PolicyModelNode> node_types;
private Map<String, PolicyModelNode> data_types;
-
}
-
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModelNode.java b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModelNode.java
index eac29b6..7b2f759 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModelNode.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyModelNode.java
@@ -31,17 +31,14 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Policy Create Model: For Policy Model Node
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Policy Create Model: A model class which represents Policy Model
+ * Node
*/
-
@Data
-@JsonInclude(value=Include.NON_NULL)
+@JsonInclude(value = Include.NON_NULL)
public class PolicyModelNode {
- private String derived_from;
- private Map<String, PolicyProperties> properties;
-
+ private String derived_from;
+ private Map<String, PolicyProperties> properties;
}
diff --git a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyProperties.java b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyProperties.java
index f12e76d..3812e73 100644
--- a/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyProperties.java
+++ b/mod/bpgenerator/common/src/main/java/org/onap/policycreate/model/PolicyProperties.java
@@ -29,17 +29,14 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by both ONAp and DCAE Blueprint Applications
- * Policy Create Model: For Policy Properties
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by both ONAp
+ * and DCAE Blueprint Applications Policy Create Model: A model class which represents Policy
+ * Properties
*/
-
@Data
-@JsonInclude(value=Include.NON_NULL)
+@JsonInclude(value = Include.NON_NULL)
public class PolicyProperties {
- private String type;
- private Object entry_schema;
-
-} \ No newline at end of file
+ private String type;
+ private Object entry_schema;
+}
diff --git a/mod/bpgenerator/onap/models/Test_Parameters.yml b/mod/bpgenerator/onap/models/Test_Parameters.yml
new file mode 100644
index 0000000..5df73fb
--- /dev/null
+++ b/mod/bpgenerator/onap/models/Test_Parameters.yml
@@ -0,0 +1,23 @@
+---
+tosca_definition_version: tosca_simple_yaml_1_0_0
+node_types:
+ onap.policy.Test_Parameters:
+ derived_from: tosca.datatypes.Root
+ properties:
+ testParam1:
+ type: map
+ entry_schema:
+ - 'type: onap.datatypes.testParam1'
+data_types:
+ onap.datatypes.PolicySchemaTest:
+ derived_from: tosca.nodes.Root
+ properties:
+ TestEntrySchema:
+ type: string
+ onap.datatypes.testParam1:
+ derived_from: tosca.datatypes.Root
+ properties:
+ PolicySchemaTest:
+ type: map
+ entry_schema:
+ - 'type: onap.datatypes.PolicySchemaTest'
diff --git a/mod/bpgenerator/onap/pom.xml b/mod/bpgenerator/onap/pom.xml
index f1b8373..6193d46 100644
--- a/mod/bpgenerator/onap/pom.xml
+++ b/mod/bpgenerator/onap/pom.xml
@@ -23,8 +23,8 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>blueprint-generator-onap</artifactId>
@@ -32,7 +32,9 @@
<packaging>jar</packaging>
<name>Onap</name>
- <description>This Application is used to generate ONAP Blueprint YAML Files for given Component Specs</description>
+ <description>This Application is used to generate ONAP Blueprint YAML Files for given Component
+ Specs
+ </description>
<parent>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java
index 3b9dd49..d680919 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/BlueprintGeneratorMainApplication.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator;
-
import org.onap.blueprintgenerator.model.base.Blueprint;
import org.onap.blueprintgenerator.model.common.Input;
import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
@@ -43,12 +42,10 @@ import static java.lang.System.exit;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP - Blueprint Generator Main Application to create Policy Models or Blueprints
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP - Blueprint Generator Main
+ * Application to create Policy Models or Blueprints
*/
-
-@ComponentScan({"org.onap.blueprintgenerator","org.onap.policycreate"})
+@ComponentScan({"org.onap.blueprintgenerator", "org.onap.policycreate"})
@SpringBootApplication
public class BlueprintGeneratorMainApplication implements CommandLineRunner {
@@ -76,35 +73,53 @@ public class BlueprintGeneratorMainApplication implements CommandLineRunner {
@Autowired
private DmaapBlueprintService dmaapBlueprintService;
+ /**
+ * Main Application to run BPGen to generate Policies/Blueprint based on Input Arguments values
+ *
+ * @param args Input Arguments
+ */
public static void main(String[] args) {
SpringApplication.run(BlueprintGeneratorMainApplication.class, args);
}
+ /**
+ * Creates Policies/Blueprint based on Input Arguments values
+ *
+ * @param args Input Arguments
+ */
@Override
public void run(String... args) {
- if (args.length >=2 && args[0].equals("app") && args[1].equals("ONAP")) {
+ if (args.length >= 2 && args[0].equals("app") && args[1].equals("ONAP")) {
onapCommonUtils.printInstructions();
- if(args.length >=4 && args[2].equals("-type") && args[3].equals("policycreate")){
+ if (args.length >= 4 && args[2].equals("-type") && args[3].equals("policycreate")) {
Input input = onapCommonUtils.parseInputs(args);
- ComponentSpec componentSpec = componentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
- onapPolicyModelNodeService.createPolicyModels(componentSpec.getParameters(), input.getOutputPath());
- }
- else {
+ ComponentSpec componentSpec =
+ componentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ onapPolicyModelNodeService.createPolicyModels(
+ componentSpec.getParameters(), input.getOutputPath());
+ } else {
Input input = onapCommonUtils.parseInputs(args);
- OnapComponentSpec onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ OnapComponentSpec onapComponentSpec =
+ onapComponentSpecService
+ .createComponentSpecFromFile(input.getComponentSpecPath());
if (input.getBpType().equals("o")) {
- Blueprint blueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
+ Blueprint blueprint = onapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
onapBlueprintService.blueprintToYaml(onapComponentSpec, blueprint, input);
- System.out.println(onapBlueprintService.blueprintToString(onapComponentSpec, blueprint, input));
+ System.out.println(
+ onapBlueprintService
+ .blueprintToString(onapComponentSpec, blueprint, input));
} else if (input.getBpType().equals("d")) {
- Blueprint blueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
+ Blueprint blueprint = dmaapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
dmaapBlueprintService.blueprintToYaml(onapComponentSpec, blueprint, input);
- System.out.println(dmaapBlueprintService.blueprintToString(onapComponentSpec, blueprint, input));
+ System.out.println(
+ dmaapBlueprintService
+ .blueprintToString(onapComponentSpec, blueprint, input));
}
}
}
exit(0);
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalCertificateParameters.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalCertificateParameters.java
index d7c76a9..5655d70 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalCertificateParameters.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalCertificateParameters.java
@@ -29,12 +29,9 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: External Certificate Parameters
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents External Certificate Parameters
*/
-
-
@Data
public class ExternalCertificateParameters {
@@ -43,5 +40,4 @@ public class ExternalCertificateParameters {
@JsonProperty(Constants.SANS_FIELD)
private GetInput sans;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalTlsInfo.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalTlsInfo.java
index 197104d..0b1b414 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalTlsInfo.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ExternalTlsInfo.java
@@ -31,12 +31,9 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: External TLS Info
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents External TLS Info
*/
-
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -56,5 +53,4 @@ public class ExternalTlsInfo {
@JsonProperty(Constants.EXTERNAL_CERTIFICATE_PARAMETERS_FIELD)
private ExternalCertificateParameters externalCertificateParameters;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/GetAttribute.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/GetAttribute.java
index 2d5bca7..3e08cc2 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/GetAttribute.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/GetAttribute.java
@@ -1,4 +1,3 @@
-
/*
*
* * ============LICENSE_START=======================================================
@@ -29,16 +28,12 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Get Attribute
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Get Attribute
*/
-
-
@Data
public class GetAttribute {
@JsonProperty("get_attribute")
private Object attribute;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Info.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Info.java
index 3721d55..8f0b909 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Info.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Info.java
@@ -29,26 +29,22 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Info
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Info
*/
-
-
@Data
-@JsonInclude(value= Include.NON_NULL)
+@JsonInclude(value = Include.NON_NULL)
public class Info {
- private GetInput topic_url;
-
- private GetInput username;
+ private GetInput topic_url;
- private GetInput password;
+ private GetInput username;
- private GetInput location;
+ private GetInput password;
- private GetInput delivery_url;
+ private GetInput location;
- private GetInput subscriber_id;
+ private GetInput delivery_url;
+ private GetInput subscriber_id;
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Interfaces.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Interfaces.java
index 04ef7e7..c0536de 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Interfaces.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Interfaces.java
@@ -23,20 +23,15 @@
package org.onap.blueprintgenerator.model.common;
-
import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Interfaces
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Interfaces
*/
-
-
@Data
public class Interfaces {
- private Start start;
-
+ private Start start;
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Node.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Node.java
index ea28d62..9387d42 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Node.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Node.java
@@ -32,12 +32,9 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Node derived from Common Module Node Model used by both DCAE and ONAP
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Node derived from Common Module Node Model
*/
-
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/OnapBlueprint.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/OnapBlueprint.java
index 4dd7b0f..198a43e 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/OnapBlueprint.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/OnapBlueprint.java
@@ -32,17 +32,13 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Blueprint derived from Common Module Blueprint Model used by both DCAE and ONAP
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Blueprint derived from Common Module Blueprint Model
*/
-
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class OnapBlueprint extends Blueprint {
private Map<String, Node> node_templates;
-
-} \ No newline at end of file
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNode.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNode.java
index af6fb54..daa9c74 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNode.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNode.java
@@ -23,24 +23,19 @@
package org.onap.blueprintgenerator.model.common;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Pgaas Node
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Pgaas Node
*/
-
-
@Data
@NoArgsConstructor
public class PgaasNode extends Node {
@JsonProperty("properties")
private PgaasNodeProperties pgaasNodeProperties;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNodeProperties.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNodeProperties.java
index 37ddb73..36ab1a8 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNodeProperties.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PgaasNodeProperties.java
@@ -28,13 +28,9 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Pgaas Node Properties
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator OONAP Common Model: A model class which
+ * represents Pgaas Node Properties
*/
-
-
-
@Data
public class PgaasNodeProperties {
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModel.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModel.java
index 08b9096..c432ae9 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModel.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModel.java
@@ -30,19 +30,14 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Policy Model
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Policy Model
*/
-
-
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PolicyModel {
-
- private String tosca_definition_version;
- private Map<String, PolicyModelNode> node_types;
- private Map<String, PolicyModelNode> data_types;
-
+ private String tosca_definition_version;
+ private Map<String, PolicyModelNode> node_types;
+ private Map<String, PolicyModelNode> data_types;
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModelNode.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModelNode.java
index c418b8e..54a5b20 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModelNode.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyModelNode.java
@@ -30,18 +30,14 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Policy Model Node
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Policy Model Node
*/
-
-
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PolicyModelNode {
-
- private String derived_from;
- private Map<String, PolicyProperties> properties;
+ private String derived_from;
+ private Map<String, PolicyProperties> properties;
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNode.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNode.java
index cc08814..3e518c0 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNode.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNode.java
@@ -23,24 +23,19 @@
package org.onap.blueprintgenerator.model.common;
-
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Policy Node derived from Common Module Node Model used by both DCAE and ONAP
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Policy Node derived from Common Module Node Model
*/
-
-
@Data
@NoArgsConstructor
public class PolicyNode extends Node {
@JsonProperty("properties")
private PolicyNodeProperties policyNodeProperties;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNodeProperties.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNodeProperties.java
index 3f472c8..169c7d5 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNodeProperties.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyNodeProperties.java
@@ -29,12 +29,9 @@ import lombok.NoArgsConstructor;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Policy Node Properties
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Policy Node Properties
*/
-
-
@Data
@NoArgsConstructor
public class PolicyNodeProperties {
@@ -44,5 +41,4 @@ public class PolicyNodeProperties {
@JsonProperty("policy_model_id")
private String policyModelId;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyProperties.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyProperties.java
index 5a63b00..7e3060b 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyProperties.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/PolicyProperties.java
@@ -28,18 +28,14 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Policy Properties
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Policy Properties
*/
-
-
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PolicyProperties {
-
- private String type;
- private Object entry_schema;
-
+ private String type;
+
+ private Object entry_schema;
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Properties.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Properties.java
index 11fc06e..a9675f5 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Properties.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Properties.java
@@ -37,53 +37,49 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Properties
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Properties
*/
-
-
@Data
@JsonInclude(value = Include.NON_NULL)
public class Properties {
- private Appconfig application_config;
-
- private OnapAuxilary docker_config;
+ private Appconfig application_config;
- private Object image;
+ private OnapAuxilary docker_config;
- private GetInput location_id;
+ private Object image;
- private String service_component_type;
+ private GetInput location_id;
- private Map<String, Object> log_info;
+ private String service_component_type;
- private String dns_name;
+ private Map<String, Object> log_info;
- private Object replicas;
+ private String dns_name;
- private String name;
+ private Object replicas;
- private GetInput topic_name;
+ private String name;
- private GetInput feed_name;
+ private GetInput topic_name;
- private List<Streams> streams_publishes;
+ private GetInput feed_name;
- private List<Streams> streams_subscribes;
+ private List<Streams> streams_publishes;
- private TlsInfo tls_info;
+ private List<Streams> streams_subscribes;
- private ResourceConfig resource_config;
+ private TlsInfo tls_info;
- private GetInput always_pull_image;
+ private ResourceConfig resource_config;
- private Boolean useExisting;
+ private GetInput always_pull_image;
- @JsonIgnore
- private ExternalTlsInfoFactoryService externalCertFactory;
+ private Boolean useExisting;
- private ExternalTlsInfo external_cert;
+ @JsonIgnore
+ private ExternalTlsInfoFactoryService externalCertFactory;
+ private ExternalTlsInfo external_cert;
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ResourceConfig.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ResourceConfig.java
index 8b41fd2..cda8458 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ResourceConfig.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/ResourceConfig.java
@@ -29,17 +29,13 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Resource Config
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Resource Config
*/
-
-
@Data
public class ResourceConfig {
- private Map<String, GetInput> limits;
-
- private Map<String, GetInput> requests;
+ private Map<String, GetInput> limits;
-} \ No newline at end of file
+ private Map<String, GetInput> requests;
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Services.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Services.java
index 7aa1566..abf1fb5 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Services.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Services.java
@@ -32,19 +32,15 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Services
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Services
*/
-
-
@Data
-@JsonInclude(value=Include.NON_NULL)
+@JsonInclude(value = Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
-public class Services {
-
- private Calls[] calls;
+public class Services {
- private Provides[] provides;
+ private Calls[] calls;
+ private Provides[] provides;
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Start.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Start.java
index 3740668..7714d94 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Start.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/Start.java
@@ -31,19 +31,15 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Start
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Start
*/
-
-
@Data
-@JsonInclude(value= JsonInclude.Include.NON_NULL)
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Start {
private StartInputs inputs;
private Map<String, Object> envs;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/StartInputs.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/StartInputs.java
index 458852e..6b35cc2 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/StartInputs.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/common/StartInputs.java
@@ -31,19 +31,15 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Common Model used by both ONAP and DMAAP: Start Inputs under Start
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Common Model: A model class which
+ * represents Start Inputs under Start
*/
-
-
@Data
-@JsonInclude(value= JsonInclude.Include.NON_NULL)
+@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class StartInputs {
private Object envs;
private List<String> ports;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapAuxilary.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapAuxilary.java
index 0923195..f59ee74 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapAuxilary.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapAuxilary.java
@@ -35,12 +35,9 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Component Spec Model for ONAP Auxillary derived from Common Module Auxillary used by both DCAE and ONAP
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Component Spec Model: A model class
+ * which represents ONAP Auxillary derived from Common Module Auxillary
*/
-
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -56,5 +53,4 @@ public class OnapAuxilary extends Auxilary {
private Map<String, Object> tls_info;
private Volumes[] volumes;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapComponentSpec.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapComponentSpec.java
index 5a64366..24095e7 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapComponentSpec.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/OnapComponentSpec.java
@@ -31,12 +31,9 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Component Spec Model for ONAP Component Spec derived from Common Module Component Spec used by both DCAE and ONAP
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Component Spec Model: A model class
+ * which represents ONAP Component Spec derived from Common Module Component Spec
*/
-
-
@Data
@JsonInclude(value = JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -48,5 +45,4 @@ public class OnapComponentSpec extends ComponentSpec {
@JsonProperty("policy_info")
private PolicyInfo policyInfo;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/PolicyInfo.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/PolicyInfo.java
index 3ec5fe3..903925b 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/PolicyInfo.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/PolicyInfo.java
@@ -30,16 +30,12 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Component Spec Model for Policy Info
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Component Spec Model: A model class
+ * which represents Policy Info
*/
-
-
@Data
public class PolicyInfo {
@JsonProperty("policy")
private List<TypePolicy> typePolicyList;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/Services.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/Services.java
index b7d32a4..d854be5 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/Services.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/Services.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.model.componentspec;
-
import org.onap.blueprintgenerator.model.componentspec.common.Calls;
import org.onap.blueprintgenerator.model.componentspec.common.Provides;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -33,19 +32,15 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Component Spec Model for Services
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Component Spec Model: A model class
+ * which represents Services
*/
-
-
@Data
-@JsonInclude(value= Include.NON_NULL)
+@JsonInclude(value = Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class Services {
- private Calls[] calls;
-
- private Provides[] provides;
+ private Calls[] calls;
+ private Provides[] provides;
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/TypePolicy.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/TypePolicy.java
index 6ba7daf..dd10687 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/TypePolicy.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/componentspec/TypePolicy.java
@@ -27,17 +27,13 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Component Spec Model for Type Policy
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Component Spec Model: A model class
+ * which represents Type Policy
*/
-
-
@Data
public class TypePolicy {
private String node_label;
private String policy_id;
private String policy_model_id;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/Streams.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/Streams.java
index 14d0c51..6ca089d 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/Streams.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/Streams.java
@@ -30,37 +30,32 @@ import lombok.Data;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * DMAAP Model for Streams
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP DMAAP Spec Model: A model class
+ * which represents Streams
*/
-
-
@Data
-@JsonInclude(value= Include.NON_NULL)
+@JsonInclude(value = Include.NON_NULL)
public class Streams {
- private String name;
-
- private GetInput location;
-
- private GetInput client_role;
+ private String name;
- private String type;
+ private GetInput location;
- private GetInput username;
+ private GetInput client_role;
- private GetInput password;
+ private String type;
- //private GetInput delivery_url;
+ private GetInput username;
- private GetInput privileged;
+ private GetInput password;
- private GetInput decompress;
+ // private GetInput delivery_url;
- private String route;
+ private GetInput privileged;
- private String scheme;
+ private GetInput decompress;
+ private String route;
-} \ No newline at end of file
+ private String scheme;
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/TlsInfo.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/TlsInfo.java
index 9290bf9..cfc9c45 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/TlsInfo.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/model/dmaap/TlsInfo.java
@@ -30,12 +30,9 @@ import lombok.NoArgsConstructor;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * DMAAP Model for TLS Info
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP DMAAP Spec Model: A model class
+ * which represents TLS Info
*/
-
-
@Data
@NoArgsConstructor
public class TlsInfo {
@@ -45,5 +42,4 @@ public class TlsInfo {
@JsonProperty("use_tls")
private GetInput useTls;
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java
index fed3707..66f71da 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/InfoService.java
@@ -35,32 +35,37 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Service to create Message Router and Data Router Information
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Service to create Message Router and
+ * Data Router Information
*/
-
@Service
public class InfoService {
@Autowired
private BlueprintHelperService blueprintHelperService;
- // Method to create info for Message Router
- public Map<String,Object> createMessageRouterInfo(Map<String, LinkedHashMap<String, Object>> inputs, String config, char type) {
-
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates info for Message Router
+ *
+ * @param inputs Inputs
+ * @param config Config
+ * @param type BP Type
+ * @return
+ */
+ public Map<String, Object> createMessageRouterInfo(
+ Map<String, LinkedHashMap<String, Object>> inputs, String config, char type) {
+
+ Map<String, Object> response = new HashMap<>();
Info info = new Info();
LinkedHashMap<String, Object> stringType = new LinkedHashMap<>();
stringType.put("type", "string");
config = config.replaceAll("-", "_");
- if(type == 'p') {
+ if (type == 'p') {
config = config + "_publish_url";
- }
- else if(type == 's') {
- config = config+ "_subscribe_url";
+ } else if (type == 's') {
+ config = config + "_subscribe_url";
}
GetInput topic = new GetInput();
@@ -74,10 +79,17 @@ public class InfoService {
return response;
}
- // Method to create info for Data Router
- public Map<String,Object> createDataRouterInfo(Map<String, LinkedHashMap<String, Object>> inputs, String config) {
-
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates info for Data Router
+ *
+ * @param inputs Inputs
+ * @param config Config
+ * @return
+ */
+ public Map<String, Object> createDataRouterInfo(
+ Map<String, LinkedHashMap<String, Object>> inputs, String config) {
+
+ Map<String, Object> response = new HashMap<>();
Info info = new Info();
LinkedHashMap<String, Object> stringType = new LinkedHashMap<>();
@@ -98,12 +110,14 @@ public class InfoService {
info.setLocation(location);
inputs.put(userlocationInputName, stringType);
- String userdeliveryUrlInputName = blueprintHelperService.joinUnderscore(config, "delivery_url");
+ String userdeliveryUrlInputName = blueprintHelperService
+ .joinUnderscore(config, "delivery_url");
GetInput deliveryUrl = new GetInput(userdeliveryUrlInputName);
info.setDelivery_url(deliveryUrl);
inputs.put(userdeliveryUrlInputName, stringType);
- String usersubscriberIDInputName = blueprintHelperService.joinUnderscore(config, "subscriber_id");
+ String usersubscriberIDInputName =
+ blueprintHelperService.joinUnderscore(config, "subscriber_id");
GetInput subscriberID = new GetInput(usersubscriberIDInputName);
info.setSubscriber_id(subscriberID);
inputs.put(usersubscriberIDInputName, stringType);
@@ -112,5 +126,4 @@ public class InfoService {
response.put("inputs", inputs);
return response;
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/OnapBlueprintService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/OnapBlueprintService.java
index f25c18c..748facf 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/OnapBlueprintService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/OnapBlueprintService.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.service;
-
import org.onap.blueprintgenerator.constants.Constants;
import org.onap.blueprintgenerator.exception.BlueprintException;
import org.onap.blueprintgenerator.model.common.Input;
@@ -46,11 +45,8 @@ import java.util.TreeMap;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Service to create ONAP Blueprint
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Service to create ONAP Blueprint
*/
-
@Service
public class OnapBlueprintService extends BlueprintService {
@@ -69,43 +65,51 @@ public class OnapBlueprintService extends BlueprintService {
@Autowired
protected ImportsService importsService;
- // Method to generate Onap Blueprint
+ /**
+ * Creates Onap Blueprint
+ *
+ * @param onapComponentSpec OnapComponentSpec
+ * @param input Inputs
+ * @return
+ */
public OnapBlueprint createBlueprint(OnapComponentSpec onapComponentSpec, Input input) {
try {
OnapBlueprint blueprint = new OnapBlueprint();
blueprint.setTosca_definitions_version(Constants.TOSCA_DEF_VERSION);
- //if (!"".equals(input.getImportPath()))
- if (!StringUtils.isEmpty(input.getImportPath()))
+ // if (!"".equals(input.getImportPath()))
+ if (!StringUtils.isEmpty(input.getImportPath())) {
blueprint.setImports(importsService.createImportsFromFile(input.getImportPath()));
- else
+ } else {
blueprint.setImports(importsService.createImports(input.getBpType()));
+ }
Map<String, Node> nodeTemplate = new TreeMap<>();
String nodeName = onapComponentSpec.getSelf().getName();
Map<String, LinkedHashMap<String, Object>> inputs = new TreeMap<>();
- Map<String, Object> onapNodeResponse = nodeService.createOnapNode(inputs, onapComponentSpec, input.getServiceNameOverride());
+ Map<String, Object> onapNodeResponse =
+ nodeService
+ .createOnapNode(inputs, onapComponentSpec, input.getServiceNameOverride());
inputs = (Map<String, LinkedHashMap<String, Object>>) onapNodeResponse.get("inputs");
nodeTemplate.put(nodeName, (Node) onapNodeResponse.get("onapNode"));
blueprint.setNode_templates(nodeTemplate);
- if (onapComponentSpec.getPolicyInfo() != null)
+ if (onapComponentSpec.getPolicyInfo() != null) {
policyNodeService.addPolicyNodesAndInputs(onapComponentSpec, nodeTemplate, inputs);
+ }
- if (onapComponentSpec.getAuxilary() != null && onapComponentSpec.getAuxilary().getDatabases() != null)
+ if (onapComponentSpec.getAuxilary() != null
+ && onapComponentSpec.getAuxilary().getDatabases() != null) {
pgaasNodeService.addPgaasNodesAndInputs(onapComponentSpec, nodeTemplate, inputs);
+ }
blueprint.setInputs(inputs);
return quotationService.setQuotations(blueprint);
} catch (Exception ex) {
- throw new BlueprintException("Unable to create ONAP Blueprint Object from given input parameters", ex);
+ throw new BlueprintException(
+ "Unable to create ONAP Blueprint Object from given input parameters", ex);
}
}
-
-
}
-
-
-
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java
index c6d744c..7c87af7 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/AppConfigService.java
@@ -43,12 +43,9 @@ import java.util.TreeMap;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to create App Config
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service used to create App
+ * Config
*/
-
-
@Service("onapAppConfigService")
public class AppConfigService {
@@ -58,31 +55,52 @@ public class AppConfigService {
@Autowired
private BlueprintHelperService blueprintHelperService;
- public Map<String,Object> createAppconfig(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec, String override, boolean isDmaap) {
-
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates Inputs section under App Config with Publishes, Subscribes, Parameters sections by
+ * checking Datarouter/MessageRouter/override/Dmaap values
+ *
+ * @param inputs Inputs
+ * @param onapComponentSpec Onap Component Specification
+ * @param override Parameter to Service Component Override
+ * @param isDmaap Dmaap Argument
+ * @return
+ */
+ public Map<String, Object> createAppconfig(
+ Map<String, LinkedHashMap<String, Object>> inputs,
+ OnapComponentSpec onapComponentSpec,
+ String override,
+ boolean isDmaap) {
+
+ Map<String, Object> response = new HashMap<>();
Appconfig appconfig = new Appconfig();
Calls[] call = new Calls[0];
appconfig.setService_calls(call);
Map<String, Dmaap> streamPublishes = new TreeMap<>();
- if(onapComponentSpec.getStreams() != null) {
+ if (onapComponentSpec.getStreams() != null) {
if (onapComponentSpec.getStreams().getPublishes() != null) {
for (Publishes publishes : onapComponentSpec.getStreams().getPublishes()) {
if (blueprintHelperService.isDataRouterType(publishes.getType())) {
String config = publishes.getConfig_key();
String name = config + Constants._FEED;
- Map<String, Object> dmaapDataRouterResponse = dmaapService.createDmaapDataRouter(inputs, config, name, isDmaap);
- inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse.get("inputs");
+ Map<String, Object> dmaapDataRouterResponse =
+ dmaapService.createDmaapDataRouter(inputs, config, name, isDmaap);
+ inputs =
+ (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse
+ .get("inputs");
Dmaap dmaap = (Dmaap) dmaapDataRouterResponse.get("dmaap");
dmaap.setType(publishes.getType());
streamPublishes.put(config, dmaap);
} else if (blueprintHelperService.isMessageRouterType(publishes.getType())) {
String config = publishes.getConfig_key();
String name = config + Constants._TOPIC;
- Map<String, Object> dmaapDataRouterResponse = dmaapService.createDmaapMessageRouter(inputs, config, 'p', name, name, isDmaap);
- inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse.get("inputs");
+ Map<String, Object> dmaapDataRouterResponse =
+ dmaapService
+ .createDmaapMessageRouter(inputs, config, 'p', name, name, isDmaap);
+ inputs =
+ (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse
+ .get("inputs");
Dmaap dmaap = (Dmaap) dmaapDataRouterResponse.get("dmaap");
dmaap.setType(publishes.getType());
streamPublishes.put(config, dmaap);
@@ -93,22 +111,29 @@ public class AppConfigService {
Map<String, Dmaap> streamSubscribes = new TreeMap<>();
- if(onapComponentSpec.getStreams() != null) {
+ if (onapComponentSpec.getStreams() != null) {
if (onapComponentSpec.getStreams().getSubscribes() != null) {
for (Subscribes subscribes : onapComponentSpec.getStreams().getSubscribes()) {
if (blueprintHelperService.isDataRouterType(subscribes.getType())) {
String config = subscribes.getConfig_key();
String name = config + Constants._FEED;
- Map<String, Object> dmaapDataRouterResponse = dmaapService.createDmaapDataRouter(inputs, config, name, isDmaap);
- inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse.get("inputs");
+ Map<String, Object> dmaapDataRouterResponse =
+ dmaapService.createDmaapDataRouter(inputs, config, name, isDmaap);
+ inputs =
+ (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse
+ .get("inputs");
Dmaap dmaap = (Dmaap) dmaapDataRouterResponse.get("dmaap");
dmaap.setType(subscribes.getType());
streamSubscribes.put(config, dmaap);
} else if (blueprintHelperService.isMessageRouterType(subscribes.getType())) {
String config = subscribes.getConfig_key();
String name = config + Constants._TOPIC;
- Map<String, Object> dmaapDataRouterResponse = dmaapService.createDmaapMessageRouter(inputs, config, 's', name, name, isDmaap);
- inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse.get("inputs");
+ Map<String, Object> dmaapDataRouterResponse =
+ dmaapService
+ .createDmaapMessageRouter(inputs, config, 's', name, name, isDmaap);
+ inputs =
+ (Map<String, LinkedHashMap<String, Object>>) dmaapDataRouterResponse
+ .get("inputs");
Dmaap dmaap = (Dmaap) dmaapDataRouterResponse.get("dmaap");
dmaap.setType(subscribes.getType());
streamSubscribes.put(config, dmaap);
@@ -121,14 +146,15 @@ public class AppConfigService {
appconfig.setStreams_subscribes(streamSubscribes);
Map<String, Object> parameters = new TreeMap<>();
- for(Parameters p: onapComponentSpec.getParameters()) {
+ for (Parameters p : onapComponentSpec.getParameters()) {
String pName = p.getName();
- if(p.isSourced_at_deployment()) {
+ if (p.isSourced_at_deployment()) {
GetInput paramInput = new GetInput();
paramInput.setBpInputName(pName);
parameters.put(pName, paramInput);
- if(!"".equals(p.getValue())) {
- LinkedHashMap<String, Object> pInputs = blueprintHelperService.createStringInput( p.getValue());
+ if (!"".equals(p.getValue())) {
+ LinkedHashMap<String, Object> pInputs =
+ blueprintHelperService.createStringInput(p.getValue());
inputs.put(pName, pInputs);
} else {
LinkedHashMap<String, Object> pInputs = new LinkedHashMap<>();
@@ -136,23 +162,23 @@ public class AppConfigService {
inputs.put(pName, pInputs);
}
} else {
- if("string".equals(p.getType())) {
- String val =(String) p.getValue();
+ if ("string".equals(p.getType())) {
+ String val = (String) p.getValue();
val = '"' + val + '"';
parameters.put(pName, val);
- }
- else {
+ } else {
parameters.put(pName, p.getValue());
// Updated code to resolve the issue of missing \ for collector.schema.file
- //parameters.put(pName, pName.equals("collector.schema.file") ? ((String)p.getValue()).replace("\"", "\\\"") : p.getValue());
+ // parameters.put(pName, pName.equals("collector.schema.file") ?
+ // ((String)p.getValue()).replace("\"", "\\\"") : p.getValue());
}
}
}
- if(override != null) {
+ if (override != null) {
GetInput ov = new GetInput();
ov.setBpInputName(Constants.SERVICE_COMPONENT_NAME_OVERRIDE);
parameters.put(Constants.SERVICE_COMPONENT_NAME_OVERRIDE, ov);
- LinkedHashMap<String, Object> over = blueprintHelperService.createStringInput( override);
+ LinkedHashMap<String, Object> over = blueprintHelperService.createStringInput(override);
inputs.put(Constants.SERVICE_COMPONENT_NAME_OVERRIDE, over);
}
appconfig.setParams(parameters);
@@ -160,7 +186,5 @@ public class AppConfigService {
response.put("appconfig", appconfig);
response.put("inputs", inputs);
return response;
-
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/CommonUtils.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/CommonUtils.java
index 97ed47f..2bfa43e 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/CommonUtils.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/CommonUtils.java
@@ -23,8 +23,6 @@
package org.onap.blueprintgenerator.service.common;
-
-
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.ParseException;
@@ -40,106 +38,163 @@ import static java.lang.System.exit;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to Print Instructions and Parse Inputs
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service used by ONAP and
+ * DMAAP Blueprint to Print Instructions and Parse Inputs
*/
-
-
@Service("onapCommonUtilsService")
public class CommonUtils {
+ /**
+ * Prints input arguments options to run the Blueprint Application
+ */
public void printInstructions() {
System.out.println("OPTIONS:");
- System.out.println("-i OR --component-spec: The path of the ONAP Blueprint INPUT JSON SPEC FILE (Required)");
- System.out.println("-p OR --blueprint-path: The path of the ONAP Blueprint OUTPUT where it will be saved (Required)");
- System.out.println("-n OR --blueprint-name: The NAME of the ONAP Blueprint OUTPUT that will be created (Optional)");
- System.out.println("-t OR --imports: The path of the ONAP Blueprint IMPORT FILE (Optional)");
- System.out.println("-o OR --service-name-override: The Value used to OVERRIDE the SERVICE NAME of the ONAP Blueprint (Optional)");
- System.out.println("-d OR --dmaap-plugin: The option to create a ONAP Blueprint with DMAAP Plugin (Optional)");
- System.out.println("Syntax to run from command line: \n For Blueprint : java -jar target/<JAR Filename>.jar app ONAP -i componentspec -p OutputBlueprintPath -n Blueprintname -d \n For PolicyCreate: java -jar target/<JAR Filename>.jar app ONAP -type policycreate -i componentspec -p OutputPolicyPath");
+ System.out.println(
+ "-i OR --component-spec: The path of the ONAP Blueprint INPUT JSON SPEC FILE (Required)");
+ System.out.println(
+ "-p OR --blueprint-path: The path of the ONAP Blueprint OUTPUT where it will be saved (Required)");
+ System.out.println(
+ "-n OR --blueprint-name: The NAME of the ONAP Blueprint OUTPUT that will be created (Optional)");
+ System.out
+ .println("-t OR --imports: The path of the ONAP Blueprint IMPORT FILE (Optional)");
+ System.out.println(
+ "-o OR --service-name-override: The Value used to OVERRIDE the SERVICE NAME of the ONAP Blueprint (Optional)");
+ System.out.println(
+ "-d OR --dmaap-plugin: The option to create a ONAP Blueprint with DMAAP Plugin (Optional)");
+ System.out.println(
+ "Syntax to run from command line: \n For Blueprint : java -jar target/<JAR Filename>.jar app ONAP -i componentspec -p OutputBlueprintPath -n Blueprintname -d \n For PolicyCreate: java -jar target/<JAR Filename>.jar app ONAP -type policycreate -i componentspec -p OutputPolicyPath");
}
+ /**
+ * Parses Input Arguments and validates is reuired arguments are provided or not
+ *
+ * @param args Input Arguments
+ * @return
+ */
public Input parseInputs(String[] args) {
String[] modArgs = new String[args.length];
- for(int i=0; i<args.length; i++){
- if(args[i].contains("--component-spec"))
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].contains("--component-spec")) {
modArgs[i] = "-_component_spec";
- else if(args[i].contains("--blueprint-path"))
+ } else if (args[i].contains("--blueprint-path")) {
modArgs[i] = "-_blueprint_path";
- else if(args[i].contains("--blueprint-name"))
+ } else if (args[i].contains("--blueprint-name")) {
modArgs[i] = "-_blueprint_name";
- else if(args[i].contains("--imports"))
+ } else if (args[i].contains("--imports")) {
modArgs[i] = "-_imports";
- else if(args[i].contains("--service-name-override"))
+ } else if (args[i].contains("--service-name-override")) {
modArgs[i] = "-_service_name_override";
- else if(args[i].contains("--dmaap-plugin"))
+ } else if (args[i].contains("--dmaap-plugin")) {
modArgs[i] = "-_dmaap_plugin";
- else
+ } else {
modArgs[i] = args[i];
+ }
}
- String commands = " ";
- for (String s : modArgs) {
- commands = commands + " " + s;
+ StringBuilder commandsBuf = new StringBuilder("");
+ String sep = "";
+ for (String s : modArgs) {
+ commandsBuf.append(sep).append(s);
+ sep = " ";
}
+ String commands = commandsBuf.toString();
- //checks if the required inputs are present or not
- if (!(commands.contains(" -i ")|| commands.contains(" -_component_spec "))
- && !(commands.contains(" -p ") || commands.contains(" -_blueprint_path ") ) ) {
- System.out.println("\n Please enter the ONAP Blueprint required inputs for: \n -i (The path of the ONAP Blueprint INPUT JSON SPEC FILE), \n -p (The path of the ONAP Blueprint OUTPUT where it will be saved)");
+ // checks if the required inputs are present or not
+ if (!(commands.contains(" -i ") || commands.contains(" -_component_spec "))
+ && !(commands.contains(" -p ") || commands.contains(" -_blueprint_path "))) {
+ System.out.println(
+ "\n Please enter the ONAP Blueprint required inputs for: \n -i (The path of the ONAP Blueprint INPUT JSON SPEC FILE), \n -p (The path of the ONAP Blueprint OUTPUT where it will be saved)");
exit(-1);
}
-
CommandLineParser parser = new DefaultParser();
HelpFormatter formatter = new HelpFormatter();
Options options = new Options();
options.addOption("i", "Spec", true, "ComponentSpec Input File of the ONAP Blueprint");
- options.addOption("_component_spec", "Spec", true, "ComponentSpec Input File of the ONAP Blueprint");
+ options.addOption(
+ "_component_spec", "Spec", true, "ComponentSpec Input File of the ONAP Blueprint");
options.addOption("p", "Path", true, "Path of the ONAP Blueprint OUTPUT");
options.addOption("_blueprint_path", "Path", true, "Path of the ONAP Blueprint OUTPUT");
options.addOption("n", "name", true, "NAME of the ONAP Blueprint OUTPUT");
options.addOption("_blueprint_name", "name", true, "NAME of the ONAP Blueprint OUTPUT");
options.addOption("t", "Import File", true, "Import file for the OUTPUT Blueprint Imports");
- options.addOption("_imports", "Import File", true, "Import file for the OUTPUT Blueprint Imports");
- options.addOption("o", "Service name Override", true, "Value used to override the OUTPUT Blueprint service name");
- options.addOption("_service_name_override", "Service name Override", true, "Value used to override the OUTPUT Blueprint service name");
- options.addOption("d", "Dmaap Plugin", false, "Flag used to indicate ONAP Blueprint OUTPUT uses the DMaaP plugin");
- options.addOption("_dmaap_plugin", "Dmaap Plugin", false, "Flag used to indicate ONAP Blueprint OUTPUT uses the DMaaP plugin");
+ options.addOption(
+ "_imports", "Import File", true, "Import file for the OUTPUT Blueprint Imports");
+ options.addOption(
+ "o",
+ "Service name Override",
+ true,
+ "Value used to override the OUTPUT Blueprint service name");
+ options.addOption(
+ "_service_name_override",
+ "Service name Override",
+ true,
+ "Value used to override the OUTPUT Blueprint service name");
+ options.addOption(
+ "d",
+ "Dmaap Plugin",
+ false,
+ "Flag used to indicate ONAP Blueprint OUTPUT uses the DMaaP plugin");
+ options.addOption(
+ "_dmaap_plugin",
+ "Dmaap Plugin",
+ false,
+ "Flag used to indicate ONAP Blueprint OUTPUT uses the DMaaP plugin");
Input input = new Input();
try {
CommandLine commandLine = parser.parse(options, modArgs);
- input.setComponentSpecPath(commandLine.getOptionValue("i") == null ? commandLine.getOptionValue("_component_spec") : commandLine.getOptionValue("i"));
- input.setOutputPath(commandLine.getOptionValue("p") == null ? commandLine.getOptionValue("_blueprint_path") : commandLine.getOptionValue("p"));
- input.setBluePrintName(commandLine.getOptionValue("n") == null ? commandLine.getOptionValue("_blueprint_name") : commandLine.getOptionValue("n"));
- input.setImportPath(commandLine.getOptionValue("t") == null ? commandLine.getOptionValue("_imports") : commandLine.getOptionValue("t"));
- input.setBpType((commands.contains(" -d ") || commands.contains(" -_dmaap_plugin ") ) ? "d" : "o");
- input.setServiceNameOverride(commandLine.getOptionValue("o") == null ? commandLine.getOptionValue("_service_name_override") == null ? "" : commandLine.getOptionValue("_service_name_override") : commandLine.getOptionValue("o"));
+ input.setComponentSpecPath(
+ commandLine.getOptionValue("i") == null
+ ? commandLine.getOptionValue("_component_spec")
+ : commandLine.getOptionValue("i"));
+ input.setOutputPath(
+ commandLine.getOptionValue("p") == null
+ ? commandLine.getOptionValue("_blueprint_path")
+ : commandLine.getOptionValue("p"));
+ input.setBluePrintName(
+ commandLine.getOptionValue("n") == null
+ ? commandLine.getOptionValue("_blueprint_name")
+ : commandLine.getOptionValue("n"));
+ input.setImportPath(
+ commandLine.getOptionValue("t") == null
+ ? commandLine.getOptionValue("_imports")
+ : commandLine.getOptionValue("t"));
+ input.setBpType(
+ (commands.contains(" -d ") || commands.contains(" -_dmaap_plugin ")) ? "d" : "o");
+ input.setServiceNameOverride(
+ commandLine.getOptionValue("o") == null
+ ? commandLine.getOptionValue("_service_name_override") == null
+ ? ""
+ : commandLine.getOptionValue("_service_name_override")
+ : commandLine.getOptionValue("o"));
} catch (ParseException ex) {
ex.printStackTrace();
System.out.println(ex.getMessage());
- formatter.printHelp("Required/Valid Inputs to create ONAP Blueprint are not provided", options);
+ formatter.printHelp(
+ "Required/Valid Inputs to create ONAP Blueprint are not provided", options);
exit(-1);
}
if (StringUtils.isEmpty(input.getComponentSpecPath())) {
- System.out.println("The path of the ONAP Blueprint INPUT JSON SPEC FILE is not specified");
+ System.out
+ .println("The path of the ONAP Blueprint INPUT JSON SPEC FILE is not specified");
exit(-1);
}
if (StringUtils.isEmpty(input.getOutputPath())) {
- System.out.println("The path of the ONAP Blueprint OUTPUT where it will be saved is not specified");
+ System.out.println(
+ "The path of the ONAP Blueprint OUTPUT where it will be saved is not specified");
exit(-1);
}
if (commands.contains(" -n ") || commands.contains(" -_blueprint_name ")) {
if (StringUtils.isEmpty(input.getBluePrintName())) {
- System.out.println("The NAME of the ONAP Blueprint OUTPUT that will be created is not specified");
+ System.out.println(
+ "The NAME of the ONAP Blueprint OUTPUT that will be created is not specified");
exit(-1);
}
}
- if (commands.contains(" -t ")|| commands.contains(" -_imports ")) {
+ if (commands.contains(" -t ") || commands.contains(" -_imports ")) {
if (StringUtils.isEmpty(input.getImportPath())) {
System.out.println("The path of the ONAP Blueprint Imports File is not specified");
exit(-1);
@@ -148,5 +203,4 @@ public class CommonUtils {
return input;
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java
index 4991bda..7145ac8 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ComponentSpecService.java
@@ -23,6 +23,7 @@
package org.onap.blueprintgenerator.service.common;
+import java.io.IOException;
import org.onap.blueprintgenerator.exception.ComponentSpecException;
import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -51,7 +52,7 @@ public class ComponentSpecService {
/**
* Creates ComponentSpec from given file path and validates if the input is json file or not
*
- * @param componentSpecPath
+ * @param componentSpecPath Path of Component Spec File Location
* @return
*/
public OnapComponentSpec createComponentSpecFromFile(String componentSpecPath) {
@@ -63,7 +64,9 @@ public class ComponentSpecService {
componentSpec = componentMapper.readValue(new File(componentSpecPath), OnapComponentSpec.class);
}
} catch (Exception ex) {
- throw new ComponentSpecException("Unable to create ONAP Component Spec from the input file: "+ componentSpecPath, ex);
+ throw new ComponentSpecException(
+ "Unable to create ONAP Component Spec from the input file: " + componentSpecPath,
+ ex);
}
return componentSpec;
}
@@ -71,7 +74,8 @@ public class ComponentSpecService {
/**
* Creates the component spec from string.
* This method is used by RuntimeAPI
- * @param specString the spec string
+ * @param specString the spec string of Component Spec
+ * @return
*/
public OnapComponentSpec createComponentSpecFromString(String specString) {
OnapComponentSpec componentSpec;
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/DmaapService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/DmaapService.java
index d4b2c42..e21b852 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/DmaapService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/DmaapService.java
@@ -35,63 +35,87 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to add DMAAP Message and Data Routers
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add DMAAP Message
+ * and Data Routers
*/
-
-
@Service
public class DmaapService {
@Autowired
private InfoService infoService;
- // Method is used to create the Dmaap Message Router
- public Map<String,Object> createDmaapMessageRouter(Map<String, LinkedHashMap<String, Object>> inputs,String config, char type, String counter, String num, boolean isDmaap) {
-
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates Dmaap Message Router from given inputs
+ *
+ * @param inputs Input Arguments
+ * @param config Configuration
+ * @param type BP Type
+ * @param counter Counter
+ * @param num Number Incrementor
+ * @param isDmaap Dmaap Argument
+ * @return
+ */
+ public Map<String, Object> createDmaapMessageRouter(
+ Map<String, LinkedHashMap<String, Object>> inputs,
+ String config,
+ char type,
+ String counter,
+ String num,
+ boolean isDmaap) {
+
+ Map<String, Object> response = new HashMap<>();
Dmaap dmaap = new Dmaap();
LinkedHashMap<String, Object> stringType = new LinkedHashMap();
stringType.put("type", "string");
- if(!isDmaap){
- Map<String, Object> infoResponse = infoService.createMessageRouterInfo(inputs, config, type);
+ if (!isDmaap) {
+ Map<String, Object> infoResponse = infoService
+ .createMessageRouterInfo(inputs, config, type);
inputs = (Map<String, LinkedHashMap<String, Object>>) infoResponse.get("inputs");
dmaap.setDmaap_info(infoResponse.get("info"));
- }
- else{
+ } else {
String infoType = "<<" + counter + ">>";
dmaap.setDmaap_info(infoType);
GetInput u = new GetInput();
- u.setBpInputName(config + "_" + num +"_aaf_username");
+ u.setBpInputName(config + "_" + num + "_aaf_username");
dmaap.setUser(u);
- inputs.put(config + "_" + num +"_aaf_username", stringType);
+ inputs.put(config + "_" + num + "_aaf_username", stringType);
GetInput p = new GetInput();
- p.setBpInputName(config + "_" + num +"_aaf_password");
+ p.setBpInputName(config + "_" + num + "_aaf_password");
dmaap.setPass(p);
- inputs.put(config + "_" + num +"_aaf_password", stringType);
+ inputs.put(config + "_" + num + "_aaf_password", stringType);
}
response.put("dmaap", dmaap);
response.put("inputs", inputs);
return response;
}
- // Method is used to create the Dmaap Data Router
- public Map<String,Object> createDmaapDataRouter(Map<String, LinkedHashMap<String, Object>> inputs, String config, String counter, boolean isDmaap) {
-
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates Dmaap Data Router from given inputs
+ *
+ * @param inputs Input Arguments
+ * @param config Configuration
+ * @param counter Counter
+ * @param isDmaap Dmaap Argument
+ * @return
+ */
+ public Map<String, Object> createDmaapDataRouter(
+ Map<String, LinkedHashMap<String, Object>> inputs,
+ String config,
+ String counter,
+ boolean isDmaap) {
+
+ Map<String, Object> response = new HashMap<>();
Dmaap dmaap = new Dmaap();
- if(!isDmaap){
+ if (!isDmaap) {
Map<String, Object> infoResponse = infoService.createDataRouterInfo(inputs, config);
inputs = (Map<String, LinkedHashMap<String, Object>>) infoResponse.get("inputs");
dmaap.setDmaap_info(infoResponse.get("info"));
- }
- else {
+ } else {
String infoType = "<<" + counter + ">>";
dmaap.setDmaap_info(infoType);
}
@@ -99,5 +123,4 @@ public class DmaapService {
response.put("inputs", inputs);
return response;
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateDataFactoryService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateDataFactoryService.java
index ab48ada..f81da68 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateDataFactoryService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateDataFactoryService.java
@@ -30,21 +30,19 @@ import org.springframework.stereotype.Service;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to add External Certificate Data Factory
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add External
+ * Certificate Data Factory
*/
-
-
@Service
public abstract class ExternalCertificateDataFactoryService {
- // Method to concatenate Constant with field
+ // Method to concatenate Constant with field
protected static GetInput createPrefixedGetInput(String fieldName) {
return new GetInput(addPrefix(fieldName));
}
// Method to concatenate the Constant INPUT_PREFIX to the input field
- protected static String addPrefix(String fieldName) { return Constants.INPUT_PREFIX + fieldName; }
-
+ protected static String addPrefix(String fieldName) {
+ return Constants.INPUT_PREFIX + fieldName;
+ }
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateParametersFactoryService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateParametersFactoryService.java
index 300aa5d..226a319 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateParametersFactoryService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalCertificateParametersFactoryService.java
@@ -35,40 +35,52 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service used by ONAP and DMAAP Blueprint to add
- * External Certificate Parameters
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service used by ONAP and
+ * DMAAP Blueprint to add Common ONAP Service to add External Certificate Parameters Factory
*/
-
-
@Service
-public class ExternalCertificateParametersFactoryService extends ExternalCertificateDataFactoryService {
+public class ExternalCertificateParametersFactoryService
+ extends ExternalCertificateDataFactoryService {
@Autowired
private BlueprintHelperService blueprintHelperService;
- // method to create external certificate parameters
+ /**
+ * Creates external certificate parameters
+ *
+ * @return
+ */
public ExternalCertificateParameters create() {
- ExternalCertificateParameters externalCertificateParameters = new ExternalCertificateParameters();
- externalCertificateParameters.setCommonName(createPrefixedGetInput(Constants.COMMON_NAME_FIELD));
+ ExternalCertificateParameters externalCertificateParameters =
+ new ExternalCertificateParameters();
+ externalCertificateParameters.setCommonName(
+ createPrefixedGetInput(Constants.COMMON_NAME_FIELD));
externalCertificateParameters.setSans(createPrefixedGetInput(Constants.SANS_FIELD));
return externalCertificateParameters;
}
- // method to create input list for external certificate parameters factory
+ /**
+ * Creates input list for external certificate parameters factory
+ *
+ * @return
+ */
public Map<String, LinkedHashMap<String, Object>> createInputList() {
Map<String, LinkedHashMap<String, Object>> retInputs = new LinkedHashMap<>();
- LinkedHashMap<String, Object> commonNameInputMap = blueprintHelperService
- .createStringInput("Common name which should be present in certificate.", Constants.DEFAULT_COMMON_NAME);
+ LinkedHashMap<String, Object> commonNameInputMap =
+ blueprintHelperService.createStringInput(
+ "Common name which should be present in certificate.",
+ Constants.DEFAULT_COMMON_NAME);
retInputs.put(addPrefix(Constants.COMMON_NAME_FIELD), commonNameInputMap);
- LinkedHashMap<String, Object> sansInputMap = blueprintHelperService
- .createStringInput("\"List of Subject Alternative Names (SANs) which should be present in certificate. " +
- "Delimiter - , Should contain a common_name value and other FQDNs under which the given "
- + "component is accessible.\"", Constants.DEFAULT_SANS);
+ LinkedHashMap<String, Object> sansInputMap =
+ blueprintHelperService.createStringInput(
+ "\"List of Subject Alternative Names (SANs) which should be present in certificate. "
+ + "Delimiter - , Should contain a common_name value and other FQDNs under which the given "
+ + "component is accessible.\"",
+ Constants.DEFAULT_SANS);
retInputs.put(addPrefix(Constants.SANS_FIELD), sansInputMap);
return retInputs;
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalTlsInfoFactoryService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalTlsInfoFactoryService.java
index 10364ab..0694821 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalTlsInfoFactoryService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ExternalTlsInfoFactoryService.java
@@ -36,12 +36,9 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to add External TLS Info
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add External TLS
+ * Info
*/
-
-
@Service
public class ExternalTlsInfoFactoryService extends ExternalCertificateDataFactoryService {
@@ -51,37 +48,58 @@ public class ExternalTlsInfoFactoryService extends ExternalCertificateDataFactor
@Autowired
private BlueprintHelperService blueprintHelperService;
- //Method to create External TLS Info from Component Spec
+ /**
+ * Creates External TLS Info from Component Spec
+ *
+ * @param cs ComponentSpec
+ * @return
+ */
public ExternalTlsInfo createFromComponentSpec(OnapComponentSpec cs) {
ExternalTlsInfo externalTlsInfoBp = new ExternalTlsInfo();
Map<String, Object> tlsInfoCs = cs.getAuxilary().getTls_info();
- externalTlsInfoBp.setExternalCertDirectory((String) tlsInfoCs.get(Constants.CERT_DIRECTORY_FIELD));
- externalTlsInfoBp.setUseExternalTls(createPrefixedGetInput(Constants.USE_EXTERNAL_TLS_FIELD));
+ externalTlsInfoBp.setExternalCertDirectory(
+ (String) tlsInfoCs.get(Constants.CERT_DIRECTORY_FIELD));
+ externalTlsInfoBp
+ .setUseExternalTls(createPrefixedGetInput(Constants.USE_EXTERNAL_TLS_FIELD));
externalTlsInfoBp.setCaName(createPrefixedGetInput(Constants.CA_NAME_FIELD));
externalTlsInfoBp.setCertType(createPrefixedGetInput(Constants.CERT_TYPE_FIELD));
- externalTlsInfoBp.setExternalCertificateParameters(externalCertificateParametersFactoryService.create());
+ externalTlsInfoBp.setExternalCertificateParameters(
+ externalCertificateParametersFactoryService.create());
return externalTlsInfoBp;
}
- //Method to create Input List for External TLS Info from Component Spec
- public Map<String, LinkedHashMap<String, Object>> createInputListFromComponentSpec(OnapComponentSpec cs) {
+ /**
+ * Creates Input List for External TLS Info from Component Spec
+ *
+ * @param cs ComponentSpec
+ * @return
+ */
+ public Map<String, LinkedHashMap<String, Object>> createInputListFromComponentSpec(
+ OnapComponentSpec cs) {
Map<String, LinkedHashMap<String, Object>> retInputs = new HashMap<>();
Map<String, Object> externalTlsInfoCs = cs.getAuxilary().getTls_info();
- LinkedHashMap<String, Object> useTlsFlagInput = blueprintHelperService.createBooleanInput("Flag to indicate external tls enable/disable.",externalTlsInfoCs.get(Constants.USE_EXTERNAL_TLS_FIELD));
+ LinkedHashMap<String, Object> useTlsFlagInput =
+ blueprintHelperService.createBooleanInput(
+ "Flag to indicate external tls enable/disable.",
+ externalTlsInfoCs.get(Constants.USE_EXTERNAL_TLS_FIELD));
retInputs.put(addPrefix(Constants.USE_EXTERNAL_TLS_FIELD), useTlsFlagInput);
- LinkedHashMap<String, Object> caNameInputMap = blueprintHelperService.createStringInput("Name of Certificate Authority configured on CertService side.",Constants.DEFAULT_CA);
+ LinkedHashMap<String, Object> caNameInputMap =
+ blueprintHelperService.createStringInput(
+ "Name of Certificate Authority configured on CertService side.",
+ Constants.DEFAULT_CA);
retInputs.put(addPrefix(Constants.CA_NAME_FIELD), caNameInputMap);
- LinkedHashMap<String, Object> certTypeInputMap = blueprintHelperService.createStringInput("Format of provided certificates",Constants.DEFAULT_CERT_TYPE);
+ LinkedHashMap<String, Object> certTypeInputMap =
+ blueprintHelperService.createStringInput(
+ "Format of provided certificates", Constants.DEFAULT_CERT_TYPE);
retInputs.put(addPrefix(Constants.CERT_TYPE_FIELD), certTypeInputMap);
retInputs.putAll(externalCertificateParametersFactoryService.createInputList());
return retInputs;
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ImportsService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ImportsService.java
index cb9c03c..6fa43da 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ImportsService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ImportsService.java
@@ -37,12 +37,9 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: DCAE/ONAP - Blueprint Generator
- * Common Module: Used by ONAP Blueprint Application
- * Service: For Imports
+ * @date 10/16/2020 Application: DCAE/ONAP - Blueprint Generator Common Module: Used by ONAP
+ * Blueprint Application Service: For Imports
*/
-
@Service
public class ImportsService {
@@ -64,11 +61,16 @@ public class ImportsService {
@Value("${import.Clamp}")
private String importClamp;
-
@Qualifier("yamlObjectMapper")
@Autowired
protected ObjectMapper yamlObjectMapper;
+ /**
+ * Creates Imports for Blueprint based on Blueprint Type
+ *
+ * @param bpType Blueprint Type
+ * @return
+ */
public List<String> createImports(String bpType) {
List<String> imports = new ArrayList<>();
if (bpType.equals("o")) {
@@ -77,8 +79,7 @@ public class ImportsService {
imports.add(importsOnapK8sDcaepolicyplugin);
imports.add(importPostgres);
imports.add(importClamp);
- }
- else {
+ } else {
imports.add(importsOnapTypes);
imports.add(importsOnapK8sPlugintypes);
imports.add(importsDmaapDmaapplugin);
@@ -88,11 +89,16 @@ public class ImportsService {
return imports;
}
+ /**
+ * Creates Imports for Blueprint from the file path provided
+ *
+ * @param path Path of Import File
+ * @return
+ */
public List<String> createImportsFromFile(String path) throws IOException {
File importPath = new File(path);
Imports imports = yamlObjectMapper.readValue(importPath, Imports.class);
imports.getImports().removeIf(String::isBlank);
return imports.getImports();
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/InterfacesService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/InterfacesService.java
index bfd14a4..a14204f 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/InterfacesService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/InterfacesService.java
@@ -35,22 +35,26 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to add Interfaces
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add Interfaces
*/
-
-
@Service
public class InterfacesService {
@Autowired
private StartService startService;
- // Method to create Interface to include Start and Start inputs sections in BP
- public Map<String,Object> createInterface(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec){
+ /**
+ * Creates Interface to include Start and Start inputs sections in BP for given Inputs and
+ * ComponentSpec
+ *
+ * @param inputs Inputs
+ * @param onapComponentSpec OnapComponentSpec
+ * @return
+ */
+ public Map<String, Object> createInterface(
+ Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec) {
- Map<String,Object> response = new HashMap<>();
+ Map<String, Object> response = new HashMap<>();
Interfaces interfaces = new Interfaces();
Map<String, Object> startResponse = startService.createStart(inputs, onapComponentSpec);
@@ -62,6 +66,4 @@ public class InterfacesService {
response.put("inputs", inputs);
return response;
}
-
}
-
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/NodeService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/NodeService.java
index b8da0d7..ab1b7f2 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/NodeService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/NodeService.java
@@ -42,15 +42,11 @@ import java.util.HashMap;
import java.util.TreeMap;
import java.util.List;
-
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to add ONAP/DMAAP/Feed/Topic Nodes
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add
+ * ONAP/DMAAP/Feed/Topic Nodes
*/
-
-
@Service
public class NodeService {
@@ -69,68 +65,97 @@ public class NodeService {
@Autowired
private BlueprintHelperService blueprintHelperService;
- // method to create Onap Node to include interface
- public Map<String,Object> createOnapNode(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec, String override) {
-
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates Onap Node to include interface
+ *
+ * @param inputs Inputs
+ * @param onapComponentSpec OnapComponentSpec
+ * @param override Service Name Override
+ * @return
+ */
+ public Map<String, Object> createOnapNode(
+ Map<String, LinkedHashMap<String, Object>> inputs,
+ OnapComponentSpec onapComponentSpec,
+ String override) {
+
+ Map<String, Object> response = new HashMap<>();
Node onapNode = new Node();
- Map<String, Object> onapResponse = interfacesService.createInterface(inputs, onapComponentSpec);
+ Map<String, Object> onapResponse = interfacesService
+ .createInterface(inputs, onapComponentSpec);
inputs = (Map<String, LinkedHashMap<String, Object>>) onapResponse.get("inputs");
Map<String, Interfaces> interfaces = new TreeMap<>();
- interfaces.put(Constants.CLOUDIFY_INTERFACES_LEFECYCLE, (Interfaces) onapResponse.get("interfaces"));
+ interfaces.put(
+ Constants.CLOUDIFY_INTERFACES_LEFECYCLE, (Interfaces) onapResponse.get("interfaces"));
onapNode.setInterfaces(interfaces);
onapNode.setType(Constants.DCAE_NODES_CONTAINERIZED_SERVICE_COMPONENT);
List<Map<String, String>> relationships = new ArrayList();
- if(onapComponentSpec.getPolicyInfo() != null){
- List<Map<String, String>> policyRelationshipsList = policyNodeService.getPolicyRelationships(onapComponentSpec);
+ if (onapComponentSpec.getPolicyInfo() != null) {
+ List<Map<String, String>> policyRelationshipsList =
+ policyNodeService.getPolicyRelationships(onapComponentSpec);
relationships.addAll(policyRelationshipsList);
}
- if(onapComponentSpec.getAuxilary().getDatabases() != null){
- List<Map<String, String>> pgaasRelationshipsList = pgaasNodeService.getPgaasNodeRelationships(onapComponentSpec);
+ if (onapComponentSpec.getAuxilary().getDatabases() != null) {
+ List<Map<String, String>> pgaasRelationshipsList =
+ pgaasNodeService.getPgaasNodeRelationships(onapComponentSpec);
relationships.addAll(pgaasRelationshipsList);
}
onapNode.setRelationships(relationships);
- Map<String, Object> propertiesResponse = propertiesService.createOnapProperties(inputs, onapComponentSpec, override);
+ Map<String, Object> propertiesResponse =
+ propertiesService.createOnapProperties(inputs, onapComponentSpec, override);
inputs = (Map<String, LinkedHashMap<String, Object>>) propertiesResponse.get("inputs");
- onapNode.setProperties((org.onap.blueprintgenerator.model.common.Properties)propertiesResponse.get("properties"));
+ onapNode.setProperties(
+ (org.onap.blueprintgenerator.model.common.Properties) propertiesResponse
+ .get("properties"));
response.put("onapNode", onapNode);
response.put("inputs", inputs);
return response;
}
- // method to create Dmaap Node to include interface
- public Map<String,Object> createDmaapNode(OnapComponentSpec onapComponentSpec, Map<String, LinkedHashMap<String, Object>> inputs, String override) {
-
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates Dmaap Node to include interface
+ *
+ * @param inputs Inputs
+ * @param onapComponentSpec OnapComponentSpec
+ * @param override Service Name Override
+ * @return
+ */
+ public Map<String, Object> createDmaapNode(
+ OnapComponentSpec onapComponentSpec,
+ Map<String, LinkedHashMap<String, Object>> inputs,
+ String override) {
+
+ Map<String, Object> response = new HashMap<>();
Node dmaapNode = new Node();
dmaapNode.setType(Constants.DCAE_NODES_CONTAINERIZED_SERVICE_COMPONENT_USING_DMAAP);
- Map<String, Object> dmaapResponse = interfacesService.createInterface(inputs, onapComponentSpec);
+ Map<String, Object> dmaapResponse =
+ interfacesService.createInterface(inputs, onapComponentSpec);
inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapResponse.get("inputs");
Map<String, Interfaces> interfaces = new TreeMap<>();
- interfaces.put(Constants.CLOUDIFY_INTERFACES_LEFECYCLE, (Interfaces) dmaapResponse.get("interfaces"));
+ interfaces.put(
+ Constants.CLOUDIFY_INTERFACES_LEFECYCLE, (Interfaces) dmaapResponse.get("interfaces"));
dmaapNode.setInterfaces(interfaces);
List<Map<String, String>> relationships = new ArrayList();
- if(onapComponentSpec.getStreams().getPublishes() != null) {
- for(Publishes publishes: onapComponentSpec.getStreams().getPublishes()) {
+ if (onapComponentSpec.getStreams().getPublishes() != null) {
+ for (Publishes publishes : onapComponentSpec.getStreams().getPublishes()) {
Map<String, String> pubRelations = new LinkedHashMap();
- if(blueprintHelperService.isMessageRouterType(publishes.getType())){
+ if (blueprintHelperService.isMessageRouterType(publishes.getType())) {
pubRelations.put("type", Constants.PUBLISH_EVENTS);
pubRelations.put("target", publishes.getConfig_key() + Constants._TOPIC);
- } else if(blueprintHelperService.isDataRouterType(publishes.getType())){
+ } else if (blueprintHelperService.isDataRouterType(publishes.getType())) {
pubRelations.put("type", Constants.PUBLISH_FILES);
pubRelations.put("target", publishes.getConfig_key() + Constants._FEED);
}
@@ -138,13 +163,13 @@ public class NodeService {
}
}
- if(onapComponentSpec.getStreams().getSubscribes() != null) {
- for(Subscribes subscribes: onapComponentSpec.getStreams().getSubscribes()) {
- Map<String, String> subRelations = new LinkedHashMap();
- if(blueprintHelperService.isMessageRouterType(subscribes.getType())){
+ if (onapComponentSpec.getStreams().getSubscribes() != null) {
+ for (Subscribes subscribes : onapComponentSpec.getStreams().getSubscribes()) {
+ Map<String, String> subRelations = new LinkedHashMap();
+ if (blueprintHelperService.isMessageRouterType(subscribes.getType())) {
subRelations.put("type", Constants.SUBSCRIBE_TO_EVENTS);
subRelations.put("target", subscribes.getConfig_key() + Constants._TOPIC);
- } else if(blueprintHelperService.isDataRouterType(subscribes.getType())){
+ } else if (blueprintHelperService.isDataRouterType(subscribes.getType())) {
subRelations.put("type", Constants.SUBSCRIBE_TO_FILES);
subRelations.put("target", subscribes.getConfig_key() + Constants._FEED);
}
@@ -152,30 +177,42 @@ public class NodeService {
}
}
- if(onapComponentSpec.getPolicyInfo() != null){
- List<Map<String, String>> policyRelationshipsList = policyNodeService.getPolicyRelationships(onapComponentSpec);
+ if (onapComponentSpec.getPolicyInfo() != null) {
+ List<Map<String, String>> policyRelationshipsList =
+ policyNodeService.getPolicyRelationships(onapComponentSpec);
relationships.addAll(policyRelationshipsList);
}
- if(onapComponentSpec.getAuxilary().getDatabases() != null){
- List<Map<String, String>> pgaasRelationshipsList = pgaasNodeService.getPgaasNodeRelationships(onapComponentSpec);
+ if (onapComponentSpec.getAuxilary().getDatabases() != null) {
+ List<Map<String, String>> pgaasRelationshipsList =
+ pgaasNodeService.getPgaasNodeRelationships(onapComponentSpec);
relationships.addAll(pgaasRelationshipsList);
}
dmaapNode.setRelationships(relationships);
- Map<String, Object> propertiesResponse = propertiesService.createDmaapProperties(inputs, onapComponentSpec, override);
+ Map<String, Object> propertiesResponse =
+ propertiesService.createDmaapProperties(inputs, onapComponentSpec, override);
inputs = (Map<String, LinkedHashMap<String, Object>>) propertiesResponse.get("inputs");
- dmaapNode.setProperties((org.onap.blueprintgenerator.model.common.Properties)propertiesResponse.get("properties"));
+ dmaapNode.setProperties(
+ (org.onap.blueprintgenerator.model.common.Properties) propertiesResponse
+ .get("properties"));
response.put("dmaapNode", dmaapNode);
response.put("inputs", inputs);
return response;
}
- // method to create Feed Node for Streams
- public Map<String,Object> createFeedNode(Map<String, LinkedHashMap<String, Object>> inputs, String name){
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates Feed Node for Streams
+ *
+ * @param inputs Inputs
+ * @param name Name
+ * @return
+ */
+ public Map<String, Object> createFeedNode(
+ Map<String, LinkedHashMap<String, Object>> inputs, String name) {
+ Map<String, Object> response = new HashMap<>();
Node feedNode = new Node();
LinkedHashMap<String, Object> stringType = new LinkedHashMap();
@@ -183,7 +220,8 @@ public class NodeService {
feedNode.setType(Constants.FEED);
- org.onap.blueprintgenerator.model.common.Properties props = new org.onap.blueprintgenerator.model.common.Properties();
+ org.onap.blueprintgenerator.model.common.Properties props =
+ new org.onap.blueprintgenerator.model.common.Properties();
GetInput topicInput = new GetInput();
topicInput.setBpInputName(name + "_name");
props.setFeed_name(topicInput);
@@ -196,9 +234,16 @@ public class NodeService {
return response;
}
- // method to create Topic Node for Streams
- public Map<String,Object> createTopicNode(Map<String, LinkedHashMap<String, Object>> inputs, String name){
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates Topic Node for Streams
+ *
+ * @param inputs Inpts
+ * @param name Name
+ * @return
+ */
+ public Map<String, Object> createTopicNode(
+ Map<String, LinkedHashMap<String, Object>> inputs, String name) {
+ Map<String, Object> response = new HashMap<>();
Node topicNode = new Node();
LinkedHashMap<String, Object> stringType = new LinkedHashMap();
@@ -217,6 +262,4 @@ public class NodeService {
response.put("inputs", inputs);
return response;
}
-
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PgaasNodeService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PgaasNodeService.java
index ff45701..d18ca92 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PgaasNodeService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PgaasNodeService.java
@@ -26,7 +26,6 @@ package org.onap.blueprintgenerator.service.common;
import org.onap.blueprintgenerator.constants.Constants;
import org.onap.blueprintgenerator.exception.DatabasesNotFoundException;
-
import org.onap.blueprintgenerator.model.common.Node;
import org.onap.blueprintgenerator.model.common.PgaasNode;
import org.onap.blueprintgenerator.model.common.GetInput;
@@ -45,30 +44,43 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to add Pgaas Node
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add Pgaas Node
*/
-
-
@Service
public class PgaasNodeService {
@Autowired
private BlueprintHelperService blueprintHelperService;
- // method to create Pgaas Nodes and Inputs for Databases
- public void addPgaasNodesAndInputs(OnapComponentSpec onapComponentSpec, Map<String, Node> nodeTemplate, Map<String, LinkedHashMap<String, Object>> inputs) {
+ /**
+ * Creates Pgaas Nodes and Inputs for Databases
+ *
+ * @param onapComponentSpec OnapComponentSpec
+ * @param nodeTemplate Node template
+ * @param inputs Inputs
+ * @return
+ */
+ public void addPgaasNodesAndInputs(
+ OnapComponentSpec onapComponentSpec,
+ Map<String, Node> nodeTemplate,
+ Map<String, LinkedHashMap<String, Object>> inputs) {
Map<String, String> databases = onapComponentSpec.getAuxilary().getDatabases();
- for(Map.Entry<String, String> database : databases.entrySet()){
- addPgaasNode(database, nodeTemplate);
- addPgaasInputs(database, inputs);
+ if (databases != null) {
+ for (Map.Entry<String, String> database : databases.entrySet()) {
+ addPgaasNode(database, nodeTemplate);
+ addPgaasInputs(database, inputs);
+ }
}
}
- private void addPgaasInputs(Map.Entry<String, String> database, Map<String, LinkedHashMap<String, Object>> inputs) {
- inputs.put(database.getKey() + Constants.NAME_POSTFIX, blueprintHelperService.createStringInput( "db name", ""));
- inputs.put(database.getKey() + Constants.WRITER_FQDN_POSTFIX, blueprintHelperService.createStringInput( "db writerfqdn", ""));
+ private void addPgaasInputs(
+ Map.Entry<String, String> database, Map<String, LinkedHashMap<String, Object>> inputs) {
+ inputs.put(
+ database.getKey() + Constants.NAME_POSTFIX,
+ blueprintHelperService.createStringInput("db name", ""));
+ inputs.put(
+ database.getKey() + Constants.WRITER_FQDN_POSTFIX,
+ blueprintHelperService.createStringInput("db writerfqdn", ""));
}
private void addPgaasNode(Map.Entry<String, String> database, Map<String, Node> nodeTemplate) {
@@ -76,7 +88,7 @@ public class PgaasNodeService {
String dbName = database.getKey();
pgaasNode.setType(Constants.PGAAS_NODE_TYPE);
pgaasNode.setPgaasNodeProperties(buildPgaasNodeProperties(dbName));
- nodeTemplate.put(dbName + Constants.PGAAS_NODE_NAME_POSTFIX , pgaasNode);
+ nodeTemplate.put(dbName + Constants.PGAAS_NODE_NAME_POSTFIX, pgaasNode);
}
private PgaasNodeProperties buildPgaasNodeProperties(String dbName) {
@@ -95,10 +107,17 @@ public class PgaasNodeService {
return pgaasNodeProperties;
}
- // method to create Pgaas Node Relationships for Databases
- public List<Map<String, String>> getPgaasNodeRelationships(OnapComponentSpec onapComponentSpec) {
+ /**
+ * Creates Pgaas Nodes Relationships for Databases
+ *
+ * @param onapComponentSpec OnapComponentSpec
+ * @return
+ */
+ public List<Map<String, String>> getPgaasNodeRelationships(
+ OnapComponentSpec onapComponentSpec) {
List<Map<String, String>> relationships = new ArrayList<>();
- for(Map.Entry<String, String> database : onapComponentSpec.getAuxilary().getDatabases().entrySet()){
+ for (Map.Entry<String, String> database :
+ onapComponentSpec.getAuxilary().getDatabases().entrySet()) {
Map<String, String> relationship = new LinkedHashMap<>();
relationship.put("type", Constants.DB_RELATIONSHIP_TYPE);
relationship.put("target", database.getKey() + Constants.PGAAS_NODE_NAME_POSTFIX);
@@ -107,10 +126,15 @@ public class PgaasNodeService {
return relationships;
}
- // method to create Env Variables for Databases
+ /**
+ * Creates Env Variables for Databases
+ *
+ * @param databases Database
+ * @return
+ */
public Map<String, Object> getEnvVariables(Map<String, String> databases) {
Map<String, Object> envVariables = new LinkedHashMap<>();
- for(Map.Entry<String, String> database : databases.entrySet()){
+ for (Map.Entry<String, String> database : databases.entrySet()) {
String name = database.getKey().toUpperCase();
envVariables.put("<<", "*envs");
@@ -118,21 +142,25 @@ public class PgaasNodeService {
nameValue.setBpInputName(name.toLowerCase() + Constants.NAME_POSTFIX);
envVariables.put(name + "_DB_NAME", nameValue);
- GetAttribute adminHostValue = buildGetAttributeValue(name.toLowerCase(), "admin", "host");
- envVariables.put( name.toUpperCase() + "_DB_ADMIN_HOST", adminHostValue);
+ GetAttribute adminHostValue = buildGetAttributeValue(name.toLowerCase(), "admin",
+ "host");
+ envVariables.put(name.toUpperCase() + "_DB_ADMIN_HOST", adminHostValue);
- GetAttribute adminUserValue = buildGetAttributeValue(name.toLowerCase(), "admin", "user");
- envVariables.put( name.toUpperCase() + "_DB_ADMIN_USER", adminUserValue);
+ GetAttribute adminUserValue = buildGetAttributeValue(name.toLowerCase(), "admin",
+ "user");
+ envVariables.put(name.toUpperCase() + "_DB_ADMIN_USER", adminUserValue);
- GetAttribute adminPasswordValue = buildGetAttributeValue(name.toLowerCase(), "admin", "password");
- envVariables.put( name.toUpperCase() + "_DB_ADMIN_PASS", adminPasswordValue);
+ GetAttribute adminPasswordValue =
+ buildGetAttributeValue(name.toLowerCase(), "admin", "password");
+ envVariables.put(name.toUpperCase() + "_DB_ADMIN_PASS", adminPasswordValue);
}
return envVariables;
}
private GetAttribute buildGetAttributeValue(String dbName, String owner, String type) {
GetAttribute attribute = new GetAttribute();
- attribute.setAttribute(Arrays.asList(dbName + Constants.PGAAS_NODE_NAME_POSTFIX, owner, type));
+ attribute
+ .setAttribute(Arrays.asList(dbName + Constants.PGAAS_NODE_NAME_POSTFIX, owner, type));
return attribute;
}
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java
index 7f6c63d..43d819f 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PolicyNodeService.java
@@ -41,31 +41,40 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to add Policy Node
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add Policy Node
*/
-
-
@Service("onapPolicyNodeService")
public class PolicyNodeService {
@Autowired
private BlueprintHelperService blueprintHelperService;
- // Method to add Policy Nodes and Inputs
- public void addPolicyNodesAndInputs(OnapComponentSpec onapComponentSpec, Map<String, Node> nodeTemplate, Map<String, LinkedHashMap<String, Object>> inputs) {
+ /**
+ * Creates Policy Nodes and Inputs
+ *
+ * @param onapComponentSpec OnapComponentSpec
+ * @param nodeTemplate Node Template
+ * @param inputs Inputs
+ * @return
+ */
+ public void addPolicyNodesAndInputs(
+ OnapComponentSpec onapComponentSpec,
+ Map<String, Node> nodeTemplate,
+ Map<String, LinkedHashMap<String, Object>> inputs) {
List<TypePolicy> policyList = onapComponentSpec.getPolicyInfo().getTypePolicyList();
- for(TypePolicy policy: policyList){
+ for (TypePolicy policy : policyList) {
addPolicyNodesToNodeTemplate(policy, nodeTemplate);
addPolicyInputs(policy, inputs);
}
}
- private void addPolicyInputs(TypePolicy policy, Map<String, LinkedHashMap<String, Object>> inputs) {
+ private void addPolicyInputs(
+ TypePolicy policy, Map<String, LinkedHashMap<String, Object>> inputs) {
String defaultValue = policy.getPolicy_id();
defaultValue = defaultValue != null ? defaultValue : "";
- inputs.put(policy.getNode_label() + "_policy_id", blueprintHelperService.createStringInput("policy_id", defaultValue));
+ inputs.put(
+ policy.getNode_label() + "_policy_id",
+ blueprintHelperService.createStringInput("policy_id", defaultValue));
}
private void addPolicyNodesToNodeTemplate(TypePolicy policy, Map<String, Node> nodeTemplate) {
@@ -84,11 +93,16 @@ public class PolicyNodeService {
return policyNodeProperties;
}
- // Method to add Policy Relationships
+ /**
+ * Creates Policy Relationships
+ *
+ * @param onapComponentSpec OnapComponentSpec
+ * @return
+ */
public List<Map<String, String>> getPolicyRelationships(OnapComponentSpec onapComponentSpec) {
List<Map<String, String>> relationships = new ArrayList<>();
List<TypePolicy> policyList = onapComponentSpec.getPolicyInfo().getTypePolicyList();
- for(TypePolicy policy: policyList){
+ for (TypePolicy policy : policyList) {
Map<String, String> relationship = new LinkedHashMap<>();
relationship.put("type", Constants.POLICY_RELATIONSHIP_TYPE);
relationship.put("target", policy.getNode_label());
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PropertiesService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PropertiesService.java
index e858d88..3c36cca 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PropertiesService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/PropertiesService.java
@@ -47,13 +47,9 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to create Properties Node
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to create Properties
+ * Node
*/
-
-
-
@Service("onapPropertiesService")
public class PropertiesService {
@@ -72,18 +68,30 @@ public class PropertiesService {
@Autowired
private BlueprintHelperService blueprintHelperService;
- // Method to create ONAP properties
- public Map<String,Object> createOnapProperties(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec, String override) {
- Map<String,Object> response = new HashMap<>();
- org.onap.blueprintgenerator.model.common.Properties properties = new org.onap.blueprintgenerator.model.common.Properties();
+ /**
+ * Creates ONAP properties
+ *
+ * @param inputs Inputs
+ * @param onapComponentSpec OnapComponentSpec
+ * @param override Override
+ * @return
+ */
+ public Map<String, Object> createOnapProperties(
+ Map<String, LinkedHashMap<String, Object>> inputs,
+ OnapComponentSpec onapComponentSpec,
+ String override) {
+ Map<String, Object> response = new HashMap<>();
+ org.onap.blueprintgenerator.model.common.Properties properties =
+ new org.onap.blueprintgenerator.model.common.Properties();
GetInput image = new GetInput();
image.setBpInputName("image");
properties.setImage(image);
LinkedHashMap<String, Object> img = new LinkedHashMap<>();
- inputs.put("image", blueprintHelperService.createStringInput(onapComponentSpec.getArtifacts()[0].getUri()));
-
+ inputs.put(
+ "image",
+ blueprintHelperService.createStringInput(onapComponentSpec.getArtifacts()[0].getUri()));
GetInput location = new GetInput();
location.setBpInputName("location_id");
@@ -98,14 +106,16 @@ public class PropertiesService {
replica.setBpInputName("replicas");
properties.setReplicas(replica);
- LinkedHashMap<String, Object> replicas = blueprintHelperService.createIntegerInput("number of instances", 1);
+ LinkedHashMap<String, Object> replicas =
+ blueprintHelperService.createIntegerInput("number of instances", 1);
inputs.put("replicas", replicas);
OnapAuxilary onapAuxilary = onapComponentSpec.getAuxilary();
properties.setDocker_config(onapAuxilary);
- Map<String, Object> appConfigResponse = appConfigService.createAppconfig(inputs, onapComponentSpec, override, false);
+ Map<String, Object> appConfigResponse =
+ appConfigService.createAppconfig(inputs, onapComponentSpec, override, false);
inputs = (Map<String, LinkedHashMap<String, Object>>) appConfigResponse.get("inputs");
properties.setApplication_config((Appconfig) appConfigResponse.get("appconfig"));
@@ -114,7 +124,9 @@ public class PropertiesService {
properties.setAlways_pull_image(always_pull_image);
- LinkedHashMap<String, Object> inputAlwaysPullImage = blueprintHelperService.createBooleanInput("Set to true if the image should always be pulled",true);
+ LinkedHashMap<String, Object> inputAlwaysPullImage =
+ blueprintHelperService.createBooleanInput(
+ "Set to true if the image should always be pulled", true);
inputs.put("always_pull_image", inputAlwaysPullImage);
String sType = onapComponentSpec.getSelf().getName();
@@ -122,33 +134,49 @@ public class PropertiesService {
properties.setService_component_type(sType);
Map<String, Object> tls_info = onapComponentSpec.getAuxilary().getTls_info();
- if(tls_info != null) {
+ if (tls_info != null) {
addTlsInfo(onapComponentSpec, inputs, properties);
if (tls_info.get(Constants.USE_EXTERNAL_TLS_FIELD) != null) {
- inputs.putAll(addExternalTlsInfo(onapComponentSpec,properties));
+ inputs.putAll(addExternalTlsInfo(onapComponentSpec, properties));
}
}
- Map<String, Object> resourceConfigResponse = resourceConfigService.createResourceConfig(inputs, onapComponentSpec.getSelf().getName());
+ Map<String, Object> resourceConfigResponse =
+ resourceConfigService
+ .createResourceConfig(inputs, onapComponentSpec.getSelf().getName());
inputs = (Map<String, LinkedHashMap<String, Object>>) resourceConfigResponse.get("inputs");
- properties.setResource_config((ResourceConfig) resourceConfigResponse.get("resourceConfig"));
+ properties
+ .setResource_config((ResourceConfig) resourceConfigResponse.get("resourceConfig"));
response.put("properties", properties);
response.put("inputs", inputs);
return response;
}
- // Method to create Dmaap properties
- public Map<String,Object> createDmaapProperties(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec, String override) {
- Map<String,Object> response = new HashMap<>();
- org.onap.blueprintgenerator.model.common.Properties properties = new org.onap.blueprintgenerator.model.common.Properties();
+ /**
+ * Creates Dmaap properties
+ *
+ * @param inputs Inputs
+ * @param onapComponentSpec OnapComponentSpec
+ * @param override Override
+ * @return
+ */
+ public Map<String, Object> createDmaapProperties(
+ Map<String, LinkedHashMap<String, Object>> inputs,
+ OnapComponentSpec onapComponentSpec,
+ String override) {
+ Map<String, Object> response = new HashMap<>();
+ org.onap.blueprintgenerator.model.common.Properties properties =
+ new org.onap.blueprintgenerator.model.common.Properties();
GetInput image = new GetInput();
image.setBpInputName("tag_version");
properties.setImage(image);
LinkedHashMap<String, Object> img = new LinkedHashMap<>();
- inputs.put("tag_version", blueprintHelperService.createStringInput(onapComponentSpec.getArtifacts()[0].getUri()));
+ inputs.put(
+ "tag_version",
+ blueprintHelperService.createStringInput(onapComponentSpec.getArtifacts()[0].getUri()));
GetInput location = new GetInput();
location.setBpInputName("location_id");
@@ -164,10 +192,10 @@ public class PropertiesService {
properties.setService_component_type(sType);
Map<String, Object> tls_info = onapComponentSpec.getAuxilary().getTls_info();
- if(tls_info != null) {
+ if (tls_info != null) {
addTlsInfo(onapComponentSpec, inputs, properties);
if (tls_info.get(Constants.USE_EXTERNAL_TLS_FIELD) != null) {
- inputs.putAll(addExternalTlsInfo(onapComponentSpec,properties));
+ inputs.putAll(addExternalTlsInfo(onapComponentSpec, properties));
}
}
@@ -175,31 +203,50 @@ public class PropertiesService {
replica.setBpInputName("replicas");
properties.setReplicas(replica);
- LinkedHashMap<String, Object> rep = blueprintHelperService.createIntegerInput( "number of instances", 1);
+ LinkedHashMap<String, Object> rep =
+ blueprintHelperService.createIntegerInput("number of instances", 1);
inputs.put("replicas", rep);
OnapAuxilary onapAuxilary = onapComponentSpec.getAuxilary();
properties.setDocker_config(onapAuxilary);
- Map<String, Object> appConfigResponse = appConfigService.createAppconfig(inputs, onapComponentSpec, override, true);
+ Map<String, Object> appConfigResponse =
+ appConfigService.createAppconfig(inputs, onapComponentSpec, override, true);
inputs = (Map<String, LinkedHashMap<String, Object>>) appConfigResponse.get("inputs");
properties.setApplication_config((Appconfig) appConfigResponse.get("appconfig"));
-
List<Streams> pubStreams = new ArrayList();
- if(onapComponentSpec.getStreams() != null) {
+ if (onapComponentSpec.getStreams() != null) {
if (onapComponentSpec.getStreams().getPublishes() != null) {
for (Publishes publishes : onapComponentSpec.getStreams().getPublishes()) {
if (blueprintHelperService.isMessageRouterType(publishes.getType())) {
String topic = publishes.getConfig_key() + Constants._TOPIC;
- Map<String, Object> streamsMessageRouterResponse = streamsService.createStreams(inputs, topic, publishes.getType(), publishes.getConfig_key(), publishes.getRoute(), 'p');
- inputs = (Map<String, LinkedHashMap<String, Object>>) streamsMessageRouterResponse.get("inputs");
+ Map<String, Object> streamsMessageRouterResponse =
+ streamsService.createStreams(
+ inputs,
+ topic,
+ publishes.getType(),
+ publishes.getConfig_key(),
+ publishes.getRoute(),
+ 'p');
+ inputs =
+ (Map<String, LinkedHashMap<String, Object>>)
+ streamsMessageRouterResponse.get("inputs");
pubStreams.add((Streams) streamsMessageRouterResponse.get("streams"));
} else if (blueprintHelperService.isDataRouterType(publishes.getType())) {
String feed = publishes.getConfig_key() + Constants._FEED;
- Map<String, Object> streamsDataRouterResponse = streamsService.createStreams(inputs, feed, publishes.getType(), publishes.getConfig_key(), publishes.getRoute(), 'p');
- inputs = (Map<String, LinkedHashMap<String, Object>>) streamsDataRouterResponse.get("inputs");
+ Map<String, Object> streamsDataRouterResponse =
+ streamsService.createStreams(
+ inputs,
+ feed,
+ publishes.getType(),
+ publishes.getConfig_key(),
+ publishes.getRoute(),
+ 'p');
+ inputs =
+ (Map<String, LinkedHashMap<String, Object>>)
+ streamsDataRouterResponse.get("inputs");
pubStreams.add((Streams) streamsDataRouterResponse.get("streams"));
}
}
@@ -207,53 +254,84 @@ public class PropertiesService {
}
ArrayList<Streams> subStreams = new ArrayList();
- if(onapComponentSpec.getStreams() != null) {
+ if (onapComponentSpec.getStreams() != null) {
if (onapComponentSpec.getStreams().getSubscribes() != null) {
for (Subscribes subscribes : onapComponentSpec.getStreams().getSubscribes()) {
if (blueprintHelperService.isMessageRouterType(subscribes.getType())) {
String topic = subscribes.getConfig_key() + Constants._TOPIC;
- Map<String, Object> streamsMessageRouterResponse = streamsService.createStreams(inputs, topic, subscribes.getType(), subscribes.getConfig_key(), subscribes.getRoute(), 's');
- inputs = (Map<String, LinkedHashMap<String, Object>>) streamsMessageRouterResponse.get("inputs");
+ Map<String, Object> streamsMessageRouterResponse =
+ streamsService.createStreams(
+ inputs,
+ topic,
+ subscribes.getType(),
+ subscribes.getConfig_key(),
+ subscribes.getRoute(),
+ 's');
+ inputs =
+ (Map<String, LinkedHashMap<String, Object>>)
+ streamsMessageRouterResponse.get("inputs");
subStreams.add((Streams) streamsMessageRouterResponse.get("streams"));
} else if (blueprintHelperService.isDataRouterType(subscribes.getType())) {
String feed = subscribes.getConfig_key() + Constants._FEED;
- Map<String, Object> streamsDataRouterResponse = streamsService.createStreams(inputs, feed, subscribes.getType(), subscribes.getConfig_key(), subscribes.getRoute(), 's');
- inputs = (Map<String, LinkedHashMap<String, Object>>) streamsDataRouterResponse.get("inputs");
+ Map<String, Object> streamsDataRouterResponse =
+ streamsService.createStreams(
+ inputs,
+ feed,
+ subscribes.getType(),
+ subscribes.getConfig_key(),
+ subscribes.getRoute(),
+ 's');
+ inputs =
+ (Map<String, LinkedHashMap<String, Object>>)
+ streamsDataRouterResponse.get("inputs");
subStreams.add((Streams) streamsDataRouterResponse.get("streams"));
}
}
}
}
- if(!pubStreams.isEmpty())
+ if (!pubStreams.isEmpty()) {
properties.setStreams_publishes(pubStreams);
+ }
- if(!subStreams.isEmpty())
+ if (!subStreams.isEmpty()) {
properties.setStreams_subscribes(subStreams);
+ }
- Map<String, Object> resourceConfigResponse = resourceConfigService.createResourceConfig(inputs, onapComponentSpec.getSelf().getName());
+ Map<String, Object> resourceConfigResponse =
+ resourceConfigService
+ .createResourceConfig(inputs, onapComponentSpec.getSelf().getName());
inputs = (Map<String, LinkedHashMap<String, Object>>) resourceConfigResponse.get("inputs");
- properties.setResource_config((ResourceConfig) resourceConfigResponse.get("resourceConfig"));
+ properties
+ .setResource_config((ResourceConfig) resourceConfigResponse.get("resourceConfig"));
response.put("properties", properties);
response.put("inputs", inputs);
return response;
}
- private void addTlsInfo(OnapComponentSpec onapComponentSpec, Map<String, LinkedHashMap<String, Object>> inputs, Properties properties) {
+ private void addTlsInfo(
+ OnapComponentSpec onapComponentSpec,
+ Map<String, LinkedHashMap<String, Object>> inputs,
+ Properties properties) {
TlsInfo tlsInfo = new TlsInfo();
- tlsInfo.setCertDirectory((String) onapComponentSpec.getAuxilary().getTls_info().get("cert_directory"));
+ tlsInfo.setCertDirectory(
+ (String) onapComponentSpec.getAuxilary().getTls_info().get("cert_directory"));
GetInput useTLSFlag = new GetInput();
useTLSFlag.setBpInputName("use_tls");
tlsInfo.setUseTls(useTLSFlag);
properties.setTls_info(tlsInfo);
- LinkedHashMap<String, Object> useTlsFlagInput = blueprintHelperService.createBooleanInput("flag to indicate tls enable/disable",onapComponentSpec.getAuxilary().getTls_info().get("use_tls"));
+ LinkedHashMap<String, Object> useTlsFlagInput =
+ blueprintHelperService.createBooleanInput(
+ "flag to indicate tls enable/disable",
+ onapComponentSpec.getAuxilary().getTls_info().get("use_tls"));
inputs.put("use_tls", useTlsFlagInput);
}
- private Map<String, LinkedHashMap<String, Object>> addExternalTlsInfo(OnapComponentSpec onapComponentSpec, Properties properties) {
- properties.setExternal_cert(externalTlsInfoFactoryService.createFromComponentSpec(onapComponentSpec));
- return externalTlsInfoFactoryService.createInputListFromComponentSpec(onapComponentSpec);
- }
-
+ private Map<String, LinkedHashMap<String, Object>> addExternalTlsInfo(
+ OnapComponentSpec onapComponentSpec, Properties properties) {
+ properties.setExternal_cert(
+ externalTlsInfoFactoryService.createFromComponentSpec(onapComponentSpec));
+ return externalTlsInfoFactoryService.createInputListFromComponentSpec(onapComponentSpec);
+ }
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/QuotationService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/QuotationService.java
index c79ec56..642a13e 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/QuotationService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/QuotationService.java
@@ -30,22 +30,24 @@ import java.util.LinkedHashMap;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to set Quotations of generated Blueprint
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to set Quotations of
+ * generated Blueprint
*/
-
-
@Service
public class QuotationService {
- // Method to add Quotes for String Types
+ /**
+ * Adds Quotes for String Types for generated Blueprint
+ *
+ * @param bp Blueprint
+ * @return
+ */
public OnapBlueprint setQuotations(OnapBlueprint bp) {
- for(String s: bp.getInputs().keySet()) {
+ for (String s : bp.getInputs().keySet()) {
LinkedHashMap<String, Object> temp = bp.getInputs().get(s);
- if(temp.get("type") == "string") {
+ if (temp.get("type") == "string") {
String def = (String) temp.get("default");
- if(def != null){
+ if (def != null) {
def = def.replaceAll("\"$", "").replaceAll("^\"", "");
}
def = '"' + def + '"';
@@ -55,5 +57,4 @@ public class QuotationService {
}
return bp;
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java
index 7b03372..a3a9c97 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/ResourceConfigService.java
@@ -37,26 +37,32 @@ import java.util.TreeMap;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to add ResourceConfig
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add
+ * ResourceConfig
*/
-
-
@Service("onapResourceConfigService")
public class ResourceConfigService {
@Autowired
private BlueprintHelperService blueprintHelperService;
- //Method to create Resouce Config for properties
- public Map<String,Object> createResourceConfig(Map<String, LinkedHashMap<String, Object>> inputs, String name){
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates Resouce Config for properties
+ *
+ * @param inputs Inputs
+ * @param name Name
+ * @return
+ */
+ public Map<String, Object> createResourceConfig(
+ Map<String, LinkedHashMap<String, Object>> inputs, String name) {
+ Map<String, Object> response = new HashMap<>();
ResourceConfig resourceConfig = new ResourceConfig();
- LinkedHashMap<String, Object> memoryLimit = blueprintHelperService.createStringInput(Constants.MEMORY_LIMIT_128Mi);
+ LinkedHashMap<String, Object> memoryLimit =
+ blueprintHelperService.createStringInput(Constants.MEMORY_LIMIT_128Mi);
- LinkedHashMap<String, Object> cpuLimit = blueprintHelperService.createStringInput( Constants.CPU_LIMIT_250m);
+ LinkedHashMap<String, Object> cpuLimit =
+ blueprintHelperService.createStringInput(Constants.CPU_LIMIT_250m);
name = blueprintHelperService.getNamePrefix(name);
@@ -94,5 +100,4 @@ public class ResourceConfigService {
response.put("inputs", inputs);
return response;
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartInputsService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartInputsService.java
index 20c3656..8ec0024 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartInputsService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartInputsService.java
@@ -38,22 +38,26 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to add Start Inputs Node under Start
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add Start Inputs
+ * Node under Start
*/
-
-
@Service
public class StartInputsService {
@Autowired
private PgaasNodeService pgaasNodeService;
- //Method to create Start Inputs for Start in Interfaces
- public Map<String, Object> createStartInputs(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec){
-
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates Start Inputs for Start in Interfaces
+ *
+ * @param inputs Inputs
+ * @param onapComponentSpec OnapComponentSpec
+ * @return
+ */
+ public Map<String, Object> createStartInputs(
+ Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec) {
+
+ Map<String, Object> response = new HashMap<>();
StartInputs startInputs = new StartInputs();
int count = 0;
@@ -61,9 +65,11 @@ public class StartInputsService {
OnapAuxilary aux = onapComponentSpec.getAuxilary();
if (aux.getPorts() != null) {
- for(Object p : aux.getPorts()) {
+ for (Object p : aux.getPorts()) {
String[] ports = p.toString().split(":");
- portList.add(String.format("concat: [\"%s:\", {get_input: external_port_%d}]" , ports[0], count));
+ portList.add(
+ String.format("concat: [\"%s:\", {get_input: external_port_%d}]", ports[0],
+ count));
LinkedHashMap<String, Object> portType = new LinkedHashMap();
portType.put("type", "string");
@@ -76,12 +82,12 @@ public class StartInputsService {
startInputs.setPorts(portList);
LinkedHashMap<String, Object> envMap = new LinkedHashMap();
- if(onapComponentSpec.getAuxilary().getDatabases() != null){
- Map<String, Object> envVars = pgaasNodeService.getEnvVariables(onapComponentSpec.getAuxilary().getDatabases());
+ if (onapComponentSpec.getAuxilary().getDatabases() != null) {
+ Map<String, Object> envVars =
+ pgaasNodeService.getEnvVariables(onapComponentSpec.getAuxilary().getDatabases());
startInputs.setEnvs(envVars);
envMap.put("default", "&envs {}");
- }
- else {
+ } else {
GetInput env = new GetInput();
env.setBpInputName("envs");
startInputs.setEnvs(env);
@@ -93,5 +99,4 @@ public class StartInputsService {
response.put("inputs", inputs);
return response;
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartService.java
index 3fbfdb1..6c92c6f 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/common/StartService.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.service.common;
-
import org.onap.blueprintgenerator.model.common.Start;
import org.onap.blueprintgenerator.model.common.StartInputs;
import org.onap.blueprintgenerator.model.componentspec.OnapComponentSpec;
@@ -36,24 +35,28 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Common ONAP Service used by ONAP and DMAAP Blueprint to add Start Node
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Common ONAP Service to add Start Node
*/
-
-
@Service
public class StartService {
@Autowired
private StartInputsService startInputsService;
- // Method to create Start for Interfaces
- public Map<String,Object> createStart(Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec) {
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates Start for Interfaces
+ *
+ * @param inputs Inputs
+ * @param onapComponentSpec OnapComponentSpec
+ * @return
+ */
+ public Map<String, Object> createStart(
+ Map<String, LinkedHashMap<String, Object>> inputs, OnapComponentSpec onapComponentSpec) {
+ Map<String, Object> response = new HashMap<>();
Start start = new Start();
- Map<String, Object> startInputsResponse = startInputsService.createStartInputs(inputs, onapComponentSpec);
+ Map<String, Object> startInputsResponse =
+ startInputsService.createStartInputs(inputs, onapComponentSpec);
inputs = (Map<String, LinkedHashMap<String, Object>>) startInputsResponse.get("inputs");
start.setInputs((StartInputs) startInputsResponse.get("startInputs"));
@@ -61,5 +64,4 @@ public class StartService {
response.put("inputs", inputs);
return response;
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/DmaapBlueprintService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/DmaapBlueprintService.java
index 002bd6c..9da2074 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/DmaapBlueprintService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/DmaapBlueprintService.java
@@ -48,97 +48,116 @@ import java.util.TreeMap;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Service to create DMAAP Blueprint
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Service to create DMAAP Blueprint
*/
-
@Service
public class DmaapBlueprintService extends BlueprintService {
- @Autowired
- protected ImportsService importsService;
-
- @Autowired
- private NodeService nodeService;
-
- @Autowired
- private PolicyNodeService policyNodeService;
-
- @Autowired
- private PgaasNodeService pgaasNodeService;
-
- @Autowired
- private QuotationService quotationService;
-
- @Autowired
- private BlueprintHelperService blueprintHelperService;
-
- // method to generate Dmaap Blueprint
- public OnapBlueprint createBlueprint(OnapComponentSpec onapComponentSpec, Input input) {
- try {
- OnapBlueprint blueprint = new OnapBlueprint();
- blueprint.setTosca_definitions_version(Constants.TOSCA_DEF_VERSION);
- blueprint.setDescription(onapComponentSpec.getSelf().getDescription());
-
- Map<String, LinkedHashMap<String, Object>> inputs = new TreeMap<>();
-
- //if (!"".equals(input.getImportPath()))
- if (!StringUtils.isEmpty(input.getImportPath()) )
- blueprint.setImports(importsService.createImportsFromFile(input.getImportPath()));
- else
- blueprint.setImports(importsService.createImports(input.getBpType()));
-
- Map<String, Node> nodeTemplate = new TreeMap();
-
- Map<String, Object> dmaapNodeResponse = nodeService.createDmaapNode(onapComponentSpec, inputs, input.getServiceNameOverride());
- inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapNodeResponse.get("inputs");
- nodeTemplate.put(onapComponentSpec.getSelf().getName(), (Node) dmaapNodeResponse.get("dmaapNode"));
-
- if (onapComponentSpec.getStreams() != null) {
- if (onapComponentSpec.getStreams().getPublishes() != null) {
- for (Publishes publishes : onapComponentSpec.getStreams().getPublishes()) {
- if (blueprintHelperService.isMessageRouterType(publishes.getType())) {
- String topic = publishes.getConfig_key() + Constants._TOPIC;
- Map<String, Object> topicNodeResponse = nodeService.createTopicNode(inputs, topic);
- inputs = (Map<String, LinkedHashMap<String, Object>>) topicNodeResponse.get("inputs");
- nodeTemplate.put(topic, (Node) topicNodeResponse.get("topicNode"));
- } else if (blueprintHelperService.isDataRouterType(publishes.getType())) {
- String feed = publishes.getConfig_key() + Constants._FEED;
- Map<String, Object> feedNodeResponse = nodeService.createFeedNode(inputs, feed);
- inputs = (Map<String, LinkedHashMap<String, Object>>) feedNodeResponse.get("inputs");
- nodeTemplate.put(feed, (Node) feedNodeResponse.get("feedNode"));
- }
- }
- }
- if (onapComponentSpec.getStreams().getSubscribes() != null) {
- for (Subscribes s : onapComponentSpec.getStreams().getSubscribes()) {
- if (blueprintHelperService.isMessageRouterType(s.getType())) {
- String topic = s.getConfig_key() + Constants._TOPIC;
- Map<String, Object> topicNodeResponse = nodeService.createTopicNode(inputs, topic);
- inputs = (Map<String, LinkedHashMap<String, Object>>) topicNodeResponse.get("inputs");
- nodeTemplate.put(topic, (Node) topicNodeResponse.get("topicNode"));
- } else if (blueprintHelperService.isDataRouterType(s.getType())) {
- String feed = s.getConfig_key() + Constants._FEED;
- Map<String, Object> feedNodeResponse = nodeService.createFeedNode(inputs, feed);
- inputs = (Map<String, LinkedHashMap<String, Object>>) feedNodeResponse.get("inputs");
- nodeTemplate.put(feed, (Node) feedNodeResponse.get("feedNode"));
- }
- }
+ @Autowired
+ protected ImportsService importsService;
+
+ @Autowired
+ private NodeService nodeService;
+
+ @Autowired
+ private PolicyNodeService policyNodeService;
+
+ @Autowired
+ private PgaasNodeService pgaasNodeService;
+
+ @Autowired
+ private QuotationService quotationService;
+
+ @Autowired
+ private BlueprintHelperService blueprintHelperService;
+
+ /**
+ * Creates Dmaap Blueprint
+ *
+ * @param onapComponentSpec OnapComponentSpec
+ * @param input Inputs
+ * @return
+ */
+ public OnapBlueprint createBlueprint(OnapComponentSpec onapComponentSpec, Input input) {
+ try {
+ OnapBlueprint blueprint = new OnapBlueprint();
+ blueprint.setTosca_definitions_version(Constants.TOSCA_DEF_VERSION);
+ blueprint.setDescription(onapComponentSpec.getSelf().getDescription());
+
+ Map<String, LinkedHashMap<String, Object>> inputs = new TreeMap<>();
+
+ // if (!"".equals(input.getImportPath()))
+ if (!StringUtils.isEmpty(input.getImportPath())) {
+ blueprint.setImports(importsService.createImportsFromFile(input.getImportPath()));
+ } else {
+ blueprint.setImports(importsService.createImports(input.getBpType()));
+ }
+
+ Map<String, Node> nodeTemplate = new TreeMap();
+
+ Map<String, Object> dmaapNodeResponse =
+ nodeService
+ .createDmaapNode(onapComponentSpec, inputs, input.getServiceNameOverride());
+ inputs = (Map<String, LinkedHashMap<String, Object>>) dmaapNodeResponse.get("inputs");
+ nodeTemplate.put(
+ onapComponentSpec.getSelf().getName(), (Node) dmaapNodeResponse.get("dmaapNode"));
+
+ if (onapComponentSpec.getStreams() != null) {
+ if (onapComponentSpec.getStreams().getPublishes() != null) {
+ for (Publishes publishes : onapComponentSpec.getStreams().getPublishes()) {
+ if (blueprintHelperService.isMessageRouterType(publishes.getType())) {
+ String topic = publishes.getConfig_key() + Constants._TOPIC;
+ Map<String, Object> topicNodeResponse = nodeService
+ .createTopicNode(inputs, topic);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) topicNodeResponse
+ .get("inputs");
+ nodeTemplate.put(topic, (Node) topicNodeResponse.get("topicNode"));
+ } else if (blueprintHelperService.isDataRouterType(publishes.getType())) {
+ String feed = publishes.getConfig_key() + Constants._FEED;
+ Map<String, Object> feedNodeResponse = nodeService
+ .createFeedNode(inputs, feed);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) feedNodeResponse
+ .get("inputs");
+ nodeTemplate.put(feed, (Node) feedNodeResponse.get("feedNode"));
+ }
+ }
+ }
+ if (onapComponentSpec.getStreams().getSubscribes() != null) {
+ for (Subscribes s : onapComponentSpec.getStreams().getSubscribes()) {
+ if (blueprintHelperService.isMessageRouterType(s.getType())) {
+ String topic = s.getConfig_key() + Constants._TOPIC;
+ Map<String, Object> topicNodeResponse = nodeService
+ .createTopicNode(inputs, topic);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) topicNodeResponse
+ .get("inputs");
+ nodeTemplate.put(topic, (Node) topicNodeResponse.get("topicNode"));
+ } else if (blueprintHelperService.isDataRouterType(s.getType())) {
+ String feed = s.getConfig_key() + Constants._FEED;
+ Map<String, Object> feedNodeResponse = nodeService
+ .createFeedNode(inputs, feed);
+ inputs = (Map<String, LinkedHashMap<String, Object>>) feedNodeResponse
+ .get("inputs");
+ nodeTemplate.put(feed, (Node) feedNodeResponse.get("feedNode"));
+ }
+ }
+ }
+ }
+
+ if (onapComponentSpec.getPolicyInfo() != null) {
+ policyNodeService.addPolicyNodesAndInputs(onapComponentSpec, nodeTemplate, inputs);
+ }
+
+ if (onapComponentSpec.getAuxilary() != null
+ && onapComponentSpec.getAuxilary().getDatabases() != null) {
+ pgaasNodeService.addPgaasNodesAndInputs(onapComponentSpec, nodeTemplate, inputs);
+ }
+
+ blueprint.setNode_templates(nodeTemplate);
+ blueprint.setInputs(inputs);
+ return quotationService.setQuotations(blueprint);
+ } catch (Exception ex) {
+ throw new BlueprintException(
+ "Unable to create ONAP DMAAP Blueprint Object from given input parameters", ex);
+ }
}
- }
-
- if (onapComponentSpec.getPolicyInfo() != null)
- policyNodeService.addPolicyNodesAndInputs(onapComponentSpec, nodeTemplate, inputs);
-
- if (onapComponentSpec.getAuxilary() != null && onapComponentSpec.getAuxilary().getDatabases() != null)
- pgaasNodeService.addPgaasNodesAndInputs(onapComponentSpec, nodeTemplate, inputs);
-
- blueprint.setNode_templates(nodeTemplate);
- blueprint.setInputs(inputs);
- return quotationService.setQuotations(blueprint);
- } catch (Exception ex) {
- throw new BlueprintException("Unable to create ONAP DMAAP Blueprint Object from given input parameters", ex);
- }
- }
-} \ No newline at end of file
+}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/StreamsService.java b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/StreamsService.java
index 16687fc..051b060 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/StreamsService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/blueprintgenerator/service/dmaap/StreamsService.java
@@ -35,21 +35,33 @@ import java.util.Map;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Service to create Streams
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Service to create Streams
*/
-
-
@Service
public class StreamsService {
@Autowired
private BlueprintHelperService blueprintHelperService;
- //Methos to create streams for Dmaap Blueprint
- public Map<String, Object> createStreams(Map<String, LinkedHashMap<String, Object>> inputs, String name, String type, String key, String route, char o){
- Map<String,Object> response = new HashMap<>();
+ /**
+ * Creates streams for Dmaap Blueprint
+ *
+ * @param inputs Inputs
+ * @param name Name
+ * @param type Type
+ * @param key Key
+ * @param route Route
+ * @param o For Data Router Type s
+ * @return
+ */
+ public Map<String, Object> createStreams(
+ Map<String, LinkedHashMap<String, Object>> inputs,
+ String name,
+ String type,
+ String key,
+ String route,
+ char o) {
+ Map<String, Object> response = new HashMap<>();
Streams streams = new Streams();
LinkedHashMap<String, Object> stringType = new LinkedHashMap();
@@ -63,8 +75,8 @@ public class StreamsService {
inputs.put(key + "_" + name + "_location", stringType);
streams.setLocation(location);
- if(blueprintHelperService.isDataRouterType(type)) {
- if('s' == o) {
+ if (blueprintHelperService.isDataRouterType(type)) {
+ if ('s' == o) {
GetInput username = new GetInput();
username.setBpInputName(key + "_" + name + "_username");
streams.setUsername(username);
@@ -89,7 +101,6 @@ public class StreamsService {
streams.setScheme("https");
}
-
} else {
GetInput client = new GetInput();
client.setBpInputName(key + "_" + name + "_client_role");
@@ -100,5 +111,4 @@ public class StreamsService {
response.put("inputs", inputs);
return response;
}
-
}
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelNodeService.java b/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelNodeService.java
index 05dbcae..14c33d8 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelNodeService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelNodeService.java
@@ -39,39 +39,41 @@ import java.util.List;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * To create Node Type, Data Type and Translate Entry Schema for Policy Model Node
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator To create Node Type, Data Type and
+ * Translate Entry Schema for Policy Model Node
*/
-
-
@Service("onapPolicyModelNodeService")
public class PolicyModelNodeService {
- // Method to create Nodes for Policy
- public Map<String,Object> creatNodeType(String policyName, Parameters[] params) {
+ /**
+ * Creates Nodes for Policy
+ *
+ * @param policyName Policy Name
+ * @param params Paramaeters
+ * @return
+ */
+ public Map<String, Object> creatNodeType(String policyName, Parameters[] params) {
String hasEntrySchema = "";
- Map<String,Object> response = new HashMap<>();
+ Map<String, Object> response = new HashMap<>();
PolicyModelNode policyModelNode = new PolicyModelNode();
Map<String, PolicyProperties> props = new TreeMap<>();
- for(Parameters p: params) {
- if(p.getPolicy_group() != null && p.getPolicy_group().equals(policyName)) {
- String name = p.getName();
- String type = p.getType();
- PolicyProperties polProps = new PolicyProperties();
- if(p.getPolicy_schema() != null) {
- polProps.setType("map");
- ArrayList<String> entrySchema = new ArrayList<String>();
- entrySchema.add("type: onap.datatypes." + name);
- polProps.setEntry_schema(entrySchema);
- hasEntrySchema = name;
- props.put(name, polProps);
- }
- else {
- polProps.setType(type);
- props.put(name, polProps);
- }
+ for (Parameters p : params) {
+ if (p.getPolicy_group() != null && p.getPolicy_group().equals(policyName)) {
+ String name = p.getName();
+ String type = p.getType();
+ PolicyProperties polProps = new PolicyProperties();
+ if (p.getPolicy_schema() != null) {
+ polProps.setType("map");
+ ArrayList<String> entrySchema = new ArrayList<String>();
+ entrySchema.add("type: onap.datatypes." + name);
+ polProps.setEntry_schema(entrySchema);
+ hasEntrySchema = name;
+ props.put(name, polProps);
+ } else {
+ polProps.setType(type);
+ props.put(name, polProps);
+ }
}
}
policyModelNode.setDerived_from(Constants.TOSCA_DATATYPES_ROOT);
@@ -81,32 +83,37 @@ public class PolicyModelNodeService {
return response;
}
- // Method to create Data Types for Policy
- public Map<String, PolicyModelNode> createDataTypes(String param, Parameters[] parameters){
+ /**
+ * Creates Data Types for Policy
+ *
+ * @param param Param
+ * @param parameters Parameters
+ * @return
+ */
+ public Map<String, PolicyModelNode> createDataTypes(String param, Parameters[] parameters) {
Map<String, PolicyModelNode> dataType = new TreeMap<>();
PolicyModelNode node = new PolicyModelNode();
node.setDerived_from(Constants.TOSCA_DATATYPES_ROOT);
Map<String, PolicyProperties> properties = new TreeMap<>();
Parameters par = new Parameters();
- for(Parameters p: parameters) {
- if(param.equals(p.getName())) {
+ for (Parameters p : parameters) {
+ if (param.equals(p.getName())) {
par = p;
break;
}
}
- for(PolicySchema pol: par.getPolicy_schema()) {
- if(pol.getEntry_schema() != null) {
- PolicyProperties prop =new PolicyProperties();
+ for (PolicySchema pol : par.getPolicy_schema()) {
+ if (pol.getEntry_schema() != null) {
+ PolicyProperties prop = new PolicyProperties();
prop.setType("map");
- ArrayList<String> schema = new ArrayList<String>();
+ List<String> schema = new ArrayList<>();
schema.add("type: onap.datatypes." + pol.getName());
prop.setEntry_schema(schema);
properties.put(pol.getName(), prop);
dataType = translateEntrySchema(dataType, pol.getEntry_schema(), pol.getName());
- }
- else {
+ } else {
PolicyProperties prop = new PolicyProperties();
prop.setType(pol.getType());
properties.put(pol.getName(), prop);
@@ -118,14 +125,15 @@ public class PolicyModelNodeService {
return dataType;
}
- private Map<String, PolicyModelNode> translateEntrySchema(Map<String, PolicyModelNode> dataType, EntrySchema[] entry, String name){
+ private Map<String, PolicyModelNode> translateEntrySchema(
+ Map<String, PolicyModelNode> dataType, EntrySchema[] entry, String name) {
Map<String, PolicyModelNode> data = dataType;
PolicyModelNode node = new PolicyModelNode();
node.setDerived_from(Constants.TOSCA_NODES_ROOT);
Map<String, PolicyProperties> properties = new TreeMap<>();
- for(EntrySchema e: entry) {
- if(e.getEntry_schema() != null) {
+ for (EntrySchema e : entry) {
+ if (e.getEntry_schema() != null) {
PolicyProperties prop = new PolicyProperties();
prop.setType("list");
List<String> schema = new ArrayList<>();
@@ -145,6 +153,4 @@ public class PolicyModelNodeService {
dataType.put("onap.datatypes." + name, node);
return data;
}
-
}
-
diff --git a/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelService.java b/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelService.java
index bbc6259..28a0035 100644
--- a/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelService.java
+++ b/mod/bpgenerator/onap/src/main/java/org/onap/policycreate/service/PolicyModelService.java
@@ -42,12 +42,9 @@ import java.util.TreeMap;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Service for Policy Model to create Policy Models, Policy Group Names and Convert Policy to Yaml
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Service for Policy Model to create
+ * Policy Models, Policy Group Names and Convert Policy to Yaml
*/
-
-
@Service("onapPolicyModelService")
public class PolicyModelService {
@@ -58,7 +55,13 @@ public class PolicyModelService {
@Autowired
private PolicyModelNodeService policyModelNodeService;
- // Method to create Policy Models
+ /**
+ * Creates Policy Models
+ *
+ * @param params Parameters
+ * @param filePath File path
+ * @return
+ */
public void createPolicyModels(Parameters[] params, String filePath) {
try {
List<String> policyGroups = getPolicyGroupNames(params);
@@ -72,12 +75,16 @@ public class PolicyModelService {
nodeType.put(nodeTypeName, (PolicyModelNode) response.get("policyModelNode"));
model.setNode_types(nodeType);
- if (!"".equals(response.get("hasEntrySchema")))
- model.setData_types(policyModelNodeService.createDataTypes((String) response.get("hasEntrySchema"), params));
+ if (!"".equals(response.get("hasEntrySchema"))) {
+ model.setData_types(
+ policyModelNodeService.createDataTypes(
+ (String) response.get("hasEntrySchema"), params));
+ }
policyModelToYaml(filePath, model, s);
}
} catch (Exception ex) {
- throw new PolicyCreateException("Unable to create Policies from given input parameters", ex);
+ throw new PolicyCreateException("Unable to create Policies from given input parameters",
+ ex);
}
}
@@ -88,7 +95,7 @@ public class PolicyModelService {
if (names.isEmpty()) {
names.add(p.getPolicy_group());
} else if (!names.contains(p.getPolicy_group())) {
- names.add(p.getPolicy_group());
+ names.add(p.getPolicy_group());
}
}
}
@@ -100,6 +107,4 @@ public class PolicyModelService {
outputFile.getParentFile().mkdirs();
yamlObjectMapper.writeValue(outputFile, model);
}
-
}
-
diff --git a/mod/bpgenerator/onap/src/main/resources/application.properties b/mod/bpgenerator/onap/src/main/resources/application.properties
index 3b70df6..f7155a5 100644
--- a/mod/bpgenerator/onap/src/main/resources/application.properties
+++ b/mod/bpgenerator/onap/src/main/resources/application.properties
@@ -20,16 +20,12 @@
# */
#
#
-
spring.main.banner-mode=off
spring.output.ansi.enabled=ALWAYS
-
imports.onap.types=https://www.getcloudify.org/spec/cloudify/4.5.5/types.yaml
imports.onap.K8s.plugintypes=plugin:k8splugin?version=3.4.2
imports.onap.K8s.dcaepolicyplugin=plugin:dcaepolicyplugin?version=2.4.0
-
imports.dmaap.dmaapplugin=plugin:dmaap?version=1.5.0
-
import.Postgres=plugin:pgaas?version=1.3.0
import.Clamp=plugin:clamppolicyplugin?version=1.1.0
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java
index b19a823..d15be4d 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTestSuite.java
@@ -28,13 +28,14 @@ import org.junit.runners.Suite;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Test Suite for Test Cases
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Test Suite for Test Cases
*/
-
-
@RunWith(Suite.class)
-@Suite.SuiteClasses({ OnapComponentSpecTest.class, OnapBlueprintServiceTest.class,ExternalCertificateParametersFactoryServiceTest.class/*, BlueprintJarComparatorTest.class*/})
+@Suite.SuiteClasses({
+ OnapComponentSpecTest.class,
+ OnapBlueprintServiceTest.class,
+ ExternalCertificateParametersFactoryServiceTest.class /*, BlueprintJarComparatorTest.class*/
+})
public class BlueprintGeneratorTestSuite {
+
}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java
index ea324da..81aaa60 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintGeneratorTests.java
@@ -42,24 +42,21 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Test Cases
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Test Cases
*/
-
-
@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = BlueprintGeneratorMainApplication.class, initializers = ConfigFileApplicationContextInitializer.class)
+@ContextConfiguration(
+ classes = BlueprintGeneratorMainApplication.class,
+ initializers = ConfigFileApplicationContextInitializer.class)
@TestPropertySource(
- properties = {
- "ves=ves.json",
- "testImports=testImports.yaml",
- "useTlsTrueAndUseExternalTlsTrueTest=testComponentSpec_withTlsTrueAndExternalTlsTrue.json",
- "useTlsFalseAndUseExternalTlsFalseTest=testComponentSpec_withTlsFalseAndExternalTlsFalse.json",
- "useTlsTrueAndNoExternalTlsFlagTest=testComponentSpec_withTlsTrueAndNoExternalTls.json",
- "noTlsInfo=testComponentSpec_withoutTlsInfo.json"
- }
-)
+ properties = {
+ "ves=ves.json",
+ "testImports=testImports.yaml",
+ "useTlsTrueAndUseExternalTlsTrueTest=testComponentSpec_withTlsTrueAndExternalTlsTrue.json",
+ "useTlsFalseAndUseExternalTlsFalseTest=testComponentSpec_withTlsFalseAndExternalTlsFalse.json",
+ "useTlsTrueAndNoExternalTlsFlagTest=testComponentSpec_withTlsTrueAndNoExternalTls.json",
+ "noTlsInfo=testComponentSpec_withoutTlsInfo.json"
+ })
@Ignore
public class BlueprintGeneratorTests {
@@ -105,5 +102,4 @@ public class BlueprintGeneratorTests {
protected OnapTestUtils onapTestUtils;
protected OnapComponentSpec onapComponentSpec = null;
-
}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java
index d10d3ff..a0cf04a 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java
@@ -21,7 +21,6 @@
*
*/
-
package org.onap.blueprintgenerator.test;
import org.apache.commons.io.FileUtils;
@@ -37,15 +36,11 @@ import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
-
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Bueprint Jar Comparision with Previos version to make sure Bps are not broken with new changes
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Bueprint Jar Comparision with
+ * Blueprint Comparator using preious and new Jar files to make sure the new code doesnt break previous changes.
*/
-
-
@Ignore
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class BlueprintJarComparatorTest extends BlueprintGeneratorTests {
@@ -55,15 +50,19 @@ public class BlueprintJarComparatorTest extends BlueprintGeneratorTests {
private String previousVersion = "0_1";
private String latestVersion = "1_0";
private String latestJarPath = Paths.get("target").toAbsolutePath().toString() + "\\";
- private String previousJarPath = Paths.get("src", "test", "resources", "archives").toAbsolutePath().toString() + "\\";
- private String inputPath = Paths.get("src", "test", "resources", "componentspecs").toAbsolutePath().toString() + "\\";
- private String inputPolicyPath = Paths.get("src", "test", "resources", "policyjson").toAbsolutePath().toString() + "\\";
- private String outputPath = Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString() + "\\";
+ private String previousJarPath =
+ Paths.get("src", "test", "resources", "archives").toAbsolutePath().toString() + "\\";
+ private String inputPath =
+ Paths.get("src", "test", "resources", "componentspecs").toAbsolutePath().toString() + "\\";
+ private String inputPolicyPath =
+ Paths.get("src", "test", "resources", "policyjson").toAbsolutePath().toString() + "\\";
+ private String outputPath =
+ Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString() + "\\";
private String previousJar = "onap-blueprint-generator-" + previousJarVersion + ".jar";
private String latestJar = "onap-blueprint-generator-" + latestJarVersion + ".jar";
@Test
- @Order(value=1)
+ @Order(value = 1)
public void filesCleanup() throws IOException {
FileUtils.deleteDirectory(new File(outputPath));
}
@@ -74,19 +73,54 @@ public class BlueprintJarComparatorTest extends BlueprintGeneratorTests {
String outputFileName = "dcae-ves-collector-dmaap-";
String inputImportsFileName = testImports;
- String previousJarCommand = "java -jar " + previousJarPath + previousJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
- " -n " + outputFileName + previousVersion + " -t " + inputPath + inputImportsFileName + " -d";
+ String previousJarCommand =
+ "java -jar "
+ + previousJarPath
+ + previousJar
+ + " app ONAP -i "
+ + inputPath
+ + inputFileName
+ + " -p "
+ + outputPath
+ + " -n "
+ + outputFileName
+ + previousVersion
+ + " -t "
+ + inputPath
+ + inputImportsFileName
+ + " -d";
Runtime.getRuntime().exec(previousJarCommand);
- String latestJarCommand = "java -jar " + latestJarPath + latestJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
- " -n " + outputFileName + latestVersion + " -t " + inputPath + inputImportsFileName + " -d";
+ String latestJarCommand =
+ "java -jar "
+ + latestJarPath
+ + latestJar
+ + " app ONAP -i "
+ + inputPath
+ + inputFileName
+ + " -p "
+ + outputPath
+ + " -n "
+ + outputFileName
+ + latestVersion
+ + " -t "
+ + inputPath
+ + inputImportsFileName
+ + " -d";
Runtime.getRuntime().exec(latestJarCommand);
Thread.sleep(8000);
- Assert.assertEquals("The BluePrint files (" + outputFileName + ") for " + inputFileName + " with -m option don't match!",
- FileUtils.readFileToString(new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
- FileUtils.readFileToString(new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));
+ Assert.assertEquals(
+ "The BluePrint files ("
+ + outputFileName
+ + ") for "
+ + inputFileName
+ + " with -m option don't match!",
+ FileUtils.readFileToString(
+ new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
+ FileUtils.readFileToString(
+ new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));
}
@Test
@@ -95,21 +129,51 @@ public class BlueprintJarComparatorTest extends BlueprintGeneratorTests {
String outputFileName = "dcae-ves-collector-";
String inputImportsFileName = testImports;
- String previousJarCommand = "java -jar " + previousJarPath + previousJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
- " -n " + outputFileName + previousVersion + " -t " + inputPath + inputImportsFileName ;
+ String previousJarCommand =
+ "java -jar "
+ + previousJarPath
+ + previousJar
+ + " app ONAP -i "
+ + inputPath
+ + inputFileName
+ + " -p "
+ + outputPath
+ + " -n "
+ + outputFileName
+ + previousVersion
+ + " -t "
+ + inputPath
+ + inputImportsFileName;
Runtime.getRuntime().exec(previousJarCommand);
- String latestJarCommand = "java -jar " + latestJarPath + latestJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath +
- " -n " + outputFileName + latestVersion + " -t " + inputPath + inputImportsFileName ;
+ String latestJarCommand =
+ "java -jar "
+ + latestJarPath
+ + latestJar
+ + " app ONAP -i "
+ + inputPath
+ + inputFileName
+ + " -p "
+ + outputPath
+ + " -n "
+ + outputFileName
+ + latestVersion
+ + " -t "
+ + inputPath
+ + inputImportsFileName;
Runtime.getRuntime().exec(latestJarCommand);
Thread.sleep(8000);
- Assert.assertEquals("The BluePrint files (" + outputFileName + ") for " + inputFileName + " with -m option dont match!",
- FileUtils.readFileToString(new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
- FileUtils.readFileToString(new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));
+ Assert.assertEquals(
+ "The BluePrint files ("
+ + outputFileName
+ + ") for "
+ + inputFileName
+ + " with -m option dont match!",
+ FileUtils.readFileToString(
+ new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"),
+ FileUtils.readFileToString(
+ new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8"));
}
-
-
}
-
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java
index 021bc49..718ea4a 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/ExternalCertificateParametersFactoryServiceTest.java
@@ -1,22 +1,22 @@
/*============LICENSE_START=======================================================
- org.onap.dcae
- ================================================================================
- Copyright (c) 2020 Nokia Intellectual Property. All rights reserved.
- Copyright (c) 2020 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=========================================================
- */
+org.onap.dcae
+================================================================================
+Copyright (c) 2020 Nokia Intellectual Property. All rights reserved.
+Copyright (c) 2020 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.blueprintgenerator.test;
@@ -26,7 +26,6 @@ import org.onap.blueprintgenerator.service.common.ExternalCertificateParametersF
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-
import java.util.LinkedHashMap;
import java.util.Map;
@@ -34,15 +33,23 @@ import static org.junit.Assert.assertEquals;
import static org.onap.blueprintgenerator.constants.Constants.COMMON_NAME_FIELD;
import static org.onap.blueprintgenerator.constants.Constants.SANS_FIELD;
-public class ExternalCertificateParametersFactoryServiceTest extends BlueprintGeneratorTests{
+/**
+ * Test for External Certificate Parameters Factory Service
+ */
+public class ExternalCertificateParametersFactoryServiceTest extends BlueprintGeneratorTests {
- private static final String PREFIXED_COMMON_NAME_FIELD = Constants.INPUT_PREFIX + COMMON_NAME_FIELD;
+ private static final String PREFIXED_COMMON_NAME_FIELD =
+ Constants.INPUT_PREFIX + COMMON_NAME_FIELD;
private static final String PREFIXED_SANS_FIELD = Constants.INPUT_PREFIX + SANS_FIELD;
private static final String DEFAULT = "default";
@Autowired
private ExternalCertificateParametersFactoryService externalCertificateParametersFactoryService;
+ /**
+ * Test case to create External Certificate Properties
+ *
+ */
@Test
public void shouldCreateExternalCertificatePropertiesObject() {
@@ -51,11 +58,17 @@ public class ExternalCertificateParametersFactoryServiceTest extends BlueprintGe
assertEquals(result.getSans().getBpInputName(), PREFIXED_SANS_FIELD);
}
+ /**
+ * Test case to create Correct Input List with Default Values from Component Spec
+ *
+ */
@Test
public void shouldCreateCorrectInputListWithDefaultValuesTakenFromComponentSpec() {
- Map<String, LinkedHashMap<String, Object>> result = externalCertificateParametersFactoryService.createInputList();
- assertEquals(Constants.DEFAULT_COMMON_NAME, result.get(PREFIXED_COMMON_NAME_FIELD).get(DEFAULT));
+ Map<String, LinkedHashMap<String, Object>> result =
+ externalCertificateParametersFactoryService.createInputList();
+ assertEquals(
+ Constants.DEFAULT_COMMON_NAME, result.get(PREFIXED_COMMON_NAME_FIELD).get(DEFAULT));
assertEquals(Constants.DEFAULT_SANS, result.get(PREFIXED_SANS_FIELD).get(DEFAULT));
}
}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java
index 351f94e..8f4a1f6 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapBlueprintServiceTest.java
@@ -51,207 +51,408 @@ import static org.mockito.Mockito.verify;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP Blueprint Test Cases for ONAP and DMAAP
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Blueprint Test Cases for ONAP and
+ * DMAAP
*/
-
-
public class OnapBlueprintServiceTest extends BlueprintGeneratorTests {
- private String outputfilesPath = Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString();
+ private String outputfilesPath =
+ Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString();
+ /**
+ * Test Case for Service Name Override Component Spec Input File
+ *
+ */
@DisplayName("Testing K8s Blueprint for Service Name Override Component Spec Input File")
@Test
public void testServiceNameOverrideK8sBlueprint() throws IOException {
- Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs" , ves).toFile().getAbsolutePath(), outputfilesPath, "testServiceNameOverrideK8sBlueprint", "", "o", "");
- onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
- assertNotNull("K8s Blueprint for Service Name Override Component Spec is NULL", onapComponentSpec);
-
- OnapBlueprint onapBlueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
+ Input input =
+ onapTestUtils.getInput(
+ Paths.get("src", "test", "resources", "componentspecs", ves).toFile()
+ .getAbsolutePath(),
+ outputfilesPath,
+ "testServiceNameOverrideK8sBlueprint",
+ "",
+ "o",
+ "");
+ onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ assertNotNull(
+ "K8s Blueprint for Service Name Override Component Spec is NULL", onapComponentSpec);
+
+ OnapBlueprint onapBlueprint = onapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
onapBlueprintService.blueprintToYaml(onapComponentSpec, onapBlueprint, input);
- System.out.println(onapBlueprintService.blueprintToString(onapComponentSpec, onapBlueprint, input));
+ System.out.println(
+ onapBlueprintService.blueprintToString(onapComponentSpec, onapBlueprint, input));
- onapTestUtils.verifyToscaDefVersion("Service Name Override K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
- onapTestUtils.verifyBpImports("Service Name Override K8s",onapBlueprint,false);
+ onapTestUtils.verifyToscaDefVersion(
+ "Service Name Override K8s", onapBlueprint, Constants.TOSCA_DEF_VERSION);
+ onapTestUtils.verifyBpImports("Service Name Override K8s", onapBlueprint, false);
Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
assertNotNull("Service Name Override K8s Blueprint Inputs Section is NULL", k8sBpInputs);
- assertTrue("Service Name Override K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
-
- assertEquals("Service Name Override K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
- assertEquals("Service Name Override K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+ assertTrue(
+ "Service Name Override K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
+
+ assertEquals(
+ "Service Name Override K8s Blueprint:Inputs "
+ + Constants.ONAP_INPUT_CPU_LIMIT
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"),
+ Constants.ONAP_DEFAULT250m);
+ assertEquals(
+ "Service Name Override K8s Blueprint:Inputs "
+ + Constants.SERVICE_COMPONENT_NAME_OVERRIDE
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"),
+ Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
- assertNotNull("Service Name Override K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
- assertTrue("Service Name Override K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
-
- assertEquals("Service Name Override K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.ONAP_NODETEMPLATES_TYPE);
-
- Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
- assertNotNull("Service Name Override K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
-
+ assertNotNull(
+ "Service Name Override K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint",
+ k8sBpNodeTemplates);
+ assertTrue(
+ "Service Name Override K8s Blueprint Node Templates Section Size is Empty",
+ k8sBpNodeTemplates.size() > 0);
+
+ assertEquals(
+ "Service Name Override K8s Blueprint:NodeTemplates:Type is not Matching",
+ k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(),
+ Constants.ONAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull(
+ "Service Name Override K8s Blueprint Node Templates:Properties Section is NULL",
+ k8sBpNodeTemplateProperties);
Map<String, LinkedHashMap<String, Object>> bpInputs = onapBlueprint.getInputs();
- onapTestUtils.verifyArtifacts("Service Name Override K8s",onapComponentSpec,bpInputs,"o");
-
- onapTestUtils.verifyStreamsPublishes("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyStreamsSubscribes("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyAuxilary("Service Name Override K8s",onapComponentSpec);
- onapTestUtils.verifyHealthCheck("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyServicesCalls("Service Name Override K8s",onapComponentSpec);
- onapTestUtils.verifyServicesProvides("Service Name Override K8s",onapComponentSpec);
- onapTestUtils.verifyDockerConfig("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyParameters("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplates);
- onapTestUtils.verifyVolumes("Service Name Override K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils
+ .verifyArtifacts("Service Name Override K8s", onapComponentSpec, bpInputs, "o");
+
+ onapTestUtils.verifyStreamsPublishes(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyAuxilary("Service Name Override K8s", onapComponentSpec);
+ onapTestUtils.verifyHealthCheck(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls("Service Name Override K8s", onapComponentSpec);
+ onapTestUtils.verifyServicesProvides("Service Name Override K8s", onapComponentSpec);
+ onapTestUtils.verifyDockerConfig(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplates);
+ onapTestUtils.verifyVolumes(
+ "Service Name Override K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
}
- @DisplayName("Testing K8s Blueprint for Service Name Override Component Spec Input File with Import File")
+ /**
+ * Test Case for Service Name Override Component Spec Input File with Import File
+ *
+ */
+ @DisplayName(
+ "Testing K8s Blueprint for Service Name Override Component Spec Input File with Import File")
@Test
public void testServiceNameOverrideImportFileK8sBlueprint() throws IOException {
- Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs", ves).toFile().getAbsolutePath(), "", "", Paths.get("src", "test", "resources", "componentspecs" , testImports).toFile().getAbsolutePath(), "o", "");
- onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
- assertNotNull("K8s Blueprint for Service Name Override with Import File Component Spec is NULL", onapComponentSpec);
-
- OnapBlueprint onapBlueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
-
- onapTestUtils.verifyToscaDefVersion("Service Name Override with Import File K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
- onapTestUtils.verifyBpImportsFromFile("Service Name Override with Import File K8s",onapBlueprint,input.getImportPath());
-
+ Input input =
+ onapTestUtils.getInput(
+ Paths.get("src", "test", "resources", "componentspecs", ves).toFile()
+ .getAbsolutePath(),
+ "",
+ "",
+ Paths.get("src", "test", "resources", "componentspecs", testImports)
+ .toFile()
+ .getAbsolutePath(),
+ "o",
+ "");
+ onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ assertNotNull(
+ "K8s Blueprint for Service Name Override with Import File Component Spec is NULL",
+ onapComponentSpec);
+
+ OnapBlueprint onapBlueprint = onapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
+
+ onapTestUtils.verifyToscaDefVersion(
+ "Service Name Override with Import File K8s", onapBlueprint,
+ Constants.TOSCA_DEF_VERSION);
+ onapTestUtils.verifyBpImportsFromFile(
+ "Service Name Override with Import File K8s", onapBlueprint, input.getImportPath());
Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
- assertNotNull("Service Name Override with Import File K8s Blueprint Inputs Section is NULL", k8sBpInputs);
- assertTrue("Service Name Override with Import File K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
-
- assertEquals("Service Name Override with Import File K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
- assertEquals("Service Name Override with Import File K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+ assertNotNull(
+ "Service Name Override with Import File K8s Blueprint Inputs Section is NULL",
+ k8sBpInputs);
+ assertTrue(
+ "Service Name Override with Import File K8s Blueprint Inputs Section is Empty",
+ k8sBpInputs.size() > 0);
+
+ assertEquals(
+ "Service Name Override with Import File K8s Blueprint:Inputs "
+ + Constants.ONAP_INPUT_CPU_LIMIT
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"),
+ Constants.ONAP_DEFAULT250m);
+ assertEquals(
+ "Service Name Override with Import File K8s Blueprint:Inputs "
+ + Constants.SERVICE_COMPONENT_NAME_OVERRIDE
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"),
+ Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
- assertNotNull("Service Name Override with Import File K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
- assertTrue("Service Name Override with Import File K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
-
- assertEquals("Service Name Override with Import File K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.ONAP_NODETEMPLATES_TYPE);
-
- Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
- assertNotNull("Service Name Override with Import File K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
-
+ assertNotNull(
+ "Service Name Override with Import File K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint",
+ k8sBpNodeTemplates);
+ assertTrue(
+ "Service Name Override with Import File K8s Blueprint Node Templates Section Size is Empty",
+ k8sBpNodeTemplates.size() > 0);
+
+ assertEquals(
+ "Service Name Override with Import File K8s Blueprint:NodeTemplates:Type is not Matching",
+ k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(),
+ Constants.ONAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull(
+ "Service Name Override with Import File K8s Blueprint Node Templates:Properties Section is NULL",
+ k8sBpNodeTemplateProperties);
Map<String, LinkedHashMap<String, Object>> bpInputs = onapBlueprint.getInputs();
- onapTestUtils.verifyArtifacts("Service Name Override with Import File K8s",onapComponentSpec,bpInputs,"o");
-
- onapTestUtils.verifyStreamsPublishes("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyStreamsSubscribes("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyAuxilary("Service Name Override with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyHealthCheck("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyServicesCalls("Service Name Override with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyServicesProvides("Service Name Override with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyDockerConfig("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyParameters("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplates);
- onapTestUtils.verifyVolumes("Service Name Override with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyArtifacts(
+ "Service Name Override with Import File K8s", onapComponentSpec, bpInputs, "o");
+
+ onapTestUtils.verifyStreamsPublishes(
+ "Service Name Override with Import File K8s",
+ onapComponentSpec,
+ k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes(
+ "Service Name Override with Import File K8s",
+ onapComponentSpec,
+ k8sBpNodeTemplateProperties);
+ onapTestUtils
+ .verifyAuxilary("Service Name Override with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyHealthCheck(
+ "Service Name Override with Import File K8s",
+ onapComponentSpec,
+ k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls(
+ "Service Name Override with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyServicesProvides(
+ "Service Name Override with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyDockerConfig(
+ "Service Name Override with Import File K8s",
+ onapComponentSpec,
+ k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters(
+ "Service Name Override with Import File K8s", onapComponentSpec, k8sBpNodeTemplates);
+ onapTestUtils.verifyVolumes(
+ "Service Name Override with Import File K8s",
+ onapComponentSpec,
+ k8sBpNodeTemplateProperties);
}
+ /**
+ * Test Case for K8s Blueprint with DB
+ *
+ */
@DisplayName("Testing K8s Blueprint with DB")
@Test
public void testDMAAPK8sBlueprintWithDB() {
- Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs", ves).toFile().getAbsolutePath(), outputfilesPath, "testDMAAPK8sBlueprintWithDB", "", "d", "");
- onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ Input input =
+ onapTestUtils.getInput(
+ Paths.get("src", "test", "resources", "componentspecs", ves).toFile()
+ .getAbsolutePath(),
+ outputfilesPath,
+ "testDMAAPK8sBlueprintWithDB",
+ "",
+ "d",
+ "");
+ onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
assertNotNull("K8s Blueprint for DMAAP Component Spec is NULL", onapComponentSpec);
- OnapBlueprint onapBlueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
+ OnapBlueprint onapBlueprint = dmaapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
onapBlueprintService.blueprintToYaml(onapComponentSpec, onapBlueprint, input);
}
+ /**
+ * Test Case for K8s Blueprint for DMAAP Component Spec Input File
+ *
+ */
@DisplayName("Testing K8s Blueprint for DMAAP Component Spec Input File")
@Test
public void testDMAAPK8sBlueprint() {
- Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs" , ves).toFile().getAbsolutePath(), outputfilesPath, "testDMAAPK8sBlueprint", "", "d", "");
- onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ Input input =
+ onapTestUtils.getInput(
+ Paths.get("src", "test", "resources", "componentspecs", ves).toFile()
+ .getAbsolutePath(),
+ outputfilesPath,
+ "testDMAAPK8sBlueprint",
+ "",
+ "d",
+ "");
+ onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
assertNotNull("K8s Blueprint for DMAAP Component Spec is NULL", onapComponentSpec);
- OnapBlueprint onapBlueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
+ OnapBlueprint onapBlueprint = dmaapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
onapBlueprintService.blueprintToYaml(onapComponentSpec, onapBlueprint, input);
- System.out.println(onapBlueprintService.blueprintToString(onapComponentSpec, onapBlueprint, input));
+ System.out.println(
+ onapBlueprintService.blueprintToString(onapComponentSpec, onapBlueprint, input));
policyModelService.createPolicyModels(onapComponentSpec.getParameters(), "models");
- onapTestUtils.verifyToscaDefVersion("DMAAP K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
- //onapTestUtils.verifyBpImports("DMAAP K8s",onapBlueprint,false);
+ onapTestUtils
+ .verifyToscaDefVersion("DMAAP K8s", onapBlueprint, Constants.TOSCA_DEF_VERSION);
Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
assertNotNull("DMAAP K8s Blueprint Inputs Section is NULL", k8sBpInputs);
assertTrue("DMAAP K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
- //assertEquals("DMAAP K8s Blueprint:Inputs " + Constants.ALWAYS_PULL_IMAGE + " Type is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("type"), "boolean");
- //assertEquals("DMAAP K8s Blueprint:Inputs Always Pull Image Default is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("default"), Constants.ALWAYS_PULL_IMAGE_DEFAULT);
- assertEquals("DMAAP K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
- assertEquals("DMAAP K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+ assertEquals(
+ "DMAAP K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"),
+ Constants.ONAP_DEFAULT250m);
+ assertEquals(
+ "DMAAP K8s Blueprint:Inputs "
+ + Constants.SERVICE_COMPONENT_NAME_OVERRIDE
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"),
+ Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
- assertNotNull("DMAAP K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
- assertTrue("DMAAP K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
-
- assertEquals("DMAAP K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.DMAAP_NODETEMPLATES_TYPE);
-
- Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
- assertNotNull("DMAAP K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
-
- List bpNodeTemplateRelationships = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getRelationships();
- assertNotNull("DMAAP K8s Blueprint Node Templates:Relationships Section is NULL", bpNodeTemplateRelationships);
-
- onapTestUtils.verifyStreamsPublishes("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyStreamsSubscribes("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyAuxilary("DMAAP K8s",onapComponentSpec);
- onapTestUtils.verifyHealthCheck("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyServicesCalls("DMAAP K8s",onapComponentSpec);
- onapTestUtils.verifyServicesProvides("DMAAP K8s",onapComponentSpec);
- onapTestUtils.verifyDockerConfig("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyParameters("DMAAP K8s",onapComponentSpec,k8sBpNodeTemplates);
+ assertNotNull(
+ "DMAAP K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint",
+ k8sBpNodeTemplates);
+ assertTrue(
+ "DMAAP K8s Blueprint Node Templates Section Size is Empty",
+ k8sBpNodeTemplates.size() > 0);
+
+ assertEquals(
+ "DMAAP K8s Blueprint:NodeTemplates:Type is not Matching",
+ k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(),
+ Constants.DMAAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull(
+ "DMAAP K8s Blueprint Node Templates:Properties Section is NULL",
+ k8sBpNodeTemplateProperties);
+
+ List bpNodeTemplateRelationships =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getRelationships();
+ assertNotNull(
+ "DMAAP K8s Blueprint Node Templates:Relationships Section is NULL",
+ bpNodeTemplateRelationships);
+
+ onapTestUtils.verifyStreamsPublishes(
+ "DMAAP K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes(
+ "DMAAP K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyAuxilary("DMAAP K8s", onapComponentSpec);
+ onapTestUtils
+ .verifyHealthCheck("DMAAP K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls("DMAAP K8s", onapComponentSpec);
+ onapTestUtils.verifyServicesProvides("DMAAP K8s", onapComponentSpec);
+ onapTestUtils
+ .verifyDockerConfig("DMAAP K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters("DMAAP K8s", onapComponentSpec, k8sBpNodeTemplates);
}
+ /**
+ * Test Case for K8s Blueprint for DMAAP Component Spec Input File with Import File
+ *
+ */
@DisplayName("Testing K8s Blueprint for DMAAP Component Spec Input File with Import File")
@Test
public void testDMAAPK8sImportFileBlueprint() throws IOException {
- Input input = onapTestUtils.getInput(Paths.get("src", "test", "resources", "componentspecs" , ves).toFile().getAbsolutePath(), "", "", Paths.get("src", "test", "resources", "componentspecs" , testImports).toFile().getAbsolutePath(), "d", "");
- onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
- assertNotNull("K8s Blueprint for DMAAP Component Spec with Import File is NULL", onapComponentSpec);
-
- OnapBlueprint onapBlueprint = dmaapBlueprintService.createBlueprint(onapComponentSpec, input);
-
- onapTestUtils.verifyToscaDefVersion("DMAAP with Import File K8s",onapBlueprint, Constants.TOSCA_DEF_VERSION);
- onapTestUtils.verifyBpImportsFromFile("DMAAP with Import File K8s",onapBlueprint,input.getImportPath());
+ Input input =
+ onapTestUtils.getInput(
+ Paths.get("src", "test", "resources", "componentspecs", ves).toFile()
+ .getAbsolutePath(),
+ "",
+ "",
+ Paths.get("src", "test", "resources", "componentspecs", testImports)
+ .toFile()
+ .getAbsolutePath(),
+ "d",
+ "");
+ onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(input.getComponentSpecPath());
+ assertNotNull(
+ "K8s Blueprint for DMAAP Component Spec with Import File is NULL", onapComponentSpec);
+
+ OnapBlueprint onapBlueprint = dmaapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
+
+ onapTestUtils.verifyToscaDefVersion(
+ "DMAAP with Import File K8s", onapBlueprint, Constants.TOSCA_DEF_VERSION);
+ onapTestUtils.verifyBpImportsFromFile(
+ "DMAAP with Import File K8s", onapBlueprint, input.getImportPath());
Map<String, LinkedHashMap<String, Object>> k8sBpInputs = onapBlueprint.getInputs();
assertNotNull("DMAAP with Import File K8s Blueprint Inputs Section is NULL", k8sBpInputs);
- assertTrue("DMAAP with Import File K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
-
- //assertEquals("DMAAP with Import File K8s Blueprint:Inputs " + Constants.ALWAYS_PULL_IMAGE + " Type is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("type"), "boolean");
- //assertEquals("DMAAP with Import File K8s Blueprint:Inputs Always Pull Image Default is not matching", k8sBpInputs.get(Constants.ALWAYS_PULL_IMAGE).get("default"), Constants.ALWAYS_PULL_IMAGE_DEFAULT);
- assertEquals("DMAAP with Import File K8s Blueprint:Inputs " + Constants.ONAP_INPUT_CPU_LIMIT + " Default is not matching", k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"), Constants.ONAP_DEFAULT250m);
- assertEquals("DMAAP with Import File K8s Blueprint:Inputs " + Constants.SERVICE_COMPONENT_NAME_OVERRIDE + " Default is not matching", k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"), Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
+ assertTrue(
+ "DMAAP with Import File K8s Blueprint Inputs Section is Empty", k8sBpInputs.size() > 0);
+
+ assertEquals(
+ "DMAAP with Import File K8s Blueprint:Inputs "
+ + Constants.ONAP_INPUT_CPU_LIMIT
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.ONAP_INPUT_CPU_LIMIT).get("default"),
+ Constants.ONAP_DEFAULT250m);
+ assertEquals(
+ "DMAAP with Import File K8s Blueprint:Inputs "
+ + Constants.SERVICE_COMPONENT_NAME_OVERRIDE
+ + " Default is not matching",
+ k8sBpInputs.get(Constants.SERVICE_COMPONENT_NAME_OVERRIDE).get("default"),
+ Constants.ONAP_SERVICE_COMPONENTNAME_OVERRIDE_DEFAULT);
Map<String, Node> k8sBpNodeTemplates = onapBlueprint.getNode_templates();
- assertNotNull("DMAAP with Import File K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint", k8sBpNodeTemplates);
- assertTrue("DMAAP with Import File K8s Blueprint Node Templates Section Size is Empty", k8sBpNodeTemplates.size() > 0);
-
- assertEquals("DMAAP with Import File K8s Blueprint:NodeTemplates:Type is not Matching", k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(), Constants.DMAAP_NODETEMPLATES_TYPE);
-
- Properties k8sBpNodeTemplateProperties = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
- assertNotNull("DMAAP with Import File K8s Blueprint Node Templates:Properties Section is NULL", k8sBpNodeTemplateProperties);
-
- List bpNodeTemplateRelationships = ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getRelationships();
- assertNotNull("DMAAP with Import File K8s Blueprint Node Templates:Relationships Section is NULL", bpNodeTemplateRelationships);
-
- onapTestUtils.verifyStreamsPublishes("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyStreamsSubscribes("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyAuxilary("DMAAP with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyHealthCheck("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyServicesCalls("DMAAP with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyServicesProvides("DMAAP with Import File K8s",onapComponentSpec);
- onapTestUtils.verifyDockerConfig("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplateProperties);
- onapTestUtils.verifyParameters("DMAAP with Import File K8s",onapComponentSpec,k8sBpNodeTemplates);
+ assertNotNull(
+ "DMAAP with Import File K8s Blueprint Node Templates Section is NULL in the K8s DMAAP Blueprint",
+ k8sBpNodeTemplates);
+ assertTrue(
+ "DMAAP with Import File K8s Blueprint Node Templates Section Size is Empty",
+ k8sBpNodeTemplates.size() > 0);
+
+ assertEquals(
+ "DMAAP with Import File K8s Blueprint:NodeTemplates:Type is not Matching",
+ k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES).getType(),
+ Constants.DMAAP_NODETEMPLATES_TYPE);
+
+ Properties k8sBpNodeTemplateProperties =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getProperties();
+ assertNotNull(
+ "DMAAP with Import File K8s Blueprint Node Templates:Properties Section is NULL",
+ k8sBpNodeTemplateProperties);
+
+ List bpNodeTemplateRelationships =
+ ((Node) k8sBpNodeTemplates.get(Constants.ONAP_NODETEMPLATES)).getRelationships();
+ assertNotNull(
+ "DMAAP with Import File K8s Blueprint Node Templates:Relationships Section is NULL",
+ bpNodeTemplateRelationships);
+
+ onapTestUtils.verifyStreamsPublishes(
+ "DMAAP with Import File K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyStreamsSubscribes(
+ "DMAAP with Import File K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyAuxilary("DMAAP with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyHealthCheck(
+ "DMAAP with Import File K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyServicesCalls("DMAAP with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyServicesProvides("DMAAP with Import File K8s", onapComponentSpec);
+ onapTestUtils.verifyDockerConfig(
+ "DMAAP with Import File K8s", onapComponentSpec, k8sBpNodeTemplateProperties);
+ onapTestUtils.verifyParameters(
+ "DMAAP with Import File K8s", onapComponentSpec, k8sBpNodeTemplates);
}
-
}
-
-
-
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java
index 633c205..e610bd3 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapComponentSpecTest.java
@@ -23,7 +23,6 @@
package org.onap.blueprintgenerator.test;
-
import org.onap.blueprintgenerator.exception.ComponentSpecException;
import org.onap.blueprintgenerator.model.componentspec.base.ComponentSpec;
import org.junit.Test;
@@ -35,24 +34,35 @@ import static org.junit.Assert.assertEquals;
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * ONAP ComponentSpec Test Cases
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP ComponentSpec Test Cases
*/
-
public class OnapComponentSpecTest extends BlueprintGeneratorTests {
+ /**
+ * Test Case for ComponentSpec File Generation for Invalid File
+ *
+ */
@DisplayName("Testing ComponentSpec File Generation for Invalid File")
@Test(expected = ComponentSpecException.class)
public void testComponentSpecForInvalidFile() {
onapComponentSpecService.createComponentSpecFromFile("invalid.json");
}
+ /**
+ * Test Case for ComponentSpec File Generation for Valid DMAAP Fil
+ *
+ */
@DisplayName("Testing ComponentSpec File Generation for Valid DMAAP File")
@Test
- public void testComponentSpecForValidVesFile(){
- ComponentSpec onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(Paths.get("src", "test", "resources", "componentspecs", ves).toFile().getAbsolutePath());
- assertEquals("ComponentSpec name not matching for Valid Ves File",onapComponentSpec.getSelf().getName(), "dcae-ves-collector");
+ public void testComponentSpecForValidVesFile() {
+ ComponentSpec onapComponentSpec =
+ onapComponentSpecService.createComponentSpecFromFile(
+ Paths.get("src", "test", "resources", "componentspecs", ves)
+ .toFile()
+ .getAbsolutePath());
+ assertEquals(
+ "ComponentSpec name not matching for Valid Ves File",
+ onapComponentSpec.getSelf().getName(),
+ "dcae-ves-collector");
}
-
}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java
index 9033fbe..01845ab 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/OnapTestUtils.java
@@ -53,14 +53,11 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-
/**
* @author : Ravi Mantena
- * @date 10/16/2020
- * Application: ONAP - Blueprint Generator
- * Test Utilities used in Test Suite and Test Cases
+ * @date 10/16/2020 Application: ONAP - Blueprint Generator Test Utilities used in Test Suite and
+ * Test Cases
*/
-
@Component
@Ignore
public class OnapTestUtils extends BlueprintGeneratorTests {
@@ -83,9 +80,24 @@ public class OnapTestUtils extends BlueprintGeneratorTests {
@Value("${import.Clamp}")
private String importClamp;
-
-
- public Input getInput(String componentSpecPath,String outputPath,String bluePrintName,String importPath,String bpType,String serviceNameOverride){
+ /**
+ * Creates Input
+ *
+ * @param componentSpecPath
+ * @param outputPath
+ * @param bluePrintName
+ * @param importPath
+ * @param bpType
+ * @param serviceNameOverride
+ * @return
+ */
+ public Input getInput(
+ String componentSpecPath,
+ String outputPath,
+ String bluePrintName,
+ String importPath,
+ String bpType,
+ String serviceNameOverride) {
Input input = new Input();
input.setComponentSpecPath(componentSpecPath);
input.setBluePrintName(bluePrintName);
@@ -96,112 +108,285 @@ public class OnapTestUtils extends BlueprintGeneratorTests {
return input;
}
- public Input getInput(String componentSpecPath){
+ /**
+ * Creates Input from Component Spec Path
+ *
+ * @param componentSpecPath
+ * @return
+ */
+ public Input getInput(String componentSpecPath) {
Input input = new Input();
input.setComponentSpecPath(componentSpecPath);
return input;
}
- public void verifyToscaDefVersion(String type,Blueprint blueprint,String toscaDefVersion){
+ /**
+ * Verifies Tosca Def Version
+ *
+ * @param type
+ * @param blueprint
+ * @param toscaDefVersion
+ */
+ public void verifyToscaDefVersion(String type, Blueprint blueprint, String toscaDefVersion) {
String bpToscaDefVersion = blueprint.getTosca_definitions_version();
assertNotNull(type + " TOSCA Definition Version is NULL", bpToscaDefVersion);
- assertEquals(type + " TOSCA Definition Version is not Matching", bpToscaDefVersion, toscaDefVersion);
+ assertEquals(
+ type + " TOSCA Definition Version is not Matching", bpToscaDefVersion, toscaDefVersion);
}
- public void verifyBpImports(String type,Blueprint blueprint, boolean validateimps) {
- String[] bpImports = blueprint.getImports().toArray(new String[blueprint.getImports().size()]);
+ /**
+ * Verifies Imports
+ *
+ * @param type
+ * @param blueprint
+ * @param validateimps
+ */
+ public void verifyBpImports(String type, Blueprint blueprint, boolean validateimps) {
+ String[] bpImports = blueprint.getImports()
+ .toArray(new String[blueprint.getImports().size()]);
if (validateimps) {
- String[] testImports = {importsOnapTypes,importsOnapK8sPlugintypes,importsDmaapDmaapplugin,importPostgres,importClamp};
- assertArrayEquals(type + " Blueprint Imports is not matching with default Dmaap K8s Blueprint imports", bpImports, testImports);
- }
- else{
- String[] testImports = {importsOnapTypes,importsOnapK8sPlugintypes,importsOnapK8sDcaepolicyplugin,importPostgres,importClamp};
- assertArrayEquals(type + " Blueprint Imports is not matching with default Onap K8s Blueprint imports", bpImports, testImports);
+ String[] testImports = {
+ importsOnapTypes,
+ importsOnapK8sPlugintypes,
+ importsDmaapDmaapplugin,
+ importPostgres,
+ importClamp
+ };
+ assertArrayEquals(
+ type
+ + " Blueprint Imports is not matching with default Dmaap K8s Blueprint imports",
+ bpImports,
+ testImports);
+ } else {
+ String[] testImports = {
+ importsOnapTypes,
+ importsOnapK8sPlugintypes,
+ importsOnapK8sDcaepolicyplugin,
+ importPostgres,
+ importClamp
+ };
+ assertArrayEquals(
+ type + " Blueprint Imports is not matching with default Onap K8s Blueprint imports",
+ bpImports,
+ testImports);
}
-
}
- public void verifyBpImportsFromFile(String type,Blueprint blueprint, String importPath) throws IOException {
- Blueprint importFileRead = yamlObjectMapper.readValue(new File(importPath), Blueprint.class);
- String[] importFileImports = importFileRead.getImports().toArray(new String[importFileRead.getImports().size()]);
- String[] bpImports = blueprint.getImports().toArray(new String[blueprint.getImports().size()]);
- assertArrayEquals(type + " Blueprint Imports is not matching with default Dmaap K8s Blueprint imports", bpImports, importFileImports);
-
+ /**
+ * Verifies Imports from file
+ *
+ * @param type
+ * @param blueprint
+ * @param importPath
+ */
+ public void verifyBpImportsFromFile(String type, Blueprint blueprint, String importPath)
+ throws IOException {
+ Blueprint importFileRead = yamlObjectMapper
+ .readValue(new File(importPath), Blueprint.class);
+ String[] importFileImports =
+ importFileRead.getImports().toArray(new String[importFileRead.getImports().size()]);
+ String[] bpImports = blueprint.getImports()
+ .toArray(new String[blueprint.getImports().size()]);
+ assertArrayEquals(
+ type + " Blueprint Imports is not matching with default Dmaap K8s Blueprint imports",
+ bpImports,
+ importFileImports);
}
- public void verifyStreamsPublishes(String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
+ /**
+ * Verifies Streams Publishes
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplateProperties
+ */
+ public void verifyStreamsPublishes(
+ String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
List<Streams> streamsPublishes = nodeTemplateProperties.getStreams_publishes();
if (!(streamsPublishes == null)) {
- assertNotNull(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is NULL", streamsPublishes);
- assertTrue(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes Section Size is 0", streamsPublishes.size() > 0);
- assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is Not Matching", streamsPublishes.get(0).getType(), Constants.MESSAGEROUTER_VALUE);
- assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is Not Matching", streamsPublishes.get(1).getType(), Constants.MESSAGEROUTER_VALUE);
+ assertNotNull(
+ type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is NULL",
+ streamsPublishes);
+ assertTrue(
+ type + " Blueprint:NodeTemplates:Properties:StreamsPublishes Section Size is 0",
+ streamsPublishes.size() > 0);
+ assertEquals(
+ type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is Not Matching",
+ streamsPublishes.get(0).getType(),
+ Constants.MESSAGEROUTER_VALUE);
+ assertEquals(
+ type + " Blueprint:NodeTemplates:Properties:StreamsPublishes is Not Matching",
+ streamsPublishes.get(1).getType(),
+ Constants.MESSAGEROUTER_VALUE);
}
}
- public void verifyStreamsSubscribes(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
+ /**
+ * Verifies Streams Subscribes
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplateProperties
+ */
+ public void verifyStreamsSubscribes(
+ String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
List<Streams> streamsSubscribes = nodeTemplateProperties.getStreams_subscribes();
if (!(streamsSubscribes == null)) {
- assertNotNull(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is NULL", streamsSubscribes);
- assertTrue(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes Section Size is 0", streamsSubscribes.size() > 0);
- assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is Not Matching", streamsSubscribes.get(0).getType(), Constants.MESSAGE_ROUTER);
- assertEquals(type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is Not Matching", streamsSubscribes.get(1).getType(), Constants.DATA_ROUTER);
+ assertNotNull(
+ type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is NULL",
+ streamsSubscribes);
+ assertTrue(
+ type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes Section Size is 0",
+ streamsSubscribes.size() > 0);
+ assertEquals(
+ type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is Not Matching",
+ streamsSubscribes.get(0).getType(),
+ Constants.MESSAGE_ROUTER);
+ assertEquals(
+ type + " Blueprint:NodeTemplates:Properties:StreamsSubscribes is Not Matching",
+ streamsSubscribes.get(1).getType(),
+ Constants.DATA_ROUTER);
}
}
- public void verifyServicesCalls(String type, OnapComponentSpec onapComponentSpec){
+ /**
+ * Verifies Services Calls
+ *
+ * @param type
+ * @param onapComponentSpec
+ */
+ public void verifyServicesCalls(String type, OnapComponentSpec onapComponentSpec) {
Calls[] csServicesCalls = onapComponentSpec.getServices().getCalls();
assertNotNull(type + " ComponentSpec Services Calls is NULL", csServicesCalls);
- //assertTrue(type + " ComponentSpec Services Calls Section Size is 0", csServicesCalls.length > 0);
+ // assertTrue(type + " ComponentSpec Services Calls Section Size is 0", csServicesCalls.length >
+ // 0);
}
- public void verifyServicesProvides(String type, OnapComponentSpec onapComponentSpec){
+ /**
+ * Verifies Services Provides
+ *
+ * @param type
+ * @param onapComponentSpec
+ */
+ public void verifyServicesProvides(String type, OnapComponentSpec onapComponentSpec) {
Provides[] csServicesProvides = onapComponentSpec.getServices().getProvides();
assertNotNull(type + " ComponentSpec Services Provides is NULL", csServicesProvides);
- assertTrue(type + " ComponentSpec Services Provides Section Size is 0", csServicesProvides.length > 0);
+ assertTrue(
+ type + " ComponentSpec Services Provides Section Size is 0",
+ csServicesProvides.length > 0);
}
- public void verifyDockerConfig(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
- OnapAuxilary dockerConfig = nodeTemplateProperties.getDocker_config();
- assertNotNull(type +" Blueprint Docker Config Section is NULL", dockerConfig);
+ /**
+ * Verifies Docker Config
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplateProperties
+ */
+ public void verifyDockerConfig(
+ String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
+ OnapAuxilary dockerConfig = nodeTemplateProperties.getDocker_config();
+ assertNotNull(type + " Blueprint Docker Config Section is NULL", dockerConfig);
}
-
- public void verifyParameters(String type, OnapComponentSpec onapComponentSpec, Map<String, Node> nodeTemplates) {
+ /**
+ * Verifies Parameters
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplates
+ */
+ public void verifyParameters(
+ String type, OnapComponentSpec onapComponentSpec, Map<String, Node> nodeTemplates) {
Parameters[] csParameters = onapComponentSpec.getParameters();
- assertNotNull(type +" ComponentSpec Parameters Section is NULL", csParameters);
+ assertNotNull(type + " ComponentSpec Parameters Section is NULL", csParameters);
assertTrue(type + " ComponentSpec Parameters Section Size is 0", csParameters.length > 0);
}
- public void verifyAuxilary(String type, OnapComponentSpec onapComponentSpec){
+ /**
+ * Verifies Auxilary
+ *
+ * @param type
+ * @param onapComponentSpec
+ */
+ public void verifyAuxilary(String type, OnapComponentSpec onapComponentSpec) {
OnapAuxilary csAuxilary = onapComponentSpec.getAuxilary();
- assertNotNull(type +" ComponentSpec Auxilary Section is NULL", csAuxilary);
+ assertNotNull(type + " ComponentSpec Auxilary Section is NULL", csAuxilary);
}
- public void verifyHealthCheck(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
+ /**
+ * Verifies HealthCheck
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplateProperties
+ */
+ public void verifyHealthCheck(
+ String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
HealthCheck csAuxilaryHealthcheck = onapComponentSpec.getAuxilary().getHealthcheck();
- assertNotNull(type +" ComponentSpec Auxilary Health Check Section is NULL", csAuxilaryHealthcheck);
+ assertNotNull(
+ type + " ComponentSpec Auxilary Health Check Section is NULL", csAuxilaryHealthcheck);
HealthCheck healthCheck = nodeTemplateProperties.getDocker_config().getHealthcheck();
- assertNotNull(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck Section is NULL", healthCheck);
- assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Interval Tag is not matching", healthCheck.getInterval(), csAuxilaryHealthcheck.getInterval());
- assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Timeout Tag is not matching", healthCheck.getTimeout(), csAuxilaryHealthcheck.getTimeout());
- assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Script Tag is not matching", healthCheck.getEndpoint(), csAuxilaryHealthcheck.getEndpoint());
- assertEquals(type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Type Tag is not matching", healthCheck.getType(), csAuxilaryHealthcheck.getType());
+ assertNotNull(
+ type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck Section is NULL",
+ healthCheck);
+ assertEquals(
+ type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Interval Tag is not matching",
+ healthCheck.getInterval(),
+ csAuxilaryHealthcheck.getInterval());
+ assertEquals(
+ type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Timeout Tag is not matching",
+ healthCheck.getTimeout(),
+ csAuxilaryHealthcheck.getTimeout());
+ assertEquals(
+ type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Script Tag is not matching",
+ healthCheck.getEndpoint(),
+ csAuxilaryHealthcheck.getEndpoint());
+ assertEquals(
+ type + " Blueprint:NodeTemplates:DockerConfig:Healthcheck:Type Tag is not matching",
+ healthCheck.getType(),
+ csAuxilaryHealthcheck.getType());
}
- public void verifyVolumes(String type,OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties){
+ /**
+ * Verifies Volumes
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param nodeTemplateProperties
+ */
+ public void verifyVolumes(
+ String type, OnapComponentSpec onapComponentSpec, Properties nodeTemplateProperties) {
Volumes[] csAuxilaryVolumes = onapComponentSpec.getAuxilary().getVolumes();
- assertNotNull(type +" ComponentSpec Auxilary Live Health Check Section is NULL", csAuxilaryVolumes);
+ assertNotNull(
+ type + " ComponentSpec Auxilary Live Health Check Section is NULL", csAuxilaryVolumes);
Volumes[] onapVolumes = nodeTemplateProperties.getDocker_config().getVolumes();
- assertNotNull(type + " Blueprint:NodeTemplates:DockerConfig:LiveHealthcheck Section is NULL", onapVolumes);
+ assertNotNull(
+ type + " Blueprint:NodeTemplates:DockerConfig:LiveHealthcheck Section is NULL",
+ onapVolumes);
}
- public void verifyArtifacts(String type,OnapComponentSpec onapComponentSpec, Map<String, LinkedHashMap<String, Object>> inputs,String bptype){
+ /**
+ * Verifies Artifacts
+ *
+ * @param type
+ * @param onapComponentSpec
+ * @param inputs
+ * @param bptype
+ */
+ public void verifyArtifacts(
+ String type,
+ OnapComponentSpec onapComponentSpec,
+ Map<String, LinkedHashMap<String, Object>> inputs,
+ String bptype) {
Artifacts[] csArtifacts = onapComponentSpec.getArtifacts();
assertNotNull(type + " ComponentSpec Artifacts Section is NULL", csArtifacts);
- assertEquals(type + " Blueprint:Artifacts:image is not matching", ((String) inputs.get("image").get("default")), "\"" + csArtifacts[0].getUri() + "\"");
- //assertEquals(type + " Blueprint:Artifacts:image is not matching", ((String) inputs.get("tag_version").get("default")), "\"" + csArtifacts[0].getUri() + "\"");
+ assertEquals(
+ type + " Blueprint:Artifacts:image is not matching",
+ ((String) inputs.get("image").get("default")),
+ "\"" + csArtifacts[0].getUri() + "\"");
+ // assertEquals(type + " Blueprint:Artifacts:image is not matching", ((String)
+ // inputs.get("tag_version").get("default")), "\"" + csArtifacts[0].getUri() + "\"");
}
-
}
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java
index 9eb6899..984c262 100644
--- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java
+++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/TlsInfoTest.java
@@ -1,26 +1,25 @@
/*============LICENSE_START=======================================================
- org.onap.dcae
- ================================================================================
- Copyright (c) 2020 Nokia. All rights reserved.
- Copyright (c) 2020 AT&T. 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=========================================================
- */
+org.onap.dcae
+================================================================================
+Copyright (c) 2020 Nokia. All rights reserved.
+Copyright (c) 2020 AT&T. 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.blueprintgenerator.test;
-
import org.junit.Test;
import org.junit.runners.Parameterized;
import org.onap.blueprintgenerator.model.common.Input;
@@ -30,7 +29,6 @@ import org.onap.blueprintgenerator.model.common.ExternalCertificateParameters;
import org.onap.blueprintgenerator.model.common.ExternalTlsInfo;
import org.onap.blueprintgenerator.model.dmaap.TlsInfo;
-
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.LinkedHashMap;
@@ -41,8 +39,11 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-
-//@RunWith(Parameterized.class)
+/**
+ * Test Case for Tls Info
+ *
+ */
+// @RunWith(Parameterized.class)
public class TlsInfoTest extends BlueprintGeneratorTests {
@Parameterized.Parameter
@@ -53,89 +54,129 @@ public class TlsInfoTest extends BlueprintGeneratorTests {
return Arrays.asList('o', 'd');
}
-
+ /**
+ * Test Case for Tls True and External TLS True
+ *
+ */
@Test
public void useTlsTrueAndUseExternalTlsTrueTest() {
- //Input input = input.setComponentSpecPath(componentSpecPath + "testComponentSpec_withTlsTrueAndExternalTlsTrue.json");
- OnapBlueprint bp = createBlueprintFromFile(
- Paths.get("src", "test", "resources", "componentspecs", useTlsTrueAndUseExternalTlsTrueTest).toFile()
- .getAbsolutePath());
+ OnapBlueprint bp =
+ createBlueprintFromFile(
+ Paths.get(
+ "src",
+ "test",
+ "resources",
+ "componentspecs",
+ useTlsTrueAndUseExternalTlsTrueTest)
+ .toFile()
+ .getAbsolutePath());
assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(bp, true);
assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, true);
}
-
+ /**
+ * Test Case for Tls False and External TLS False
+ *
+ */
@Test
public void useTlsFalseAndUseExternalTlsFalseTest() {
- OnapBlueprint bp = createBlueprintFromFile(
- Paths.get("src", "test", "resources", "componentspecs", useTlsFalseAndUseExternalTlsFalseTest).toFile()
- .getAbsolutePath());
+ OnapBlueprint bp =
+ createBlueprintFromFile(
+ Paths.get(
+ "src",
+ "test",
+ "resources",
+ "componentspecs",
+ useTlsFalseAndUseExternalTlsFalseTest)
+ .toFile()
+ .getAbsolutePath());
assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(bp, false);
assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, false);
}
+ /**
+ * Test Case for Tls True and No External TLS Flag
+ *
+ */
@Test
public void useTlsTrueAndNoExternalTlsFlagTest() {
- OnapBlueprint bp = createBlueprintFromFile(
- Paths.get("src", "test", "resources", "componentspecs", useTlsTrueAndNoExternalTlsFlagTest).toFile()
- .getAbsolutePath());
+ OnapBlueprint bp =
+ createBlueprintFromFile(
+ Paths.get(
+ "src",
+ "test",
+ "resources",
+ "componentspecs",
+ useTlsTrueAndNoExternalTlsFlagTest)
+ .toFile()
+ .getAbsolutePath());
assertBlueprintContainsTlsInfoWithUseFlagDefault(bp, true);
assertBlueprintHasNoExternalTlsInfo(bp);
}
+ /**
+ * Test Case for No Tls Info
+ *
+ */
@Test
public void noTlsInfo() {
- OnapBlueprint bp = createBlueprintFromFile(
- Paths.get("src", "test", "resources", "componentspecs", noTlsInfo).toFile().getAbsolutePath());
+ OnapBlueprint bp =
+ createBlueprintFromFile(
+ Paths.get("src", "test", "resources", "componentspecs", noTlsInfo)
+ .toFile()
+ .getAbsolutePath());
assertBlueprintHasNoTlsInfo(bp);
assertBlueprintHasNoExternalTlsInfo(bp);
}
- private void assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(OnapBlueprint bp, boolean useFlagDefault) {
- //should create proper inputs
+ private void assertBlueprintContainsExternalTlsInfoWithUseFlagDefault(
+ OnapBlueprint bp, boolean useFlagDefault) {
+ // should create proper inputs
assertContainsInputWithDefault(bp, "external_cert_use_external_tls", useFlagDefault);
assertContainsInputWithDefault(bp, "external_cert_ca_name", "\"RA\"");
assertContainsInputWithDefault(bp, "external_cert_cert_type", "\"P12\"");
assertContainsInputWithDefault(bp, "external_cert_common_name", "\"sample.onap.org\"");
- assertContainsInputWithDefault(bp, "external_cert_sans",
- "\"sample.onap.org,component.sample.onap.org\"");
+ assertContainsInputWithDefault(
+ bp, "external_cert_sans", "\"sample.onap.org,component.sample.onap.org\"");
Node node = bp.getNode_templates().get("test.component.spec");
- //should create proper externalTlsInfo object in node properties
+ // should create proper externalTlsInfo object in node properties
ExternalTlsInfo externalTlsInfo = node.getProperties().getExternal_cert();
assertNotNull(externalTlsInfo);
assertEquals("external_cert_ca_name", externalTlsInfo.getCaName().getBpInputName());
assertEquals("external_cert_cert_type", externalTlsInfo.getCertType().getBpInputName());
- assertEquals("external_cert_use_external_tls", externalTlsInfo.getUseExternalTls().getBpInputName());
+ assertEquals(
+ "external_cert_use_external_tls", externalTlsInfo.getUseExternalTls().getBpInputName());
assertEquals("/opt/app/dcae-certificate/", externalTlsInfo.getExternalCertDirectory());
- ExternalCertificateParameters extCertParams = externalTlsInfo.getExternalCertificateParameters();
+ ExternalCertificateParameters extCertParams =
+ externalTlsInfo.getExternalCertificateParameters();
assertNotNull(extCertParams);
assertEquals("external_cert_common_name", extCertParams.getCommonName().getBpInputName());
assertEquals("external_cert_sans", extCertParams.getSans().getBpInputName());
}
- private void assertBlueprintContainsTlsInfoWithUseFlagDefault(OnapBlueprint bp, boolean useFlagDefault) {
- //shold create proper inputs
+ private void assertBlueprintContainsTlsInfoWithUseFlagDefault(
+ OnapBlueprint bp, boolean useFlagDefault) {
+ // shold create proper inputs
assertContainsInputWithDefault(bp, "use_tls", useFlagDefault);
Node node = bp.getNode_templates().get("test.component.spec");
- //should create proper tlsInfo object in node properties
+ // should create proper tlsInfo object in node properties
TlsInfo tlsInfo = node.getProperties().getTls_info();
assertEquals("use_tls", tlsInfo.getUseTls().getBpInputName());
assertEquals("/opt/app/dcae-certificate/", tlsInfo.getCertDirectory());
-
}
private void assertBlueprintHasNoExternalTlsInfo(OnapBlueprint bp) {
- //should not create inputs for external tls
+ // should not create inputs for external tls
assertFalse(bp.getInputs().containsKey("external_cert_use_external_tls"));
assertFalse(bp.getInputs().containsKey("external_cert_common_name"));
assertFalse(bp.getInputs().containsKey("external_cert_ca_name"));
@@ -143,23 +184,23 @@ public class TlsInfoTest extends BlueprintGeneratorTests {
Node node = bp.getNode_templates().get("test.component.spec");
- //should not create externalTlsInfo object in node properties
+ // should not create externalTlsInfo object in node properties
ExternalTlsInfo externalTlsInfo = node.getProperties().getExternal_cert();
assertNull(externalTlsInfo);
}
-
private void assertBlueprintHasNoTlsInfo(OnapBlueprint bp) {
- //should not create inputs for tls
+ // should not create inputs for tls
assertFalse(bp.getInputs().containsKey("use_tls"));
Node node = bp.getNode_templates().get("test.component.spec");
- //should not create tlsInfo object in node properties
+ // should not create tlsInfo object in node properties
assertNull(node.getProperties().getTls_info());
}
- private void assertContainsInputWithDefault(OnapBlueprint bp, String inputName, Object defaultValue) {
+ private void assertContainsInputWithDefault(
+ OnapBlueprint bp, String inputName, Object defaultValue) {
LinkedHashMap<String, Object> input = bp.getInputs().get(inputName);
assertNotNull(input);
assertEquals(defaultValue, input.get("default"));
@@ -168,7 +209,8 @@ public class TlsInfoTest extends BlueprintGeneratorTests {
private OnapBlueprint createBlueprintFromFile(String path) {
onapComponentSpec = onapComponentSpecService.createComponentSpecFromFile(path);
Input input = onapTestUtils.getInput(path, "", "", "", "o", "");
- OnapBlueprint onapBlueprint = onapBlueprintService.createBlueprint(onapComponentSpec, input);
+ OnapBlueprint onapBlueprint = onapBlueprintService
+ .createBlueprint(onapComponentSpec, input);
return onapBlueprint;
}
}
diff --git a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsFalseAndExternalTlsFalse.json b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsFalseAndExternalTlsFalse.json
index da75ab8..8234605 100644
--- a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsFalseAndExternalTlsFalse.json
+++ b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsFalseAndExternalTlsFalse.json
@@ -1,43 +1,40 @@
{
- "self": {
- "component_type": "docker",
- "description": "Test component spec",
- "name": "test.component.spec",
- "version": "1.0.1"
- },
-
- "services": {
- "calls": [],
- "provides": []
- },
-
- "streams": {
- "publishes": [],
- "subscribes": []
- },
-
- "parameters": [],
-
- "auxilary": {
- "healthcheck": {
- "type": "docker",
- "interval": "300s",
- "timeout": "120s",
- "script": "/etc/init.d/nagios status"
- },
- "ports": [
- "80:80",
- "99:99"
- ],
- "tls_info": {
- "cert_directory": "/opt/app/dcae-certificate/",
- "use_tls": false,
- "use_external_tls": false
- }
- },
- "artifacts": [{
- "type": "docker image",
- "uri": "test.tester"
- }]
-
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+ "parameters": [],
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ],
+ "tls_info": {
+ "cert_directory": "/opt/app/dcae-certificate/",
+ "use_tls": false,
+ "use_external_tls": false
+ }
+ },
+ "artifacts": [
+ {
+ "type": "docker image",
+ "uri": "test.tester"
+ }
+ ]
}
diff --git a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndExternalTlsTrue.json b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndExternalTlsTrue.json
index f13e3fd..20709e9 100644
--- a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndExternalTlsTrue.json
+++ b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndExternalTlsTrue.json
@@ -1,43 +1,40 @@
{
- "self": {
- "component_type": "docker",
- "description": "Test component spec",
- "name": "test.component.spec",
- "version": "1.0.1"
- },
-
- "services": {
- "calls": [],
- "provides": []
- },
-
- "streams": {
- "publishes": [],
- "subscribes": []
- },
-
- "parameters": [],
-
- "auxilary": {
- "healthcheck": {
- "type": "docker",
- "interval": "300s",
- "timeout": "120s",
- "script": "/etc/init.d/nagios status"
- },
- "ports": [
- "80:80",
- "99:99"
- ],
- "tls_info": {
- "cert_directory": "/opt/app/dcae-certificate/",
- "use_tls": true,
- "use_external_tls": true
- }
- },
- "artifacts": [{
- "type": "docker image",
- "uri": "test.tester"
- }]
-
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+ "parameters": [],
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ],
+ "tls_info": {
+ "cert_directory": "/opt/app/dcae-certificate/",
+ "use_tls": true,
+ "use_external_tls": true
+ }
+ },
+ "artifacts": [
+ {
+ "type": "docker image",
+ "uri": "test.tester"
+ }
+ ]
}
diff --git a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndNoExternalTls.json b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndNoExternalTls.json
index 517c461..cb73af7 100644
--- a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndNoExternalTls.json
+++ b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withTlsTrueAndNoExternalTls.json
@@ -1,42 +1,39 @@
{
- "self": {
- "component_type": "docker",
- "description": "Test component spec",
- "name": "test.component.spec",
- "version": "1.0.1"
- },
-
- "services": {
- "calls": [],
- "provides": []
- },
-
- "streams": {
- "publishes": [],
- "subscribes": []
- },
-
- "parameters": [],
-
- "auxilary": {
- "healthcheck": {
- "type": "docker",
- "interval": "300s",
- "timeout": "120s",
- "script": "/etc/init.d/nagios status"
- },
- "ports": [
- "80:80",
- "99:99"
- ],
- "tls_info": {
- "cert_directory": "/opt/app/dcae-certificate/",
- "use_tls": true
- }
- },
- "artifacts": [{
- "type": "docker image",
- "uri": "test.tester"
- }]
-
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+ "parameters": [],
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ],
+ "tls_info": {
+ "cert_directory": "/opt/app/dcae-certificate/",
+ "use_tls": true
+ }
+ },
+ "artifacts": [
+ {
+ "type": "docker image",
+ "uri": "test.tester"
+ }
+ ]
}
diff --git a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withoutTlsInfo.json b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withoutTlsInfo.json
index a94c987..a247b2c 100644
--- a/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withoutTlsInfo.json
+++ b/mod/bpgenerator/onap/src/test/resources/componentspecs/testComponentSpec_withoutTlsInfo.json
@@ -1,38 +1,35 @@
{
- "self": {
- "component_type": "docker",
- "description": "Test component spec",
- "name": "test.component.spec",
- "version": "1.0.1"
- },
-
- "services": {
- "calls": [],
- "provides": []
- },
-
- "streams": {
- "publishes": [],
- "subscribes": []
- },
-
- "parameters": [],
-
- "auxilary": {
- "healthcheck": {
- "type": "docker",
- "interval": "300s",
- "timeout": "120s",
- "script": "/etc/init.d/nagios status"
- },
- "ports": [
- "80:80",
- "99:99"
- ]
- },
- "artifacts": [{
- "type": "docker image",
- "uri": "test.tester"
- }]
-
+ "self": {
+ "component_type": "docker",
+ "description": "Test component spec",
+ "name": "test.component.spec",
+ "version": "1.0.1"
+ },
+ "services": {
+ "calls": [],
+ "provides": []
+ },
+ "streams": {
+ "publishes": [],
+ "subscribes": []
+ },
+ "parameters": [],
+ "auxilary": {
+ "healthcheck": {
+ "type": "docker",
+ "interval": "300s",
+ "timeout": "120s",
+ "script": "/etc/init.d/nagios status"
+ },
+ "ports": [
+ "80:80",
+ "99:99"
+ ]
+ },
+ "artifacts": [
+ {
+ "type": "docker image",
+ "uri": "test.tester"
+ }
+ ]
}
diff --git a/mod/bpgenerator/onap/src/test/resources/componentspecs/ves.json b/mod/bpgenerator/onap/src/test/resources/componentspecs/ves.json
index 6655a2c..822a7b1 100644
--- a/mod/bpgenerator/onap/src/test/resources/componentspecs/ves.json
+++ b/mod/bpgenerator/onap/src/test/resources/componentspecs/ves.json
@@ -12,14 +12,14 @@
"version": "1.0.0",
"route": "/TEST_HELLO_WORLD_SUB_MR",
"type": "message_router",
- "config_key": "TEST-SUB-MR"
+ "config_key": "TEST-SUB-MR"
},
{
"format": "dataformat_Hello_World_PM DR",
"version": "1.0.0",
- "route": "/TEST_HELLO_WORLD_SUB_DR",
+ "route": "/TEST_HELLO_WORLD_SUB_DR",
"type": "data_router",
- "config_key": "TEST-SUB-DR"
+ "config_key": "TEST-SUB-DR"
}
],
"publishes": [
@@ -27,37 +27,37 @@
"format": "VES_specification",
"version": "5.28.4",
"type": "message router",
- "config_key": "ves-fault"
+ "config_key": "ves-fault"
},
{
"format": "VES_specification",
"version": "5.28.4",
"type": "message router",
- "config_key": "ves-measurement"
+ "config_key": "ves-measurement"
},
{
"format": "VES_specification",
"version": "5.28.4",
"type": "message router",
- "config_key": "ves-other"
+ "config_key": "ves-other"
},
{
"format": "VES_specification",
"version": "5.28.4",
"type": "message router",
- "config_key": "ves-heartbeat-secondary"
+ "config_key": "ves-heartbeat-secondary"
},
{
"format": "VES_specification",
"version": "7.30.0",
"type": "message router",
- "config_key": "ves-pnfRegistration"
+ "config_key": "ves-pnfRegistration"
},
{
"format": "VES_specification",
"version": "7.30.0",
"type": "message router",
- "config_key": "ves-notification"
+ "config_key": "ves-notification"
}
]
},
@@ -242,24 +242,24 @@
"sourced_at_deployment": true,
"policy_editable": true,
"policy_group": "Test_Parameters",
- "required": true,
+ "required": true,
"designer_editable": true,
"policy_schema": [
- {
- "name": "PolicySchemaTest",
- "description": "List of objects for vnf type monitorng",
- "type": "String",
- "entry_schema": [
- {
- "name": "TestEntrySchema",
- "description": "entry",
- "type": "string",
- "value": "None"
- }
- ]
- }
+ {
+ "name": "PolicySchemaTest",
+ "description": "List of objects for vnf type monitorng",
+ "type": "String",
+ "entry_schema": [
+ {
+ "name": "TestEntrySchema",
+ "description": "entry",
+ "type": "string",
+ "value": "None"
+ }
+ ]
+ }
]
- },
+ },
{
"name": "tomcat.maxthreads",
"value": "200",
@@ -281,17 +281,17 @@
"interval": "15s",
"timeout": "1s",
"endpoint": "/livehealthcheck"
- },
+ },
"databases": {
"dti": "postgres"
- },
+ },
"reconfigs": {
"app_reconfig": "abc"
- },
+ },
"policy": {
"trigger_type": "docker",
- "script_path": "/opt/app/manager/bin/reconfigure.sh"
- },
+ "script_path": "/opt/app/manager/bin/reconfigure.sh"
+ },
"volumes": [
{
"container": {
diff --git a/mod/bpgenerator/onap/src/test/resources/policyjson/policyInput.json b/mod/bpgenerator/onap/src/test/resources/policyjson/policyInput.json
index fb89e1a..4e413d1 100644
--- a/mod/bpgenerator/onap/src/test/resources/policyjson/policyInput.json
+++ b/mod/bpgenerator/onap/src/test/resources/policyjson/policyInput.json
@@ -1,28 +1,28 @@
{
- "policies": [
- {
- "configAttributes": "",
- "configName": "",
- "onapName": "DCAE",
- "policyName": "DCAE.Config_*",
- "unique": false
- },
- {
- "onapName": "DCAE",
- "policyName": "DCAE.Config_*",
- "unique": true
- },
- {
- "configAttributes": "",
- "configName": "",
- "onapName": "DCAE",
- "policyName": "DCAE.Config_*",
- "unique": false
- }
- ],
- "policy": [
- {
- "policy_id" : "id_0"
- }
- ]
+ "policies": [
+ {
+ "configAttributes": "",
+ "configName": "",
+ "onapName": "DCAE",
+ "policyName": "DCAE.Config_*",
+ "unique": false
+ },
+ {
+ "onapName": "DCAE",
+ "policyName": "DCAE.Config_*",
+ "unique": true
+ },
+ {
+ "configAttributes": "",
+ "configName": "",
+ "onapName": "DCAE",
+ "policyName": "DCAE.Config_*",
+ "unique": false
+ }
+ ],
+ "policy": [
+ {
+ "policy_id": "id_0"
+ }
+ ]
} \ No newline at end of file
diff --git a/mod/bpgenerator/onap/version.properties b/mod/bpgenerator/onap/version.properties
index 93e7833..8abc1d2 100644
--- a/mod/bpgenerator/onap/version.properties
+++ b/mod/bpgenerator/onap/version.properties
@@ -20,7 +20,6 @@
# */
#
#
-
major=1
minor=7
patch=0
diff --git a/mod/bpgenerator/pom.xml b/mod/bpgenerator/pom.xml
index 724aad8..423ffc9 100644
--- a/mod/bpgenerator/pom.xml
+++ b/mod/bpgenerator/pom.xml
@@ -23,8 +23,8 @@
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.onap.dcaegen2.platform.mod</groupId>
@@ -44,7 +44,7 @@
<groupId>org.onap.oparent</groupId>
<artifactId>oparent</artifactId>
<version>2.0.0</version>
- <relativePath />
+ <relativePath/>
</parent>
<properties>
@@ -64,17 +64,20 @@
<dockerfile-maven-plugin.version>1.4.10</dockerfile-maven-plugin.version>
<docker.image.name>onap/${project.groupId}.${project.artifactId}</docker.image.name>
<sonar.maven.plugin>3.0.2</sonar.maven.plugin>
- <sonar.junit.reportsPath>${project.basedir}/target/surefire-reports</sonar.junit.reportsPath>
- <sonar.surefire.reportsPath>${project.basedir}/target/surefire-reports</sonar.surefire.reportsPath>
- <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
+ <sonar.junit.reportsPath>${project.basedir}/target/surefire-reports
+ </sonar.junit.reportsPath>
+ <sonar.surefire.reportsPath>${project.basedir}/target/surefire-reports
+ </sonar.surefire.reportsPath>
+ <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco-ut/jacoco.xml
+ </sonar.coverage.jacoco.xmlReportPaths>
</properties>
<dependencies>
<dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>5.2.0.RELEASE</version>
- </dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>5.2.0.RELEASE</version>
+ </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
@@ -85,7 +88,7 @@
<artifactId>spring-boot-starter</artifactId>
<version>2.2.5.RELEASE</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>2.2.5.RELEASE</version>
@@ -149,12 +152,27 @@
<artifactId>commons-cli</artifactId>
<version>${commons.cli.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>3.3.9</version>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.10.2</version>
+ <configuration>
+ <additionalparam>-Xdoclint:all</additionalparam>
+ <additionalparam>-Xlint:all</additionalparam>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.6</version>
<executions>