use of org.kie.workbench.common.services.backend.compiler.impl.incrementalenabler.DefaultIncrementalCompilerEnabler in project kie-wb-common by kiegroup.
the class DefaultIncrementalCompilerEnablerTest method testReadPomsInaPrjTest.
@Test
public void testReadPomsInaPrjTest() throws Exception {
FileSystemProvider fs = FileSystemProviders.getDefaultProvider();
Path tmpRoot = Files.createTempDirectory("repo");
// NIO creation and copy content
Path temp = Files.createDirectories(Paths.get(tmpRoot.toString(), "dummy"));
TestUtil.copyTree(Paths.get("src/test/projects/dummy_multimodule_untouched"), temp);
// end NIO
Path tmp = Paths.get(tmpRoot.toAbsolutePath().toString(), "dummy");
Path mainPom = Paths.get(temp.toAbsolutePath().toString(), "pom.xml");
byte[] encoded = Files.readAllBytes(Paths.get(temp.toAbsolutePath().toString(), "pom.xml"));
String pomAsAstring = new String(encoded, StandardCharsets.UTF_8);
assertThat(pomAsAstring).doesNotContain(TestConstants.TAKARI_LIFECYCLE_ARTIFACT);
WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(tmp);
CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.COMPILE }, Boolean.FALSE);
DefaultIncrementalCompilerEnabler enabler = new DefaultIncrementalCompilerEnabler();
assertThat(enabler.process(req).getResult()).isTrue();
encoded = Files.readAllBytes(Paths.get(mainPom.toString()));
pomAsAstring = new String(encoded, StandardCharsets.UTF_8);
assertThat(pomAsAstring).contains(TestConstants.KIE_TAKARI_LIFECYCLE_ARTIFACT);
assertThat(pomAsAstring.contains("kie-takari-plugin")).isFalse();
TestUtil.rm(tmpRoot.toFile());
}
use of org.kie.workbench.common.services.backend.compiler.impl.incrementalenabler.DefaultIncrementalCompilerEnabler in project kie-wb-common by kiegroup.
the class DefaultIncrementalCompilerEnablerTest method testReadKiePluginTest.
@Test
public void testReadKiePluginTest() throws Exception {
Path tmpRoot = Files.createTempDirectory("repo");
// NIO creation and copy content
Path temp = Files.createDirectories(Paths.get(tmpRoot.toString(), "dummy"));
TestUtil.copyTree(Paths.get("src/test/projects/dummy_kie_multimodule_untouched"), temp);
// end NIO
Path tmp = Paths.get(tmpRoot.toAbsolutePath().toString(), "dummy");
Path mainPom = Paths.get(tmp.toAbsolutePath().toString(), "pom.xml");
byte[] encoded = Files.readAllBytes(Paths.get(tmp.toAbsolutePath().toString(), "pom.xml"));
String pomAsAstring = new String(encoded, StandardCharsets.UTF_8);
assertThat(pomAsAstring).doesNotContain(TestConstants.TAKARI_LIFECYCLE_ARTIFACT);
assertThat(pomAsAstring).doesNotContain("<packaging>kjar</packaging>");
byte[] encodedDummyB = Files.readAllBytes(Paths.get(tmp.toAbsolutePath().toString(), "/dummyB/pom.xml"));
String pomAsAstringDummyB = new String(encodedDummyB, StandardCharsets.UTF_8);
assertThat(pomAsAstringDummyB).contains("<packaging>kjar</packaging>");
WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(tmp);
CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.COMPILE }, Boolean.FALSE);
DefaultIncrementalCompilerEnabler enabler = new DefaultIncrementalCompilerEnabler();
assertThat(enabler.process(req).getResult()).isTrue();
assertThat(info.isKiePluginPresent()).isTrue();
encoded = Files.readAllBytes(Paths.get(mainPom.toString()));
pomAsAstring = new String(encoded, StandardCharsets.UTF_8);
assertThat(pomAsAstring).contains("kie-takari-plugin");
TestUtil.rm(tmpRoot.toFile());
}
use of org.kie.workbench.common.services.backend.compiler.impl.incrementalenabler.DefaultIncrementalCompilerEnabler in project kie-wb-common by kiegroup.
the class DefaultMavenCompilerTest method testJDTCompiler.
@Test
public void testJDTCompiler() throws Exception {
Path tmpRoot = Files.createTempDirectory("repo");
// NIO creation and copy content
Path temp = Files.createDirectories(Paths.get(tmpRoot.toString(), "dummy"));
TestUtil.copyTree(Paths.get(ResourcesConstants.DUMMY_KIE_MULTIMODULE_UNTOUCHED_WITH_ERROR_DIR), temp);
// end NIO
Path tmp = Paths.get(tmpRoot.toAbsolutePath().toString(), "dummy");
Path mainPom = Paths.get(tmp.toAbsolutePath().toString(), "pom.xml");
byte[] encoded = Files.readAllBytes(Paths.get(tmp.toAbsolutePath().toString(), "pom.xml"));
String pomAsAstring = new String(encoded, StandardCharsets.UTF_8);
assertThat(pomAsAstring).doesNotContain("<artifactId>kie-takari-lifecycle-plugin</artifactId>").doesNotContain("<packaging>kjar</packaging>").doesNotContain("<compilerId>jdt</compilerId>").doesNotContain("<source>1.8</source>").doesNotContain("<target>1.8</target>");
WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(tmp);
CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.COMPILE }, Boolean.FALSE);
DefaultIncrementalCompilerEnabler enabler = new DefaultIncrementalCompilerEnabler();
assertThat(enabler.process(req).getResult()).isTrue();
encoded = Files.readAllBytes(Paths.get(mainPom.toString()));
pomAsAstring = new String(encoded, StandardCharsets.UTF_8);
assertThat(pomAsAstring).contains("<compilerId>jdt</compilerId>").contains("<source>1.8</source>").contains("<target>1.8</target>");
TestUtil.rm(tmpRoot.toFile());
}
Aggregations