add crawlers

This commit is contained in:
jackdaw@loafle.com 2017-04-12 14:59:33 +09:00
parent d9019cc150
commit 396a613d1b
3 changed files with 76 additions and 2 deletions

39
pom.xml
View File

@ -45,12 +45,49 @@
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<!--crawlers-->
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>crawler_java</artifactId>
<artifactId>crawler_sql</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>crawler_snmp</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>cralwer_redis</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>crawler_mongo</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.loafle.overflow</groupId>
<artifactId>crawler_wmi</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.loafle.overflow</groupId>-->
<!--<artifactId>crawler_jmx</artifactId>-->
<!--<version>1.0.0-SNAPSHOT</version>-->
<!--</dependency>-->
</dependencies>
</project>

View File

@ -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);

View File

@ -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<String,Object> m= new HashMap<String, Object>();
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"));
}
}