summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-04-10 10:56:29 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-10 10:56:29 +0000
commitcace90c7b774f6d80e4b9e2a4fdf0cac192f1096 (patch)
tree670462fe0ddc79031669a3f7c6a090301bb40f1c
parent85f13e967a72a403af11cc0227996256a1495f40 (diff)
parent65e1358e0b4e4f44969db81bcb347e6722d81b08 (diff)
Merge "Implement interface to SDC for ActivitySpec"
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java123
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java67
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/ActivitySpec.java99
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/ActivitySpecCreateResponse.java61
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/Input.java61
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/Output.java73
-rw-r--r--asdc-controller/src/test/java/org/onap/asdc/activity/ActivitySpecsActionsTest.java76
-rw-r--r--asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java38
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java1
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/BeansTest.java70
-rw-r--r--asdc-controller/src/test/resources/application-test.yaml2
11 files changed, 671 insertions, 0 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
new file mode 100644
index 0000000000..c80e84b574
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.asdc.activity;
+
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import org.apache.http.HttpStatus;
+import org.apache.http.entity.ContentType;
+import org.onap.so.asdc.activity.beans.ActivitySpec;
+import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse;
+import org.onap.so.client.HttpClient;
+import org.onap.so.client.HttpClientFactory;
+import org.onap.so.utils.TargetEntity;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.net.URL;
+
+@Component
+public class ActivitySpecsActions {
+
+ private static final String ACTIVITY_SPEC_URI = "/v1.0/activity-spec";
+ private static final String ACTIVITY_SPEC_URI_SUFFIX = "/versions/latest/actions";
+ private static final String CERTIFY_ACTIVITY_PAYLOAD = "{\"action\": \"CERTIFY\"}";
+
+ private final HttpClientFactory httpClientFactory = new HttpClientFactory();
+ protected static final Logger logger = LoggerFactory.getLogger(ActivitySpecsActions.class);
+
+ public String createActivitySpec(String hostname, ActivitySpec activitySpec) {
+ if (activitySpec == null) {
+ return null;
+ }
+
+ String activitySpecId = null;
+
+ try {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.setSerializationInclusion(Include.NON_NULL);
+ String payload = mapper.writer().writeValueAsString(activitySpec);
+
+ String urlString = UriBuilder.fromUri(hostname).path(ACTIVITY_SPEC_URI).build().toString();
+ URL url = new URL(urlString);
+
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC);
+ httpClient.addAdditionalHeader("Content-Type", ContentType.APPLICATION_JSON.toString());
+
+ Response response = httpClient.post(payload);
+
+ int statusCode = response.getStatus();
+ if (statusCode != HttpStatus.SC_OK) {
+ logger.warn("{} {} {}", "Error creating activity spec", activitySpec.getName(), statusCode);
+ } else {
+ if (response.getEntity() != null) {
+ ActivitySpecCreateResponse activitySpecCreateResponse =
+ response.readEntity(ActivitySpecCreateResponse.class);
+ if (activitySpecCreateResponse != null) {
+ activitySpecId = activitySpecCreateResponse.getId();
+ } else {
+ logger.warn("{} {}", "Unable to read activity spec", activitySpec.getName());
+ }
+ } else {
+ logger.warn("{} {}", "No activity spec response returned", activitySpec.getName());
+ }
+ }
+ } catch (Exception e) {
+ logger.warn("{} {}", "Exception creating activitySpec", e.getMessage());
+ }
+
+ return activitySpecId;
+ }
+
+ public boolean certifyActivitySpec(String hostname, String activitySpecId) {
+ boolean certificationResult = false;
+ if (activitySpecId == null) {
+ return false;
+ }
+
+ try {
+ String path = ACTIVITY_SPEC_URI + "/" + activitySpecId + ACTIVITY_SPEC_URI_SUFFIX;
+
+ String urlString = UriBuilder.fromUri(hostname).path(path).build().toString();
+ URL url = new URL(urlString);
+
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC);
+ httpClient.addAdditionalHeader("Content-Type", ContentType.APPLICATION_JSON.toString());
+
+ Response response = httpClient.put(CERTIFY_ACTIVITY_PAYLOAD);
+
+ int statusCode = response.getStatus();
+
+ if (statusCode != HttpStatus.SC_OK) {
+ logger.warn("{} {} {}", "Error certifying activity", activitySpecId, statusCode);
+ } else {
+ certificationResult = true;
+ }
+
+ } catch (Exception e) {
+ logger.warn("{} {}", "Exception certifying activitySpec", e.getMessage());
+ }
+
+ return certificationResult;
+ }
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
new file mode 100644
index 0000000000..46d0f78e35
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.asdc.activity;
+
+import javax.annotation.PostConstruct;
+import java.util.ArrayList;
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+import org.onap.so.asdc.activity.beans.ActivitySpec;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Component
+public class DeployActivitySpecs {
+ @Autowired
+ private ActivitySpecsActions activitySpecsActions;
+
+ @Autowired
+ private Environment env;
+
+ private static final String SDC_ENDPOINT = "mso.asdc.config.activity.endpoint";
+
+ protected static final Logger logger = LoggerFactory.getLogger(DeployActivitySpecs.class);
+
+ public void deployActivities() throws Exception {
+ String hostname = this.env.getProperty(SDC_ENDPOINT);
+ List<ActivitySpec> activitySpecs = new ArrayList<ActivitySpec>();
+
+ // Initialize activitySpecs from Catalog DB
+
+ for (ActivitySpec activitySpec : activitySpecs) {
+ String activitySpecId = activitySpecsActions.createActivitySpec(hostname, activitySpec);
+ if (activitySpecId != null) {
+ logger.info("{} {}", "Successfully created activitySpec", activitySpec.getName());
+ boolean certificationResult = activitySpecsActions.certifyActivitySpec(hostname, activitySpecId);
+ if (certificationResult) {
+ logger.info("{} {}", "Successfully certified activitySpec", activitySpec.getName());
+ } else {
+ logger.info("{} {}", "Failed to certify activitySpec", activitySpec.getName());
+ }
+ } else {
+ logger.info("{} {}", "Failed to create activitySpec", activitySpec.getName());
+ }
+ }
+ }
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/ActivitySpec.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/ActivitySpec.java
new file mode 100644
index 0000000000..e7d1ff15ab
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/ActivitySpec.java
@@ -0,0 +1,99 @@
+/*-
+ * ============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.asdc.activity.beans;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"name", "description", "categoryList", "inputs", "outputs"})
+public class ActivitySpec {
+
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("description")
+ private String description;
+ @JsonProperty("categoryList")
+ private List<String> categoryList = null;
+ @JsonProperty("inputs")
+ private List<Input> inputs = null;
+ @JsonProperty("outputs")
+ private List<Output> outputs = null;
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("description")
+ public String getDescription() {
+ return description;
+ }
+
+ @JsonProperty("description")
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @JsonProperty("categoryList")
+ public List<String> getCategoryList() {
+ return categoryList;
+ }
+
+ @JsonProperty("categoryList")
+ public void setCategoryList(List<String> categoryList) {
+ this.categoryList = categoryList;
+ }
+
+ @JsonProperty("inputs")
+ public List<Input> getInputs() {
+ return inputs;
+ }
+
+ @JsonProperty("inputs")
+ public void setInputs(List<Input> inputs) {
+ this.inputs = inputs;
+ }
+
+ @JsonProperty("outputs")
+ public List<Output> getOutputs() {
+ return outputs;
+ }
+
+ @JsonProperty("outputs")
+ public void setOutputs(List<Output> outputs) {
+ this.outputs = outputs;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("name", name).append("description", description)
+ .append("categoryList", categoryList).append("inputs", inputs).append("outputs", outputs).toString();
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/ActivitySpecCreateResponse.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/ActivitySpecCreateResponse.java
new file mode 100644
index 0000000000..13844257b6
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/ActivitySpecCreateResponse.java
@@ -0,0 +1,61 @@
+/*-
+ * ============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.asdc.activity.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"id", "versionId"})
+public class ActivitySpecCreateResponse {
+
+ @JsonProperty("id")
+ private String id;
+ @JsonProperty("versionId")
+ private String versionId;
+
+ @JsonProperty("id")
+ public String getId() {
+ return id;
+ }
+
+ @JsonProperty("id")
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ @JsonProperty("versionId")
+ public String getVersionId() {
+ return versionId;
+ }
+
+ @JsonProperty("versionId")
+ public void setVersionId(String versionId) {
+ this.versionId = versionId;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("id", id).append("versionId", versionId).toString();
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/Input.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/Input.java
new file mode 100644
index 0000000000..3359d1df2d
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/Input.java
@@ -0,0 +1,61 @@
+/*-
+ * ============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.asdc.activity.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"name", "type"})
+public class Input {
+
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("type")
+ private String type;
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("type")
+ public String getType() {
+ return type;
+ }
+
+ @JsonProperty("type")
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("name", name).append("type", type).toString();
+ }
+
+}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/Output.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/Output.java
new file mode 100644
index 0000000000..1e3d2e4dd2
--- /dev/null
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/beans/Output.java
@@ -0,0 +1,73 @@
+/*-
+ * ============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.asdc.activity.beans;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({"name", "type", "value"})
+public class Output {
+
+ @JsonProperty("name")
+ private String name;
+ @JsonProperty("type")
+ private String type;
+ @JsonProperty("value")
+ private String value;
+
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ @JsonProperty("type")
+ public String getType() {
+ return type;
+ }
+
+ @JsonProperty("type")
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @JsonProperty("value")
+ public String getValue() {
+ return value;
+ }
+
+ @JsonProperty("value")
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("name", name).append("type", type).append("value", value).toString();
+ }
+
+}
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/ActivitySpecsActionsTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/ActivitySpecsActionsTest.java
new file mode 100644
index 0000000000..438120924a
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/asdc/activity/ActivitySpecsActionsTest.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.asdc.activity;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static org.junit.Assert.*;
+import org.junit.Test;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.activity.ActivitySpecsActions;
+import org.onap.so.asdc.activity.beans.ActivitySpec;
+import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class ActivitySpecsActionsTest extends BaseTest {
+ @Autowired
+ ActivitySpecsActions activitySpecsActions;
+
+ @Test
+ public void CreateActivitySpec_Test() throws Exception {
+ String HOSTNAME = createURLWithPort("");
+
+ ActivitySpec activitySpec = new ActivitySpec();
+ activitySpec.setName("testActivitySpec");
+ activitySpec.setDescription("Test Activity Spec");
+ ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse();
+ activitySpecCreateResponse.setId("testActivityId");
+ ObjectMapper mapper = new ObjectMapper();
+ String body = mapper.writeValueAsString(activitySpecCreateResponse);
+ wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec"))
+ .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(org.springframework.http.HttpStatus.OK.value()).withBody(body)));
+
+ String activitySpecId = activitySpecsActions.createActivitySpec(HOSTNAME, activitySpec);
+ assertEquals("testActivityId", activitySpecId);
+ }
+
+ @Test
+ public void CertifyActivitySpec_Test() throws Exception {
+ String HOSTNAME = createURLWithPort("");
+
+ String activitySpecId = "testActivitySpec";
+ String urlPath = "/v1.0/activity-spec/testActivitySpec/versions/latest/actions";
+
+ wireMockServer.stubFor(
+ put(urlPathMatching(urlPath)).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withStatus(org.springframework.http.HttpStatus.OK.value())));
+
+ boolean certificationResult = activitySpecsActions.certifyActivitySpec(HOSTNAME, activitySpecId);
+ assertTrue(certificationResult);
+ }
+
+ private String createURLWithPort(String uri) {
+ return "http://localhost:" + wireMockPort + uri;
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
new file mode 100644
index 0000000000..86f6a89af5
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
@@ -0,0 +1,38 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.asdc.activity;
+
+import org.junit.Test;
+import org.onap.so.asdc.BaseTest;
+import org.onap.so.asdc.activity.DeployActivitySpecs;
+import org.springframework.beans.factory.annotation.Autowired;
+
+
+public class DeployActivitySpecsTest extends BaseTest {
+
+ @Autowired
+ private DeployActivitySpecs deployActivitySpecs;
+
+ @Test
+ public void DeployActivitySpecs_Test() throws Exception {
+ // Mock catalog DB results
+ deployActivitySpecs.deployActivities();
+ }
+}
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java
index 0fcf9b0559..7ecd472c50 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java
@@ -45,6 +45,7 @@ import com.github.tomakehurst.wiremock.WireMockServer;
@ActiveProfiles("test")
@ContextConfiguration(classes = SpringContextHelper.class, initializers = ConfigFileApplicationContextInitializer.class)
@AutoConfigureWireMock(port = 0)
+
public abstract class BaseTest {
@MockBean
protected VfResourceStructure vfResourceStructure;
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/BeansTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/BeansTest.java
new file mode 100644
index 0000000000..86e4d27a1e
--- /dev/null
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/BeansTest.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 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.asdc;
+
+import org.junit.Test;
+import org.onap.so.openpojo.rules.ToStringTester;
+import com.openpojo.reflection.PojoClass;
+import com.openpojo.reflection.PojoClassFilter;
+import com.openpojo.reflection.filters.FilterEnum;
+import com.openpojo.reflection.filters.FilterNonConcrete;
+import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.validation.Validator;
+import com.openpojo.validation.ValidatorBuilder;
+import com.openpojo.validation.rule.impl.GetterMustExistRule;
+import com.openpojo.validation.rule.impl.SetterMustExistRule;
+import com.openpojo.validation.test.impl.GetterTester;
+import com.openpojo.validation.test.impl.SetterTester;
+
+public class BeansTest {
+
+
+ private PojoClassFilter filterTestClasses = new FilterTestClasses();
+
+ private PojoClassFilter enumFilter = new FilterEnum();
+
+
+ @Test
+ public void pojoStructure() {
+ test("org.onap.so.asdc.activity.beans");
+ }
+
+ private void test(String pojoPackage) {
+ Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule())
+
+ .with(new SetterTester()).with(new GetterTester())
+
+ .with(new SetterTester()).with(new GetterTester()).with(new ToStringTester())
+
+ .build();
+
+
+ validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, enumFilter,
+ new FilterNonConcrete());
+ }
+
+ private static class FilterTestClasses implements PojoClassFilter {
+ @Override
+ public boolean include(PojoClass pojoClass) {
+ return !pojoClass.getSourcePath().contains("/test-classes/");
+ }
+ }
+}
diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml
index 5ba8521b3c..ec536491a1 100644
--- a/asdc-controller/src/test/resources/application-test.yaml
+++ b/asdc-controller/src/test/resources/application-test.yaml
@@ -89,6 +89,8 @@ mso:
messageBusAddress: localhost,localhost
asdc:
config:
+ activity:
+ endpoint: http://localhost:${wiremock.server.port}
key: 566B754875657232314F5548556D3665
components:
count: 3,