Search in sources :

Example 6 with DefaultTagDefinition

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

Example 7 with DefaultTagDefinition

use of org.killbill.billing.util.tag.DefaultTagDefinition in project killbill by killbill.

the class TestDefaultControlTagCreationEvent method testSerialization.

@Test(groups = "fast")
public void testSerialization() throws Exception {
    final ObjectMapper objectMapper = new ObjectMapper();
    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 = UUID.randomUUID();
    final DefaultControlTagCreationEvent event = new DefaultControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, 1L, 2L, UUID.randomUUID());
    final String json = objectMapper.writeValueAsString(event);
    final DefaultControlTagCreationEvent fromJson = objectMapper.readValue(json, DefaultControlTagCreationEvent.class);
    Assert.assertEquals(fromJson, event);
}
Also used : ObjectType(org.killbill.billing.ObjectType) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) TagDefinition(org.killbill.billing.util.tag.TagDefinition) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) UUID(java.util.UUID) ObjectMapper(org.killbill.billing.util.jackson.ObjectMapper) Test(org.testng.annotations.Test)

Example 8 with DefaultTagDefinition

use of org.killbill.billing.util.tag.DefaultTagDefinition in project killbill by killbill.

the class TestDefaultControlTagCreationEvent method testPojo.

@Test(groups = "fast")
public void testPojo() 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 = UUID.randomUUID();
    final DefaultControlTagCreationEvent event = new DefaultControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, 1L, 2L, UUID.randomUUID());
    Assert.assertEquals(event.getBusEventType(), BusInternalEvent.BusInternalEventType.CONTROL_TAG_CREATION);
    Assert.assertEquals(event.getTagId(), tagId);
    Assert.assertEquals(event.getObjectId(), objectId);
    Assert.assertEquals(event.getObjectType(), objectType);
    Assert.assertEquals(event.getTagDefinition(), tagDefinition);
    Assert.assertEquals(event.getTagDefinition().getId(), tagDefinitionId);
    Assert.assertEquals(event.getTagDefinition().getName(), tagDefinitionName);
    Assert.assertEquals(event.getTagDefinition().getDescription(), tagDefinitionDescription);
    Assert.assertEquals(event, event);
    Assert.assertEquals(event, new DefaultControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, 1L, 2L, UUID.randomUUID()));
    Assert.assertTrue(event.equals(event));
    Assert.assertTrue(event.equals(new DefaultControlTagCreationEvent(tagId, objectId, objectType, tagDefinition, 1L, 2L, UUID.randomUUID())));
}
Also used : ObjectType(org.killbill.billing.ObjectType) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) TagDefinition(org.killbill.billing.util.tag.TagDefinition) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) UUID(java.util.UUID) Test(org.testng.annotations.Test)

Example 9 with DefaultTagDefinition

use of org.killbill.billing.util.tag.DefaultTagDefinition in project killbill by killbill.

the class TestDefaultControlTagDefinitionCreationEvent method testSerialization.

@Test(groups = "fast")
public void testSerialization() throws Exception {
    final ObjectMapper objectMapper = new ObjectMapper();
    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 = UUID.randomUUID();
    final DefaultControlTagDefinitionCreationEvent event = new DefaultControlTagDefinitionCreationEvent(tagDefinitionId, tagDefinition, 1L, 2L, UUID.randomUUID());
    final String json = objectMapper.writeValueAsString(event);
    final DefaultControlTagDefinitionCreationEvent fromJson = objectMapper.readValue(json, DefaultControlTagDefinitionCreationEvent.class);
    Assert.assertEquals(fromJson, event);
}
Also used : DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) TagDefinition(org.killbill.billing.util.tag.TagDefinition) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) UUID(java.util.UUID) ObjectMapper(org.killbill.billing.util.jackson.ObjectMapper) Test(org.testng.annotations.Test)

Example 10 with DefaultTagDefinition

use of org.killbill.billing.util.tag.DefaultTagDefinition in project killbill by killbill.

the class TestDefaultControlTagDefinitionDeletionEvent method testSerialization.

@Test(groups = "fast")
public void testSerialization() throws Exception {
    final ObjectMapper objectMapper = new ObjectMapper();
    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 = UUID.randomUUID();
    final DefaultControlTagDefinitionDeletionEvent event = new DefaultControlTagDefinitionDeletionEvent(tagDefinitionId, tagDefinition, 1L, 2L, UUID.randomUUID());
    final String json = objectMapper.writeValueAsString(event);
    final DefaultControlTagDefinitionDeletionEvent fromJson = objectMapper.readValue(json, DefaultControlTagDefinitionDeletionEvent.class);
    Assert.assertEquals(fromJson, event);
}
Also used : DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) TagDefinition(org.killbill.billing.util.tag.TagDefinition) DefaultTagDefinition(org.killbill.billing.util.tag.DefaultTagDefinition) UUID(java.util.UUID) ObjectMapper(org.killbill.billing.util.jackson.ObjectMapper) Test(org.testng.annotations.Test)

Aggregations

UUID (java.util.UUID)24 DefaultTagDefinition (org.killbill.billing.util.tag.DefaultTagDefinition)24 TagDefinition (org.killbill.billing.util.tag.TagDefinition)24 Test (org.testng.annotations.Test)24 ObjectType (org.killbill.billing.ObjectType)12 ObjectMapper (org.killbill.billing.util.jackson.ObjectMapper)8 TagDefinitionModelDao (org.killbill.billing.util.tag.dao.TagDefinitionModelDao)8 TagDefinitionInternalEvent (org.killbill.billing.events.TagDefinitionInternalEvent)4 TagInternalEvent (org.killbill.billing.events.TagInternalEvent)4 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