Search in sources :

Example 11 with IncrementalBuildResults

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

the class ResourceChangeIncrementalBuilderWithoutFullBuildTest method testResourceDeleted.

@Test
public void testResourceDeleted() throws Exception {
    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/src/main/resources/delete.drl");
    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.deleteResource(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 12 with IncrementalBuildResults

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

the class BuildServiceHelperTest method testLocalBuildWithResourceChanges.

@Test
public void testLocalBuildWithResourceChanges() {
    BuildPipelineInvoker.LocalBuildRequest buildRequest = BuildPipelineInvoker.LocalBuildRequest.newIncrementalBuildRequest(module, resourceChanges);
    preparePipelineInvocation(buildRequest);
    when(localBinaryConfig.getIncrementalBuildResults()).thenReturn(incrementalBuildResults);
    IncrementalBuildResults result = serviceHelper.localBuild(module, resourceChanges);
    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) Test(org.junit.Test)

Example 13 with IncrementalBuildResults

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

the class BuildServiceImplTest method testAddPackageResource.

@Test
public void testAddPackageResource() {
    prepareIncrementalBuild(path, LocalBuildConfig.BuildType.INCREMENTAL_ADD_RESOURCE);
    IncrementalBuildResults result = buildService.addPackageResource(path);
    assertEquals(incrementalBuildResults, result);
    verifyIncrementalBuild(path, LocalBuildConfig.BuildType.INCREMENTAL_ADD_RESOURCE);
}
Also used : IncrementalBuildResults(org.guvnor.common.services.project.builder.model.IncrementalBuildResults) Test(org.junit.Test)

Example 14 with IncrementalBuildResults

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

the class BuildServiceImplTest method testUpdatePackageResource.

@Test
public void testUpdatePackageResource() {
    prepareIncrementalBuild(path, LocalBuildConfig.BuildType.INCREMENTAL_UPDATE_RESOURCE);
    IncrementalBuildResults result = buildService.updatePackageResource(path);
    assertEquals(incrementalBuildResults, result);
    verifyIncrementalBuild(path, LocalBuildConfig.BuildType.INCREMENTAL_UPDATE_RESOURCE);
}
Also used : IncrementalBuildResults(org.guvnor.common.services.project.builder.model.IncrementalBuildResults) Test(org.junit.Test)

Example 15 with IncrementalBuildResults

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

the class BuildServiceImplTest method testDeletePackageResource.

@Test
public void testDeletePackageResource() {
    prepareIncrementalBuild(path, LocalBuildConfig.BuildType.INCREMENTAL_DELETE_RESOURCE);
    IncrementalBuildResults result = buildService.deletePackageResource(path);
    assertEquals(incrementalBuildResults, result);
    verifyIncrementalBuild(path, LocalBuildConfig.BuildType.INCREMENTAL_DELETE_RESOURCE);
}
Also used : IncrementalBuildResults(org.guvnor.common.services.project.builder.model.IncrementalBuildResults) Test(org.junit.Test)

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