Search in sources :

Example 71 with LogicalFlow

use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.

the class LogicalFlowTest 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(lfDao.findBySelector(logicalFlowIdSelectorFactory.apply(mkOpts(mkRef(EntityKind.ORG_UNIT, ouIds.root), CHILDREN))), IdProvider::id), "find by root ou gives all");
    assertEquals(asSet(ac.id()), map(lfDao.findBySelector(logicalFlowIdSelectorFactory.apply(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 72 with LogicalFlow

use of org.finos.waltz.model.logical_flow.LogicalFlow in project waltz by khartec.

the class LogicalFlowTest method basicDirectAssociations.

@Test
public void basicDirectAssociations() {
    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("c", ouIds.b);
    // a -> b
    // a -> d
    // c
    LogicalFlow ab = helper.createLogicalFlow(a, b);
    LogicalFlow ad = helper.createLogicalFlow(a, d);
    assertEquals(asSet(ab.id(), ad.id()), map(lfDao.findByEntityReference(a), IdProvider::id), "Can see flow associated to 'a'");
    assertEquals(asSet(ab.id()), map(lfDao.findByEntityReference(b), IdProvider::id), "Can sees flows associated to 'b'");
    assertEquals(asSet(ad.id()), map(lfDao.findByEntityReference(d), IdProvider::id), "Can sees flows associated to 'd'");
    assertTrue(isEmpty(lfDao.findByEntityReference(c)), "Can sees nothing associated to 'c'");
}
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