Search in sources :

Example 11 with TagDefinitionModelDao

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);
}
Also used : TagDefinition(org.killbill.billing.util.tag.TagDefinition) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) TagDefinitionInternalEvent(org.killbill.billing.events.TagDefinitionInternalEvent) TagDefinitionModelDao(org.killbill.billing.util.tag.dao.TagDefinitionModelDao) UUID(java.util.UUID) ControlTagDefinitionDeletionInternalEvent(org.killbill.billing.events.ControlTagDefinitionDeletionInternalEvent) Test(org.testng.annotations.Test)

Example 12 with TagDefinitionModelDao

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);
}
Also used : ObjectType(org.killbill.billing.ObjectType) TagDefinition(org.killbill.billing.util.tag.TagDefinition) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) ControlTagDeletionInternalEvent(org.killbill.billing.events.ControlTagDeletionInternalEvent) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) TagDefinitionModelDao(org.killbill.billing.util.tag.dao.TagDefinitionModelDao) UUID(java.util.UUID) TagInternalEvent(org.killbill.billing.events.TagInternalEvent) Test(org.testng.annotations.Test)

Example 13 with TagDefinitionModelDao

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);
}
Also used : TagDefinition(org.killbill.billing.util.tag.TagDefinition) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) TagDefinitionInternalEvent(org.killbill.billing.events.TagDefinitionInternalEvent) TagDefinitionModelDao(org.killbill.billing.util.tag.dao.TagDefinitionModelDao) UUID(java.util.UUID) UserTagDefinitionDeletionInternalEvent(org.killbill.billing.events.UserTagDefinitionDeletionInternalEvent) Test(org.testng.annotations.Test)

Example 14 with TagDefinitionModelDao

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);
}
Also used : ControlTagDefinitionCreationInternalEvent(org.killbill.billing.events.ControlTagDefinitionCreationInternalEvent) TagDefinition(org.killbill.billing.util.tag.TagDefinition) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) TagDefinitionInternalEvent(org.killbill.billing.events.TagDefinitionInternalEvent) TagDefinitionModelDao(org.killbill.billing.util.tag.dao.TagDefinitionModelDao) UUID(java.util.UUID) Test(org.testng.annotations.Test)

Example 15 with TagDefinitionModelDao

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());
}
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