Support for optional rApp and rApp instance parameters
[nonrtric/plt/rappmanager.git] / rapp-manager-sme / src / test / java / com / oransc / rappmanager / sme / service / SmeDeployerTest.java
index e1b3752..4574ada 100755 (executable)
@@ -297,6 +297,18 @@ class SmeDeployerTest {
         assertTrue(deployRapp);
     }
 
+    @Test
+    void testDeployRappInstanceWithoutSme() throws Exception {
+        UUID rappId = UUID.randomUUID();
+        Rapp rapp =
+                Rapp.builder().rappId(rappId).name("").packageName(validRappFile).packageLocation(validCsarFileLocation)
+                        .state(RappState.PRIMED).build();
+        RappInstance rappInstance = getRappInstance();
+        rappInstance.setSme(null);
+        rappInstanceStateMachine.onboardRappInstance(rappInstance.getRappInstanceId());
+        assertTrue(smeDeployer.deployRappInstance(rapp, rappInstance));
+    }
+
     @Test
     void testDeployRappFailure() throws Exception {
         UUID rappId = UUID.randomUUID();
@@ -362,6 +374,16 @@ class SmeDeployerTest {
         assertTrue(undeployRapp);
     }
 
+    @Test
+    void testUndeployRappInstanceWithoutSme() {
+        UUID rappId = UUID.randomUUID();
+        Rapp rapp = Rapp.builder().rappId(rappId).name(rappId.toString()).packageName(validRappFile)
+                            .packageLocation(validCsarFileLocation).state(RappState.COMMISSIONED).build();
+        RappInstance rappInstance = getRappInstance();
+        rappInstance.setSme(null);
+        assertTrue(smeDeployer.undeployRappInstance(rapp, rappInstance));
+    }
+
     @Test
     void testUndeployRappInstanceFailure() {
         UUID rappId = UUID.randomUUID();