Java Code Examples for org.springframework.cloud.deployer.spi.core.AppDeploymentRequest#getCommandlineArguments()

The following examples show how to use org.springframework.cloud.deployer.spi.core.AppDeploymentRequest#getCommandlineArguments() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultTaskExecutionServiceTests.java    From spring-cloud-dataflow with Apache License 2.0 6 votes vote down vote up
@Test
@DirtiesContext
public void executeComposedTaskWithAccessTokenOverrideAsProperty() {
	initializeSuccessfulRegistry(appRegistry);

	Map<String, String> properties = prepareEnvironmentForTokenTests(this.taskSaveService,
			this.taskLauncher, this.appRegistry);
	properties.put("app.composed-task-runner.dataflow-server-access-token", "foo-bar-123-token-override");

	AppDeploymentRequest request = getAppDeploymentRequestForToken(properties, Collections.emptyList(),
			this.taskExecutionService, this.taskLauncher);

	assertTrue("Should contain the property 'dataflow-server-access-token'",
		request.getDefinition().getProperties().containsKey("dataflow-server-access-token"));

	boolean containsArgument = false;
	for (String argument : request.getCommandlineArguments()) {
		if (argument.contains("--dataflow-server-access-token")) {
			containsArgument = true;
		}
	}

	assertFalse("Should not contain the argument 'dataflow-server-access-token'", containsArgument);
	assertEquals("foo-bar-123-token-override", request.getDefinition().getProperties().get("dataflow-server-access-token"));
}
 
Example 2
Source File: AbstractLocalDeployerSupport.java    From spring-cloud-deployer-local with Apache License 2.0 5 votes vote down vote up
protected Integer isServerPortKeyPresentOnArgs(AppDeploymentRequest request) {
	Integer result = null;

	for (String argument : request.getCommandlineArguments()) {
		if (argument.startsWith(SERVER_PORT_KEY_COMMAND_LINE_ARG)) {
			result = Integer.parseInt(argument.replace(SERVER_PORT_KEY_COMMAND_LINE_ARG, "").trim());
			break;
		}
	}

	return result;
}
 
Example 3
Source File: DefaultTaskExecutionServiceTests.java    From spring-cloud-dataflow with Apache License 2.0 5 votes vote down vote up
@Test
@DirtiesContext
public void executeComposedTaskWithAccessTokenOverrideAsArgument() {
	initializeSuccessfulRegistry(appRegistry);

	List<String> args = Collections.singletonList("--dataflow-server-access-token=foo-bar-123-token-override");

	AppDeploymentRequest request = getAppDeploymentRequestForToken(prepareEnvironmentForTokenTests(this.taskSaveService,
			this.taskLauncher, this.appRegistry), args,  this.taskExecutionService,
			this.taskLauncher);

	assertFalse("Should not contain the property 'dataflow-server-access-token'",
		request.getDefinition().getProperties().containsKey("dataflow-server-access-token"));

	boolean containsArgument = false;
	String argumentValue = null;
	for (String argument : request.getCommandlineArguments()) {
		if (argument.contains("--dataflow-server-access-token")) {
			containsArgument = true;
			argumentValue = argument;
		}
	}
	assertFalse("Should not contain the property 'dataflow-server-access-token'",
			request.getCommandlineArguments().contains("dataflow-server-access-token"));
	assertTrue("Should contain the argument 'dataflow-server-access-token'", containsArgument);
	assertEquals("--dataflow-server-access-token=foo-bar-123-token-override", argumentValue);
}
 
Example 4
Source File: TaskConfiguration.java    From spring-cloud-task with Apache License 2.0 5 votes vote down vote up
@Override
public String launch(AppDeploymentRequest request) {
	this.state = LaunchState.complete;
	this.commandlineArguments = request.getCommandlineArguments();
	this.applicationName = request.getDefinition().getName();
	return null;
}
 
Example 5
Source File: CfEnvAwareAppDeploymentRequest.java    From spring-cloud-deployer-cloudfoundry with Apache License 2.0 4 votes vote down vote up
private CfEnvAwareAppDeploymentRequest(AppDeploymentRequest appDeploymentRequest) {
	super(appDeploymentRequest.getDefinition(),
			CfEnvAwareResource.of(appDeploymentRequest.getResource()),
			appDeploymentRequest.getDeploymentProperties(),
			appDeploymentRequest.getCommandlineArguments());
}