use of com.linkedin.pegasus.generator.GeneratorResult in project rest.li by linkedin.
the class TestRestLiSnapshotExporter method testCircularSnapshot.
@Test
public void testCircularSnapshot() throws Exception {
RestLiSnapshotExporter exporter = new RestLiSnapshotExporter();
exporter.setResolverPath(resolverPath);
assertEquals(outdir.list().length, 0);
GeneratorResult result = exporter.export("circular", null, new String[] { moduleDir + FS + TEST_DIR + FS + "snapshot" }, new String[] { "com.linkedin.restli.tools.snapshot.circular" }, null, outdir.getAbsolutePath());
String[] expectedFiles = { CIRCULAR_FILE };
assertEquals(outdir.list().length, expectedFiles.length);
assertEquals(result.getModifiedFiles().size(), expectedFiles.length);
assertEquals(result.getTargetFiles().size(), expectedFiles.length);
for (String file : expectedFiles) {
String actualFile = outdir + FS + file;
String expectedFile = SNAPSHOTS_DIR + FS + file;
compareFiles(actualFile, expectedFile);
assertTrue(result.getModifiedFiles().contains(new File(actualFile)));
assertTrue(result.getTargetFiles().contains(new File(actualFile)));
}
}
use of com.linkedin.pegasus.generator.GeneratorResult in project rest.li by linkedin.
the class TestRestLiSnapshotExporter method testSampleGreetingSnapshot.
@Test
public void testSampleGreetingSnapshot() throws Exception {
RestLiSnapshotExporter exporter = new RestLiSnapshotExporter();
exporter.setResolverPath(moduleDir + File.separator + "src" + File.separator + "test" + File.separator + PEGASUS_SUFFIX);
assertEquals(outdir.list().length, 0);
GeneratorResult result = exporter.export("sample", null, new String[] { moduleDir + FS + TEST_DIR }, new String[] { "com.linkedin.restli.tools.sample" }, null, outdir.getAbsolutePath());
String[] expectedFiles = { GREETINGS_FILE };
assertEquals(outdir.list().length, expectedFiles.length);
assertEquals(result.getModifiedFiles().size(), expectedFiles.length);
assertEquals(result.getTargetFiles().size(), expectedFiles.length);
for (String file : expectedFiles) {
String actualFile = outdir + FS + file;
String expectedFile = SNAPSHOTS_DIR + FS + file;
compareFiles(actualFile, expectedFile);
assertTrue(result.getModifiedFiles().contains(new File(actualFile)));
assertTrue(result.getTargetFiles().contains(new File(actualFile)));
}
}
use of com.linkedin.pegasus.generator.GeneratorResult in project rest.li by linkedin.
the class TestRestLiResourceModelExporter method testSampleGreeting.
@Test
public void testSampleGreeting() throws Exception {
RestLiResourceModelExporter exporter = new RestLiResourceModelExporter();
assertEquals(outdir.list().length, 0);
GeneratorResult result = exporter.export(null, null, new String[] { moduleDir + FS + TEST_DIR }, new String[] { "com.linkedin.restli.tools.sample" }, null, outdir.getAbsolutePath());
String[] expectedFiles = { GREETING_FILE };
assertEquals(outdir.list().length, expectedFiles.length);
assertEquals(result.getModifiedFiles().size(), expectedFiles.length);
assertEquals(result.getTargetFiles().size(), expectedFiles.length);
for (String file : expectedFiles) {
String actualFile = outdir + FS + file;
String expectedFile = moduleDir + FS + IDL_DIR + FS + file;
compareFiles(actualFile, expectedFile);
assertTrue(result.getModifiedFiles().contains(new File(actualFile)));
assertTrue(result.getTargetFiles().contains(new File(actualFile)));
}
}
Aggregations