import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType;
import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome;
import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams;
-import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpConfig;
+import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig;
import org.onap.policy.controlloop.actorserviceprovider.pipeline.PipelineControllerFuture;
import org.onap.policy.so.SoModelInfo;
import org.onap.policy.so.SoOperationType;
import org.onap.policy.so.SoRequest;
import org.onap.policy.so.SoRequestDetails;
+import org.onap.policy.so.SoResponse;
/**
* Operation to delete a VF Module. This gets the VF count from the A&AI Custom Query
* @param params operation parameters
* @param config configuration for this operation
*/
- public VfModuleDelete(ControlLoopOperationParams params, HttpConfig config) {
+ public VfModuleDelete(ControlLoopOperationParams params, HttpPollingConfig config) {
super(params, config);
// ensure we have the necessary parameters
protected CompletableFuture<OperationOutcome> startOperationAsync(int attempt, OperationOutcome outcome) {
// starting a whole new attempt - reset the count
- resetGetCount();
+ resetPollCount();
Pair<String, SoRequest> pair = makeRequest();
SoRequest request = pair.getRight();
* HttpClient, as the JerseyClient does not support it. This will add the content-type
* and authorization headers, so they should not be included within "headers".
*
- * @param <Q> request type
* @param uri URI suffix, to be appended to the URI prefix
* @param headers headers to be included
* @param contentType content type of the request
* @return a future to await the response. Note: it's untested whether canceling this
* future will actually cancel the underlying HTTP request
*/
- protected <Q> CompletableFuture<Response> delete(String uri, Map<String, Object> headers, String contentType,
+ protected CompletableFuture<Response> delete(String uri, Map<String, Object> headers, String contentType,
String request, InvocationCallback<Response> callback) {
// TODO move to HttpOperation
// propagate "cancel" to the future
controller.add(future);
- future.thenApply(response -> new RestManagerResponse(response.statusCode(), response.body(), makeCoder()))
+ future.thenApply(response -> new RestManagerResponse(response.statusCode(), response.body(), getCoder()))
.whenComplete((resp, thrown) -> {
if (thrown != null) {
callback.failed(thrown);
return builder.header("Authorization", "Basic " + encoded);
}
+
/**
- * Decrements the VF count that's stored in the context.
+ * Decrements the VF count that's stored in the context, if the request was
+ * successful.
*/
@Override
- protected void successfulCompletion() {
- setVfCount(getVfCount() - 1);
+ protected Status detmStatus(Response rawResponse, SoResponse response) {
+ Status status = super.detmStatus(rawResponse, response);
+
+ if (status == Status.SUCCESS) {
+ setVfCount(getVfCount() - 1);
+ }
+
+ return status;
}
/**