e581050a61
modified: ../../../java/packages/OLOneFileTest.java
56 lines
2.0 KiB
Java
56 lines
2.0 KiB
Java
package packages;
|
|
|
|
import com.google.common.collect.Lists;
|
|
import de.dhbwstuttgart.core.JavaTXCompiler;
|
|
import de.dhbwstuttgart.environment.CompilationEnvironment;
|
|
import junit.framework.TestCase;
|
|
import org.junit.Test;
|
|
|
|
import java.io.File;
|
|
import java.io.IOException;
|
|
import java.net.URL;
|
|
import java.net.URLClassLoader;
|
|
|
|
public class LoadDefaultPackageClassesTest extends TestCase {
|
|
|
|
public static final String rootDirectory = System.getProperty("user.dir")+"/src/test/resources/javFiles/packageTest/";
|
|
|
|
|
|
public LoadDefaultPackageClassesTest() throws ClassNotFoundException, IOException {
|
|
/*
|
|
Generate ToImport class in rootDirectory and in output-Directory
|
|
*/
|
|
JavaTXCompiler compiler = new JavaTXCompiler(
|
|
Lists.newArrayList(new File(rootDirectory+"Gen.jav")),
|
|
Lists.newArrayList(new File(rootDirectory+"/de/test/output/")));
|
|
compiler.typeInference();
|
|
compiler.generateBytecode();
|
|
File f = new File(rootDirectory + "Gen.class");
|
|
assertTrue(f.exists());
|
|
}
|
|
|
|
public void testLoadGenClass() throws IOException, ClassNotFoundException {
|
|
CompilationEnvironment.loadDefaultPackageClasses(new File( rootDirectory + "Test.jav"), ClassLoader.getSystemClassLoader());
|
|
}
|
|
|
|
public void testURLClassLoader() throws IOException, ClassNotFoundException {
|
|
URLClassLoader cl = new URLClassLoader(new URL[]{new URL("file://"+rootDirectory)}, ClassLoader.getSystemClassLoader());
|
|
cl.loadClass("Gen");
|
|
}
|
|
/*
|
|
public void testE2E() throws IOException, ClassNotFoundException {
|
|
JavaTXCompiler compiler = new JavaTXCompiler(new File(rootDirectory+"OL.jav"));
|
|
compiler.typeInference();
|
|
compiler.generateBytecode();
|
|
File f = new File(rootDirectory + "OL.class");
|
|
assertTrue(f.exists());
|
|
|
|
compiler = new JavaTXCompiler(new File(rootDirectory+"OLMain.jav"));
|
|
compiler.typeInference();
|
|
compiler.generateBytecode();
|
|
f = new File(rootDirectory + "OLMain.class");
|
|
assertTrue(f.exists());
|
|
}
|
|
*/
|
|
}
|