/** * @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; }
void start(final Object initialInput) { if (isStarted()) { throw new RuntimeException("Process has already been started."); } this.values.put("input", initialInput); if (initialInput instanceof Input) { executionId = ((Input) initialInput).computeIfAbsent(PIPELINE_EXECUTION_ID, generator -> ExecutionIdGenerator.generateExecutionId()); } else { executionId = ExecutionIdGenerator.generateExecutionId(); } if (iterator.hasNext()) { currentStage = Optional.of(iterator.next()); } else { currentStage = Optional.empty(); } lastOutput = Optional.of(initialInput); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PipelineExecutorTaskDefImpl taskDef = (PipelineExecutorTaskDefImpl) o; if (pipeline != null ? !pipeline.equals(taskDef.pipeline) : taskDef.pipeline != null) { return false; } if (stages != null ? !stages.equals(taskDef.stages) : taskDef.stages != null) { return false; } if (input != null ? !input.equals(taskDef.input) : taskDef.input != null) { return false; } if (providerId != null ? !providerId.equals(taskDef.providerId) : taskDef.providerId != null) { return false; } return providerType != null ? providerType.equals(taskDef.providerType) : taskDef.providerType == null; }
private void addResourceChanges(Input input, Map<Path, Collection<ResourceChange>> resourceChanges) { resourceChanges.entrySet().forEach(entry -> { input.put(encodeResourceChangePath(entry.getKey()), encodeResourceChanges(entry.getValue())); }); }
@Test public void testProvisioningUsingMaven() { final String gav = "org.jbpm:jbpm-wb-case-mgmt-showcase:war:1.0.0"; when(settings.isProvisioningEnabled()).thenReturn(true); when(settings.isDeployFromLocalPath()).thenReturn(false); when(settings.getGAV()).thenReturn(gav); service.init(); ArgumentCaptor<Input> captor = ArgumentCaptor.forClass(Input.class); verify(executor).execute(any(PipelineExecutor.class), any(Pipeline.class), captor.capture()); assertEquals(gav, captor.getValue().get("artifact")); }
@Override public int hashCode() { int result = pipeline != null ? pipeline.hashCode() : 0; result = 31 * result + (stages != null ? stages.hashCode() : 0); result = 31 * result + (input != null ? input.hashCode() : 0); result = 31 * result + (providerId != null ? providerId.hashCode() : 0); result = 31 * result + (providerType != null ? providerType.hashCode() : 0); return result; } }
private void setId(final String executionId) { this.executionId = executionId; getTaskDef().getInput().put(PIPELINE_EXECUTION_ID, executionId); }
@Test public void testProvisioningUsingWarPath() { final String path = "path/to/file.war"; when(settings.isProvisioningEnabled()).thenReturn(true); when(settings.isDeployFromLocalPath()).thenReturn(true); when(settings.getPath()).thenReturn(path); service.init(); ArgumentCaptor<Input> captor = ArgumentCaptor.forClass(Input.class); verify(executor).execute(any(PipelineExecutor.class), any(Pipeline.class), captor.capture()); assertEquals(path, captor.getValue().get("war-path")); }
@Override public int hashCode() { int result = pipeline != null ? pipeline.hashCode() : 0; result = 31 * result + (stages != null ? stages.hashCode() : 0); result = 31 * result + (input != null ? input.hashCode() : 0); result = 31 * result + (providerId != null ? providerId.hashCode() : 0); result = 31 * result + (providerType != null ? providerType.hashCode() : 0); return result; } }
/** * @return the Pipeline input for a full build and deploy. */ public static Input createFullBuildAndDeployInput( String rootPathUri, String deploymentType, boolean suppressHandlers ) { Input input = new Input( ); input.put( LocalSourceConfig.ROOT_PATH, rootPathUri ); input.put( LocalBuildConfig.BUILD_TYPE, LocalBuildConfig.BuildType.FULL_BUILD_AND_DEPLOY.name( ) ); input.put( LocalBuildConfig.DEPLOYMENT_TYPE, deploymentType ); input.put( LocalBuildConfig.SUPPRESS_HANDLERS, Boolean.toString( suppressHandlers ) ); return input; }
private void setId(final String executionId) { this.executionId = executionId; getTaskDef().getInput().put(PIPELINE_EXECUTION_ID, executionId); }
@Test public void testProvisioningUsingWarPath() { final String path = "path/to/file.war"; when(settings.isProvisioningEnabled()).thenReturn(true); when(settings.isDeployFromLocalPath()).thenReturn(true); when(settings.getPath()).thenReturn(path); service.init(); ArgumentCaptor<Input> captor = ArgumentCaptor.forClass(Input.class); verify(executor).execute(any(PipelineExecutor.class), any(Pipeline.class), captor.capture()); assertEquals(path, captor.getValue().get("war-path")); }
void start(final Object initialInput) { if (isStarted()) { throw new RuntimeException("Process has already been started."); } this.values.put("input", initialInput); if (initialInput instanceof Input) { executionId = ((Input) initialInput).computeIfAbsent(PIPELINE_EXECUTION_ID, generator -> ExecutionIdGenerator.generateExecutionId()); } else { executionId = ExecutionIdGenerator.generateExecutionId(); } if (iterator.hasNext()) { currentStage = Optional.of(iterator.next()); } else { currentStage = Optional.empty(); } lastOutput = Optional.of(initialInput); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PipelineExecutorTaskDefImpl taskDef = (PipelineExecutorTaskDefImpl) o; if (pipeline != null ? !pipeline.equals(taskDef.pipeline) : taskDef.pipeline != null) { return false; } if (stages != null ? !stages.equals(taskDef.stages) : taskDef.stages != null) { return false; } if (input != null ? !input.equals(taskDef.input) : taskDef.input != null) { return false; } if (providerId != null ? !providerId.equals(taskDef.providerId) : taskDef.providerId != null) { return false; } return providerType != null ? providerType.equals(taskDef.providerType) : taskDef.providerType == null; }
@Test public void testProvisioningUsingMaven() { final String gav = "org.jbpm:jbpm-wb-case-mgmt-showcase:war:1.0.0"; when(settings.isProvisioningEnabled()).thenReturn(true); when(settings.isDeployFromLocalPath()).thenReturn(false); when(settings.getGAV()).thenReturn(gav); service.init(); ArgumentCaptor<Input> captor = ArgumentCaptor.forClass(Input.class); verify(executor).execute(any(PipelineExecutor.class), any(Pipeline.class), captor.capture()); assertEquals(gav, captor.getValue().get("artifact")); }
/** * @return the Pipeline input for a project full build. */ public static Input createFullBuildInput( String rootPathUri ) { Input input = new Input(); input.put( LocalSourceConfig.ROOT_PATH, rootPathUri ); input.put( LocalBuildConfig.BUILD_TYPE, LocalBuildConfig.BuildType.FULL_BUILD.name( ) ); return input; }
@Test public void testBuild() { Input result = PipelineInputBuilder.newInstance() .withProvider(providerKey) .withParams(params) .withRuntimeName(RUNTIME).build(); assertNotNull(result); assertEquals(RUNTIME, result.get(RuntimeConfig.RUNTIME_NAME)); assertEquals(PROVIDER, result.get(ProviderConfig.PROVIDER_NAME)); params.forEach((name, value) -> assertEquals(value, result.get(name))); }