use of org.killbill.billing.util.tag.dao.TagDefinitionModelDao in project killbill by killbill.
the class TestTagEventBuilder method testNewControlTagDefinitionDeletionEvent.
@Test(groups = "fast")
public void testNewControlTagDefinitionDeletionEvent() throws Exception {
final UUID tagDefinitionId = ControlTagType.AUTO_PAY_OFF.getId();
final String tagDefinitionName = UUID.randomUUID().toString();
final String tagDefinitionDescription = UUID.randomUUID().toString();
final boolean controlTag = true;
final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
final UUID userToken = internalCallContext.getUserToken();
final TagEventBuilder tagEventBuilder = new TagEventBuilder();
final TagDefinitionInternalEvent event = tagEventBuilder.newControlTagDefinitionDeletionEvent(tagDefinitionId, new TagDefinitionModelDao(tagDefinition), 1L, 2L, UUID.randomUUID());
Assert.assertTrue(event instanceof ControlTagDefinitionDeletionInternalEvent);
Assert.assertEquals(event, new DefaultControlTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, 1L, 2L, UUID.randomUUID()));
Assert.assertTrue(event.equals(new DefaultControlTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, 1L, 2L, UUID.randomUUID())));
verifyTagDefinitionEvent(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
}
use of org.killbill.billing.util.tag.dao.TagDefinitionModelDao in project killbill by killbill.
the class TestTagEventBuilder method testNewControlTagDeletionEvent.
@Test(groups = "fast")
public void testNewControlTagDeletionEvent() throws Exception {
final UUID tagId = UUID.randomUUID();
final UUID objectId = UUID.randomUUID();
final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
final UUID tagDefinitionId = ControlTagType.AUTO_PAY_OFF.getId();
final String tagDefinitionName = UUID.randomUUID().toString();
final String tagDefinitionDescription = UUID.randomUUID().toString();
final boolean controlTag = true;
final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
final UUID userToken = internalCallContext.getUserToken();
final TagEventBuilder tagEventBuilder = new TagEventBuilder();
final TagInternalEvent event = tagEventBuilder.newControlTagDeletionEvent(tagId, objectId, objectType, new TagDefinitionModelDao(tagDefinition), 1L, 2L, UUID.randomUUID());
Assert.assertTrue(event instanceof ControlTagDeletionInternalEvent);
Assert.assertEquals(event, new DefaultControlTagDeletionEvent(tagId, objectId, objectType, tagDefinition, 1L, 2L, UUID.randomUUID()));
Assert.assertTrue(event.equals(new DefaultControlTagDeletionEvent(tagId, objectId, objectType, tagDefinition, 1L, 2L, UUID.randomUUID())));
verifyTagEvent(tagId, objectId, objectType, tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
}
use of org.killbill.billing.util.tag.dao.TagDefinitionModelDao in project killbill by killbill.
the class TestTagEventBuilder method testNewUserTagDefinitionDeletionEvent.
@Test(groups = "fast")
public void testNewUserTagDefinitionDeletionEvent() throws Exception {
final UUID tagDefinitionId = UUID.randomUUID();
final String tagDefinitionName = UUID.randomUUID().toString();
final String tagDefinitionDescription = UUID.randomUUID().toString();
final boolean controlTag = false;
final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
final UUID userToken = internalCallContext.getUserToken();
final TagEventBuilder tagEventBuilder = new TagEventBuilder();
final TagDefinitionInternalEvent event = tagEventBuilder.newUserTagDefinitionDeletionEvent(tagDefinitionId, new TagDefinitionModelDao(tagDefinition), 1L, 2L, UUID.randomUUID());
Assert.assertTrue(event instanceof UserTagDefinitionDeletionInternalEvent);
Assert.assertEquals(event, new DefaultUserTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, 1L, 2L, UUID.randomUUID()));
Assert.assertTrue(event.equals(new DefaultUserTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, 1L, 2L, UUID.randomUUID())));
verifyTagDefinitionEvent(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
}
use of org.killbill.billing.util.tag.dao.TagDefinitionModelDao in project killbill by killbill.
the class TestTagEventBuilder method testNewControlTagDefinitionCreationEvent.
@Test(groups = "fast")
public void testNewControlTagDefinitionCreationEvent() throws Exception {
final UUID tagDefinitionId = ControlTagType.AUTO_PAY_OFF.getId();
final String tagDefinitionName = UUID.randomUUID().toString();
final String tagDefinitionDescription = UUID.randomUUID().toString();
final boolean controlTag = true;
final TagDefinition tagDefinition = new DefaultTagDefinition(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, controlTag);
final UUID userToken = internalCallContext.getUserToken();
final TagEventBuilder tagEventBuilder = new TagEventBuilder();
final TagDefinitionInternalEvent event = tagEventBuilder.newControlTagDefinitionCreationEvent(tagDefinitionId, new TagDefinitionModelDao(tagDefinition), 1L, 2L, UUID.randomUUID());
Assert.assertTrue(event instanceof ControlTagDefinitionCreationInternalEvent);
Assert.assertEquals(event, new DefaultControlTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, 1L, 2L, UUID.randomUUID()));
Assert.assertTrue(event.equals(new DefaultControlTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, 1L, 2L, UUID.randomUUID())));
verifyTagDefinitionEvent(tagDefinitionId, tagDefinitionName, tagDefinitionDescription, tagDefinition, userToken, event);
}
use of org.killbill.billing.util.tag.dao.TagDefinitionModelDao in project killbill by killbill.
the class TestTagStore method testTagCreationAndRetrieval.
@Test(groups = "slow")
public void testTagCreationAndRetrieval() throws TagApiException, TagDefinitionApiException {
final UUID accountId = UUID.randomUUID();
eventsListener.pushExpectedEvent(NextEvent.TAG_DEFINITION);
tagDefinitionDao.create("tag1", "First tag", internalCallContext);
assertListenerStatus();
eventsListener.pushExpectedEvent(NextEvent.TAG_DEFINITION);
final TagDefinitionModelDao testTagDefinition = tagDefinitionDao.create("testTagDefinition", "Second tag", internalCallContext);
assertListenerStatus();
final Tag tag = new DescriptiveTag(testTagDefinition.getId(), ObjectType.ACCOUNT, accountId, clock.getUTCNow());
eventsListener.pushExpectedEvent(NextEvent.TAG);
tagDao.create(new TagModelDao(tag), internalCallContext);
assertListenerStatus();
final TagModelDao savedTag = tagDao.getById(tag.getId(), internalCallContext);
assertEquals(savedTag.getTagDefinitionId(), tag.getTagDefinitionId());
assertEquals(savedTag.getId(), tag.getId());
}
Aggregations