aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorAlexis de Talhouët <adetalhouet89@gmail.com>2019-02-26 11:26:03 -0500
committerAlexis de Talhouët <adetalhouet89@gmail.com>2019-02-26 17:03:45 -0500
commitf07c74c83343da4a8751d7f45fb1edcd111e3647 (patch)
treed6dc716c2a5bcd6e9666d3bfc348c79c7e3428a5 /bpmn
parent1212fa1a4b33c76d5cc01ebd1cc438a3e3bc433a (diff)
Add CDS client
Change-Id: I3f77a2c9e8341239b97675f5897cecf28c7dfb6f Issue-ID: SO-1483 Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java66
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties1
3 files changed, 82 insertions, 9 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java
index deae46ce98..adf1dc01c0 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java
@@ -7,9 +7,9 @@
* 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.
@@ -24,6 +24,8 @@ import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.client.aai.AAIQueryClient;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.cds.CDSProcessingClient;
+import org.onap.so.client.cds.CDSProcessingListener;
import org.onap.so.client.policy.PolicyClientImpl;
import org.onap.so.client.sdno.SDNOValidator;
import org.onap.so.client.sdno.SDNOValidatorImpl;
@@ -32,14 +34,14 @@ import org.springframework.stereotype.Component;
/*
* This object is intended to be a helper for acquiring classes
* that cannot be acquired via Spring injection.
- *
+ *
* It brings two benefits:
- *
+ *
* 1) Enforces acquisition of a new copy of these classes every
* time to help with picking up properties files changes, etc
* 2) The classes are exposed in such a way that mocks of them can
* still be injected when testing the Spring objects that use
- * them
+ * them
*/
@Component
@@ -47,11 +49,11 @@ public class InjectionHelper {
public AAIResourcesClient getAaiClient() {
return new AAIResourcesClient();
}
-
+
public AAIQueryClient getAaiQueryClient() {
return new AAIQueryClient();
}
-
+
public SDNOValidator getSdnoValidator() {
return new SDNOValidatorImpl();
}
@@ -59,12 +61,16 @@ public class InjectionHelper {
public AAICommonObjectMapperProvider getAaiCommonObjectMapperProvider() {
return new AAICommonObjectMapperProvider();
}
-
+
public AAIResultWrapper getAaiResultWrapper(String json) {
return new AAIResultWrapper(json);
}
-
+
public PolicyClientImpl getPolicyClient() {
return new PolicyClientImpl();
}
+
+ public CDSProcessingClient getCdsClient(CDSProcessingListener listener) {
+ return new CDSProcessingClient(listener);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
new file mode 100644
index 0000000000..b8ab588a75
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
+ * 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.
+ */
+package org.onap.so.client.restproperties;
+
+import java.net.URL;
+import java.util.Objects;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.client.cds.CDSProperties;
+
+public class CDSPropertiesImpl implements CDSProperties {
+
+ private static final String ENDPOINT = "cds.endpoint";
+ private static final String PORT = "cds.port";
+
+ public CDSPropertiesImpl() {
+ // Needed for service loader
+ }
+
+ @Override
+ public String getHost() {
+ return Objects.requireNonNull(UrnPropertiesReader.getVariable(ENDPOINT));
+ }
+
+ @Override
+ public int getPort() {
+ return Integer.parseInt(Objects.requireNonNull(UrnPropertiesReader.getVariable(PORT)));
+ }
+
+ @Override
+ public URL getEndpoint() {
+ return null;
+ }
+
+ @Override
+ public String getSystemName() {
+ return "MSO";
+ }
+
+ @Override
+ public Integer getRetries() {
+ return null;
+ }
+
+ @Override
+ public Long getDelayBetweenRetries() {
+ return null;
+ }
+
+ @Override
+ public boolean mapNotFoundToEmpty() {
+ return false;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
index bdc72c86a4..27da189456 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
+++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/services/org.onap.so.client.RestProperties
@@ -1,2 +1,3 @@
org.onap.so.client.restproperties.AAIPropertiesImpl
+org.onap.so.client.restproperties.CDSPropertiesImpl
org.onap.so.client.restproperties.PolicyRestPropertiesImpl \ No newline at end of file