Search in sources :

Example 1 with ProjectInfo

use of com.kyj.fx.voeditor.visual.loder.ProjectInfo in project Gargoyle by callakrsos.

the class DynamicClassLoaderTest method loadTest3.

/**
	 * classpath를 찾고 classpath의 컴파일 폴더를 기준으로 컴파일을 처리한뒤 정상적으로 특정클래스가 로딩되는지를
	 * 테스트한다.
	 * 
	 * @작성자 : KYJ
	 * @작성일 : 2015. 10. 26.
	 * @throws Exception
	 */
@Test
public void loadTest3() throws Exception {
    ClassPath parsingClassPath = DynamicClassLoader.parsingClassPath("C:/Users/KYJ/JAVA_FX/webWorkspace");
    List<ClassPathEntry> entryFilter = parsingClassPath.entryFilter(entry -> ValueUtil.isNotEmpty(entry.getOutput()));
    entryFilter.forEach(entry -> {
        try {
            String filePathName = parsingClassPath.getFilePathName();
            System.out.println(filePathName);
            String replaceFirst = filePathName.replaceFirst(".classPath", "");
            String output = entry.getOutput();
            System.out.println(output);
            System.out.println("output");
            String classesLocation = replaceFirst + output;
            System.out.println(classesLocation);
            List<ProjectInfo> listClases = DynamicClassLoader.listClases(classesLocation);
            if (listClases.isEmpty())
                return;
            ProjectInfo projectInfo = listClases.get(0);
            List<String> classes = projectInfo.getClasses();
            for (String clzz : classes) {
                DynamicClassLoader.load(classesLocation, clzz);
            }
            System.out.println("load ok.");
        } catch (Exception e) {
            e.printStackTrace();
        }
    });
}
Also used : ClassPath(com.kyj.fx.voeditor.visual.main.model.vo.ClassPath) ProjectInfo(com.kyj.fx.voeditor.visual.loder.ProjectInfo) ClassPathEntry(com.kyj.fx.voeditor.visual.main.model.vo.ClassPathEntry) Test(org.junit.Test)

Aggregations

ProjectInfo (com.kyj.fx.voeditor.visual.loder.ProjectInfo)1 ClassPath (com.kyj.fx.voeditor.visual.main.model.vo.ClassPath)1 ClassPathEntry (com.kyj.fx.voeditor.visual.main.model.vo.ClassPathEntry)1 Test (org.junit.Test)1