/*
 * Copyright 2016 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.cloud.dataflow.module.deployer.cloudfoundry;

import org.junit.ClassRule;

import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.dataflow.module.deployer.test.AbstractModuleDeployerTests;

/**
 * Runs integration tests for {@link ApplicationModuleDeployer}, using the production configuration,
 * that may be configured via {@link CloudFoundryModuleDeployerProperties}.
 *
 * Tests are only run if a successful connection can be made at startup.
 *
 * @author Eric Bottard
 */
@SpringApplicationConfiguration(classes = CloudFoundryModuleDeployerConfiguration.class)
@IntegrationTest("localRepository=fff")
public class ApplicationModuleDeployerTests extends AbstractModuleDeployerTests {

	@ClassRule
	public static CloudFoundryTestSupport cfAvailable = new CloudFoundryTestSupport();

}

@@ -698,24 +698,50 @@
 foundry;%0D%0A%0D%0A
+import org.junit.Before;%0D%0A
 import org.j
@@ -757,16 +757,16 @@
 sRule;%0D%0A
-
 %0D%0Aimport
@@ -1385,31 +1385,8 @@
 Test
-(%22localRepository=fff%22)
 %0D%0Apu
@@ -1468,16 +1468,1027 @@
 ts %7B%0D%0A%0D%0A
+%0D%0A%09/**%0D%0A%09 * Execution environments may override this default value to have tests wait longer for a deployment, for example if%0D%0A%09 * running in an environment that is known to be slow.%0D%0A%09 */%0D%0A%09protected double timeoutMultiplier = 1.0D;%0D%0A%0D%0A%09@Before%0D%0A%09public void init() %7B%0D%0A%09%09String multiplier = System.getenv(%22CF_DEPLOYER_TIMEOUT_MULTIPLIER%22);%0D%0A%09%09if (multiplier != null) %7B%0D%0A%09%09%09timeoutMultiplier = Double.parseDouble(multiplier);%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%0D%0A%0D%0A%09/**%0D%0A%09 * Return the timeout to use for repeatedly querying a module while it is being deployed.%0D%0A%09 * Default value is one minute, being queried every 5 seconds.%0D%0A%09 */%0D%0A%09protected Attempts deploymentTimeout() %7B%0D%0A%09%09return new Attempts(12, (int) (5000 * timeoutMultiplier));%0D%0A%09%7D%0D%0A%0D%0A%09/**%0D%0A%09 * Return the timeout to use for repeatedly querying a module while it is being un-deployed.%0D%0A%09 * Default value is one minute, being queried every 5 seconds.%0D%0A%09 */%0D%0A%09protected Attempts undeploymentTimeout() %7B%0D%0A%09%09return new Attempts(20, (int) (5000 * timeoutMultiplier));%0D%0A%09%7D%0D%0A%0D%0A%0D%0A%0D%0A%0D%0A
 %09@ClassR

Allow per-environment customization of test timeouts