Search in sources :

Example 6 with Bookmark

use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.

the class BookmarkDaoTest method testRemove.

/**
 * Ensures that removing a bookmark works as expected.
 */
@Test
public void testRemove() {
    dao.remove(existing_bookmark.getId());
    Bookmark result = dao.get(existing_bookmark.getId());
    assertNull(result);
}
Also used : Bookmark(org.ovirt.engine.core.common.businessentities.Bookmark) Test(org.junit.Test)

Example 7 with Bookmark

use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.

the class BookmarkDaoTest method testGetByName.

/**
 * Ensures that finding by name works as expected.
 */
@Test
public void testGetByName() {
    Bookmark result = dao.getByName(existing_bookmark.getName());
    assertNotNull(result);
    assertEquals(existing_bookmark.getName(), result.getName());
}
Also used : Bookmark(org.ovirt.engine.core.common.businessentities.Bookmark) Test(org.junit.Test)

Example 8 with Bookmark

use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.

the class BookmarkDaoTest method testGetByNameWithInvalidName.

/**
 * Ensures that, if the supplied name is invalid, then no bookmark is returned.
 */
@Test
public void testGetByNameWithInvalidName() {
    Bookmark result = dao.getByName("thisnameisinvalid");
    assertNull(result);
}
Also used : Bookmark(org.ovirt.engine.core.common.businessentities.Bookmark) Test(org.junit.Test)

Example 9 with Bookmark

use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.

the class BookmarkDaoTest method testUpdate.

/**
 * Ensures that updating a bookmark works as expected.
 */
@Test
public void testUpdate() {
    existing_bookmark.setName(existing_bookmark.getName().toUpperCase());
    dao.update(existing_bookmark);
    Bookmark result = dao.get(existing_bookmark.getId());
    assertNotNull(result);
    assertEquals(existing_bookmark.getName(), result.getName());
}
Also used : Bookmark(org.ovirt.engine.core.common.businessentities.Bookmark) Test(org.junit.Test)

Example 10 with Bookmark

use of org.ovirt.engine.core.common.businessentities.Bookmark in project ovirt-engine by oVirt.

the class BookmarkDaoTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    dao = dbFacade.getBookmarkDao();
    // create some test data
    new_bookmark = new Bookmark();
    Random r = new Random(System.currentTimeMillis());
    new_bookmark.setName("newbookmarkname" + (r.nextInt() % BOOKMARK_MAX_RANDOM_NUMBER));
    new_bookmark.setValue("newbookmarkvalue");
    existing_bookmark = dao.get(new Guid("a4affabf-7b45-4a6c-b0a9-107d0bbe265e"));
}
Also used : Bookmark(org.ovirt.engine.core.common.businessentities.Bookmark) Random(java.util.Random) Guid(org.ovirt.engine.core.compat.Guid) Before(org.junit.Before)

Aggregations

Bookmark (org.ovirt.engine.core.common.businessentities.Bookmark)16 Test (org.junit.Test)8 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 Inject (com.google.inject.Inject)2 HandlerRegistration (com.google.web.bindery.event.shared.HandlerRegistration)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 BookmarksOperationParameters (org.ovirt.engine.core.common.action.BookmarksOperationParameters)2 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)2 Guid (org.ovirt.engine.core.compat.Guid)2 AsyncCallback (org.ovirt.engine.ui.frontend.AsyncCallback)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 SearchableListModel (org.ovirt.engine.ui.uicommonweb.models.SearchableListModel)2 BookmarkListModel (org.ovirt.engine.ui.uicommonweb.models.bookmarks.BookmarkListModel)2 IFrontendActionAsyncCallback (org.ovirt.engine.ui.uicompat.IFrontendActionAsyncCallback)2 BookmarkModelProvider (org.ovirt.engine.ui.webadmin.uicommon.model.BookmarkModelProvider)2 Scheduler (com.google.gwt.core.client.Scheduler)1 HasClickHandlers (com.google.gwt.event.dom.client.HasClickHandlers)1 HasKeyDownHandlers (com.google.gwt.event.dom.client.HasKeyDownHandlers)1 KeyCodes (com.google.gwt.event.dom.client.KeyCodes)1