Search in sources :

Example 1 with BuildMessage

use of org.guvnor.common.services.project.builder.model.BuildMessage in project kie-wb-common by kiegroup.

the class BuildHelper method buildExceptionResults.

/**
 * When an exception is produced by the builder service, this method is uses to generate an instance of
 * <code>org.guvnor.common.services.project.builder.model.BuildResults</code> in generated with the exception details.
 * @param e The error exception.
 * @param gav
 * @return An instance of BuildResults with the exception details.
 */
public BuildResults buildExceptionResults(Exception e, GAV gav) {
    BuildResults exceptionResults = new BuildResults(gav);
    BuildMessage exceptionMessage = new BuildMessage();
    exceptionMessage.setLevel(Level.ERROR);
    exceptionMessage.setText(e.getMessage());
    exceptionResults.addBuildMessage(exceptionMessage);
    return exceptionResults;
}
Also used : BuildMessage(org.guvnor.common.services.project.builder.model.BuildMessage) IncrementalBuildResults(org.guvnor.common.services.project.builder.model.IncrementalBuildResults) BuildResults(org.guvnor.common.services.project.builder.model.BuildResults)

Example 2 with BuildMessage

use of org.guvnor.common.services.project.builder.model.BuildMessage in project kie-wb-common by kiegroup.

the class BuildMessageBuilder method makeWarningMessage.

static BuildMessage makeWarningMessage(final String prefix) {
    final BuildMessage buildMessage = new BuildMessage();
    buildMessage.setLevel(Level.WARNING);
    buildMessage.setText(prefix);
    return buildMessage;
}
Also used : BuildMessage(org.guvnor.common.services.project.builder.model.BuildMessage)

Example 3 with BuildMessage

use of org.guvnor.common.services.project.builder.model.BuildMessage in project kie-wb-common by kiegroup.

the class MessageConverter method convertValidationMessage.

static BuildMessage convertValidationMessage(final ValidationMessage message) {
    final BuildMessage m = new BuildMessage();
    m.setLevel(message.getLevel());
    m.setId(message.getId());
    m.setLine(message.getLine());
    m.setColumn(message.getColumn());
    m.setText(message.getText());
    m.setPath(message.getPath());
    return m;
}
Also used : BuildMessage(org.guvnor.common.services.project.builder.model.BuildMessage)

Example 4 with BuildMessage

use of org.guvnor.common.services.project.builder.model.BuildMessage in project kie-wb-common by kiegroup.

the class MessageConverterTest method checkMessageWithKieBase.

@Test
public void checkMessageWithKieBase() {
    final MessageImpl m = new MessageImpl(ID, Message.Level.ERROR, FILE, TEXT);
    m.setKieBaseName(KIE_BASE_NAME);
    final BuildMessage bm = MessageConverter.convertMessage(m, handles);
    assertConversion(bm, () -> "[KBase: " + KIE_BASE_NAME + "]: " + TEXT);
}
Also used : BuildMessage(org.guvnor.common.services.project.builder.model.BuildMessage) MessageImpl(org.drools.compiler.kie.builder.impl.MessageImpl) Test(org.junit.Test)

Example 5 with BuildMessage

use of org.guvnor.common.services.project.builder.model.BuildMessage in project kie-wb-common by kiegroup.

the class BuildExecutorTest method testBuildAndDeployCommandFail.

@Test
public void testBuildAndDeployCommandFail() {
    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.buildAndDeploy(any(KieModule.class), any(DeploymentMode.class))).thenReturn(results);
    buildExecutor.triggerBuildAndDeploy();
    verifyNotification(ProjectEditorResources.CONSTANTS.BuildFailed(), NotificationEvent.NotificationType.ERROR);
    verifyBusyShowHideAnyString(1, 1, ProjectEditorResources.CONSTANTS.Building());
}
Also used : BuildMessage(org.guvnor.common.services.project.builder.model.BuildMessage) BuildResults(org.guvnor.common.services.project.builder.model.BuildResults) ArrayList(java.util.ArrayList) DeploymentMode(org.guvnor.common.services.project.service.DeploymentMode) KieModule(org.kie.workbench.common.services.shared.project.KieModule) Test(org.junit.Test)

Aggregations

BuildMessage (org.guvnor.common.services.project.builder.model.BuildMessage)15 Test (org.junit.Test)9 BuildResults (org.guvnor.common.services.project.builder.model.BuildResults)8 URL (java.net.URL)4 Module (org.guvnor.common.services.project.model.Module)4 SimpleFileSystemProvider (org.uberfire.java.nio.fs.file.SimpleFileSystemProvider)4 ArrayList (java.util.ArrayList)2 MessageImpl (org.drools.compiler.kie.builder.impl.MessageImpl)2 IncrementalBuildResults (org.guvnor.common.services.project.builder.model.IncrementalBuildResults)2 KieModule (org.kie.workbench.common.services.shared.project.KieModule)2 HashSet (java.util.HashSet)1 ContextNotActiveException (javax.enterprise.context.ContextNotActiveException)1 TypeMetaInfo (org.drools.core.rule.TypeMetaInfo)1 DeploymentMode (org.guvnor.common.services.project.service.DeploymentMode)1 Message (org.kie.api.builder.Message)1 KieModuleMetaData (org.kie.scanner.KieModuleMetaData)1 WhiteList (org.kie.workbench.common.services.shared.whitelist.WhiteList)1