Search in sources :

Example 26 with IncrementalBuildResults

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

the class ResourceChangeIncrementalBuilderWithoutFullBuildTest method testPomResourceUpdated.

@Test
public void testPomResourceUpdated() throws Exception {
    // This tests changes pom.xml
    final Bean buildChangeListenerBean = (Bean) beanManager.getBeans(org.guvnor.common.services.builder.ResourceChangeIncrementalBuilder.class).iterator().next();
    final CreationalContext cc = beanManager.createCreationalContext(buildChangeListenerBean);
    final org.guvnor.common.services.builder.ResourceChangeIncrementalBuilder buildChangeListener = (org.guvnor.common.services.builder.ResourceChangeIncrementalBuilder) beanManager.getReference(buildChangeListenerBean, org.guvnor.common.services.builder.ResourceChangeIncrementalBuilder.class, cc);
    final URL resourceUrl = this.getClass().getResource("/BuildChangeListenerRepo/pom.xml");
    final org.uberfire.java.nio.file.Path nioResourcePath = fs.getPath(resourceUrl.toURI());
    final Path resourcePath = paths.convert(nioResourcePath);
    // Perform incremental build (Without a full Build first)
    buildChangeListener.updateResource(resourcePath);
    waitForBuildResults(buildResultsObserver);
    final BuildResults buildResults = buildResultsObserver.getBuildResults();
    assertNotNull(buildResults);
    assertEquals(0, buildResults.getErrorMessages().size());
    assertEquals(1, buildResults.getInformationMessages().size());
    final IncrementalBuildResults incrementalBuildResults = buildResultsObserver.getIncrementalBuildResults();
    assertNull(incrementalBuildResults);
}
Also used : Path(org.uberfire.backend.vfs.Path) IncrementalBuildResults(org.guvnor.common.services.project.builder.model.IncrementalBuildResults) BuildResults(org.guvnor.common.services.project.builder.model.BuildResults) IncrementalBuildResults(org.guvnor.common.services.project.builder.model.IncrementalBuildResults) URL(java.net.URL) Bean(javax.enterprise.inject.spi.Bean) CreationalContext(javax.enterprise.context.spi.CreationalContext) Test(org.junit.Test)

Example 27 with IncrementalBuildResults

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

the class BuildServiceHelperTest method testLocalBuildWithResource.

private void testLocalBuildWithResource(Module module, LocalBuildConfig.BuildType buildType, Path resource) {
    BuildPipelineInvoker.LocalBuildRequest buildRequest = BuildPipelineInvoker.LocalBuildRequest.newIncrementalBuildRequest(module, buildType, resource);
    preparePipelineInvocation(buildRequest);
    when(localBinaryConfig.getIncrementalBuildResults()).thenReturn(incrementalBuildResults);
    IncrementalBuildResults result = serviceHelper.localBuild(module, buildType, resource);
    assertEquals(incrementalBuildResults, result);
    verify(pipelineInvoker, times(1)).invokeLocalBuildPipeLine(eq(buildRequest), any(Consumer.class));
}
Also used : IncrementalBuildResults(org.guvnor.common.services.project.builder.model.IncrementalBuildResults) Consumer(java.util.function.Consumer) BuildPipelineInvoker(org.kie.workbench.common.services.backend.builder.ala.BuildPipelineInvoker)

Aggregations

IncrementalBuildResults (org.guvnor.common.services.project.builder.model.IncrementalBuildResults)27 Test (org.junit.Test)19 BuildResults (org.guvnor.common.services.project.builder.model.BuildResults)14 Path (org.uberfire.backend.vfs.Path)14 URL (java.net.URL)12 KieModule (org.kie.workbench.common.services.shared.project.KieModule)11 CreationalContext (javax.enterprise.context.spi.CreationalContext)6 Bean (javax.enterprise.inject.spi.Bean)6 Collection (java.util.Collection)5 ResourceChange (org.uberfire.workbench.events.ResourceChange)5 Consumer (java.util.function.Consumer)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 ContextNotActiveException (javax.enterprise.context.ContextNotActiveException)3 InternalKieModule (org.drools.compiler.kie.builder.impl.InternalKieModule)3 Builder (org.kie.workbench.common.services.backend.builder.core.Builder)3 List (java.util.List)2 ConfigExecutor (org.guvnor.ala.pipeline.ConfigExecutor)2 Input (org.guvnor.ala.pipeline.Input)2