Search in sources :

Example 16 with TagDefinitionModelDao

use of org.killbill.billing.util.tag.dao.TagDefinitionModelDao in project killbill by killbill.

the class TestTagStore method testTagDefinitionDeletionForDefinitionInUse.

@Test(groups = "slow", expectedExceptions = TagDefinitionApiException.class)
public void testTagDefinitionDeletionForDefinitionInUse() throws TagDefinitionApiException, TagApiException {
    final String definitionName = "TestTag12345";
    eventsListener.pushExpectedEvent(NextEvent.TAG_DEFINITION);
    tagDefinitionDao.create(definitionName, "Some test tag", internalCallContext);
    assertListenerStatus();
    final TagDefinitionModelDao tagDefinition = tagDefinitionDao.getByName(definitionName, internalCallContext);
    assertNotNull(tagDefinition);
    final UUID objectId = UUID.randomUUID();
    final Tag tag = new DescriptiveTag(tagDefinition.getId(), ObjectType.ACCOUNT, objectId, internalCallContext.getCreatedDate());
    eventsListener.pushExpectedEvent(NextEvent.TAG);
    tagDao.create(new TagModelDao(tag), internalCallContext);
    assertListenerStatus();
    tagDefinitionDao.deleteById(tagDefinition.getId(), internalCallContext);
}
Also used : TagModelDao(org.killbill.billing.util.tag.dao.TagModelDao) TagDefinitionModelDao(org.killbill.billing.util.tag.dao.TagDefinitionModelDao) UUID(java.util.UUID) Test(org.testng.annotations.Test)

Aggregations

TagDefinitionModelDao (org.killbill.billing.util.tag.dao.TagDefinitionModelDao)16 Test (org.testng.annotations.Test)15 UUID (java.util.UUID)12 TagDefinition (org.killbill.billing.util.tag.TagDefinition)9 DefaultTagDefinition (org.killbill.billing.util.tag.DefaultTagDefinition)8 TagModelDao (org.killbill.billing.util.tag.dao.TagModelDao)5 ObjectType (org.killbill.billing.ObjectType)4 TagDefinitionInternalEvent (org.killbill.billing.events.TagDefinitionInternalEvent)4 TagInternalEvent (org.killbill.billing.events.TagInternalEvent)4 DescriptiveTag (org.killbill.billing.util.tag.DescriptiveTag)2 Tag (org.killbill.billing.util.tag.Tag)2 InternalCallContext (org.killbill.billing.callcontext.InternalCallContext)1 ControlTagCreationInternalEvent (org.killbill.billing.events.ControlTagCreationInternalEvent)1 ControlTagDefinitionCreationInternalEvent (org.killbill.billing.events.ControlTagDefinitionCreationInternalEvent)1 ControlTagDefinitionDeletionInternalEvent (org.killbill.billing.events.ControlTagDefinitionDeletionInternalEvent)1 ControlTagDeletionInternalEvent (org.killbill.billing.events.ControlTagDeletionInternalEvent)1 UserTagCreationInternalEvent (org.killbill.billing.events.UserTagCreationInternalEvent)1 UserTagDefinitionCreationInternalEvent (org.killbill.billing.events.UserTagDefinitionCreationInternalEvent)1 UserTagDefinitionDeletionInternalEvent (org.killbill.billing.events.UserTagDefinitionDeletionInternalEvent)1 UserTagDeletionInternalEvent (org.killbill.billing.events.UserTagDeletionInternalEvent)1