Search in sources :

Example 1 with QueryFilterSpec

use of org.kie.server.api.model.definition.QueryFilterSpec in project droolsjbpm-integration by kiegroup.

the class MarshallerHelperTest method testJsonUnmarshallProcessInstanceQueryFilterSpec.

@Test
public void testJsonUnmarshallProcessInstanceQueryFilterSpec() {
    ProcessInstanceQueryFilterSpec expectedPiQfs = new ProcessInstanceQueryFilterSpecBuilder().get();
    MarshallerHelper helper = new MarshallerHelper(null);
    String marshalledQFS = "{\"order-by\" : null,\"order-asc\" : false,\"query-params\" : null}";
    ProcessInstanceQueryFilterSpec unmarshalledPiQfs = helper.unmarshal(marshalledQFS, MarshallingFormat.JSON.toString(), ProcessInstanceQueryFilterSpec.class);
    assertThat(expectedPiQfs, new BaseMatcher<QueryFilterSpec>() {

        @Override
        public void describeTo(Description description) {
        }

        @Override
        public boolean matches(Object item) {
            return new ReflectionEquals(unmarshalledPiQfs).matches(item);
        }
    });
}
Also used : Description(org.hamcrest.Description) ProcessInstanceQueryFilterSpec(org.kie.server.api.model.definition.ProcessInstanceQueryFilterSpec) TaskQueryFilterSpec(org.kie.server.api.model.definition.TaskQueryFilterSpec) QueryFilterSpec(org.kie.server.api.model.definition.QueryFilterSpec) ProcessInstanceQueryFilterSpecBuilder(org.kie.server.api.util.ProcessInstanceQueryFilterSpecBuilder) ReflectionEquals(org.mockito.internal.matchers.apachecommons.ReflectionEquals) ProcessInstanceQueryFilterSpec(org.kie.server.api.model.definition.ProcessInstanceQueryFilterSpec) Test(org.junit.Test)

Example 2 with QueryFilterSpec

use of org.kie.server.api.model.definition.QueryFilterSpec in project droolsjbpm-integration by kiegroup.

the class MarshallerHelperTest method testMarshallWithoutContainer.

@Test
public void testMarshallWithoutContainer() {
    KieServerRegistry kieServerRegistryMock = Mockito.mock(KieServerRegistry.class);
    MarshallerHelper helper = new MarshallerHelper(kieServerRegistryMock);
    QueryFilterSpec queryFilterSpec = new QueryFilterSpecBuilder().get();
    String marshalledQFS = helper.marshal(MarshallingFormat.JAXB.toString(), queryFilterSpec);
    String expectedMarshalledQFS = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<query-filter-spec>" + "<order-asc>false</order-asc>" + "</query-filter-spec>";
    assertThat(marshalledQFS, CompareMatcher.isIdenticalTo(expectedMarshalledQFS).ignoreWhitespace());
}
Also used : ProcessInstanceQueryFilterSpecBuilder(org.kie.server.api.util.ProcessInstanceQueryFilterSpecBuilder) QueryFilterSpecBuilder(org.kie.server.api.util.QueryFilterSpecBuilder) TaskQueryFilterSpecBuilder(org.kie.server.api.util.TaskQueryFilterSpecBuilder) ProcessInstanceQueryFilterSpec(org.kie.server.api.model.definition.ProcessInstanceQueryFilterSpec) TaskQueryFilterSpec(org.kie.server.api.model.definition.TaskQueryFilterSpec) QueryFilterSpec(org.kie.server.api.model.definition.QueryFilterSpec) KieServerRegistry(org.kie.server.services.api.KieServerRegistry) Test(org.junit.Test)

Example 3 with QueryFilterSpec

use of org.kie.server.api.model.definition.QueryFilterSpec in project droolsjbpm-integration by kiegroup.

the class MarshallerHelperTest method testJsonUnmarshallQueryFilterSpec.

@Test
public void testJsonUnmarshallQueryFilterSpec() {
    MarshallerHelper helper = new MarshallerHelper(null);
    String marshalledQFS = "{\"order-by\" : null, \"order-asc\" : false, \"query-params\" : null, \"result-column-mapping\" : null}";
    QueryFilterSpec qfs = helper.unmarshal(marshalledQFS, MarshallingFormat.JSON.toString(), QueryFilterSpec.class);
// TODO: assert value.
}
Also used : ProcessInstanceQueryFilterSpec(org.kie.server.api.model.definition.ProcessInstanceQueryFilterSpec) TaskQueryFilterSpec(org.kie.server.api.model.definition.TaskQueryFilterSpec) QueryFilterSpec(org.kie.server.api.model.definition.QueryFilterSpec) Test(org.junit.Test)

Example 4 with QueryFilterSpec

