forked from jenkinsci/java-client-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNoExecutorStartedGetArtifactIT.java
More file actions
49 lines (37 loc) · 1.78 KB
/
NoExecutorStartedGetArtifactIT.java
File metadata and controls
49 lines (37 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.offbytwo.jenkins.integration;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.IOException;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import com.offbytwo.jenkins.model.Artifact;
import com.offbytwo.jenkins.model.BaseModel;
import com.offbytwo.jenkins.model.Build;
@Test(groups = { Groups.NO_EXECUTOR_GROUP })
public class NoExecutorStartedGetArtifactIT extends AbstractJenkinsIntegrationCase {
private Build build;
@BeforeMethod
public void beforeMethod() throws IOException {
build = jenkinsServer.getJob("test").getBuildByNumber(1);
}
@Test
public void getBuildShouldContainTwoArtifacts() throws IOException {
assertThat(build.details().getArtifacts()).hasSize(2);
}
@Test
public void traverseFromArtifactToJenkinsServerShouldNotFail() throws IOException {
build.details().getArtifacts().forEach(a -> assertArtifact(a));
}
private void assertArtifact(Artifact artifact) {
assertBaseModel(artifact);
assertBaseModel(artifact.getBuildWithDetails());
assertBaseModel(artifact.getBuildWithDetails().getBuild());
assertBaseModel(artifact.getBuildWithDetails().getBuild().getJobWithDetails());
assertBaseModel(artifact.getBuildWithDetails().getBuild().getJobWithDetails().getJob());
assertThat(artifact.getBuildWithDetails().getBuild().getJobWithDetails().getJenkinsServer()).isNotNull();
assertThat(artifact.getBuildWithDetails().getBuild().getJobWithDetails().getJob().getJenkinsServer()).isNotNull();
}
private void assertBaseModel(BaseModel baseModel) {
assertThat(baseModel).isNotNull();
// TODO: this will work once #337 is fixed: assertThat(baseModel.getClient()).isNotNull();
}
}