added test
wmi
This commit is contained in:
parent
c704055570
commit
6ab69dbd66
|
@ -9,6 +9,7 @@ import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
@ -32,4 +33,26 @@ public class ApplicationTest {
|
||||||
m = r.getConfig("testid");
|
m = r.getConfig("testid");
|
||||||
assertEquals("192.168.1.104",m.get("id"));
|
assertEquals("192.168.1.104",m.get("id"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWMI() throws Exception {
|
||||||
|
Crawler r = impl.getCrawler("WMI");
|
||||||
|
|
||||||
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
map.put("id", "administrator");
|
||||||
|
map.put("pw", "!@#$qwer1234");
|
||||||
|
map.put("nameSpace", "root/cimv2");
|
||||||
|
map.put("query", "select * from Win32_OperatingSystem");
|
||||||
|
map.put("ip", "192.168.1.1");
|
||||||
|
|
||||||
|
List<Map<String, String>> resultList = (List<Map<String, String>>)r.getInternal(map);
|
||||||
|
|
||||||
|
for( Map<String,String> rMap : resultList) {
|
||||||
|
for( String key : rMap.keySet() ){
|
||||||
|
System.out.println( String.format("key : %s ||| value : %s", key, rMap.get(key)) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user