aboutsummaryrefslogtreecommitdiffstats
path: root/common/src
diff options
context:
space:
mode:
Diffstat (limited to 'common/src')
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java2
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java2
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java10
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java8
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/EndPoint.java17
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java18
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java103
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java1
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java91
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java2
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java9
-rw-r--r--common/src/main/java/org/onap/so/client/AddCacheHeaders.java28
-rw-r--r--common/src/main/java/org/onap/so/client/CacheFactory.java25
-rw-r--r--common/src/main/java/org/onap/so/client/CacheProperties.java13
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java14
-rw-r--r--common/src/main/java/org/onap/so/client/RestClientSSL.java4
-rw-r--r--common/src/main/java/org/onap/so/client/RestProperties.java8
-rw-r--r--common/src/test/java/org/onap/so/client/RestClientTest.java4
-rw-r--r--common/src/test/resources/logback-test.xml91
19 files changed, 259 insertions, 191 deletions
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
index dc8e69121e..f966098b18 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateAnNssi.java
@@ -47,5 +47,5 @@ public class AllocateAnNssi implements Serializable {
private NsiInfo nsiInfo;
- private Map<String, Object> endPoint;
+ private EndPoint endPoint;
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java
index f5b926f627..fdbff2fd42 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AllocateCnNssi.java
@@ -49,5 +49,5 @@ public class AllocateCnNssi implements Serializable {
private NsiInfo nsiInfo;
- private Map<String, Object> endPoint;
+ private EndPoint endPoint;
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
index 14918c7873..3d0f70805c 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
@@ -32,7 +32,7 @@ import java.util.List;
@ToString
public class AnSliceProfile implements Serializable {
/*
- * Reference 3GPP TS 28.541 V16.5.0, Section 6.3.4.
+ * Reference 3GPP TS 28.541 V16.5.0.
*/
private static final long serialVersionUID = -3057342171549542794L;
@@ -40,10 +40,10 @@ public class AnSliceProfile implements Serializable {
@JsonProperty(value = "sliceProfileId", required = true)
private String sliceProfileId;
- @JsonProperty(value = "sNSSAIList", required = true)
+ @JsonProperty(value = "snssaiList", required = true)
private List<String> sNSSAIList;
- @JsonProperty(value = "pLMNIdList", required = true)
+ @JsonProperty(value = "plmnIdList", required = true)
private List<String> pLMNIdList;
@JsonProperty(value = "perfReq", required = true)
@@ -51,7 +51,7 @@ public class AnSliceProfile implements Serializable {
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
@JsonProperty(value = "maxNumberofUEs")
- private long maxNumberofUEs;
+ private int maxNumberOfUEs;
@JsonProperty(value = "coverageAreaTAList")
private List<Integer> coverageAreaTAList;
@@ -61,7 +61,7 @@ public class AnSliceProfile implements Serializable {
private int latency;
@JsonProperty(value = "uEMobilityLevel")
- private UeMobilityLevel uEMobilityLevel;
+ private UeMobilityLevel ueMobilityLevel;
@JsonProperty(value = "resourceSharingLevel")
private ResourceSharingLevel resourceSharingLevel;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
index 3a45119195..efb447bc00 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
@@ -38,13 +38,13 @@ public class CnSliceProfile implements Serializable {
private String sliceProfileId;
@JsonProperty(value = "plmnIdList", required = true)
- private List<String> plmnIdList;
+ private List<String> pLMNIdList;
@JsonProperty(value = "perfReq", required = true)
private PerfReq perfReq;
@JsonProperty(value = "maxNumberofUEs")
- private int maxNumberofUEs;
+ private int maxNumberOfUEs;
@JsonProperty(value = "coverageAreaTAList")
private List<String> coverageAreaTAList;
@@ -57,4 +57,8 @@ public class CnSliceProfile implements Serializable {
@JsonProperty(value = "resourceSharingLevel")
private ResourceSharingLevel resourceSharingLevel;
+
+ @JsonProperty(value = "maxNumberofPDUSession")
+ private int maxNumberOfPDUSession;
+
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/EndPoint.java b/common/src/main/java/org/onap/so/beans/nsmf/EndPoint.java
index dab9b3a990..90bfc0eae0 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/EndPoint.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/EndPoint.java
@@ -20,17 +20,28 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.AllArgsConstructor;
import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
import java.io.Serializable;
-import java.util.Map;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
public class EndPoint implements Serializable {
private static final long serialVersionUID = 2479795890807020491L;
- private String nodeId;
+ @JsonProperty(value = "ipAddress")
+ private String ipAddress;
- private Map<String, Object> additionalInfo;
+ @JsonProperty(value = "logicInterfaceId")
+ private String logicInterfaceId;
+
+ @JsonProperty(value = "nextHopInfo")
+ private String nextHopInfo;
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java b/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java
index 92acdaa90d..270a55e349 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssiResponse.java
@@ -21,9 +21,11 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
+@Data
public class NssiResponse implements Serializable {
private static final long serialVersionUID = 2723440188640857903L;
@@ -32,19 +34,5 @@ public class NssiResponse implements Serializable {
private String jobId;
- public String getNssiId() {
- return nssiId;
- }
-
- public void setNssiId(String nssiId) {
- this.nssiId = nssiId;
- }
-
- public String getJobId() {
- return jobId;
- }
-
- public void setJobId(String jobId) {
- this.jobId = jobId;
- }
+ private String status;
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java
index 9e4b4edce3..06f97a8484 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqUrllc.java
@@ -21,118 +21,31 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import lombok.Data;
import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
+@Data
public class PerfReqUrllc implements Serializable {
private static final long serialVersionUID = 3133479142915485943L;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
- private int e2eLatency;
+ private String survivalTime;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
- private int jitter;
-
- @JsonInclude(JsonInclude.Include.NON_DEFAULT)
- private int survivalTime;
-
- @JsonInclude(JsonInclude.Include.NON_DEFAULT)
- private float csAvailability;
+ private int expDataRate;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
- private float reliability;
+ private String transferIntervalTarget;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
- private int expDataRate;
-
- private String payloadSize;
+ private String msgSizeByte;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
- private int trafficDensity;
+ private String csReliabilityMeanTime;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
- private int connDensity;
-
- private String serviceAreaDimension;
-
- public int getE2eLatency() {
- return e2eLatency;
- }
-
- public void setE2eLatency(int e2eLatency) {
- this.e2eLatency = e2eLatency;
- }
-
- public int getJitter() {
- return jitter;
- }
-
- public void setJitter(int jitter) {
- this.jitter = jitter;
- }
-
- public int getSurvivalTime() {
- return survivalTime;
- }
-
- public void setSurvivalTime(int survivalTime) {
- this.survivalTime = survivalTime;
- }
-
- public float getReliability() {
- return reliability;
- }
-
- public void setReliability(float reliability) {
- this.reliability = reliability;
- }
-
- public int getExpDataRate() {
- return expDataRate;
- }
-
- public void setExpDataRate(int expDataRate) {
- this.expDataRate = expDataRate;
- }
-
- public String getPayloadSize() {
- return payloadSize;
- }
-
- public void setPayloadSize(String payloadSize) {
- this.payloadSize = payloadSize;
- }
-
- public int getTrafficDensity() {
- return trafficDensity;
- }
-
- public void setTrafficDensity(int trafficDensity) {
- this.trafficDensity = trafficDensity;
- }
-
- public int getConnDensity() {
- return connDensity;
- }
-
- public void setConnDensity(int connDensity) {
- this.connDensity = connDensity;
- }
-
- public String getServiceAreaDimension() {
- return serviceAreaDimension;
- }
-
- public void setServiceAreaDimension(String serviceAreaDimension) {
- this.serviceAreaDimension = serviceAreaDimension;
- }
-
- public float getCsAvailability() {
- return csAvailability;
- }
+ private float csAvailabilityTarget;
- public void setCsAvailability(float csAvailability) {
- this.csAvailability = csAvailability;
- }
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java b/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
index 2456d540ce..17ef210c4e 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/ResponseDescriptor.java
@@ -31,7 +31,6 @@ public class ResponseDescriptor implements Serializable {
private static final long serialVersionUID = 6330527958947215910L;
- @JsonInclude(JsonInclude.Include.NON_DEFAULT)
private int progress;
private String status;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
index ad6eec1c01..90cee2794a 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
@@ -25,7 +25,9 @@ import lombok.Data;
import lombok.ToString;
import org.springframework.beans.BeanUtils;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
@Data
@ToString
@@ -43,7 +45,7 @@ public class SliceProfileAdapter implements Serializable {
private String pLMNIdList = "";
@JsonProperty(value = "maxNumberofUEs")
- private long maxNumberofUEs;
+ private int maxNumberOfUEs;
@JsonProperty(value = "coverageAreaTAList")
private String coverageAreaTAList = "";
@@ -52,23 +54,68 @@ public class SliceProfileAdapter implements Serializable {
private int latency;
@JsonProperty(value = "uEMobilityLevel")
- private String uEMobilityLevel;
+ private String ueMobilityLevel;
@JsonProperty(value = "resourceSharingLevel")
private String resourceSharingLevel;
@JsonProperty(value = "maxBandwidth")
- private String bandwidth;
+ private int maxBandwidth;
@JsonProperty(value = "sST")
private String sST;
@JsonProperty(value = "activityFactor")
- private String activityFactor;
+ private int activityFactor;
@JsonProperty(value = "survivalTime")
private String survivalTime;
+ @JsonProperty(value = "expDataRateUL")
+ private int expDataRateUL;
+
+ @JsonProperty(value = "expDataRateDL")
+ private int expDataRateDL;
+
+ @JsonProperty(value = "areaTrafficCapUL")
+ private int areaTrafficCapUL;
+
+ @JsonProperty(value = "areaTrafficCapDL")
+ private int areaTrafficCapDL;
+
+ @JsonProperty(value = "jitter")
+ private int jitter;
+
+ @JsonProperty(value = "csAvailabilityTarget")
+ private float csAvailabilityTarget;
+
+ @JsonProperty(value = "expDataRate")
+ private int expDataRate;
+
+ @JsonProperty(value = "maxNumberofPDUSession")
+ private int maxNumberOfPDUSession;
+
+ @JsonProperty(value = "overallUserDensity")
+ private int overallUserDensity;
+
+ @JsonProperty(value = "cSReliabilityMeanTime")
+ private String csReliabilityMeanTime;
+
+ @JsonProperty(value = "msgSizeByte")
+ private String msgSizeByte;
+
+ @JsonProperty(value = "transferIntervalTarget")
+ private String transferIntervalTarget;
+
+ @JsonProperty(value = "ipAddress")
+ private String ipAddress;
+
+ @JsonProperty(value = "logicInterfaceId")
+ private String logicInterfaceId;
+
+ @JsonProperty(value = "nextHopInfo")
+ private String nextHopInfo;
+
public AnSliceProfile trans2AnProfile() {
AnSliceProfile anSliceProfile = new AnSliceProfile();
BeanUtils.copyProperties(this, anSliceProfile);
@@ -81,16 +128,16 @@ public class SliceProfileAdapter implements Serializable {
areasRes[i] = str2Code(areas[i]);
}
anSliceProfile.setCoverageAreaTAList(Arrays.asList(areasRes));
- anSliceProfile.setUEMobilityLevel(UeMobilityLevel.fromString(this.uEMobilityLevel));
+
+ anSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(this.ueMobilityLevel));
anSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(this.resourceSharingLevel));
- PerfReq perfReq = new PerfReq();
- // todo
- anSliceProfile.setPerfReq(perfReq);
+ anSliceProfile.setPerfReq(generatePerfReq());
+
return anSliceProfile;
}
private Integer str2Code(String area) {
- return Math.abs(area.hashCode() >> 16);
+ return area.hashCode() >> 16;
}
public CnSliceProfile trans2CnProfile() {
@@ -98,15 +145,31 @@ public class SliceProfileAdapter implements Serializable {
BeanUtils.copyProperties(this, cnSliceProfile);
cnSliceProfile.setSnssaiList(Arrays.asList(this.sNSSAIList.split("\\|")));
cnSliceProfile.setCoverageAreaTAList(Arrays.asList(this.coverageAreaTAList.split("\\|")));
- cnSliceProfile.setPlmnIdList(Arrays.asList(this.pLMNIdList.split("\\|")));
+ cnSliceProfile.setPLMNIdList(Arrays.asList(this.pLMNIdList.split("\\|")));
cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(this.resourceSharingLevel));
- cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(this.uEMobilityLevel));
- PerfReq perfReq = new PerfReq();
- // todo
- cnSliceProfile.setPerfReq(perfReq);
+
+ cnSliceProfile.setPerfReq(generatePerfReq());
return cnSliceProfile;
}
+ private PerfReq generatePerfReq() {
+ PerfReq perfReq = new PerfReq();
+ if ("embb".equalsIgnoreCase(sST)) {
+ List<PerfReqEmbb> perfReqEmbbs = new ArrayList<>();
+ PerfReqEmbb perfReqEmbb = new PerfReqEmbb();
+ BeanUtils.copyProperties(this, perfReqEmbb);
+ perfReqEmbbs.add(perfReqEmbb);
+ perfReq.setPerfReqEmbbList(perfReqEmbbs);
+ } else if ("ullc".equalsIgnoreCase(sST)) {
+ List<PerfReqUrllc> perfReqUrllcs = new ArrayList<>();
+ PerfReqUrllc perfReqUrllc = new PerfReqUrllc();
+ BeanUtils.copyProperties(this, perfReqUrllc);
+ perfReqUrllcs.add(perfReqUrllc);
+ perfReq.setPerfReqUrllcList(perfReqUrllcs);
+ }
+ return perfReq;
+ }
+
public TnSliceProfile trans2TnProfile() {
TnSliceProfile tnSliceProfile = new TnSliceProfile();
BeanUtils.copyProperties(this, tnSliceProfile);
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java
index 9b6406d57f..18d6007176 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskInfo.java
@@ -52,4 +52,6 @@ public class SliceTaskInfo<T> implements Serializable {
private SubnetType subnetType;
+ private String endPointId;
+
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
index 3f0da1bf21..f904e1c466 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
@@ -35,14 +35,17 @@ public class TnSliceProfile implements Serializable {
private String sliceProfileId;
@JsonProperty(value = "maxBandwidth")
- private String bandwidth;
+ private int maxBandwidth;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
private int latency;
- @JsonProperty(value = "sNSSAIList", required = true)
+ @JsonProperty(value = "snssaiList", required = true)
private List<String> sNSSAIList;
- @JsonProperty(value = "pLMNIdList", required = true)
+ @JsonProperty(value = "plmnIdList", required = true)
private List<String> pLMNIdList;
+
+ @JsonProperty(value = "jitter")
+ private int jitter;
}
diff --git a/common/src/main/java/org/onap/so/client/AddCacheHeaders.java b/common/src/main/java/org/onap/so/client/AddCacheHeaders.java
new file mode 100644
index 0000000000..1a41be1233
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/AddCacheHeaders.java
@@ -0,0 +1,28 @@
+package org.onap.so.client;
+
+import java.io.IOException;
+import java.util.Collections;
+import javax.annotation.Priority;
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.ext.Provider;
+
+@Provider
+@Priority(1)
+public class AddCacheHeaders implements ClientResponseFilter {
+
+ private final CacheProperties props;
+
+ public AddCacheHeaders(CacheProperties props) {
+ this.props = props;
+ }
+
+ public void filter(ClientRequestContext request, ClientResponseContext response) throws IOException {
+ if (request.getMethod().equalsIgnoreCase("GET")) {
+ response.getHeaders().putIfAbsent("Cache-Control",
+ Collections.singletonList("public, max-age=" + (props.getMaxAge() / 1000)));
+ }
+
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/CacheFactory.java b/common/src/main/java/org/onap/so/client/CacheFactory.java
new file mode 100644
index 0000000000..6bc4858463
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/CacheFactory.java
@@ -0,0 +1,25 @@
+package org.onap.so.client;
+
+
+import java.util.concurrent.TimeUnit;
+import javax.cache.configuration.Factory;
+import javax.cache.expiry.Duration;
+import javax.cache.expiry.ExpiryPolicy;
+import javax.cache.expiry.TouchedExpiryPolicy;
+
+public class CacheFactory implements Factory<ExpiryPolicy> {
+
+ private static final long serialVersionUID = 8948728679233836929L;
+
+ private final CacheProperties props;
+
+ public CacheFactory(CacheProperties props) {
+ this.props = props;
+ }
+
+ @Override
+ public ExpiryPolicy create() {
+ return TouchedExpiryPolicy.factoryOf(new Duration(TimeUnit.MILLISECONDS, props.getMaxAge())).create();
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/CacheProperties.java b/common/src/main/java/org/onap/so/client/CacheProperties.java
new file mode 100644
index 0000000000..4fb2a87a5b
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/CacheProperties.java
@@ -0,0 +1,13 @@
+package org.onap.so.client;
+
+public interface CacheProperties {
+
+
+ default Long getMaxAge() {
+ return 60000L;
+ }
+
+ default String getCacheName() {
+ return "default-http-cache";
+ }
+}
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 9fce328b1d..be0a0f3f9e 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -188,8 +188,20 @@ public abstract class RestClient {
return APPLICATION_MERGE_PATCH_JSON;
}
+ protected ClientBuilder getClientBuilder() {
+ ClientBuilder builder = ClientBuilder.newBuilder();
+ if (props.isCachingEnabled()) {
+ enableCaching(builder);
+ }
+ return builder.readTimeout(props.getReadTimeout(), TimeUnit.MILLISECONDS);
+ }
+
+ protected ClientBuilder enableCaching(ClientBuilder builder) {
+ return builder;
+ }
+
protected Client getClient() {
- return ClientBuilder.newBuilder().readTimeout(props.getReadTimeout(), TimeUnit.MILLISECONDS).build();
+ return getClientBuilder().build();
}
protected abstract ONAPComponentsList getTargetEntity();
diff --git a/common/src/main/java/org/onap/so/client/RestClientSSL.java b/common/src/main/java/org/onap/so/client/RestClientSSL.java
index 8956e20a5a..c6252e4652 100644
--- a/common/src/main/java/org/onap/so/client/RestClientSSL.java
+++ b/common/src/main/java/org/onap/so/client/RestClientSSL.java
@@ -24,7 +24,6 @@ import java.net.URI;
import java.security.KeyStore;
import java.security.NoSuchAlgorithmException;
import java.util.Optional;
-import java.util.concurrent.TimeUnit;
import javax.net.ssl.SSLContext;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
@@ -57,8 +56,7 @@ public abstract class RestClientSSL extends RestClient {
}
}
// Use default SSL context
- client = ClientBuilder.newBuilder().sslContext(SSLContext.getDefault())
- .readTimeout(props.getReadTimeout(), TimeUnit.MILLISECONDS).build();
+ client = getClientBuilder().sslContext(SSLContext.getDefault()).build();
logger.info("RestClientSSL using default SSL context!");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
diff --git a/common/src/main/java/org/onap/so/client/RestProperties.java b/common/src/main/java/org/onap/so/client/RestProperties.java
index 36da424f93..a7a0ef614c 100644
--- a/common/src/main/java/org/onap/so/client/RestProperties.java
+++ b/common/src/main/java/org/onap/so/client/RestProperties.java
@@ -49,4 +49,12 @@ public interface RestProperties {
public default Long getReadTimeout() {
return Long.valueOf(60000);
}
+
+ public default boolean isCachingEnabled() {
+ return false;
+ }
+
+ public default CacheProperties getCacheProperties() {
+ return new CacheProperties() {};
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/RestClientTest.java b/common/src/test/java/org/onap/so/client/RestClientTest.java
index c6e282c14a..d40576b69f 100644
--- a/common/src/test/java/org/onap/so/client/RestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/RestClientTest.java
@@ -49,6 +49,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.logging.filter.base.ONAPComponents;
import org.onap.logging.filter.base.ONAPComponentsList;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
+import com.github.tomakehurst.wiremock.extension.responsetemplating.ResponseTemplateTransformer;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
@RunWith(MockitoJUnitRunner.class)
@@ -61,7 +62,8 @@ public class RestClientTest {
public ExpectedException thrown = ExpectedException.none();
@Rule
- public WireMockRule wireMockRule = new WireMockRule(WireMockConfiguration.options().dynamicPort());
+ public WireMockRule wireMockRule = new WireMockRule(
+ WireMockConfiguration.options().dynamicPort().extensions(new ResponseTemplateTransformer(false)));
@Test
public void retries() throws Exception {
diff --git a/common/src/test/resources/logback-test.xml b/common/src/test/resources/logback-test.xml
index b52e6be022..3c5f259817 100644
--- a/common/src/test/resources/logback-test.xml
+++ b/common/src/test/resources/logback-test.xml
@@ -19,61 +19,60 @@
-->
<configuration>
- <property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}"/>
- <property name="p_lvl" value="%level"/>
- <property name="p_log" value="%logger"/>
- <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}"/>
- <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}"/>
- <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}"/>
- <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}"/>
- <property name="p_thr" value="%thread"/>
- <property name="pattern" value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n"/>
+ <property name="p_tim" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;, UTC}" />
+ <property name="p_lvl" value="%level" />
+ <property name="p_log" value="%logger" />
+ <property name="p_mdc" value="%replace(%replace(%mdc){'\t','\\\\t'}){'\n', '\\\\n'}" />
+ <property name="p_msg" value="%replace(%replace(%msg){'\t', '\\\\t'}){'\n','\\\\n'}" />
+ <property name="p_exc" value="%replace(%replace(%rootException){'\t', '\\\\t'}){'\n','\\\\n'}" />
+ <property name="p_mak" value="%replace(%replace(%marker){'\t', '\\\\t'}){'\n','\\\\n'}" />
+ <property name="p_thr" value="%thread" />
+ <property name="pattern"
+ value="%nopexception${p_tim}\t${p_thr}\t${p_lvl}\t${p_log}\t${p_mdc}\t${p_msg}\t${p_exc}\t${p_mak}\t%n" />
- <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>${pattern}</pattern>
- </encoder>
- </appender>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>${pattern}</pattern>
+ </encoder>
+ </appender>
- <appender name="test"
- class="org.onap.so.utils.TestAppender" />
+ <appender name="test" class="org.onap.so.utils.TestAppender" />
- <logger name="com.att.ecomp.audit" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
+ <logger name="com.att.ecomp.audit" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
- <logger name="com.att.eelf.metrics" level="info" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
+ <logger name="com.att.eelf.metrics" level="info" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
- <logger name="com.att.eelf.error" level="WARN" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
+ <logger name="com.att.eelf.error" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
- <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="test" />
- </logger>
-
- <logger name="org.flywaydb" level="DEBUG" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
+ <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </logger>
- <logger name="ch.vorburger" level="WARN" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
- <logger name="org.reflections" level="ERROR" additivity="false">
- <appender-ref ref="STDOUT" />
- </logger>
-
+ <logger name="org.flywaydb" level="DEBUG" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
- <root level="WARN">
- <appender-ref ref="STDOUT" />
- <appender-ref ref="test" />
- </root>
+
+ <logger name="ch.vorburger" level="WARN" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="org.reflections" level="ERROR" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <root level="WARN">
+ <appender-ref ref="STDOUT" />
+ <appender-ref ref="test" />
+ </root>
</configuration> \ No newline at end of file