use of org.kie.workbench.common.services.backend.compiler.impl.kie.KieCompilationResponse in project kie-wb-common by kiegroup.
the class KieMetadataTest method compileAndloadKieJarSingleMetadata.
@Test
@Ignore("https://issues.redhat.com/browse/AF-2892")
public void compileAndloadKieJarSingleMetadata() {
/**
* If the test fail check if the Drools core classes used, KieModuleMetaInfo and TypeMetaInfo implements Serializable
*/
try {
Path tmp = TestUtil.createAndCopyToDirectory(tmpRoot, "dummy", ResourcesConstants.KJAR_2_SINGLE_RESOURCES);
final AFCompiler compiler = KieMavenCompilerFactory.getCompiler(EnumSet.of(KieDecorator.ENABLE_LOGGING, KieDecorator.STORE_KIE_OBJECTS, KieDecorator.STORE_BUILD_CLASSPATH, KieDecorator.ENABLE_INCREMENTAL_BUILD));
WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(Paths.get(tmp.toUri()));
CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE);
KieCompilationResponse res = (KieCompilationResponse) compiler.compile(req);
TestUtil.saveMavenLogIfCompilationResponseNotSuccessfull(tmp, res, this.getClass(), testName);
if (!res.isSuccessful()) {
List<String> msgs = res.getMavenOutput();
for (String msg : msgs) {
logger.info(msg);
}
}
assertThat(res.isSuccessful()).isTrue();
Optional<KieModuleMetaInfo> metaDataOptional = res.getKieModuleMetaInfo();
assertThat(metaDataOptional).isPresent();
KieModuleMetaInfo kieModuleMetaInfo = metaDataOptional.get();
assertThat(kieModuleMetaInfo).isNotNull();
Optional<KieModule> kieModuleOptional = res.getKieModule();
assertThat(kieModuleOptional).isPresent();
assertThat(res.getDependenciesAsURI()).hasSize(4);
// comment if you want read the log file after the test run
} catch (Exception e) {
e.printStackTrace();
}
}
use of org.kie.workbench.common.services.backend.compiler.impl.kie.KieCompilationResponse in project kie-wb-common by kiegroup.
the class DefaultKieCompilerServiceTest method buildRemoteAndInstallExistentProject.
@Test
@Ignore("https://issues.redhat.com/browse/AF-2892")
public void buildRemoteAndInstallExistentProject() throws Exception {
AFCompilerService service = new DefaultKieCompilerService();
CompletableFuture<KieCompilationResponse> futureRes = service.buildAndInstall(Paths.get(tmpRoot.toAbsolutePath() + "/dummy").toAbsolutePath().toString(), mavenRepoPath, TestUtilMaven.getSettingsFile());
KieCompilationResponse res = futureRes.get();
assertThat(res.isSuccessful()).isTrue();
assertThat(res.getDependencies()).isNotEmpty();
assertThat(res.getDependencies().size()).isGreaterThan(0);
}
use of org.kie.workbench.common.services.backend.compiler.impl.kie.KieCompilationResponse in project kie-wb-common by kiegroup.
the class DefaultKieCompilerServiceTest method buildRemoteSpecializedSkipDepsNonExistentProject.
@Test
public void buildRemoteSpecializedSkipDepsNonExistentProject() throws Exception {
AFCompilerService service = new DefaultKieCompilerService();
CompletableFuture<KieCompilationResponse> futureRes = service.buildSpecialized(tmpRoot.toAbsolutePath().toString(), mavenRepoPath, new String[] { MavenCLIArgs.ALTERNATE_USER_SETTINGS + TestUtilMaven.getSettingsFile(), MavenCLIArgs.COMPILE }, Boolean.TRUE);
KieCompilationResponse res = futureRes.get();
assertThat(res.isSuccessful()).isFalse();
}
use of org.kie.workbench.common.services.backend.compiler.impl.kie.KieCompilationResponse in project kie-wb-common by kiegroup.
the class DefaultKieCompilerServiceTest method buildRemoteExistentProject.
@Test
@Ignore("https://issues.redhat.com/browse/AF-2892")
public void buildRemoteExistentProject() throws Exception {
AFCompilerService service = new DefaultKieCompilerService();
CompletableFuture<KieCompilationResponse> futureRes = service.build(Paths.get(tmpRoot.toAbsolutePath() + "/dummy").toAbsolutePath().toString(), mavenRepoPath, TestUtilMaven.getSettingsFile());
KieCompilationResponse res = futureRes.get();
assertThat(res.isSuccessful()).isTrue();
}
use of org.kie.workbench.common.services.backend.compiler.impl.kie.KieCompilationResponse in project kie-wb-common by kiegroup.
the class DefaultKieCompilerServiceTest method buildWithOverrideNonExistentProject.
@Test
public void buildWithOverrideNonExistentProject() throws Exception {
AFCompilerService service = new DefaultKieCompilerService();
// change some files
Map<Path, InputStream> override = new HashMap<>();
org.uberfire.java.nio.file.Path path = org.uberfire.java.nio.file.Paths.get(tmpRoot + "/dummy/src/main/java/dummy/DummyOverride.java");
InputStream input = new FileInputStream(new File("target/test-classes/dummy_override/src/main/java/dummy/DummyOverride.java"));
override.put(path, input);
CompletableFuture<KieCompilationResponse> futureRes = service.build(tmpRoot, mavenRepoPath, TestUtilMaven.getSettingsFile(), override);
KieCompilationResponse res = futureRes.get();
assertThat(res.isSuccessful()).isFalse();
}
Aggregations