diff options
Diffstat (limited to 'common')
55 files changed, 617 insertions, 166 deletions
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java index 0b10d85bbf..0b3aa651a0 100644 --- a/common/src/main/java/org/onap/so/client/RestClient.java +++ b/common/src/main/java/org/onap/so/client/RestClient.java @@ -28,7 +28,6 @@ import java.net.URL; import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.Base64; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClient.java b/common/src/main/java/org/onap/so/client/aai/AAIClient.java index 131bc27783..a1e0d7c102 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIClient.java @@ -25,7 +25,6 @@ import javax.ws.rs.NotFoundException; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.RestClient; import org.onap.so.client.graphinventory.GraphInventoryClient; -import org.onap.so.client.graphinventory.GraphInventoryVersion; import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException; import org.slf4j.Logger; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java index 7029ffe5e4..66ea8f950e 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java @@ -24,8 +24,6 @@ import java.io.IOException; import java.util.Optional; import javax.annotation.Priority; import javax.ws.rs.ext.Provider; -import javax.annotation.Priority; -import javax.ws.rs.ext.Provider; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.client.ResponseExceptionMapper; import org.onap.so.client.aai.entities.AAIError; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java index cd4e1125ce..c2c8e933b1 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java @@ -36,9 +36,7 @@ import org.onap.aai.domain.yang.Configuration; import org.onap.aai.domain.yang.Connector; import org.onap.aai.domain.yang.Customer; import org.onap.aai.domain.yang.Device; -import org.onap.aai.domain.yang.EsrSystemInfoList; import org.onap.aai.domain.yang.EsrVnfm; -import org.onap.aai.domain.yang.EsrVnfmList; import org.onap.aai.domain.yang.ExtAaiNetwork; import org.onap.aai.domain.yang.Flavor; import org.onap.aai.domain.yang.GenericVnf; @@ -74,6 +72,7 @@ import org.onap.aai.domain.yang.Vnfc; import org.onap.aai.domain.yang.VolumeGroup; import org.onap.aai.domain.yang.VpnBinding; import org.onap.aai.domain.yang.Vserver; +import org.onap.aai.domain.yang.Zone; import org.onap.so.client.graphinventory.GraphInventoryObjectType; import org.onap.so.constants.Defaults; import org.reflections.Reflections; @@ -188,7 +187,7 @@ public class AAIObjectType implements GraphInventoryObjectType, Serializable { "/esr-vnfm/{vnfm-id}/esr-system-info-list", "vnfm-esr-system-info-list"); public static final AAIObjectType CLOUD_ESR_SYSTEM_INFO_LIST = new AAIObjectType( AAIObjectType.CLOUD_REGION.uriTemplate(), "/esr-system-info-list", "cloud-esr-system-info-list"); - + public static final AAIObjectType ZONE = new AAIObjectType(AAINamespaceConstants.NETWORK, Zone.class); private final String uriTemplate; private final String parentUri; diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java index 6eafb965a2..b546aaa23e 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java @@ -23,11 +23,9 @@ package org.onap.so.client.aai; import java.net.URI; import java.util.Map; import java.util.Optional; -import javax.ws.rs.core.Response; import org.onap.so.client.ResponseExceptionMapper; import org.onap.so.client.graphinventory.GraphInventoryPatchConverter; import org.onap.so.client.graphinventory.GraphInventoryRestClient; -import org.onap.so.client.policy.CommonObjectMapperProvider; import org.onap.so.utils.TargetEntity; public class AAIRestClient extends GraphInventoryRestClient { diff --git a/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java index 0d400339f9..b2223be688 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIUpdatorImpl.java @@ -21,7 +21,6 @@ package org.onap.so.client.aai; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; public class AAIUpdatorImpl implements AAIUpdator { diff --git a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java index 3987d7375a..95ed01ee94 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java @@ -25,7 +25,6 @@ import java.util.List; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.Pserver; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; public class AAIValidatorImpl implements AAIValidator { diff --git a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java index 499246d7d1..91030d831a 100644 --- a/common/src/main/java/org/onap/so/client/aai/AAIVersion.java +++ b/common/src/main/java/org/onap/so/client/aai/AAIVersion.java @@ -25,7 +25,7 @@ import org.onap.so.client.graphinventory.GraphInventoryVersion; public enum AAIVersion implements GraphInventoryVersion { V13("v13"), V14("v14"), V15("v15"); - public final static AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1]; + public static final AAIVersion LATEST = AAIVersion.values()[AAIVersion.values().length - 1]; private final String value; private AAIVersion(String value) { diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java index 2e70c4925a..456f14e5ee 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java @@ -24,8 +24,9 @@ import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; public enum AAIEdgeLabel implements GraphInventoryEdgeLabel { - BELONGS_TO("org.onap.relationships.inventory.BelongsTo"), USES( - "org.onap.relationships.inventory.Uses"), COMPOSED_OF("org.onap.relationships.inventory.ComposedOf"); + BELONGS_TO("org.onap.relationships.inventory.BelongsTo"), + USES("org.onap.relationships.inventory.Uses"), + COMPOSED_OF("org.onap.relationships.inventory.ComposedOf"); private final String label; diff --git a/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java b/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java index af7ccf661e..3433e36151 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/CustomQuery.java @@ -34,15 +34,6 @@ public class CustomQuery { private String query; private String gremlin; - public String getGremlin() { - return gremlin; - } - - public void setGremlin(String gremlin) { - this.gremlin = gremlin; - } - - public CustomQuery(List<AAIResourceUri> start) { this.setStart(start); } @@ -56,6 +47,14 @@ public class CustomQuery { this.gremlin = gremlin; } + public String getGremlin() { + return gremlin; + } + + public void setGremlin(String gremlin) { + this.gremlin = gremlin; + } + public List<String> getStart() { return start; } diff --git a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java index 16a4c178e5..45f2c965f9 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/bulkprocess/OperationBody.java @@ -23,7 +23,6 @@ package org.onap.so.client.aai.entities.bulkprocess; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRawValue; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java index 5d28013c85..b2d67af156 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/singletransaction/OperationBodyRequest.java @@ -23,7 +23,6 @@ package org.onap.so.client.aai.entities.singletransaction; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRawValue; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonInclude(JsonInclude.Include.NON_NULL) diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java index 7572541206..f2f99050db 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java @@ -25,9 +25,7 @@ import javax.ws.rs.core.UriBuilder; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.graphinventory.Format; -import org.onap.so.client.graphinventory.GraphInventoryObjectType; import org.onap.so.client.graphinventory.entities.uri.Depth; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; import org.onap.so.client.graphinventory.entities.uri.SimpleUri; public class AAISimpleUri extends SimpleUri implements AAIResourceUri { diff --git a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java index 3dd0c751e3..4de546e9da 100644 --- a/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java +++ b/common/src/main/java/org/onap/so/client/dmaap/DmaapConsumer.java @@ -28,6 +28,7 @@ import org.onap.so.client.dmaap.exceptions.ExceededMaximumPollingTime; import org.onap.so.client.dmaap.rest.RestConsumer; public abstract class DmaapConsumer extends DmaapClient { + static final int MAX_ELAPSED_TIME = 180000; public DmaapConsumer() throws IOException { super("dmaap/default-consumer.properties"); @@ -125,7 +126,7 @@ public abstract class DmaapConsumer extends DmaapClient { * time in milliseconds */ public int getMaximumElapsedTime() { - return 180000; + return MAX_ELAPSED_TIME; } diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java index 1d85dac7dc..68b4e84448 100644 --- a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java +++ b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java @@ -23,7 +23,6 @@ package org.onap.so.client.dmaap.rest; import java.net.URL; import java.util.Map; import org.onap.so.client.RestClient; -import org.onap.so.utils.CryptoUtils; import org.onap.so.utils.TargetEntity; public class DMaaPRestClient extends RestClient { diff --git a/common/src/main/java/org/onap/so/client/graphinventory/Format.java b/common/src/main/java/org/onap/so/client/graphinventory/Format.java index b422516e63..c3cb4b9eaf 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/Format.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/Format.java @@ -22,8 +22,14 @@ package org.onap.so.client.graphinventory; public enum Format { - RESOURCE("resource"), RESOURCE_AND_URL("resource_and_url"), SIMPLE("simple"), RAW("raw"), CONSOLE( - "console"), PATHED("pathed"), GRAPHSON("graphson"), ID("id"); + RESOURCE("resource"), + RESOURCE_AND_URL("resource_and_url"), + SIMPLE("simple"), + RAW("raw"), + CONSOLE("console"), + PATHED("pathed"), + GRAPHSON("graphson"), + ID("id"); private final String name; diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java index 992d1f017b..5fc8726427 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryTransactionClient.java @@ -27,8 +27,6 @@ import java.util.Optional; import javax.ws.rs.NotFoundException; import javax.ws.rs.core.GenericType; import org.onap.aai.domain.yang.Relationship; -import org.onap.so.client.aai.AAIVersion; -import org.onap.so.client.aai.entities.singletransaction.SingleTransactionRequest; import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; import org.onap.so.client.graphinventory.exceptions.BulkProcessFailed; diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java index bf33e8f8d3..f7f5d78604 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java @@ -56,9 +56,9 @@ public class DSLNodeKey implements QueryStep { result.append("('").append(keyName).append("', "); List<String> temp = new ArrayList<>(); for (String item : values) { - if (item.equals("null")) { + if ("null".equals(item)) { temp.add(String.format("' %s '", item)); - } else if (item.equals("")) { + } else if ("".equals(item)) { temp.add("' '"); } else { temp.add(String.format("'%s'", item)); diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java index 892951f950..6703416832 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java @@ -27,10 +27,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Predicate; -import org.onap.so.client.aai.AAICommonObjectMapperProvider; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.so.client.graphinventory.GraphInventoryObjectName; import org.onap.so.client.graphinventory.GraphInventoryObjectType; diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java index 5d0a33909a..41ba07ad6c 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java @@ -44,8 +44,8 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable { private static final long serialVersionUID = -337701171277616439L; protected transient UriBuilder internalURI; - protected final static String relationshipAPI = "/relationship-list/relationship"; - protected final static String relatedTo = "/related-to"; + protected static final String relationshipAPI = "/relationship-list/relationship"; + protected static final String relatedTo = "/related-to"; protected final Object[] values; protected final GraphInventoryObjectType type; protected final GraphInventoryObjectPlurals pluralType; diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java index 14a46c243b..71afdb83d9 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/parsers/UriParserSpringImpl.java @@ -20,7 +20,6 @@ package org.onap.so.client.graphinventory.entities.uri.parsers; -import java.io.UnsupportedEncodingException; import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedHashSet; diff --git a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java index fa155de6a2..507f1130b5 100644 --- a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java +++ b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java @@ -22,11 +22,9 @@ package org.onap.so.client.grm; import java.net.URI; -import java.util.Base64; import java.util.Map; import java.util.Optional; import org.onap.so.client.RestClient; -import org.onap.so.client.RestProperties; import org.onap.so.utils.TargetEntity; public class GRMRestClient extends RestClient { diff --git a/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java index 5b99fe1a05..6e7baa37e6 100644 --- a/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java +++ b/common/src/main/java/org/onap/so/client/policy/entities/DictionaryJson.java @@ -31,7 +31,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; public class DictionaryJson { @JsonProperty("DictionaryDatas") - private List<DictionaryData> dictionaryDatas = new ArrayList<DictionaryData>(); + private List<DictionaryData> dictionaryDatas = new ArrayList<>(); @JsonProperty("DictionaryDatas") public List<DictionaryData> getDictionaryDatas() { diff --git a/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java index b00d22dbad..eb95b75593 100644 --- a/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java +++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyServiceType.java @@ -21,11 +21,18 @@ package org.onap.so.client.policy.entities; public enum PolicyServiceType { - GET_CONFIG("getConfig"), SEND_EVENT("sendEvent"), PUSH_POLICY("pushPolicy"), CREATE_POLICY( - "createPolicy"), UPDATE_POLICY("updatePolicy"), GET_DECISION("getDecision"), GET_METRICS( - "getMetrics"), DELETE_POLICY("deletePolicy"), LIST_CONFIG("listConfig"), CREATE_DICTIONARY_ITEM( - "createDictionaryItem"), UPDATE_DICTIONARY_ITEM( - "updateDictionaryItem"), GET_DICTIONARY_ITEMS("getDictionaryItems"); + GET_CONFIG("getConfig"), + SEND_EVENT("sendEvent"), + PUSH_POLICY("pushPolicy"), + CREATE_POLICY("createPolicy"), + UPDATE_POLICY("updatePolicy"), + GET_DECISION("getDecision"), + GET_METRICS("getMetrics"), + DELETE_POLICY("deletePolicy"), + LIST_CONFIG("listConfig"), + CREATE_DICTIONARY_ITEM("createDictionaryItem"), + UPDATE_DICTIONARY_ITEM("updateDictionaryItem"), + GET_DICTIONARY_ITEMS("getDictionaryItems"); private final String name; diff --git a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java index 4aafd145b7..8e674fb77b 100644 --- a/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java +++ b/common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java @@ -28,7 +28,6 @@ import javax.ws.rs.NotFoundException; import org.onap.aai.domain.yang.GenericVnf; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.AAIVersion; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.dmaap.DmaapConsumer; diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/Body.java b/common/src/main/java/org/onap/so/client/sdno/beans/Body.java index 84dd83ea6f..8c40b749a6 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/Body.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/Body.java @@ -37,8 +37,8 @@ public class Body implements Serializable { @JsonProperty("input") private Input input; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); - private final static long serialVersionUID = 9101706044452851559L; + private Map<String, Object> additionalProperties = new HashMap<>(); + private static final long serialVersionUID = 9101706044452851559L; @JsonProperty("input") public Input getInput() { diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/Input.java b/common/src/main/java/org/onap/so/client/sdno/beans/Input.java index ea537bba09..c8122c06f6 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/Input.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/Input.java @@ -40,7 +40,7 @@ public class Input implements Serializable { private RequestHdCustom requestHdCustom; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + private Map<String, Object> additionalProperties = new HashMap<>(); private final static long serialVersionUID = 7155546785389227528L; @JsonProperty("request-healthdiagnostic") diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java index c08d1ef386..485f64673f 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java @@ -49,7 +49,7 @@ public class RequestHdCustom implements Serializable { @JsonProperty("send-detailed-cmd-response") private String sendDetailedCmdResponse = "false"; @JsonProperty("aai-param-list") - private List<AAIParamList> aaiParamList = new ArrayList<AAIParamList>(); + private List<AAIParamList> aaiParamList = new ArrayList<>(); /** * No args constructor for use in serialization diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java index c05b470b0e..b1b75ab412 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java @@ -52,8 +52,8 @@ public class RequestHealthDiagnostic implements Serializable { @JsonProperty("health-diagnostic-code") private String healthDiagnosticCode; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); - private final static long serialVersionUID = 1166788526178388021L; + private Map<String, Object> additionalProperties = new HashMap<>(); + private static final long serialVersionUID = 1166788526178388021L; @JsonProperty("request-client-name") public String getRequestClientName() { diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java b/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java index 93826c752f..8b84cf6659 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java @@ -44,7 +44,7 @@ public class ResultInfo { @JsonProperty("status") private String status; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); + private Map<String, Object> additionalProperties = new HashMap<>(); @JsonProperty("client-name") public String getClientName() { diff --git a/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java b/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java index 09f408c967..46e2c1d1fc 100644 --- a/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java +++ b/common/src/main/java/org/onap/so/client/sdno/beans/SDNO.java @@ -43,8 +43,8 @@ public class SDNO implements Serializable { @JsonProperty("body") private Body body; @JsonIgnore - private Map<String, Object> additionalProperties = new HashMap<String, Object>(); - private final static long serialVersionUID = -5303297382564282650L; + private Map<String, Object> additionalProperties = new HashMap<>(); + private static final long serialVersionUID = -5303297382564282650L; @JsonProperty("operation") public String getOperation() { diff --git a/common/src/main/java/org/onap/so/logger/ErrorCode.java b/common/src/main/java/org/onap/so/logger/ErrorCode.java index 2d6fb791d5..f0a78e9699 100644 --- a/common/src/main/java/org/onap/so/logger/ErrorCode.java +++ b/common/src/main/java/org/onap/so/logger/ErrorCode.java @@ -1,8 +1,12 @@ package org.onap.so.logger; public enum ErrorCode { - PermissionError(100), AvailabilityError(200), DataError(300), SchemaError(400), BusinessProcesssError( - 500), UnknownError(900); + PermissionError(100), + AvailabilityError(200), + DataError(300), + SchemaError(400), + BusinessProcesssError(500), + UnknownError(900); private int value; diff --git a/common/src/main/java/org/onap/so/logger/MdcConstants.java b/common/src/main/java/org/onap/so/logger/MdcConstants.java index 9f8417e047..e3212733c8 100644 --- a/common/src/main/java/org/onap/so/logger/MdcConstants.java +++ b/common/src/main/java/org/onap/so/logger/MdcConstants.java @@ -10,4 +10,5 @@ public class MdcConstants { public static final String SERVICE_NAME = "ServiceName"; public static final String STATUSCODE = "StatusCode"; public static final String ENDTIME = "EndTimestamp"; + public static final String ORIGINAL_PARTNER_NAME = "OriginalPartnerName"; } diff --git a/common/src/main/java/org/onap/so/logger/MessageEnum.java b/common/src/main/java/org/onap/so/logger/MessageEnum.java index e92d50a685..bcf699beaf 100644 --- a/common/src/main/java/org/onap/so/logger/MessageEnum.java +++ b/common/src/main/java/org/onap/so/logger/MessageEnum.java @@ -24,13 +24,200 @@ package org.onap.so.logger; public enum MessageEnum { // Api Handler Messages - APIH_REQUEST_NULL, APIH_QUERY_FOUND, APIH_QUERY_NOT_FOUND, APIH_QUERY_PARAM_WRONG, APIH_DB_ACCESS_EXC, APIH_DB_ACCESS_EXC_REASON, APIH_VALIDATION_ERROR, APIH_REQUEST_VALIDATION_ERROR, APIH_SERVICE_VALIDATION_ERROR, APIH_GENERAL_EXCEPTION_ARG, APIH_GENERAL_EXCEPTION, APIH_GENERAL_WARNING, APIH_AUDIT_EXEC, APIH_GENERAL_METRICS, APIH_DUPLICATE_CHECK_EXC, APIH_DUPLICATE_FOUND, APIH_BAD_ORDER, APIH_DB_ATTRIBUTE_NOT_FOUND, APIH_BPEL_COMMUNICATE_ERROR, APIH_BPEL_RESPONSE_ERROR, APIH_WARP_REQUEST, APIH_ERROR_FROM_BPEL_SERVER, APIH_DB_INSERT_EXC, APIH_DB_UPDATE_EXC, APIH_NO_PROPERTIES, APIH_PROPERTY_LOAD_SUC, APIH_LOAD_PROPERTIES_FAIL, APIH_SDNC_COMMUNICATE_ERROR, APIH_SDNC_RESPONSE_ERROR, APIH_CANNOT_READ_SCHEMA, APIH_HEALTH_CHECK_EXCEPTION, APIH_REQUEST_VALIDATION_ERROR_REASON, APIH_JAXB_MARSH_ERROR, APIH_JAXB_UNMARSH_ERROR, APIH_VNFREQUEST_VALIDATION_ERROR, APIH_DOM2STR_ERROR, APIH_READ_VNFOUTPUT_CLOB_EXCEPTION, APIH_DUPLICATE_CHECK_EXC_ATT, APIH_GENERATED_REQUEST_ID, APIH_GENERATED_SERVICE_INSTANCE_ID, APIH_REPLACE_REQUEST_ID, + APIH_REQUEST_NULL, + APIH_QUERY_FOUND, + APIH_QUERY_NOT_FOUND, + APIH_QUERY_PARAM_WRONG, + APIH_DB_ACCESS_EXC, + APIH_DB_ACCESS_EXC_REASON, + APIH_VALIDATION_ERROR, + APIH_REQUEST_VALIDATION_ERROR, + APIH_SERVICE_VALIDATION_ERROR, + APIH_GENERAL_EXCEPTION_ARG, + APIH_GENERAL_EXCEPTION, + APIH_GENERAL_WARNING, + APIH_AUDIT_EXEC, + APIH_GENERAL_METRICS, + APIH_DUPLICATE_CHECK_EXC, + APIH_DUPLICATE_FOUND, + APIH_BAD_ORDER, + APIH_DB_ATTRIBUTE_NOT_FOUND, + APIH_BPEL_COMMUNICATE_ERROR, + APIH_BPEL_RESPONSE_ERROR, + APIH_WARP_REQUEST, + APIH_ERROR_FROM_BPEL_SERVER, + APIH_DB_INSERT_EXC, + APIH_DB_UPDATE_EXC, + APIH_NO_PROPERTIES, + APIH_PROPERTY_LOAD_SUC, + APIH_LOAD_PROPERTIES_FAIL, + APIH_SDNC_COMMUNICATE_ERROR, + APIH_SDNC_RESPONSE_ERROR, + APIH_CANNOT_READ_SCHEMA, + APIH_HEALTH_CHECK_EXCEPTION, + APIH_REQUEST_VALIDATION_ERROR_REASON, + APIH_JAXB_MARSH_ERROR, + APIH_JAXB_UNMARSH_ERROR, + APIH_VNFREQUEST_VALIDATION_ERROR, + APIH_DOM2STR_ERROR, + APIH_READ_VNFOUTPUT_CLOB_EXCEPTION, + APIH_DUPLICATE_CHECK_EXC_ATT, + APIH_GENERATED_REQUEST_ID, + APIH_GENERATED_SERVICE_INSTANCE_ID, + APIH_REPLACE_REQUEST_ID, // Resource Adapter Messages - RA_GENERAL_EXCEPTION_ARG, RA_GENERAL_EXCEPTION, RA_GENERAL_WARNING, RA_MISSING_PARAM, RA_AUDIT_EXEC, RA_GENERAL_METRICS, RA_CREATE_STACK_TIMEOUT, RA_DELETE_STACK_TIMEOUT, RA_UPDATE_STACK_TIMEOUT, RA_CONNECTION_EXCEPTION, RA_PARSING_ERROR, RA_PROPERTIES_NOT_FOUND, RA_LOAD_PROPERTIES_SUC, RA_NETWORK_ALREADY_EXIST, RA_UPDATE_NETWORK_ERR, RA_CREATE_STACK_ERR, RA_UPDATE_STACK_ERR, RA_CREATE_TENANT_ERR, RA_NETWORK_NOT_FOUND, RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, RA_CREATE_NETWORK_EXC, RA_NS_EXC, RA_PARAM_NOT_FOUND, RA_CONFIG_EXC, RA_UNKOWN_PARAM, RA_VLAN_PARSE, RA_DELETE_NETWORK_EXC, RA_ROLLBACK_NULL, RA_TENANT_NOT_FOUND, RA_QUERY_NETWORK_EXC, RA_CREATE_NETWORK_NOTIF_EXC, RA_ASYNC_ROLLBACK, RA_WSDL_NOT_FOUND, RA_WSDL_URL_CONVENTION_EXC, RA_INIT_NOTIF_EXC, RA_SET_CALLBACK_AUTH_EXC, RA_FAULT_INFO_EXC, RA_MARSHING_ERROR, RA_PARSING_REQUEST_ERROR, RA_SEND_REQUEST_SDNC, RA_RESPONSE_FROM_SDNC, RA_EXCEPTION_COMMUNICATE_SDNC, RA_EVALUATE_XPATH_ERROR, RA_ANALYZE_ERROR_EXC, RA_ERROR_GET_RESPONSE_SDNC, RA_CALLBACK_BPEL, RA_INIT_CALLBACK_WSDL_ERR, RA_CALLBACK_BPEL_EXC, RA_CALLBACK_BPEL_COMPLETE, RA_SDNC_MISS_CONFIG_PARAM, RA_SDNC_INVALID_CONFIG, RA_PRINT_URL, RA_ERROR_CREATE_SDNC_REQUEST, RA_ERROR_CREATE_SDNC_RESPONSE, RA_ERROR_CONVERT_XML2STR, RA_RECEIVE_SDNC_NOTIF, RA_INIT_SDNC_ADAPTER, RA_SEND_REQUEST_APPC_ERR, RA_SEND_REQUEST_SDNC_ERR, RA_RECEIVE_BPEL_REQUEST, RA_TENANT_ALREADY_EXIST, RA_UPDATE_TENANT_ERR, RA_DELETE_TEMAMT_ERR, RA_ROLLBACK_TENANT_ERR, RA_QUERY_VNF_ERR, RA_VNF_ALREADY_EXIST, RA_VNF_UNKNOWN_PARAM, RA_VNF_EXTRA_PARAM, RA_CREATE_VNF_ERR, RA_VNF_NOT_EXIST, RA_UPDATE_VNF_ERR, RA_DELETE_VNF_ERR, RA_ASYNC_CREATE_VNF, RA_SEND_VNF_NOTIF_ERR, RA_ASYNC_CREATE_VNF_COMPLETE, RA_ASYNC_UPDATE_VNF, RA_ASYNC_UPDATE_VNF_COMPLETE, RA_ASYNC_QUERY_VNF, RA_ASYNC_QUERY_VNF_COMPLETE, RA_ASYNC_DELETE_VNF, RA_ASYNC_DELETE_VNF_COMPLETE, RA_ASYNC_ROLLBACK_VNF, RA_ASYNC_ROLLBACK_VNF_COMPLETE, RA_ROLLBACK_VNF_ERR, RA_DB_INVALID_STATUS, RA_CANT_UPDATE_REQUEST, RA_DB_REQUEST_NOT_EXIST, RA_CONFIG_NOT_FOUND, RA_CONFIG_LOAD, RA_RECEIVE_WORKFLOW_MESSAGE, + RA_GENERAL_EXCEPTION_ARG, + RA_GENERAL_EXCEPTION, + RA_GENERAL_WARNING, + RA_MISSING_PARAM, + RA_AUDIT_EXEC, + RA_GENERAL_METRICS, + RA_CREATE_STACK_TIMEOUT, + RA_DELETE_STACK_TIMEOUT, + RA_UPDATE_STACK_TIMEOUT, + RA_CONNECTION_EXCEPTION, + RA_PARSING_ERROR, + RA_PROPERTIES_NOT_FOUND, + RA_LOAD_PROPERTIES_SUC, + RA_NETWORK_ALREADY_EXIST, + RA_UPDATE_NETWORK_ERR, + RA_CREATE_STACK_ERR, + RA_UPDATE_STACK_ERR, + RA_CREATE_TENANT_ERR, + RA_NETWORK_NOT_FOUND, + RA_NETWORK_ORCHE_MODE_NOT_SUPPORT, + RA_CREATE_NETWORK_EXC, + RA_NS_EXC, + RA_PARAM_NOT_FOUND, + RA_CONFIG_EXC, + RA_UNKOWN_PARAM, + RA_VLAN_PARSE, + RA_DELETE_NETWORK_EXC, + RA_ROLLBACK_NULL, + RA_TENANT_NOT_FOUND, + RA_QUERY_NETWORK_EXC, + RA_CREATE_NETWORK_NOTIF_EXC, + RA_ASYNC_ROLLBACK, + RA_WSDL_NOT_FOUND, + RA_WSDL_URL_CONVENTION_EXC, + RA_INIT_NOTIF_EXC, + RA_SET_CALLBACK_AUTH_EXC, + RA_FAULT_INFO_EXC, + RA_MARSHING_ERROR, + RA_PARSING_REQUEST_ERROR, + RA_SEND_REQUEST_SDNC, + RA_RESPONSE_FROM_SDNC, + RA_EXCEPTION_COMMUNICATE_SDNC, + RA_EVALUATE_XPATH_ERROR, + RA_ANALYZE_ERROR_EXC, + RA_ERROR_GET_RESPONSE_SDNC, + RA_CALLBACK_BPEL, + RA_INIT_CALLBACK_WSDL_ERR, + RA_CALLBACK_BPEL_EXC, + RA_CALLBACK_BPEL_COMPLETE, + RA_SDNC_MISS_CONFIG_PARAM, + RA_SDNC_INVALID_CONFIG, + RA_PRINT_URL, + RA_ERROR_CREATE_SDNC_REQUEST, + RA_ERROR_CREATE_SDNC_RESPONSE, + RA_ERROR_CONVERT_XML2STR, + RA_RECEIVE_SDNC_NOTIF, + RA_INIT_SDNC_ADAPTER, + RA_SEND_REQUEST_APPC_ERR, + RA_SEND_REQUEST_SDNC_ERR, + RA_RECEIVE_BPEL_REQUEST, + RA_TENANT_ALREADY_EXIST, + RA_UPDATE_TENANT_ERR, + RA_DELETE_TEMAMT_ERR, + RA_ROLLBACK_TENANT_ERR, + RA_QUERY_VNF_ERR, + RA_VNF_ALREADY_EXIST, + RA_VNF_UNKNOWN_PARAM, + RA_VNF_EXTRA_PARAM, + RA_CREATE_VNF_ERR, + RA_VNF_NOT_EXIST, + RA_UPDATE_VNF_ERR, + RA_DELETE_VNF_ERR, + RA_ASYNC_CREATE_VNF, + RA_SEND_VNF_NOTIF_ERR, + RA_ASYNC_CREATE_VNF_COMPLETE, + RA_ASYNC_UPDATE_VNF, + RA_ASYNC_UPDATE_VNF_COMPLETE, + RA_ASYNC_QUERY_VNF, + RA_ASYNC_QUERY_VNF_COMPLETE, + RA_ASYNC_DELETE_VNF, + RA_ASYNC_DELETE_VNF_COMPLETE, + RA_ASYNC_ROLLBACK_VNF, + RA_ASYNC_ROLLBACK_VNF_COMPLETE, + RA_ROLLBACK_VNF_ERR, + RA_DB_INVALID_STATUS, + RA_CANT_UPDATE_REQUEST, + RA_DB_REQUEST_NOT_EXIST, + RA_CONFIG_NOT_FOUND, + RA_CONFIG_LOAD, + RA_RECEIVE_WORKFLOW_MESSAGE, // BPEL engine Messages - BPMN_GENERAL_INFO, BPMN_GENERAL_EXCEPTION_ARG, BPMN_GENERAL_EXCEPTION, BPMN_GENERAL_WARNING, BPMN_AUDIT_EXEC, BPMN_GENERAL_METRICS, BPMN_URN_MAPPING_FAIL, BPMN_VARIABLE_NULL, BPMN_CALLBACK_EXCEPTION, + BPMN_GENERAL_INFO, + BPMN_GENERAL_EXCEPTION_ARG, + BPMN_GENERAL_EXCEPTION, + BPMN_GENERAL_WARNING, + BPMN_AUDIT_EXEC, + BPMN_GENERAL_METRICS, + BPMN_URN_MAPPING_FAIL, + BPMN_VARIABLE_NULL, + BPMN_CALLBACK_EXCEPTION, // ASDC Messages - ASDC_GENERAL_EXCEPTION_ARG, ASDC_GENERAL_EXCEPTION, ASDC_GENERAL_WARNING, ASDC_GENERAL_INFO, ASDC_AUDIT_EXEC, ASDC_GENERAL_METRICS, ASDC_CREATE_SERVICE, ASDC_ARTIFACT_ALREADY_DEPLOYED, ASDC_CREATE_ARTIFACT, ASDC_ARTIFACT_INSTALL_EXC, ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL, ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL, ASDC_ARTIFACT_CHECK_EXC, ASDC_INIT_ASDC_CLIENT_EXC, ASDC_INIT_ASDC_CLIENT_SUC, ASDC_LOAD_ASDC_CLIENT_EXC, ASDC_SINGLETON_CHECKT_EXC, ASDC_SHUTDOWN_ASDC_CLIENT_EXC, ASDC_CHECK_HEAT_TEMPLATE, ASDC_START_INSTALL_ARTIFACT, ASDC_ARTIFACT_TYPE_NOT_SUPPORT, ASDC_ARTIFACT_ALREADY_EXIST, ASDC_ARTIFACT_DOWNLOAD_SUC, ASDC_ARTIFACT_DOWNLOAD_FAIL, ASDC_START_DEPLOY_ARTIFACT, ASDC_SEND_NOTIF_ASDC, ASDC_SEND_NOTIF_ASDC_EXEC, ASDC_RECEIVE_CALLBACK_NOTIF, ASDC_RECEIVE_SERVICE_NOTIF, ASDC_ARTIFACT_NULL, ASDC_SERVICE_NOT_SUPPORT, ASDC_ARTIFACT_DEPLOY_SUC, ASDC_PROPERTIES_NOT_FOUND, ASDC_PROPERTIES_LOAD_SUCCESS, + ASDC_GENERAL_EXCEPTION_ARG, + ASDC_GENERAL_EXCEPTION, + ASDC_GENERAL_WARNING, + ASDC_GENERAL_INFO, + ASDC_AUDIT_EXEC, + ASDC_GENERAL_METRICS, + ASDC_CREATE_SERVICE, + ASDC_ARTIFACT_ALREADY_DEPLOYED, + ASDC_CREATE_ARTIFACT, + ASDC_ARTIFACT_INSTALL_EXC, + ASDC_ARTIFACT_ALREADY_DEPLOYED_DETAIL, + ASDC_ARTIFACT_NOT_DEPLOYED_DETAIL, + ASDC_ARTIFACT_CHECK_EXC, + ASDC_INIT_ASDC_CLIENT_EXC, + ASDC_INIT_ASDC_CLIENT_SUC, + ASDC_LOAD_ASDC_CLIENT_EXC, + ASDC_SINGLETON_CHECKT_EXC, + ASDC_SHUTDOWN_ASDC_CLIENT_EXC, + ASDC_CHECK_HEAT_TEMPLATE, + ASDC_START_INSTALL_ARTIFACT, + ASDC_ARTIFACT_TYPE_NOT_SUPPORT, + ASDC_ARTIFACT_ALREADY_EXIST, + ASDC_ARTIFACT_DOWNLOAD_SUC, + ASDC_ARTIFACT_DOWNLOAD_FAIL, + ASDC_START_DEPLOY_ARTIFACT, + ASDC_SEND_NOTIF_ASDC, + ASDC_SEND_NOTIF_ASDC_EXEC, + ASDC_RECEIVE_CALLBACK_NOTIF, + ASDC_RECEIVE_SERVICE_NOTIF, + ASDC_ARTIFACT_NULL, + ASDC_SERVICE_NOT_SUPPORT, + ASDC_ARTIFACT_DEPLOY_SUC, + ASDC_PROPERTIES_NOT_FOUND, + ASDC_PROPERTIES_LOAD_SUCCESS, // Default Messages, in case Log catalog is not defined - GENERAL_EXCEPTION_ARG, GENERAL_EXCEPTION, GENERAL_WARNING, AUDIT_EXEC, GENERAL_METRICS, LOGGER_SETUP, LOGGER_NOT_FOUND, LOGGER_UPDATE_SUC, LOGGER_UPDATE_DEBUG, LOGGER_UPDATE_DEBUG_SUC, LOAD_PROPERTIES_SUC, NO_PROPERTIES, MADATORY_PARAM_MISSING, LOAD_PROPERTIES_FAIL, INIT_LOGGER, INIT_LOGGER_FAIL, JAXB_EXCEPTION, IDENTITY_SERVICE_NOT_FOUND; + GENERAL_EXCEPTION_ARG, + GENERAL_EXCEPTION, + GENERAL_WARNING, + AUDIT_EXEC, + GENERAL_METRICS, + LOGGER_SETUP, + LOGGER_NOT_FOUND, + LOGGER_UPDATE_SUC, + LOGGER_UPDATE_DEBUG, + LOGGER_UPDATE_DEBUG_SUC, + LOAD_PROPERTIES_SUC, + NO_PROPERTIES, + MADATORY_PARAM_MISSING, + LOAD_PROPERTIES_FAIL, + INIT_LOGGER, + INIT_LOGGER_FAIL, + JAXB_EXCEPTION, + IDENTITY_SERVICE_NOT_FOUND; } diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java index 975f6bb9d8..5dbf88d346 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java @@ -21,34 +21,24 @@ package org.onap.so.logging.jaxrs.filter; -import org.apache.commons.io.IOUtils; import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.utils.TargetEntity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; -import org.slf4j.MarkerFactory; import org.springframework.stereotype.Component; import javax.annotation.Priority; import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientRequestFilter; import javax.ws.rs.client.ClientResponseContext; import javax.ws.rs.client.ClientResponseFilter; -import javax.ws.rs.container.ContainerRequestContext; -import javax.ws.rs.container.ContainerResponseContext; import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; -import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Providers; -import java.io.*; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; -import java.util.Map; import java.util.UUID; @SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection") diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java index 635d95be2e..7e2b603ba6 100644 --- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java +++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java @@ -20,7 +20,6 @@ package org.onap.so.logging.jaxrs.filter; - import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.annotation.Annotation; @@ -40,13 +39,14 @@ import javax.ws.rs.ext.MessageBodyWriter; import javax.ws.rs.ext.Provider; import javax.ws.rs.ext.Providers; import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.onap.so.logger.HttpHeadersConstants; import org.onap.so.logger.LogConstants; +import org.onap.so.logger.MdcConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import com.fasterxml.jackson.databind.ObjectMapper; @Priority(1) @Provider @@ -77,8 +77,10 @@ public class JaxRsFilterLogging implements ContainerRequestFilter, ContainerResp mdcSetup.setClientIPAddress(httpServletRequest); mdcSetup.setInstanceUUID(); mdcSetup.setEntryTimeStamp(); + MDC.put(HttpHeadersConstants.REQUESTOR_ID, headers.getFirst("X-RequestorID")); MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString()); MDC.put(LogConstants.URI_BASE, containerRequest.getUriInfo().getBaseUri().toString()); + MDC.put(MdcConstants.ORIGINAL_PARTNER_NAME, MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)); logger.info(ONAPLogConstants.Markers.ENTRY, "Entering"); } catch (Exception e) { logger.warn("Error in incoming JAX-RS Inteceptor", e); @@ -128,7 +130,6 @@ public class JaxRsFilterLogging implements ContainerRequestFilter, ContainerResp return message; } - private void setRequestId(MultivaluedMap<String, String> headers) { String requestId = headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID); if (requestId == null || requestId.isEmpty()) @@ -169,6 +170,4 @@ public class JaxRsFilterLogging implements ContainerRequestFilter, ContainerResp MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME); } - - } diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java index 8e7a95b581..fa5a5d5da4 100644 --- a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java +++ b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java @@ -30,7 +30,6 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.ext.Providers; import org.onap.logging.ref.slf4j.ONAPLogConstants; -import org.onap.so.logger.LogConstants; import org.onap.so.logging.jaxrs.filter.MDCSetup; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/common/src/main/java/org/onap/so/objects/audit/AAIObjectAudit.java b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAudit.java new file mode 100644 index 0000000000..a27e8fbbd1 --- /dev/null +++ b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAudit.java @@ -0,0 +1,56 @@ +package org.onap.so.objects.audit; + +import java.io.Serializable; +import java.net.URI; +import org.apache.commons.lang3.builder.ToStringBuilder; + +public class AAIObjectAudit implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -4560928512855386021L; + private boolean doesObjectExist = false; + private Object aaiObject; + private URI resourceURI; + private String aaiObjectType; + + @Override + public String toString() { + return new ToStringBuilder(this).append("doesObjectExist", doesObjectExist).append("aaiObject", aaiObject) + .append("resourceURI", resourceURI).append("aaiObjectType", aaiObjectType).toString(); + } + + public String getAaiObjectType() { + return aaiObjectType; + } + + public void setAaiObjectType(String aaiObjectType) { + this.aaiObjectType = aaiObjectType; + } + + public boolean isDoesObjectExist() { + return doesObjectExist; + } + + public void setDoesObjectExist(boolean doesObjectExist) { + this.doesObjectExist = doesObjectExist; + } + + public Object getAaiObject() { + return aaiObject; + } + + public void setAaiObject(Object aaiObject) { + this.aaiObject = aaiObject; + } + + public URI getResourceURI() { + return resourceURI; + } + + public void setResourceURI(URI resourceURI) { + this.resourceURI = resourceURI; + } + +} diff --git a/common/src/main/java/org/onap/so/objects/audit/AAIObjectAuditList.java b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAuditList.java new file mode 100644 index 0000000000..675701d598 --- /dev/null +++ b/common/src/main/java/org/onap/so/objects/audit/AAIObjectAuditList.java @@ -0,0 +1,46 @@ +package org.onap.so.objects.audit; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.lang3.builder.ToStringBuilder; + + +public class AAIObjectAuditList implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 6712662349909726930L; + private List<AAIObjectAudit> auditList = new ArrayList<>(); + private String auditType; + private String heatStackName; + + @Override + public String toString() { + return new ToStringBuilder(this).append("auditList", auditList).toString(); + } + + public List<AAIObjectAudit> getAuditList() { + return auditList; + } + + + public String getAuditType() { + return auditType; + } + + + public void setAuditType(String auditType) { + this.auditType = auditType; + } + + public String getHeatStackName() { + return heatStackName; + } + + public void setHeatStackName(String heatStackName) { + this.heatStackName = heatStackName; + } + +} diff --git a/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java index e63e226457..6e2bc97ee9 100644 --- a/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java +++ b/common/src/main/java/org/onap/so/openpojo/rules/EqualsAndHashCodeTester.java @@ -73,9 +73,9 @@ public class EqualsAndHashCodeTester implements Tester { boolean hasEquals = false; boolean hasHashcode = false; for (Method method : methods) { - if (method.getName().equals("equals")) { + if ("equals".equals(method.getName())) { hasEquals = true; - } else if (method.getName().equals("hashCode")) { + } else if ("hashCode".equals(method.getName())) { hasHashcode = true; } } @@ -114,7 +114,7 @@ public class EqualsAndHashCodeTester implements Tester { Affirm.affirmTrue("HashCode test failed for [" + classInstanceOne.getClass().getName() + "]", classInstanceOne.hashCode() == classInstanceTwo.hashCode()); - Affirm.affirmFalse("Expected false for comparison of two unlike objects", classInstanceOne.equals("test")); + Affirm.affirmFalse("Expected false for comparison of two unlike objects", "test".equals(classInstanceOne)); } } diff --git a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java index fc9bb388f4..42dda850f5 100644 --- a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java +++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationMatcher.java @@ -22,7 +22,6 @@ package org.onap.so.openpojo.rules; import static org.hamcrest.CoreMatchers.anything; import java.lang.annotation.Annotation; -import java.lang.reflect.AnnotatedElement; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.TypeSafeDiagnosingMatcher; @@ -65,6 +64,6 @@ public class HasAnnotationMatcher<T extends PojoField> extends TypeSafeDiagnosin public static <T extends PojoField> Matcher<T> hasAnnotation(final Class<? extends Annotation> annotationType, final Matcher<? super T> annotationMatcher) { - return new HasAnnotationMatcher<T>(annotationType, annotationMatcher); + return new HasAnnotationMatcher<>(annotationType, annotationMatcher); } } diff --git a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java index 8a47299c73..a55113b0d0 100644 --- a/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java +++ b/common/src/main/java/org/onap/so/openpojo/rules/HasAnnotationPropertyWithValueMatcher.java @@ -78,6 +78,6 @@ public class HasAnnotationPropertyWithValueMatcher<T extends PojoField> extends public static <T extends PojoField> Matcher<T> hasAnnotationPropertyWithValue(Class<? extends Annotation> clazz, String attribute, final Matcher<?> annotationMatcher) { - return new HasAnnotationPropertyWithValueMatcher<T>(clazz, attribute, annotationMatcher); + return new HasAnnotationPropertyWithValueMatcher<>(clazz, attribute, annotationMatcher); } } diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/CloudRequestData.java b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudRequestData.java new file mode 100644 index 0000000000..abaef26562 --- /dev/null +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/CloudRequestData.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + +package org.onap.so.serviceinstancebeans; + +import org.apache.commons.lang3.builder.ToStringBuilder; + +public class CloudRequestData { + + Object cloudRequest; + String cloudIdentifier; + + public CloudRequestData() {} + + public CloudRequestData(Object cloudRequest, String cloudIdentifier) { + this.cloudRequest = cloudRequest; + this.cloudIdentifier = cloudIdentifier; + } + + public Object getCloudRequest() { + return cloudRequest; + } + + public void setCloudRequest(Object cloudRequest) { + this.cloudRequest = cloudRequest; + } + + public String getCloudIdentifier() { + return cloudIdentifier; + } + + public void setCloudIdentifier(String cloudIdentifier) { + this.cloudIdentifier = cloudIdentifier; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("cloudRequest", cloudRequest).append("cloudIdentifier", cloudIdentifier) + .toString(); + } +} diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java index 53ce3884e9..7c1df67903 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/GetOrchestrationResponse.java @@ -23,7 +23,6 @@ package org.onap.so.serviceinstancebeans; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; @JsonInclude(Include.NON_DEFAULT) public class GetOrchestrationResponse { diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java index 9a184b0a51..6b9b39e5a9 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/ModelType.java @@ -20,9 +20,76 @@ package org.onap.so.serviceinstancebeans; +import java.lang.reflect.InvocationTargetException; +import com.google.common.base.CaseFormat; + /* * Enum for Model Type values returned by API Handler to BPMN */ public enum ModelType { - service, vnf, vfModule, volumeGroup, network, configuration, connectionPoint, pnf, networkInstanceGroup, instanceGroup + service("serviceInstance"), + vnf("vnf"), + vfModule("vfModule"), + volumeGroup("volumeGroup"), + network("network"), + configuration("configuration"), + connectionPoint("connectionPoint"), + pnf("pnf"), + networkInstanceGroup("networkInstanceGroup"), + instanceGroup("instanceGroup"), + vpnBinding("vpnBinding"); + + final String name; + + private ModelType(String name) { + this.name = name; + } + + + public <T> T getId(Object obj) { + return this.get(obj, "Id"); + } + + public <T> T getName(Object obj) { + return this.get(obj, "Name"); + } + + public void setId(Object obj, Object value) { + this.set(obj, "Id", value); + } + + public void setName(Object obj, Object value) { + this.set(obj, "Name", value); + } + + protected <T> T get(Object obj, String field) { + T result = null; + if (obj != null) { + try { + result = (T) obj.getClass().getMethod(String.format("%s%s%s", "get", + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, this.name), field)).invoke(obj); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException + | NoSuchMethodException | SecurityException e) { + // silent fail + } + } + + return result; + } + + protected void set(Object obj, String field, Object value) { + if (obj != null) { + try { + obj.getClass() + .getMethod( + String.format("%s%s%s", "set", + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, this.name), field), + value.getClass()) + .invoke(obj, value); + } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException + | InvocationTargetException e) { + // silent fail + } + } + } } diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java index 8635af5b94..75a6ba8280 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java @@ -20,6 +20,7 @@ package org.onap.so.serviceinstancebeans; +import java.util.ArrayList; import java.util.List; import org.apache.commons.lang3.builder.ToStringBuilder; import com.fasterxml.jackson.annotation.JsonInclude; @@ -34,10 +35,12 @@ public class Request { protected String finishTime; protected String requestScope; protected String requestType; + protected String originalRequestId; protected RequestDetails requestDetails; protected InstanceReferences instanceReferences; protected RequestStatus requestStatus; protected List<RequestProcessingData> requestProcessingData; + protected List<CloudRequestData> cloudRequestData = new ArrayList<>(); public String getRequestId() { @@ -112,12 +115,30 @@ public class Request { this.requestProcessingData = requestProcessingData; } + + public List<CloudRequestData> getCloudRequestData() { + return cloudRequestData; + } + + public void setCloudRequestData(List<CloudRequestData> cloudRequestData) { + this.cloudRequestData = cloudRequestData; + } + + public String getOriginalRequestId() { + return originalRequestId; + } + + public void setOriginalRequestId(String originalRequestId) { + this.originalRequestId = originalRequestId; + } + @Override public String toString() { return new ToStringBuilder(this).append("requestId", requestId).append("startTime", startTime) .append("finishTime", finishTime).append("requestScope", requestScope) .append("requestType", requestType).append("requestDetails", requestDetails) .append("instanceReferences", instanceReferences).append("requestStatus", requestStatus) - .append("requestProcessingData", requestProcessingData).toString(); + .append("requestProcessingData", requestProcessingData).append("cloudRequestData", cloudRequestData) + .append("originalRequestId", originalRequestId).toString(); } } diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java index 1df2c10411..9fceed1641 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestParameters.java @@ -20,11 +20,11 @@ package org.onap.so.serviceinstancebeans; -import java.beans.Transient; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Map; +import org.apache.commons.lang3.builder.ToStringBuilder; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; @@ -52,9 +52,21 @@ public class RequestParameters implements Serializable { private Boolean cascadeDelete; @JsonProperty("testApi") private String testApi; // usePreload would always be true for Update + @JsonProperty("retainAssignments") + private Boolean retainAssignments; // usePreload would always be true for Update @JsonProperty("rebuildVolumeGroups") private Boolean rebuildVolumeGroups; + @Override + public String toString() { + return new ToStringBuilder(this).append("subscriptionServiceType", subscriptionServiceType) + .append("userParams", userParams).append("aLaCarte", aLaCarte).append("payload", payload) + .append("usePreload", usePreload).append("autoBuildVfModules", autoBuildVfModules) + .append("cascadeDelete", cascadeDelete).append("testApi", testApi) + .append("retainAssignments", retainAssignments).append("rebuildVolumeGroups", rebuildVolumeGroups) + .toString(); + } + public String getSubscriptionServiceType() { return subscriptionServiceType; } @@ -150,11 +162,13 @@ public class RequestParameters implements Serializable { this.rebuildVolumeGroups = rebuildVolumeGroups; } - @Override - public String toString() { - return "RequestParameters [subscriptionServiceType=" + subscriptionServiceType + ", userParams=" + userParams - + ", aLaCarte=" + aLaCarte + ", testApi= " + testApi + ", autoBuildVfModules=" + autoBuildVfModules - + ", usePreload=" + usePreload + ", rebuildVolumeGroups=" + rebuildVolumeGroups + ", payload=" + payload - + "]"; + public Boolean getRetainAssignments() { + return retainAssignments; + } + + public void setRetainAssignments(Boolean retainAssignments) { + this.retainAssignments = retainAssignments; } + + } diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java index f239774d57..2123b2f6fc 100644 --- a/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java +++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Resources.java @@ -24,7 +24,6 @@ package org.onap.so.serviceinstancebeans; import java.io.Serializable; import java.util.ArrayList; import java.util.List; -import java.util.Map; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; diff --git a/common/src/main/java/org/onap/so/utils/CryptoUtils.java b/common/src/main/java/org/onap/so/utils/CryptoUtils.java index 09b48d266f..f42fc0111f 100644 --- a/common/src/main/java/org/onap/so/utils/CryptoUtils.java +++ b/common/src/main/java/org/onap/so/utils/CryptoUtils.java @@ -23,6 +23,7 @@ package org.onap.so.utils; +import com.google.common.base.Strings; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; @@ -89,7 +90,7 @@ public final class CryptoUtils { try { return CryptoUtils.encrypt(message, CLOUD_KEY); } catch (GeneralSecurityException e) { - logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_GENERAL_EXCEPTION.toString(), ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); return null; } @@ -99,7 +100,7 @@ public final class CryptoUtils { try { return CryptoUtils.decrypt(message, CLOUD_KEY); } catch (GeneralSecurityException e) { - logger.error("{} {} {}", MessageEnum.RA_GENERAL_EXCEPTION.toString(), + logger.error(Strings.repeat("{} ", 3), MessageEnum.RA_GENERAL_EXCEPTION.toString(), ErrorCode.BusinessProcesssError.getValue(), "Exception in encryptPassword ", e); return null; } diff --git a/common/src/main/java/org/onap/so/utils/TargetEntity.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java index ea0b70413b..0f1fe51114 100644 --- a/common/src/main/java/org/onap/so/utils/TargetEntity.java +++ b/common/src/main/java/org/onap/so/utils/TargetEntity.java @@ -23,7 +23,21 @@ package org.onap.so.utils; import java.util.EnumSet; public enum TargetEntity { - OPENSTACK_ADAPTER, BPMN, GRM, AAI, DMAAP, POLICY, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER, SNIRO, SDC, EXTERNAL, MULTICLOUD, OOF; + OPENSTACK_ADAPTER, + BPMN, + GRM, + AAI, + DMAAP, + POLICY, + CATALOG_DB, + REQUEST_DB, + VNF_ADAPTER, + SDNC_ADAPTER, + SNIRO, + SDC, + EXTERNAL, + MULTICLOUD, + OOF; private static final String PREFIX = "SO"; diff --git a/common/src/main/java/org/onap/so/utils/UUIDChecker.java b/common/src/main/java/org/onap/so/utils/UUIDChecker.java index 585ffcc7c4..6a95334696 100644 --- a/common/src/main/java/org/onap/so/utils/UUIDChecker.java +++ b/common/src/main/java/org/onap/so/utils/UUIDChecker.java @@ -24,6 +24,7 @@ package org.onap.so.utils; import java.util.UUID; +import com.google.common.base.Strings; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,7 +52,7 @@ public class UUIDChecker { public static String getUUID() { String result = UUID.randomUUID().toString(); - logger.info("{} {}", MessageEnum.APIH_GENERATED_REQUEST_ID, result); + logger.info(Strings.repeat("{} ", 2), MessageEnum.APIH_GENERATED_REQUEST_ID, result); return result; } } diff --git a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java index 0022ecbb96..e6acb87eaa 100644 --- a/common/src/main/java/org/onap/so/utils/XmlMarshaller.java +++ b/common/src/main/java/org/onap/so/utils/XmlMarshaller.java @@ -32,6 +32,7 @@ import javax.xml.bind.Marshaller; import javax.xml.bind.Unmarshaller; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.sax.SAXSource; +import com.google.common.base.Strings; import org.onap.so.exceptions.MarshallerException; import org.onap.so.logger.ErrorCode; import org.onap.so.logger.MessageEnum; @@ -52,8 +53,8 @@ public class XmlMarshaller { Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); jaxbMarshaller.marshal(object, stringWriter); } catch (JAXBException e) { - logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(), - e.getMessage(), e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.GENERAL_EXCEPTION.toString(), + ErrorCode.SchemaError.getValue(), e.getMessage(), e); throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e); } @@ -77,8 +78,8 @@ public class XmlMarshaller { SAXSource source = new SAXSource(xmlReader, inputSource); object = jaxbUnmarshaller.unmarshal(source, object.getClass()).getValue(); } catch (Exception e) { - logger.error("{} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), ErrorCode.SchemaError.getValue(), - e.getMessage(), e); + logger.error(Strings.repeat("{} ", 3), MessageEnum.GENERAL_EXCEPTION.toString(), + ErrorCode.SchemaError.getValue(), e.getMessage(), e); throw new MarshallerException(e.getMessage(), ErrorCode.SchemaError.getValue(), e); } diff --git a/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java b/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java deleted file mode 100644 index 4bfac38151..0000000000 --- a/common/src/test/java/org/onap/so/client/dmaap/DmaapPublisherTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei 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.so.client.dmaap; - -import org.junit.Test; -import javax.ws.rs.ProcessingException; -import java.io.IOException; -import java.util.Optional; - -public class DmaapPublisherTest { - - DmaapPublisher dmaapPublisher = new DmaapPublisher(120) { - @Override - public String getAuth() { - return "8F73A1691F6271E769329C176EE3EA48F52786AF12A3E16259007EED2A0F0CC3CB965F4AB5318483015723CCE1C0B48AB6C4DED6E251869393B01E4EC532FC88D4A128B92F4CDB34719B171923"; - } - - @Override - public String getKey() { - return "07a7159d3bf51a0e53be7a8f89699be7"; - } - - @Override - public String getTopic() { - return "test"; - } - - @Override - public Optional<String> getHost() { - return Optional.of("http://test"); - } - }; - - public DmaapPublisherTest() throws IOException {} - - @Test(expected = ProcessingException.class) - public void sendTest() throws Exception { - dmaapPublisher.send("{'key': 'value'}"); - } - -} diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java b/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java new file mode 100644 index 0000000000..e4b694cd15 --- /dev/null +++ b/common/src/test/java/org/onap/so/serviceinstancebeans/ModelTypeTest.java @@ -0,0 +1,38 @@ +package org.onap.so.serviceinstancebeans; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import org.junit.Test; + +public class ModelTypeTest { + + + + @Test + public void reflectionTest() { + TestServiceInstanceBean a = new TestServiceInstanceBean(); + TestServiceInstanceBean b = new TestServiceInstanceBean(); + + a.setServiceInstanceId("my-id-a"); + a.setServiceInstanceName("my-name-a"); + + b.setServiceInstanceId("my-id-b"); + b.setServiceInstanceName("my-name-b"); + + assertEquals("my-id-a", ModelType.service.getId(a)); + assertEquals("my-name-a", ModelType.service.getName(a)); + ModelType.service.setName(a, ModelType.service.getName(b)); + ModelType.service.setId(a, ModelType.service.getId(b)); + assertEquals("my-name-b", ModelType.service.getName(a)); + assertEquals("my-id-b", ModelType.service.getId(a)); + } + + @Test + public void testSilentFail() { + TestServiceInstanceBean a = new TestServiceInstanceBean(); + + a.setServiceInstanceId("my-id-a"); + a.setServiceInstanceName("my-name-a"); + assertNull(ModelType.service.get(a, "NoField")); + } +} diff --git a/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java b/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java new file mode 100644 index 0000000000..b8cf6141e3 --- /dev/null +++ b/common/src/test/java/org/onap/so/serviceinstancebeans/TestServiceInstanceBean.java @@ -0,0 +1,24 @@ +package org.onap.so.serviceinstancebeans; + +public class TestServiceInstanceBean { + + private String serviceInstanceId; + private String serviceInstanceName; + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getServiceInstanceName() { + return serviceInstanceName; + } + + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + +} |