Search in sources :

Example 21 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.

the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeLongPrimitiveWhenMaximumGreaterThanIntegerMax.

@Test
public void applyGeneratesIntegerUsingJavaTypeLongPrimitiveWhenMaximumGreaterThanIntegerMax() {
    JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
    ObjectNode objectNode = new ObjectMapper().createObjectNode();
    objectNode.put("type", "integer");
    objectNode.put("maximum", Integer.MAX_VALUE + 1L);
    when(config.isUsePrimitives()).thenReturn(true);
    JType result = rule.apply("fooBar", objectNode, jpackage, null);
    assertThat(result.fullName(), is("long"));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) JPackage(com.sun.codemodel.JPackage) JCodeModel(com.sun.codemodel.JCodeModel) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JType(com.sun.codemodel.JType) Test(org.junit.Test)

Example 22 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.

the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeInteger.

@Test
public void applyGeneratesIntegerUsingJavaTypeInteger() {
    JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
    ObjectNode objectNode = new ObjectMapper().createObjectNode();
    objectNode.put("type", "integer");
    objectNode.put("javaType", "java.lang.Integer");
    when(config.isUsePrimitives()).thenReturn(true);
    JType result = rule.apply("fooBar", objectNode, jpackage, null);
    assertThat(result.fullName(), is("java.lang.Integer"));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) JPackage(com.sun.codemodel.JPackage) JCodeModel(com.sun.codemodel.JCodeModel) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JType(com.sun.codemodel.JType) Test(org.junit.Test)

Example 23 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.

the class FragmentResolverTest method hashResolvesToRoot.

@Test
public void hashResolvesToRoot() {
    ObjectNode root = new ObjectMapper().createObjectNode();
    root.set("child1", root.objectNode());
    root.set("child2", root.objectNode());
    root.set("child3", root.objectNode());
    assertThat((ObjectNode) resolver.resolve(root, "#", "#/."), is(sameInstance(root)));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 24 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.

the class FragmentResolverTest method attemptToUsePropertyNameOnArrayNodeThrowsIllegalArgumentException.

@Test(expected = IllegalArgumentException.class)
public void attemptToUsePropertyNameOnArrayNodeThrowsIllegalArgumentException() {
    ObjectNode root = new ObjectMapper().createObjectNode();
    ArrayNode a = root.arrayNode();
    root.set("a", a);
    resolver.resolve(root, "#/a/b", "#/.");
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 25 with ObjectNode

use of com.fasterxml.jackson.databind.node.ObjectNode in project jsonschema2pojo by joelittlejohn.

the class FragmentResolverTest method missingPathThrowsIllegalArgumentException.

@Test(expected = IllegalArgumentException.class)
public void missingPathThrowsIllegalArgumentException() {
    ObjectNode root = new ObjectMapper().createObjectNode();
    resolver.resolve(root, "#/a/b/c", "#/.");
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)702 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)174 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)157 JsonNode (com.fasterxml.jackson.databind.JsonNode)142 Test (org.junit.Test)111 StringEntity (org.apache.http.entity.StringEntity)88 Deployment (org.activiti.engine.test.Deployment)84 CloseableHttpResponse (org.apache.http.client.methods.CloseableHttpResponse)67 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)64 Task (org.activiti.engine.task.Task)49 HttpPost (org.apache.http.client.methods.HttpPost)49 JCodeModel (com.sun.codemodel.JCodeModel)45 JPackage (com.sun.codemodel.JPackage)44 HttpPut (org.apache.http.client.methods.HttpPut)40 JType (com.sun.codemodel.JType)39 Cluster (org.apache.geode.tools.pulse.internal.data.Cluster)39 IOException (java.io.IOException)38 HashMap (java.util.HashMap)38 ArrayList (java.util.ArrayList)28 Map (java.util.Map)28