Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
09dad51000
|
@ -9,6 +9,8 @@ import org.codehaus.jackson.map.ObjectMapper;
|
|||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.aop.framework.Advised;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
|
@ -17,12 +19,16 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by snoop on 17. 6. 28.
|
||||
*/
|
||||
@Ignore
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = {AppConfig.class, JdbcConfiguration.class})
|
||||
public class TargetDiscoveryServiceTest {
|
||||
|
@ -62,6 +68,44 @@ public class TargetDiscoveryServiceTest {
|
|||
}
|
||||
reader.close();
|
||||
return fileData.toString();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testParam() throws NoSuchMethodException {
|
||||
|
||||
Method m = this.targetDiscoveryService.getClass().getMethod("saveAllTarget", List.class, Probe.class);
|
||||
// Method m = TargetDiscoveryService.class.getMethod("saveAllTarget", List.class, Probe.class);
|
||||
|
||||
System.out.println(m.getName());
|
||||
Type[] genericParameterTypes = m.getGenericParameterTypes();
|
||||
|
||||
for(Type genericParameterType : genericParameterTypes){
|
||||
if(genericParameterType instanceof ParameterizedType){
|
||||
ParameterizedType aType = (ParameterizedType) genericParameterType;
|
||||
Type[] parameterArgTypes = aType.getActualTypeArguments();
|
||||
for(Type parameterArgType : parameterArgTypes){
|
||||
Class parameterArgClass = (Class) parameterArgType;
|
||||
System.out.println("parameterArgClass = " + parameterArgClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testName() throws ClassNotFoundException {
|
||||
|
||||
Object o = this.targetDiscoveryService;
|
||||
|
||||
String nnn = o.getClass().getSimpleName();
|
||||
System.out.println(nnn);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user