use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.
the class TagControllerTest method addTag.
@Test
public void addTag() throws Exception {
doReturn(session).when(controller).getAuthenticatedSession(SUPERADMIN);
mockRequestBody(mockRequest, new Tag("tagValue"));
controller.addTag();
verify(mockService).addTag("tagValue");
}
use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.
the class TagEventListenerTest method onDeleteWithTransientEntities.
@Test
public void onDeleteWithTransientEntities() throws HibernateException {
DeleteEvent event = new DeleteEvent(new Tag("value"), null);
listener.onDelete(event, null);
verify(cacheProvider).removeObject(CacheKey.tagList());
}
use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.
the class TagEventListenerTest method onPersist.
@Test
public void onPersist() throws HibernateException {
PersistEvent event = new PersistEvent(new Tag("value"), null);
listener.onPersist(event);
verify(cacheProvider).removeObject(CacheKey.tagList());
}
use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.
the class TagEventListenerTest method onMergeWithCopiedAlready.
@Test
public void onMergeWithCopiedAlready() throws HibernateException {
MergeEvent event = new MergeEvent(new Tag("value"), null);
event.setEntity(new Tag("value"));
listener.onMerge(event, null);
verify(cacheProvider).removeObject(CacheKey.tagList());
}
use of org.sagebionetworks.bridge.models.Tag in project BridgeServer2 by Sage-Bionetworks.
the class TagController method addTag.
@PostMapping("/v1/tags")
@ResponseStatus(HttpStatus.CREATED)
public StatusMessage addTag() {
getAuthenticatedSession(SUPERADMIN);
Tag tag = parseJson(Tag.class);
// This method is provided so Sage admins can seed the tags we wish to use
tagService.addTag(tag.getValue());
return new StatusMessage("Tag created if not already present.");
}
Aggregations