Search in sources :

Example 31 with ObjectNode

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

the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeLongWhenMaximumGreaterThanIntegerMax.

@Test
public void applyGeneratesIntegerUsingJavaTypeLongWhenMaximumGreaterThanIntegerMax() {
    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(false);
    JType result = rule.apply("fooBar", objectNode, jpackage, null);
    assertThat(result.fullName(), is(Long.class.getName()));
}
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 32 with ObjectNode

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

the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeBigInteger.

@Test
public void applyGeneratesIntegerUsingJavaTypeBigInteger() {
    JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
    ObjectNode objectNode = new ObjectMapper().createObjectNode();
    objectNode.put("type", "integer");
    objectNode.put("javaType", "java.math.BigInteger");
    JType result = rule.apply("fooBar", objectNode, jpackage, null);
    assertThat(result.fullName(), is("java.math.BigInteger"));
}
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 33 with ObjectNode

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

the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeIntegerPrimitive.

@Test
public void applyGeneratesIntegerUsingJavaTypeIntegerPrimitive() {
    JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
    ObjectNode objectNode = new ObjectMapper().createObjectNode();
    objectNode.put("type", "integer");
    objectNode.put("javaType", "int");
    when(config.isUsePrimitives()).thenReturn(false);
    JType result = rule.apply("fooBar", objectNode, jpackage, null);
    assertThat(result.fullName(), is("int"));
}
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 34 with ObjectNode

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

the class TypeRuleTest method applyGeneratesIntegerUsingJavaTypeLongWhenMinimumLessThanIntegerMin.

@Test
public void applyGeneratesIntegerUsingJavaTypeLongWhenMinimumLessThanIntegerMin() {
    JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
    ObjectNode objectNode = new ObjectMapper().createObjectNode();
    objectNode.put("type", "integer");
    objectNode.put("minimum", Integer.MIN_VALUE - 1L);
    when(config.isUsePrimitives()).thenReturn(false);
    JType result = rule.apply("fooBar", objectNode, jpackage, null);
    assertThat(result.fullName(), is(Long.class.getName()));
}
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 35 with ObjectNode

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

the class TypeRuleTest method applyGeneratesCustomObject.

@Test
public void applyGeneratesCustomObject() {
    JPackage jpackage = new JCodeModel()._package(getClass().getPackage().getName());
    ObjectNode objectNode = new ObjectMapper().createObjectNode();
    objectNode.put("type", "object");
    JDefinedClass mockObjectType = mock(JDefinedClass.class);
    ObjectRule mockObjectRule = mock(ObjectRule.class);
    when(mockObjectRule.apply("fooBar", objectNode, jpackage, null)).thenReturn(mockObjectType);
    when(ruleFactory.getObjectRule()).thenReturn(mockObjectRule);
    JType result = rule.apply("fooBar", objectNode, jpackage, null);
    assertThat(result, is((JType) mockObjectType));
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) JDefinedClass(com.sun.codemodel.JDefinedClass) 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)

Aggregations

ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)767 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)185 JsonNode (com.fasterxml.jackson.databind.JsonNode)165 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)165 Test (org.junit.Test)112 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 IOException (java.io.IOException)43 HttpPut (org.apache.http.client.methods.HttpPut)40 JType (com.sun.codemodel.JType)39 HashMap (java.util.HashMap)39 Cluster (org.apache.geode.tools.pulse.internal.data.Cluster)39 ArrayList (java.util.ArrayList)32 Map (java.util.Map)32