diff options
author | Boslet, Cory <cory.boslet@att.com> | 2020-07-06 09:58:17 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2020-07-06 09:58:17 -0400 |
commit | b7c956f3fa521e2031a7b7051ba2f42e6ac30cf5 (patch) | |
tree | 342aa19a7a86684b69500eef3313eaaa9cb2e87a /bpmn/so-bpmn-tasks/src | |
parent | 47cb76e07dd671bab171432141fa89f6c2a1c95f (diff) |
Moved sniro and oof clients into their own project
Moved sniro and oof clients into their own project
Remove methods that arnt used to avoid comp error
Refactored the conductor call to not use the urn property reader so
that we dont have to import bpmn core.
Replaced the auth method and removed unused import.
Issue-ID: SO-3021
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Ie281ef95fef984890b10297f434b8336e9017921
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
33 files changed, 2 insertions, 2863 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index f10b503ed3..71ea9fa719 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -440,7 +440,8 @@ public class SniroHomingV2 { if (!candidates.isEmpty()) { for (Candidate c : candidates) { org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate(); - can.setIdentifierType(c.getIdentifierType()); + can.setIdentifierType( + org.onap.so.client.sniro.beans.CandidateType.valueOf(c.getIdentifierType().name())); can.setIdentifiers(c.getIdentifiers()); can.setCloudOwner(c.getCloudOwner()); candidateList.add(can); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java deleted file mode 100644 index 8b0cf69f6c..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof; - - -import org.camunda.bpm.engine.delegate.BpmnError; -import org.onap.so.client.BaseClient; -import org.onap.so.client.exception.BadResponseException; -import org.onap.so.client.oof.beans.OofProperties; -import org.onap.so.client.oof.beans.OofRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.util.LinkedHashMap; - -@Component -public class OofClient { - - private static final Logger logger = LoggerFactory.getLogger(OofClient.class); - public static final String X_MINOR_VERSION = "X-MinorVersion"; - public static final String X_PATCH_VERSION = "X-PatchVersion"; - public static final String X_LATEST_VERSION = "X-LatestVersion"; - - @Autowired - private OofProperties oofProperties; - - @Autowired - private OofValidator validator; - - - /** - * Makes a rest call to oof to perform homing and licensing for a list of demands - * - * @param homingRequest - * @return - * @throws JsonProcessingException - * @throws BpmnError - */ - public void postDemands(OofRequest homingRequest) throws BadResponseException, JsonProcessingException { - logger.trace("Started oof Client Post Demands"); - String url = oofProperties.getHost() + oofProperties.getUri(); - logger.debug("Post demands url: " + url); - logger.debug("Post demands payload: " + homingRequest.toJsonString()); - - HttpHeaders header = new HttpHeaders(); - header.setContentType(MediaType.APPLICATION_JSON); - header.set(HttpHeaders.AUTHORIZATION, oofProperties.getHeaders().get("auth")); - header.set(X_PATCH_VERSION, oofProperties.getHeaders().get("patchVersion")); - header.set(X_MINOR_VERSION, oofProperties.getHeaders().get("minorVersion")); - header.set(X_LATEST_VERSION, oofProperties.getHeaders().get("latestVersion")); - BaseClient<String, LinkedHashMap<?, ?>> baseClient = new BaseClient<>(); - - baseClient.setTargetUrl(url); - baseClient.setHttpHeader(header); - - LinkedHashMap<?, ?> response = - baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<?, ?>>() {}); - validator.validateDemandsResponse(response); - logger.trace("Completed OOF Client Post Demands"); - } -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java deleted file mode 100644 index abbf52e38c..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof; - - -import org.json.JSONObject; -import org.onap.so.client.exception.BadResponseException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; -import java.util.LinkedHashMap; -import static org.apache.commons.lang.StringUtils.isNotBlank; - - -@Component -public class OofValidator { - - private static final Logger logger = LoggerFactory.getLogger(OofValidator.class); - - /** - * Validates the synchronous homing response from oof - * - * @throws BadResponseException - */ - public void validateDemandsResponse(LinkedHashMap<?, ?> response) throws BadResponseException { - logger.debug("Validating oofs synchronous response"); - if (!response.isEmpty()) { - JSONObject jsonResponse = new JSONObject(response); - if (jsonResponse.has("requestStatus")) { - String status = jsonResponse.getString("requestStatus"); - if (status.equals("accepted")) { - logger.debug("oofs synchronous response indicates accepted"); - } else { - String message = jsonResponse.getString("statusMessage"); - if (isNotBlank(message)) { - logger.debug("oofs response indicates failed: " + message); - } else { - logger.debug("oofs response indicates failed: no status message provided"); - message = "error message not provided"; - } - throw new BadResponseException("oofs synchronous response indicates failed: " + message); - } - } else { - logger.debug("oofs synchronous response does not contain: request status"); - throw new BadResponseException("oofs synchronous response does not contain: request status"); - } - } else { - logger.debug("oofs synchronous response is empty"); - throw new BadResponseException("oofs synchronous response i is empty"); - } - } - - /** - * Validates the asynchronous/callback response from oof which contains the homing and licensing solutions - * - * @throws BadResponseException - */ - public void validateSolution(String response) throws BadResponseException { - logger.debug("Validating oofs asynchronous callback response"); - if (isNotBlank(response)) { - JSONObject jsonResponse = new JSONObject(response); - if (!jsonResponse.has("serviceException")) { - logger.debug("oofs asynchronous response is valid"); - } else { - String message = jsonResponse.getJSONObject("serviceException").getString("text"); - if (isNotBlank(message)) { - logger.debug("oofs response contains a service exception: " + message); - } else { - logger.debug("oofs response contains a service exception: no service exception text provided"); - message = "error message not provided"; - } - throw new BadResponseException("oofs asynchronous response contains a service exception: " + message); - } - } else { - logger.debug("oofs asynchronous response is empty"); - throw new BadResponseException("oofs asynchronous response is empty"); - } - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java deleted file mode 100644 index e64a5450b5..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2019 Intel Corp. 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.oof.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; -import java.io.Serializable; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"resourceModuleName", "serviceResourceId", "tenantId", "resourceModelInfo"}) -@JsonRootName("licenseDemand") -public class LicenseDemand implements Serializable { - - private static final long serialVersionUID = -759180997599143791L; - - @JsonProperty("resourceModuleName") - private String resourceModuleName; - @JsonProperty("serviceResourceId") - private String serviceResourceId; - @JsonProperty("tenantId") - private String tenantId; - @JsonProperty("resourceModelInfo") - private ResourceModelInfo resourceModelInfo; - - @JsonProperty("resourceModuleName") - public String getResourceModuleName() { - return resourceModuleName; - } - - @JsonProperty("resourceModuleName") - public void setResourceModuleName(String resourceModuleName) { - this.resourceModuleName = resourceModuleName; - } - - @JsonProperty("serviceResourceId") - public String getServiceResourceId() { - return serviceResourceId; - } - - @JsonProperty("serviceResourceId") - public void setServiceResourceId(String serviceResourceId) { - this.serviceResourceId = serviceResourceId; - } - - @JsonProperty("tenantId") - public String getTenantId() { - return tenantId; - } - - @JsonProperty("tenantId") - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - @JsonProperty("resourceModelInfo") - public ResourceModelInfo getResourceModelInfo() { - return resourceModelInfo; - } - - @JsonProperty("resourceModelInfo") - public void setResourceModelInfo(ResourceModelInfo resourceModelInfo) { - this.resourceModelInfo = resourceModelInfo; - } - - public void setResourceModelInfo(ModelInfo modelInfo) { - ResourceModelInfo localResourceModelInfo = new ResourceModelInfo(); - localResourceModelInfo.setModelVersionId(modelInfo.getModelVersionId()); - localResourceModelInfo.setModelVersionId(modelInfo.getModelVersionId()); - localResourceModelInfo.setModelVersion(modelInfo.getModelVersion()); - localResourceModelInfo.setModelName(modelInfo.getModelName()); - localResourceModelInfo.setModelType(modelInfo.getModelType()); - localResourceModelInfo.setModelInvariantId(modelInfo.getModelInvariantId()); - localResourceModelInfo.setModelCustomizationName(modelInfo.getModelCustomizationName()); - this.resourceModelInfo = localResourceModelInfo; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java deleted file mode 100644 index 74ff9339d3..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2019 Intel Corp. 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.oof.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; -import java.io.Serializable; -import java.util.ArrayList; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonRootName("licenseInfo") -public class LicenseInfo implements Serializable { - - private static final long serialVersionUID = -759180997599143791L; - - @JsonProperty("licenseDemands") - private ArrayList<LicenseDemand> licenseDemands = new ArrayList<>(); - - - @JsonProperty("licenseDemands") - public ArrayList<LicenseDemand> getLicenseDemands() { - return licenseDemands; - } - - @JsonProperty("licenseDemands") - public void setLicenseDemands(ArrayList<LicenseDemand> licenseDemands) { - this.licenseDemands = licenseDemands; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java deleted file mode 100644 index 433de22aba..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; -import java.io.Serializable; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"modelType", "modelInvariantId", "modelVersionId", "modelName", "modelVersion", - "modelCustomizationName"}) -@JsonRootName("modelInfo") -public class ModelInfo implements Serializable { - - private static final long serialVersionUID = -759180997599143791L; - - @JsonProperty("modelType") - private String modelType; - @JsonProperty("modelInvariantId") - private String modelInvariantId; - @JsonProperty("modelVersionId") - private String modelVersionId; - @JsonProperty("modelName") - private String modelName; - @JsonProperty("modelVersion") - private String modelVersion; - @JsonProperty("modelCustomizationName") - private String modelCustomizationName; - - @JsonProperty("modelType") - public String getModelType() { - return modelType; - } - - @JsonProperty("modelType") - public void setModelType(String modelType) { - this.modelType = modelType; - } - - @JsonProperty("modelInvariantId") - public String getModelInvariantId() { - return modelInvariantId; - } - - @JsonProperty("modelInvariantId") - public void setModelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - } - - @JsonProperty("modelVersionId") - public String getModelVersionId() { - return modelVersionId; - } - - @JsonProperty("modelVersionId") - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - - @JsonProperty("modelName") - public String getModelName() { - return modelName; - } - - @JsonProperty("modelName") - public void setModelName(String modelName) { - this.modelName = modelName; - } - - @JsonProperty("modelVersion") - public String getModelVersion() { - return modelVersion; - } - - @JsonProperty("modelVersion") - public void setModelVersion(String modelVersion) { - this.modelVersion = modelVersion; - } - - @JsonProperty("modelCustomizationName") - public String getModelCustomizationName() { - return modelCustomizationName; - } - - @JsonProperty("modelCustomizationName") - public void setModelCustomizationName(String modelCustomizationName) { - this.modelCustomizationName = modelCustomizationName; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java deleted file mode 100644 index 84e29b6f2d..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof.beans; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; -import java.util.Map; - -@Configuration -@ConfigurationProperties(prefix = "oof") -public class OofProperties { - - private String host; - private String uri; - - private Map<String, String> headers; - - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public Map<String, String> getHeaders() { - return headers; - } - - public void setHeaders(Map<String, String> headers) { - this.headers = headers; - } - - - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java deleted file mode 100644 index f8896240ba..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java +++ /dev/null @@ -1,100 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import java.io.Serializable; - - -public class OofRequest implements Serializable { - - private static final long serialVersionUID = -1541132882892163132L; - private static final Logger logger = LoggerFactory.getLogger(OofRequest.class); - - - @JsonProperty("requestInfo") - private RequestInfo requestInformation; - - @JsonProperty("serviceInfo") - private ServiceInfo serviceInformation; - - @JsonProperty("placementInfo") - private PlacementInfo placementInformation; - - @JsonProperty("licenseInfo") - private LicenseInfo licenseInformation; - - - public RequestInfo getRequestInformation() { - return requestInformation; - } - - public void setRequestInformation(RequestInfo requestInformation) { - this.requestInformation = requestInformation; - } - - public ServiceInfo getServiceInformation() { - return serviceInformation; - } - - public void setServiceInformation(ServiceInfo serviceInformation) { - this.serviceInformation = serviceInformation; - } - - public PlacementInfo getPlacementInformation() { - return placementInformation; - } - - public void setPlacementInformation(PlacementInfo placementInformation) { - this.placementInformation = placementInformation; - } - - public LicenseInfo getLicenseInformation() { - return licenseInformation; - } - - public void setLicenseInformation(LicenseInfo licenseInformation) { - this.licenseInformation = licenseInformation; - } - - - @JsonInclude(Include.NON_NULL) - public String toJsonString() { - String json = ""; - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); - try { - json = ow.writeValueAsString(this); - } catch (Exception e) { - logger.error("Unable to convert oofRequest to string", e); - } - return json.replaceAll("\\\\", ""); - } - - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java deleted file mode 100644 index 6c9e45c787..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; -import java.io.Serializable; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"customerLatitude", "customerLongitude", "customerName"}) -@JsonRootName("requestParameters") -public class OofRequestParameters implements Serializable { - - private static final long serialVersionUID = -759180997599143791L; - - - @JsonProperty("customerLatitude") - private String customerLatitude; - @JsonProperty("customerLongitude") - private String customerLongitude; - @JsonProperty("customerName") - private String customerName; - - @JsonProperty("customerLatitude") - public String getCustomerLatitude() { - return customerLatitude; - } - - @JsonProperty("customerLatitude") - public void setCustomerLatitude(String customerLatitude) { - this.customerLatitude = customerLatitude; - } - - @JsonProperty("customerLongitude") - public String getCustomerLongitude() { - return customerLongitude; - } - - @JsonProperty("customerLongitude") - public void setCustomerLongitude(String customerLongitude) { - this.customerLongitude = customerLongitude; - } - - @JsonProperty("customerName") - public String getCustomerName() { - return customerName; - } - - @JsonProperty("customerName") - public void setCustomerName(String customerName) { - this.customerName = customerName; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java deleted file mode 100644 index 631b3707d4..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; -import java.io.Serializable; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"resourceModuleName", "serviceResourceId", "tenantId", "resourceModelInfo"}) -@JsonRootName("placementDemand") -public class PlacementDemand implements Serializable { - - private static final long serialVersionUID = -759180997599143791L; - - @JsonProperty("resourceModuleName") - private String resourceModuleName; - @JsonProperty("serviceResourceId") - private String serviceResourceId; - @JsonProperty("tenantId") - private String tenantId; - @JsonProperty("resourceModelInfo") - private ResourceModelInfo resourceModelInfo; - - @JsonProperty("resourceModuleName") - public String getResourceModuleName() { - return resourceModuleName; - } - - @JsonProperty("resourceModuleName") - public void setResourceModuleName(String resourceModuleName) { - this.resourceModuleName = resourceModuleName; - } - - @JsonProperty("serviceResourceId") - public String getServiceResourceId() { - return serviceResourceId; - } - - @JsonProperty("serviceResourceId") - public void setServiceResourceId(String serviceResourceId) { - this.serviceResourceId = serviceResourceId; - } - - @JsonProperty("tenantId") - public String getTenantId() { - return tenantId; - } - - @JsonProperty("tenantId") - public void setTenantId(String tenantId) { - this.tenantId = tenantId; - } - - @JsonProperty("resourceModelInfo") - public ResourceModelInfo getResourceModelInfo() { - return resourceModelInfo; - } - - @JsonProperty("resourceModelInfo") - public void setResourceModelInfo(ResourceModelInfo resourceModelInfo) { - this.resourceModelInfo = resourceModelInfo; - } - - public void setResourceModelInfo(ModelInfo modelInfo) { - ResourceModelInfo localResourceModelInfo = new ResourceModelInfo(); - localResourceModelInfo.setModelVersionId(modelInfo.getModelVersionId()); - localResourceModelInfo.setModelVersionId(modelInfo.getModelVersionId()); - localResourceModelInfo.setModelVersion(modelInfo.getModelVersion()); - localResourceModelInfo.setModelName(modelInfo.getModelName()); - localResourceModelInfo.setModelType(modelInfo.getModelType()); - localResourceModelInfo.setModelInvariantId(modelInfo.getModelInvariantId()); - localResourceModelInfo.setModelCustomizationName(modelInfo.getModelCustomizationName()); - this.resourceModelInfo = localResourceModelInfo; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java deleted file mode 100644 index 7519e8c87e..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof.beans; - -import java.io.Serializable; -import java.util.ArrayList; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"requestParameters", "subscriberInfo", "placementDemands"}) -@JsonRootName("placementInfo") -public class PlacementInfo implements Serializable { - - private static final long serialVersionUID = -759180997599143791L; - - @JsonProperty("requestParameters") - private OofRequestParameters requestParameters; - @JsonProperty("subscriberInfo") - private SubscriberInfo subscriberInfo; - @JsonProperty("placementDemands") - private ArrayList<PlacementDemand> placementDemands = new ArrayList<>(); - - @JsonProperty("requestParameters") - public OofRequestParameters getRequestParameters() { - return requestParameters; - } - - @JsonProperty("requestParameters") - public void setRequestParameters(OofRequestParameters requestParameters) { - this.requestParameters = requestParameters; - } - - @JsonProperty("subscriberInfo") - public SubscriberInfo getSubscriberInfo() { - return subscriberInfo; - } - - @JsonProperty("subscriberInfo") - public void setSubscriberInfo(SubscriberInfo subscriberInfo) { - this.subscriberInfo = subscriberInfo; - } - - @JsonProperty("placementDemands") - public ArrayList<PlacementDemand> getPlacementDemands() { - return placementDemands; - } - - @JsonProperty("placementDemands") - public void setPlacementDemands(ArrayList<PlacementDemand> placementDemands) { - this.placementDemands = placementDemands; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java deleted file mode 100644 index 0132ed56e9..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java +++ /dev/null @@ -1,135 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof.beans; - -import java.io.Serializable; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"transactionId", "requestId", "callbackUrl", "sourceId", "requestType", "numSolutions", - "optimizers", "timeout"}) -@JsonRootName("requestInfo") -public class RequestInfo implements Serializable { - - private static final long serialVersionUID = -759180997599143791L; - - @JsonProperty("transactionId") - private String transactionId; - @JsonProperty("requestId") - private String requestId; - @JsonProperty("callbackUrl") - private String callbackUrl; - @JsonProperty("sourceId") - private String sourceId; - @JsonProperty("requestType") - private String requestType; - @JsonProperty("numSolutions") - private Integer numSolutions; - @JsonProperty("optimizers") - private List<String> optimizers = null; - @JsonProperty("timeout") - private Long timeout; - - @JsonProperty("transactionId") - public String getTransactionId() { - return transactionId; - } - - @JsonProperty("transactionId") - public void setTransactionId(String transactionId) { - this.transactionId = transactionId; - } - - @JsonProperty("requestId") - public String getRequestId() { - return requestId; - } - - @JsonProperty("requestId") - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - @JsonProperty("callbackUrl") - public String getCallbackUrl() { - return callbackUrl; - } - - @JsonProperty("callbackUrl") - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - } - - @JsonProperty("sourceId") - public String getSourceId() { - return sourceId; - } - - @JsonProperty("sourceId") - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - @JsonProperty("requestType") - public String getRequestType() { - return requestType; - } - - @JsonProperty("requestType") - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - @JsonProperty("numSolutions") - public Integer getNumSolutions() { - return numSolutions; - } - - @JsonProperty("numSolutions") - public void setNumSolutions(Integer numSolutions) { - this.numSolutions = numSolutions; - } - - @JsonProperty("optimizers") - public List<String> getOptimizers() { - return optimizers; - } - - @JsonProperty("optimizers") - public void setOptimizers(List<String> optimizers) { - this.optimizers = optimizers; - } - - @JsonProperty("timeout") - public Long getTimeout() { - return timeout; - } - - @JsonProperty("timeout") - public void setTimeout(Long timeout) { - this.timeout = timeout; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java deleted file mode 100644 index 8d44c63571..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof.beans; - -import com.fasterxml.jackson.annotation.JsonProperty; -import java.io.Serializable; - -public class Resource implements Serializable { - - private static final long serialVersionUID = 5949861520571440421L; - - @JsonProperty("service-resource-id") - private String serviceResourceId; - @JsonProperty("status") - private String status; - - - public String getServiceResourceId() { - return serviceResourceId; - } - - public void setServiceResourceId(String serviceResourceId) { - this.serviceResourceId = serviceResourceId; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java deleted file mode 100644 index 9d0352525d..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java +++ /dev/null @@ -1,107 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; -import java.io.Serializable; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonRootName("resourceModelInfo") -public class ResourceModelInfo extends ModelInfo implements Serializable { - - private static final long serialVersionUID = -759180997599143791L; - - @JsonProperty("modelInvariantId") - private String modelInvariantId; - @JsonProperty("modelVersionId") - private String modelVersionId; - @JsonProperty("modelName") - private String modelName; - @JsonProperty("modelType") - private String modelType; - @JsonProperty("modelVersion") - private String modelVersion; - @JsonProperty("modelCustomizationName") - private String modelCustomizationName; - - @JsonProperty("modelInvariantId") - public String getModelInvariantId() { - return modelInvariantId; - } - - @JsonProperty("modelInvariantId") - public void setModelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - } - - @JsonProperty("modelVersionId") - public String getModelVersionId() { - return modelVersionId; - } - - @JsonProperty("modelVersionId") - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - - @JsonProperty("modelName") - public String getModelName() { - return modelName; - } - - @JsonProperty("modelName") - public void setModelName(String modelName) { - this.modelName = modelName; - } - - @JsonProperty("modelType") - public String getModelType() { - return modelType; - } - - @JsonProperty("modelType") - public void setModelType(String modelType) { - this.modelType = modelType; - } - - @JsonProperty("modelVersion") - public String getModelVersion() { - return modelVersion; - } - - @JsonProperty("modelVersion") - public void setModelVersion(String modelVersion) { - this.modelVersion = modelVersion; - } - - @JsonProperty("modelCustomizationName") - public String getModelCustomizationName() { - return modelCustomizationName; - } - - @JsonProperty("modelCustomizationName") - public void setModelCustomizationName(String modelCustomizationName) { - this.modelCustomizationName = modelCustomizationName; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java deleted file mode 100644 index db0e2acd60..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; -import java.io.Serializable; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"serviceInstanceId", "serviceName", "modelInfo"}) -@JsonRootName("serviceInfo") -public class ServiceInfo implements Serializable { - - private static final long serialVersionUID = -759180997599143791L; - - @JsonProperty("serviceInstanceId") - private String serviceInstanceId; - @JsonProperty("serviceName") - private String serviceName; - @JsonProperty("modelInfo") - private ModelInfo modelInfo; - - @JsonProperty("serviceInstanceId") - public String getServiceInstanceId() { - return serviceInstanceId; - } - - @JsonProperty("serviceInstanceId") - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - @JsonProperty("serviceName") - public String getServiceName() { - return serviceName; - } - - @JsonProperty("serviceName") - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - @JsonProperty("modelInfo") - public ModelInfo getModelInfo() { - return modelInfo; - } - - @JsonProperty("modelInfo") - public void setModelInfo(ModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java deleted file mode 100644 index 8fef4c45e7..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof.beans; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; -import java.io.Serializable; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({"globalSubscriberId", "subscriberName", "subscriberCommonSiteId"}) -@JsonRootName("subscriberInfo") -public class SubscriberInfo implements Serializable { - - private static final long serialVersionUID = -759180997599143791L; - - @JsonProperty("globalSubscriberId") - private String globalSubscriberId; - @JsonProperty("subscriberName") - private String subscriberName; - @JsonProperty("subscriberCommonSiteId") - private String subscriberCommonSiteId; - - @JsonProperty("globalSubscriberId") - public String getGlobalSubscriberId() { - return globalSubscriberId; - } - - @JsonProperty("globalSubscriberId") - public void setGlobalSubscriberId(String globalSubscriberId) { - this.globalSubscriberId = globalSubscriberId; - } - - @JsonProperty("subscriberName") - public String getSubscriberName() { - return subscriberName; - } - - @JsonProperty("subscriberName") - public void setSubscriberName(String subscriberName) { - this.subscriberName = subscriberName; - } - - @JsonProperty("subscriberCommonSiteId") - public String getSubscriberCommonSiteId() { - return subscriberCommonSiteId; - } - - @JsonProperty("subscriberCommonSiteId") - public void setSubscriberCommonSiteId(String subscriberCommonSiteId) { - this.subscriberCommonSiteId = subscriberCommonSiteId; - } -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java deleted file mode 100644 index c63cbc0b68..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java +++ /dev/null @@ -1,118 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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.sniro; - -import java.util.LinkedHashMap; -import org.camunda.bpm.engine.delegate.BpmnError; -import org.onap.so.bpmn.core.UrnPropertiesReader; -import org.onap.so.client.BaseClient; -import org.onap.so.client.exception.BadResponseException; -import org.onap.so.client.sniro.beans.ManagerProperties; -import org.onap.so.client.sniro.beans.SniroConductorRequest; -import org.onap.so.client.sniro.beans.SniroManagerRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.ParameterizedTypeReference; -import org.springframework.http.HttpHeaders; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; - - -@Component -public class SniroClient { - - private static final Logger logger = LoggerFactory.getLogger(SniroClient.class); - - @Autowired - private ManagerProperties managerProperties; - - @Autowired - private SniroValidator validator; - - - /** - * Makes a rest call to sniro manager to perform homing and licensing for a list of demands - * - * @param homingRequest - * @return - * @throws BadResponseException - * @throws BpmnError - */ - public void postDemands(SniroManagerRequest homingRequest) throws BadResponseException { - logger.trace("Started Sniro Client Post Demands"); - String url = managerProperties.getHost() + managerProperties.getUri().get("v2"); - logger.debug("Post demands url: {}", url); - logger.debug("Post demands payload: {}", homingRequest.toJsonString()); - - HttpHeaders header = new HttpHeaders(); - header.setContentType(MediaType.APPLICATION_JSON); - header.set("Authorization", managerProperties.getHeaders().get("auth")); - header.set("X-patchVersion", managerProperties.getHeaders().get("patchVersion")); - header.set("X-minorVersion", managerProperties.getHeaders().get("minorVersion")); - header.set("X-latestVersion", managerProperties.getHeaders().get("latestVersion")); - BaseClient<String, LinkedHashMap<String, Object>> baseClient = new BaseClient<>(); - - baseClient.setTargetUrl(url); - baseClient.setHttpHeader(header); - - LinkedHashMap<String, Object> response = baseClient.post(homingRequest.toJsonString(), - new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {}); - validator.validateDemandsResponse(response); - logger.trace("Completed Sniro Client Post Demands"); - } - - /** - * Makes a rest call to sniro conductor to notify them of successful or unsuccessful vnf creation for previously - * homed resources - * - * TODO Temporarily being used in groovy therefore can not utilize autowire. Once java "release" subflow is - * developed it will be refactored to use autowire. - * - * @param releaseRequest - * @return - * @throws BadResponseException - */ - public void postRelease(SniroConductorRequest releaseRequest) throws BadResponseException { - logger.trace("Started Sniro Client Post Release"); - String url = UrnPropertiesReader.getVariable("sniro.conductor.host") - + UrnPropertiesReader.getVariable("sniro.conductor.uri"); - logger.debug("Post release url: {}", url); - logger.debug("Post release payload: {}", releaseRequest.toJsonString()); - - HttpHeaders header = new HttpHeaders(); - header.setContentType(MediaType.APPLICATION_JSON); - header.set("Authorization", UrnPropertiesReader.getVariable("sniro.conductor.headers.auth")); - BaseClient<String, LinkedHashMap<String, Object>> baseClient = new BaseClient<>(); - - baseClient.setTargetUrl(url); - baseClient.setHttpHeader(header); - - LinkedHashMap<String, Object> response = baseClient.post(releaseRequest.toJsonString(), - new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {}); - SniroValidator v = new SniroValidator(); - v.validateReleaseResponse(response); - logger.trace("Completed Sniro Client Post Release"); - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java deleted file mode 100644 index eb73001f42..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java +++ /dev/null @@ -1,138 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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.sniro; - - -import static org.apache.commons.lang.StringUtils.*; -import java.util.LinkedHashMap; -import org.json.JSONObject; -import org.onap.so.client.exception.BadResponseException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Component; - - - -@Component -public class SniroValidator { - - private static final Logger logger = LoggerFactory.getLogger(SniroValidator.class); - - /** - * Validates the synchronous homing response from sniro manager - * - * @throws BadResponseException - */ - public void validateDemandsResponse(LinkedHashMap<String, Object> response) throws BadResponseException { - logger.debug("Validating Sniro Managers synchronous response"); - if (!response.isEmpty()) { - JSONObject jsonResponse = new JSONObject(response); - if (jsonResponse.has("requestStatus")) { - String status = jsonResponse.getString("requestStatus"); - if ("accepted".equals(status)) { - logger.debug("Sniro Managers synchronous response indicates accepted"); - } else { - String message = jsonResponse.getString("statusMessage"); - if (isNotBlank(message)) { - logger.debug("Sniro Managers response indicates failed: " + message); - } else { - logger.debug("Sniro Managers response indicates failed: no status message provided"); - message = "error message not provided"; - } - throw new BadResponseException("Sniro Managers synchronous response indicates failed: " + message); - } - } else { - logger.debug("Sniro Managers synchronous response does not contain: request status"); - throw new BadResponseException("Sniro Managers synchronous response does not contain: request status"); - } - } else { - logger.debug("Sniro Managers synchronous response is empty"); - throw new BadResponseException("Sniro Managers synchronous response i is empty"); - } - } - - /** - * Validates the asynchronous/callback response from sniro manager which contains the homing and licensing solutions - * - * @throws BadResponseException - */ - public static void validateSolution(String response) throws BadResponseException { - logger.debug("Validating Sniro Managers asynchronous callback response"); - if (isNotBlank(response)) { - JSONObject jsonResponse = new JSONObject(response); - if (!jsonResponse.has("serviceException")) { - logger.debug("Sniro Managers asynchronous response is valid"); - } else { - String message = jsonResponse.getJSONObject("serviceException").getString("text"); - if (isNotBlank(message)) { - logger.debug("Sniro Managers response contains a service exception: " + message); - } else { - logger.debug( - "Sniro Managers response contains a service exception: no service exception text provided"); - message = "error message not provided"; - } - throw new BadResponseException( - "Sniro Managers asynchronous response contains a service exception: " + message); - } - } else { - logger.debug("Sniro Managers asynchronous response is empty"); - throw new BadResponseException("Sniro Managers asynchronous response is empty"); - } - } - - - /** - * Validates the release response from sniro conductor - * - * @throws BadResponseException - */ - public void validateReleaseResponse(LinkedHashMap<String, Object> response) throws BadResponseException { - logger.debug("Validating Sniro Conductors response"); - if (!response.isEmpty()) { - String status = (String) response.get("status"); - if (isNotBlank(status)) { - if ("success".equals(status)) { - logger.debug("Sniro Conductors synchronous response indicates success"); - } else { - String message = (String) response.get("message"); - if (isNotBlank(message)) { - logger.debug("Sniro Conductors response indicates failed: " + message); - } else { - logger.debug("Sniro Conductors response indicates failed: error message not provided"); - message = "error message not provided"; - } - throw new BadResponseException( - "Sniro Conductors synchronous response indicates failed: " + message); - } - } else { - logger.debug("Sniro Managers Conductors response does not contain: status"); - throw new BadResponseException("Sniro Conductors synchronous response does not contain: status"); - } - } else { - logger.debug("Sniro Conductors response is empty"); - throw new BadResponseException("Sniro Conductors response is empty"); - } - - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java deleted file mode 100644 index 3127275b24..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 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.client.sniro.beans; - -import java.io.Serializable; -import java.util.List; -import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Candidate implements Serializable { - - private static final long serialVersionUID = -5474502255533410907L; - - @JsonProperty("identifierType") - private CandidateType identifierType; - @JsonProperty("identifiers") - private List<String> identifiers; - @JsonProperty("cloudOwner") - private String cloudOwner; - - public Candidate() {} - - public Candidate(CandidateType identifierType, List<String> identifiers, String cloudOwner) { - this.identifierType = identifierType; - this.identifiers = identifiers; - this.cloudOwner = cloudOwner; - } - - public CandidateType getIdentifierType() { - return identifierType; - } - - public void setIdentifierType(CandidateType identifierType) { - this.identifierType = identifierType; - } - - public List<String> getIdentifiers() { - return identifiers; - } - - public void setIdentifiers(List<String> identifiers) { - this.identifiers = identifiers; - } - - public String getCloudOwner() { - return cloudOwner; - } - - public void setCloudOwner(String cloudOwner) { - this.cloudOwner = cloudOwner; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java deleted file mode 100644 index 9ac8727a0f..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 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.client.sniro.beans; - -import java.util.Map; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "sniro.conductor") -public class ConductorProperties { - - private String host; - private String uri; - - private Map<String, String> headers; - - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public Map<String, String> getHeaders() { - return headers; - } - - public void setHeaders(Map<String, String> headers) { - this.headers = headers; - } - - - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java deleted file mode 100644 index 0cc993560d..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 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.client.sniro.beans; - -import java.io.Serializable; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Demand implements Serializable { - - private static final long serialVersionUID = 5676094538091859816L; - - @JsonProperty("serviceResourceId") - private String serviceResourceId; - @JsonProperty("resourceModuleName") - private String resourceModuleName; - @JsonProperty("resourceModelInfo") - private ModelInfo modelInfo; - @JsonProperty("requiredCandidates") - private List<Candidate> requiredCandidates; - @JsonProperty("excludedCandidates") - private List<Candidate> excludedCandidates; - @JsonProperty("existingCandidates") - private List<Candidate> existingCandidates; - @JsonProperty("filteringAttributes") - private List<Candidate> filteringAttributes; - - - public List<Candidate> getRequiredCandidates() { - return requiredCandidates; - } - - public void setRequiredCandidates(List<Candidate> requiredCandidates) { - this.requiredCandidates = requiredCandidates; - } - - public List<Candidate> getExcludedCandidates() { - return excludedCandidates; - } - - public void setExcludedCandidates(List<Candidate> excludedCandidates) { - this.excludedCandidates = excludedCandidates; - } - - public String getServiceResourceId() { - return serviceResourceId; - } - - public void setServiceResourceId(String serviceResourceId) { - this.serviceResourceId = serviceResourceId; - } - - public String getResourceModuleName() { - return resourceModuleName; - } - - public void setResourceModuleName(String resourceModuleName) { - this.resourceModuleName = resourceModuleName; - } - - public ModelInfo getModelInfo() { - return modelInfo; - } - - public void setModelInfo(ModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - - public List<Candidate> getExistingCandidates() { - return existingCandidates; - } - - public void setExistingCandidates(List<Candidate> existingCandidates) { - this.existingCandidates = existingCandidates; - } - - public List<Candidate> getFilteringAttributes() { - return filteringAttributes; - } - - public void setFilteringAttributes(List<Candidate> filteringAttributes) { - this.filteringAttributes = filteringAttributes; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java deleted file mode 100644 index 9ab3ae673a..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 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.client.sniro.beans; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class LicenseInfo implements Serializable { - - private static final long serialVersionUID = 6878164369491185856L; - - @JsonProperty("licenseDemands") - private List<Demand> demands = new ArrayList<>(); - - - public List<Demand> getDemands() { - return demands; - } - - public void setDemands(List<Demand> demands) { - this.demands = demands; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java deleted file mode 100644 index 70b1a37b5e..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 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.client.sniro.beans; - -import java.util.Map; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ConfigurationProperties(prefix = "sniro.manager") -public class ManagerProperties { - - private String host; - private Map<String, String> uri; - private Map<String, String> headers; - - - public String getHost() { - return host; - } - - public void setHost(String host) { - this.host = host; - } - - public Map<String, String> getUri() { - return uri; - } - - public void setUri(Map<String, String> uri) { - this.uri = uri; - } - - public Map<String, String> getHeaders() { - return headers; - } - - public void setHeaders(Map<String, String> headers) { - this.headers = headers; - } - - - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java deleted file mode 100644 index 6c1932e344..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 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.client.sniro.beans; - -import java.io.Serializable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonPropertyOrder({"modelName", "modelVersionId", "modelVersion", "modelInvariantId"}) -@JsonRootName("modelInfo") -public class ModelInfo implements Serializable { - - private static final long serialVersionUID = 1488642558601651075L; - - @JsonProperty("modelInvariantId") - private String modelInvariantId; - @JsonProperty("modelVersionId") - private String modelVersionId; - @JsonProperty("modelName") - private String modelName; - @JsonProperty("modelVersion") - private String modelVersion; - - - public String getModelInvariantId() { - return modelInvariantId; - } - - public void setModelInvariantId(String modelInvariantId) { - this.modelInvariantId = modelInvariantId; - } - - public String getModelVersionId() { - return modelVersionId; - } - - public void setModelVersionId(String modelVersionId) { - this.modelVersionId = modelVersionId; - } - - public String getModelName() { - return modelName; - } - - public void setModelName(String modelName) { - this.modelName = modelName; - } - - public String getModelVersion() { - return modelVersion; - } - - public void setModelVersion(String modelVersion) { - this.modelVersion = modelVersion; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java deleted file mode 100644 index bbbbf9cfd6..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 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.client.sniro.beans; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRawValue; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonPropertyOrder({"subscriberInfo", "placementDemands", "requestParameters"}) -@JsonRootName("placementInfo") -public class PlacementInfo implements Serializable { - - private static final long serialVersionUID = -964488472247386556L; - - @JsonProperty("subscriberInfo") - private SubscriberInfo subscriberInfo; - @JsonProperty("placementDemands") - private List<Demand> demands = new ArrayList<>(); - @JsonRawValue - @JsonProperty("requestParameters") - private String requestParameters; - - - public SubscriberInfo getSubscriberInfo() { - return subscriberInfo; - } - - public void setSubscriberInfo(SubscriberInfo subscriberInfo) { - this.subscriberInfo = subscriberInfo; - } - - public List<Demand> getDemands() { - return demands; - } - - public void setDemands(List<Demand> demands) { - this.demands = demands; - } - - public String getRequestParameters() { - return requestParameters; - } - - public void setRequestParameters(String requestParameters) { - this.requestParameters = requestParameters; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java deleted file mode 100644 index fc6aec7d14..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 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.client.sniro.beans; - -import java.io.Serializable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - - -@JsonRootName("requestInfo") -public class RequestInfo implements Serializable { - - private static final long serialVersionUID = -759180997599143791L; - - @JsonProperty("transactionId") - String transactionId; - @JsonProperty("requestId") - String requestId; - @JsonProperty("callbackUrl") - String callbackUrl; - @JsonProperty("sourceId") - String sourceId = "mso"; - @JsonProperty("requestType") - String requestType; - @JsonProperty("timeout") - long timeout; - - public String getTransactionId() { - return transactionId; - } - - public void setTransactionId(String transactionId) { - this.transactionId = transactionId; - } - - public String getRequestId() { - return requestId; - } - - public void setRequestId(String requestId) { - this.requestId = requestId; - } - - public String getCallbackUrl() { - return callbackUrl; - } - - public void setCallbackUrl(String callbackUrl) { - this.callbackUrl = callbackUrl; - } - - public String getSourceId() { - return sourceId; - } - - public void setSourceId(String sourceId) { - this.sourceId = sourceId; - } - - public String getRequestType() { - return requestType; - } - - public void setRequestType(String requestType) { - this.requestType = requestType; - } - - public long getTimeout() { - return timeout; - } - - public void setTimeout(long timeout) { - this.timeout = timeout; - } - - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java deleted file mode 100644 index b5d40a8e80..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 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.client.sniro.beans; - -import java.io.Serializable; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class Resource implements Serializable { - - private static final long serialVersionUID = 5949861520571440421L; - - @JsonProperty("service-resource-id") - private String serviceResourceId; - @JsonProperty("status") - private String status; - - - public String getServiceResourceId() { - return serviceResourceId; - } - - public void setServiceResourceId(String serviceResourceId) { - this.serviceResourceId = serviceResourceId; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java deleted file mode 100644 index 8b6f234c1e..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 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.client.sniro.beans; - -import java.io.Serializable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonPropertyOrder({"modelInfo", "serviceRole", "serviceInstanceId", "serviceName"}) -@JsonRootName("serviceInfo") -public class ServiceInfo implements Serializable { - - private static final long serialVersionUID = -6866022419398548585L; - - @JsonProperty("serviceInstanceId") - private String serviceInstanceId; - @JsonProperty("serviceName") - private String serviceName; - @JsonProperty("serviceRole") - private String serviceRole; - @JsonProperty("modelInfo") - private ModelInfo modelInfo; - - - public String getServiceInstanceId() { - return serviceInstanceId; - } - - public void setServiceInstanceId(String serviceInstanceId) { - this.serviceInstanceId = serviceInstanceId; - } - - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - } - - public String getServiceRole() { - return serviceRole; - } - - public void setServiceRole(String serviceRole) { - this.serviceRole = serviceRole; - } - - public ModelInfo getModelInfo() { - return modelInfo; - } - - public void setModelInfo(ModelInfo modelInfo) { - this.modelInfo = modelInfo; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java deleted file mode 100644 index b8896a2bab..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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.sniro.beans; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class SniroConductorRequest implements Serializable { - - private static final long serialVersionUID = 1906052095861777655L; - private static final Logger logger = LoggerFactory.getLogger(SniroConductorRequest.class); - - @JsonProperty("release-locks") - private List<Resource> resources = new ArrayList<>(); - - - public List<Resource> getResources() { - return resources; - } - - @JsonInclude(Include.NON_NULL) - public String toJsonString() { - String json = ""; - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); - try { - json = ow.writeValueAsString(this); - } catch (Exception e) { - logger.error("Unable to convert SniroConductorRequest to string", e); - } - return json; - } - - - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java deleted file mode 100644 index 4babbe5c39..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Modifications Copyright (c) 2019 Samsung - * ================================================================================ - * 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.sniro.beans; - -import java.io.Serializable; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ObjectWriter; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -public class SniroManagerRequest implements Serializable { - - private static final long serialVersionUID = -1541132882892163132L; - private static final Logger logger = LoggerFactory.getLogger(SniroManagerRequest.class); - - @JsonProperty("requestInfo") - private RequestInfo requestInformation; - @JsonProperty("serviceInfo") - private ServiceInfo serviceInformation; - @JsonProperty("placementInfo") - private PlacementInfo placementInformation; - @JsonProperty("licenseInfo") - private LicenseInfo licenseInformation; - - - public RequestInfo getRequestInformation() { - return requestInformation; - } - - public void setRequestInformation(RequestInfo requestInformation) { - this.requestInformation = requestInformation; - } - - public ServiceInfo getServiceInformation() { - return serviceInformation; - } - - public void setServiceInformation(ServiceInfo serviceInformation) { - this.serviceInformation = serviceInformation; - } - - public PlacementInfo getPlacementInformation() { - return placementInformation; - } - - public void setPlacementInformation(PlacementInfo placementInformation) { - this.placementInformation = placementInformation; - } - - public LicenseInfo getLicenseInformation() { - return licenseInformation; - } - - public void setLicenseInformation(LicenseInfo licenseInformation) { - this.licenseInformation = licenseInformation; - } - - - @JsonInclude(Include.NON_NULL) - public String toJsonString() { - String json = ""; - ObjectMapper mapper = new ObjectMapper(); - mapper.setSerializationInclusion(Include.NON_NULL); - ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter(); - try { - json = ow.writeValueAsString(this); - } catch (Exception e) { - logger.error("Unable to convert SniroManagerRequest to string", e); - } - return json.replaceAll("\\\\", ""); - } - - -} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java deleted file mode 100644 index 35a4cac459..0000000000 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 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.client.sniro.beans; - -import java.io.Serializable; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRootName; - -@JsonRootName("subscriberInfo") -public class SubscriberInfo implements Serializable { - - private static final long serialVersionUID = -6350949051379748872L; - - @JsonProperty("globalSubscriberId") - private String globalSubscriberId; - @JsonProperty("subscriberName") - private String subscriberName; - @JsonProperty("subscriberCommonSiteId") - private String subscriberCommonSiteId; - - - public String getGlobalSubscriberId() { - return globalSubscriberId; - } - - public void setGlobalSubscriberId(String globalSubscriberId) { - this.globalSubscriberId = globalSubscriberId; - } - - public String getSubscriberName() { - return subscriberName; - } - - public void setSubscriberName(String subscriberName) { - this.subscriberName = subscriberName; - } - - public String getSubscriberCommonSiteId() { - return subscriberCommonSiteId; - } - - public void setSubscriberCommonSiteId(String subscriberCommonSiteId) { - this.subscriberCommonSiteId = subscriberCommonSiteId; - } - -} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java deleted file mode 100644 index 3ae0db627a..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java +++ /dev/null @@ -1,219 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Intel Corp. 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.oof; - -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.urlEqualTo; -import static org.junit.Assert.assertEquals; -import org.junit.Test; -import org.onap.so.BaseIntegrationTest; -import org.onap.so.client.exception.BadResponseException; -import org.onap.so.client.oof.beans.LicenseInfo; -import org.onap.so.client.oof.beans.ModelInfo; -import org.onap.so.client.oof.beans.OofRequest; -import org.onap.so.client.oof.beans.OofRequestParameters; -import org.onap.so.client.oof.beans.PlacementDemand; -import org.onap.so.client.oof.beans.PlacementInfo; -import org.onap.so.client.oof.beans.RequestInfo; -import org.onap.so.client.oof.beans.ResourceModelInfo; -import org.onap.so.client.oof.beans.ServiceInfo; -import org.onap.so.client.oof.beans.SubscriberInfo; -import org.skyscreamer.jsonassert.JSONAssert; -import org.springframework.beans.factory.annotation.Autowired; -import com.fasterxml.jackson.core.JsonProcessingException; -import java.util.ArrayList; -import java.util.List; - - -public class OofClientTestIT extends BaseIntegrationTest { - - @Autowired - private OofClient client; - - @Test - public void testPostDemands_success() throws BadResponseException, JsonProcessingException { - String mockResponse = - "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}"; - - ModelInfo modelInfo = new ModelInfo(); - modelInfo.setModelCustomizationName("modelCustomizationName-Service"); - modelInfo.setModelInvariantId("modelInvariantId-Service"); - modelInfo.setModelName("modelName-Service"); - modelInfo.setModelType("modelType-Service"); - modelInfo.setModelVersion("modelVersion-Service"); - modelInfo.setModelVersionId("modelVersionId-Service"); - - ServiceInfo serviceInfo = new ServiceInfo(); - serviceInfo.setModelInfo(modelInfo); - serviceInfo.setServiceInstanceId("serviceInstanceId"); - serviceInfo.setServiceName("serviceName"); - - SubscriberInfo subscriberInfo = new SubscriberInfo(); - subscriberInfo.setGlobalSubscriberId("globalSubscriberId"); - subscriberInfo.setSubscriberCommonSiteId("subscriberCommonSiteId"); - subscriberInfo.setSubscriberName("subscriberName"); - - ResourceModelInfo resourceModelInfo = new ResourceModelInfo(); - resourceModelInfo.setModelType("modelType"); - resourceModelInfo.setModelCustomizationName("modelCustomizationName"); - resourceModelInfo.setModelInvariantId("invarianteId"); - resourceModelInfo.setModelName("modelName"); - resourceModelInfo.setModelVersion("version"); - resourceModelInfo.setModelVersionId("versionId"); - - PlacementDemand placementDemand = new PlacementDemand(); - placementDemand.setResourceModelInfo(resourceModelInfo); - placementDemand.setResourceModuleName("resourceModuleName"); - placementDemand.setServiceResourceId("serviceResourceId"); - placementDemand.setTenantId("tenantId"); - - OofRequestParameters oofRequestParameters = new OofRequestParameters(); - oofRequestParameters.setCustomerLatitude("customerLatitude"); - oofRequestParameters.setCustomerLongitude("customerLongitude"); - oofRequestParameters.setCustomerName("customerName"); - - ArrayList<PlacementDemand> placementDemands = new ArrayList<>(); - placementDemands.add(placementDemand); - - PlacementInfo placementInfo = new PlacementInfo(); - placementInfo.setPlacementDemands(placementDemands); - placementInfo.setRequestParameters(oofRequestParameters); - placementInfo.setSubscriberInfo(subscriberInfo); - - RequestInfo requestInfo = new RequestInfo(); - requestInfo.setTransactionId("transactionId"); - List<String> optimizer = new ArrayList<>(); - optimizer.add("optimizer1"); - optimizer.add("optimizer2"); - requestInfo.setOptimizers(optimizer); - requestInfo.setCallbackUrl("callBackUrl"); - requestInfo.setNumSolutions(1); - requestInfo.setRequestId("requestId"); - requestInfo.setSourceId("sourceId"); - requestInfo.setTimeout(30L); - requestInfo.setRequestType("requestType"); - - OofRequest oofRequest = new OofRequest(); - oofRequest.setRequestInformation(requestInfo); - oofRequest.setPlacementInformation(placementInfo); - oofRequest.setServiceInformation(serviceInfo); - oofRequest.setLicenseInformation(new LicenseInfo()); - - wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - client.postDemands(oofRequest); - - String oofRequestOutput = oofRequest.toJsonString(); - JSONAssert.assertEquals("{\n" + " \"requestInfo\" : {\n" + " \"transactionId\" : \"transactionId\",\n" - + " \"requestId\" : \"requestId\",\n" + " \"callbackUrl\" : \"callBackUrl\",\n" - + " \"sourceId\" : \"sourceId\",\n" + " \"requestType\" : \"requestType\",\n" - + " \"numSolutions\" : 1,\n" + " \"optimizers\" : [ \"optimizer1\", \"optimizer2\" ],\n" - + " \"timeout\" : 30\n" + " },\n" + " \"serviceInfo\" : {\n" - + " \"serviceInstanceId\" : \"serviceInstanceId\",\n" + " \"serviceName\" : \"serviceName\",\n" - + " \"modelInfo\" : {\n" + " \"modelType\" : \"modelType-Service\",\n" - + " \"modelInvariantId\" : \"modelInvariantId-Service\",\n" - + " \"modelVersionId\" : \"modelVersionId-Service\",\n" - + " \"modelName\" : \"modelName-Service\",\n" - + " \"modelVersion\" : \"modelVersion-Service\",\n" - + " \"modelCustomizationName\" : \"modelCustomizationName-Service\"\n" + " }\n" + " },\n" - + " \"placementInfo\" : {\n" + " \"requestParameters\" : {\n" - + " \"customerLatitude\" : \"customerLatitude\",\n" - + " \"customerLongitude\" : \"customerLongitude\",\n" - + " \"customerName\" : \"customerName\"\n" + " },\n" + " \"subscriberInfo\" : {\n" - + " \"globalSubscriberId\" : \"globalSubscriberId\",\n" - + " \"subscriberName\" : \"subscriberName\",\n" - + " \"subscriberCommonSiteId\" : \"subscriberCommonSiteId\"\n" + " },\n" - + " \"placementDemands\" : [ {\n" + " \"resourceModuleName\" : \"resourceModuleName\",\n" - + " \"serviceResourceId\" : \"serviceResourceId\",\n" + " \"tenantId\" : \"tenantId\",\n" - + " \"resourceModelInfo\" : {\n" + " \"modelType\" : \"modelType\",\n" - + " \"modelInvariantId\" : \"invarianteId\",\n" + " \"modelVersionId\" : \"versionId\",\n" - + " \"modelName\" : \"modelName\",\n" + " \"modelVersion\" : \"version\",\n" - + " \"modelCustomizationName\" : \"modelCustomizationName\"\n" + " }\n" + " } ]\n" - + " },\n" + " \"licenseInfo\" : { \n" + " \"licenseDemands\" : [ ]\n" + "}\n" + "}", - oofRequestOutput, false); - } - - @Test - public void testAsyncResponse_success() throws BadResponseException, JsonProcessingException { - String mockResponse = - "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}"; - - wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - client.postDemands(new OofRequest()); - } - - @Test(expected = BadResponseException.class) - public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException { - String mockResponse = - "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}"; - - wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - - client.postDemands(new OofRequest()); - - // TODO assertEquals("missing data", ); - - } - - @Test(expected = BadResponseException.class) - public void testPostDemands_error_noMessage() throws JsonProcessingException, BadResponseException { - String mockResponse = - "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}"; - - wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - - client.postDemands(new OofRequest()); - - } - - @Test(expected = BadResponseException.class) - public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException { - String mockResponse = - "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}"; - - wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - - client.postDemands(new OofRequest()); - - } - - @Test(expected = BadResponseException.class) - public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException { - String mockResponse = "{ }"; - - wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - - client.postDemands(new OofRequest()); - } - -} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java deleted file mode 100644 index 56c52388f8..0000000000 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java +++ /dev/null @@ -1,158 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 2018 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.client.sniro; - -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.urlEqualTo; -import org.junit.Test; -import org.onap.so.BaseIntegrationTest; -import org.onap.so.client.exception.BadResponseException; -import org.onap.so.client.sniro.beans.SniroConductorRequest; -import org.onap.so.client.sniro.beans.SniroManagerRequest; -import org.springframework.beans.factory.annotation.Autowired; -import com.fasterxml.jackson.core.JsonProcessingException; - - -public class SniroClientTestIT extends BaseIntegrationTest { - - @Autowired - private SniroClient client; - - - @Test(expected = Test.None.class) - public void testPostDemands_success() throws BadResponseException, JsonProcessingException { - String mockResponse = - "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"corys cool\", \"requestStatus\": \"accepted\"}"; - - wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - client.postDemands(new SniroManagerRequest()); - - } - - @Test(expected = BadResponseException.class) - public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException { - String mockResponse = - "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}"; - - wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - - client.postDemands(new SniroManagerRequest()); - - // TODO assertEquals("missing data", ); - - } - - @Test(expected = BadResponseException.class) - public void testPostDemands_error_noMessage() throws JsonProcessingException, BadResponseException { - String mockResponse = - "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}"; - - wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - - client.postDemands(new SniroManagerRequest()); - - } - - @Test(expected = BadResponseException.class) - public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException { - String mockResponse = - "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}"; - - wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - - client.postDemands(new SniroManagerRequest()); - - } - - @Test(expected = BadResponseException.class) - public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException { - String mockResponse = "{ }"; - - wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - - client.postDemands(new SniroManagerRequest()); - } - - @Test(expected = Test.None.class) - public void testPostRelease_success() throws BadResponseException, JsonProcessingException { - String mockResponse = "{\"status\": \"success\", \"message\": \"corys cool\"}"; - - wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - client.postRelease(new SniroConductorRequest()); - } - - @Test(expected = BadResponseException.class) - public void testPostRelease_error_failed() throws BadResponseException, JsonProcessingException { - String mockResponse = "{\"status\": \"failure\", \"message\": \"corys cool\"}"; - - wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - client.postRelease(new SniroConductorRequest()); - } - - @Test(expected = BadResponseException.class) - public void testPostRelease_error_noStatus() throws BadResponseException, JsonProcessingException { - String mockResponse = "{\"status\": \"\", \"message\": \"corys cool\"}"; - - wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - client.postRelease(new SniroConductorRequest()); - - } - - @Test(expected = BadResponseException.class) - public void testPostRelease_error_noMessage() throws BadResponseException, JsonProcessingException { - String mockResponse = "{\"status\": \"failure\", \"message\": null}"; - - wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - client.postRelease(new SniroConductorRequest()); - - } - - @Test(expected = BadResponseException.class) - public void testPostRelease_error_empty() throws BadResponseException, JsonProcessingException { - String mockResponse = "{ }"; - - wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn( - aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse))); - - client.postRelease(new SniroConductorRequest()); - - } - -} |