use of org.kie.workbench.common.services.backend.compiler.CompilationResponse in project kie-wb-common by kiegroup.
the class KieClassLoaderProviderTest method loadProjectClassloaderFromStringTest.
@Test
public void loadProjectClassloaderFromStringTest() throws Exception {
// we use NIO for this part of the test because Uberfire lack the implementation to copy a tree
CompilationResponse res = compileProjectInRepo(MavenCLIArgs.COMPILE);
TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName);
assertThat(res.isSuccessful()).isTrue();
Optional<ClassLoader> clazzLoader = CompilerClassloaderUtils.loadDependenciesClassloaderFromProject(uberfireTmp.toAbsolutePath().toString(), mavenRepoPath);
assertThat(clazzLoader).isPresent();
LoadProjectDependencyUtil.loadLoggerFactory(clazzLoader.get());
}
use of org.kie.workbench.common.services.backend.compiler.CompilationResponse in project kie-wb-common by kiegroup.
the class JGITCompilerBeforeDecoratorTest method compileTestTwo.
@Test
public void compileTestTwo() throws Exception {
final FileSystem fileSystem = createFileSystem("myrepodecorator");
// Compile the repo
JGITCompilerBeforeDecorator compiler = new JGITCompilerBeforeDecorator(new BaseMavenCompiler(true, false));
WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(fileSystem.getPath("/"));
CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.COMPILE }, Boolean.TRUE);
CompilationResponse res = compiler.compile(req);
final java.nio.file.Path tempPath = ((Git) compiler.getGitMap().get(fileSystem)).getRepository().getDirectory().toPath().getParent();
TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tempPath, res, this.getClass(), testName);
assertThat(res.isSuccessful()).isTrue();
final Path incrementalConfiguration = Paths.get(tempPath.toUri() + TARGET_TAKARI_PLUGIN);
assertThat(incrementalConfiguration.toFile()).exists();
TestUtil.rm(tempPath.toFile());
}
use of org.kie.workbench.common.services.backend.compiler.CompilationResponse in project kie-wb-common by kiegroup.
the class JGITCompilerBeforeDecoratorTest method compileWithOverrideTest.
@Test
public void compileWithOverrideTest() throws Exception {
final FileSystem fileSystem = createFileSystem("myrepo");
// Compile the repo
WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(fileSystem.getPath("/"));
CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.COMPILE }, Boolean.TRUE);
Map<Path, InputStream> override = new HashMap<>();
org.uberfire.java.nio.file.Path path = fileSystem.getPath("/", "/dummyA/src/main/java/dummy/Person.java");
InputStream input = new FileInputStream(new File("target/test-classes/kjar-2-single-resources_override/src/main/java/dummy/PersonOverride.java"));
override.put(path, input);
JGITCompilerBeforeDecorator compiler = new JGITCompilerBeforeDecorator(new BaseMavenCompiler(true, false));
CompilationResponse res = compiler.compile(req, override);
final java.nio.file.Path tempPath = ((Git) compiler.getGitMap().get(fileSystem)).getRepository().getDirectory().toPath().getParent();
TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tempPath, res, this.getClass(), testName);
assertThat(res.isSuccessful()).isTrue();
final Path incrementalConfiguration = Paths.get(tempPath.toUri() + TARGET_TAKARI_PLUGIN);
assertThat(incrementalConfiguration.toFile().exists()).isTrue();
TestUtil.rm(tempPath.toFile());
}
Aggregations