sql crawler
This commit is contained in:
parent
e206016ad8
commit
0d414b3b8f
2
pom.xml
2
pom.xml
|
@ -45,7 +45,7 @@
|
|||
|
||||
<dependency>
|
||||
<groupId>com.loafle.overflow</groupId>
|
||||
<artifactId>crawler_java</artifactId>
|
||||
<artifactId>crawler</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public class SQLCrawler extends Crawler {
|
|||
}
|
||||
|
||||
|
||||
private List<Map<String, String>> getMetrics(Map<String, Object> config) {
|
||||
private Object getMetrics(Map<String, Object> config) {
|
||||
|
||||
Connection conn = null;
|
||||
Statement stmt = null;
|
||||
|
@ -58,8 +58,7 @@ public class SQLCrawler extends Crawler {
|
|||
return datas;
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
new Exception(e.getMessage()).printStackTrace();
|
||||
|
||||
} finally {
|
||||
if (conn != null) {
|
||||
|
@ -87,7 +86,6 @@ public class SQLCrawler extends Crawler {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
package com.loafle.overflow;
|
||||
|
||||
import com.loafle.overflow.crawler.Crawler;
|
||||
import com.loafle.overflow.crawler.sql.SQLCrawler;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -36,6 +36,7 @@ public class AppTest {
|
|||
// info.setQuery("select * from v$sysstat");
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testSQL() {
|
||||
SQLCrawler sc = new SQLCrawler();
|
||||
Map config = new HashMap();
|
||||
|
@ -45,9 +46,8 @@ public class AppTest {
|
|||
config.put("ssl", false);
|
||||
config.put("query", "show session status");
|
||||
|
||||
List<Map<String,String>> result = (List<Map<String,String>>)sc.getInternal(config);
|
||||
|
||||
for(Map<String, String> m : result) {
|
||||
Object result = sc.getInternal(config);
|
||||
for(Map<String, String> m : (List<Map<String,String>>)result) {
|
||||
for (Map.Entry<String, String> entry : m.entrySet()) {
|
||||
System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user