From b4b9a1f3c81a1c64271e38d879a84f6b134d3a54 Mon Sep 17 00:00:00 2001 From: lapentafd Date: Mon, 8 May 2023 10:07:26 +0100 Subject: Update ACM-R missing stubs Fix typo and adding return 202 to missing stub Issue-ID: POLICY-4143 Change-Id: I9b59b762395a1c3a1ae262ed4ac7679de402e0ac Signed-off-by: lapentafd --- .../main/rest/stub/CommissioningControllerStub.java | 4 ++-- .../main/rest/stub/InstantiationControllerStub.java | 18 +++++++++--------- .../main/rest/stub/ParticipantControllerStub.java | 4 ++-- .../contract/CommissioningControllerStubTest.java | 2 +- .../contract/InstantiationControllerStubTest.java | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'runtime-acm') diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/CommissioningControllerStub.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/CommissioningControllerStub.java index adcb1410b..fc94f3476 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/CommissioningControllerStub.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/CommissioningControllerStub.java @@ -31,6 +31,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplates; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RestController; @@ -87,7 +88,6 @@ public class CommissioningControllerStub extends AbstractRestController implemen @Override public ResponseEntity compositionDefinitionPriming(UUID compositionId, UUID requestId, AcTypeStateUpdate body) { - // TODO Auto-generated method stub - return null; + return new ResponseEntity<>(HttpStatus.ACCEPTED); } } diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/InstantiationControllerStub.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/InstantiationControllerStub.java index d0b190dd3..3fa47497a 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/InstantiationControllerStub.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/InstantiationControllerStub.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022-2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AcInstanceSt import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Profile; +import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RestController; @@ -45,13 +46,13 @@ public class InstantiationControllerStub extends AbstractRestController implemen private String pathToResponseFile; @Value("${stub.getCompositionInstancesResponse}") - private String pathToSingleIntance; + private String pathToSingleInstance; @Value("${stub.getAllCompositionInstancesResponse}") - private String pathToAllIntances; + private String pathToAllInstances; @Value("${stub.postInstanceResponse}") - private String pathPostIntance; + private String pathPostInstance; @Value("${stub.putCompositionInstanceUpdateResponse}") private String pathToPutUpdate; @@ -60,7 +61,7 @@ public class InstantiationControllerStub extends AbstractRestController implemen public ResponseEntity createCompositionInstance(UUID compositionId, AutomationComposition body, UUID xonaprequestid) { if (body.getInstanceId() == null) { - return stubUtils.getResponse(pathPostIntance, InstantiationResponse.class); + return stubUtils.getResponse(pathPostInstance, InstantiationResponse.class); } else { return stubUtils.getResponse(pathToResponseFile, InstantiationResponse.class); } @@ -75,19 +76,18 @@ public class InstantiationControllerStub extends AbstractRestController implemen @Override public ResponseEntity getCompositionInstance(UUID compositionId, UUID instanceId, UUID xonaprequestid) { - return stubUtils.getResponse(pathToSingleIntance, AutomationComposition.class); + return stubUtils.getResponse(pathToSingleInstance, AutomationComposition.class); } @Override public ResponseEntity queryCompositionInstances(UUID compositionId, String name, String version, UUID xonaprequestid) { - return stubUtils.getResponse(pathToAllIntances, AutomationCompositions.class); + return stubUtils.getResponse(pathToAllInstances, AutomationCompositions.class); } @Override public ResponseEntity compositionInstanceState(UUID compositionId, UUID instanceId, @Valid AcInstanceStateUpdate body, UUID requestId) { - // TODO Auto-generated method stub - return null; + return new ResponseEntity<>(HttpStatus.ACCEPTED); } } diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/ParticipantControllerStub.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/ParticipantControllerStub.java index e87accf20..78c566ce4 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/ParticipantControllerStub.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/stub/ParticipantControllerStub.java @@ -52,12 +52,12 @@ public class ParticipantControllerStub extends AbstractRestController implements @Override public ResponseEntity orderAllParticipantsReport(UUID xonaprequestid) { - return new ResponseEntity(HttpStatus.ACCEPTED); + return new ResponseEntity<>(HttpStatus.ACCEPTED); } @Override public ResponseEntity orderParticipantReport(UUID participantId, UUID xonaprequestid) { - return new ResponseEntity(HttpStatus.ACCEPTED); + return new ResponseEntity<>(HttpStatus.ACCEPTED); } @Override diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/CommissioningControllerStubTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/CommissioningControllerStubTest.java index 8c956aede..2c72a8299 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/CommissioningControllerStubTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/CommissioningControllerStubTest.java @@ -70,7 +70,7 @@ class CommissioningControllerStubTest extends CommonRestController { void testPut() { var invocationBuilder = super.sendRequest(COMMISSIONING_ENDPOINT + "/" + COMPOSITION_ID); var respPost = invocationBuilder.put(Entity.json(serviceTemplate)); - assertThat(Response.Status.OK.getStatusCode()).isEqualTo(respPost.getStatus()); + assertThat(Response.Status.ACCEPTED.getStatusCode()).isEqualTo(respPost.getStatus()); } @Test diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/InstantiationControllerStubTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/InstantiationControllerStubTest.java index 9df4df886..4f3c93f43 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/InstantiationControllerStubTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/contract/InstantiationControllerStubTest.java @@ -80,7 +80,7 @@ class InstantiationControllerStubTest extends CommonRestController { + "/" + INSTANTIATION_ENDPOINT + "/" + INSTANCE_ID); var respPost = invocationBuilder.put(Entity.json(new AcInstanceStateUpdate())); - assertThat(Response.Status.OK.getStatusCode()).isEqualTo(respPost.getStatus()); + assertThat(Response.Status.ACCEPTED.getStatusCode()).isEqualTo(respPost.getStatus()); } @Test -- cgit 1.2.3-korg