Commit adabb620 authored by Christos Tranoris's avatar Christos Tranoris
Browse files

service order inital state

parent 793d9523
Loading
Loading
Loading
Loading
Loading
+2 −1
Changes for src/main/java/org/etsi/osl/tmf/so641/reposervices/ServiceOrderRepoService.java: 2 added lines, 1 removed line.
Original line number Original line Diff line number Diff line
@@ -1013,11 +1013,12 @@ public class ServiceOrderRepoService {
		}
		}


		Set<String> drop = (dropItemIds != null) ? new HashSet<>(dropItemIds) : Collections.emptySet();
		Set<String> drop = (dropItemIds != null) ? new HashSet<>(dropItemIds) : Collections.emptySet();
		ServiceStateType initialServiceState = new ServiceRestriction().getState();
		for (ServiceOrderItem soi : so.getOrderItem()) {
		for (ServiceOrderItem soi : so.getOrderItem()) {
			if (soi.getService() != null) {
			if (soi.getService() != null) {
				soi.getService().getSupportingService().clear();
				soi.getService().getSupportingService().clear();
				soi.getService().getSupportingResource().clear();
				soi.getService().getSupportingResource().clear();
				soi.getService().setState(null);
				soi.getService().setState(initialServiceState);
			}
			}
			soi.setState(drop.contains(soi.getId()) ? ServiceOrderStateType.CANCELLED : ServiceOrderStateType.INITIAL);
			soi.setState(drop.contains(soi.getId()) ? ServiceOrderStateType.CANCELLED : ServiceOrderStateType.INITIAL);
		}
		}
+2
Changes for src/test/java/org/etsi/osl/services/api/so641/ServiceOrderRepoServiceTest.java: 2 added lines, 0 removed lines.
Original line number Original line Diff line number Diff line
@@ -590,6 +590,8 @@ public class ServiceOrderRepoServiceTest extends BaseIT {
        assertThat(reset.getOrderItem()).hasSize(2);
        assertThat(reset.getOrderItem()).hasSize(2);
        for (ServiceOrderItem soi : reset.getOrderItem()) {
        for (ServiceOrderItem soi : reset.getOrderItem()) {
            assertThat(soi.getService().getSupportingService()).isEmpty();
            assertThat(soi.getService().getSupportingService()).isEmpty();
            // back to the state a new item's service starts in, never null
            assertThat(soi.getService().getState()).isEqualTo(ServiceStateType.FEASIBILITYCHECKED);
            assertThat(soi.getState()).isEqualTo(soi.getId().equals(dropped)
            assertThat(soi.getState()).isEqualTo(soi.getId().equals(dropped)
                    ? ServiceOrderStateType.CANCELLED : ServiceOrderStateType.INITIAL);
                    ? ServiceOrderStateType.CANCELLED : ServiceOrderStateType.INITIAL);
        }
        }