example json edit

substring edit
This commit is contained in:
geek 2017-05-23 11:23:09 +09:00
parent 27578fe288
commit cec74ae05a
3 changed files with 9 additions and 9 deletions

View File

@ -130,7 +130,7 @@ public class JmxCrawler extends Crawler{
int start = s.indexOf("["); int start = s.indexOf("[");
int end = s.lastIndexOf("]"); int end = s.lastIndexOf("]");
s = s.substring(start,end); s = s.substring(start+1,end);
String [] slices = s.split(","); String [] slices = s.split(",");
String returnData = ""; String returnData = "";

View File

@ -3,14 +3,13 @@ package com.loafle;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.loafle.overflow.crawler.Crawler;
import com.loafle.overflow.crawler.config.*; import com.loafle.overflow.crawler.config.*;
import com.loafle.overflow.crawler.jmx.JmxCrawler; import com.loafle.overflow.crawler.jmx.JmxCrawler;
import com.loafle.overflow.crawler.result.OFResultSet; import com.loafle.overflow.crawler.result.OFResultSet;
import org.junit.Test; import org.junit.Test;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.net.URL;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -25,6 +24,7 @@ public class AppTest {
public void TestDoCrawler() throws Exception { public void TestDoCrawler() throws Exception {
ClassLoader classLoader = getClass().getClassLoader(); ClassLoader classLoader = getClass().getClassLoader();
URL url = classLoader.getResource("config/");
String path = classLoader.getResource("config/example.json").getFile(); String path = classLoader.getResource("config/example.json").getFile();
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();

View File

@ -21,23 +21,23 @@
"items" : [ "items" : [
{ {
"keys" : [ "keys" : [
{"metric" : "net.connector[$0].localPort", "key" : "localPort"}, {"metric" : "net.connector[$0].requestCount", "key" : "requestCount"},
{"metric" : "net.connector[$0].port", "key" : "port"}, {"metric" : "net.connector[$0].loadOnStartup", "key" : "loadOnStartup"},
{"metric" : "net.connector[$0].protocol", "key" : "protocol"} {"metric" : "net.connector[$0].errorCount", "key" : "errorCount"}
], ],
"queryInfo" : { "queryInfo" : {
"query": "*Catalina:type=Connector,*", "query": "*Catalina:j2eeType=Servlet,*",
"extend" : { "extend" : {
"aliases" : [ "aliases" : [
{ {
"key": "port", "key": "Catalina:j2eeType",
"index":0 "index":0
} }
] ]
} }
}, },
"mappingInfo" : { "mappingInfo" : {
"arrayColumns" : [ "portName" ] "arrayColumns" : [ "Servlet" ]
} }
} }
] ]