Search in sources :

Example 36 with CompilationRequest

use of org.kie.workbench.common.services.backend.compiler.CompilationRequest in project kie-wb-common by kiegroup.

the class BuildInMemoryClasspathMojoTest method getClassloaderFromAllDependenciesComplexTest.

@Test
public void getClassloaderFromAllDependenciesComplexTest() {
    Path path = Paths.get(".").resolve("target/test-classes/dummy_deps_complex");
    final AFCompiler compiler = KieMavenCompilerFactory.getCompiler(EnumSet.of(KieDecorator.STORE_BUILD_CLASSPATH));
    WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(path);
    CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath, MavenConfig.DEPS_IN_MEMORY_BUILD_CLASSPATH }, Boolean.FALSE);
    CompilationResponse res = compiler.compile(req);
    assertThat(res.isSuccessful()).isTrue();
    assertThat(res.getDependencies()).isNotEmpty();
    assertThat(res.getDependencies()).hasSize(7);
}
Also used : Path(org.uberfire.java.nio.file.Path) WorkspaceCompilationInfo(org.kie.workbench.common.services.backend.compiler.impl.WorkspaceCompilationInfo) DefaultCompilationRequest(org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest) CompilationResponse(org.kie.workbench.common.services.backend.compiler.CompilationResponse) AFCompiler(org.kie.workbench.common.services.backend.compiler.AFCompiler) CompilationRequest(org.kie.workbench.common.services.backend.compiler.CompilationRequest) DefaultCompilationRequest(org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest) Test(org.junit.Test)

Example 37 with CompilationRequest

use of org.kie.workbench.common.services.backend.compiler.CompilationRequest in project kie-wb-common by kiegroup.

the class BuildInMemoryClasspathMojoTest method getClassloaderFromAllDependenciesSimpleTest.

@Test
public void getClassloaderFromAllDependenciesSimpleTest() {
    Path path = Paths.get(".").resolve("target/test-classes/dummy_deps_simple");
    final AFCompiler compiler = KieMavenCompilerFactory.getCompiler(EnumSet.of(KieDecorator.STORE_BUILD_CLASSPATH));
    WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(path);
    CompilationRequest req = new DefaultCompilationRequest(mavenRepoPath, info, new String[] { MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath, MavenConfig.DEPS_IN_MEMORY_BUILD_CLASSPATH }, Boolean.FALSE);
    CompilationResponse res = compiler.compile(req);
    assertThat(res.isSuccessful()).isTrue();
    assertThat(res.getDependencies()).isNotEmpty();
    assertThat(res.getDependencies()).hasSize(4);
}
Also used : Path(org.uberfire.java.nio.file.Path) WorkspaceCompilationInfo(org.kie.workbench.common.services.backend.compiler.impl.WorkspaceCompilationInfo) DefaultCompilationRequest(org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest) CompilationResponse(org.kie.workbench.common.services.backend.compiler.CompilationResponse) AFCompiler(org.kie.workbench.common.services.backend.compiler.AFCompiler) CompilationRequest(org.kie.workbench.common.services.backend.compiler.CompilationRequest) DefaultCompilationRequest(org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest) Test(org.junit.Test)

Example 38 with CompilationRequest

use of org.kie.workbench.common.services.backend.compiler.CompilationRequest in project kie-wb-common by kiegroup.

the class CompilerChronicleCoordinatorTest method offProcessOneBuildTest.

