Backend support for operation milestones with activities
[sdc.git] / catalog-be / src / test / java / org / openecomp / sdc / be / components / impl / ServiceBusinessLogicTest.java
index 4167036..587b902 100644 (file)
@@ -57,6 +57,7 @@ import org.openecomp.sdc.be.dao.api.ActionStatus;
 import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
 import org.openecomp.sdc.be.datatypes.elements.InterfaceInstanceDataDefinition;
 import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MilestoneDataDefinition;
 import org.openecomp.sdc.be.datatypes.elements.ToscaGetFunctionDataDefinition;
 import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
 import org.openecomp.sdc.be.datatypes.enums.ModelTypeEnum;
@@ -154,7 +155,6 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
         assertTrue(createResponse.isLeft());
     }
 
-
     @Test
     void testCreateServiceWhenGenericTypeHasProperties() {
         final Service service = createServiceObject(false);
@@ -255,8 +255,6 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
             actualService.getProperties(), is(expectedService.getProperties()));
     }
 
-
-
     /* CREATE validations - start ***********************/
     // Service name - start
 
@@ -644,7 +642,6 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
         fail();
     }
 
-
     private void testProjectCodeTooShort() {
 
         Service serviceExist = createServiceObject(false);
@@ -701,7 +698,7 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
         eitherService.left().value().setArchived(false);
         Mockito.when(toscaOperationFacade.getToscaElement(Mockito.anyString())).thenReturn(eitherService);
         final ComponentException actualException = assertThrows(ComponentException.class, () -> bl.deleteServiceAllVersions(serviceId, user));
-        assertEquals(actualException.getActionStatus(), ActionStatus.COMPONENT_NOT_ARCHIVED);
+        assertEquals(ActionStatus.COMPONENT_NOT_ARCHIVED, actualException.getActionStatus());
         assertEquals(actualException.getParams()[0], serviceId);
     }
 
@@ -893,16 +890,16 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
         newService.setServiceType("");
         resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
         assertThat(resultOfUpdate.isLeft()).isTrue();
-        //null is invalid
+        //null is valid
         newService.setServiceType(null);
         resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
-        assertThat(resultOfUpdate.isRight()).isTrue();
+        assertThat(resultOfUpdate.isLeft()).isTrue();
     }
 
     @Test
     void testCreateDefaultMetadataServiceFunction() {
         Service currentService = createServiceObject(true);
-        assertThat(currentService.getServiceFunction()).isEqualTo("");
+        assertThat(currentService.getServiceFunction()).isEmpty();
     }
 
     @Test
@@ -933,10 +930,9 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
         newService.setServiceFunction(null);
         resultOfUpdate = bl.validateAndUpdateServiceMetadata(user, currentService, newService, false, new ArrayList<>());
         assertThat(resultOfUpdate.isLeft()).isTrue();
-        assertThat(updatedService.getServiceFunction()).isEqualTo("");
+        assertThat(updatedService.getServiceFunction()).isEmpty();
     }
 
-
     @Test
     void testServiceFunctionExceedLength() {
         String serviceName = "Service";
@@ -1057,7 +1053,7 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
             new ComponentInstanceInterface("interfaceId", new InterfaceInstanceDataDefinition());
         Map<String, Operation> operationsMap = Maps.newHashMap();
         operationsMap.put(operationId, new Operation(new ArtifactDataDefinition(), "1",
-            new ListDataDefinition<>(), new ListDataDefinition<>()));
+            new ListDataDefinition<>(), new ListDataDefinition<>(), new HashMap<>()));
         componentInstanceInterface.setOperationsMap(operationsMap);
 
         Map<String, List<ComponentInstanceInterface>> componentInstancesInterfacesMap = Maps.newHashMap();
@@ -1096,7 +1092,6 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
         return propertyList;
     }
 
-
     @Test
     void testCreateService_withMultitenancyValidTenant_Success() {
         Assert.assertTrue(MULTITENANCY_ENABLED);
@@ -1113,7 +1108,6 @@ class ServiceBusinessLogicTest extends ServiceBusinessLogicBaseTestSetup {
         assertEqualsServiceObject(createServiceObject(true), createResponse.left().value());
     }
 
-
     @Test
     void testCreateService_withMultitenancyInvalidTenant_Failure() {
         Service service = createServiceObject(false);