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

Commit cd3ef30

Browse files
committed
Upgrade to Platform 1.07
1 parent 4cc4af7 commit cd3ef30

File tree

2 files changed

+7
-25
lines changed

2 files changed

+7
-25
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<parent>
1313
<groupId>com.proofpoint.platform</groupId>
1414
<artifactId>rest-server-base</artifactId>
15-
<version>1.05</version>
15+
<version>1.07</version>
1616
</parent>
1717

1818
<licenses>

src/test/java/com/proofpoint/event/collector/TestServer.java

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import com.proofpoint.bootstrap.LifeCycleManager;
2929
import com.proofpoint.discovery.client.testing.TestingDiscoveryModule;
3030
import com.proofpoint.event.client.JsonEventModule;
31-
import com.proofpoint.http.client.BodyGenerator;
3231
import com.proofpoint.http.client.HttpClient;
3332
import com.proofpoint.http.client.StatusResponseHandler.StatusResponse;
3433
import com.proofpoint.http.client.StringResponseHandler.StringResponse;
@@ -48,14 +47,14 @@
4847

4948
import java.io.File;
5049
import java.io.IOException;
51-
import java.io.OutputStream;
5250
import java.net.URI;
5351
import java.util.concurrent.ExecutionException;
5452

5553
import static com.proofpoint.http.client.JsonBodyGenerator.jsonBodyGenerator;
5654
import static com.proofpoint.http.client.Request.Builder.prepareDelete;
5755
import static com.proofpoint.http.client.Request.Builder.prepareGet;
5856
import static com.proofpoint.http.client.Request.Builder.preparePost;
57+
import static com.proofpoint.http.client.SmileBodyGenerator.smileBodyGenerator;
5958
import static com.proofpoint.http.client.StaticBodyGenerator.createStaticBodyGenerator;
6059
import static com.proofpoint.http.client.StatusResponseHandler.createStatusResponseHandler;
6160
import static com.proofpoint.http.client.StringResponseHandler.createStringResponseHandler;
@@ -68,7 +67,6 @@
6867
public class TestServer
6968
{
7069
private static final JsonCodec<Object> OBJECT_CODEC = JsonCodec.jsonCodec(Object.class);
71-
private static final ObjectMapper MAPPER = new ObjectMapper(new SmileFactory()).disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
7270
private static final Object TESTING_SINGLE_EVENT_STRUCTURE = ImmutableList.of(
7371
ImmutableMap.of(
7472
"type", "Test",
@@ -169,18 +167,10 @@ public void testPostSmile()
169167
throws IOException, ExecutionException, InterruptedException
170168
{
171169
StatusResponse response = client.execute(preparePost()
172-
.setUri(urlFor("/v2/event"))
173-
.setHeader("Content-Type", "application/x-jackson-smile")
174-
.setBodyGenerator(new BodyGenerator()
175-
{
176-
@Override
177-
public void write(OutputStream outputStream)
178-
throws Exception
179-
{
180-
MAPPER.writeValue(outputStream, TESTING_SINGLE_EVENT_STRUCTURE);
181-
}
182-
})
183-
.build(),
170+
.setUri(urlFor("/v2/event"))
171+
.setHeader("Content-Type", "application/x-jackson-smile")
172+
.setBodyGenerator(smileBodyGenerator(OBJECT_CODEC, TESTING_SINGLE_EVENT_STRUCTURE))
173+
.build(),
184174
createStatusResponseHandler());
185175

186176
assertEquals(response.getStatusCode(), Status.ACCEPTED.getStatusCode());
@@ -248,15 +238,7 @@ public void testDistributeSmile()
248238
StatusResponse response = client.execute(preparePost()
249239
.setUri(urlFor("/v2/event/distribute"))
250240
.setHeader("Content-Type", "application/x-jackson-smile")
251-
.setBodyGenerator(new BodyGenerator()
252-
{
253-
@Override
254-
public void write(OutputStream outputStream)
255-
throws Exception
256-
{
257-
MAPPER.writeValue(outputStream, TESTING_SINGLE_EVENT_STRUCTURE);
258-
}
259-
})
241+
.setBodyGenerator(smileBodyGenerator(OBJECT_CODEC, TESTING_SINGLE_EVENT_STRUCTURE))
260242
.build(),
261243
createStatusResponseHandler());
262244

0 commit comments

Comments
 (0)