use of org.killbill.billing.util.tag.dao.TagDefinitionModelDao in project killbill by killbill.
the class TestTagEventBuilder method testNewUserTagDefinitionCreationEvent.
@Test(groups = "fast")
public void testNewUserTagDefinitionCreationEvent() 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.newUserTagDefinitionCreationEvent(tagDefinitionId, new TagDefinitionModelDao(tagDefinition), 1L, 2L, UUID.randomUUID());
Assert.assertTrue(event instanceof UserTagDefinitionCreationInternalEvent);
Assert.assertEquals(event, new DefaultUserTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, 1L, 2L, UUID.randomUUID()));
Assert.assertTrue(event.equals(new DefaultUserTagDefinitionCreationEvent(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 testNewUserTagCreationEvent.
@Test(groups = "fast")
public void testNewUserTagCreationEvent() throws Exception {
final UUID tagId = UUID.randomUUID();
final UUID objectId = UUID.randomUUID();
final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
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 TagInternalEvent event = tagEventBuilder.newUserTagCreationEvent(tagId, objectId, objectType, new TagDefinitionModelDao(tagDefinition), 1L, 2L, UUID.randomUUID());
Assert.assertTrue(event instanceof UserTagCreationInternalEvent);
Assert.assertEquals(event, new DefaultUserTagCreationEvent(tagId, objectId, objectType, tagDefinition, 1L, 2L, UUID.randomUUID()));
Assert.assertTrue(event.equals(new DefaultUserTagCreationEvent(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 testNewControlTagCreationEvent.
@Test(groups = "fast")
public void testNewControlTagCreationEvent() 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.newControlTagCreationEvent(tagId, objectId, objectType, new TagDefinitionModelDao(tagDefinition), 1L, 2L, UUID.randomUUID());
Assert.assertTrue(event instanceof ControlTagCreationInternalEvent);
Assert.assertEquals(event, new DefaultControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, 1L, 2L, UUID.randomUUID()));
Assert.assertTrue(event.equals(new DefaultControlTagCreationEvent(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 testNewUserTagDeletionEvent.
@Test(groups = "fast")
public void testNewUserTagDeletionEvent() throws Exception {
final UUID tagId = UUID.randomUUID();
final UUID objectId = UUID.randomUUID();
final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
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 TagInternalEvent event = tagEventBuilder.newUserTagDeletionEvent(tagId, objectId, objectType, new TagDefinitionModelDao(tagDefinition), 1L, 2L, UUID.randomUUID());
Assert.assertTrue(event instanceof UserTagDeletionInternalEvent);
Assert.assertEquals(event, new DefaultUserTagDeletionEvent(tagId, objectId, objectType, tagDefinition, 1L, 2L, UUID.randomUUID()));
Assert.assertTrue(event.equals(new DefaultUserTagDeletionEvent(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 TestDefaultTagUserApiWithMockDao method testCreateTagDefinitionWithLowerCase.
@Test(groups = "fast")
public void testCreateTagDefinitionWithLowerCase() throws Exception {
final String tagDefinitionName = "lowercase";
final TagDefinitionModelDao tagDefinitionModelDao = new TagDefinitionModelDao();
tagDefinitionModelDao.setName(tagDefinitionName);
Mockito.when(tagDefinitionDao.create(Mockito.anyString(), Mockito.anyString(), Mockito.any(InternalCallContext.class))).thenReturn(tagDefinitionModelDao);
final TagDefinition tagDefinition = tagUserApi.createTagDefinition(tagDefinitionName, "description", context);
assertEquals(tagDefinitionName, tagDefinition.getName());
}
Aggregations