use of org.kie.workbench.common.services.backend.compiler.impl.DefaultKieCompilationResponse in project kie-wb-common by kiegroup.
the class KieAfterDecorator method handleKieMavenPlugin.
private KieCompilationResponse handleKieMavenPlugin(CompilationRequest req, CompilationResponse res) {
KieTuple kieModuleMetaInfoTuple = readKieModuleMetaInfo(req);
KieTuple kieModuleTuple = readKieModule(req);
if (kieModuleMetaInfoTuple.getOptionalObject().isPresent() && kieModuleTuple.getOptionalObject().isPresent()) {
AFClassLoaderProvider provider = new ClassLoaderProviderImpl();
Optional<List<URI>> optionalDeps = provider.getURISFromAllDependencies(req.getInfo().getPrjPath().toAbsolutePath().toString());
List<URI> uris = Collections.emptyList();
if (optionalDeps.isPresent()) {
uris = optionalDeps.get();
}
if (req.getKieCliRequest().isLogRequested()) {
return new DefaultKieCompilationResponse(Boolean.TRUE, (KieModuleMetaInfo) kieModuleMetaInfoTuple.getOptionalObject().get(), (KieModule) kieModuleTuple.getOptionalObject().get(), res.getMavenOutput().get(), uris);
} else {
return new DefaultKieCompilationResponse(Boolean.TRUE, (KieModuleMetaInfo) kieModuleMetaInfoTuple.getOptionalObject().get(), (KieModule) kieModuleTuple.getOptionalObject().get(), uris);
}
} else {
StringBuilder sb = new StringBuilder();
if (kieModuleMetaInfoTuple.getErrorMsg().isPresent()) {
sb.append(" Error in the kieModuleMetaInfo from the kieMap:").append(kieModuleMetaInfoTuple.getErrorMsg().get());
}
if (kieModuleTuple.getErrorMsg().isPresent()) {
sb.append(" Error in the kieModule:").append(kieModuleTuple.getErrorMsg().get());
}
if (req.getKieCliRequest().isLogRequested()) {
return new DefaultKieCompilationResponse(Boolean.FALSE, sb.toString(), res.getMavenOutput().get());
} else {
return new DefaultKieCompilationResponse(Boolean.FALSE, sb.toString());
}
}
}
use of org.kie.workbench.common.services.backend.compiler.impl.DefaultKieCompilationResponse 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());
}
use of org.kie.workbench.common.services.backend.compiler.impl.DefaultKieCompilationResponse 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());
}
use of org.kie.workbench.common.services.backend.compiler.impl.DefaultKieCompilationResponse 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());
}
use of org.kie.workbench.common.services.backend.compiler.impl.DefaultKieCompilationResponse in project kie-wb-common by kiegroup.
the class ClientIPCImpl method isLoaded.
private boolean isLoaded(String uuid) {
ExcerptTailer tailer = provider.getQueue().createTailer();
DefaultKieCompilationResponseOffProcess res = readThisDocument(tailer);
DefaultKieCompilationResponse kres = new DefaultKieCompilationResponse(res);
if (uuid.equals(kres.getRequestUUID())) {
if (!map.contains(kres.getRequestUUID())) {
map.addResponse(uuid, kres);
return true;
}
} else {
// we loop in the queue to find our Response by UUID, from the tail of the queue backward
tailer.toEnd();
tailer.direction(TailerDirection.BACKWARD);
res = loopOverQueue(tailer, uuid, 0l);
}
kres = new DefaultKieCompilationResponse(res);
if (!map.contains(kres.getRequestUUID())) {
map.addResponse(uuid, new DefaultKieCompilationResponse(res));
return true;
} else {
return false;
}
}
Aggregations