Search in sources :

Example 31 with ObjectType

use of org.killbill.billing.ObjectType in project killbill by killbill.

the class TestDefaultCustomFieldCreationEvent method testPojo.

@Test(groups = "fast")
public void testPojo() throws Exception {
    final UUID customFieldId = UUID.randomUUID();
    final UUID objectId = UUID.randomUUID();
    final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
    final DefaultCustomFieldCreationEvent event = new DefaultCustomFieldCreationEvent(customFieldId, objectId, objectType, 1L, 2L, UUID.randomUUID());
    Assert.assertEquals(event.getBusEventType(), BusInternalEventType.CUSTOM_FIELD_CREATION);
    Assert.assertEquals(event.getObjectId(), objectId);
    Assert.assertEquals(event.getObjectType(), objectType);
    Assert.assertEquals(event, event);
    Assert.assertEquals(event, new DefaultCustomFieldCreationEvent(customFieldId, objectId, objectType, 1L, 2L, UUID.randomUUID()));
}
Also used : ObjectType(org.killbill.billing.ObjectType) UUID(java.util.UUID) Test(org.testng.annotations.Test)

Example 32 with ObjectType

use of org.killbill.billing.ObjectType in project killbill by killbill.

the class TestDefaultCustomFieldCreationEvent method testSerialization.

@Test(groups = "fast")
public void testSerialization() throws Exception {
    final ObjectMapper objectMapper = new ObjectMapper();
    final UUID customFieldId = UUID.randomUUID();
    final UUID objectId = UUID.randomUUID();
    final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
    final DefaultCustomFieldCreationEvent event = new DefaultCustomFieldCreationEvent(customFieldId, objectId, objectType, 1L, 2L, UUID.randomUUID());
    final String json = objectMapper.writeValueAsString(event);
    final DefaultCustomFieldCreationEvent fromJson = objectMapper.readValue(json, DefaultCustomFieldCreationEvent.class);
    Assert.assertEquals(fromJson, event);
}
Also used : ObjectType(org.killbill.billing.ObjectType) UUID(java.util.UUID) ObjectMapper(org.killbill.billing.util.jackson.ObjectMapper) Test(org.testng.annotations.Test)

Example 33 with ObjectType

use of org.killbill.billing.ObjectType in project killbill by killbill.

the class TestDefaultCustomFieldDeletionEvent method testSerialization.

@Test(groups = "fast")
public void testSerialization() throws Exception {
    final ObjectMapper objectMapper = new ObjectMapper();
    final UUID customFieldId = UUID.randomUUID();
    final UUID objectId = UUID.randomUUID();
    final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
    final UUID userToken = UUID.randomUUID();
    final DefaultCustomFieldDeletionEvent event = new DefaultCustomFieldDeletionEvent(customFieldId, objectId, objectType, 1L, 2L, UUID.randomUUID());
    final String json = objectMapper.writeValueAsString(event);
    final DefaultCustomFieldDeletionEvent fromJson = objectMapper.readValue(json, DefaultCustomFieldDeletionEvent.class);
    Assert.assertEquals(fromJson, event);
}
Also used : ObjectType(org.killbill.billing.ObjectType) UUID(java.util.UUID) ObjectMapper(org.killbill.billing.util.jackson.ObjectMapper) Test(org.testng.annotations.Test)

Example 34 with ObjectType

use of org.killbill.billing.ObjectType in project killbill by killbill.

the class TestDefaultCustomFieldDeletionEvent method testPojo.

@Test(groups = "fast")
public void testPojo() throws Exception {
    final UUID customFieldId = UUID.randomUUID();
    final UUID objectId = UUID.randomUUID();
    final ObjectType objectType = ObjectType.ACCOUNT_EMAIL;
    final UUID userToken = UUID.randomUUID();
    final DefaultCustomFieldDeletionEvent event = new DefaultCustomFieldDeletionEvent(customFieldId, objectId, objectType, 1L, 2L, UUID.randomUUID());
    Assert.assertEquals(event.getBusEventType(), BusInternalEventType.CUSTOM_FIELD_DELETION);
    Assert.assertEquals(event.getObjectId(), objectId);
    Assert.assertEquals(event.getObjectType(), objectType);
    Assert.assertEquals(event, event);
    Assert.assertEquals(event, new DefaultCustomFieldDeletionEvent(customFieldId, objectId, objectType, 1L, 2L, UUID.randomUUID()));
}
Also used : ObjectType(org.killbill.billing.ObjectType) UUID(java.util.UUID) Test(org.testng.annotations.Test)

Example 35 with ObjectType

use of org.killbill.billing.ObjectType in project killbill by killbill.

the class DefaultOverdueConfigCache method initializeCacheLoaderArgument.

private CacheLoaderArgument initializeCacheLoaderArgument() {
    final LoaderCallback loaderCallback = new LoaderCallback() {

        @Override
        public OverdueConfig loadOverdueConfig(final String overdueConfigXML) throws OverdueApiException {
            final InputStream overdueConfigStream = new ByteArrayInputStream(overdueConfigXML.getBytes());
            try {
                return XMLLoader.getObjectFromStream(overdueConfigStream, DefaultOverdueConfig.class);
            } catch (final Exception e) {
                throw new OverdueApiException(ErrorCode.OVERDUE_INVALID_FOR_TENANT, "Problem encountered loading overdue config ", e);
            }
        }
    };
    final Object[] args = new Object[1];
    args[0] = loaderCallback;
    final ObjectType irrelevant = null;
    final InternalTenantContext notUsed = null;
    return new CacheLoaderArgument(irrelevant, args, notUsed);
}
Also used : ObjectType(org.killbill.billing.ObjectType) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) InternalTenantContext(org.killbill.billing.callcontext.InternalTenantContext) LoaderCallback(org.killbill.billing.util.cache.TenantOverdueConfigCacheLoader.LoaderCallback) OverdueApiException(org.killbill.billing.overdue.api.OverdueApiException) CacheLoaderArgument(org.killbill.billing.util.cache.CacheLoaderArgument) OverdueApiException(org.killbill.billing.overdue.api.OverdueApiException)

Aggregations

ObjectType (org.killbill.billing.ObjectType)41 UUID (java.util.UUID)27 Test (org.testng.annotations.Test)25 DefaultTagDefinition (org.killbill.billing.util.tag.DefaultTagDefinition)12 TagDefinition (org.killbill.billing.util.tag.TagDefinition)12 CacheLoaderArgument (org.killbill.billing.util.cache.CacheLoaderArgument)11 InternalTenantContext (org.killbill.billing.callcontext.InternalTenantContext)9 ObjectMapper (org.killbill.billing.util.jackson.ObjectMapper)6 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 TagInternalEvent (org.killbill.billing.events.TagInternalEvent)3 DescriptiveTag (org.killbill.billing.util.tag.DescriptiveTag)3 TagDefinitionModelDao (org.killbill.billing.util.tag.dao.TagDefinitionModelDao)3 ImmutableList (com.google.common.collect.ImmutableList)2 List (java.util.List)2 DefaultPlan (org.killbill.billing.catalog.DefaultPlan)2 DefaultPlanPhasePriceOverride (org.killbill.billing.catalog.DefaultPlanPhasePriceOverride)2 PlanPhasePriceOverride (org.killbill.billing.catalog.api.PlanPhasePriceOverride)2 ControlTagCreationInternalEvent (org.killbill.billing.events.ControlTagCreationInternalEvent)2 ControlTagDeletionInternalEvent (org.killbill.billing.events.ControlTagDeletionInternalEvent)2