import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.oransc.rappmanager.models.rapp.Rapp;
+import com.oransc.rappmanager.models.cache.RappCacheService;
import com.oransc.rappmanager.models.csar.RappCsarConfigurationHandler;
+import com.oransc.rappmanager.models.rapp.Rapp;
+import com.oransc.rappmanager.models.rapp.RappState;
import com.oransc.rappmanager.models.rappinstance.RappInstance;
import com.oransc.rappmanager.models.rappinstance.RappSMEInstance;
-import com.oransc.rappmanager.models.rapp.RappState;
-import com.oransc.rappmanager.models.cache.RappCacheService;
import com.oransc.rappmanager.models.statemachine.RappInstanceStateMachine;
import com.oransc.rappmanager.models.statemachine.RappInstanceStateMachineConfig;
import com.oransc.rappmanager.sme.configuration.SmeConfiguration;
RappInstanceStateMachine.class})
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
@AutoConfigureMockMvc
-public class SmeDeployerTest {
+class SmeDeployerTest {
MockRestServiceServer mockServer;
@Autowired
@Autowired
RappInstanceStateMachine rappInstanceStateMachine;
@Autowired
- RappCacheService rappCacheService;
- @Autowired
ObjectMapper objectMapper;
private final String validRappFile = "valid-rapp-package.csar";
String URI_PROVIDER_REGISTRATIONS, URI_PROVIDER_REGISTRATION, URI_PUBLISH_APIS, URI_PUBLISH_API, URI_INVOKERS,
}
@Test
- void testCreateInvokerFailure() throws Exception {
+ void testCreateInvokerFailure() {
UUID rappId = UUID.randomUUID();
Rapp rapp =
Rapp.builder().rappId(rappId).name("").packageName(validRappFile).packageLocation(validCsarFileLocation)
}
@Test
- void testUndeployRappInstanceFailure() throws Exception {
+ void testUndeployRappInstanceFailure() {
UUID rappId = UUID.randomUUID();
UUID apfId = UUID.randomUUID();
List<String> invokers = List.of(String.valueOf(UUID.randomUUID()), String.valueOf(UUID.randomUUID()));
rappInstance.getSme().setProviderFunctionIds(providerFuncs.values().stream().toList());
rappInstance.getSme().setServiceApiIds(serviceApis);
rappInstance.getSme().setInvokerIds(invokers);
+ rappInstanceStateMachine.onboardRappInstance(rappInstance.getRappInstanceId());
boolean undeployRapp = smeDeployer.undeployRappInstance(rapp, rappInstance);
mockServer.verify();
assertFalse(undeployRapp);
}
+ @Test
+ void testPrimingAndDeprimingDoesNothing() {
+ assertTrue(smeDeployer.primeRapp(null));
+ assertTrue(smeDeployer.deprimeRapp(null));
+ }
+
RappInstance getRappInstance() {
RappSMEInstance rappSMEInstance = new RappSMEInstance();
rappSMEInstance.setInvokers("invoker-app1");