From 90b3f1efcf0d4ed6dd4bc57de5e2c7d56b1d73d9 Mon Sep 17 00:00:00 2001 From: "beili.zhou" Date: Tue, 15 Aug 2017 14:39:58 -0400 Subject: [APPC-143] OAM restart operation with stop error Fix OAM restart operation does not report stop failure. And also remove unused LCM OperationStatus and related comments. Issue-Id: APPC-143 Change-Id: Ia2580717ef515856725e3e50c63b17404f123325 Signed-off-by: beili.zhou --- .../appc/listener/LCM/impl/ListenerImpl.java | 1 - .../appc/listener/LCM/model/InputBody.java | 16 ----- .../GenericProviderOperationRequestFormatter.java | 34 ----------- .../listener/LCM/operation/OperationStatus.java | 69 ---------------------- 4 files changed, 120 deletions(-) delete mode 100644 appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/operation/OperationStatus.java (limited to 'appc-event-listener/appc-event-listener-bundle') diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/impl/ListenerImpl.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/impl/ListenerImpl.java index d0ba7fbf5..c9ac104f3 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/impl/ListenerImpl.java +++ b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/impl/ListenerImpl.java @@ -87,7 +87,6 @@ public class ListenerImpl extends AbstractListener { if (isValid(incoming)) { String requestIdWithSubId = getRequestIdWithSubId(incoming.getBody()); LOG.info("Acknowledging Message: " + requestIdWithSubId); -// dmaap.postStatus(incoming.toOutgoing(OperationStatus.PENDING)); } } for (DmaapIncomingMessage incoming : messages) { diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/model/InputBody.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/model/InputBody.java index 88e515b0d..9808daf56 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/model/InputBody.java +++ b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/model/InputBody.java @@ -24,14 +24,11 @@ package org.openecomp.appc.listener.LCM.model; -import org.openecomp.appc.listener.LCM.operation.OperationStatus; - import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonSerialize; - @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class InputBody { @@ -85,19 +82,6 @@ public class InputBody { this.commonHeader = commonHeader; } -// public String toOutgoing(OperationStatus operationStatus) { -// OutputBody out = new OutputBody(this); -// out.setStatus(new ResponseStatus(operationStatus.getCode(), operationStatus.getValue())); -// return out.toResponse().toString(); -// } - -// public String toOutgoing(OperationStatus operationStatus,String islocked) { -// OutputBody out = new OutputBody(this); -// out.setStatus(new ResponseStatus(operationStatus.getCode(), operationStatus.getValue())); -// out.setLocked(islocked); -// return out.toResponse().toString(); -// } - @JsonIgnore public boolean isValid() { return getCommonHeader() != null; diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/operation/GenericProviderOperationRequestFormatter.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/operation/GenericProviderOperationRequestFormatter.java index e68d23bb6..dc8b5eab7 100644 --- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/operation/GenericProviderOperationRequestFormatter.java +++ b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/operation/GenericProviderOperationRequestFormatter.java @@ -36,8 +36,6 @@ import com.att.eelf.configuration.EELFManager; import java.net.URL; - - public class GenericProviderOperationRequestFormatter implements ProviderOperationRequestFormatter { private final EELFLogger LOG = EELFManager.getInstance().getLogger(GenericProviderOperationRequestFormatter.class); @@ -52,44 +50,12 @@ public class GenericProviderOperationRequestFormatter implements ProviderOperati return url.getPath() + ":"+rpcName; } -// private String convertActionToUrl(String action) { -// String res = ""; -// switch (action) { -// case "SoftwareUpload": -// res = "software-upload"; -// break; -// case "LiveUpgrade": -// res = "live-upgrade"; -// break; -// case "HealthCheck": -// res = "health-check"; -// break; -// case "CheckLock": -// res = "check-lock"; -// break; -// default : -// res = action; -// } -// return res.toLowerCase(); -// } - @Override public String buildRequest(InputBody msg) { JSONObject jsonObject = Mapper.toJsonObject(msg); return String.format(TEMPLATE, jsonObject.toString()); } -/* @Override - public OperationStatus getOperationStatus(JSONObject responseBody) throws APPCException { - try { - JSONObject status = responseBody.getJSONObject("output").getJSONObject("status"); - return new OperationStatus(String.valueOf(status.getInt("code")), status.getString("message")); - } catch (Exception e) { - LOG.error("Unknown error processing failed response from provider. Json not in expected format", e); - throw new APPCException("APPC has an unknown RPC error"); - } - }*/ - @Override public ResponseStatus getResponseStatus(JsonNode responseBody)throws APPCException{ try { diff --git a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/operation/OperationStatus.java b/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/operation/OperationStatus.java deleted file mode 100644 index e60c90916..000000000 --- a/appc-event-listener/appc-event-listener-bundle/src/main/java/org/openecomp/appc/listener/LCM/operation/OperationStatus.java +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * 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. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.appc.listener.LCM.operation; - - -public class OperationStatus { - public final static OperationStatus PENDING = new OperationStatus("PENDING", "PENDING"); - public final static OperationStatus ACTIVE = new OperationStatus("ACTIVE", "ACTIVE"); - public final static OperationStatus SUCCESS = new OperationStatus("SUCCESS", "SUCCESS"); - public final static OperationStatus FAILURE = new OperationStatus("FAILURE", "FAILURE"); - - private String code; - private String value; - - public OperationStatus() { - } - - - public OperationStatus(String code, String value) { - this.code = code; - this.value = value; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public boolean isSucceeded() { - if (code == null) { - return false; - } - int intCode = Integer.parseInt(code); - return (intCode >= 200) && (intCode < 300); // All 2xx statuses are success - } -} -- cgit 1.2.3-korg