Search in sources :

Example 16 with EntityReference

use of org.finos.waltz.model.EntityReference 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 17 with EntityReference

use of org.finos.waltz.model.EntityReference 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 18 with EntityReference

use of org.finos.waltz.model.EntityReference 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)

Example 19 with EntityReference

use of org.finos.waltz.model.EntityReference in project waltz by khartec.

the class BookmarkServiceTest method bookmarksCanBeCreated.

@Test
public void bookmarksCanBeCreated() {
    EntityReference bookmarkedEntity = mkAppRef();
    Bookmark bookmark1 = createBookmark(bookmarkedEntity, "test bookmark1");
    Bookmark bookmark2 = createBookmark(bookmarkedEntity, "test bookmark2");
    List<Bookmark> bookmarks = svc.findByReference(bookmarkedEntity);
    assertEquals(2, bookmarks.size());
    assertTrue(bookmarks.contains(bookmark1));
    assertTrue(bookmarks.contains(bookmark2));
}
Also used : Bookmark(org.finos.waltz.model.bookmark.Bookmark) ImmutableBookmark(org.finos.waltz.model.bookmark.ImmutableBookmark) EntityReference(org.finos.waltz.model.EntityReference) BaseInMemoryIntegrationTest(org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 20 with EntityReference

use of org.finos.waltz.model.EntityReference in project waltz by khartec.

the class BookmarkServiceTest method bookmarksCanBeFoundBySelector.

@Test
public void bookmarksCanBeFoundBySelector() {
    EntityReference appRef1 = mkAppRef();
    EntityReference appRef2 = mkAppRef();
    createBookmark(appRef1, "a");
    createBookmark(appRef1, "b");
    createBookmark(appRef2, "c");
    Set<Bookmark> matches = svc.findByBookmarkIdSelector(mkOpts(appRef1, HierarchyQueryScope.EXACT));
    assertEquals(2, matches.size());
    assertEquals(asSet("a", "b"), SetUtilities.map(matches, m -> m.title().get()));
}
Also used : Bookmark(org.finos.waltz.model.bookmark.Bookmark) CollectionUtilities.first(org.finos.waltz.common.CollectionUtilities.first) IdSelectionOptions(org.finos.waltz.model.IdSelectionOptions) BookmarkKindValue(org.finos.waltz.model.bookmark.BookmarkKindValue) Collections.emptySet(java.util.Collections.emptySet) BaseInMemoryIntegrationTest(org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest) EntityKind(org.finos.waltz.model.EntityKind) IdSelectionOptions.mkOpts(org.finos.waltz.model.IdSelectionOptions.mkOpts) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) Autowired(org.springframework.beans.factory.annotation.Autowired) Set(java.util.Set) SetUtilities.asSet(org.finos.waltz.common.SetUtilities.asSet) EntityReference.mkRef(org.finos.waltz.model.EntityReference.mkRef) Test(org.junit.jupiter.api.Test) List(java.util.List) NameHelper.mkUserId(org.finos.waltz.integration_test.inmem.helpers.NameHelper.mkUserId) DateTimeUtilities(org.finos.waltz.common.DateTimeUtilities) TestCase.assertTrue(junit.framework.TestCase.assertTrue) SetUtilities(org.finos.waltz.common.SetUtilities) EntityReference(org.finos.waltz.model.EntityReference) ImmutableBookmark(org.finos.waltz.model.bookmark.ImmutableBookmark) BookmarkService(org.finos.waltz.service.bookmark.BookmarkService) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) HierarchyQueryScope(org.finos.waltz.model.HierarchyQueryScope) Bookmark(org.finos.waltz.model.bookmark.Bookmark) ImmutableBookmark(org.finos.waltz.model.bookmark.ImmutableBookmark) EntityReference(org.finos.waltz.model.EntityReference) BaseInMemoryIntegrationTest(org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

EntityReference (org.finos.waltz.model.EntityReference)114 BaseInMemoryIntegrationTest (org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest)55 Test (org.junit.jupiter.api.Test)55 LogicalFlow (org.finos.waltz.model.logical_flow.LogicalFlow)40 EntityKind (org.finos.waltz.model.EntityKind)23 List (java.util.List)21 IdSelectionOptions (org.finos.waltz.model.IdSelectionOptions)19 Autowired (org.springframework.beans.factory.annotation.Autowired)17 DataTypeDecorator (org.finos.waltz.model.datatype.DataTypeDecorator)16 Set (java.util.Set)14 Collection (java.util.Collection)13 EntityReference.mkRef (org.finos.waltz.model.EntityReference.mkRef)13 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)10 IdSelectionOptions.mkOpts (org.finos.waltz.model.IdSelectionOptions.mkOpts)9 DateTimeUtilities (org.finos.waltz.common.DateTimeUtilities)8 ListUtilities.newArrayList (org.finos.waltz.common.ListUtilities.newArrayList)8 Bookmark (org.finos.waltz.model.bookmark.Bookmark)8 Collections.emptyList (java.util.Collections.emptyList)7 Collectors (java.util.stream.Collectors)7 CollectionUtilities.first (org.finos.waltz.common.CollectionUtilities.first)7