Skip to content

Commit

Permalink
Fix issue proofpoint#54 Add missing test for /v2/event/distribute
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Wittel committed Sep 8, 2014
1 parent 45d89cd commit 571fb80
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/test/java/com/proofpoint/event/collector/TestServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@
import static com.proofpoint.http.client.StaticBodyGenerator.createStaticBodyGenerator;
import static com.proofpoint.http.client.StatusResponseHandler.createStatusResponseHandler;
import static com.proofpoint.http.client.StringResponseHandler.createStringResponseHandler;
import static org.testng.Assert.assertEquals;
import static javax.ws.rs.core.HttpHeaders.CONTENT_TYPE;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static javax.ws.rs.core.Response.Status;
import static org.testng.Assert.assertEquals;

public class TestServer
{
Expand Down Expand Up @@ -186,6 +186,21 @@ public void testClearSpoolCounts()
assertEquals(response.getStatusCode(), Status.NO_CONTENT.getStatusCode());
}

@Test
public void testDistributeSingle()
throws IOException, ExecutionException, InterruptedException
{
String json = Resources.toString(Resources.getResource("single.json"), Charsets.UTF_8);
StatusResponse response = client.execute(preparePost()
.setUri(urlFor("/v2/event/distribute"))
.setHeader("Content-Type", APPLICATION_JSON)
.setBodyGenerator(createStaticBodyGenerator(json, Charsets.UTF_8))
.build(),
createStatusResponseHandler());

assertEquals(response.getStatusCode(), Status.ACCEPTED.getStatusCode());
}

private URI urlFor(String path)
{
return server.getBaseUrl().resolve(path);
Expand Down

0 comments on commit 571fb80

Please sign in to comment.