Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Commit

Permalink
Upgrade to Platform 1.07
Browse files Browse the repository at this point in the history
  • Loading branch information
johngmyers committed Nov 12, 2014
1 parent 4cc4af7 commit cd3ef30
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<groupId>com.proofpoint.platform</groupId>
<artifactId>rest-server-base</artifactId>
<version>1.05</version>
<version>1.07</version>
</parent>

<licenses>
Expand Down
30 changes: 6 additions & 24 deletions src/test/java/com/proofpoint/event/collector/TestServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.proofpoint.bootstrap.LifeCycleManager;
import com.proofpoint.discovery.client.testing.TestingDiscoveryModule;
import com.proofpoint.event.client.JsonEventModule;
import com.proofpoint.http.client.BodyGenerator;
import com.proofpoint.http.client.HttpClient;
import com.proofpoint.http.client.StatusResponseHandler.StatusResponse;
import com.proofpoint.http.client.StringResponseHandler.StringResponse;
Expand All @@ -48,14 +47,14 @@

import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
import java.util.concurrent.ExecutionException;

import static com.proofpoint.http.client.JsonBodyGenerator.jsonBodyGenerator;
import static com.proofpoint.http.client.Request.Builder.prepareDelete;
import static com.proofpoint.http.client.Request.Builder.prepareGet;
import static com.proofpoint.http.client.Request.Builder.preparePost;
import static com.proofpoint.http.client.SmileBodyGenerator.smileBodyGenerator;
import static com.proofpoint.http.client.StaticBodyGenerator.createStaticBodyGenerator;
import static com.proofpoint.http.client.StatusResponseHandler.createStatusResponseHandler;
import static com.proofpoint.http.client.StringResponseHandler.createStringResponseHandler;
Expand All @@ -68,7 +67,6 @@
public class TestServer
{
private static final JsonCodec<Object> OBJECT_CODEC = JsonCodec.jsonCodec(Object.class);
private static final ObjectMapper MAPPER = new ObjectMapper(new SmileFactory()).disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
private static final Object TESTING_SINGLE_EVENT_STRUCTURE = ImmutableList.of(
ImmutableMap.of(
"type", "Test",
Expand Down Expand Up @@ -169,18 +167,10 @@ public void testPostSmile()
throws IOException, ExecutionException, InterruptedException
{
StatusResponse response = client.execute(preparePost()
.setUri(urlFor("/v2/event"))
.setHeader("Content-Type", "application/x-jackson-smile")
.setBodyGenerator(new BodyGenerator()
{
@Override
public void write(OutputStream outputStream)
throws Exception
{
MAPPER.writeValue(outputStream, TESTING_SINGLE_EVENT_STRUCTURE);
}
})
.build(),
.setUri(urlFor("/v2/event"))
.setHeader("Content-Type", "application/x-jackson-smile")
.setBodyGenerator(smileBodyGenerator(OBJECT_CODEC, TESTING_SINGLE_EVENT_STRUCTURE))
.build(),
createStatusResponseHandler());

assertEquals(response.getStatusCode(), Status.ACCEPTED.getStatusCode());
Expand Down Expand Up @@ -248,15 +238,7 @@ public void testDistributeSmile()
StatusResponse response = client.execute(preparePost()
.setUri(urlFor("/v2/event/distribute"))
.setHeader("Content-Type", "application/x-jackson-smile")
.setBodyGenerator(new BodyGenerator()
{
@Override
public void write(OutputStream outputStream)
throws Exception
{
MAPPER.writeValue(outputStream, TESTING_SINGLE_EVENT_STRUCTURE);
}
})
.setBodyGenerator(smileBodyGenerator(OBJECT_CODEC, TESTING_SINGLE_EVENT_STRUCTURE))
.build(),
createStatusResponseHandler());

Expand Down

0 comments on commit cd3ef30

Please sign in to comment.