use of net.morimekta.providence.reflect.util.ProgramConverter in project providence by morimekta.
the class CMessageBuilderTest method setUp.
@Before
public void setUp() throws IOException {
File file = tmp.newFile("test.thrift").getCanonicalFile().getAbsoluteFile();
ProgramRegistry tmp = new ProgramRegistry();
ThriftProgramParser parser = new ThriftProgramParser();
ProgramConverter converter = new ProgramConverter(tmp);
ProgramType program = parser.parse(getClass().getResourceAsStream("/parser/tests/test.thrift"), file, ImmutableList.of());
tmp.putProgram(file.getPath(), converter.convert(file.getPath(), program));
registry = tmp.registryForPath(file.getCanonicalFile().getAbsolutePath());
}
use of net.morimekta.providence.reflect.util.ProgramConverter in project providence by morimekta.
the class CServiceMethodTest method setUp.
@Before
public void setUp() throws IOException {
File numeric = ResourceUtils.copyResourceTo("/parser/calculator/number.thrift", tmp.getRoot());
File calculator = ResourceUtils.copyResourceTo("/parser/calculator/calculator.thrift", tmp.getRoot());
ProgramRegistry registry = new ProgramRegistry();
ThriftProgramParser parser = new ThriftProgramParser();
ProgramConverter converter = new ProgramConverter(registry);
ProgramType program = parser.parse(new FileInputStream(numeric), numeric, ImmutableList.of(tmp.getRoot()));
registry.putProgram(numeric.getCanonicalPath(), converter.convert(numeric.getCanonicalPath(), program));
program = parser.parse(new FileInputStream(calculator), calculator, ImmutableList.of(tmp.getRoot()));
registry.putProgram(calculator.getCanonicalPath(), converter.convert(calculator.getCanonicalPath(), program));
this.registry = registry.registryForPath(calculator.getCanonicalPath());
}
use of net.morimekta.providence.reflect.util.ProgramConverter in project providence by morimekta.
the class CServiceTest method setUp.
@Before
public void setUp() throws IOException {
File numeric = ResourceUtils.copyResourceTo("/parser/calculator/number.thrift", tmp.getRoot());
File calculator = ResourceUtils.copyResourceTo("/parser/calculator/calculator.thrift", tmp.getRoot());
ProgramRegistry registry = new ProgramRegistry();
ThriftProgramParser parser = new ThriftProgramParser();
ProgramConverter converter = new ProgramConverter(registry);
ProgramType program = parser.parse(new FileInputStream(numeric), numeric, ImmutableList.of(tmp.getRoot()));
registry.putProgram(numeric.getCanonicalPath(), converter.convert(numeric.getCanonicalPath(), program));
program = parser.parse(new FileInputStream(calculator), calculator, ImmutableList.of(tmp.getRoot()));
registry.putProgram(calculator.getCanonicalPath(), converter.convert(calculator.getCanonicalPath(), program));
this.registry = registry.registryForPath(calculator.getCanonicalPath());
}
Aggregations