use of org.kie.server.api.model.definition.QueryFilterSpec in project droolsjbpm-integration by kiegroup.

the class MarshallerHelperTest method testJsonUnmarshallTaskQueryFilterSpec.

@Test
public void testJsonUnmarshallTaskQueryFilterSpec() {
    TaskQueryFilterSpec expectedTaskQfs = new TaskQueryFilterSpecBuilder().get();
    MarshallerHelper helper = new MarshallerHelper(null);
    String marshalledQFS = "{\"order-by\" : null, \"order-asc\" : false, \"query-params\" : null}";
    TaskQueryFilterSpec unmarshalledTaskQfs = helper.unmarshal(marshalledQFS, MarshallingFormat.JSON.toString(), TaskQueryFilterSpec.class);
    assertThat(expectedTaskQfs, new BaseMatcher<QueryFilterSpec>() {

        @Override
        public void describeTo(Description description) {
        }

        @Override
        public boolean matches(Object item) {
            return new ReflectionEquals(unmarshalledTaskQfs).matches(item);
        }
    });
}
Also used : TaskQueryFilterSpec(org.kie.server.api.model.definition.TaskQueryFilterSpec) Description(org.hamcrest.Description) ProcessInstanceQueryFilterSpec(org.kie.server.api.model.definition.ProcessInstanceQueryFilterSpec) TaskQueryFilterSpec(org.kie.server.api.model.definition.TaskQueryFilterSpec) QueryFilterSpec(org.kie.server.api.model.definition.QueryFilterSpec) ReflectionEquals(org.mockito.internal.matchers.apachecommons.ReflectionEquals) TaskQueryFilterSpecBuilder(org.kie.server.api.util.TaskQueryFilterSpecBuilder) Test(org.junit.Test)

Example 5 with QueryFilterSpec

use of org.kie.server.api.model.definition.QueryFilterSpec in project droolsjbpm-integration by kiegroup.

the class MarshallerHelperTest method testMarshallWithNullRegistry.

/**
 * Tests that MarshallerHelper can also be used when passing in a <code>null</code> KieServerRegistry.
 */
@Test
public void testMarshallWithNullRegistry() {
    MarshallerHelper helper = new MarshallerHelper(null);
    QueryFilterSpec queryFilterSpec = new QueryFilterSpecBuilder().get();
    String marshalledQFS = helper.marshal(MarshallingFormat.JAXB.toString(), queryFilterSpec);
    String expectedMarshalledQFS = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<query-filter-spec>" + "<order-asc>false</order-asc>" + "</query-filter-spec>";
    assertThat(marshalledQFS, CompareMatcher.isIdenticalTo(expectedMarshalledQFS).ignoreWhitespace());
}
Also used : ProcessInstanceQueryFilterSpecBuilder(org.kie.server.api.util.ProcessInstanceQueryFilterSpecBuilder) QueryFilterSpecBuilder(org.kie.server.api.util.QueryFilterSpecBuilder) TaskQueryFilterSpecBuilder(org.kie.server.api.util.TaskQueryFilterSpecBuilder) ProcessInstanceQueryFilterSpec(org.kie.server.api.model.definition.ProcessInstanceQueryFilterSpec) TaskQueryFilterSpec(org.kie.server.api.model.definition.TaskQueryFilterSpec) QueryFilterSpec(org.kie.server.api.model.definition.QueryFilterSpec) Test(org.junit.Test)

Aggregations

QueryFilterSpec (org.kie.server.api.model.definition.QueryFilterSpec)16 Test (org.junit.Test)15 QueryFilterSpecBuilder (org.kie.server.api.util.QueryFilterSpecBuilder)10 ProcessInstanceQueryFilterSpec (org.kie.server.api.model.definition.ProcessInstanceQueryFilterSpec)9 TaskQueryFilterSpec (org.kie.server.api.model.definition.TaskQueryFilterSpec)9 ProcessInstanceQueryFilterSpecBuilder (org.kie.server.api.util.ProcessInstanceQueryFilterSpecBuilder)7 TaskQueryFilterSpecBuilder (org.kie.server.api.util.TaskQueryFilterSpecBuilder)7 Description (org.hamcrest.Description)4 QueryDefinition (org.kie.server.api.model.definition.QueryDefinition)4 ReflectionEquals (org.mockito.internal.matchers.apachecommons.ReflectionEquals)4 HashMap (java.util.HashMap)3 ProcessInstance (org.kie.server.api.model.instance.ProcessInstance)3 KieServerRegistry (org.kie.server.services.api.KieServerRegistry)3 QueryParam (org.kie.server.api.model.definition.QueryParam)2 TaskInstance (org.kie.server.api.model.instance.TaskInstance)2 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 MappedVariable (org.drools.persistence.jpa.marshaller.MappedVariable)1