org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode.asInt()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(239)

本文整理了Java中org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode.asInt()方法的一些代码示例,展示了JsonNode.asInt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonNode.asInt()方法的具体详情如下:
包路径:org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.JsonNode
类名称:JsonNode
方法名:asInt

JsonNode.asInt介绍

暂无

代码示例

代码示例来源:origin: apache/flink

int numTasks = tasks.get("total").asInt();
int pending = tasks.get("pending").asInt();
int running = tasks.get("running").asInt();
int finished = tasks.get("finished").asInt();
int canceling = tasks.get("canceling").asInt();
int canceled = tasks.get("canceled").asInt();
int failed = tasks.get("failed").asInt();

代码示例来源:origin: apache/flink

@Test
public void getTaskmanagers() throws Exception {
  String json = TestBaseUtils.getFromHTTP("http://localhost:" + getRestPort() + "/taskmanagers/");
  ObjectMapper mapper = new ObjectMapper();
  JsonNode parsed = mapper.readTree(json);
  ArrayNode taskManagers = (ArrayNode) parsed.get("taskmanagers");
  assertNotNull(taskManagers);
  assertEquals(NUM_TASK_MANAGERS, taskManagers.size());
  JsonNode taskManager = taskManagers.get(0);
  assertNotNull(taskManager);
  assertEquals(NUM_SLOTS, taskManager.get("slotsNumber").asInt());
  assertTrue(taskManager.get("freeSlots").asInt() <= NUM_SLOTS);
}

代码示例来源:origin: apache/flink

@Test
  public void testDeserializeWithMetadata() throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    ObjectNode initialKey = mapper.createObjectNode();
    initialKey.put("index", 4);
    byte[] serializedKey = mapper.writeValueAsBytes(initialKey);

    ObjectNode initialValue = mapper.createObjectNode();
    initialValue.put("word", "world");
    byte[] serializedValue = mapper.writeValueAsBytes(initialValue);

    JSONKeyValueDeserializationSchema schema = new JSONKeyValueDeserializationSchema(true);
    ObjectNode deserializedValue = schema.deserialize(serializedKey, serializedValue, "topic#1", 3, 4);

    Assert.assertEquals(4, deserializedValue.get("key").get("index").asInt());
    Assert.assertEquals("world", deserializedValue.get("value").get("word").asText());
    Assert.assertEquals("topic#1", deserializedValue.get("metadata").get("topic").asText());
    Assert.assertEquals(4, deserializedValue.get("metadata").get("offset").asInt());
    Assert.assertEquals(3, deserializedValue.get("metadata").get("partition").asInt());
  }
}

代码示例来源:origin: apache/flink

assertEquals(1, parallelismField.asInt());
assertEquals(expectedParallelism, parallelismField.asInt());

代码示例来源:origin: apache/flink

@Test
public void testDeserializeWithoutValue() throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  ObjectNode initialKey = mapper.createObjectNode();
  initialKey.put("index", 4);
  byte[] serializedKey = mapper.writeValueAsBytes(initialKey);
  byte[] serializedValue = null;
  JSONKeyValueDeserializationSchema schema = new JSONKeyValueDeserializationSchema(false);
  ObjectNode deserializedValue = schema.deserialize(serializedKey, serializedValue, "", 0, 0);
  Assert.assertTrue(deserializedValue.get("metadata") == null);
  Assert.assertEquals(4, deserializedValue.get("key").get("index").asInt());
  Assert.assertTrue(deserializedValue.get("value") == null);
}

代码示例来源:origin: apache/flink

@Test
public void testDeserializeWithoutMetadata() throws IOException {
  ObjectMapper mapper = new ObjectMapper();
  ObjectNode initialKey = mapper.createObjectNode();
  initialKey.put("index", 4);
  byte[] serializedKey = mapper.writeValueAsBytes(initialKey);
  ObjectNode initialValue = mapper.createObjectNode();
  initialValue.put("word", "world");
  byte[] serializedValue = mapper.writeValueAsBytes(initialValue);
  JSONKeyValueDeserializationSchema schema = new JSONKeyValueDeserializationSchema(false);
  ObjectNode deserializedValue = schema.deserialize(serializedKey, serializedValue, "", 0, 0);
  Assert.assertTrue(deserializedValue.get("metadata") == null);
  Assert.assertEquals(4, deserializedValue.get("key").get("index").asInt());
  Assert.assertEquals("world", deserializedValue.get("value").get("word").asText());
}

代码示例来源:origin: org.apache.flink/flink-runtime-web

int numTasks = tasks.get("total").asInt();
int pending = tasks.get("pending").asInt();
int running = tasks.get("running").asInt();
int finished = tasks.get("finished").asInt();
int canceling = tasks.get("canceling").asInt();
int canceled = tasks.get("canceled").asInt();
int failed = tasks.get("failed").asInt();

代码示例来源:origin: org.apache.flink/flink-runtime-web_2.11

int numTasks = tasks.get("total").asInt();
int pending = tasks.get("pending").asInt();
int running = tasks.get("running").asInt();
int finished = tasks.get("finished").asInt();
int canceling = tasks.get("canceling").asInt();
int canceled = tasks.get("canceled").asInt();
int failed = tasks.get("failed").asInt();

相关文章