From 396a613d1b15f4897865f54476c9e3d8be9e3ad1 Mon Sep 17 00:00:00 2001 From: "jackdaw@loafle.com" Date: Wed, 12 Apr 2017 14:59:33 +0900 Subject: [PATCH] add crawlers --- pom.xml | 39 ++++++++++++++++++- .../com/loafle/overflow/rpc/Application.java | 4 +- .../loafle/overflow/rpc/ApplicationTest.java | 35 +++++++++++++++++ 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 src/test/java/com/loafle/overflow/rpc/ApplicationTest.java diff --git a/pom.xml b/pom.xml index 179fefa..52e7915 100644 --- a/pom.xml +++ b/pom.xml @@ -45,12 +45,49 @@ spring-boot-starter-jetty + + org.springframework.boot + spring-boot-starter-test + + + + com.loafle.overflow - crawler_java + crawler_sql 1.0.0-SNAPSHOT + + com.loafle.overflow + crawler_snmp + 1.0.0-SNAPSHOT + + + + com.loafle.overflow + cralwer_redis + 1.0.0-SNAPSHOT + + + + com.loafle.overflow + crawler_mongo + 1.0.0-SNAPSHOT + + + + com.loafle.overflow + crawler_wmi + 1.0.0-SNAPSHOT + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/loafle/overflow/rpc/Application.java b/src/main/java/com/loafle/overflow/rpc/Application.java index 80ade13..faf27d8 100644 --- a/src/main/java/com/loafle/overflow/rpc/Application.java +++ b/src/main/java/com/loafle/overflow/rpc/Application.java @@ -2,8 +2,10 @@ package com.loafle.overflow.rpc; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; +import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; -@SpringBootApplication +@SpringBootApplication(exclude = {MongoAutoConfiguration.class, MongoDataAutoConfiguration.class}) public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); diff --git a/src/test/java/com/loafle/overflow/rpc/ApplicationTest.java b/src/test/java/com/loafle/overflow/rpc/ApplicationTest.java new file mode 100644 index 0000000..83f3af0 --- /dev/null +++ b/src/test/java/com/loafle/overflow/rpc/ApplicationTest.java @@ -0,0 +1,35 @@ +package com.loafle.overflow.rpc; + +import com.loafle.overflow.crawler.Crawler; +import com.loafle.overflow.rpc.api.RemoteImpl; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import java.util.HashMap; +import java.util.Map; + +import static org.junit.Assert.*; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = Application.class) +public class ApplicationTest { + + @Autowired + private RemoteImpl impl; + + @Test + public void TestRun() throws Exception { + + Crawler r = impl.getCrawler("REDIS"); + Map m= new HashMap(); + m.put("id","192.168.1.104"); + m.put("port","6379"); + r.putConfig("testid",m); + + m = r.getConfig("testid"); + assertEquals("192.168.1.104",m.get("id")); + } +} \ No newline at end of file