removed extra create job method

This commit is contained in:
Adrian Cole 2012-04-24 22:40:58 -07:00
parent a1ff6f3b59
commit 9884d04c2e
3 changed files with 12 additions and 29 deletions

View File

@ -25,7 +25,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.jclouds.io.Payload;
import org.jclouds.jenkins.v1.filters.BasicAuthenticationUnlessAnonymous;
import org.jclouds.jenkins.v1.functions.ReturnVoidOn302Or404;
import org.jclouds.rest.annotations.BinderParam;
@ -44,17 +43,9 @@ import com.google.common.util.concurrent.ListenableFuture;
*/
@RequestFilters(BasicAuthenticationUnlessAnonymous.class)
public interface JobAsyncClient {
/**
* @see JobClient#createFromXML(String, Payload)
*/
@POST
@Path("/createItem")
@Produces(MediaType.TEXT_XML)
ListenableFuture<Void> createFromXML(@QueryParam("name") String displayName, Payload xml);
/**
* @see JobClient#createFromXML(String, String)
* @see JobClient#createFromXML
*/
@POST
@Path("/createItem")
@ -62,7 +53,7 @@ public interface JobAsyncClient {
ListenableFuture<Void> createFromXML(@QueryParam("name") String displayName, @BinderParam(BindToStringPayload.class) String xml);
/**
* @see JobClient#getJobView
* @see JobClient#delete
*/
@POST
@Path("/job/{displayName}/doDelete")

View File

@ -21,7 +21,6 @@ package org.jclouds.jenkins.v1.features;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
import org.jclouds.io.Payload;
/**
* Job Services
@ -39,8 +38,6 @@ public interface JobClient {
* @param displayName
* @param xml
*/
void createFromXML(String displayName, Payload xml);
void createFromXML(String displayName, String xml);
void delete(String displayName);

View File

@ -36,24 +36,19 @@ import com.google.common.collect.ImmutableMultimap;
*/
@Test(groups = "unit", testName = "JobClientExpectTest")
public class JobClientExpectTest extends BaseJenkinsClientExpectTest {
HttpRequest createJob = HttpRequest.builder()
.method("POST")
.endpoint(URI.create("http://localhost:8080/createItem?name=blagoo"))
.headers(ImmutableMultimap.<String, String> builder()
.put("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build())
.payload(payloadFromResourceWithContentType("/sample_job.xml", "text/xml"))
.build();
HttpResponse createJobResponse = HttpResponse.builder().statusCode(200).build();
public void testCreateJobPayloadWhenResponseIs2xx() {
JenkinsClient createJobWhenCreated = requestSendsResponse(createJob, createJobResponse);
createJobWhenCreated.getJobClient().createFromXML("blagoo", payloadFromResource("/sample_job.xml"));
}
public void testCreateJobStringWhenResponseIs2xx() throws IOException {
HttpRequest createJob = HttpRequest.builder()
.method("POST")
.endpoint(URI.create("http://localhost:8080/createItem?name=blagoo"))
.headers(ImmutableMultimap.<String, String> builder()
.put("Authorization", "Basic aWRlbnRpdHk6Y3JlZGVudGlhbA==").build())
.payload(payloadFromResourceWithContentType("/sample_job.xml", "text/xml"))
.build();
HttpResponse createJobResponse = HttpResponse.builder().statusCode(200).build();
JenkinsClient createJobWhenCreated = requestSendsResponse(createJob, createJobResponse);
createJobWhenCreated.getJobClient().createFromXML("blagoo", Strings2.toStringAndClose(getClass().getResourceAsStream("/sample_job.xml")));