use of org.killbill.billing.util.jackson.ObjectMapper in project killbill by killbill.
the class TestDefaultBroadcastInternalEvent method testBasic.
@Test(groups = "fast")
public void testBasic() throws Exception {
final ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(new JodaModule());
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
final String eventJson = "\"{\"pluginName\":\"foo\",\"pluginVersion\":\"1.2.3\",\"properties\":[{\"key\":\"something\",\"value\":\"nothing\"}]}\"";
final BroadcastInternalEvent broadcastEvent = new DefaultBroadcastInternalEvent("service", "PLUGIN_INSTALL", eventJson);
final String broadcastEventStr = objectMapper.writeValueAsString(broadcastEvent);
final BroadcastInternalEvent res = objectMapper.readValue(broadcastEventStr, DefaultBroadcastInternalEvent.class);
Assert.assertEquals(res.getServiceName(), "service");
Assert.assertEquals(res.getType(), "PLUGIN_INSTALL");
Assert.assertEquals(res.getJsonEvent(), eventJson);
}
use of org.killbill.billing.util.jackson.ObjectMapper 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);
}
use of org.killbill.billing.util.jackson.ObjectMapper 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);
}
use of org.killbill.billing.util.jackson.ObjectMapper in project killbill by killbill.
the class TestDefaultUserTagDeletionEvent 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 DefaultUserTagDeletionEvent event = new DefaultUserTagDeletionEvent(tagId, objectId, objectType, tagDefinition, 1L, 2L, UUID.randomUUID());
final String json = objectMapper.writeValueAsString(event);
final DefaultUserTagDeletionEvent fromJson = objectMapper.readValue(json, DefaultUserTagDeletionEvent.class);
Assert.assertEquals(fromJson, event);
}
use of org.killbill.billing.util.jackson.ObjectMapper in project killbill by killbill.
the class TestDefaultUserTagCreationEvent 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 DefaultUserTagCreationEvent event = new DefaultUserTagCreationEvent(tagId, objectId, objectType, tagDefinition, 1L, 2L, UUID.randomUUID());
final String json = objectMapper.writeValueAsString(event);
final DefaultUserTagCreationEvent fromJson = objectMapper.readValue(json, DefaultUserTagCreationEvent.class);
Assert.assertEquals(fromJson, event);
}
Aggregations