target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void decodeArrayWithSimpleStrings() throws Exception { final String[] decode = JsonUtil.decode("[\"one\", \"two\"]"); assertThat(decode.length, is(2)); assertThat(decode[0], equalTo("one")); assertThat(decode[1], equalTo("two")); }
@SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte firstByte =...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
@Test public void decodeArrayWithJsonObject() throws Exception { final String[] decode = JsonUtil.decode("[{\"firstName\":\"Fletch\"}]"); assertThat(decode.length, is(1)); assertThat(decode[0], equalTo("{\"firstName\":\"Fletch\"}")); }
@SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte firstByte =...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
@Test public void decodeArrayWithJsonObjectAndString() throws Exception { final String[] decode = JsonUtil.decode("[{\"firstName\":\"Fletch\"}, \"10\"]"); assertThat(decode.length, is(2)); assertThat(decode[0], equalTo("{\"firstName\":\"Fletch\"}")); assertThat(decode[1], equalTo("10")); }
@SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte firstByte =...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
@Test public void decodeArrayWithJsonObjectAndArray() throws Exception { final String[] decode = JsonUtil.decode("[{\"firstName\":[\"Fletch\"]}, \"10\"]"); assertThat(decode.length, is(2)); assertThat(decode[0], equalTo("{\"firstName\":[\"Fletch\"]}")); assertThat(decode[1], equalTo("10")); }
@SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte firstByte =...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
@Test public void decodeObject() throws Exception { final String[] decode = JsonUtil.decode("{\"firstName\":\"Fletch\"}"); assertThat(decode.length, is(1)); assertThat(decode[0], equalTo("{\"firstName\":\"Fletch\"}")); }
@SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte firstByte =...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
@Test public void decodeString() throws Exception { final String[] decode = JsonUtil.decode("\"x\""); assertThat(decode.length, is(1)); assertThat(decode[0], equalTo("x")); }
@SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte firstByte =...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
@Test public void decodeTextWebSocketFrameSimpleString() throws Exception { final TextWebSocketFrame frame = new TextWebSocketFrame("\"test\""); final String[] decode = JsonUtil.decode(frame); assertThat(decode.length, is(1)); assertThat(decode[0], equalTo("test")); frame.release(); }
@SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte firstByte =...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
@Test public void equalsContractSymetric() { final Ack x = new AckImpl("ch1", 10L); final Ack y = new AckImpl("ch1", 10L); assertThat(x, equalTo(y)); assertThat(y, equalTo(x)); assertThat(x.hashCode(), equalTo(y.hashCode())); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((channelId == null) ? 0 : channelId.hashCode()); return result; }
AckImpl implements Ack { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((channelId == null) ? 0 : channelId.hashCode()); return result; } }
AckImpl implements Ack { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((channelId == null) ? 0 : channelId.hashCode()); return result; } AckImpl(final String channelId, final long version); }
AckImpl implements Ack { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((channelId == null) ? 0 : channelId.hashCode()); return result; } AckImpl(final String channelId, final long version); @Override String getChannelId(); @Override long getVersion(); @Override Strin...
AckImpl implements Ack { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((channelId == null) ? 0 : channelId.hashCode()); return result; } AckImpl(final String channelId, final long version); @Override String getChannelId(); @Override long getVersion(); @Override Strin...
@Test public void decodeTextWebSocketFrameArray() throws Exception { final TextWebSocketFrame frame = new TextWebSocketFrame("[\"test\"]"); final String[] decode = JsonUtil.decode(frame); assertThat(decode.length, is(1)); assertThat(decode[0], equalTo("test")); frame.release(); }
@SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte firstByte =...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
@Test public void decodeTextWebSocketFrameObject() throws Exception { final TextWebSocketFrame frame = new TextWebSocketFrame("{\"firstName\":\"Fletch\"}"); final String[] decode = JsonUtil.decode(frame); assertThat(decode.length, is(1)); assertThat(decode[0], equalTo("{\"firstName\":\"Fletch\"}")); frame.release(); }
@SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte firstByte =...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
JsonUtil { @SuppressWarnings("resource") public static String[] decode(final TextWebSocketFrame frame) throws IOException { final ByteBuf content = frame.content(); if (content.readableBytes() == 0) { return EMPTY_STRING_ARRAY; } final ByteBufInputStream byteBufInputStream = new ByteBufInputStream(content); final byte ...
@Test public void nonMatch() { final SockJsHandler.PathParams sessionPath = SockJsHandler.matches("/xhr_send"); assertThat(sessionPath.matches(), is(false)); }
static PathParams matches(final String path) { final Matcher matcher = SERVER_SESSION_PATTERN.matcher(path); if (matcher.find()) { final String serverId = matcher.group(1); final String sessionId = matcher.group(2); final String transport = matcher.group(3); return new MatchingSessionPath(serverId, sessionId, transport...
SockJsHandler extends SimpleChannelInboundHandler<FullHttpRequest> { static PathParams matches(final String path) { final Matcher matcher = SERVER_SESSION_PATTERN.matcher(path); if (matcher.find()) { final String serverId = matcher.group(1); final String sessionId = matcher.group(2); final String transport = matcher.gr...
SockJsHandler extends SimpleChannelInboundHandler<FullHttpRequest> { static PathParams matches(final String path) { final Matcher matcher = SERVER_SESSION_PATTERN.matcher(path); if (matcher.find()) { final String serverId = matcher.group(1); final String sessionId = matcher.group(2); final String transport = matcher.gr...
SockJsHandler extends SimpleChannelInboundHandler<FullHttpRequest> { static PathParams matches(final String path) { final Matcher matcher = SERVER_SESSION_PATTERN.matcher(path); if (matcher.find()) { final String serverId = matcher.group(1); final String sessionId = matcher.group(2); final String transport = matcher.gr...
SockJsHandler extends SimpleChannelInboundHandler<FullHttpRequest> { static PathParams matches(final String path) { final Matcher matcher = SERVER_SESSION_PATTERN.matcher(path); if (matcher.find()) { final String serverId = matcher.group(1); final String sessionId = matcher.group(2); final String transport = matcher.gr...
@Test public void matches() { final SockJsHandler.PathParams sessionPath = SockJsHandler.matches("/000/123/xhr_send"); assertThat(sessionPath.matches(), is(true)); assertThat(sessionPath.serverId(), equalTo("000")); assertThat(sessionPath.sessionId(), equalTo("123")); assertThat(sessionPath.transport(), equalTo(Transpo...
static PathParams matches(final String path) { final Matcher matcher = SERVER_SESSION_PATTERN.matcher(path); if (matcher.find()) { final String serverId = matcher.group(1); final String sessionId = matcher.group(2); final String transport = matcher.group(3); return new MatchingSessionPath(serverId, sessionId, transport...
SockJsHandler extends SimpleChannelInboundHandler<FullHttpRequest> { static PathParams matches(final String path) { final Matcher matcher = SERVER_SESSION_PATTERN.matcher(path); if (matcher.find()) { final String serverId = matcher.group(1); final String sessionId = matcher.group(2); final String transport = matcher.gr...
SockJsHandler extends SimpleChannelInboundHandler<FullHttpRequest> { static PathParams matches(final String path) { final Matcher matcher = SERVER_SESSION_PATTERN.matcher(path); if (matcher.find()) { final String serverId = matcher.group(1); final String sessionId = matcher.group(2); final String transport = matcher.gr...
SockJsHandler extends SimpleChannelInboundHandler<FullHttpRequest> { static PathParams matches(final String path) { final Matcher matcher = SERVER_SESSION_PATTERN.matcher(path); if (matcher.find()) { final String serverId = matcher.group(1); final String sessionId = matcher.group(2); final String transport = matcher.gr...
SockJsHandler extends SimpleChannelInboundHandler<FullHttpRequest> { static PathParams matches(final String path) { final Matcher matcher = SERVER_SESSION_PATTERN.matcher(path); if (matcher.find()) { final String serverId = matcher.group(1); final String sessionId = matcher.group(2); final String transport = matcher.gr...
@Test public void greeting() throws Exception { final FullHttpResponse response = sendGreetingRequest(); assertWelcomeMessage(response); }
private Greeting() { }
Greeting { private Greeting() { } }
Greeting { private Greeting() { } private Greeting(); }
Greeting { private Greeting() { } private Greeting(); static boolean matches(final String path); static FullHttpResponse response(final HttpRequest request); }
Greeting { private Greeting() { } private Greeting(); static boolean matches(final String path); static FullHttpResponse response(final HttpRequest request); }
@Test public void webSocketSupported() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("websocket").asBoolean(), is(true)); response.release(); }
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return response; ...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
@Test public void webSocketNotSupported() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").disableWebSocket().build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("websocket").asBoolean(), is(false));...
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return response; ...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
@Test public void cookiesNeeded() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").disableWebSocket().cookiesNeeded().build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("cookie_needed").asBoolean(),...
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return response; ...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
@Test public void cookiesNotNeeded() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").disableWebSocket().build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("cookie_needed").asBoolean(), is(false)); ...
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return response; ...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
@Test public void origins() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").disableWebSocket().build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("origins").get(0).asText(), is("*:*")); response.re...
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return response; ...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
@Test public void equalsContractConsistent() { final Ack x = new AckImpl("ch1", 10L); final Ack y = new AckImpl("ch2", 10L); assertThat(x.equals(y), is(false)); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); }
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } }
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } Ac...
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } Ac...
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } Ac...
@Test public void entropy() throws Exception { final SockJsConfig config = SockJsConfig.withPrefix("/simplepush").disableWebSocket().build(); final FullHttpResponse response = Info.response(config, createHttpRequest("/simplepush")); assertThat(infoAsJson(response).get("entropy").asLong(), is(notNullValue())); response....
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return response; ...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
Info { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final FullHttpResponse response = createResponse(request); Transports.setNoCacheHeaders(response); Transports.writeContent(response, infoContent(config), "application/json; charset=UTF-8"); return res...
@Test public void iframeHtm() throws Exception { final SockJsConfig config = config(); final String path = config.prefix() + "/iframe.htm"; final FullHttpResponse response = Iframe.response(config, createHttpRequest(path)); assertThat(response.getStatus().code(), is(HttpResponseStatus.NOT_FOUND.code())); response.relea...
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copiedBuffer("N...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
@Test public void iframeHTML() throws Exception { final SockJsConfig config = config(); final String path = config.prefix() + "/iframe.HTML"; final FullHttpResponse response = Iframe.response(config, createHttpRequest(path)); assertThat(response.getStatus().code(), is(HttpResponseStatus.NOT_FOUND.code())); response.rel...
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copiedBuffer("N...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
@Test public void iframeHtmlUppercase() throws Exception { final SockJsConfig config = config(); final String path = config.prefix() + "/IFRAME.HTML"; final FullHttpResponse response = Iframe.response(config, createHttpRequest(path)); assertThat(response.getStatus().code(), is(HttpResponseStatus.NOT_FOUND.code())); res...
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copiedBuffer("N...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
@Test public void iframeXml() throws Exception { final SockJsConfig config = config(); final String path = config.prefix() + "/iframe.xml"; final FullHttpResponse response = Iframe.response(config, createHttpRequest(path)); assertThat(response.getStatus().code(), is(HttpResponseStatus.NOT_FOUND.code())); response.relea...
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copiedBuffer("N...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
@Test public void iframeUppercase() throws Exception { final SockJsConfig config = config(); final String path = config.prefix() + "/IFRAME"; final FullHttpResponse response = Iframe.response(config, createHttpRequest(path)); assertThat(response.getStatus().code(), is(HttpResponseStatus.NOT_FOUND.code())); response.rel...
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copiedBuffer("N...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
@Test public void ifNoneMatchHeader() throws Exception { final SockJsConfig config = config(); final String path = config.prefix() + "/iframe.html"; final HttpRequest httpRequest = createHttpRequest(path); httpRequest.headers().set(HttpHeaders.Names.IF_NONE_MATCH, "*"); final FullHttpResponse response = Iframe.response...
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copiedBuffer("N...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
@Test public void iframeHtml() throws Exception { final SockJsConfig config = config(); final String path = config.prefix() + "/iframe.html"; final FullHttpResponse response = Iframe.response(config, createHttpRequest(path)); assertThat(response.getStatus().code(), is(HttpResponseStatus.OK.code())); assertThat(response...
public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copiedBuffer("N...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
Iframe { public static FullHttpResponse response(final SockJsConfig config, final HttpRequest request) throws Exception { final QueryStringDecoder qsd = new QueryStringDecoder(request.getUri()); final String path = qsd.path(); if (!PATH_PATTERN.matcher(path).matches()) { return createResponse(request, NOT_FOUND, copied...
@Test public void setState() throws Exception { final SockJsService service = mock(SockJsService.class); final SockJsSession session = new SockJsSession("123", service); session.setState(State.OPEN); assertThat(session.getState(), is(State.OPEN)); }
public void setState(State newState) { while (true) { final State oldState = state.get(); if (state.compareAndSet(oldState, newState)) { return; } } }
SockJsSession { public void setState(State newState) { while (true) { final State oldState = state.get(); if (state.compareAndSet(oldState, newState)) { return; } } } }
SockJsSession { public void setState(State newState) { while (true) { final State oldState = state.get(); if (state.compareAndSet(oldState, newState)) { return; } } } SockJsSession(final String sessionId, final SockJsService service); }
SockJsSession { public void setState(State newState) { while (true) { final State oldState = state.get(); if (state.compareAndSet(oldState, newState)) { return; } } } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHan...
SockJsSession { public void setState(State newState) { while (true) { final State oldState = state.get(); if (state.compareAndSet(oldState, newState)) { return; } } } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHan...
@Test public void onOpen() throws Exception { final SockJsService service = mock(SockJsService.class); final SockJsSession sockJSSession = new SockJsSession("123", service); final SockJsSessionContext session = mock(SockJsSessionContext.class); sockJSSession.onOpen(session); verify(service).onOpen(session); assertThat(...
public void onOpen(final SockJsSessionContext session) { setState(State.OPEN); service.onOpen(session); updateTimestamp(); }
SockJsSession { public void onOpen(final SockJsSessionContext session) { setState(State.OPEN); service.onOpen(session); updateTimestamp(); } }
SockJsSession { public void onOpen(final SockJsSessionContext session) { setState(State.OPEN); service.onOpen(session); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); }
SockJsSession { public void onOpen(final SockJsSessionContext session) { setState(State.OPEN); service.onOpen(session); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelH...
SockJsSession { public void onOpen(final SockJsSessionContext session) { setState(State.OPEN); service.onOpen(session); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelH...
@Test public void equalsContractNull() { final Ack x = new AckImpl("ch1", 10L); assertThat(x.equals(null), is(false)); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); }
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } }
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } Ac...
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } Ac...
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } Ac...
@Test public void onMessage() throws Exception { final SockJsService service = mock(SockJsService.class); final SockJsSession sockJSSession = new SockJsSession("123", service); sockJSSession.onMessage("testing"); verify(service).onMessage("testing"); }
public void onMessage(final String message) throws Exception { service.onMessage(message); updateTimestamp(); }
SockJsSession { public void onMessage(final String message) throws Exception { service.onMessage(message); updateTimestamp(); } }
SockJsSession { public void onMessage(final String message) throws Exception { service.onMessage(message); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); }
SockJsSession { public void onMessage(final String message) throws Exception { service.onMessage(message); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelHandlerContext...
SockJsSession { public void onMessage(final String message) throws Exception { service.onMessage(message); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelHandlerContext...
@Test public void onClose() throws Exception { final SockJsService service = mock(SockJsService.class); final SockJsSession sockJSSession = new SockJsSession("123", service); sockJSSession.onClose(); verify(service).onClose(); }
public void onClose() { setState(State.CLOSED); service.onClose(); }
SockJsSession { public void onClose() { setState(State.CLOSED); service.onClose(); } }
SockJsSession { public void onClose() { setState(State.CLOSED); service.onClose(); } SockJsSession(final String sessionId, final SockJsService service); }
SockJsSession { public void onClose() { setState(State.CLOSED); service.onClose(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelHandlerContext openContext(); void setOpenContext(final C...
SockJsSession { public void onClose() { setState(State.CLOSED); service.onClose(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelHandlerContext openContext(); void setOpenContext(final C...
@Test public void addMessage() throws Exception { final SockJsService service = mock(SockJsService.class); final SockJsSession sockJSSession = new SockJsSession("123", service); sockJSSession.addMessage("hello"); assertThat(sockJSSession.getAllMessages().size(), is(1)); }
public void addMessage(final String message) { messageQueue.add(message); updateTimestamp(); }
SockJsSession { public void addMessage(final String message) { messageQueue.add(message); updateTimestamp(); } }
SockJsSession { public void addMessage(final String message) { messageQueue.add(message); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); }
SockJsSession { public void addMessage(final String message) { messageQueue.add(message); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelHandlerContext openContext(); v...
SockJsSession { public void addMessage(final String message) { messageQueue.add(message); updateTimestamp(); } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final ChannelHandlerContext ctx); ChannelHandlerContext openContext(); v...
@Test public void addMessages() throws Exception { final SockJsService service = mock(SockJsService.class); final SockJsSession sockJSSession = new SockJsSession("123", service); sockJSSession.addMessages(new String[]{"hello", "world"}); final List<String> messages = sockJSSession.getAllMessages(); assertThat(messages....
@SuppressWarnings("ManualArrayToCollectionCopy") public void addMessages(final String[] messages) { for (String msg: messages) { messageQueue.add(msg); } }
SockJsSession { @SuppressWarnings("ManualArrayToCollectionCopy") public void addMessages(final String[] messages) { for (String msg: messages) { messageQueue.add(msg); } } }
SockJsSession { @SuppressWarnings("ManualArrayToCollectionCopy") public void addMessages(final String[] messages) { for (String msg: messages) { messageQueue.add(msg); } } SockJsSession(final String sessionId, final SockJsService service); }
SockJsSession { @SuppressWarnings("ManualArrayToCollectionCopy") public void addMessages(final String[] messages) { for (String msg: messages) { messageQueue.add(msg); } } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final Chann...
SockJsSession { @SuppressWarnings("ManualArrayToCollectionCopy") public void addMessages(final String[] messages) { for (String msg: messages) { messageQueue.add(msg); } } SockJsSession(final String sessionId, final SockJsService service); ChannelHandlerContext connectionContext(); void setConnectionContext(final Chann...
@Test public void extractVersion() { assertThat(VersionExtractor.extractVersion("version=1"), equalTo("1")); assertThat(VersionExtractor.extractVersion("version= 2"), equalTo("2")); assertThat(VersionExtractor.extractVersion("version =3"), equalTo("3")); assertThat(VersionExtractor.extractVersion(" version=10"), equalT...
public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could not find a version in...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
@Test public void noVersion() { assertThat(VersionExtractor.extractVersion(""), is(notNullValue())); assertThat(VersionExtractor.extractVersion(null), is(notNullValue())); }
public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could not find a version in...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
@Test (expected = RuntimeException.class) public void invalidVersionPropertyName() { VersionExtractor.extractVersion("vorsion=12"); }
public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could not find a version in...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
@Test (expected = RuntimeException.class) public void invalidVersion() { VersionExtractor.extractVersion("version="); }
public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could not find a version in...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
VersionExtractor { public static String extractVersion(final String payload) { if (payload == null || "".equals(payload)) { return String.valueOf(System.currentTimeMillis()); } final Matcher matcher = VERSION_PATTERN.matcher(payload); if (matcher.find()) { return matcher.group(1); } throw new RuntimeException("Could no...
@Test public void encrypt() throws Exception { final byte[] salt = "some salt for the server private".getBytes(); final byte[] key = CryptoUtil.secretKey("key", salt); final String encrypted = CryptoUtil.encrypt(key, "some string to encrypt"); assertThat(encrypted, is(notNullValue())); }
public static String encrypt(final byte[] key, final String content) throws Exception { final byte[] iv = BlockCipher.getIV(); final byte[] encrypted = new CryptoBox(key).encrypt(iv, content.getBytes(ASCII)); final String base64 = new UrlBase64().encode(prependIV(encrypted, iv)); return URLEncoder.encode(base64, ASCII....
CryptoUtil { public static String encrypt(final byte[] key, final String content) throws Exception { final byte[] iv = BlockCipher.getIV(); final byte[] encrypted = new CryptoBox(key).encrypt(iv, content.getBytes(ASCII)); final String base64 = new UrlBase64().encode(prependIV(encrypted, iv)); return URLEncoder.encode(b...
CryptoUtil { public static String encrypt(final byte[] key, final String content) throws Exception { final byte[] iv = BlockCipher.getIV(); final byte[] encrypted = new CryptoBox(key).encrypt(iv, content.getBytes(ASCII)); final String base64 = new UrlBase64().encode(prependIV(encrypted, iv)); return URLEncoder.encode(b...
CryptoUtil { public static String encrypt(final byte[] key, final String content) throws Exception { final byte[] iv = BlockCipher.getIV(); final byte[] encrypted = new CryptoBox(key).encrypt(iv, content.getBytes(ASCII)); final String base64 = new UrlBase64().encode(prependIV(encrypted, iv)); return URLEncoder.encode(b...
CryptoUtil { public static String encrypt(final byte[] key, final String content) throws Exception { final byte[] iv = BlockCipher.getIV(); final byte[] encrypted = new CryptoBox(key).encrypt(iv, content.getBytes(ASCII)); final String base64 = new UrlBase64().encode(prependIV(encrypted, iv)); return URLEncoder.encode(b...
@Test public void decrypt() throws Exception { final byte[] salt = "some salt for the server private".getBytes(); final byte[] encryptKey = CryptoUtil.secretKey("key", salt); final String expected = UUID.randomUUID().toString() + "." + UUID.randomUUID().toString(); final String encrypted = CryptoUtil.encrypt(encryptKey...
public static String decrypt(final byte[] key, final String content) throws Exception { final byte[] decodedContent = new UrlBase64().decode(URLDecoder.decode(content, ASCII.displayName())); final byte[] iv = extractIV(decodedContent); final byte[] decrypted = new CryptoBox(key).decrypt(iv, extractContent(decodedConten...
CryptoUtil { public static String decrypt(final byte[] key, final String content) throws Exception { final byte[] decodedContent = new UrlBase64().decode(URLDecoder.decode(content, ASCII.displayName())); final byte[] iv = extractIV(decodedContent); final byte[] decrypted = new CryptoBox(key).decrypt(iv, extractContent(...
CryptoUtil { public static String decrypt(final byte[] key, final String content) throws Exception { final byte[] decodedContent = new UrlBase64().decode(URLDecoder.decode(content, ASCII.displayName())); final byte[] iv = extractIV(decodedContent); final byte[] decrypted = new CryptoBox(key).decrypt(iv, extractContent(...
CryptoUtil { public static String decrypt(final byte[] key, final String content) throws Exception { final byte[] decodedContent = new UrlBase64().decode(URLDecoder.decode(content, ASCII.displayName())); final byte[] iv = extractIV(decodedContent); final byte[] decrypted = new CryptoBox(key).decrypt(iv, extractContent(...
CryptoUtil { public static String decrypt(final byte[] key, final String content) throws Exception { final byte[] decodedContent = new UrlBase64().decode(URLDecoder.decode(content, ASCII.displayName())); final byte[] iv = extractIV(decodedContent); final byte[] decrypted = new CryptoBox(key).decrypt(iv, extractContent(...
@Test public void versionNotPartOfContract() { final Ack x = new AckImpl("ch1", 11L); final Ack y = new AckImpl("ch1", 12L); assertThat(x.equals(y), is(true)); }
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); }
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } }
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } Ac...
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } Ac...
AckImpl implements Ack { @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof Ack)) { return false; } final AckImpl other = (AckImpl) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId); } Ac...
@Test public void saveChannel() { final Channel channel = newChannel2(); assertThat(newRedisDataStore().saveChannel(channel), is(true)); }
@Override public boolean saveChannel(final Channel channel) { final Jedis jedis = jedisPool.getResource(); try { final String uaid = channel.getUAID(); final String chid = channel.getChannelId(); if (jedis.sismember(uaidLookupKey(uaid), chid)) { return false; } final String endpointToken = channel.getEndpointToken(); f...
RedisDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final Jedis jedis = jedisPool.getResource(); try { final String uaid = channel.getUAID(); final String chid = channel.getChannelId(); if (jedis.sismember(uaidLookupKey(uaid), chid)) { return false; } final String endpoin...
RedisDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final Jedis jedis = jedisPool.getResource(); try { final String uaid = channel.getUAID(); final String chid = channel.getChannelId(); if (jedis.sismember(uaidLookupKey(uaid), chid)) { return false; } final String endpoin...
RedisDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final Jedis jedis = jedisPool.getResource(); try { final String uaid = channel.getUAID(); final String chid = channel.getChannelId(); if (jedis.sismember(uaidLookupKey(uaid), chid)) { return false; } final String endpoin...
RedisDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final Jedis jedis = jedisPool.getResource(); try { final String uaid = channel.getUAID(); final String chid = channel.getChannelId(); if (jedis.sismember(uaidLookupKey(uaid), chid)) { return false; } final String endpoin...
@Test public void saveChannelDuplicate() { final Channel channel = newChannel2(); assertThat(newRedisDataStore().saveChannel(channel), is(true)); assertThat(newRedisDataStore().saveChannel(channel), is(false)); }
@Override public boolean saveChannel(final Channel channel) { final Jedis jedis = jedisPool.getResource(); try { final String uaid = channel.getUAID(); final String chid = channel.getChannelId(); if (jedis.sismember(uaidLookupKey(uaid), chid)) { return false; } final String endpointToken = channel.getEndpointToken(); f...
RedisDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final Jedis jedis = jedisPool.getResource(); try { final String uaid = channel.getUAID(); final String chid = channel.getChannelId(); if (jedis.sismember(uaidLookupKey(uaid), chid)) { return false; } final String endpoin...
RedisDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final Jedis jedis = jedisPool.getResource(); try { final String uaid = channel.getUAID(); final String chid = channel.getChannelId(); if (jedis.sismember(uaidLookupKey(uaid), chid)) { return false; } final String endpoin...
RedisDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final Jedis jedis = jedisPool.getResource(); try { final String uaid = channel.getUAID(); final String chid = channel.getChannelId(); if (jedis.sismember(uaidLookupKey(uaid), chid)) { return false; } final String endpoin...
RedisDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final Jedis jedis = jedisPool.getResource(); try { final String uaid = channel.getUAID(); final String chid = channel.getChannelId(); if (jedis.sismember(uaidLookupKey(uaid), chid)) { return false; } final String endpoin...
@Test public void getChannel() throws ChannelNotFoundException { final RedisDataStore store = newRedisDataStore(); final Channel channel = newChannel2(); store.saveChannel(channel); final Channel retreived = store.getChannel(channel.getChannelId()); assertThat(retreived.getChannelId(), equalTo(channel.getChannelId()));...
@Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { final List<String> endpointTokenAndUaid = jedis.hmget(chidLookupKey(channelId), TOKEN_KEY, UAID_KEY); if (!endpointTokenAndUaid.isEmpty()) { final String endpointToken = endpo...
RedisDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { final List<String> endpointTokenAndUaid = jedis.hmget(chidLookupKey(channelId), TOKEN_KEY, UAID_KEY); if (!endpointTokenAndUaid.isEmpty()...
RedisDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { final List<String> endpointTokenAndUaid = jedis.hmget(chidLookupKey(channelId), TOKEN_KEY, UAID_KEY); if (!endpointTokenAndUaid.isEmpty()...
RedisDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { final List<String> endpointTokenAndUaid = jedis.hmget(chidLookupKey(channelId), TOKEN_KEY, UAID_KEY); if (!endpointTokenAndUaid.isEmpty()...
RedisDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { final List<String> endpointTokenAndUaid = jedis.hmget(chidLookupKey(channelId), TOKEN_KEY, UAID_KEY); if (!endpointTokenAndUaid.isEmpty()...
@Test (expected = ChannelNotFoundException.class) public void getChannelNonExisting() throws ChannelNotFoundException { newRedisDataStore().getChannel(UUID.randomUUID().toString()); }
@Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { final List<String> endpointTokenAndUaid = jedis.hmget(chidLookupKey(channelId), TOKEN_KEY, UAID_KEY); if (!endpointTokenAndUaid.isEmpty()) { final String endpointToken = endpo...
RedisDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { final List<String> endpointTokenAndUaid = jedis.hmget(chidLookupKey(channelId), TOKEN_KEY, UAID_KEY); if (!endpointTokenAndUaid.isEmpty()...
RedisDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { final List<String> endpointTokenAndUaid = jedis.hmget(chidLookupKey(channelId), TOKEN_KEY, UAID_KEY); if (!endpointTokenAndUaid.isEmpty()...
RedisDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { final List<String> endpointTokenAndUaid = jedis.hmget(chidLookupKey(channelId), TOKEN_KEY, UAID_KEY); if (!endpointTokenAndUaid.isEmpty()...
RedisDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { final List<String> endpointTokenAndUaid = jedis.hmget(chidLookupKey(channelId), TOKEN_KEY, UAID_KEY); if (!endpointTokenAndUaid.isEmpty()...
@Test public void getChannelIds() throws ChannelNotFoundException { final RedisDataStore store = newRedisDataStore(); final String uaid = UUIDUtil.newUAID(); store.saveChannel(newChannel2(uaid)); store.saveChannel(newChannel2(uaid)); final Set<String> channelIds = store.getChannelIds(uaid); assertThat(channelIds.size()...
@Override public Set<String> getChannelIds(final String uaid) { final Jedis jedis = jedisPool.getResource(); try { return jedis.smembers(uaidLookupKey(uaid)); } finally { jedisPool.returnResource(jedis); } }
RedisDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final Jedis jedis = jedisPool.getResource(); try { return jedis.smembers(uaidLookupKey(uaid)); } finally { jedisPool.returnResource(jedis); } } }
RedisDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final Jedis jedis = jedisPool.getResource(); try { return jedis.smembers(uaidLookupKey(uaid)); } finally { jedisPool.returnResource(jedis); } } RedisDataStore(final String host, final int port); }
RedisDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final Jedis jedis = jedisPool.getResource(); try { return jedis.smembers(uaidLookupKey(uaid)); } finally { jedisPool.returnResource(jedis); } } RedisDataStore(final String host, final int port); @Override void savePriv...
RedisDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final Jedis jedis = jedisPool.getResource(); try { return jedis.smembers(uaidLookupKey(uaid)); } finally { jedisPool.returnResource(jedis); } } RedisDataStore(final String host, final int port); @Override void savePriv...
@Test public void removeChannels() throws ChannelNotFoundException { final RedisDataStore store = newRedisDataStore(); final String uaid = UUIDUtil.newUAID(); final Channel ch1 = newChannel2(uaid); final Channel ch2 = newChannel2(uaid); store.saveChannel(ch1); store.saveChannel(ch2); store.removeChannels(new HashSet<St...
@Override public void removeChannels(final Set<String> channelIds) { for (String channelId : channelIds) { removeChannel(channelId); } }
RedisDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { for (String channelId : channelIds) { removeChannel(channelId); } } }
RedisDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { for (String channelId : channelIds) { removeChannel(channelId); } } RedisDataStore(final String host, final int port); }
RedisDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { for (String channelId : channelIds) { removeChannel(channelId); } } RedisDataStore(final String host, final int port); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @O...
RedisDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { for (String channelId : channelIds) { removeChannel(channelId); } } RedisDataStore(final String host, final int port); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @O...
@Test public void updateVersion() throws VersionException, ChannelNotFoundException { final RedisDataStore store = newRedisDataStore(); final Channel channel = newChannel2(); store.saveChannel(channel); final String channelId = store.updateVersion(channel.getEndpointToken(), 2L); assertThat(channelId, equalTo(channel.g...
@Override public String updateVersion(final String endpointToken, final long newVersion) throws VersionException, ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { jedis.watch(endpointToken); final String versionString = jedis.get(endpointToken); if (versionString == null) { throw channelNot...
RedisDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long newVersion) throws VersionException, ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { jedis.watch(endpointToken); final String versionString = jedis.get(endpointToken); if (ver...
RedisDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long newVersion) throws VersionException, ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { jedis.watch(endpointToken); final String versionString = jedis.get(endpointToken); if (ver...
RedisDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long newVersion) throws VersionException, ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { jedis.watch(endpointToken); final String versionString = jedis.get(endpointToken); if (ver...
RedisDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long newVersion) throws VersionException, ChannelNotFoundException { final Jedis jedis = jedisPool.getResource(); try { jedis.watch(endpointToken); final String versionString = jedis.get(endpointToken); if (ver...
@Test public void saveUnacknowledged() { final RedisDataStore store = newRedisDataStore(); final Channel channel = newChannel2(); store.saveChannel(channel); store.saveUnacknowledged(channel.getChannelId(), channel.getVersion()); final Set<Ack> unacknowledged = store.getUnacknowledged(channel.getUAID()); assertThat(una...
@Override public String saveUnacknowledged(final String channelId, final long version) { final Jedis jedis = jedisPool.getResource(); try { jedis.set(ackLookupKey(channelId), Long.toString(version)); final List<String> hashValues = jedis.hmget(chidLookupKey(channelId), UAID_KEY); final String uaid = hashValues.get(0); ...
RedisDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) { final Jedis jedis = jedisPool.getResource(); try { jedis.set(ackLookupKey(channelId), Long.toString(version)); final List<String> hashValues = jedis.hmget(chidLookupKey(channelId), UAID_KEY); f...
RedisDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) { final Jedis jedis = jedisPool.getResource(); try { jedis.set(ackLookupKey(channelId), Long.toString(version)); final List<String> hashValues = jedis.hmget(chidLookupKey(channelId), UAID_KEY); f...
RedisDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) { final Jedis jedis = jedisPool.getResource(); try { jedis.set(ackLookupKey(channelId), Long.toString(version)); final List<String> hashValues = jedis.hmget(chidLookupKey(channelId), UAID_KEY); f...
RedisDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) { final Jedis jedis = jedisPool.getResource(); try { jedis.set(ackLookupKey(channelId), Long.toString(version)); final List<String> hashValues = jedis.hmget(chidLookupKey(channelId), UAID_KEY); f...
@Test public void removeAcknowledged() { final RedisDataStore store = newRedisDataStore(); final String uaid = UUIDUtil.newUAID(); final Channel channel1 = newChannel2(uaid); final Channel channel2 = newChannel2(uaid); store.saveChannel(channel1); store.saveChannel(channel2); store.saveUnacknowledged(channel1.getChanne...
@Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acks) { final Jedis jedis = jedisPool.getResource(); try { for (Ack ack : acks) { jedis.del(ackLookupKey(ack.getChannelId())); jedis.srem(acksLookupKey(uaid), ack.getChannelId()); } return getUnacknowledged(uaid); } finally { jedisPool.retur...
RedisDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acks) { final Jedis jedis = jedisPool.getResource(); try { for (Ack ack : acks) { jedis.del(ackLookupKey(ack.getChannelId())); jedis.srem(acksLookupKey(uaid), ack.getChannelId()); } return getUnacknowled...
RedisDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acks) { final Jedis jedis = jedisPool.getResource(); try { for (Ack ack : acks) { jedis.del(ackLookupKey(ack.getChannelId())); jedis.srem(acksLookupKey(uaid), ack.getChannelId()); } return getUnacknowled...
RedisDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acks) { final Jedis jedis = jedisPool.getResource(); try { for (Ack ack : acks) { jedis.del(ackLookupKey(ack.getChannelId())); jedis.srem(acksLookupKey(uaid), ack.getChannelId()); } return getUnacknowled...
RedisDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acks) { final Jedis jedis = jedisPool.getResource(); try { for (Ack ack : acks) { jedis.del(ackLookupKey(ack.getChannelId())); jedis.srem(acksLookupKey(uaid), ack.getChannelId()); } return getUnacknowled...
@Test public void saveChannel() { final InMemoryDataStore store = new InMemoryDataStore(); final Channel channel = mockChannel(UUIDUtil.newUAID(), "channel-1", 1, "endpointToken"); final boolean saved = store.saveChannel(channel); assertThat(saved, is(true)); }
@Override public boolean saveChannel(final Channel ch) { checkNotNull(ch, "ch"); final MutableChannel mutableChannel = new MutableChannel(ch); final Channel previous = channels.putIfAbsent(ch.getChannelId(), mutableChannel); endpoints.put(ch.getEndpointToken(), mutableChannel); return previous == null; }
InMemoryDataStore implements DataStore { @Override public boolean saveChannel(final Channel ch) { checkNotNull(ch, "ch"); final MutableChannel mutableChannel = new MutableChannel(ch); final Channel previous = channels.putIfAbsent(ch.getChannelId(), mutableChannel); endpoints.put(ch.getEndpointToken(), mutableChannel); ...
InMemoryDataStore implements DataStore { @Override public boolean saveChannel(final Channel ch) { checkNotNull(ch, "ch"); final MutableChannel mutableChannel = new MutableChannel(ch); final Channel previous = channels.putIfAbsent(ch.getChannelId(), mutableChannel); endpoints.put(ch.getEndpointToken(), mutableChannel); ...
InMemoryDataStore implements DataStore { @Override public boolean saveChannel(final Channel ch) { checkNotNull(ch, "ch"); final MutableChannel mutableChannel = new MutableChannel(ch); final Channel previous = channels.putIfAbsent(ch.getChannelId(), mutableChannel); endpoints.put(ch.getEndpointToken(), mutableChannel); ...
InMemoryDataStore implements DataStore { @Override public boolean saveChannel(final Channel ch) { checkNotNull(ch, "ch"); final MutableChannel mutableChannel = new MutableChannel(ch); final Channel previous = channels.putIfAbsent(ch.getChannelId(), mutableChannel); endpoints.put(ch.getEndpointToken(), mutableChannel); ...
@Test(expected = UnsupportedOperationException.class) public void channelIdsUnmodifiable() { final HelloMessageImpl handshake = new HelloMessageImpl(newUAID(), channelIds("123abc", "efg456")); handshake.getChannelIds().remove("123abc"); }
@Override public Set<String> getChannelIds() { return Collections.unmodifiableSet(channelIds); }
HelloMessageImpl implements HelloMessage { @Override public Set<String> getChannelIds() { return Collections.unmodifiableSet(channelIds); } }
HelloMessageImpl implements HelloMessage { @Override public Set<String> getChannelIds() { return Collections.unmodifiableSet(channelIds); } HelloMessageImpl(); HelloMessageImpl(final String uaid); HelloMessageImpl(final String uaid, final Set<String> channelIds); }
HelloMessageImpl implements HelloMessage { @Override public Set<String> getChannelIds() { return Collections.unmodifiableSet(channelIds); } HelloMessageImpl(); HelloMessageImpl(final String uaid); HelloMessageImpl(final String uaid, final Set<String> channelIds); @Override String getUAID(); @Override Set<String> getC...
HelloMessageImpl implements HelloMessage { @Override public Set<String> getChannelIds() { return Collections.unmodifiableSet(channelIds); } HelloMessageImpl(); HelloMessageImpl(final String uaid); HelloMessageImpl(final String uaid, final Set<String> channelIds); @Override String getUAID(); @Override Set<String> getC...
@Test public void getChannel() throws ChannelNotFoundException { final InMemoryDataStore store = new InMemoryDataStore(); store.saveChannel(mockChannel(UUIDUtil.newUAID(), "channel-1", 1, "endpointToken")); final Channel channel = store.getChannel("channel-1"); assertThat(channel, is(notNullValue())); assertThat(channe...
@Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); final Channel channel = channels.get(channelId); if (channel == null) { throw new ChannelNotFoundException("No Channel for [" + channelId + "] was found", channelId); } return channel; }
InMemoryDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); final Channel channel = channels.get(channelId); if (channel == null) { throw new ChannelNotFoundException("No Channel for [" + channelId + "] was ...
InMemoryDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); final Channel channel = channels.get(channelId); if (channel == null) { throw new ChannelNotFoundException("No Channel for [" + channelId + "] was ...
InMemoryDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); final Channel channel = channels.get(channelId); if (channel == null) { throw new ChannelNotFoundException("No Channel for [" + channelId + "] was ...
InMemoryDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); final Channel channel = channels.get(channelId); if (channel == null) { throw new ChannelNotFoundException("No Channel for [" + channelId + "] was ...
@Test public void removeChannel() { final InMemoryDataStore store = new InMemoryDataStore(); store.saveChannel(mockChannel(UUIDUtil.newUAID(), "channel-1", 1, "endpointToken")); store.removeChannels(new HashSet<String>(Arrays.asList("channel-1"))); assertThat(hasChannel("channel-1", store), is(false)); }
private boolean removeChannel(final String channelId) { checkNotNull(channelId, "channelId"); final Channel channel = channels.remove(channelId); if (channel != null) { endpoints.remove(endpoints.get(channel.getEndpointToken())); } return channel != null; }
InMemoryDataStore implements DataStore { private boolean removeChannel(final String channelId) { checkNotNull(channelId, "channelId"); final Channel channel = channels.remove(channelId); if (channel != null) { endpoints.remove(endpoints.get(channel.getEndpointToken())); } return channel != null; } }
InMemoryDataStore implements DataStore { private boolean removeChannel(final String channelId) { checkNotNull(channelId, "channelId"); final Channel channel = channels.remove(channelId); if (channel != null) { endpoints.remove(endpoints.get(channel.getEndpointToken())); } return channel != null; } }
InMemoryDataStore implements DataStore { private boolean removeChannel(final String channelId) { checkNotNull(channelId, "channelId"); final Channel channel = channels.remove(channelId); if (channel != null) { endpoints.remove(endpoints.get(channel.getEndpointToken())); } return channel != null; } @Override void saveP...
InMemoryDataStore implements DataStore { private boolean removeChannel(final String channelId) { checkNotNull(channelId, "channelId"); final Channel channel = channels.remove(channelId); if (channel != null) { endpoints.remove(endpoints.get(channel.getEndpointToken())); } return channel != null; } @Override void saveP...
@Test public void removeChannels() throws ChannelNotFoundException { final InMemoryDataStore store = new InMemoryDataStore(); final String uaid1 = UUIDUtil.newUAID(); final String uaid2 = UUIDUtil.newUAID(); store.saveChannel(mockChannel(uaid1, "channel-1", 1, "endpointToken1")); store.saveChannel(mockChannel(uaid2, "c...
@Override public void removeChannels(final String uaid) { checkNotNull(uaid, "uaid"); for (Channel channel : channels.values()) { if (channel.getUAID().equals(uaid)) { removeChannel(channel.getChannelId()); logger.info("Removing [" + channel.getChannelId() + "] for UserAgent [" + uaid + "]"); } } unacked.remove(uaid); ...
InMemoryDataStore implements DataStore { @Override public void removeChannels(final String uaid) { checkNotNull(uaid, "uaid"); for (Channel channel : channels.values()) { if (channel.getUAID().equals(uaid)) { removeChannel(channel.getChannelId()); logger.info("Removing [" + channel.getChannelId() + "] for UserAgent [" ...
InMemoryDataStore implements DataStore { @Override public void removeChannels(final String uaid) { checkNotNull(uaid, "uaid"); for (Channel channel : channels.values()) { if (channel.getUAID().equals(uaid)) { removeChannel(channel.getChannelId()); logger.info("Removing [" + channel.getChannelId() + "] for UserAgent [" ...
InMemoryDataStore implements DataStore { @Override public void removeChannels(final String uaid) { checkNotNull(uaid, "uaid"); for (Channel channel : channels.values()) { if (channel.getUAID().equals(uaid)) { removeChannel(channel.getChannelId()); logger.info("Removing [" + channel.getChannelId() + "] for UserAgent [" ...
InMemoryDataStore implements DataStore { @Override public void removeChannels(final String uaid) { checkNotNull(uaid, "uaid"); for (Channel channel : channels.values()) { if (channel.getUAID().equals(uaid)) { removeChannel(channel.getChannelId()); logger.info("Removing [" + channel.getChannelId() + "] for UserAgent [" ...
@Test public void saveUnacknowledged() throws ChannelNotFoundException { final InMemoryDataStore store = new InMemoryDataStore(); final String uaid = UUIDUtil.newUAID(); final String channelId1 = UUID.randomUUID().toString(); store.saveChannel(mockChannel(uaid, channelId1, 1, "endpointToken")); store.saveUnacknowledged...
@Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); checkNotNull(version, "version"); final Channel channel = channels.get(channelId); if (channel == null) { throw new ChannelNotFoundException("Could not find chan...
InMemoryDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); checkNotNull(version, "version"); final Channel channel = channels.get(channelId); if (channel == null) { throw new Chan...
InMemoryDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); checkNotNull(version, "version"); final Channel channel = channels.get(channelId); if (channel == null) { throw new Chan...
InMemoryDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); checkNotNull(version, "version"); final Channel channel = channels.get(channelId); if (channel == null) { throw new Chan...
InMemoryDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { checkNotNull(channelId, "channelId"); checkNotNull(version, "version"); final Channel channel = channels.get(channelId); if (channel == null) { throw new Chan...
@Test public void savePrivateKeySalt() { final byte[] salt = "some private salt".getBytes(); datastore.savePrivateKeySalt(salt); assertThat(datastore.getPrivateKeySalt(), equalTo(salt)); }
@Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length == 0) { final Map<String, String> map = new HashMap<String, String>(2); map.put(TYPE_FIELD, Views.SERVER.viewName()); map.put("salt", new String(salt, UTF_8)); db.create(map); } }
CouchDBDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length == 0) { final Map<String, String> map = new HashMap<String, String>(2); map.put(TYPE_FIELD, Views.SERVER.viewName()); map.put("salt", new Str...
CouchDBDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length == 0) { final Map<String, String> map = new HashMap<String, String>(2); map.put(TYPE_FIELD, Views.SERVER.viewName()); map.put("salt", new Str...
CouchDBDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length == 0) { final Map<String, String> map = new HashMap<String, String>(2); map.put(TYPE_FIELD, Views.SERVER.viewName()); map.put("salt", new Str...
CouchDBDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length == 0) { final Map<String, String> map = new HashMap<String, String>(2); map.put(TYPE_FIELD, Views.SERVER.viewName()); map.put("salt", new Str...
@Test public void saveChannel() { final Channel channel = newChannel(UUIDUtil.newUAID(), UUID.randomUUID().toString()); final boolean saved = datastore.saveChannel(channel); assertThat(saved, is(true)); }
@Override public boolean saveChannel(final Channel channel) { db.create(channelAsMap(channel)); return true; }
CouchDBDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { db.create(channelAsMap(channel)); return true; } }
CouchDBDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { db.create(channelAsMap(channel)); return true; } CouchDBDataStore(final String url, final String dbName); }
CouchDBDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { db.create(channelAsMap(channel)); return true; } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Override boolean sa...
CouchDBDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { db.create(channelAsMap(channel)); return true; } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Override boolean sa...
@Test public void saveChannelWithIdContainingUnderscore() { final String uaid = UUIDUtil.newUAID(); final String channelId = UUID.randomUUID().toString(); final byte[] keySalt = "some string as a salt".getBytes(); final String endpointToken = CryptoUtil.endpointToken(uaid, channelId, CryptoUtil.secretKey("testKey", key...
@Override public boolean saveChannel(final Channel channel) { db.create(channelAsMap(channel)); return true; }
CouchDBDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { db.create(channelAsMap(channel)); return true; } }
CouchDBDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { db.create(channelAsMap(channel)); return true; } CouchDBDataStore(final String url, final String dbName); }
CouchDBDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { db.create(channelAsMap(channel)); return true; } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Override boolean sa...
CouchDBDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { db.create(channelAsMap(channel)); return true; } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPrivateKeySalt(); @Override boolean sa...
@Test (expected = ChannelNotFoundException.class) public void getChannelNonExisting() throws ChannelNotFoundException { datastore.getChannel(UUID.randomUUID().toString()); }
@Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { return channelFromJson(getChannelJson(channelId)); }
CouchDBDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { return channelFromJson(getChannelJson(channelId)); } }
CouchDBDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { return channelFromJson(getChannelJson(channelId)); } CouchDBDataStore(final String url, final String dbName); }
CouchDBDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { return channelFromJson(getChannelJson(channelId)); } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPr...
CouchDBDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { return channelFromJson(getChannelJson(channelId)); } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPr...
@Test public void getChannel() throws ChannelNotFoundException { final String uaid = UUIDUtil.newUAID(); final String channelId = UUID.randomUUID().toString(); final Channel channel = newChannel(uaid, channelId); datastore.saveChannel(channel); final Channel retreived = datastore.getChannel(channelId); assertThat(retre...
@Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { return channelFromJson(getChannelJson(channelId)); }
CouchDBDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { return channelFromJson(getChannelJson(channelId)); } }
CouchDBDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { return channelFromJson(getChannelJson(channelId)); } CouchDBDataStore(final String url, final String dbName); }
CouchDBDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { return channelFromJson(getChannelJson(channelId)); } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPr...
CouchDBDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { return channelFromJson(getChannelJson(channelId)); } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt(final byte[] salt); @Override byte[] getPr...
@Test (expected = ChannelNotFoundException.class) public void removeChannels() throws ChannelNotFoundException { final String uaid = UUIDUtil.newUAID(); final String channelId = UUID.randomUUID().toString(); datastore.saveChannel(newChannel(uaid, channelId)); datastore.saveChannel(newChannel(uaid, UUID.randomUUID().toS...
@Override public void removeChannels(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Set<String> channelIds = new HashSet<String>(rows.size()); for (Row row : rows) { final JsonNode json = row.getValueAsNode().get(DO...
CouchDBDataStore implements DataStore { @Override public void removeChannels(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Set<String> channelIds = new HashSet<String>(rows.size()); for (Row row : rows) { final Jso...
CouchDBDataStore implements DataStore { @Override public void removeChannels(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Set<String> channelIds = new HashSet<String>(rows.size()); for (Row row : rows) { final Jso...
CouchDBDataStore implements DataStore { @Override public void removeChannels(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Set<String> channelIds = new HashSet<String>(rows.size()); for (Row row : rows) { final Jso...
CouchDBDataStore implements DataStore { @Override public void removeChannels(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Set<String> channelIds = new HashSet<String>(rows.size()); for (Row row : rows) { final Jso...
@Test public void content() { assertThat(new OpenFrame().content().toString(CharsetUtil.UTF_8), equalTo("o")); }
@Override public String toString() { return StringUtil.simpleClassName(this) + "[o]"; }
OpenFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[o]"; } }
OpenFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[o]"; } OpenFrame(); }
OpenFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[o]"; } OpenFrame(); @Override String toString(); @Override OpenFrame copy(); @Override OpenFrame duplicate(); @Override OpenFrame retain(); @Override OpenFrame retain(int increment)...
OpenFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[o]"; } OpenFrame(); @Override String toString(); @Override OpenFrame copy(); @Override OpenFrame duplicate(); @Override OpenFrame retain(); @Override OpenFrame retain(int increment)...
@Test public void removeChannelIdsEmpty() throws ChannelNotFoundException { final Set<String> channelIds = datastore.getChannelIds(UUIDUtil.newUAID()); assertThat(channelIds.isEmpty(), is(true)); }
@Override public Set<String> getChannelIds(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); if (rows.isEmpty()) { return Collections.emptySet(); } final Set<String> channelIds = new HashSet<String> (rows.size()); for (Row r...
CouchDBDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); if (rows.isEmpty()) { return Collections.emptySet(); } final Set<String> channelIds = new H...
CouchDBDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); if (rows.isEmpty()) { return Collections.emptySet(); } final Set<String> channelIds = new H...
CouchDBDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); if (rows.isEmpty()) { return Collections.emptySet(); } final Set<String> channelIds = new H...
CouchDBDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UAID.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); if (rows.isEmpty()) { return Collections.emptySet(); } final Set<String> channelIds = new H...
@Test (expected = ChannelNotFoundException.class) public void updateVersionNonExistingEndpointToken() throws VersionException, ChannelNotFoundException { final Channel channel = newChannel(UUIDUtil.newUAID(), UUID.randomUUID().toString()); datastore.updateVersion(channel.getEndpointToken(), 2); }
@Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final ViewResult viewResult = db.queryView(query(Views.TOKEN.viewName(), endpointToken)); final List<Row> rows = viewResult.getRows(); if (rows.isEmpty()) { throw new ChannelNotFound...
CouchDBDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final ViewResult viewResult = db.queryView(query(Views.TOKEN.viewName(), endpointToken)); final List<Row> rows = viewResult.getRows(); if (row...
CouchDBDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final ViewResult viewResult = db.queryView(query(Views.TOKEN.viewName(), endpointToken)); final List<Row> rows = viewResult.getRows(); if (row...
CouchDBDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final ViewResult viewResult = db.queryView(query(Views.TOKEN.viewName(), endpointToken)); final List<Row> rows = viewResult.getRows(); if (row...
CouchDBDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final ViewResult viewResult = db.queryView(query(Views.TOKEN.viewName(), endpointToken)); final List<Row> rows = viewResult.getRows(); if (row...
@Test public void updateVersion() throws VersionException, ChannelNotFoundException { final Channel channel = newChannel(UUIDUtil.newUAID(), UUID.randomUUID().toString()); datastore.saveChannel(channel); final String channelId = datastore.updateVersion(channel.getEndpointToken(), 2); assertThat(channel.getChannelId(), ...
@Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final ViewResult viewResult = db.queryView(query(Views.TOKEN.viewName(), endpointToken)); final List<Row> rows = viewResult.getRows(); if (rows.isEmpty()) { throw new ChannelNotFound...
CouchDBDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final ViewResult viewResult = db.queryView(query(Views.TOKEN.viewName(), endpointToken)); final List<Row> rows = viewResult.getRows(); if (row...
CouchDBDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final ViewResult viewResult = db.queryView(query(Views.TOKEN.viewName(), endpointToken)); final List<Row> rows = viewResult.getRows(); if (row...
CouchDBDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final ViewResult viewResult = db.queryView(query(Views.TOKEN.viewName(), endpointToken)); final List<Row> rows = viewResult.getRows(); if (row...
CouchDBDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final ViewResult viewResult = db.queryView(query(Views.TOKEN.viewName(), endpointToken)); final List<Row> rows = viewResult.getRows(); if (row...
@Test public void saveUnacknowledged() throws ChannelNotFoundException { final String uaid = UUIDUtil.newUAID(); final Channel channel = newChannel(uaid, UUID.randomUUID().toString(), 10); datastore.saveChannel(channel); final String savedUaid = datastore.saveUnacknowledged(channel.getChannelId(), channel.getVersion())...
@Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { final JsonNode json = getChannelJson(channelId); final Map<String, String> unack = docToAckMap((ObjectNode) json.get(DOC_FIELD), version); db.create(unack); return unack.get(UAID_FIELD); }
CouchDBDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { final JsonNode json = getChannelJson(channelId); final Map<String, String> unack = docToAckMap((ObjectNode) json.get(DOC_FIELD), version); db.create(unack); re...
CouchDBDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { final JsonNode json = getChannelJson(channelId); final Map<String, String> unack = docToAckMap((ObjectNode) json.get(DOC_FIELD), version); db.create(unack); re...
CouchDBDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { final JsonNode json = getChannelJson(channelId); final Map<String, String> unack = docToAckMap((ObjectNode) json.get(DOC_FIELD), version); db.create(unack); re...
CouchDBDataStore implements DataStore { @Override public String saveUnacknowledged(final String channelId, final long version) throws ChannelNotFoundException { final JsonNode json = getChannelJson(channelId); final Map<String, String> unack = docToAckMap((ObjectNode) json.get(DOC_FIELD), version); db.create(unack); re...
@Test public void getUnacknowledged() throws ChannelNotFoundException { final String uaid = UUIDUtil.newUAID(); final Channel channel = newChannel(uaid, UUID.randomUUID().toString(), 10); datastore.saveChannel(channel); datastore.saveUnacknowledged(channel.getChannelId(), channel.getVersion()); final Set<Ack> unacks = ...
@Override public Set<Ack> getUnacknowledged(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); return rowsToAcks(viewResult.getRows()); }
CouchDBDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); return rowsToAcks(viewResult.getRows()); } }
CouchDBDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); return rowsToAcks(viewResult.getRows()); } CouchDBDataStore(final String url, final String dbName); }
CouchDBDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); return rowsToAcks(viewResult.getRows()); } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt...
CouchDBDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); return rowsToAcks(viewResult.getRows()); } CouchDBDataStore(final String url, final String dbName); @Override void savePrivateKeySalt...
@Test public void removeAcknowledged() throws ChannelNotFoundException { final String uaid = UUIDUtil.newUAID(); final Channel channel1 = newChannel(uaid, UUID.randomUUID().toString(), 10); final Channel channel2 = newChannel(uaid, UUID.randomUUID().toString(), 22); datastore.saveChannel(channel1); datastore.saveChanne...
@Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Collection<BulkDeleteDocument> removals = new LinkedHashSet<BulkDeleteDocument>(); for (Iterator<Ro...
CouchDBDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Collection<BulkDeleteDocument> removals = new LinkedHashSet...
CouchDBDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Collection<BulkDeleteDocument> removals = new LinkedHashSet...
CouchDBDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Collection<BulkDeleteDocument> removals = new LinkedHashSet...
CouchDBDataStore implements DataStore { @Override public Set<Ack> removeAcknowledged(final String uaid, final Set<Ack> acked) { final ViewResult viewResult = db.queryView(query(Views.UNACKS.viewName(), uaid)); final List<Row> rows = viewResult.getRows(); final Collection<BulkDeleteDocument> removals = new LinkedHashSet...
@Test public void equalsContractReflexive() { final ChannelDTO x = new ChannelDTO(new UserAgentDTO(uaid), channelId, version, endpointUrl); assertThat(x.equals(x), is(true)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId) && endpointToken == nul...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
@Test public void equalsContractSymmetric() { final ChannelDTO x = new ChannelDTO(new UserAgentDTO(uaid), channelId, version, endpointUrl); final ChannelDTO y = new ChannelDTO(new UserAgentDTO(uaid), channelId, version, endpointUrl); assertThat(x.equals(y), is(true)); assertThat(y.equals(x), is(true)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId) && endpointToken == nul...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
@Test public void equalsContractTransative() { final ChannelDTO x = new ChannelDTO(new UserAgentDTO(uaid), channelId, version, endpointUrl); final ChannelDTO y = new ChannelDTO(new UserAgentDTO(uaid), channelId, version, endpointUrl); final ChannelDTO z = new ChannelDTO(new UserAgentDTO(uaid), channelId, version, endpo...
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId) && endpointToken == nul...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
@Test public void equalsContractNull() { final ChannelDTO x = new ChannelDTO(new UserAgentDTO(uaid), channelId, version, endpointUrl); assertThat(x.equals(null), is(false)); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(other.channelId) && endpointToken == nul...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
ChannelDTO implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ChannelDTO other = (ChannelDTO) obj; return channelId == null ? other.channelId == null : channelId.equals(oth...
@Test public void content() { final CloseFrame closeFrame = new CloseFrame(3000, "Go away!"); assertThat(closeFrame.content().toString(CharsetUtil.UTF_8), equalTo("c[3000,\"Go away!\"]")); closeFrame.release(); }
@Override public String toString() { return StringUtil.simpleClassName(this) + "[statusCode=" + statusCode + ", statusMsg='" + statusMsg + "']"; }
CloseFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[statusCode=" + statusCode + ", statusMsg='" + statusMsg + "']"; } }
CloseFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[statusCode=" + statusCode + ", statusMsg='" + statusMsg + "']"; } CloseFrame(final int statusCode, final String statusMsg); }
CloseFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[statusCode=" + statusCode + ", statusMsg='" + statusMsg + "']"; } CloseFrame(final int statusCode, final String statusMsg); int statusCode(); String statusMsg(); @Override String t...
CloseFrame extends DefaultByteBufHolder implements Frame { @Override public String toString() { return StringUtil.simpleClassName(this) + "[statusCode=" + statusCode + ", statusMsg='" + statusMsg + "']"; } CloseFrame(final int statusCode, final String statusMsg); int statusCode(); String statusMsg(); @Override String t...
@Test public void savePrivateKeySalt() { final byte[] salt = "some private salt".getBytes(); jpaDataStore.savePrivateKeySalt(salt); assertThat(jpaDataStore.getPrivateKeySalt(), equalTo(salt)); }
@Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length != 0) { return; } final JpaOperation<Void> saveSalt = new JpaOperation<Void>() { @Override public Void perform(final EntityManager em) { em.persist(new Server(new String(salt, UTF_8...
JpaDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length != 0) { return; } final JpaOperation<Void> saveSalt = new JpaOperation<Void>() { @Override public Void perform(final EntityManager em) { em.persi...
JpaDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length != 0) { return; } final JpaOperation<Void> saveSalt = new JpaOperation<Void>() { @Override public Void perform(final EntityManager em) { em.persi...
JpaDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length != 0) { return; } final JpaOperation<Void> saveSalt = new JpaOperation<Void>() { @Override public Void perform(final EntityManager em) { em.persi...
JpaDataStore implements DataStore { @Override public void savePrivateKeySalt(final byte[] salt) { final byte[] privateKeySalt = getPrivateKeySalt(); if (privateKeySalt.length != 0) { return; } final JpaOperation<Void> saveSalt = new JpaOperation<Void>() { @Override public Void perform(final EntityManager em) { em.persi...
@Test public void saveChannel() { final boolean saved = jpaDataStore.saveChannel(newChannel(UUIDUtil.newUAID(), UUID.randomUUID().toString(), 10L)); assertThat(saved, is(true)); }
@Override public boolean saveChannel(final Channel channel) { final JpaOperation<Boolean> saveChannel = new JpaOperation<Boolean>() { @Override public Boolean perform(final EntityManager em) { UserAgentDTO userAgent = em.find(UserAgentDTO.class, channel.getUAID()); if (userAgent == null) { userAgent = new UserAgentDTO(...
JpaDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final JpaOperation<Boolean> saveChannel = new JpaOperation<Boolean>() { @Override public Boolean perform(final EntityManager em) { UserAgentDTO userAgent = em.find(UserAgentDTO.class, channel.getUAID()); if (userAgent == n...
JpaDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final JpaOperation<Boolean> saveChannel = new JpaOperation<Boolean>() { @Override public Boolean perform(final EntityManager em) { UserAgentDTO userAgent = em.find(UserAgentDTO.class, channel.getUAID()); if (userAgent == n...
JpaDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final JpaOperation<Boolean> saveChannel = new JpaOperation<Boolean>() { @Override public Boolean perform(final EntityManager em) { UserAgentDTO userAgent = em.find(UserAgentDTO.class, channel.getUAID()); if (userAgent == n...
JpaDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final JpaOperation<Boolean> saveChannel = new JpaOperation<Boolean>() { @Override public Boolean perform(final EntityManager em) { UserAgentDTO userAgent = em.find(UserAgentDTO.class, channel.getUAID()); if (userAgent == n...
@Test public void saveChannels() { final String uaid = UUIDUtil.newUAID(); final String channelId = UUID.randomUUID().toString(); assertThat(jpaDataStore.saveChannel(newChannel(uaid, channelId, 1L)), is(true)); assertThat(jpaDataStore.saveChannel(newChannel(uaid, channelId, 10L)), is(true)); }
@Override public boolean saveChannel(final Channel channel) { final JpaOperation<Boolean> saveChannel = new JpaOperation<Boolean>() { @Override public Boolean perform(final EntityManager em) { UserAgentDTO userAgent = em.find(UserAgentDTO.class, channel.getUAID()); if (userAgent == null) { userAgent = new UserAgentDTO(...
JpaDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final JpaOperation<Boolean> saveChannel = new JpaOperation<Boolean>() { @Override public Boolean perform(final EntityManager em) { UserAgentDTO userAgent = em.find(UserAgentDTO.class, channel.getUAID()); if (userAgent == n...
JpaDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final JpaOperation<Boolean> saveChannel = new JpaOperation<Boolean>() { @Override public Boolean perform(final EntityManager em) { UserAgentDTO userAgent = em.find(UserAgentDTO.class, channel.getUAID()); if (userAgent == n...
JpaDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final JpaOperation<Boolean> saveChannel = new JpaOperation<Boolean>() { @Override public Boolean perform(final EntityManager em) { UserAgentDTO userAgent = em.find(UserAgentDTO.class, channel.getUAID()); if (userAgent == n...
JpaDataStore implements DataStore { @Override public boolean saveChannel(final Channel channel) { final JpaOperation<Boolean> saveChannel = new JpaOperation<Boolean>() { @Override public Boolean perform(final EntityManager em) { UserAgentDTO userAgent = em.find(UserAgentDTO.class, channel.getUAID()); if (userAgent == n...
@Test public void getChannel() throws ChannelNotFoundException { final String uaid = UUIDUtil.newUAID(); final String channelId = UUID.randomUUID().toString(); jpaDataStore.saveChannel(newChannel(uaid, channelId, 10L)); final Channel channel = jpaDataStore.getChannel(channelId); assertThat(channel.getChannelId(), equal...
@Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId); } }; final ChannelDTO dto = jpaExecutor.execute...
JpaDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId); } }; final ...
JpaDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId); } }; final ...
JpaDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId); } }; final ...
JpaDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId); } }; final ...
@Test public void getChannelsForNonExistingUserAgent() throws ChannelNotFoundException { final Set<String> channels = jpaDataStore.getChannelIds(UUIDUtil.newUAID()); assertThat(channels.isEmpty(), is(true)); }
@Override public Set<String> getChannelIds(final String uaid) { final JpaOperation<Set<String>> getChannelIds = new JpaOperation<Set<String>>() { @Override public Set<String> perform(final EntityManager em) { final Set<String> channels = new HashSet<String>(); final UserAgentDTO userAgent = em.find(UserAgentDTO.class, ...
JpaDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final JpaOperation<Set<String>> getChannelIds = new JpaOperation<Set<String>>() { @Override public Set<String> perform(final EntityManager em) { final Set<String> channels = new HashSet<String>(); final UserAgentDTO user...
JpaDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final JpaOperation<Set<String>> getChannelIds = new JpaOperation<Set<String>>() { @Override public Set<String> perform(final EntityManager em) { final Set<String> channels = new HashSet<String>(); final UserAgentDTO user...
JpaDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final JpaOperation<Set<String>> getChannelIds = new JpaOperation<Set<String>>() { @Override public Set<String> perform(final EntityManager em) { final Set<String> channels = new HashSet<String>(); final UserAgentDTO user...
JpaDataStore implements DataStore { @Override public Set<String> getChannelIds(final String uaid) { final JpaOperation<Set<String>> getChannelIds = new JpaOperation<Set<String>>() { @Override public Set<String> perform(final EntityManager em) { final Set<String> channels = new HashSet<String>(); final UserAgentDTO user...
@Test (expected = ChannelNotFoundException.class) public void shouldThrowIfChannelIdNotFound() throws ChannelNotFoundException { jpaDataStore.getChannel("doesNotExistId"); }
@Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId); } }; final ChannelDTO dto = jpaExecutor.execute...
JpaDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId); } }; final ...
JpaDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId); } }; final ...
JpaDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId); } }; final ...
JpaDataStore implements DataStore { @Override public Channel getChannel(final String channelId) throws ChannelNotFoundException { final JpaOperation<ChannelDTO> findChannel = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(EntityManager em) { return em.find(ChannelDTO.class, channelId); } }; final ...
@Test public void removeChannels() { final String uaid = UUIDUtil.newUAID(); final String channelId1 = UUID.randomUUID().toString(); final String channelId2 = UUID.randomUUID().toString(); jpaDataStore.saveChannel(newChannel(uaid, channelId1, 10L)); jpaDataStore.saveChannel(newChannel(uaid, channelId2, 10L)); jpaDataSt...
@Override public void removeChannels(final Set<String> channelIds) { if (channelIds == null || channelIds.isEmpty()) { return; } final JpaOperation<Integer> removeChannel = new JpaOperation<Integer>() { @Override public Integer perform(EntityManager em) { final Query delete = em.createQuery("DELETE from ChannelDTO c wh...
JpaDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { if (channelIds == null || channelIds.isEmpty()) { return; } final JpaOperation<Integer> removeChannel = new JpaOperation<Integer>() { @Override public Integer perform(EntityManager em) { final Query delete = em.crea...
JpaDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { if (channelIds == null || channelIds.isEmpty()) { return; } final JpaOperation<Integer> removeChannel = new JpaOperation<Integer>() { @Override public Integer perform(EntityManager em) { final Query delete = em.crea...
JpaDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { if (channelIds == null || channelIds.isEmpty()) { return; } final JpaOperation<Integer> removeChannel = new JpaOperation<Integer>() { @Override public Integer perform(EntityManager em) { final Query delete = em.crea...
JpaDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { if (channelIds == null || channelIds.isEmpty()) { return; } final JpaOperation<Integer> removeChannel = new JpaOperation<Integer>() { @Override public Integer perform(EntityManager em) { final Query delete = em.crea...
@Test public void removeChannelsNoUserAgentStored() { final String channelId1 = UUID.randomUUID().toString(); jpaDataStore.removeChannels(UUIDUtil.newUAID()); assertThat(channelExists(channelId1, jpaDataStore), is(false)); }
@Override public void removeChannels(final Set<String> channelIds) { if (channelIds == null || channelIds.isEmpty()) { return; } final JpaOperation<Integer> removeChannel = new JpaOperation<Integer>() { @Override public Integer perform(EntityManager em) { final Query delete = em.createQuery("DELETE from ChannelDTO c wh...
JpaDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { if (channelIds == null || channelIds.isEmpty()) { return; } final JpaOperation<Integer> removeChannel = new JpaOperation<Integer>() { @Override public Integer perform(EntityManager em) { final Query delete = em.crea...
JpaDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { if (channelIds == null || channelIds.isEmpty()) { return; } final JpaOperation<Integer> removeChannel = new JpaOperation<Integer>() { @Override public Integer perform(EntityManager em) { final Query delete = em.crea...
JpaDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { if (channelIds == null || channelIds.isEmpty()) { return; } final JpaOperation<Integer> removeChannel = new JpaOperation<Integer>() { @Override public Integer perform(EntityManager em) { final Query delete = em.crea...
JpaDataStore implements DataStore { @Override public void removeChannels(final Set<String> channelIds) { if (channelIds == null || channelIds.isEmpty()) { return; } final JpaOperation<Integer> removeChannel = new JpaOperation<Integer>() { @Override public Integer perform(EntityManager em) { final Query delete = em.crea...
@Test public void updateVersion() throws VersionException, ChannelNotFoundException { final Channel channel = newChannel(UUIDUtil.newUAID(), UUID.randomUUID().toString(), 0); jpaDataStore.saveChannel(channel); final String channelId = jpaDataStore.updateVersion(channel.getEndpointToken(), 1); assertThat(channelId, is(e...
@Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final JpaOperation<ChannelDTO> updateVersion = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(final EntityManager em) { final TypedQuery<ChannelDTO> select = em...
JpaDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final JpaOperation<ChannelDTO> updateVersion = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(final EntityManager em) { fina...
JpaDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final JpaOperation<ChannelDTO> updateVersion = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(final EntityManager em) { fina...
JpaDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final JpaOperation<ChannelDTO> updateVersion = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(final EntityManager em) { fina...
JpaDataStore implements DataStore { @Override public String updateVersion(final String endpointToken, final long version) throws VersionException, ChannelNotFoundException { final JpaOperation<ChannelDTO> updateVersion = new JpaOperation<ChannelDTO>() { @Override public ChannelDTO perform(final EntityManager em) { fina...
@Test public void getUnacknowledged() throws ChannelNotFoundException { final String uaid = UUIDUtil.newUAID(); final Channel channel1 = newChannel(uaid, UUID.randomUUID().toString(), 1); final Channel channel2 = newChannel(uaid, UUID.randomUUID().toString(), 2); jpaDataStore.saveChannel(channel1); jpaDataStore.saveCha...
@Override public Set<Ack> getUnacknowledged(final String uaid) { final JpaOperation<Set<Ack>> getUnacks = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final UserAgentDTO userAgent = em.find(UserAgentDTO.class, uaid); if (userAgent == null) { return Collections.emptySet(); }...
JpaDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final JpaOperation<Set<Ack>> getUnacks = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final UserAgentDTO userAgent = em.find(UserAgentDTO.class, uaid); if (userAgent == null...
JpaDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final JpaOperation<Set<Ack>> getUnacks = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final UserAgentDTO userAgent = em.find(UserAgentDTO.class, uaid); if (userAgent == null...
JpaDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final JpaOperation<Set<Ack>> getUnacks = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final UserAgentDTO userAgent = em.find(UserAgentDTO.class, uaid); if (userAgent == null...
JpaDataStore implements DataStore { @Override public Set<Ack> getUnacknowledged(final String uaid) { final JpaOperation<Set<Ack>> getUnacks = new JpaOperation<Set<Ack>>() { @Override public Set<Ack> perform(final EntityManager em) { final UserAgentDTO userAgent = em.find(UserAgentDTO.class, uaid); if (userAgent == null...
@Test public void messages() { final MessageFrame messageFrame = new MessageFrame("first", "second", "third"); assertThat(messageFrame.messages(), hasItems("first", "second", "third")); messageFrame.release(); }
public List<String> messages() { return Collections.unmodifiableList(messages); }
MessageFrame extends DefaultByteBufHolder implements Frame { public List<String> messages() { return Collections.unmodifiableList(messages); } }
MessageFrame extends DefaultByteBufHolder implements Frame { public List<String> messages() { return Collections.unmodifiableList(messages); } MessageFrame(final String message); MessageFrame(final String... messages); MessageFrame(final List<String> messages); }
MessageFrame extends DefaultByteBufHolder implements Frame { public List<String> messages() { return Collections.unmodifiableList(messages); } MessageFrame(final String message); MessageFrame(final String... messages); MessageFrame(final List<String> messages); List<String> messages(); @Override MessageFrame copy(); ...
MessageFrame extends DefaultByteBufHolder implements Frame { public List<String> messages() { return Collections.unmodifiableList(messages); } MessageFrame(final String message); MessageFrame(final String... messages); MessageFrame(final List<String> messages); List<String> messages(); @Override MessageFrame copy(); ...
@Test public void testScrollAction_pass() { TestObserver<Result> testObserver; NowPlayingInteractor nowPlayingInteractor = new NowPlayingInteractor(mockServiceController, filterTransformer); List<MovieInfo> movieInfoList = new ArrayList<>(); for (int i = 0; i < 5; i++) { movieInfoList.add(movieInfo); } NowPlayingInfo n...
public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
@Test public void testScrollAction_fail() { TestObserver<Result> testObserver; NowPlayingInteractor nowPlayingInteractor = new NowPlayingInteractor(mockServiceController, filterTransformer); List<MovieInfo> movieInfoList = new ArrayList<MovieInfo>(); for (int i = 0; i < 5; i++) { movieInfoList.add(movieInfo); } NowPlay...
public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
@Test public void testResultAction_pass() { TestObserver<Result> testObserver; NowPlayingInteractor nowPlayingInteractor = new NowPlayingInteractor(mockServiceController, filterTransformer); List<MovieInfo> movieInfoList = new ArrayList<MovieInfo>(); for (int i = 0; i < 5; i++) { movieInfoList.add(movieInfo); } NowPlay...
public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
@Test public void testResultAction_fail() { TestObserver<Result> testObserver; NowPlayingInteractor nowPlayingInteractor = new NowPlayingInteractor(mockServiceController, filterTransformer); List<MovieInfo> movieInfoList = new ArrayList<MovieInfo>(); for (int i = 0; i < 5; i++) { movieInfoList.add(movieInfo); } NowPlay...
public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
@Test public void testResultAction_pass_multiple_results() { TestObserver<Result> testObserver; NowPlayingInteractor nowPlayingInteractor = new NowPlayingInteractor(mockServiceController, filterTransformer); int pageNumber = 2; List<MovieInfo> movieInfoList = new ArrayList<MovieInfo>(); for (int i = 0; i < 5; i++) { mo...
public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
@Test public void testFilter_turnFilterOn() { TestObserver<Result> testObserver; NowPlayingInteractor nowPlayingInteractor = new NowPlayingInteractor(mockServiceController, filterTransformer); List<MovieInfo> movieInfoList = new ArrayList<MovieInfo>(); for (int i = 0; i < 5; i++) { movieInfoList.add(movieInfo); } when(...
public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
@Test public void testFilter_ScrollResults() { TestObserver<Result> testObserver; NowPlayingInteractor nowPlayingInteractor = new NowPlayingInteractor(mockServiceController, filterTransformer); int pageNumber = 2; List<MovieInfo> movieInfoList = new ArrayList<MovieInfo>(); for (int i = 0; i < 5; i++) { movieInfoList.ad...
public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); }
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
NowPlayingInteractor { public Observable<Result> processAction(Observable<Action> actions) { return actions.compose(transformActionIntoResults); } @SuppressWarnings("checkstyle:magicnumber") NowPlayingInteractor(@NonNull ServiceController serviceControllerIn, @NonNull FilterTransformer filterTransformerIn); Observable...
@Test public void testRemoveListener() { AndroidLocationEngineImpl.AndroidLocationEngineCallbackTransport transport = new AndroidLocationEngineImpl.AndroidLocationEngineCallbackTransport(callback); when(engineImpl.createListener(callback)).thenReturn(transport); locationEngineProxy.getListener(callback); locationEngine...
@VisibleForTesting T removeListener(@NonNull LocationEngineCallback<LocationEngineResult> callback) { return listeners != null ? listeners.remove(callback) : null; }
LocationEngineProxy implements LocationEngine { @VisibleForTesting T removeListener(@NonNull LocationEngineCallback<LocationEngineResult> callback) { return listeners != null ? listeners.remove(callback) : null; } }
LocationEngineProxy implements LocationEngine { @VisibleForTesting T removeListener(@NonNull LocationEngineCallback<LocationEngineResult> callback) { return listeners != null ? listeners.remove(callback) : null; } LocationEngineProxy(LocationEngineImpl<T> locationEngineImpl); }
LocationEngineProxy implements LocationEngine { @VisibleForTesting T removeListener(@NonNull LocationEngineCallback<LocationEngineResult> callback) { return listeners != null ? listeners.remove(callback) : null; } LocationEngineProxy(LocationEngineImpl<T> locationEngineImpl); @Override void getLastLocation(@NonNull Loc...
LocationEngineProxy implements LocationEngine { @VisibleForTesting T removeListener(@NonNull LocationEngineCallback<LocationEngineResult> callback) { return listeners != null ? listeners.remove(callback) : null; } LocationEngineProxy(LocationEngineImpl<T> locationEngineImpl); @Override void getLastLocation(@NonNull Loc...
@Test public void checkNotCnRegion() { Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); Callback mockedHttpCallback = mock(Callback.class); MapboxTelemetry theMapboxTelemetry = obtainMapboxTelemetryWith(mockedContext, mockedTelemetryCl...
public boolean isCnRegion() { if (checkRequiredParameters(sAccessToken.get(), userAgent)) { return telemetryClient.isCnRegion(); } return false; }
MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean isCnRegion() { if (checkRequiredParameters(sAccessToken.get(), userAgent)) { return telemetryClient.isCnRegion(); } return false; } }
MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean isCnRegion() { if (checkRequiredParameters(sAccessToken.get(), userAgent)) { return telemetryClient.isCnRegion(); } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context...
MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean isCnRegion() { if (checkRequiredParameters(sAccessToken.get(), userAgent)) { return telemetryClient.isCnRegion(); } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context...
MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { public boolean isCnRegion() { if (checkRequiredParameters(sAccessToken.get(), userAgent)) { return telemetryClient.isCnRegion(); } return false; } MapboxTelemetry(Context context, String accessToken, String userAgent); MapboxTelemetry(Context context...
@Test public void checkTelemetryClientFactory() { String anyToken = "anyToken"; String anyUserAgent = "anyUserAgent"; Context mockedContext = mock(Context.class, RETURNS_DEEP_STUBS); TelemetryClient mockedTelemetryClient = mock(TelemetryClient.class); Callback mockedHttpCallback = mock(Callback.class); MapboxTelemetry ...
@VisibleForTesting TelemetryClientFactory getTelemetryClientFactory(String accessToken, String userAgent) { String fullUserAgent = TelemetryUtils.createFullUserAgent(userAgent, applicationContext); return new TelemetryClientFactory(accessToken, fullUserAgent, new Logger(), certificateBlacklist); }
MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @VisibleForTesting TelemetryClientFactory getTelemetryClientFactory(String accessToken, String userAgent) { String fullUserAgent = TelemetryUtils.createFullUserAgent(userAgent, applicationContext); return new TelemetryClientFactory(accessToken, fullUse...
MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @VisibleForTesting TelemetryClientFactory getTelemetryClientFactory(String accessToken, String userAgent) { String fullUserAgent = TelemetryUtils.createFullUserAgent(userAgent, applicationContext); return new TelemetryClientFactory(accessToken, fullUse...
MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @VisibleForTesting TelemetryClientFactory getTelemetryClientFactory(String accessToken, String userAgent) { String fullUserAgent = TelemetryUtils.createFullUserAgent(userAgent, applicationContext); return new TelemetryClientFactory(accessToken, fullUse...
MapboxTelemetry implements FullQueueCallback, ServiceTaskCallback { @VisibleForTesting TelemetryClientFactory getTelemetryClientFactory(String accessToken, String userAgent) { String fullUserAgent = TelemetryUtils.createFullUserAgent(userAgent, applicationContext); return new TelemetryClientFactory(accessToken, fullUse...
@Test public void getEmptyMetric() { assertThat(metrics.getMetrics("test")).isNull(); }
@Nullable public Metrics getMetrics(@NonNull String name) { Deque<Metrics> metrics = metricsMap.get(name.trim()); synchronized (this) { return metrics != null && !metrics.isEmpty() ? metrics.pop() : null; } }
AbstractCompositeMetrics { @Nullable public Metrics getMetrics(@NonNull String name) { Deque<Metrics> metrics = metricsMap.get(name.trim()); synchronized (this) { return metrics != null && !metrics.isEmpty() ? metrics.pop() : null; } } }
AbstractCompositeMetrics { @Nullable public Metrics getMetrics(@NonNull String name) { Deque<Metrics> metrics = metricsMap.get(name.trim()); synchronized (this) { return metrics != null && !metrics.isEmpty() ? metrics.pop() : null; } } AbstractCompositeMetrics(long maxLength); }
AbstractCompositeMetrics { @Nullable public Metrics getMetrics(@NonNull String name) { Deque<Metrics> metrics = metricsMap.get(name.trim()); synchronized (this) { return metrics != null && !metrics.isEmpty() ? metrics.pop() : null; } } AbstractCompositeMetrics(long maxLength); void add(String name, long delta); @Nullab...
AbstractCompositeMetrics { @Nullable public Metrics getMetrics(@NonNull String name) { Deque<Metrics> metrics = metricsMap.get(name.trim()); synchronized (this) { return metrics != null && !metrics.isEmpty() ? metrics.pop() : null; } } AbstractCompositeMetrics(long maxLength); void add(String name, long delta); @Nullab...
@Test public void getMetricsEmptyString() { assertThat(metrics.getMetrics("")).isNull(); }
@Nullable public Metrics getMetrics(@NonNull String name) { Deque<Metrics> metrics = metricsMap.get(name.trim()); synchronized (this) { return metrics != null && !metrics.isEmpty() ? metrics.pop() : null; } }
AbstractCompositeMetrics { @Nullable public Metrics getMetrics(@NonNull String name) { Deque<Metrics> metrics = metricsMap.get(name.trim()); synchronized (this) { return metrics != null && !metrics.isEmpty() ? metrics.pop() : null; } } }
AbstractCompositeMetrics { @Nullable public Metrics getMetrics(@NonNull String name) { Deque<Metrics> metrics = metricsMap.get(name.trim()); synchronized (this) { return metrics != null && !metrics.isEmpty() ? metrics.pop() : null; } } AbstractCompositeMetrics(long maxLength); }
AbstractCompositeMetrics { @Nullable public Metrics getMetrics(@NonNull String name) { Deque<Metrics> metrics = metricsMap.get(name.trim()); synchronized (this) { return metrics != null && !metrics.isEmpty() ? metrics.pop() : null; } } AbstractCompositeMetrics(long maxLength); void add(String name, long delta); @Nullab...
AbstractCompositeMetrics { @Nullable public Metrics getMetrics(@NonNull String name) { Deque<Metrics> metrics = metricsMap.get(name.trim()); synchronized (this) { return metrics != null && !metrics.isEmpty() ? metrics.pop() : null; } } AbstractCompositeMetrics(long maxLength); void add(String name, long delta); @Nullab...
@Test public void add() { Metrics metrics = getMetrics(); metrics.add(100L); assertThat(metrics.getValue()).isEqualTo(100L); }
@Override public void add(long delta) { value.addAndGet(delta); }
MetricsImpl implements Metrics { @Override public void add(long delta) { value.addAndGet(delta); } }
MetricsImpl implements Metrics { @Override public void add(long delta) { value.addAndGet(delta); } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); }
MetricsImpl implements Metrics { @Override public void add(long delta) { value.addAndGet(delta); } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); }
MetricsImpl implements Metrics { @Override public void add(long delta) { value.addAndGet(delta); } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); }
@Test public void getValue() { Metrics metrics = getMetrics(); assertThat(metrics.getValue()).isEqualTo(0L); }
@Override public long getValue() { return value.get(); }
MetricsImpl implements Metrics { @Override public long getValue() { return value.get(); } }
MetricsImpl implements Metrics { @Override public long getValue() { return value.get(); } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); }
MetricsImpl implements Metrics { @Override public long getValue() { return value.get(); } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); }
MetricsImpl implements Metrics { @Override public long getValue() { return value.get(); } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); }
@Test public void getStart() { long startTime = SystemClock.elapsedRealtime(); Metrics metrics = new MetricsImpl(startTime, startTime + TimeUnit.HOURS.toMillis(24)); assertThat(metrics.getStart()).isEqualTo(startTime); }
@Override public long getStart() { return start; }
MetricsImpl implements Metrics { @Override public long getStart() { return start; } }
MetricsImpl implements Metrics { @Override public long getStart() { return start; } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); }
MetricsImpl implements Metrics { @Override public long getStart() { return start; } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); }
MetricsImpl implements Metrics { @Override public long getStart() { return start; } MetricsImpl(long start, long end, long initialValue); MetricsImpl(long start, long end); @Override void add(long delta); @Override long getValue(); @Override long getStart(); @Override long getEnd(); }