Modify poll interval assertion in DeployerPartitionHandlerTests

- Greater than 20s poll interval check in the assertion might as well needs to be equal to 20s interval as the test could finish before the next second
This commit is contained in:
Ilayaperumal Gopinathan
2016-04-08 12:46:29 +05:30
committed by Michael Minella
parent d810601708
commit 9a073631f1
2 changed files with 9 additions and 9 deletions

View File

@@ -190,7 +190,7 @@ public class DeployerPartitionHandler implements PartitionHandler, EnvironmentAw
final Set<StepExecution> executed = new HashSet<>(candidates.size());
if(CollectionUtils.isEmpty(candidates)) {
if (CollectionUtils.isEmpty(candidates)) {
return null;
}
@@ -203,7 +203,7 @@ public class DeployerPartitionHandler implements PartitionHandler, EnvironmentAw
private void launchWorkers(Set<StepExecution> candidates, Set<StepExecution> executed) {
for (StepExecution execution : candidates) {
if(this.currentWorkers < this.maxWorkers || this.maxWorkers < 0) {
if (this.currentWorkers < this.maxWorkers || this.maxWorkers < 0) {
launchWorker(execution);
this.currentWorkers++;
@@ -271,7 +271,7 @@ public class DeployerPartitionHandler implements PartitionHandler, EnvironmentAw
executed.addAll(newExecuted);
if(result.size() == size) {
if (result.size() == size) {
return result;
}
else {
@@ -283,7 +283,7 @@ public class DeployerPartitionHandler implements PartitionHandler, EnvironmentAw
Poller<Collection<StepExecution>> poller = new DirectPoller<>(this.pollInterval);
Future<Collection<StepExecution>> resultsFuture = poller.poll(callback);
if(timeout >= 0) {
if (timeout >= 0) {
return resultsFuture.get(timeout, TimeUnit.MILLISECONDS);
}
else {
@@ -316,7 +316,7 @@ public class DeployerPartitionHandler implements PartitionHandler, EnvironmentAw
Set<String> keys = new HashSet<>();
for(Iterator it = ((AbstractEnvironment) this.environment).getPropertySources().iterator(); it.hasNext(); ) {
for (Iterator it = ((AbstractEnvironment) this.environment).getPropertySources().iterator(); it.hasNext(); ) {
PropertySource propertySource = (PropertySource) it.next();
if (propertySource instanceof MapPropertySource) {
keys.addAll(Arrays.asList(((MapPropertySource) propertySource).getPropertyNames()));

View File

@@ -297,7 +297,7 @@ public class DeployerPartitionHandlerTests {
while (resultsIterator.hasNext()) {
StepExecution curResult = resultsIterator.next();
if(curResult.getStepName().equals("step1:partition2")) {
if (curResult.getStepName().equals("step1:partition2")) {
assertEquals(BatchStatus.FAILED, curResult.getStatus());
}
else {
@@ -451,7 +451,6 @@ public class DeployerPartitionHandlerTests {
Date startTime = new Date();
Collection<StepExecution> results = handler.handle(this.splitter, masterStepExecution);
Date endTime = new Date();
verify(this.taskLauncher, times(2)).launch(this.appDeploymentRequestArgumentCaptor.capture());
List<AppDeploymentRequest> allRequests = this.appDeploymentRequestArgumentCaptor.getAllValues();
@@ -460,7 +459,8 @@ public class DeployerPartitionHandlerTests {
validateStepExecutionResults(results);
assertTrue("Time difference was too small: " + (endTime.getTime() - startTime.getTime()), endTime.getTime() - startTime.getTime() > 20000);
assertTrue("Time difference was too small: " + (endTime.getTime() - startTime.getTime()),
endTime.getTime() - startTime.getTime() >= 20000);
}
@Test(expected = TimeoutException.class)
@@ -585,7 +585,7 @@ public class DeployerPartitionHandlerTests {
}
});
for(int i = 4; i < (numberOfPartitions + 4); i++) {
for (int i = 4; i < (numberOfPartitions + 4); i++) {
AppDeploymentRequest request = allRequests.get(i - 4);
assertEquals(this.resource, request.getResource());
assertEquals(0, request.getEnvironmentProperties().size());