Example usage for com.fasterxml.jackson.databind.node JsonNodeFactory instance

List of usage examples for com.fasterxml.jackson.databind.node JsonNodeFactory instance

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind.node JsonNodeFactory instance.

Prototype

JsonNodeFactory instance

To view the source code for com.fasterxml.jackson.databind.node JsonNodeFactory instance.

Click Source Link

Usage

From source file:neo4play.Neo4j.java

protected static JsonNode buildStatements(String query, JsonNode properties) {
    ObjectNode statement = Json.newObject();
    statement.put("statement", query);
    ObjectNode parameters = Json.newObject();
    parameters.put("props", properties);
    statement.put("parameters", parameters);
    ArrayNode statementList = JsonNodeFactory.instance.arrayNode();
    statementList.add(statement);//from w w  w  .j  a v a  2s. c  om
    ObjectNode statements = Json.newObject();
    statements.put("statements", statementList);
    return statements;
}

From source file:com.digitalpebble.storm.crawler.filtering.HostURLFilterTest.java

private HostURLFilter createFilter(boolean ignoreOutsideHost, boolean ignoreOutsideDomain) {
    HostURLFilter filter = new HostURLFilter();
    ObjectNode filterParams = new ObjectNode(JsonNodeFactory.instance);
    filterParams.put("ignoreOutsideHost", Boolean.valueOf(ignoreOutsideHost));
    filterParams.put("ignoreOutsideDomain", Boolean.valueOf(ignoreOutsideDomain));
    Map<String, Object> conf = new HashMap<String, Object>();
    filter.configure(conf, filterParams);
    return filter;
}

From source file:org.apache.solr.kelvin.testcases.SimpleTestCaseTest.java

@Override
protected void setUp() throws Exception {
    super.setUp();
    configs = SimpleConditionTest.readJsonResource(this.getClass(),
            "/org/apache/solr/kelvin/testcases/TestCase.json");
    decodedResponses = XmlDoclistExtractorResponseAnalyzerTest
            .quickParseForTest("/org/apache/solr/kelvin/responseanalyzers/multiResult.xml");
    JsonNode empty = JsonNodeFactory.instance.objectNode();
    SingletonTestRegistry.configure(empty);
    SingletonConditionRegistry.configure(empty);
}

From source file:es.bsc.amon.controller.QueriesDBMapper.java

/**
 * Uses the MongoDB Json query language//from w  ww  .  j a v a 2s . com
 * @param query
 * @return
 */
public ArrayNode aggregate(JsonNode query) {
    Object raw = JSON.parse(query.toString());
    ArrayNode ret = new ArrayNode(JsonNodeFactory.instance);

    if (raw instanceof BasicDBObject) {
        ret = (ArrayNode) Json.parse(EventsDBMapper.getInstance().aggregate((BasicDBObject) raw).toString());
    } else if (raw instanceof BasicDBList) {
        ret = (ArrayNode) Json.parse(EventsDBMapper.getInstance().aggregate((BasicDBList) raw).toString());
    }

    return ret;
}

From source file:neo4play.RelationshipService.java

private static JsonNode buildStatements(String query) {
    ObjectNode statement = Json.newObject();
    statement.put("statement", query);
    ArrayNode statementList = JsonNodeFactory.instance.arrayNode();
    statementList.add(statement);/*from ww  w  .  jav a2  s.  com*/
    ObjectNode statements = Json.newObject();
    statements.put("statements", statementList);
    return statements;
}

From source file:org.apache.solr.kelvin.scorer.ScorersTest.java

public void testMissingResults() throws Exception {
    //actually tests TypedTestScorer
    MissingFieldScorer mfs = new MissingFieldScorer();
    mfs.configure(JsonNodeFactory.instance.objectNode());

    //must be 0//from ww w .  ja v  a 2  s. co  m
    String measureName = "misses";
    assertEquals(0.0, peek(mfs, measureName).getValue());

    mfs.update(null, new MissingFieldTestEvent(null, null, null, 0));
    assertEquals(1.0, peek(mfs, measureName).getValue());
    mfs.update(null, new ExceptionTestEvent(null, null, null));
    // different base class, shoud not be counted
    assertEquals(1.0, peek(mfs, measureName).getValue());

    mfs.update(null, new MissingFieldTestEvent(null, null, null, 0));
    mfs.update(null, new MissingFieldTestEvent(null, null, null, 0));
    assertEquals(3.0, peek(mfs, measureName).getValue());
}

From source file:org.onosproject.ovsdbrest.rest.OvsdbBridgeWebResource.java

@GET
@Path("/test")
public Response getTest() {
    ObjectNode responseBody = new ObjectNode(JsonNodeFactory.instance);
    responseBody.put("message", "it works!");
    return Response.status(200).entity(responseBody).build();
}

From source file:org.apache.usergrid.android.sdk.utils.JsonUtils.java

public static void setFloatProperty(Map<String, JsonNode> properties, String name, Float value) {
    if (value == null) {
        properties.remove(name);/*from   www.  java 2  s .com*/
    } else {
        properties.put(name, JsonNodeFactory.instance.numberNode(value));
    }
}

From source file:com.flipkart.zjsonpatch.TestDataGenerator.java

private static ArrayNode getArrayNode(List<String> args) {
    ArrayNode countryNode = JsonNodeFactory.instance.arrayNode();
    for (String arg : args) {
        countryNode.add(arg);/*from   www  .  j a va 2  s . c om*/
    }
    return countryNode;
}

From source file:org.apache.taverna.gis.GisActivityFactoryTest.java

@Before
public void setUp() throws Exception {
    configuration = JsonNodeFactory.instance.objectNode();
    configuration.put("exampleString", "something");
    configuration.put("exampleUri", "http://localhost:8080/myEndPoint");

    activityFactory = new GisActivityFactory();
    activityFactory.setEdits(new EditsImpl());
}