Search in sources :

Example 6 with Bookmark

use of org.finos.waltz.model.bookmark.Bookmark in project waltz by khartec.

the class BookmarkServiceTest method bookmarksCanDeletedById.

@Test
public void bookmarksCanDeletedById() {
    EntityReference bookmarkedEntity = mkAppRef();
    Bookmark bookmark = createBookmark(bookmarkedEntity, "test bookmark1");
    Long bookmarkId = bookmark.id().get();
    assertEquals(bookmark, svc.getById(bookmarkId));
    assertTrue(svc.deleteById(bookmark, mkUserId()));
    assertNull(svc.getById(bookmarkId));
}
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 7 with Bookmark

use of org.finos.waltz.model.bookmark.Bookmark in project waltz by khartec.

the class BookmarkServiceTest method bookmarksCanBeUpdated.

@Test
public void bookmarksCanBeUpdated() {
    EntityReference bookmarkedEntity = mkAppRef();
    Bookmark bookmark = createBookmark(bookmarkedEntity, "test bookmark1");
    Long bookmarkId = bookmark.id().get();
    assertEquals(bookmark, svc.getById(bookmarkId));
    ImmutableBookmark updatedBookmark = ImmutableBookmark.copyOf(bookmark).withTitle("Updated").withLastUpdatedAt(DateTimeUtilities.today().atStartOfDay().plusHours(1));
    svc.update(updatedBookmark, "admin");
    assertEquals(updatedBookmark, svc.getById(bookmarkId));
}
Also used : Bookmark(org.finos.waltz.model.bookmark.Bookmark) ImmutableBookmark(org.finos.waltz.model.bookmark.ImmutableBookmark) 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 8 with Bookmark

use of org.finos.waltz.model.bookmark.Bookmark in project waltz by khartec.

the class BookmarkServiceTest method bookmarksAreAttachedToSpecificEntities.

@Test
public void bookmarksAreAttachedToSpecificEntities() {
    EntityReference bookmarkedEntity = mkAppRef();
    EntityReference anotherBookmarkedEntity = mkAppRef();
    Bookmark bookmark1 = createBookmark(bookmarkedEntity, "test bookmark1");
    Bookmark bookmark2 = createBookmark(anotherBookmarkedEntity, "test bookmark2");
    List<Bookmark> bookmarksForFirstEntity = svc.findByReference(bookmarkedEntity);
    assertEquals(1, bookmarksForFirstEntity.size());
    assertTrue(bookmarksForFirstEntity.contains(bookmark1));
    List<Bookmark> bookmarksForSecondEntity = svc.findByReference(anotherBookmarkedEntity);
    assertEquals(1, bookmarksForSecondEntity.size());
    assertTrue(bookmarksForSecondEntity.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)

Aggregations

EntityReference (org.finos.waltz.model.EntityReference)8 Bookmark (org.finos.waltz.model.bookmark.Bookmark)8 BaseInMemoryIntegrationTest (org.finos.waltz.integration_test.inmem.BaseInMemoryIntegrationTest)7 ImmutableBookmark (org.finos.waltz.model.bookmark.ImmutableBookmark)7 Test (org.junit.jupiter.api.Test)7 Collections.emptySet (java.util.Collections.emptySet)1 List (java.util.List)1 Set (java.util.Set)1 TestCase.assertTrue (junit.framework.TestCase.assertTrue)1 CollectionUtilities.first (org.finos.waltz.common.CollectionUtilities.first)1 DateTimeUtilities (org.finos.waltz.common.DateTimeUtilities)1 SetUtilities (org.finos.waltz.common.SetUtilities)1 SetUtilities.asSet (org.finos.waltz.common.SetUtilities.asSet)1 NameHelper.mkUserId (org.finos.waltz.integration_test.inmem.helpers.NameHelper.mkUserId)1 EntityKind (org.finos.waltz.model.EntityKind)1 EntityReference.mkRef (org.finos.waltz.model.EntityReference.mkRef)1 HierarchyQueryScope (org.finos.waltz.model.HierarchyQueryScope)1 IdSelectionOptions (org.finos.waltz.model.IdSelectionOptions)1 IdSelectionOptions.mkOpts (org.finos.waltz.model.IdSelectionOptions.mkOpts)1 BookmarkKindValue (org.finos.waltz.model.bookmark.BookmarkKindValue)1