use of org.guvnor.common.services.project.builder.model.BuildMessage in project kie-wb-common by kiegroup.
the class BuildExecutorTest method testBuildCommandFail.
@Test
public void testBuildCommandFail() {
BuildMessage message = mock(BuildMessage.class);
List<BuildMessage> messages = new ArrayList<>();
messages.add(message);
BuildResults results = mock(BuildResults.class);
when(results.getErrorMessages()).thenReturn(messages);
when(buildServiceMock.build(any(KieModule.class))).thenReturn(results);
buildExecutor.triggerBuild();
verifyNotification(ProjectEditorResources.CONSTANTS.BuildFailed(), NotificationEvent.NotificationType.ERROR);
verifyBusyShowHideAnyString(1, 1, ProjectEditorResources.CONSTANTS.Building());
}
use of org.guvnor.common.services.project.builder.model.BuildMessage in project kie-wb-common by kiegroup.
the class BuildHelper method build.
public BuildResult build(final Module module) {
try {
cache.invalidateCache(module);
Builder builder = cache.assertBuilder(module);
final BuildResults results = builder.build();
BuildMessage infoMsg = new BuildMessage();
infoMsg.setLevel(Level.INFO);
infoMsg.setText(buildResultMessage(module, results).toString());
results.addBuildMessage(0, infoMsg);
return new BuildResult(builder, results);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new BuildResult(null, buildExceptionResults(e, module.getPom().getGav()));
}
}
use of org.guvnor.common.services.project.builder.model.BuildMessage in project kie-wb-common by kiegroup.
the class BuildMessageBuilder method makeErrorMessage.
static BuildMessage makeErrorMessage(final String prefix) {
final BuildMessage buildMessage = new BuildMessage();
buildMessage.setLevel(Level.ERROR);
buildMessage.setText(prefix);
return buildMessage;
}
use of org.guvnor.common.services.project.builder.model.BuildMessage in project kie-wb-common by kiegroup.
the class MessageConverter method convertMessage.
static BuildMessage convertMessage(final Message message, Handles handles) {
final BuildMessage m = new BuildMessage();
switch(message.getLevel()) {
case ERROR:
m.setLevel(Level.ERROR);
break;
case WARNING:
m.setLevel(Level.WARNING);
break;
case INFO:
m.setLevel(Level.INFO);
break;
}
m.setId(message.getId());
m.setLine(message.getLine());
m.setPath(convertPath(message.getPath(), handles));
m.setColumn(message.getColumn());
m.setText(convertMessageText(message));
return m;
}
use of org.guvnor.common.services.project.builder.model.BuildMessage in project kie-wb-common by kiegroup.
the class BuilderTest method testBuilderKModuleHasSnapshotDependency.
@Test
public void testBuilderKModuleHasSnapshotDependency() throws Exception {
URL url = this.getClass().getResource("/GuvnorM2RepoDependencyExample2Snapshot");
SimpleFileSystemProvider p = new SimpleFileSystemProvider();
org.uberfire.java.nio.file.Path path = p.getPath(url.toURI());
final Module module = moduleService.resolveModule(Paths.convert(path));
final Builder builder = new Builder(module, ioService, moduleService, importsService, new ArrayList<>(), dependenciesClassLoaderCache, pomModelCache, getPackageNameWhiteListService(), alwaysTrue);
final BuildResults results = builder.build();
// Debug output
if (!results.getMessages().isEmpty()) {
for (BuildMessage m : results.getMessages()) {
logger.debug(m.getText());
}
}
assertTrue(results.getMessages().isEmpty());
}
Aggregations