Search in sources :

Example 31 with TagDefinition

use of org.killbill.billing.util.tag.TagDefinition 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 32 with TagDefinition

use of org.killbill.billing.util.tag.TagDefinition 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 33 with TagDefinition

use of org.killbill.billing.util.tag.TagDefinition 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)

Aggregations

TagDefinition (org.killbill.billing.util.tag.TagDefinition)33 UUID (java.util.UUID)27 Test (org.testng.annotations.Test)26 DefaultTagDefinition (org.killbill.billing.util.tag.DefaultTagDefinition)24 ObjectType (org.killbill.billing.ObjectType)12 TagDefinitionModelDao (org.killbill.billing.util.tag.dao.TagDefinitionModelDao)9 ObjectMapper (org.killbill.billing.util.jackson.ObjectMapper)8 ApiOperation (io.swagger.annotations.ApiOperation)6 ApiResponses (io.swagger.annotations.ApiResponses)6 Produces (javax.ws.rs.Produces)6 TimedResource (org.killbill.commons.metrics.TimedResource)6 GET (javax.ws.rs.GET)5 TenantContext (org.killbill.billing.util.callcontext.TenantContext)5 Path (javax.ws.rs.Path)4 TagDefinitionInternalEvent (org.killbill.billing.events.TagDefinitionInternalEvent)4 TagInternalEvent (org.killbill.billing.events.TagInternalEvent)4 AuditLog (org.killbill.billing.util.audit.AuditLog)4 Tag (org.killbill.billing.util.tag.Tag)4 HashMap (java.util.HashMap)3 TagDefinitionJson (org.killbill.billing.jaxrs.json.TagDefinitionJson)3