Permalink
Browse files

Using failsafe plugin for Integration tests

Rename current Integration test to match failsafe default naming pattern and
mismatch surefire default naming pattern.
  • Loading branch information...
alecharp committed May 10, 2014
1 parent 56d2773 commit 841711a02c76934276db789e8db3c661f13cfdd2
14 pom.xml
@@ -144,6 +144,20 @@
<target>1.6</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.17</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

@@ -11,6 +11,17 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotEquals;

import com.google.common.collect.ImmutableMap;
import com.offbytwo.jenkins.client.JenkinsHttpClient;
import com.offbytwo.jenkins.model.Build;
import com.offbytwo.jenkins.model.BuildResult;
import com.offbytwo.jenkins.model.BuildWithDetails;
import com.offbytwo.jenkins.model.Computer;
import com.offbytwo.jenkins.model.Job;
import com.offbytwo.jenkins.model.JobWithDetails;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
@@ -37,12 +48,12 @@
import com.offbytwo.jenkins.model.Job;
import com.offbytwo.jenkins.model.JobWithDetails;

public class JenkinsServerIntegration {
public class JenkinsServerIT {

private static final String JENKINS_MASTER = "master";
private static final String JENKINS_TEST_JOB = "jenkins-client-test";
private static final String SAMPLE_JOB_FILE = "sample-job.xml";

private JenkinsHttpClient client;
private JenkinsServer server;
private PoolingClientConnectionManager poolingConnectionManager = new PoolingClientConnectionManager();
@@ -85,6 +96,20 @@ public void shouldReturnListOfJobs() throws Exception {
assertTrue(server.getJobs().containsKey(JENKINS_TEST_JOB));
}

@Test
public void shouldReturnBuildsForJob() throws Exception {
JobWithDetails job = server.getJobs().get("trunk").details();
assertEquals(5, job.getBuilds().get(0).getNumber());
}

@Test
public void shouldReturnBuildStatusForBuild() throws Exception {
JobWithDetails job = server.getJobs().get("pr").details();
BuildWithDetails build = job.getBuilds().get(0).details();
assertEquals(BuildResult.SUCCESS, build.getResult());
assertEquals("foobar", build.getParameters().get("REVISION"));
}

@Test
public void shouldReturnListOfComputers() throws Exception {
assertTrue(server.getComputers().containsKey(JENKINS_MASTER));
@@ -184,12 +209,10 @@ public void testUpdateJob() throws Exception {
private class PerformPollingTest implements Callable<Void> {
private final JenkinsServer server;
private final String jobName;

public PerformPollingTest(JenkinsServer server, String jobName) {
this.server = server;
this.jobName = jobName;
}

public Void call() throws InterruptedException, IOException {
while (true) {
Thread.sleep(500);

0 comments on commit 841711a

Please sign in to comment.