use of org.kie.server.api.marshalling.Marshaller in project droolsjbpm-integration by kiegroup.
the class DroolsCommandsMarshallingTest method roundTrip.
private <T> T roundTrip(T obj) {
Class<T> type = (Class<T>) obj.getClass();
Marshaller marshaller = marshallerBuilder.build(extraClasses, marshallingFormat, getClass().getClassLoader());
String strOut = marshaller.marshall(obj);
return marshaller.unmarshall(strOut, type);
}
use of org.kie.server.api.marshalling.Marshaller in project droolsjbpm-integration by kiegroup.
the class MarshallingRoundTripCustomClassListTest method testJSONTypeInfoTopLevelOnly.
@Test
public void testJSONTypeInfoTopLevelOnly() {
Marshaller marshaller = MarshallerFactory.getMarshaller(getCustomClasses(), MarshallingFormat.JSON, getClass().getClassLoader());
String rawContent = "{\"org.kie.server.api.marshalling.objects.PojoA\": " + "{\"name\": \"A\"," + " \"pojoBList\":" + " [{\"name\": \"B1\"," + " \"pojoCList\":" + " [" + " {\"name\": \"C1\"}, " + " {\"name\": \"C2\"}" + " ]" + " }," + " {\"name\": \"B2\"," + " \"pojoCList\":" + " [" + " {\"name\": \"C3\"}" + " ]" + " }" + " ]," + " \"stringList\":" + " [\"Hello\", \"Bye\"]" + "}}";
Object unmarshalledObject = marshaller.unmarshall(rawContent, PojoA.class);
Assertions.assertThat(unmarshalledObject).isEqualTo(createTestObject());
}
use of org.kie.server.api.marshalling.Marshaller in project droolsjbpm-integration by kiegroup.
the class MarshallingRoundTripCustomClassListTest method testXStream.
@Test
public void testXStream() {
Marshaller marshaller = MarshallerFactory.getMarshaller(getCustomClasses(), MarshallingFormat.XSTREAM, getClass().getClassLoader());
verifyMarshallingRoundTrip(marshaller, createTestObject());
}
use of org.kie.server.api.marshalling.Marshaller in project droolsjbpm-integration by kiegroup.
the class MarshallingRoundTripCustomClassListTest method testJaxb.
@Test
public void testJaxb() {
Marshaller marshaller = MarshallerFactory.getMarshaller(getCustomClasses(), MarshallingFormat.JAXB, getClass().getClassLoader());
verifyMarshallingRoundTrip(marshaller, createTestObject());
}
use of org.kie.server.api.marshalling.Marshaller in project droolsjbpm-integration by kiegroup.
the class MarshallingRoundTripNestedClassesTest method testJaxb.
@Test
public void testJaxb() {
Marshaller marshaller = MarshallerFactory.getMarshaller(getCustomClasses(), MarshallingFormat.JAXB, getClass().getClassLoader());
verifyMarshallingRoundTrip(marshaller, createTestObject());
}
Aggregations