@Test
@Ignore("https://issues.redhat.com/browse/AF-2892")
public void offProcessOneBuildTest() {
    CompilerIPCCoordinator compiler = new CompilerIPCCoordinatorImpl(queueProvider);
    WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(prjPath);
    String uuid = UUID.randomUUID().toString();
    CompilationRequest req = new DefaultCompilationRequest(mavenRepo, info, new String[] { MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE, uuid);
    CompilationResponse res = compiler.compile(req);
    logger.info("offProcessOneBuildTest first build completed");
    assertThat(res).isNotNull();
    assertThat(res.isSuccessful()).isTrue();
    assertThat(res.getMavenOutput()).isNotEmpty();
    DefaultKieCompilationResponse kres = (DefaultKieCompilationResponse) res;
    assertThat(uuid).isEqualToIgnoringCase(kres.getRequestUUID());
}
Also used : DefaultKieCompilationResponse(org.kie.workbench.common.services.backend.compiler.impl.DefaultKieCompilationResponse) WorkspaceCompilationInfo(org.kie.workbench.common.services.backend.compiler.impl.WorkspaceCompilationInfo) DefaultCompilationRequest(org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest) CompilationResponse(org.kie.workbench.common.services.backend.compiler.CompilationResponse) DefaultKieCompilationResponse(org.kie.workbench.common.services.backend.compiler.impl.DefaultKieCompilationResponse) CompilationRequest(org.kie.workbench.common.services.backend.compiler.CompilationRequest) DefaultCompilationRequest(org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest) CompilerIPCCoordinatorImpl(org.kie.workbench.common.services.backend.compiler.offprocess.impl.CompilerIPCCoordinatorImpl) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 39 with CompilationRequest

use of org.kie.workbench.common.services.backend.compiler.CompilationRequest in project kie-wb-common by kiegroup.

the class CompilerChronicleCoordinatorTest method offProcessTwoBuildTest.

@Test
@Ignore("https://issues.redhat.com/browse/AF-2892")
public void offProcessTwoBuildTest() {
    CompilerIPCCoordinator compiler = new CompilerIPCCoordinatorImpl(queueProvider);
    WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(prjPath);
    // First Build
    String uuid = UUID.randomUUID().toString();
    CompilationRequest req = new DefaultCompilationRequest(mavenRepo, info, new String[] { MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE, uuid);
    CompilationResponse res = compiler.compile(req);
    logger.info("offProcessTwoBuildTest first build completed");
    assertThat(res).isNotNull();
    assertThat(res.isSuccessful()).isTrue();
    assertThat(res.getMavenOutput()).isNotEmpty();
    DefaultKieCompilationResponse kres = (DefaultKieCompilationResponse) res;
    assertThat(uuid).isEqualToIgnoringCase(kres.getRequestUUID());
    // Second Build
    String secondUuid = UUID.randomUUID().toString();
    DefaultCompilationRequest secondRequest = new DefaultCompilationRequest(mavenRepo, info, new String[] { MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE, secondUuid);
    CompilationResponse secondRes = compiler.compile(secondRequest);
    logger.info("offProcessTwoBuildTest second build completed");
    assertThat(secondRes).isNotNull();
    assertThat(secondRes.isSuccessful()).isTrue();
    DefaultKieCompilationResponse secondKres = (DefaultKieCompilationResponse) secondRes;
    assertThat(secondUuid).isEqualToIgnoringCase(secondKres.getRequestUUID());
}
Also used : DefaultKieCompilationResponse(org.kie.workbench.common.services.backend.compiler.impl.DefaultKieCompilationResponse) WorkspaceCompilationInfo(org.kie.workbench.common.services.backend.compiler.impl.WorkspaceCompilationInfo) DefaultCompilationRequest(org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest) CompilationResponse(org.kie.workbench.common.services.backend.compiler.CompilationResponse) DefaultKieCompilationResponse(org.kie.workbench.common.services.backend.compiler.impl.DefaultKieCompilationResponse) CompilationRequest(org.kie.workbench.common.services.backend.compiler.CompilationRequest) DefaultCompilationRequest(org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest) CompilerIPCCoordinatorImpl(org.kie.workbench.common.services.backend.compiler.offprocess.impl.CompilerIPCCoordinatorImpl) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 40 with CompilationRequest

use of org.kie.workbench.common.services.backend.compiler.CompilationRequest in project kie-wb-common by kiegroup.

the class CompilerOffProcessServiceTest method offProcessServiceCompileAsyncTest.

@Test
@Ignore("https://issues.redhat.com/browse/AF-2892")
public void offProcessServiceCompileAsyncTest() throws Exception {
    CompilerOffprocessService service = new CompilerOffprocessServiceImpl(executor, queueProvider);
    WorkspaceCompilationInfo info = new WorkspaceCompilationInfo(prjPath);
    String uuid = UUID.randomUUID().toString();
    CompilationRequest req = new DefaultCompilationRequest(mavenRepo, info, new String[] { MavenCLIArgs.COMPILE, MavenCLIArgs.ALTERNATE_USER_SETTINGS + alternateSettingsAbsPath }, Boolean.FALSE, uuid);
    CompletableFuture<KieCompilationResponse> futureRes = service.compile(req);
    logger.info("offProcessOneBuildAsyncTest build completed");
    KieCompilationResponse res = futureRes.get();
    assertThat(res).isNotNull();
    assertThat(res.isSuccessful()).isTrue();
    assertThat(res.getMavenOutput()).isNotEmpty();
    DefaultKieCompilationResponse kres = (DefaultKieCompilationResponse) res;
    assertThat(uuid).isEqualToIgnoringCase(kres.getRequestUUID());
}
Also used : DefaultKieCompilationResponse(org.kie.workbench.common.services.backend.compiler.impl.DefaultKieCompilationResponse) WorkspaceCompilationInfo(org.kie.workbench.common.services.backend.compiler.impl.WorkspaceCompilationInfo) DefaultCompilationRequest(org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest) CompilerOffprocessServiceImpl(org.kie.workbench.common.services.backend.compiler.offprocess.service.impl.CompilerOffprocessServiceImpl) CompilationRequest(org.kie.workbench.common.services.backend.compiler.CompilationRequest) DefaultCompilationRequest(org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest) KieCompilationResponse(org.kie.workbench.common.services.backend.compiler.impl.kie.KieCompilationResponse) DefaultKieCompilationResponse(org.kie.workbench.common.services.backend.compiler.impl.DefaultKieCompilationResponse) Ignore(org.junit.Ignore) CompilerChronicleCoordinatorTest(org.kie.workbench.common.services.backend.compiler.offprocess.CompilerChronicleCoordinatorTest) Test(org.junit.Test)

Aggregations

CompilationRequest (org.kie.workbench.common.services.backend.compiler.CompilationRequest)43 DefaultCompilationRequest (org.kie.workbench.common.services.backend.compiler.impl.DefaultCompilationRequest)43 Test (org.junit.Test)34 WorkspaceCompilationInfo (org.kie.workbench.common.services.backend.compiler.impl.WorkspaceCompilationInfo)30 AFCompiler (org.kie.workbench.common.services.backend.compiler.AFCompiler)24 CompilationResponse (org.kie.workbench.common.services.backend.compiler.CompilationResponse)23 Path (org.uberfire.java.nio.file.Path)19 BaseCompilerTest (org.kie.workbench.common.services.backend.compiler.BaseCompilerTest)16 BaseMavenCompiler (org.kie.workbench.common.services.backend.compiler.impl.BaseMavenCompiler)12 KieCompilationResponse (org.kie.workbench.common.services.backend.compiler.impl.kie.KieCompilationResponse)12 HashMap (java.util.HashMap)10 Ignore (org.junit.Ignore)10 File (java.io.File)9 JGitFileSystem (org.uberfire.java.nio.fs.jgit.JGitFileSystem)8 FileInputStream (java.io.FileInputStream)6 InputStream (java.io.InputStream)6 URI (java.net.URI)4 InternalKieModule (org.drools.compiler.kie.builder.impl.InternalKieModule)3 KieModuleMetaInfo (org.drools.core.rule.KieModuleMetaInfo)3 Git (org.eclipse.jgit.api.Git)3