Search in sources :

Example 1 with Marshaller

use of org.kie.server.api.marshalling.Marshaller in project droolsjbpm-integration by kiegroup.

the class DroolsCommandNestedPojoMarshallingTest method testJaxb.

@Test
public void testJaxb() {
    Marshaller marshaller = marshallerBuilder.build(getCustomClasses(), MarshallingFormat.JAXB, getClass().getClassLoader());
    verifyMarshallingRoundTrip(marshaller, createTestCommand(), jaxbExpectedPayload);
}
Also used : Marshaller(org.kie.server.api.marshalling.Marshaller) Test(org.junit.Test)

Example 2 with Marshaller

use of org.kie.server.api.marshalling.Marshaller in project droolsjbpm-integration by kiegroup.

the class DroolsCommandWithListMarshallingTest method testJSON.

@Test
public void testJSON() {
    Marshaller marshaller = marshallerBuilder.build(getCustomClasses(), MarshallingFormat.JSON, getClass().getClassLoader());
    verifyMarshallingRoundTrip(marshaller, createTestCommand(), jsonExpectedPayload);
}
Also used : Marshaller(org.kie.server.api.marshalling.Marshaller) Test(org.junit.Test)

Example 3 with Marshaller

use of org.kie.server.api.marshalling.Marshaller in project droolsjbpm-integration by kiegroup.

the class DroolsCommandWithListMarshallingTest method testXStream.

@Test
public void testXStream() {
    Marshaller marshaller = marshallerBuilder.build(getCustomClasses(), MarshallingFormat.XSTREAM, getClass().getClassLoader());
    verifyMarshallingRoundTrip(marshaller, createTestCommand(), xstreamExpectedPayload);
}
Also used : Marshaller(org.kie.server.api.marshalling.Marshaller) Test(org.junit.Test)

Example 4 with Marshaller

use of org.kie.server.api.marshalling.Marshaller in project droolsjbpm-integration by kiegroup.

the class DroolsCommandWithListMarshallingTest method testJaxb.

@Test
public void testJaxb() {
    Marshaller marshaller = marshallerBuilder.build(getCustomClasses(), MarshallingFormat.JAXB, getClass().getClassLoader());
    verifyMarshallingRoundTrip(marshaller, createTestCommand(), jaxbExpectedPayload);
}
Also used : Marshaller(org.kie.server.api.marshalling.Marshaller) Test(org.junit.Test)

Example 5 with Marshaller

use of org.kie.server.api.marshalling.Marshaller in project droolsjbpm-integration by kiegroup.

the class JSONMarshallerExtensionTest method testCustomExtensionMarshaller.

@Test
public void testCustomExtensionMarshaller() {
    Set<Class<?>> extraClasses = new HashSet<Class<?>>();
    Marshaller marshaller = MarshallerFactory.getMarshaller(extraClasses, MarshallingFormat.JSON, this.getClass().getClassLoader());
    Calendar calendar = GregorianCalendar.getInstance();
    String marshall = marshaller.marshall(calendar);
    assertEquals(marshall, "\"" + FORMATTER.format(calendar.getTime()) + "\"");
    GregorianCalendar unmarshall = marshaller.unmarshall(marshall, GregorianCalendar.class);
    assertEquals(unmarshall, calendar);
    PMMLRequestData request = new PMMLRequestData("123", "SimpleScorecard");
    request.addRequestParam("param1", 10.0);
    request.addRequestParam("param2", 15.0);
    String mshl = marshaller.marshall(request);
    PMMLRequestData rd = marshaller.unmarshall(mshl, PMMLRequestData.class);
    assertEquals(rd, request);
    logger.info(rd.toString());
}
Also used : PMMLRequestData(org.kie.api.pmml.PMMLRequestData) Marshaller(org.kie.server.api.marshalling.Marshaller) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

Marshaller (org.kie.server.api.marshalling.Marshaller)65 Test (org.junit.Test)48 HashMap (java.util.HashMap)12 WebTarget (javax.ws.rs.client.WebTarget)11 BeforeClass (org.junit.BeforeClass)10 ArrayList (java.util.ArrayList)9 MarshallingFormat (org.kie.server.api.marshalling.MarshallingFormat)9 Response (javax.ws.rs.core.Response)8 BatchExecutionCommand (org.kie.api.command.BatchExecutionCommand)8 Command (org.kie.api.command.Command)8 ExecutionResults (org.kie.api.runtime.ExecutionResults)8 HashSet (java.util.HashSet)7 JaxbLong (org.kie.server.api.model.type.JaxbLong)6 KieContainerInstance (org.kie.server.services.api.KieContainerInstance)4 CallContainerCommand (org.kie.server.api.commands.CallContainerCommand)3 KieContainerResource (org.kie.server.api.model.KieContainerResource)3 KieServerCommand (org.kie.server.api.model.KieServerCommand)3 ServiceResponse (org.kie.server.api.model.ServiceResponse)3 Date (java.util.Date)2 BatchExecutionCommandImpl (org.drools.core.command.runtime.BatchExecutionCommandImpl)2