use of org.guvnor.common.services.project.builder.model.IncrementalBuildResults in project kie-wb-common by kiegroup.
the class BuildPipelineTest method testIncrementalBuildResourceChangesExecution.
@Test
public void testIncrementalBuildResourceChangesExecution() {
when(buildHelper.applyBatchResourceChanges(eq(module), any(Map.class))).thenReturn(incrementalBuildResults);
// prepare the pipeline input.
Input input = createBatchChangesInput(ROOT_PATH_URI, LocalBuildConfig.BuildType.INCREMENTAL_BATCH_CHANGES.name(), changes);
// execute the pipeline and verify the result.
pipelineInitializer.getExecutor().execute(input, pipe, (Consumer<LocalBinaryConfig>) localBinaryConfig -> {
assertEquals(incrementalBuildResults, localBinaryConfig.getIncrementalBuildResults());
}, pipelineEventListener);
// verify that all stages were properly invoked.
verifyLocalSourceConfigWasInvoked();
verifyLocalProjectConfigWasInvoked();
verifyLocalBuildConfigExecutorWasInvoked(module, changes);
verifyLocalBuildExecConfigExecutorWasInvoked(module, changes);
// verify the pipeline events where properly raised.
verifyPipelineEvents();
}
use of org.guvnor.common.services.project.builder.model.IncrementalBuildResults in project kie-wb-common by kiegroup.
the class ResourceChangeIncrementalBuilderTest method testResourceAdded.
@Test
public void testResourceAdded() throws Exception {
final URL resourceUrl = this.getClass().getResource("/BuildChangeListenerRepo/src/main/resources/add.drl");
final org.uberfire.java.nio.file.Path nioResourcePath = fs.getPath(resourceUrl.toURI());
final Path resourcePath = paths.convert(nioResourcePath);
// Force full build before attempting incremental changes
final KieModule module = moduleService.resolveModule(resourcePath);
final BuildResults buildResults = buildService.build(module);
assertNotNull(buildResults);
assertEquals(0, buildResults.getErrorMessages().size());
assertEquals(1, buildResults.getInformationMessages().size());
// Perform incremental build
buildChangeListener.addResource(resourcePath);
waitForIncrementalBuildResults(buildResultsObserver);
final IncrementalBuildResults incrementalBuildResults = buildResultsObserver.getIncrementalBuildResults();
assertNotNull(incrementalBuildResults);
assertEquals(0, incrementalBuildResults.getAddedMessages().size());
assertEquals(0, incrementalBuildResults.getRemovedMessages().size());
}
use of org.guvnor.common.services.project.builder.model.IncrementalBuildResults in project kie-wb-common by kiegroup.
the class ResourceChangeIncrementalBuilderTest method testResourceUpdated.
@Test
public void testResourceUpdated() throws Exception {
final URL resourceUrl = this.getClass().getResource("/BuildChangeListenerRepo/src/main/resources/update.drl");
final org.uberfire.java.nio.file.Path nioResourcePath = fs.getPath(resourceUrl.toURI());
final Path resourcePath = paths.convert(nioResourcePath);
// Force full build before attempting incremental changes
final KieModule module = moduleService.resolveModule(resourcePath);
final BuildResults buildResults = buildService.build(module);
assertNotNull(buildResults);
assertEquals(0, buildResults.getErrorMessages().size());
assertEquals(1, buildResults.getInformationMessages().size());
// Perform incremental build
buildChangeListener.updateResource(resourcePath);
waitForIncrementalBuildResults(buildResultsObserver);
final IncrementalBuildResults incrementalBuildResults = buildResultsObserver.getIncrementalBuildResults();
assertNotNull(incrementalBuildResults);
assertEquals(0, incrementalBuildResults.getAddedMessages().size());
assertEquals(0, incrementalBuildResults.getRemovedMessages().size());
}
use of org.guvnor.common.services.project.builder.model.IncrementalBuildResults in project kie-wb-common by kiegroup.
the class ResourceChangeIncrementalBuilderWithoutFullBuildTest method testNonPackageResourceUpdated.
@Test
public void testNonPackageResourceUpdated() throws Exception {
// This tests changes to a resource that is neither pom.xml nor kmodule.xml nor within a Package
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/project.imports");
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);
final BuildResults buildResults = buildResultsObserver.getBuildResults();
assertNull(buildResults);
final IncrementalBuildResults incrementalBuildResults = buildResultsObserver.getIncrementalBuildResults();
assertNull(incrementalBuildResults);
}
use of org.guvnor.common.services.project.builder.model.IncrementalBuildResults in project kie-wb-common by kiegroup.
the class ResourceChangeIncrementalBuilderWithoutFullBuildTest method testResourceUpdated.
@Test
public void testResourceUpdated() 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/update.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.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);
}
Aggregations