use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.
the class LogicalFlowServiceTest method bySelector.
@Test
public void bySelector() {
EntityReference a = appHelper.createNewApp("a", ouIds.a);
EntityReference b = appHelper.createNewApp("b", ouIds.a1);
EntityReference c = appHelper.createNewApp("c", ouIds.b);
// a -> b
// a -> c
// c
LogicalFlow ab = helper.createLogicalFlow(a, b);
LogicalFlow ac = helper.createLogicalFlow(a, c);
assertEquals(asSet(ab.id(), ac.id()), map(lfSvc.findBySelector(mkOpts(mkRef(EntityKind.ORG_UNIT, ouIds.root), CHILDREN)), IdProvider::id), "find by root ou gives all");
assertEquals(asSet(ac.id()), map(lfSvc.findBySelector(mkOpts(mkRef(EntityKind.ORG_UNIT, ouIds.b), CHILDREN)), IdProvider::id), "find by ou 'b' gives only one flow");
}
use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.
the class LogicalFlowServiceTest method findActiveByFlowIdsTest.
@Test
public void findActiveByFlowIdsTest() {
EntityReference a = appHelper.createNewApp("a", ouIds.a);
EntityReference b = appHelper.createNewApp("b", ouIds.a1);
EntityReference c = appHelper.createNewApp("c", ouIds.b);
EntityReference d = appHelper.createNewApp("d", ouIds.b);
// a -> b
// a -> c
LogicalFlow ab = helper.createLogicalFlow(a, b);
LogicalFlow ac = helper.createLogicalFlow(a, c);
LogicalFlow ad = helper.createLogicalFlow(a, d);
int removedFlowCount = lfSvc.removeFlow(ab.id().get(), "logicalFlowServiceTestRemoveFlow");
Collection<LogicalFlow> activeFlows = lfSvc.findActiveByFlowIds(asSet(ab.id().get(), ac.id().get(), ad.id().get()));
Set<Long> activeFlowIds = map(activeFlows, r -> r.id().get());
assertEquals(activeFlows.size(), 2);
assertEquals(asSet(ad.id().get(), ac.id().get()), activeFlowIds);
assertEquals(asSet(ac.id().get(), ad.id().get()), activeFlowIds);
}
use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.
the class AttestationPreCheckServiceTest method notAllowedToAttestAttestIfUnknownIncomingDataTypeFlows.
@Test
public void notAllowedToAttestAttestIfUnknownIncomingDataTypeFlows() {
EntityReference aRef = mkNewAppRef();
EntityReference bRef = mkNewAppRef();
// create flow with unknown datatype
long unkId = dataTypeHelper.createUnknownDatatype();
LogicalFlow flow = lfHelper.createLogicalFlow(aRef, bRef);
lfHelper.createLogicalFlowDecorators(flow.entityReference(), asSet(unkId));
List<String> aResult = aipcSvc.calcLogicalFlowPreCheckFailures(aRef);
assertTrue(aResult.isEmpty(), "ok as unknown is outgoing");
List<String> bResult = aipcSvc.calcLogicalFlowPreCheckFailures(bRef);
assertFalse(bResult.isEmpty(), "should fail as unknown is incoming");
}
use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.
the class AttestationPreCheckServiceTest method allowedToAttestAttestIfInExemptionGroupAndUnknownIncomingDataTypeFlows.
@Test
public void allowedToAttestAttestIfInExemptionGroupAndUnknownIncomingDataTypeFlows() throws InsufficientPrivelegeException {
EntityReference aRef = mkNewAppRef();
EntityReference bRef = mkNewAppRef();
// create flow with unknown datatype
long unkId = dataTypeHelper.createUnknownDatatype();
LogicalFlow flow = lfHelper.createLogicalFlow(aRef, bRef);
lfHelper.createLogicalFlowDecorators(flow.entityReference(), asSet(unkId));
createGroupWithApps(AttestationPreCheckDao.GROUP_LOGICAL_FLOW_ATTESTATION_EXEMPT_FROM_UNKNOWN_DATA_TYPE_CHECK, bRef);
List<String> bResult = aipcSvc.calcLogicalFlowPreCheckFailures(bRef);
assertTrue(bResult.isEmpty(), "should pass as target app is in exemption from unknown flows group");
}
use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.
the class AttestationPreCheckServiceTest method notAllowedToAttestAttestIfDeprecatedIncomingDataTypeFlows.
@Test
public void notAllowedToAttestAttestIfDeprecatedIncomingDataTypeFlows() {
EntityReference aRef = mkNewAppRef();
EntityReference bRef = mkNewAppRef();
// create flow with deprecated datatype
long deprecatedTypeId = createDeprecatedDataType();
LogicalFlow flow = lfHelper.createLogicalFlow(aRef, bRef);
lfHelper.createLogicalFlowDecorators(flow.entityReference(), asSet(deprecatedTypeId));
List<String> aResult = aipcSvc.calcLogicalFlowPreCheckFailures(aRef);
assertTrue(aResult.isEmpty(), "ok as deprecated is outgoing");
List<String> bResult = aipcSvc.calcLogicalFlowPreCheckFailures(bRef);
assertFalse(bResult.isEmpty(), "should fail as deprecated is incoming");
}
Aggregations