diff options
author | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-02-15 16:04:12 +0100 |
---|---|---|
committer | Determe, Sebastien (sd378r) <sd378r@intl.att.com> | 2018-02-15 16:04:12 +0100 |
commit | 57867d108c2f4db22379f5148c9dbab85a29662f (patch) | |
tree | db477b92a01a2e5e307199acc78617b5e1a79a53 | |
parent | 3ba340378a42d0090273f358deaaa1a269008f83 (diff) |
Code refactoring
Code refactoring, mainly Classes/Methods name renaming
Issue-ID: CLAMP-85
Change-Id: I12bd190576e324ed33f057dc1a4ad32c16fcb6c2
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
49 files changed, 276 insertions, 265 deletions
@@ -378,6 +378,10 @@ <groupId>org.mariadb.jdbc</groupId> <artifactId>mariadb-java-client</artifactId> </exclusion> + <exclusion> + <groupId>com.att.nsa</groupId> + <artifactId>dmaapClient</artifactId> + </exclusion> </exclusions> </dependency> <dependency> diff --git a/src/main/java/org/onap/clamp/clds/Application.java b/src/main/java/org/onap/clamp/clds/Application.java index 281a87ca5..9d057b583 100644 --- a/src/main/java/org/onap/clamp/clds/Application.java +++ b/src/main/java/org/onap/clamp/clds/Application.java @@ -28,8 +28,8 @@ import com.att.eelf.configuration.EELFManager; import org.apache.camel.component.servlet.CamelHttpTransportServlet; import org.apache.catalina.connector.Connector; -import org.onap.clamp.clds.model.prop.Holmes; -import org.onap.clamp.clds.model.prop.ModelProperties; +import org.onap.clamp.clds.model.properties.Holmes; +import org.onap.clamp.clds.model.properties.ModelProperties; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration; diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java index 6053a0de9..3c8649cd3 100644 --- a/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java +++ b/src/main/java/org/onap/clamp/clds/client/DcaeDispatcherServices.java @@ -31,8 +31,8 @@ import java.util.Date; import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
+import org.onap.clamp.clds.config.CldsReferenceProperties;
import org.onap.clamp.clds.exception.DcaeDeploymentException;
-import org.onap.clamp.clds.model.refprop.RefProp;
import org.onap.clamp.clds.util.LoggingUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -47,7 +47,7 @@ public class DcaeDispatcherServices { protected static final EELFLogger logger = EELFManager.getInstance().getLogger(DcaeDispatcherServices.class);
protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
@Autowired
- private RefProp refProp;
+ private CldsReferenceProperties refProp;
private static final String STATUS_URL_LOG = "Status URL extracted: ";
private static final String DCAE_URL_PREFIX = "/dcae-deployments/";
private static final String DCAE_URL_PROPERTY_NAME = "DCAE_DISPATCHER_URL";
diff --git a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java index 4dfe089f9..1abd88985 100644 --- a/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java +++ b/src/main/java/org/onap/clamp/clds/client/DcaeInventoryServices.java @@ -41,13 +41,13 @@ import org.json.simple.JSONArray; import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
+import org.onap.clamp.clds.config.CldsReferenceProperties;
import org.onap.clamp.clds.dao.CldsDao;
import org.onap.clamp.clds.model.CldsEvent;
import org.onap.clamp.clds.model.CldsModel;
import org.onap.clamp.clds.model.DcaeEvent;
-import org.onap.clamp.clds.model.prop.Global;
-import org.onap.clamp.clds.model.prop.ModelProperties;
-import org.onap.clamp.clds.model.refprop.RefProp;
+import org.onap.clamp.clds.model.properties.Global;
+import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.util.LoggingUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -63,7 +63,7 @@ public class DcaeInventoryServices { protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger();
private static final String DCAE_INVENTORY_URL = "DCAE_INVENTORY_URL";
@Autowired
- private RefProp refProp;
+ private CldsReferenceProperties refProp;
@Autowired
private CldsDao cldsDao;
diff --git a/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java b/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java index 34655986d..4e165e141 100644 --- a/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDelegate.java @@ -31,9 +31,9 @@ import java.util.UUID; import org.apache.camel.Exchange; import org.apache.camel.Handler; import org.onap.clamp.clds.client.req.policy.PolicyClient; -import org.onap.clamp.clds.model.prop.Holmes; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.refprop.RefProp; +import org.onap.clamp.clds.config.CldsReferenceProperties; +import org.onap.clamp.clds.model.properties.Holmes; +import org.onap.clamp.clds.model.properties.ModelProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -48,7 +48,7 @@ public class HolmesPolicyDelegate { @Autowired private PolicyClient policyClient; @Autowired - private RefProp refProp; + private CldsReferenceProperties refProp; /** * Perform activity. Send Holmes info to policy api. diff --git a/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegate.java b/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegate.java index 28da14851..9075ea62a 100644 --- a/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/HolmesPolicyDeleteDelegate.java @@ -29,8 +29,8 @@ import com.att.eelf.configuration.EELFManager; import org.apache.camel.Exchange; import org.apache.camel.Handler; import org.onap.clamp.clds.client.req.policy.PolicyClient; -import org.onap.clamp.clds.model.prop.Holmes; -import org.onap.clamp.clds.model.prop.ModelProperties; +import org.onap.clamp.clds.model.properties.Holmes; +import org.onap.clamp.clds.model.properties.ModelProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDelegate.java b/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDelegate.java index 77d7680bb..ec83db9de 100644 --- a/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDelegate.java @@ -33,10 +33,10 @@ import org.apache.camel.Exchange; import org.apache.camel.Handler; import org.onap.clamp.clds.client.req.policy.OperationalPolicyReq; import org.onap.clamp.clds.client.req.policy.PolicyClient; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.prop.Policy; -import org.onap.clamp.clds.model.prop.PolicyChain; -import org.onap.clamp.clds.model.refprop.RefProp; +import org.onap.clamp.clds.config.CldsReferenceProperties; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.properties.Policy; +import org.onap.clamp.clds.model.properties.PolicyChain; import org.onap.clamp.clds.util.LoggingUtils; import org.onap.policy.api.AttributeType; import org.onap.policy.controlloop.policy.builder.BuilderException; @@ -61,7 +61,7 @@ public class OperationalPolicyDelegate { * Automatically injected by Spring, define in CldsConfiguration as a bean. */ @Autowired - private RefProp refProp; + private CldsReferenceProperties refProp; /** * Perform activity. Send Operational Policy info to policy api. diff --git a/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java b/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java index 4dd204080..862d68a7b 100644 --- a/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/OperationalPolicyDeleteDelegate.java @@ -29,9 +29,9 @@ import com.att.eelf.configuration.EELFManager; import org.apache.camel.Exchange; import org.apache.camel.Handler; import org.onap.clamp.clds.client.req.policy.PolicyClient; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.prop.Policy; -import org.onap.clamp.clds.model.prop.PolicyChain; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.properties.Policy; +import org.onap.clamp.clds.model.properties.PolicyChain; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java b/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java index e21bfce41..438ea4727 100644 --- a/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/SdcSendReqDelegate.java @@ -34,11 +34,11 @@ import org.apache.camel.Exchange; import org.apache.camel.Handler; import org.apache.commons.codec.DecoderException; import org.onap.clamp.clds.client.req.sdc.SdcCatalogServices; -import org.onap.clamp.clds.client.req.sdc.SdcReq; +import org.onap.clamp.clds.client.req.sdc.SdcRequests; +import org.onap.clamp.clds.config.CldsReferenceProperties; import org.onap.clamp.clds.model.DcaeEvent; -import org.onap.clamp.clds.model.prop.Global; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.refprop.RefProp; +import org.onap.clamp.clds.model.properties.Global; +import org.onap.clamp.clds.model.properties.ModelProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -53,9 +53,9 @@ public class SdcSendReqDelegate { @Autowired private SdcCatalogServices sdcCatalogServices; @Autowired - private SdcReq sdcReq; + private SdcRequests sdcReq; @Autowired - private RefProp refProp; + private CldsReferenceProperties refProp; /** * Perform activity. Send to sdc proxy. @@ -72,7 +72,6 @@ public class SdcSendReqDelegate { @Handler public void execute(Exchange camelExchange) throws GeneralSecurityException, DecoderException, IOException { String controlName = (String) camelExchange.getProperty("controlName"); - String baseUrl = refProp.getStringValue("sdc.serviceUrl"); String artifactLabel = sdcReq .normalizeResourceInstanceName(refProp.getStringValue("sdc.artifactLabel") + "-" + controlName); String locationArtifactLabel = sdcReq @@ -98,7 +97,7 @@ public class SdcSendReqDelegate { String serviceInvariantUUID = globalProps.getService(); camelExchange.setProperty("serviceInvariantUUID", serviceInvariantUUID); } - List<String> sdcReqUrlsList = sdcReq.getSdcReqUrlsList(prop, baseUrl); + List<String> sdcReqUrlsList = sdcReq.getSdcReqUrlsList(prop); String sdcLocationsPayload = sdcReq.formatSdcLocationsReq(prop, artifactName); String locationArtifactName = (String) camelExchange.getProperty("controlName") + "-location.json"; String formattedSdcLocationReq = sdcReq.formatSdcReq(sdcLocationsPayload, locationArtifactName, diff --git a/src/main/java/org/onap/clamp/clds/client/TcaPolicyDelegate.java b/src/main/java/org/onap/clamp/clds/client/TcaPolicyDelegate.java index 2657a03f9..55fe2c571 100644 --- a/src/main/java/org/onap/clamp/clds/client/TcaPolicyDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/TcaPolicyDelegate.java @@ -32,9 +32,9 @@ import org.apache.camel.Exchange; import org.apache.camel.Handler; import org.onap.clamp.clds.client.req.policy.PolicyClient; import org.onap.clamp.clds.client.req.tca.TcaRequestFormatter; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.prop.Tca; -import org.onap.clamp.clds.model.refprop.RefProp; +import org.onap.clamp.clds.config.CldsReferenceProperties; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.properties.Tca; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -47,7 +47,7 @@ public class TcaPolicyDelegate { protected static final EELFLogger logger = EELFManager.getInstance().getLogger(TcaPolicyDelegate.class); protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); @Autowired - private RefProp refProp; + private CldsReferenceProperties refProp; @Autowired private PolicyClient policyClient; diff --git a/src/main/java/org/onap/clamp/clds/client/TcaPolicyDeleteDelegate.java b/src/main/java/org/onap/clamp/clds/client/TcaPolicyDeleteDelegate.java index c2aa303a5..c38d30075 100644 --- a/src/main/java/org/onap/clamp/clds/client/TcaPolicyDeleteDelegate.java +++ b/src/main/java/org/onap/clamp/clds/client/TcaPolicyDeleteDelegate.java @@ -29,8 +29,8 @@ import com.att.eelf.configuration.EELFManager; import org.apache.camel.Exchange; import org.apache.camel.Handler; import org.onap.clamp.clds.client.req.policy.PolicyClient; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.prop.Tca; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.properties.Tca; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/src/main/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyReq.java b/src/main/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyReq.java index 8753a9fd3..434da4b65 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyReq.java +++ b/src/main/java/org/onap/clamp/clds/client/req/policy/OperationalPolicyReq.java @@ -39,12 +39,12 @@ import java.util.Map; import javax.ws.rs.BadRequestException; -import org.onap.clamp.clds.model.prop.Global; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.prop.PolicyChain; -import org.onap.clamp.clds.model.prop.PolicyItem; -import org.onap.clamp.clds.model.prop.Tca; -import org.onap.clamp.clds.model.refprop.RefProp; +import org.onap.clamp.clds.config.CldsReferenceProperties; +import org.onap.clamp.clds.model.properties.Global; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.properties.PolicyChain; +import org.onap.clamp.clds.model.properties.PolicyItem; +import org.onap.clamp.clds.model.properties.Tca; import org.onap.policy.api.AttributeType; import org.onap.policy.controlloop.policy.OperationsAccumulateParams; import org.onap.policy.controlloop.policy.Policy; @@ -80,7 +80,7 @@ public class OperationalPolicyReq { * @throws BuilderException * @throws UnsupportedEncodingException */ - public static Map<AttributeType, Map<String, String>> formatAttributes(RefProp refProp, ModelProperties prop, + public static Map<AttributeType, Map<String, String>> formatAttributes(CldsReferenceProperties refProp, ModelProperties prop, String modelElementId, PolicyChain policyChain) throws BuilderException, UnsupportedEncodingException { Global global = prop.getGlobal(); prop.setCurrentModelElementId(modelElementId); @@ -163,7 +163,7 @@ public class OperationalPolicyReq { * @throws BuilderException * @throws UnsupportedEncodingException */ - protected static String formatOpenLoopYaml(RefProp refProp, ModelProperties prop, String modelElementId, + protected static String formatOpenLoopYaml(CldsReferenceProperties refProp, ModelProperties prop, String modelElementId, PolicyChain policyChain) throws BuilderException, UnsupportedEncodingException { // get property objects Global global = prop.getGlobal(); @@ -193,7 +193,7 @@ public class OperationalPolicyReq { * @throws BuilderException * @throws UnsupportedEncodingException */ - protected static String formatYaml(RefProp refProp, ModelProperties prop, String modelElementId, + protected static String formatYaml(CldsReferenceProperties refProp, ModelProperties prop, String modelElementId, PolicyChain policyChain) throws BuilderException, UnsupportedEncodingException { // get property objects Global global = prop.getGlobal(); @@ -251,7 +251,7 @@ public class OperationalPolicyReq { * @throws BuilderException * @throws UnsupportedEncodingException */ - protected static String formateNodeBYaml(RefProp refProp, ModelProperties prop, String modelElementId, + protected static String formateNodeBYaml(CldsReferenceProperties refProp, ModelProperties prop, String modelElementId, PolicyChain policyChain) throws BuilderException, UnsupportedEncodingException { // get property objects Global global = prop.getGlobal(); @@ -329,7 +329,7 @@ public class OperationalPolicyReq { * @param inOrigList * @return */ - private static List<PolicyItem> addAOTSActorRecipe(RefProp refProp, String service, List<PolicyItem> inOrigList) { + private static List<PolicyItem> addAOTSActorRecipe(CldsReferenceProperties refProp, String service, List<PolicyItem> inOrigList) { List<PolicyItem> outList = new ArrayList<>(); try { PolicyItem policyItem = inOrigList.get(0); diff --git a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java index 046003309..ee78b45f8 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java +++ b/src/main/java/org/onap/clamp/clds/client/req/policy/PolicyClient.java @@ -37,9 +37,9 @@ import java.util.UUID; import javax.ws.rs.BadRequestException; +import org.onap.clamp.clds.config.CldsReferenceProperties; import org.onap.clamp.clds.exception.policy.PolicyClientException; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.refprop.RefProp; +import org.onap.clamp.clds.model.properties.ModelProperties; import org.onap.clamp.clds.util.LoggingUtils; import org.onap.policy.api.AttributeType; import org.onap.policy.api.ConfigRequestParameters; @@ -76,7 +76,7 @@ public class PolicyClient { @Autowired protected ApplicationContext appContext; @Autowired - protected RefProp refProp; + protected CldsReferenceProperties refProp; /** * Perform BRMS policy type. diff --git a/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java b/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java index 45dbf81fe..299ec1e9e 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java +++ b/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcCatalogServices.java @@ -58,20 +58,20 @@ import org.apache.commons.csv.CSVRecord; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHeaders;
+import org.onap.clamp.clds.config.CldsReferenceProperties;
import org.onap.clamp.clds.exception.SdcCommunicationException;
import org.onap.clamp.clds.model.CldsAlarmCondition;
-import org.onap.clamp.clds.model.CldsSdcArtifact;
-import org.onap.clamp.clds.model.CldsSdcResource;
-import org.onap.clamp.clds.model.CldsSdcResourceBasicInfo;
-import org.onap.clamp.clds.model.CldsSdcServiceDetail;
-import org.onap.clamp.clds.model.CldsSdcServiceInfo;
import org.onap.clamp.clds.model.CldsServiceData;
import org.onap.clamp.clds.model.CldsVfData;
import org.onap.clamp.clds.model.CldsVfKPIData;
import org.onap.clamp.clds.model.CldsVfcData;
-import org.onap.clamp.clds.model.prop.Global;
-import org.onap.clamp.clds.model.prop.ModelProperties;
-import org.onap.clamp.clds.model.refprop.RefProp;
+import org.onap.clamp.clds.model.properties.Global;
+import org.onap.clamp.clds.model.properties.ModelProperties;
+import org.onap.clamp.clds.model.sdc.SdcArtifact;
+import org.onap.clamp.clds.model.sdc.SdcResource;
+import org.onap.clamp.clds.model.sdc.SdcResourceBasicInfo;
+import org.onap.clamp.clds.model.sdc.SdcServiceDetail;
+import org.onap.clamp.clds.model.sdc.SdcServiceInfo;
import org.onap.clamp.clds.util.CryptoUtils;
import org.onap.clamp.clds.util.LoggingUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -93,7 +93,7 @@ public class SdcCatalogServices { private static final String SDC_INSTANCE_ID_CLAMP = "CLAMP-Tool";
private static final String RESOURCE_URL_PREFIX = "resources";
@Autowired
- private RefProp refProp;
+ private CldsReferenceProperties refProp;
/**
* Return SDC id and pw as a HTTP Basic Auth string (for example: Basic
@@ -165,8 +165,8 @@ public class SdcCatalogServices { * A list of CldsSdcServiceInfo
* @return A list of CldsSdcServiceInfo without duplicate service UUID
*/
- public List<CldsSdcServiceInfo> removeDuplicateServices(List<CldsSdcServiceInfo> rawCldsSdcServiceList) {
- List<CldsSdcServiceInfo> cldsSdcServiceInfoList = null;
+ public List<SdcServiceInfo> removeDuplicateServices(List<SdcServiceInfo> rawCldsSdcServiceList) {
+ List<SdcServiceInfo> cldsSdcServiceInfoList = null;
if (rawCldsSdcServiceList != null && !rawCldsSdcServiceList.isEmpty()) {
// sort list
Collections.sort(rawCldsSdcServiceList);
@@ -176,7 +176,7 @@ public class SdcCatalogServices { for (int i = 1; i < rawCldsSdcServiceList.size(); i++) {
// compare name with previous - if not equal, then keep the
// previous (it's the last with that name)
- CldsSdcServiceInfo prev = rawCldsSdcServiceList.get(i - 1);
+ SdcServiceInfo prev = rawCldsSdcServiceList.get(i - 1);
if (!rawCldsSdcServiceList.get(i).getName().equals(prev.getName())) {
cldsSdcServiceInfoList.add(prev);
}
@@ -193,8 +193,8 @@ public class SdcCatalogServices { * @param rawCldsSdcResourceList
* @return List of CldsSdcResource
*/
- public List<CldsSdcResource> removeDuplicateSdcResourceInstances(List<CldsSdcResource> rawCldsSdcResourceList) {
- List<CldsSdcResource> cldsSdcResourceList = null;
+ public List<SdcResource> removeDuplicateSdcResourceInstances(List<SdcResource> rawCldsSdcResourceList) {
+ List<SdcResource> cldsSdcResourceList = null;
if (rawCldsSdcResourceList != null && !rawCldsSdcResourceList.isEmpty()) {
// sort list
Collections.sort(rawCldsSdcResourceList);
@@ -204,7 +204,7 @@ public class SdcCatalogServices { for (int i = 1; i < rawCldsSdcResourceList.size(); i++) {
// compare name with previous - if not equal, then keep the
// previous (it's the last with that name)
- CldsSdcResource prev = rawCldsSdcResourceList.get(i - 1);
+ SdcResource prev = rawCldsSdcResourceList.get(i - 1);
if (!rawCldsSdcResourceList.get(i).getResourceInstanceName().equals(prev.getResourceInstanceName())) {
cldsSdcResourceList.add(prev);
}
@@ -221,9 +221,9 @@ public class SdcCatalogServices { * @param rawCldsSdcResourceListBasicList
* @return List of CldsSdcResourceBasicInfo
*/
- public List<CldsSdcResourceBasicInfo> removeDuplicateSdcResourceBasicInfo(
- List<CldsSdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {
- List<CldsSdcResourceBasicInfo> cldsSdcResourceBasicInfoList = null;
+ public List<SdcResourceBasicInfo> removeDuplicateSdcResourceBasicInfo(
+ List<SdcResourceBasicInfo> rawCldsSdcResourceListBasicList) {
+ List<SdcResourceBasicInfo> cldsSdcResourceBasicInfoList = null;
if (rawCldsSdcResourceListBasicList != null && !rawCldsSdcResourceListBasicList.isEmpty()) {
// sort list
Collections.sort(rawCldsSdcResourceListBasicList);
@@ -233,7 +233,7 @@ public class SdcCatalogServices { for (int i = 1; i < rawCldsSdcResourceListBasicList.size(); i++) {
// compare name with previous - if not equal, then keep the
// previous (it's the last with that name)
- CldsSdcResourceBasicInfo prev = rawCldsSdcResourceListBasicList.get(i - 1);
+ SdcResourceBasicInfo prev = rawCldsSdcResourceListBasicList.get(i - 1);
if (!rawCldsSdcResourceListBasicList.get(i).getName().equals(prev.getName())) {
cldsSdcResourceBasicInfoList.add(prev);
}
@@ -260,10 +260,10 @@ public class SdcCatalogServices { throws GeneralSecurityException, DecoderException {
String serviceUuid = "";
String responseStr = getSdcServicesInformation(null);
- List<CldsSdcServiceInfo> rawCldsSdcServicesList = getCldsSdcServicesListFromJson(responseStr);
- List<CldsSdcServiceInfo> cldsSdcServicesList = removeDuplicateServices(rawCldsSdcServicesList);
+ List<SdcServiceInfo> rawCldsSdcServicesList = getCldsSdcServicesListFromJson(responseStr);
+ List<SdcServiceInfo> cldsSdcServicesList = removeDuplicateServices(rawCldsSdcServicesList);
if (cldsSdcServicesList != null && !cldsSdcServicesList.isEmpty()) {
- for (CldsSdcServiceInfo currCldsSdcServiceInfo : cldsSdcServicesList) {
+ for (SdcServiceInfo currCldsSdcServiceInfo : cldsSdcServicesList) {
if (currCldsSdcServiceInfo != null && currCldsSdcServiceInfo.getInvariantUUID() != null
&& currCldsSdcServiceInfo.getInvariantUUID().equalsIgnoreCase(invariantId)) {
serviceUuid = currCldsSdcServiceInfo.getUuid();
@@ -282,14 +282,14 @@ public class SdcCatalogServices { * @return The list of CldsSdcServiceInfo, if there is a failure it return
* an empty list
*/
- private List<CldsSdcServiceInfo> getCldsSdcServicesListFromJson(String jsonStr) {
+ private List<SdcServiceInfo> getCldsSdcServicesListFromJson(String jsonStr) {
ObjectMapper objectMapper = new ObjectMapper();
if (StringUtils.isBlank(jsonStr)) {
return new ArrayList<>();
}
try {
return objectMapper.readValue(jsonStr,
- objectMapper.getTypeFactory().constructCollectionType(List.class, CldsSdcServiceInfo.class));
+ objectMapper.getTypeFactory().constructCollectionType(List.class, SdcServiceInfo.class));
} catch (IOException e) {
logger.error("Error when attempting to decode the JSON containing CldsSdcServiceInfo", e);
return new ArrayList<>();
@@ -304,14 +304,14 @@ public class SdcCatalogServices { * @return The list of CldsSdcResourceBasicInfo, an empty list in case of
* issues
*/
- private List<CldsSdcResourceBasicInfo> getAllSdcResourcesListFromJson(String jsonStr) {
+ private List<SdcResourceBasicInfo> getAllSdcResourcesListFromJson(String jsonStr) {
ObjectMapper objectMapper = new ObjectMapper();
if (StringUtils.isBlank(jsonStr)) {
return new ArrayList<>();
}
try {
return objectMapper.readValue(jsonStr,
- objectMapper.getTypeFactory().constructCollectionType(List.class, CldsSdcResourceBasicInfo.class));
+ objectMapper.getTypeFactory().constructCollectionType(List.class, SdcResourceBasicInfo.class));
} catch (IOException e) {
logger.error("Exception occurred when attempting to decode the list of CldsSdcResourceBasicInfo JSON", e);
return new ArrayList<>();
@@ -324,10 +324,10 @@ public class SdcCatalogServices { * @param jsonStr
* @return
*/
- public CldsSdcServiceDetail getCldsSdcServiceDetailFromJson(String jsonStr) {
+ public SdcServiceDetail decodeCldsSdcServiceDetailFromJson(String jsonStr) {
ObjectMapper objectMapper = new ObjectMapper();
try {
- return objectMapper.readValue(jsonStr, CldsSdcServiceDetail.class);
+ return objectMapper.readValue(jsonStr, SdcServiceDetail.class);
} catch (IOException e) {
logger.error("Exception when attempting to decode the CldsSdcServiceDetail JSON", e);
return null;
@@ -472,9 +472,9 @@ public class SdcCatalogServices { ObjectMapper objectMapper = new ObjectMapper();
CldsServiceData cldsServiceData = new CldsServiceData();
if (responseStr != null) {
- CldsSdcServiceDetail cldsSdcServiceDetail;
+ SdcServiceDetail cldsSdcServiceDetail;
try {
- cldsSdcServiceDetail = objectMapper.readValue(responseStr, CldsSdcServiceDetail.class);
+ cldsSdcServiceDetail = objectMapper.readValue(responseStr, SdcServiceDetail.class);
} catch (IOException e) {
logger.error("Exception when decoding the CldsServiceData JSON from SDC", e);
throw new SdcCommunicationException("Exception when decoding the CldsServiceData JSON from SDC", e);
@@ -484,11 +484,11 @@ public class SdcCatalogServices { if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getResources() != null) {
cldsServiceData.setServiceUUID(cldsSdcServiceDetail.getUuid());
cldsServiceData.setServiceInvariantUUID(cldsSdcServiceDetail.getInvariantUUID());
- List<CldsSdcResource> cldsSdcResourceList = removeDuplicateSdcResourceInstances(
+ List<SdcResource> cldsSdcResourceList = removeDuplicateSdcResourceInstances(
cldsSdcServiceDetail.getResources());
if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) {
List<CldsVfData> cldsVfDataList = new ArrayList<>();
- for (CldsSdcResource currCldsSdcResource : cldsSdcResourceList) {
+ for (SdcResource currCldsSdcResource : cldsSdcResourceList) {
if (currCldsSdcResource != null && currCldsSdcResource.getResoucreType() != null
&& "VF".equalsIgnoreCase(currCldsSdcResource.getResoucreType())) {
CldsVfData currCldsVfData = new CldsVfData();
@@ -511,9 +511,8 @@ public class SdcCatalogServices { throws GeneralSecurityException {
// todo : refact this..
if (cldsVfDataList != null && !cldsVfDataList.isEmpty()) {
- List<CldsSdcResourceBasicInfo> allVfResources = getAllSdcVForVfcResourcesBasedOnResourceType(
- RESOURCE_VF_TYPE);
- List<CldsSdcResourceBasicInfo> allVfcResources = getAllSdcVForVfcResourcesBasedOnResourceType(
+ List<SdcResourceBasicInfo> allVfResources = getAllSdcVForVfcResourcesBasedOnResourceType(RESOURCE_VF_TYPE);
+ List<SdcResourceBasicInfo> allVfcResources = getAllSdcVForVfcResourcesBasedOnResourceType(
RESOURCE_VFC_TYPE);
allVfcResources.addAll(getAllSdcVForVfcResourcesBasedOnResourceType(RESOURCE_CVFC_TYPE));
for (CldsVfData currCldsVfData : cldsVfDataList) {
@@ -1128,18 +1127,18 @@ public class SdcCatalogServices { * The artifact name that will be searched
* @return The artifact UUID found
*/
- public String getArtifactIdIfArtifactAlreadyExists(CldsSdcServiceDetail cldsSdcServiceDetail, String artifactName) {
+ public String getArtifactIdIfArtifactAlreadyExists(SdcServiceDetail cldsSdcServiceDetail, String artifactName) {
String artifactUuid = null;
boolean artifactExists = false;
if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getResources() != null
&& !cldsSdcServiceDetail.getResources().isEmpty()) {
- for (CldsSdcResource currCldsSdcResource : cldsSdcServiceDetail.getResources()) {
+ for (SdcResource currCldsSdcResource : cldsSdcServiceDetail.getResources()) {
if (artifactExists) {
break;
}
if (currCldsSdcResource != null && currCldsSdcResource.getArtifacts() != null
&& !currCldsSdcResource.getArtifacts().isEmpty()) {
- for (CldsSdcArtifact currCldsSdcArtifact : currCldsSdcResource.getArtifacts()) {
+ for (SdcArtifact currCldsSdcArtifact : currCldsSdcResource.getArtifacts()) {
if (currCldsSdcArtifact != null && currCldsSdcArtifact.getArtifactName() != null
&& currCldsSdcArtifact.getArtifactName().equalsIgnoreCase(artifactName)) {
artifactUuid = currCldsSdcArtifact.getArtifactUUID();
@@ -1154,7 +1153,7 @@ public class SdcCatalogServices { }
// To get all sdc VF/VFC Resources basic info.
- private List<CldsSdcResourceBasicInfo> getAllSdcVForVfcResourcesBasedOnResourceType(String resourceType) {
+ private List<SdcResourceBasicInfo> getAllSdcVForVfcResourcesBasedOnResourceType(String resourceType) {
String catalogUrl = refProp.getStringValue(SDC_CATALOG_URL_PROPERTY_NAME);
String resourceUrl = catalogUrl + "resources?resourceType=" + resourceType;
String allSdcVfcResources = getCldsServicesOrResourcesBasedOnURL(resourceUrl);
@@ -1162,10 +1161,10 @@ public class SdcCatalogServices { }
private String getResourceUuidFromResourceInvariantUuid(String resourceInvariantUuid,
- List<CldsSdcResourceBasicInfo> resourceInfoList) {
+ List<SdcResourceBasicInfo> resourceInfoList) {
String resourceUuid = null;
if (resourceInfoList != null && !resourceInfoList.isEmpty()) {
- for (CldsSdcResourceBasicInfo currResource : resourceInfoList) {
+ for (SdcResourceBasicInfo currResource : resourceInfoList) {
if (currResource != null && currResource.getInvariantUUID() != null && currResource.getUuid() != null
&& currResource.getInvariantUUID().equalsIgnoreCase(resourceInvariantUuid)) {
resourceUuid = currResource.getUuid();
@@ -1220,7 +1219,7 @@ public class SdcCatalogServices { String originalServiceUuid = getServiceUuidFromServiceInvariantId(serviceInvariantUuid);
logger.info("ServiceUUID used before upload in url:" + originalServiceUuid);
String sdcServicesInformation = getSdcServicesInformation(originalServiceUuid);
- CldsSdcServiceDetail cldsSdcServiceDetail = getCldsSdcServiceDetailFromJson(sdcServicesInformation);
+ SdcServiceDetail cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);
String uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,
artifactName);
// Upload artifacts to sdc
@@ -1233,7 +1232,7 @@ public class SdcCatalogServices { }
logger.info("ServiceUUID used after upload in ulr:" + updatedServiceUuid);
sdcServicesInformation = getSdcServicesInformation(updatedServiceUuid);
- cldsSdcServiceDetail = getCldsSdcServiceDetailFromJson(sdcServicesInformation);
+ cldsSdcServiceDetail = decodeCldsSdcServiceDetailFromJson(sdcServicesInformation);
uploadedArtifactUuid = getArtifactIdIfArtifactAlreadyExists(cldsSdcServiceDetail,
locationArtifactName);
// To send location information also to sdc
diff --git a/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcReq.java b/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcRequests.java index 3fb53a3b6..214933d49 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcReq.java +++ b/src/main/java/org/onap/clamp/clds/client/req/sdc/SdcRequests.java @@ -41,12 +41,12 @@ import java.util.Map.Entry; import org.apache.commons.codec.DecoderException; import org.onap.clamp.clds.client.req.tca.TcaRequestFormatter; -import org.onap.clamp.clds.model.CldsSdcResource; -import org.onap.clamp.clds.model.CldsSdcServiceDetail; -import org.onap.clamp.clds.model.prop.Global; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.prop.Tca; -import org.onap.clamp.clds.model.refprop.RefProp; +import org.onap.clamp.clds.config.CldsReferenceProperties; +import org.onap.clamp.clds.model.properties.Global; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.properties.Tca; +import org.onap.clamp.clds.model.sdc.SdcResource; +import org.onap.clamp.clds.model.sdc.SdcServiceDetail; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -54,14 +54,14 @@ import org.springframework.stereotype.Component; * Construct a Sdc request given CLDS objects. */ @Component -public class SdcReq { +public class SdcRequests { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcReq.class); + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcRequests.class); protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); @Autowired private SdcCatalogServices sdcCatalogServices; @Autowired - protected RefProp refProp; + protected CldsReferenceProperties refProp; /** * Format the Blueprint from a Yaml @@ -132,48 +132,48 @@ public class SdcReq { + "} \n"; } + private List<String> filterVfResourceList(String serviceUuid, List<SdcResource> sdcResourcesList, + List<String> cldsResourceVfList) { + List<String> urlList = new ArrayList<>(); + for (SdcResource cldsSdcResource : sdcResourcesList) { + if (cldsSdcResource != null && cldsSdcResource.getResoucreType() != null + && cldsSdcResource.getResoucreType().equalsIgnoreCase("VF") + && cldsResourceVfList.contains(cldsSdcResource.getResourceInvariantUUID())) { + String normalizedResourceInstanceName = normalizeResourceInstanceName( + cldsSdcResource.getResourceInstanceName()); + String svcUrl = createUrlForResource(normalizedResourceInstanceName, serviceUuid); + urlList.add(svcUrl); + } + } + return urlList; + } + + private String createUrlForResource(String normalizedResourceInstanceName, String serviceUuid) { + return refProp.getStringValue("sdc.serviceUrl") + "/" + serviceUuid + "/resourceInstances/" + + normalizedResourceInstanceName + "/artifacts"; + } + /** * To get List of urls for all vfresources * * @param prop * The model properties JSON describing the closed loop flow - * @param baseUrl - * The URL to trigger * @return A list of Service URL * @throws GeneralSecurityException * In case of issues when decrypting the password * @throws DecoderException * In case of issues when decoding the Hex String */ - public List<String> getSdcReqUrlsList(ModelProperties prop, String baseUrl) - throws GeneralSecurityException, DecoderException { + public List<String> getSdcReqUrlsList(ModelProperties prop) throws GeneralSecurityException, DecoderException { List<String> urlList = new ArrayList<>(); Global globalProps = prop.getGlobal(); - if (globalProps != null && globalProps.getService() != null) { - String serviceInvariantUUID = globalProps.getService(); - List<String> resourceVfList = globalProps.getResourceVf(); - String serviceUUID = sdcCatalogServices.getServiceUuidFromServiceInvariantId(serviceInvariantUUID); - CldsSdcServiceDetail cldsSdcServiceDetail = sdcCatalogServices - .getCldsSdcServiceDetailFromJson(sdcCatalogServices.getSdcServicesInformation(serviceUUID)); - if (cldsSdcServiceDetail != null && resourceVfList != null) { - List<CldsSdcResource> cldsSdcResourcesList = cldsSdcServiceDetail.getResources(); - if (cldsSdcResourcesList != null && !cldsSdcResourcesList.isEmpty()) { - for (CldsSdcResource cldsSdcResource : cldsSdcResourcesList) { - if (cldsSdcResource != null && cldsSdcResource.getResoucreType() != null - && cldsSdcResource.getResoucreType().equalsIgnoreCase("VF") - && resourceVfList.contains(cldsSdcResource.getResourceInvariantUUID())) { - String normalizedResourceInstanceName = normalizeResourceInstanceName( - cldsSdcResource.getResourceInstanceName()); - String svcUrl = baseUrl + "/" + serviceUUID + "/resourceInstances/" - + normalizedResourceInstanceName + "/artifacts"; - urlList.add(svcUrl); - } else { - logger.warn("The VF Resource invariant UUID (" + cldsSdcResource.getResourceInvariantUUID() - + ") has not been found in the Service (Invariant ID:" + serviceInvariantUUID - + ")VF resource list"); - } - } - } + if (globalProps != null && globalProps.getService() != null && globalProps.getResourceVf() != null) { + String serviceUuid = sdcCatalogServices.getServiceUuidFromServiceInvariantId(globalProps.getService()); + SdcServiceDetail sdcServiceDetail = sdcCatalogServices + .decodeCldsSdcServiceDetailFromJson(sdcCatalogServices.getSdcServicesInformation(serviceUuid)); + if (sdcServiceDetail != null) { + urlList = filterVfResourceList(serviceUuid, sdcServiceDetail.getResources(), + globalProps.getResourceVf()); } } else { logger.warn("GlobalProperties json is empty, skipping getSdcReqUrlsList and returning empty list"); diff --git a/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java b/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java index f13f42220..73355a7a4 100644 --- a/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java +++ b/src/main/java/org/onap/clamp/clds/client/req/tca/TcaRequestFormatter.java @@ -32,12 +32,12 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.IOException; import java.util.Map; +import org.onap.clamp.clds.config.CldsReferenceProperties; import org.onap.clamp.clds.exception.TcaRequestFormatterException; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.prop.Tca; -import org.onap.clamp.clds.model.prop.TcaItem; -import org.onap.clamp.clds.model.prop.TcaThreshold; -import org.onap.clamp.clds.model.refprop.RefProp; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.properties.Tca; +import org.onap.clamp.clds.model.properties.TcaItem; +import org.onap.clamp.clds.model.properties.TcaThreshold; import org.yaml.snakeyaml.Yaml; /** @@ -64,7 +64,7 @@ public class TcaRequestFormatter { * The Model Prop created from BPMN JSON and BPMN properties JSON * @return The Json string containing that should be sent to policy */ - public static String createPolicyJson(RefProp refProp, ModelProperties modelProperties) { + public static String createPolicyJson(CldsReferenceProperties refProp, ModelProperties modelProperties) { try { String service = modelProperties.getGlobal().getService(); Tca tca = modelProperties.getType(Tca.class); @@ -103,7 +103,7 @@ public class TcaRequestFormatter { * modelProperties.setCurrentModelElementId will be used * @return The Json node containing what should be sent to policy */ - public static JsonNode createPolicyContent(RefProp refProp, ModelProperties modelProperties, String service, + public static JsonNode createPolicyContent(CldsReferenceProperties refProp, ModelProperties modelProperties, String service, String policyName, Tca tca) { try { String serviceToUse = service; @@ -153,7 +153,7 @@ public class TcaRequestFormatter { * The Model Properties created from BPMN JSON and BPMN * properties JSON */ - private static void addThresholds(RefProp refProp, String service, ObjectNode appendToNode, TcaItem tcaItem, + private static void addThresholds(CldsReferenceProperties refProp, String service, ObjectNode appendToNode, TcaItem tcaItem, ModelProperties modelProperties) { ArrayNode tcaNodes = appendToNode.withArray("thresholds"); ObjectNode tcaNode; @@ -185,7 +185,7 @@ public class TcaRequestFormatter { * The yaml string received from the UI * @return The updated YAML as a string */ - public static String updatedBlueprintWithConfiguration(RefProp refProp, ModelProperties modelProperties, + public static String updatedBlueprintWithConfiguration(CldsReferenceProperties refProp, ModelProperties modelProperties, String yamlValue) { String jsonPolicy = ((ObjectNode) createPolicyContent(refProp, modelProperties, null, null, null)).toString(); logger.info("Yaml that will be updated:" + yamlValue); diff --git a/src/main/java/org/onap/clamp/clds/model/refprop/RefProp.java b/src/main/java/org/onap/clamp/clds/config/CldsReferenceProperties.java index f0cf71c1e..a8acdee14 100644 --- a/src/main/java/org/onap/clamp/clds/model/refprop/RefProp.java +++ b/src/main/java/org/onap/clamp/clds/config/CldsReferenceProperties.java @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.refprop; +package org.onap.clamp.clds.config; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -41,7 +41,7 @@ import org.springframework.stereotype.Component; * Holds reference properties. */ @Component -public class RefProp { +public class CldsReferenceProperties { @Autowired private ApplicationContext appContext; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/AbstractModelElement.java b/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java index a0685228b..9b8d9d9ce 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/AbstractModelElement.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/AbstractModelElement.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/Global.java b/src/main/java/org/onap/clamp/clds/model/properties/Global.java index 48c2fd9fb..ef36fef91 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/Global.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/Global.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import java.util.List; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/Holmes.java b/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java index bd47e8d78..db07cac4f 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/Holmes.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/Holmes.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.fasterxml.jackson.databind.JsonNode; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/ModelBpmn.java b/src/main/java/org/onap/clamp/clds/model/properties/ModelBpmn.java index 9738396a9..2b86b3fdc 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/ModelBpmn.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/ModelBpmn.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/ModelBpmnEntry.java b/src/main/java/org/onap/clamp/clds/model/properties/ModelBpmnEntry.java index dc6682297..81cc48d63 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/ModelBpmnEntry.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/ModelBpmnEntry.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/ModelProperties.java b/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java index dca93e46d..f9b1c25a4 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/ModelProperties.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/ModelProperties.java @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/Policy.java b/src/main/java/org/onap/clamp/clds/model/properties/Policy.java index 80d12aaba..438936f75 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/Policy.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/Policy.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/PolicyChain.java b/src/main/java/org/onap/clamp/clds/model/properties/PolicyChain.java index 217f7fd2d..dddd73506 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/PolicyChain.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/PolicyChain.java @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/PolicyItem.java b/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java index 5fc829835..d1c1906a2 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/PolicyItem.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/PolicyItem.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/ResourceGroup.java b/src/main/java/org/onap/clamp/clds/model/properties/ResourceGroup.java index 8b2dbeb83..d3280876a 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/ResourceGroup.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/ResourceGroup.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/ServiceConfiguration.java b/src/main/java/org/onap/clamp/clds/model/properties/ServiceConfiguration.java index 418afbb9f..4b80ac68a 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/ServiceConfiguration.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/ServiceConfiguration.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import java.util.HashMap; import java.util.Iterator; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/Tca.java b/src/main/java/org/onap/clamp/clds/model/properties/Tca.java index 4fd6b595d..90a8a1ab4 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/Tca.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/Tca.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/TcaItem.java b/src/main/java/org/onap/clamp/clds/model/properties/TcaItem.java index 13bff0024..299143c72 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/TcaItem.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/TcaItem.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/main/java/org/onap/clamp/clds/model/prop/TcaThreshold.java b/src/main/java/org/onap/clamp/clds/model/properties/TcaThreshold.java index d278c254f..6cd13f2ee 100644 --- a/src/main/java/org/onap/clamp/clds/model/prop/TcaThreshold.java +++ b/src/main/java/org/onap/clamp/clds/model/properties/TcaThreshold.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model.prop; +package org.onap.clamp.clds.model.properties; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; diff --git a/src/main/java/org/onap/clamp/clds/model/CldsSdcArtifact.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcArtifact.java index 48f90170c..0f7b391f6 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsSdcArtifact.java +++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcArtifact.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,12 +21,12 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model; +package org.onap.clamp.clds.model.sdc; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) -public class CldsSdcArtifact { +public class SdcArtifact { private String artifactName; private String artifactType; diff --git a/src/main/java/org/onap/clamp/clds/model/CldsSdcResource.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java index 9c47f450c..9717d7c8e 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsSdcResource.java +++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResource.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights * reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model; +package org.onap.clamp.clds.model.sdc; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; @@ -31,18 +31,18 @@ import java.math.BigDecimal; import java.util.List; @JsonIgnoreProperties(ignoreUnknown = true) -public class CldsSdcResource implements Comparable<CldsSdcResource> { +public class SdcResource implements Comparable<SdcResource> { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsSdcResource.class); + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcResource.class); protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); private String resourceInstanceName; private String resourceName; - private String resourceInvariantUuid; + private String resourceInvariantUUID; private String resourceVersion; private String resoucreType; private String resourceUuid; - private List<CldsSdcArtifact> artifacts; + private List<SdcArtifact> artifacts; public String getResourceInstanceName() { return resourceInstanceName; @@ -61,11 +61,11 @@ public class CldsSdcResource implements Comparable<CldsSdcResource> { } public String getResourceInvariantUUID() { - return resourceInvariantUuid; + return resourceInvariantUUID; } - public void setResourceInvariantUUID(String resourceInvariantUUID) { - this.resourceInvariantUuid = resourceInvariantUUID; + public void setResourceInvariantUUID(String resourceInvUuid) { + this.resourceInvariantUUID = resourceInvUuid; } public String getResourceVersion() { @@ -92,16 +92,16 @@ public class CldsSdcResource implements Comparable<CldsSdcResource> { this.resourceUuid = resourceUUID; } - public List<CldsSdcArtifact> getArtifacts() { + public List<SdcArtifact> getArtifacts() { return artifacts; } - public void setArtifacts(List<CldsSdcArtifact> artifacts) { + public void setArtifacts(List<SdcArtifact> artifacts) { this.artifacts = artifacts; } @Override - public int compareTo(CldsSdcResource in) { + public int compareTo(SdcResource in) { // Compares this object with the specified object for order. // Returns a negative integer, zero, or a positive integer as this // object is less than, equal to, or greater than the specified object. @@ -134,7 +134,7 @@ public class CldsSdcResource implements Comparable<CldsSdcResource> { return false; if (getClass() != obj.getClass()) return false; - CldsSdcResource other = (CldsSdcResource) obj; + SdcResource other = (SdcResource) obj; if (resourceInstanceName == null) { if (other.resourceInstanceName != null) return false; diff --git a/src/main/java/org/onap/clamp/clds/model/CldsSdcResourceBasicInfo.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java index f91e36a81..3a60f6dcc 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsSdcResourceBasicInfo.java +++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcResourceBasicInfo.java @@ -21,7 +21,7 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model; +package org.onap.clamp.clds.model.sdc; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; @@ -30,10 +30,10 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import java.math.BigDecimal; @JsonIgnoreProperties(ignoreUnknown = true) -public class CldsSdcResourceBasicInfo implements Comparable<CldsSdcResourceBasicInfo> { +public class SdcResourceBasicInfo implements Comparable<SdcResourceBasicInfo> { protected static final EELFLogger logger = EELFManager.getInstance() - .getLogger(CldsSdcResourceBasicInfo.class); + .getLogger(SdcResourceBasicInfo.class); protected static final EELFLogger metricsLogger = EELFManager.getInstance().getMetricsLogger(); private String uuid; @@ -48,7 +48,7 @@ public class CldsSdcResourceBasicInfo implements Comparable<CldsSdcResourceBasic private String lastUpdaterUserId; @Override - public int compareTo(CldsSdcResourceBasicInfo in) { + public int compareTo(SdcResourceBasicInfo in) { // Compares this object with the specified object for order. // Returns a negative integer, zero, or a positive integer as this // object is less than, equal to, or greater than the specified object. @@ -80,7 +80,7 @@ public class CldsSdcResourceBasicInfo implements Comparable<CldsSdcResourceBasic return false; if (getClass() != obj.getClass()) return false; - CldsSdcResourceBasicInfo other = (CldsSdcResourceBasicInfo) obj; + SdcResourceBasicInfo other = (SdcResourceBasicInfo) obj; if (name == null) { if (other.name != null) return false; diff --git a/src/main/java/org/onap/clamp/clds/model/CldsSdcServiceDetail.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceDetail.java index 551418b79..8113ea546 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsSdcServiceDetail.java +++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceDetail.java @@ -21,14 +21,14 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model; +package org.onap.clamp.clds.model.sdc; import java.util.List; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; @JsonIgnoreProperties(ignoreUnknown = true) -public class CldsSdcServiceDetail { +public class SdcServiceDetail { private String uuid; private String invariantUUID; @@ -40,8 +40,8 @@ public class CldsSdcServiceDetail { private String lastUpdaterUserId; private String distributionStatus; private String lastUpdaterFullName; - private List<CldsSdcResource> resources; - private List<CldsSdcArtifact> artifacts; + private List<SdcResource> resources; + private List<SdcArtifact> artifacts; public String getUuid() { return uuid; @@ -123,19 +123,19 @@ public class CldsSdcServiceDetail { this.lastUpdaterFullName = lastUpdaterFullName; } - public List<CldsSdcResource> getResources() { + public List<SdcResource> getResources() { return resources; } - public void setResources(List<CldsSdcResource> resources) { + public void setResources(List<SdcResource> resources) { this.resources = resources; } - public List<CldsSdcArtifact> getArtifacts() { + public List<SdcArtifact> getArtifacts() { return artifacts; } - public void setArtifacts(List<CldsSdcArtifact> artifacts) { + public void setArtifacts(List<SdcArtifact> artifacts) { this.artifacts = artifacts; } diff --git a/src/main/java/org/onap/clamp/clds/model/CldsSdcServiceInfo.java b/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceInfo.java index cf447c5c7..c829726a3 100644 --- a/src/main/java/org/onap/clamp/clds/model/CldsSdcServiceInfo.java +++ b/src/main/java/org/onap/clamp/clds/model/sdc/SdcServiceInfo.java @@ -21,16 +21,16 @@ * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ -package org.onap.clamp.clds.model; +package org.onap.clamp.clds.model.sdc; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; import java.math.BigDecimal; -public class CldsSdcServiceInfo implements Comparable<CldsSdcServiceInfo> { +public class SdcServiceInfo implements Comparable<SdcServiceInfo> { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsSdcServiceInfo.class); + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(SdcServiceInfo.class); protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger(); private String uuid; @@ -119,7 +119,7 @@ public class CldsSdcServiceInfo implements Comparable<CldsSdcServiceInfo> { * Compare using name and then version. Version is converted to a decimal. */ @Override - public int compareTo(CldsSdcServiceInfo in) { + public int compareTo(SdcServiceInfo in) { // Compares this object with the specified object for order. // Returns a negative integer, zero, or a positive integer as this // object is less than, equal to, or greater than the specified object. @@ -152,7 +152,7 @@ public class CldsSdcServiceInfo implements Comparable<CldsSdcServiceInfo> { return false; if (getClass() != obj.getClass()) return false; - CldsSdcServiceInfo other = (CldsSdcServiceInfo) obj; + SdcServiceInfo other = (SdcServiceInfo) obj; if (name == null) { if (other.name != null) return false; diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java index a139de115..14e65627f 100644 --- a/src/main/java/org/onap/clamp/clds/service/CldsService.java +++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java @@ -64,6 +64,7 @@ import org.onap.clamp.clds.camel.CamelProxy; import org.onap.clamp.clds.client.DcaeDispatcherServices; import org.onap.clamp.clds.client.DcaeInventoryServices; import org.onap.clamp.clds.client.req.sdc.SdcCatalogServices; +import org.onap.clamp.clds.config.CldsReferenceProperties; import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.exception.CldsConfigException; import org.onap.clamp.clds.exception.SdcCommunicationException; @@ -75,16 +76,15 @@ import org.onap.clamp.clds.model.CldsHealthCheck; import org.onap.clamp.clds.model.CldsInfo; import org.onap.clamp.clds.model.CldsModel; import org.onap.clamp.clds.model.CldsModelProp; -import org.onap.clamp.clds.model.CldsSdcResource; -import org.onap.clamp.clds.model.CldsSdcServiceDetail; -import org.onap.clamp.clds.model.CldsSdcServiceInfo; import org.onap.clamp.clds.model.CldsServiceData; import org.onap.clamp.clds.model.CldsTemplate; import org.onap.clamp.clds.model.DcaeEvent; import org.onap.clamp.clds.model.ValueItem; -import org.onap.clamp.clds.model.prop.AbstractModelElement; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.refprop.RefProp; +import org.onap.clamp.clds.model.properties.AbstractModelElement; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.sdc.SdcResource; +import org.onap.clamp.clds.model.sdc.SdcServiceDetail; +import org.onap.clamp.clds.model.sdc.SdcServiceInfo; import org.onap.clamp.clds.transform.XslTransformer; import org.onap.clamp.clds.util.LoggingUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -142,7 +142,7 @@ public class CldsService extends SecureServiceBase { @Autowired private XslTransformer cldsBpmnTransformer; @Autowired - private RefProp refProp; + private CldsReferenceProperties refProp; @Autowired private SdcCatalogServices sdcCatalogServices; @Autowired @@ -680,14 +680,14 @@ public class CldsService extends SecureServiceBase { return ""; } ObjectMapper objectMapper = new ObjectMapper(); - List<CldsSdcServiceInfo> rawList = objectMapper.readValue(responseStr, - objectMapper.getTypeFactory().constructCollectionType(List.class, CldsSdcServiceInfo.class)); + List<SdcServiceInfo> rawList = objectMapper.readValue(responseStr, + objectMapper.getTypeFactory().constructCollectionType(List.class, SdcServiceInfo.class)); ObjectNode invariantIdServiceNode = objectMapper.createObjectNode(); ObjectNode serviceNode = objectMapper.createObjectNode(); logger.info("value of cldsserviceiNfolist: {}", rawList); if (rawList != null && !rawList.isEmpty()) { - List<CldsSdcServiceInfo> cldsSdcServiceInfoList = sdcCatalogServices.removeDuplicateServices(rawList); - for (CldsSdcServiceInfo currCldsSdcServiceInfo : cldsSdcServiceInfoList) { + List<SdcServiceInfo> cldsSdcServiceInfoList = sdcCatalogServices.removeDuplicateServices(rawList); + for (SdcServiceInfo currCldsSdcServiceInfo : cldsSdcServiceInfoList) { if (currCldsSdcServiceInfo != null) { invariantIdServiceNode.put(currCldsSdcServiceInfo.getInvariantUUID(), currCldsSdcServiceInfo.getName()); @@ -700,7 +700,7 @@ public class CldsService extends SecureServiceBase { private String createPropertiesObjectByUUID(String globalProps, String cldsResponseStr) throws IOException { ObjectMapper mapper = new ObjectMapper(); - CldsSdcServiceDetail cldsSdcServiceDetail = mapper.readValue(cldsResponseStr, CldsSdcServiceDetail.class); + SdcServiceDetail cldsSdcServiceDetail = mapper.readValue(cldsResponseStr, SdcServiceDetail.class); ObjectNode globalPropsJson = null; if (cldsSdcServiceDetail != null && cldsSdcServiceDetail.getUuid() != null) { /** @@ -745,18 +745,18 @@ public class CldsService extends SecureServiceBase { } private void createVfObjectNode(ObjectNode vfObjectNode2, ObjectMapper mapper, - List<CldsSdcResource> rawCldsSdcResourceList) { + List<SdcResource> rawCldsSdcResourceList) { ObjectNode vfNode = mapper.createObjectNode(); vfNode.put("", ""); // To remove repeated resource instance name from // resourceInstanceList - List<CldsSdcResource> cldsSdcResourceList = sdcCatalogServices + List<SdcResource> cldsSdcResourceList = sdcCatalogServices .removeDuplicateSdcResourceInstances(rawCldsSdcResourceList); /** * Creating vf resource node using cldsSdcResource Object */ if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) { - for (CldsSdcResource cldsSdcResource : cldsSdcResourceList) { + for (SdcResource cldsSdcResource : cldsSdcResourceList) { if (cldsSdcResource != null && "VF".equalsIgnoreCase(cldsSdcResource.getResoucreType())) { vfNode.put(cldsSdcResource.getResourceUUID(), cldsSdcResource.getResourceName()); } @@ -792,7 +792,7 @@ public class CldsService extends SecureServiceBase { vfObjectNode2.putPOJO("alarmCondition", alarmStringJsonNode); } - private ObjectNode createByVFCObjectNode(ObjectMapper mapper, List<CldsSdcResource> cldsSdcResourceList) { + private ObjectNode createByVFCObjectNode(ObjectMapper mapper, List<SdcResource> cldsSdcResourceList) { ObjectNode emptyObjectNode = mapper.createObjectNode(); ObjectNode emptyvfcobjectNode = mapper.createObjectNode(); ObjectNode vfCObjectNode = mapper.createObjectNode(); @@ -800,7 +800,7 @@ public class CldsService extends SecureServiceBase { ObjectNode subVfCObjectNode = mapper.createObjectNode(); subVfCObjectNode.putPOJO("vfc", emptyObjectNode); if (cldsSdcResourceList != null && !cldsSdcResourceList.isEmpty()) { - for (CldsSdcResource cldsSdcResource : cldsSdcResourceList) { + for (SdcResource cldsSdcResource : cldsSdcResourceList) { if (cldsSdcResource != null && "VF".equalsIgnoreCase(cldsSdcResource.getResoucreType())) { vfCObjectNode.putPOJO(cldsSdcResource.getResourceUUID(), subVfCObjectNode); } diff --git a/src/test/java/org/onap/clamp/clds/AbstractItCase.java b/src/test/java/org/onap/clamp/clds/AbstractItCase.java index 2903248b6..7e2908841 100644 --- a/src/test/java/org/onap/clamp/clds/AbstractItCase.java +++ b/src/test/java/org/onap/clamp/clds/AbstractItCase.java @@ -25,7 +25,7 @@ package org.onap.clamp.clds; import org.junit.BeforeClass; import org.onap.clamp.clds.client.req.policy.PolicyClient; -import org.onap.clamp.clds.model.refprop.RefProp; +import org.onap.clamp.clds.config.CldsReferenceProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ActiveProfiles; @@ -33,7 +33,7 @@ import org.springframework.test.context.ActiveProfiles; public abstract class AbstractItCase { @Autowired - protected RefProp refProp; + protected CldsReferenceProperties refProp; @Autowired protected PolicyClient policyClient; diff --git a/src/test/java/org/onap/clamp/clds/it/RefPropItCase.java b/src/test/java/org/onap/clamp/clds/it/CldsReferencePropertiesItCase.java index 8f76b1822..6c94fc16f 100644 --- a/src/test/java/org/onap/clamp/clds/it/RefPropItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/CldsReferencePropertiesItCase.java @@ -41,9 +41,9 @@ import org.springframework.test.context.junit4.SpringRunner; */ @RunWith(SpringRunner.class) @SpringBootTest -public class RefPropItCase extends AbstractItCase { +public class CldsReferencePropertiesItCase extends AbstractItCase { - protected static final EELFLogger logger = EELFManager.getInstance().getLogger(RefPropItCase.class); + protected static final EELFLogger logger = EELFManager.getInstance().getLogger(CldsReferencePropertiesItCase.class); /** * Test getting prop value as a JSON Node / template. diff --git a/src/test/java/org/onap/clamp/clds/it/HolmesPolicyDelegateItCase.java b/src/test/java/org/onap/clamp/clds/it/HolmesPolicyDelegateItCase.java index 6f5c24d5e..c530a059f 100644 --- a/src/test/java/org/onap/clamp/clds/it/HolmesPolicyDelegateItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/HolmesPolicyDelegateItCase.java @@ -31,8 +31,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.onap.clamp.clds.AbstractItCase; import org.onap.clamp.clds.client.HolmesPolicyDelegate; -import org.onap.clamp.clds.model.prop.Holmes; -import org.onap.clamp.clds.model.prop.ModelProperties; +import org.onap.clamp.clds.model.properties.Holmes; +import org.onap.clamp.clds.model.properties.ModelProperties; import org.onap.clamp.clds.util.ResourceFileUtil; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; diff --git a/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java b/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java index 9013e0c41..873b01922 100644 --- a/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/OperationPolicyReqItCase.java @@ -38,9 +38,9 @@ import org.junit.runner.RunWith; import org.onap.clamp.clds.AbstractItCase; import org.onap.clamp.clds.client.req.policy.OperationalPolicyReq; import org.onap.clamp.clds.model.CldsEvent; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.prop.Policy; -import org.onap.clamp.clds.model.prop.PolicyChain; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.properties.Policy; +import org.onap.clamp.clds.model.properties.PolicyChain; import org.onap.clamp.clds.util.ResourceFileUtil; import org.onap.policy.api.AttributeType; import org.onap.policy.controlloop.policy.builder.BuilderException; diff --git a/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java b/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java index 71bd2d521..0e8a21772 100644 --- a/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/PolicyClientItCase.java @@ -37,10 +37,10 @@ import org.onap.clamp.clds.AbstractItCase; import org.onap.clamp.clds.client.req.policy.OperationalPolicyReq; import org.onap.clamp.clds.client.req.tca.TcaRequestFormatter; import org.onap.clamp.clds.model.CldsEvent; -import org.onap.clamp.clds.model.prop.ModelProperties; -import org.onap.clamp.clds.model.prop.Policy; -import org.onap.clamp.clds.model.prop.PolicyChain; -import org.onap.clamp.clds.model.prop.Tca; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.properties.Policy; +import org.onap.clamp.clds.model.properties.PolicyChain; +import org.onap.clamp.clds.model.properties.Tca; import org.onap.clamp.clds.util.ResourceFileUtil; import org.onap.policy.api.AttributeType; import org.springframework.boot.test.context.SpringBootTest; diff --git a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java index 548212ef8..7f962215b 100644 --- a/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/SdcCatalogServicesItCase.java @@ -35,10 +35,10 @@ import org.mockito.Mockito; import org.onap.clamp.clds.AbstractItCase; import org.onap.clamp.clds.client.req.sdc.SdcCatalogServices; import org.onap.clamp.clds.model.CldsAlarmCondition; -import org.onap.clamp.clds.model.CldsSdcResource; -import org.onap.clamp.clds.model.CldsSdcResourceBasicInfo; -import org.onap.clamp.clds.model.CldsSdcServiceInfo; import org.onap.clamp.clds.model.CldsServiceData; +import org.onap.clamp.clds.model.sdc.SdcResource; +import org.onap.clamp.clds.model.sdc.SdcResourceBasicInfo; +import org.onap.clamp.clds.model.sdc.SdcServiceInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @@ -55,33 +55,33 @@ public class SdcCatalogServicesItCase extends AbstractItCase { @Test public void removeDuplicateServicesTest() { - CldsSdcServiceInfo service1a = new CldsSdcServiceInfo(); + SdcServiceInfo service1a = new SdcServiceInfo(); service1a.setName("service1"); service1a.setVersion("1.0"); service1a.setInvariantUUID("invariantUUID1.0"); - List<CldsSdcServiceInfo> rawCldsSdcServiceList = new LinkedList<>(); + List<SdcServiceInfo> rawCldsSdcServiceList = new LinkedList<>(); rawCldsSdcServiceList.add(service1a); rawCldsSdcServiceList.add(service1a); - CldsSdcServiceInfo service1b = new CldsSdcServiceInfo(); + SdcServiceInfo service1b = new SdcServiceInfo(); service1b.setName("service1"); service1b.setVersion("1.1"); service1b.setInvariantUUID("invariantUUID1.1"); rawCldsSdcServiceList.add(service1b); - CldsSdcServiceInfo service1c = new CldsSdcServiceInfo(); + SdcServiceInfo service1c = new SdcServiceInfo(); service1c.setName("service1"); service1c.setVersion("1.2"); service1c.setInvariantUUID("invariantUUID1.2"); rawCldsSdcServiceList.add(service1c); - CldsSdcServiceInfo service2 = new CldsSdcServiceInfo(); + SdcServiceInfo service2 = new SdcServiceInfo(); service2.setName("service2"); service2.setVersion("1.0"); service2.setInvariantUUID("invariantUUID2.0"); rawCldsSdcServiceList.add(service2); SdcCatalogServices catalogServices = new SdcCatalogServices(); - List<CldsSdcServiceInfo> resultList = catalogServices.removeDuplicateServices(rawCldsSdcServiceList); + List<SdcServiceInfo> resultList = catalogServices.removeDuplicateServices(rawCldsSdcServiceList); assertTrue(resultList.size() == 2); - CldsSdcServiceInfo res1; - CldsSdcServiceInfo res2; + SdcServiceInfo res1; + SdcServiceInfo res2; if ("service1".equals(resultList.get(0).getName())) { res1 = resultList.get(0); res2 = resultList.get(1); @@ -97,27 +97,27 @@ public class SdcCatalogServicesItCase extends AbstractItCase { @Test public void removeDuplicateSdcResourceInstancesTest() { - List<CldsSdcResource> rawCldsSdcResourceList = new LinkedList<>(); - CldsSdcResource sdcResource1a = new CldsSdcResource(); + List<SdcResource> rawCldsSdcResourceList = new LinkedList<>(); + SdcResource sdcResource1a = new SdcResource(); sdcResource1a.setResourceInstanceName("resource1"); sdcResource1a.setResourceVersion("1.0"); rawCldsSdcResourceList.add(sdcResource1a); - CldsSdcResource sdcResource1b = new CldsSdcResource(); + SdcResource sdcResource1b = new SdcResource(); sdcResource1b.setResourceInstanceName("resource1"); sdcResource1b.setResourceVersion("1.1"); rawCldsSdcResourceList.add(sdcResource1b); - CldsSdcResource sdcResource1c = new CldsSdcResource(); + SdcResource sdcResource1c = new SdcResource(); sdcResource1c.setResourceInstanceName("resource1"); sdcResource1c.setResourceVersion("1.2"); rawCldsSdcResourceList.add(sdcResource1c); - CldsSdcResource sdcResource2 = new CldsSdcResource(); + SdcResource sdcResource2 = new SdcResource(); sdcResource2.setResourceInstanceName("resource2"); sdcResource2.setResourceVersion("1.0"); rawCldsSdcResourceList.add(sdcResource2); SdcCatalogServices catalogServices = new SdcCatalogServices(); - List<CldsSdcResource> resultList = catalogServices.removeDuplicateSdcResourceInstances(rawCldsSdcResourceList); - CldsSdcResource res1; - CldsSdcResource res2; + List<SdcResource> resultList = catalogServices.removeDuplicateSdcResourceInstances(rawCldsSdcResourceList); + SdcResource res1; + SdcResource res2; if ("resource1".equals(resultList.get(0).getResourceInstanceName())) { res1 = resultList.get(0); res2 = resultList.get(1); @@ -133,28 +133,28 @@ public class SdcCatalogServicesItCase extends AbstractItCase { @Test public void removeDuplicateSdcResourceBasicInfoTest() { - List<CldsSdcResourceBasicInfo> rawCldsSdcResourceList = new LinkedList<>(); - CldsSdcResourceBasicInfo sdcResource1a = new CldsSdcResourceBasicInfo(); + List<SdcResourceBasicInfo> rawCldsSdcResourceList = new LinkedList<>(); + SdcResourceBasicInfo sdcResource1a = new SdcResourceBasicInfo(); sdcResource1a.setName("resource1"); sdcResource1a.setVersion("1.0"); rawCldsSdcResourceList.add(sdcResource1a); - CldsSdcResourceBasicInfo sdcResource1b = new CldsSdcResourceBasicInfo(); + SdcResourceBasicInfo sdcResource1b = new SdcResourceBasicInfo(); sdcResource1b.setName("resource1"); sdcResource1b.setVersion("1.1"); rawCldsSdcResourceList.add(sdcResource1b); - CldsSdcResourceBasicInfo sdcResource1c = new CldsSdcResourceBasicInfo(); + SdcResourceBasicInfo sdcResource1c = new SdcResourceBasicInfo(); sdcResource1c.setName("resource1"); sdcResource1c.setVersion("1.2"); rawCldsSdcResourceList.add(sdcResource1c); - CldsSdcResourceBasicInfo sdcResource2 = new CldsSdcResourceBasicInfo(); + SdcResourceBasicInfo sdcResource2 = new SdcResourceBasicInfo(); sdcResource2.setName("resource2"); sdcResource2.setVersion("1.0"); rawCldsSdcResourceList.add(sdcResource2); SdcCatalogServices catalogServices = new SdcCatalogServices(); - List<CldsSdcResourceBasicInfo> resultList = catalogServices + List<SdcResourceBasicInfo> resultList = catalogServices .removeDuplicateSdcResourceBasicInfo(rawCldsSdcResourceList); - CldsSdcResourceBasicInfo res1; - CldsSdcResourceBasicInfo res2; + SdcResourceBasicInfo res1; + SdcResourceBasicInfo res2; if ("resource1".equals(resultList.get(0).getName())) { res1 = resultList.get(0); res2 = resultList.get(1); diff --git a/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java b/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java index afff9dd7d..2efc52866 100644 --- a/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/SdcReqItCase.java @@ -36,9 +36,9 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.onap.clamp.clds.AbstractItCase; -import org.onap.clamp.clds.client.req.sdc.SdcReq; +import org.onap.clamp.clds.client.req.sdc.SdcRequests; import org.onap.clamp.clds.model.CldsEvent; -import org.onap.clamp.clds.model.prop.ModelProperties; +import org.onap.clamp.clds.model.properties.ModelProperties; import org.onap.clamp.clds.util.ResourceFileUtil; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.beans.factory.annotation.Autowired; @@ -50,7 +50,7 @@ import org.springframework.test.context.junit4.SpringRunner; public class SdcReqItCase extends AbstractItCase { @Autowired - private SdcReq sdcReq; + private SdcRequests sdcReq; private String modelBpmnProp; private String modelBpmn; private String modelName; @@ -98,7 +98,7 @@ public class SdcReqItCase extends AbstractItCase { @Test public void getSdcReqUrlsListTest() throws GeneralSecurityException, DecoderException { - List<String> listUrls = sdcReq.getSdcReqUrlsList(modelProperties, refProp.getStringValue("sdc.serviceUrl")); + List<String> listUrls = sdcReq.getSdcReqUrlsList(modelProperties); assertNotNull(listUrls); assertTrue(listUrls.size() == 1); assertTrue(listUrls.get(0).contains( diff --git a/src/test/java/org/onap/clamp/clds/it/TcaRequestFormatterItCase.java b/src/test/java/org/onap/clamp/clds/it/TcaRequestFormatterItCase.java index 419bfde22..c290a386b 100644 --- a/src/test/java/org/onap/clamp/clds/it/TcaRequestFormatterItCase.java +++ b/src/test/java/org/onap/clamp/clds/it/TcaRequestFormatterItCase.java @@ -35,7 +35,7 @@ import org.junit.runner.RunWith; import org.onap.clamp.clds.AbstractItCase; import org.onap.clamp.clds.client.req.tca.TcaRequestFormatter; import org.onap.clamp.clds.model.CldsEvent; -import org.onap.clamp.clds.model.prop.ModelProperties; +import org.onap.clamp.clds.model.properties.ModelProperties; import org.onap.clamp.clds.util.ResourceFileUtil; import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.boot.test.context.SpringBootTest; diff --git a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java index 138d727c0..d3694aea4 100644 --- a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java +++ b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElement.java @@ -25,6 +25,10 @@ package org.onap.clamp.clds.model.prop; import com.fasterxml.jackson.databind.JsonNode;
+import org.onap.clamp.clds.model.properties.AbstractModelElement;
+import org.onap.clamp.clds.model.properties.ModelBpmn;
+import org.onap.clamp.clds.model.properties.ModelProperties;
+
/**
* A CustomModelElement to test the capability to add new elements on the fly.
*/
diff --git a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElementTest.java b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElementTest.java index 46c70e55e..851556a6c 100644 --- a/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElementTest.java +++ b/src/test/java/org/onap/clamp/clds/model/prop/CustomModelElementTest.java @@ -27,6 +27,7 @@ import java.io.IOException; import org.junit.Assert;
import org.junit.Test;
+import org.onap.clamp.clds.model.properties.ModelProperties;
import org.onap.clamp.clds.util.ResourceFileUtil;
public class CustomModelElementTest {
diff --git a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java index 7bb11a9ef..a7ab94c57 100644 --- a/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java +++ b/src/test/java/org/onap/clamp/clds/model/prop/ModelPropertiesTest.java @@ -32,6 +32,10 @@ import java.io.IOException; import org.junit.Before; import org.junit.Test; import org.onap.clamp.clds.model.CldsModel; +import org.onap.clamp.clds.model.properties.Holmes; +import org.onap.clamp.clds.model.properties.ModelProperties; +import org.onap.clamp.clds.model.properties.Policy; +import org.onap.clamp.clds.model.properties.Tca; import org.onap.clamp.clds.util.ResourceFileUtil; /** diff --git a/src/test/resources/http-cache/start_http_cache.sh b/src/test/resources/http-cache/start_http_cache.sh index 591fd5047..f318256aa 100755 --- a/src/test/resources/http-cache/start_http_cache.sh +++ b/src/test/resources/http-cache/start_http_cache.sh @@ -34,4 +34,4 @@ fi echo 'Installing requests packages for Python' pip install requests echo 'Executing the Http proxy in Cache mode only' -python sdc_proxy.py --port 8080 --root /usr/src/http-cache-app/data-cache
\ No newline at end of file +python sdc_proxy.py --port 2080 --root /usr/src/http-cache-app/data-cache |