Skip to content

Commit

Permalink
Switched Netty ServerSentEvent class to fix deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Jacobs committed Jul 7, 2016
1 parent 48f0eac commit 94c5cbb
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import io.reactivex.netty.protocol.http.server.HttpServerRequest;
import io.reactivex.netty.protocol.http.server.HttpServerResponse;
import io.reactivex.netty.protocol.http.server.RequestHandler;
import io.reactivex.netty.protocol.text.sse.ServerSentEvent;
import io.reactivex.netty.protocol.http.sse.ServerSentEvent;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -71,7 +71,7 @@ public void setUp() throws Exception {

client = RxNetty.<ByteBuf, ServerSentEvent>newHttpClientBuilder("localhost", port)
.withNoConnectionPooling()
.pipelineConfigurator(PipelineConfigurators.<ByteBuf>sseClientConfigurator())
.pipelineConfigurator(PipelineConfigurators.<ByteBuf>clientSseConfigurator())
.build();

mockStatic(HystrixCommandMetrics.class);
Expand Down Expand Up @@ -100,11 +100,11 @@ public Observable<? extends ServerSentEvent> call(HttpClientResponse<ServerSentE
}
});

Object first = Observable.amb(objectObservable, Observable.timer(1000, TimeUnit.MILLISECONDS)).toBlocking().first();
Object first = Observable.amb(objectObservable, Observable.timer(5000, TimeUnit.MILLISECONDS)).toBlocking().first();

assertTrue("Expected SSE message", first instanceof ServerSentEvent);
ServerSentEvent sse = (ServerSentEvent) first;
JsonNode jsonNode = mapper.readTree(sse.getEventData());
JsonNode jsonNode = mapper.readTree(sse.contentAsString());
assertEquals("Expected hystrix key name", HystrixCommandMetricsSamples.SAMPLE_1.getCommandKey().name(), jsonNode.get("name").asText());
}

Expand Down

0 comments on commit 94c5cbb

Please sign in to comment.