use of org.guvnor.ala.pipeline.Pipeline 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.Pipeline 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();
}
use of org.guvnor.ala.pipeline.Pipeline in project kie-wb-common by kiegroup.
the class WildflyExecutorTest method testAPI.
@Test
@InSequence(1)
public void testAPI() {
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("create-repo", "true");
put("branch", "master");
put("out-dir", tempPath.getAbsolutePath());
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();
}
use of org.guvnor.ala.pipeline.Pipeline in project kie-wb-common by kiegroup.
the class PipelineExecutorTraceImplMarshallerTest method getValue.
@Override
public PipelineExecutorTraceImpl getValue() {
// only the stage names are used by the taskDef, so the pipeline can be mocked.
List<Stage> stages = mockStages(STAGE_COUNT);
Pipeline pipeline = new BasePipeline(PIPELINE_NAME, stages) {
};
Input input = mockInput(PIPELINE_INPUT_SIZE);
PipelineExecutorTaskDefImpl taskDef = new PipelineExecutorTaskDefImpl(pipeline, input);
PipelineExecutorTaskImpl taskImpl = new PipelineExecutorTaskImpl(taskDef, PIPELINE_EXECUTION_ID);
taskImpl.setPipelineStatus(PipelineExecutorTask.Status.SCHEDULED);
taskImpl.setPipelineError(mockError(PIPELINE_ERROR, PIPELINE_ERROR_DETAIL));
taskImpl.getTaskDef().getStages().forEach(stage -> taskImpl.setStageError(stage, mockStageError(stage)));
taskImpl.setOutput(new MockPipelineOutput(PIPELINE_OUTPUT));
return new PipelineExecutorTraceImpl(taskImpl);
}
use of org.guvnor.ala.pipeline.Pipeline in project kie-wb-common by kiegroup.
the class InMemoryPipelineRegistryTest method getPipelinesForProvider.
@Test
public void getPipelinesForProvider() {
ProviderType providerType1 = mockProviderTypeSPI("providerType1");
ProviderType providerType2 = mockProviderTypeSPI("providerType2");
List<Pipeline> result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true);
assertTrue(result.isEmpty());
// register pipelines for providerType, providerType1, and providerType2
List<Pipeline> pipelines = mockPipelineList("providerType", ELEMENTS_COUNT);
registerPipelinesForProviderType(pipelines, providerType);
registerPipelinesForProviderType(mockPipelineList("providerType1", ELEMENTS_COUNT), providerType1);
registerPipelinesForProviderType(mockPipelineList("providerType2", ELEMENTS_COUNT), providerType2);
result = pipelineRegistry.getPipelines(0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true);
assertEquals(3 * ELEMENTS_COUNT, result.size());
result = pipelineRegistry.getPipelines(providerType.getProviderTypeName(), providerType.getVersion(), 0, 1000, PipelineRegistry.PIPELINE_NAME_SORT, true);
assertEquals(pipelines.size(), result.size());
for (Pipeline pipeline : result) {
assertTrue(result.contains(pipeline));
}
}
Aggregations