|
|
@@ -3,6 +3,7 @@ package cn.seecoder.client;
|
|
|
import cn.seecoder.build.client.SeecoderBuildClient;
|
|
|
import cn.seecoder.build.model.vo.BuildDetailsVO;
|
|
|
import cn.seecoder.build.model.vo.PipelineVO;
|
|
|
+import com.offbytwo.jenkins.JenkinsServer;
|
|
|
import org.apache.commons.io.IOUtils;
|
|
|
import org.junit.Assert;
|
|
|
import org.junit.Before;
|
|
|
@@ -10,6 +11,7 @@ import org.junit.Test;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
+import java.net.URI;
|
|
|
import java.net.URISyntaxException;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
@@ -22,10 +24,20 @@ public class SeecoderBuildClientTest {
|
|
|
|
|
|
private String template;
|
|
|
|
|
|
+ private JenkinsServer jenkinsServer;
|
|
|
+
|
|
|
@Before
|
|
|
public void init() throws URISyntaxException, IOException {
|
|
|
client = new SeecoderBuildClient("https://seecoder-build.seec.seecoder.cn", "3b861b052fd085887b5462fe5ae0c3a916b2c281d776a4d87e7bd5572ad24608");
|
|
|
template = IOUtils.readLines(getClass().getClassLoader().getResourceAsStream("config.xml")).stream().collect(Collectors.joining("\n"));
|
|
|
+ //用于测试jenkins服务器
|
|
|
+ this.jenkinsServer = new JenkinsServer(new URI("https://seecoder-build-jenkins.seec.seecoder.cn"), "admin", "11cf3c7f64d8203ea45a07320a2a416bce");
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void getJob() throws IOException {
|
|
|
+// jenkinsServer.createJob("test-pipeline2",template);
|
|
|
+ System.out.println(jenkinsServer.getJobs());
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
@@ -98,7 +110,7 @@ public class SeecoderBuildClientTest {
|
|
|
params.put("EXECUTE_SHELL", "mvn cobertura:cobertura");
|
|
|
params.put("PROB_TARGET", "COVERAGE");
|
|
|
params.put("JAR_ARTIFACT", "org.jacoco.examples.maven.java-1.0-SNAPSHOT.jar");
|
|
|
- System.out.println(client.invokeBuild(1, "coder-test", params));
|
|
|
+ System.out.println(client.invokeBuild(1, "test-pipeline2", params));
|
|
|
}
|
|
|
@Test
|
|
|
public void getEntity() {
|