use of org.guvnor.ala.pipeline.Input in project kie-wb-common by kiegroup.
the class BuildPipelineInvoker method invokeLocalBuildPipeLine.
/**
* Invokes the local build pipeline.
* @param buildRequest the buildRequest configures the build to perform.
* @param consumer a consumer for getting the pipeline output.
*/
public void invokeLocalBuildPipeLine(LocalBuildRequest buildRequest, Consumer<LocalBinaryConfig> consumer) {
Pipeline pipe = pipelineRegistry.getPipelineByName(BuildPipelineInitializer.LOCAL_BUILD_PIPELINE);
Input input = new Input() {
{
put(LocalSourceConfig.ROOT_PATH, buildRequest.getModule().getRootPath().toURI());
put(LocalBuildConfig.BUILD_TYPE, buildRequest.getBuildType().name());
if (buildRequest.isSingleResource()) {
put(LocalBuildConfig.RESOURCE, encodePath(buildRequest.getResource()));
} else {
addResourceChanges(this, buildRequest.getResourceChanges());
}
if (buildRequest.getDeploymentType() != null) {
put(LocalBuildConfig.DEPLOYMENT_TYPE, buildRequest.getDeploymentType().name());
put(LocalBuildConfig.SUPPRESS_HANDLERS, Boolean.toString(buildRequest.isSuppressHandlers()));
}
}
};
executor.execute(input, pipe, consumer);
}
use of org.guvnor.ala.pipeline.Input 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.ala.pipeline.Input in project kie-wb-common by kiegroup.
the class BuildPipelineTestBase method createBatchChangesInput.
/**
* @return the Pipeline input for a set of batch changes.
*/
public static Input createBatchChangesInput(String rootPathUri, String buildType, ResourceChangeRequest... changes) {
Input input = new Input();
input.put(LocalSourceConfig.ROOT_PATH, rootPathUri);
input.put(LocalBuildConfig.BUILD_TYPE, buildType);
for (ResourceChangeRequest change : changes) {
input.put(LocalBuildConfig.RESOURCE_CHANGE + change.getUri(), change.getChanges());
}
return input;
}
use of org.guvnor.ala.pipeline.Input in project kie-wb-common by kiegroup.
the class BuildPipelineTestBase method createIncrementalBuildInput.
/**
* @return the Pipeline input for an incremental build for one resource.
*/
public static Input createIncrementalBuildInput(String rootPathUri, String resourceUri, String buildType) {
Input input = new Input();
input.put(LocalSourceConfig.ROOT_PATH, rootPathUri);
input.put(LocalBuildConfig.RESOURCE, resourceUri);
input.put(LocalBuildConfig.BUILD_TYPE, buildType);
return input;
}
use of org.guvnor.ala.pipeline.Input in project kie-wb-common by kiegroup.
the class WildflyExecutorTest method testRedeploy.
@Test
@InSequence(2)
public void testRedeploy() {
final SourceRegistry sourceRegistry = new InMemorySourceRegistry();
final BuildRegistry buildRegistry = new InMemoryBuildRegistry();
final InMemoryRuntimeRegistry runtimeRegistry = new InMemoryRuntimeRegistry();
final WildflyAccessInterface wildflyAccessInterface = new WildflyAccessInterfaceImpl();
final Pipeline pipe = PipelineFactory.newBuilder().addConfigStage("Git Source", new GitConfig() {
}).addConfigStage("Maven Project", new MavenProjectConfig() {
}).addConfigStage("Maven Build Config", new MavenBuildConfig() {
}).addConfigStage("Maven Build", new MavenBuildExecConfig() {
}).addConfigStage("Wildfly Provider Config", new WildflyProviderConfig() {
}).addConfigStage("Wildfly Runtime Exec", new ContextAwareWildflyRuntimeExecConfig()).buildAs("my pipe");
WildflyRuntimeExecExecutor wildflyRuntimeExecExecutor = new WildflyRuntimeExecExecutor(runtimeRegistry, wildflyAccessInterface);
final PipelineExecutor executor = new PipelineExecutor(asList(new GitConfigExecutor(sourceRegistry), new MavenProjectConfigExecutor(sourceRegistry), new MavenBuildConfigExecutor(), new MavenBuildExecConfigExecutor(buildRegistry), new WildflyProviderConfigExecutor(runtimeRegistry), wildflyRuntimeExecExecutor));
executor.execute(new Input() {
{
put("repo-name", "drools-workshop");
put("branch", "master");
put("origin", gitUrl);
put("provider-name", "wildlfy-test");
put("wildfly-user", "admin");
put("wildfly-password", "Admin#70365");
put("host", ip);
put("port", "8080");
put("management-port", "9990");
}
}, pipe, System.out::println);
List<Runtime> allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
assertEquals(1, allRuntimes.size());
Runtime runtime = allRuntimes.get(0);
assertTrue(runtime instanceof WildflyRuntime);
WildflyRuntime wildflyRuntime = (WildflyRuntime) runtime;
WildflyRuntimeManager runtimeManager = new WildflyRuntimeManager(runtimeRegistry, wildflyAccessInterface);
runtimeManager.start(wildflyRuntime);
allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
assertEquals(1, allRuntimes.size());
runtime = allRuntimes.get(0);
assertTrue(runtime instanceof WildflyRuntime);
wildflyRuntime = (WildflyRuntime) runtime;
assertEquals(RUNNING, wildflyRuntime.getState().getState());
runtimeManager.stop(wildflyRuntime);
allRuntimes = runtimeRegistry.getRuntimes(0, 10, "", true);
assertEquals(1, allRuntimes.size());
runtime = allRuntimes.get(0);
assertTrue(runtime instanceof WildflyRuntime);
wildflyRuntime = (WildflyRuntime) runtime;
assertEquals(STOPPED, wildflyRuntime.getState().getState());
wildflyRuntimeExecExecutor.destroy(wildflyRuntime);
wildflyAccessInterface.dispose();
}
Aggregations