Search in sources :

Example 21 with LogicalFlow

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");
}
Also used : LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) EntityReference(org.finos.waltz.model.EntityReference) BaseInMemoryIntegrationTest(org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 22 with LogicalFlow

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);
}
Also used : LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) EntityReference(org.finos.waltz.model.EntityReference) BaseInMemoryIntegrationTest(org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 23 with LogicalFlow

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");
}
Also used : LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) EntityReference(org.finos.waltz.model.EntityReference) BaseInMemoryIntegrationTest(org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 24 with LogicalFlow

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");
}
Also used : LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) EntityReference(org.finos.waltz.model.EntityReference) BaseInMemoryIntegrationTest(org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 25 with LogicalFlow

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");
}
Also used : LogicalFlow(org.finos.waltz.model.logical_flow.LogicalFlow) EntityReference(org.finos.waltz.model.EntityReference) BaseInMemoryIntegrationTest(org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

LogicalFlow (org.finos.waltz.model.logical_flow.LogicalFlow)72 BaseInMemoryIntegrationTest (org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest)52 Test (org.junit.jupiter.api.Test)52 EntityReference (org.finos.waltz.model.EntityReference)40 PhysicalSpecification (org.finos.waltz.model.physical_specification.PhysicalSpecification)21 ImmutablePhysicalSpecification (org.finos.waltz.model.physical_specification.ImmutablePhysicalSpecification)15 EntityReference.mkRef (org.finos.waltz.model.EntityReference.mkRef)13 DataTypeDecorator (org.finos.waltz.model.datatype.DataTypeDecorator)13 LogicalFlowService (org.finos.waltz.service.logical_flow.LogicalFlowService)13 Autowired (org.springframework.beans.factory.annotation.Autowired)13 Collections.emptyList (java.util.Collections.emptyList)12 List (java.util.List)12 SetUtilities.map (org.finos.waltz.common.SetUtilities.map)12 Collection (java.util.Collection)11 IdSelectionOptions.mkOpts (org.finos.waltz.model.IdSelectionOptions.mkOpts)11 Collections.emptySet (java.util.Collections.emptySet)10 SetUtilities.asSet (org.finos.waltz.common.SetUtilities.asSet)10 Assertions (org.junit.jupiter.api.Assertions)10 DateTimeUtilities (org.finos.waltz.common.DateTimeUtilities)9 org.finos.waltz.integration_test.inmem.helpers (org.finos.waltz.integration_test.inmem.helpers)9