Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating spring dependencies #316

Merged
merged 3 commits into from Jul 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Expand Up @@ -7,7 +7,7 @@ buildscript {
}

dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.5.RELEASE")
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.6.RELEASE")
classpath("io.spring.gradle:dependency-management-plugin:0.6.0.RELEASE")
classpath("org.asciidoctor:asciidoctor-gradle-plugin:1.5.3")
classpath("gradle.plugin.com.gorylenko.gradle-git-properties:gradle-git-properties:1.4.11")
Expand Down Expand Up @@ -63,7 +63,7 @@ subprojects {

dependencyManagement {
imports {
mavenBom 'io.spring.platform:platform-bom:2.0.5.RELEASE'
mavenBom 'io.spring.platform:platform-bom:2.0.6.RELEASE'
// mavenBom 'org.springframework.cloud:spring-cloud-starter-parent:Brixton.RC1'
}
}
Expand Down
Expand Up @@ -481,7 +481,7 @@ public JobStatus waitForCompletion(final String jobId, final long blockTimeout,

final JobStatus status = this.getJobStatus(jobId);

if (status == JobStatus.FAILED || status == JobStatus.KILLED || status == JobStatus.SUCCEEDED) {
if (status.isFinished()) {
return status;
}

Expand Down
Expand Up @@ -71,4 +71,22 @@ public static JobStatus parse(final String value) throws GeniePreconditionExcept
"Unacceptable job status. Must be one of {Init, Running, Succeeded, Killed, Failed, Invalid}"
);
}

/**
* Check whether this job is in an active state or not.
*
* @return True if the job is still actively processing in some manner
*/
public boolean isActive() {
return this == INIT || this == RUNNING;
}

/**
* Check whether the job is no longer running.
*
* @return True if the job is no longer processing for one reason or another.
*/
public boolean isFinished() {
return this == SUCCEEDED || this == KILLED || this == FAILED || this == INVALID;
}
}
Expand Up @@ -65,4 +65,30 @@ public void testInvalidJobStatus() throws GeniePreconditionException {
public void testBlankJobStatus() throws GeniePreconditionException {
JobStatus.parse(null);
}

/**
* Test to make sure isActive is working properly.
*/
@Test
public void testIsActive() {
Assert.assertTrue(JobStatus.RUNNING.isActive());
Assert.assertTrue(JobStatus.INIT.isActive());
Assert.assertFalse(JobStatus.FAILED.isActive());
Assert.assertFalse(JobStatus.INVALID.isActive());
Assert.assertFalse(JobStatus.KILLED.isActive());
Assert.assertFalse(JobStatus.SUCCEEDED.isActive());
}

/**
* Test to make sure isFinished is working properly.
*/
@Test
public void testIsFinished() {
Assert.assertFalse(JobStatus.RUNNING.isFinished());
Assert.assertFalse(JobStatus.INIT.isFinished());
Assert.assertTrue(JobStatus.FAILED.isFinished());
Assert.assertTrue(JobStatus.INVALID.isFinished());
Assert.assertTrue(JobStatus.KILLED.isFinished());
Assert.assertTrue(JobStatus.SUCCEEDED.isFinished());
}
}