use of org.kie.server.api.marshalling.json.JSONMarshaller in project droolsjbpm-integration by kiegroup.
the class JSONMarshallerTest method testCapitalizedWrapObjectFieldnames.
@Test
public void testCapitalizedWrapObjectFieldnames() throws Exception {
Marshaller marshaller = new JSONMarshaller(new HashSet<>(), getClass().getClassLoader(), false, true);
BatchExecutionCommandImpl batch = new BatchExecutionCommandImpl();
batch.addCommand(new InsertObjectCommand(new Order("all")));
String converted = marshaller.marshall(batch);
String expectedMarshalled = "{ \"lookup\" : null, \"commands\" : [ { \"insert\" : " + "{ \"object\" : {\"org.kie.server.api.marshalling.JSONMarshallerTest$Order\":{ \"ORDER_ID\" : \"all\" }}, " + "\"out-identifier\" : null, \"return-object\" : true, \"entry-point\" : \"DEFAULT\", \"disconnected\" : false } } ] }";
JSONAssert.assertEquals(expectedMarshalled, converted, STRICT);
BatchExecutionCommandImpl unconverted = marshaller.unmarshall(converted, BatchExecutionCommandImpl.class);
assertEquals("all", ((Order) ((InsertObjectCommand) unconverted.getCommands().get(0)).getObject()).getORDER_ID());
}
use of org.kie.server.api.marshalling.json.JSONMarshaller in project droolsjbpm-integration by kiegroup.
the class JSONMarshallerTest method testCapitalizedFieldnames.
@Test
public void testCapitalizedFieldnames() throws Exception {
Marshaller marshaller = new JSONMarshaller(new HashSet<>(), getClass().getClassLoader(), false, true);
Order order = new Order("all");
String converted = marshaller.marshall(order);
String expectedMarshalled = "{\"ORDER_ID\" : \"all\"}";
JSONAssert.assertEquals(expectedMarshalled, converted, STRICT);
Order unconverted = marshaller.unmarshall(converted, Order.class);
assertEquals("all", unconverted.getORDER_ID());
}
use of org.kie.server.api.marshalling.json.JSONMarshaller in project droolsjbpm-integration by kiegroup.
the class Person method testCapitalizedWrapObjectFieldnames.
@Test
public void testCapitalizedWrapObjectFieldnames() throws Exception {
Marshaller marshaller = new JSONMarshaller(new HashSet<>(), getClass().getClassLoader(), false, true);
BatchExecutionCommandImpl batch = new BatchExecutionCommandImpl();
batch.addCommand(new InsertObjectCommand(new Order("all")));
String converted = marshaller.marshall(batch);
String expectedMarshalled = "{ \"lookup\" : null, \"commands\" : [ { \"insert\" : " + "{ \"object\" : {\"org.kie.server.api.marshalling.JSONMarshallerTest$Order\":{ \"ORDER_ID\" : \"all\" }}, " + "\"out-identifier\" : null, \"return-object\" : true, \"entry-point\" : \"DEFAULT\", \"disconnected\" : false } } ] }";
JSONAssert.assertEquals(expectedMarshalled, converted, STRICT);
BatchExecutionCommandImpl unconverted = marshaller.unmarshall(converted, BatchExecutionCommandImpl.class);
assertEquals("all", ((Order) ((InsertObjectCommand) unconverted.getCommands().get(0)).getObject()).getORDER_ID());
}
use of org.kie.server.api.marshalling.json.JSONMarshaller in project droolsjbpm-integration by kiegroup.
the class Person method testCapitalizedFieldnames.
@Test
public void testCapitalizedFieldnames() throws Exception {
Marshaller marshaller = new JSONMarshaller(new HashSet<>(), getClass().getClassLoader(), false, true);
Order order = new Order("all");
String converted = marshaller.marshall(order);
String expectedMarshalled = "{\"ORDER_ID\" : \"all\"}";
JSONAssert.assertEquals(expectedMarshalled, converted, STRICT);
Order unconverted = marshaller.unmarshall(converted, Order.class);
assertEquals("all", unconverted.getORDER_ID());
}
use of org.kie.server.api.marshalling.json.JSONMarshaller in project droolsjbpm-integration by kiegroup.
the class Person method testLegacyFieldnames.
@Test
public void testLegacyFieldnames() throws Exception {
Marshaller marshaller = new JSONMarshaller(new HashSet<>(), getClass().getClassLoader(), false, false);
Order order = new Order("all");
String converted = marshaller.marshall(order);
String expectedMarshalled = "{\"order_ID\" : \"all\"}";
JSONAssert.assertEquals(expectedMarshalled, converted, STRICT);
Order unconverted = marshaller.unmarshall(converted, Order.class);
assertEquals("all", unconverted.getORDER_ID());
}
Aggregations