Search in sources :

Example 6 with Tag

use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.

the class TagEventListenerTest method onMerge.

@Test
public void onMerge() throws HibernateException {
    MergeEvent event = new MergeEvent(new Tag("value"), null);
    event.setEntity(new Tag("value"));
    listener.onMerge(event);
    verify(cacheProvider).removeObject(CacheKey.tagList());
}
Also used : MergeEvent(org.hibernate.event.spi.MergeEvent) Tag(org.sagebionetworks.bridge.models.Tag) Test(org.testng.annotations.Test)

Example 7 with Tag

use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.

the class TagEventListenerTest method onSaveOrUpdate.

@Test
public void onSaveOrUpdate() throws HibernateException {
    SaveOrUpdateEvent event = new SaveOrUpdateEvent(new Tag("value"), null);
    listener.onSaveOrUpdate(event);
    verify(cacheProvider).removeObject(CacheKey.tagList());
}
Also used : SaveOrUpdateEvent(org.hibernate.event.spi.SaveOrUpdateEvent) Tag(org.sagebionetworks.bridge.models.Tag) Test(org.testng.annotations.Test)

Example 8 with Tag

use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.

the class TagEventListenerTest method onPersistWithCreatedMap.

@Test
public void onPersistWithCreatedMap() throws HibernateException {
    PersistEvent event = new PersistEvent(new Tag("value"), null);
    listener.onPersist(event, null);
    verify(cacheProvider).removeObject(CacheKey.tagList());
}
Also used : PersistEvent(org.hibernate.event.spi.PersistEvent) Tag(org.sagebionetworks.bridge.models.Tag) Test(org.testng.annotations.Test)

Example 9 with Tag

use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.

the class TagEventListenerTest method onDelete.

@Test
public void onDelete() throws HibernateException {
    DeleteEvent event = new DeleteEvent(new Tag("value"), null);
    listener.onDelete(event);
    verify(cacheProvider).removeObject(CacheKey.tagList());
}
Also used : DeleteEvent(org.hibernate.event.spi.DeleteEvent) Tag(org.sagebionetworks.bridge.models.Tag) Test(org.testng.annotations.Test)

Example 10 with Tag

use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.

the class HibernateTagDaoTest method getTags.

@Test
public void getTags() {
    List<Tag> list = ImmutableList.of(new Tag("a:1"), new Tag("a:2"), new Tag("a:3"), new Tag("a:4"), new Tag("a:5"), new Tag("b:6"), new Tag("b:7"), new Tag("b:8"), new Tag("b:9"), new Tag("b:0"), new Tag("a:10"), new Tag("defaultTag"));
    when(mockHelper.queryGet("from Tag", null, null, null, Tag.class)).thenReturn(list);
    Map<String, List<String>> retValue = dao.getTags();
    assertEquals(3, retValue.keySet().size());
    assertEquals(ImmutableList.of("defaultTag"), retValue.get("default"));
    assertEquals(ImmutableList.of("1", "2", "3", "4", "5", "10"), retValue.get("a"));
    assertEquals(ImmutableList.of("6", "7", "8", "9", "0"), retValue.get("b"));
}
Also used : List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) Tag(org.sagebionetworks.bridge.models.Tag) Test(org.testng.annotations.Test)

Aggregations

Tag (org.sagebionetworks.bridge.models.Tag)13 Test (org.testng.annotations.Test)9 DeleteEvent (org.hibernate.event.spi.DeleteEvent)2 MergeEvent (org.hibernate.event.spi.MergeEvent)2 PersistEvent (org.hibernate.event.spi.PersistEvent)2 ImmutableList (com.google.common.collect.ImmutableList)1 List (java.util.List)1 SaveOrUpdateEvent (org.hibernate.event.spi.SaveOrUpdateEvent)1 StatusMessage (org.sagebionetworks.bridge.models.StatusMessage)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)1