+ when(dmeDeployer.undeployRappInstance(any(), any())).thenReturn(true);
+ assertEquals(HttpStatus.BAD_GATEWAY, rappService.undeployRappInstance(rapp, rappInstance).getStatusCode());
+ }
+
+ @Test
+ void testUndeployRappInstanceDmeFailure() {
+ Rapp rapp = Rapp.builder().rappId(UUID.randomUUID()).name("").packageName(validRappFile)
+ .packageLocation(validCsarFileLocation).state(RappState.PRIMED).build();
+ RappInstance rappInstance = new RappInstance();
+ rappInstance.setState(RappInstanceState.DEPLOYED);
+ rappInstanceStateMachine.onboardRappInstance(rappInstance.getRappInstanceId());
+ when(acmDeployer.undeployRappInstance(any(), any())).thenReturn(true);
+ when(smeDeployer.undeployRappInstance(any(), any())).thenReturn(true);
+ when(dmeDeployer.undeployRappInstance(any(), any())).thenReturn(false);