Esempio n. 1
0
 public WebApp(String id, String uriPath, Classes classes) {
   this(
       id,
       null,
       null,
       uriPath != null ? U.set(uriPath) : null,
       AppMode.DEVELOPMENT,
       null,
       null,
       classes,
       null);
 }
Esempio n. 2
0
  @Test
  public void testCompile() throws Exception {

    Compilation compilation =
        Compile.compile(
            IO.load("test1.java"),
            IO.load("mixin.java"),
            "public class Book { String title; int x = 1234; } class Foo {}",
            "public class Bar extends Foo {}",
            "public class Fg extends Foo {}");

    Set<Class<?>> classes = compilation.loadClasses();
    eq(classes.size(), 10);

    Set<String> classNames = compilation.getClassNames();
    D.print(classNames);

    eq(Cls.classMap(classes).get("Main").getAnnotations().length, 2);

    Set<String> expectedClasses =
        U.set(
            "abc.Main",
            "abc.Main$1",
            "abc.Person",
            "abc.Person$Insider",
            "abc.PersonService",
            "Book",
            "Foo",
            "Bar",
            "Fg",
            "mixo.Mixin");
    eq(classNames, expectedClasses);

    for (String clsName : expectedClasses) {
      Class<?> cls = compilation.loadClass(clsName);
      notNull(cls);
      eq(cls.getName(), clsName);
    }

    Class<?> mainClass = compilation.loadClass("abc.Main");
    Method main = Cls.getMethod(mainClass, "main", String[].class);

    Cls.invoke(main, null, new Object[] {new String[] {}});
  }