put request in invoker manager

Change-Id: Ic824eaa7089854d80f25ea14b6af5a9997d7006a
diff --git a/capifcorejava/src/main/java/org/oransc/nonrtric/plt/capifcore/controller/InvokerManager.java b/capifcorejava/src/main/java/org/oransc/nonrtric/plt/capifcore/controller/InvokerManager.java
index 7baa551..c16d565 100644
--- a/capifcorejava/src/main/java/org/oransc/nonrtric/plt/capifcore/controller/InvokerManager.java
+++ b/capifcorejava/src/main/java/org/oransc/nonrtric/plt/capifcore/controller/InvokerManager.java
@@ -96,6 +96,20 @@
         return new ResponseEntity<>(HttpStatus.NO_CONTENT);
     }
 
+    @Override
+    public ResponseEntity<APIInvokerEnrolmentDetails> onboardedInvokersOnboardingIdPut(String onboardingId,
+            APIInvokerEnrolmentDetails apIInvokerEnrolmentDetails) {
+
+        if (!onboardingId.equals(apIInvokerEnrolmentDetails.getApiInvokerId())) {
+            throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Invoker ApiInvokerId not matching");
+        }
+        if (onboardedInvokers.containsKey(onboardingId)) {
+            onboardedInvokers.put(apIInvokerEnrolmentDetails.getApiInvokerId(), apIInvokerEnrolmentDetails);
+        } else {
+            throw new ResponseStatusException(HttpStatus.NOT_FOUND, "The invoker to update has not been onboarded");
+        }
+        return ResponseEntity.ok(apIInvokerEnrolmentDetails);
+    }
 
     @Override
     public ResponseEntity<APIInvokerEnrolmentDetails> modifyIndApiInvokeEnrolment(String onboardingId,
diff --git a/capifcorejava/src/test/java/org/oransc/nonrtric/plt/capifcore/controller/InvokerManagerTest.java b/capifcorejava/src/test/java/org/oransc/nonrtric/plt/capifcore/controller/InvokerManagerTest.java
index 40d1297..1cf102b 100644
--- a/capifcorejava/src/test/java/org/oransc/nonrtric/plt/capifcore/controller/InvokerManagerTest.java
+++ b/capifcorejava/src/test/java/org/oransc/nonrtric/plt/capifcore/controller/InvokerManagerTest.java
@@ -53,6 +53,7 @@
         apiRegister = mock(ApiRegister.class);

         managerUnderTest = new InvokerManager(apiRegister);

         apiInvokerEnrolmentDetails.apiInvokerInformation("apiInvokerInformation");

+        apiInvokerEnrolmentDetails.setApiInvokerId("api_invoker_id_apiInvokerInformation");

 

     }

 

@@ -79,4 +80,14 @@
 

     }

 

+    @Test

+    @DisplayName("Update the invoker")

+    void testUpdateTheInvoker() {

+        managerUnderTest.onboardedInvokersPost(apiInvokerEnrolmentDetails);

+        ResponseEntity<APIInvokerEnrolmentDetails> response = managerUnderTest

+                .onboardedInvokersOnboardingIdPut("api_invoker_id_apiInvokerInformation", apiInvokerEnrolmentDetails);

+        assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);

+

+    }

+

 }