Search in sources :

Example 6 with ProgramTypeRegistry

use of net.morimekta.providence.reflect.util.ProgramTypeRegistry in project providence by morimekta.

the class TypeLoaderTest method testLoadServices.

@Test
public void testLoadServices() throws IOException {
    copyResourceTo("/parser/tests/service2.thrift", temp.getRoot());
    File service = copyResourceTo("/parser/tests/service.thrift", temp.getRoot());
    TypeLoader loader = new TypeLoader(ImmutableList.of());
    ProgramTypeRegistry reg = loader.load(service);
    assertThat(loader.loadedPrograms(), hasSize(2));
    assertThat(reg.getLocalProgramContext(), is("service"));
    ProgramTypeRegistry rep = loader.load(service);
    assertThat(loader.loadedPrograms(), hasSize(2));
    assertThat(rep, sameInstance(reg));
}
Also used : ProgramTypeRegistry(net.morimekta.providence.reflect.util.ProgramTypeRegistry) File(java.io.File) Test(org.junit.Test)

Aggregations

ProgramTypeRegistry (net.morimekta.providence.reflect.util.ProgramTypeRegistry)6 File (java.io.File)4 IOException (java.io.IOException)4 Generator (net.morimekta.providence.generator.Generator)3 GeneratorException (net.morimekta.providence.generator.GeneratorException)3 CProgram (net.morimekta.providence.reflect.contained.CProgram)3 BufferedInputStream (java.io.BufferedInputStream)2 BufferedOutputStream (java.io.BufferedOutputStream)2 FileInputStream (java.io.FileInputStream)2 InputStream (java.io.InputStream)2 UncheckedIOException (java.io.UncheckedIOException)2 ArgumentException (net.morimekta.console.args.ArgumentException)2 ArgumentParser (net.morimekta.console.args.ArgumentParser)2 PDeclaredDescriptor (net.morimekta.providence.descriptor.PDeclaredDescriptor)2 GeneratorFactory (net.morimekta.providence.generator.GeneratorFactory)2 GeneratorOptions (net.morimekta.providence.generator.GeneratorOptions)2 FileManager (net.morimekta.providence.generator.util.FileManager)2 TypeLoader (net.morimekta.providence.reflect.TypeLoader)2 ParseException (net.morimekta.providence.reflect.parser.ParseException)2 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1