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 bytesWritten() { metrics_listen1_server1.bytesWritten(socketMetric_listen1_1, anyRemoteAddr, 1); metrics_listen1_server2.bytesWritten(socketMetric_listen1_2, anyRemoteAddr, 2); metrics_listen2_server1.bytesWritten(socketMetric_listen2_1, anyRemoteAddr, 3); metrics_listen2_server2.bytesWritten(socketMetric_listen2_2, anyRemoteAddr, 4); metrics_listen2_server2.bytesWritten(socketMetric_listen2_3, anyRemoteAddr, 5); Assert.assertEquals(3, endpointMetric1.getBytesWritten()); Assert.assertEquals(12, endpointMetric2.getBytesWritten()); }
@Override public void bytesWritten(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes) { endpointMetric.addBytesWritten(numberOfBytes); }
DefaultTcpServerMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void bytesWritten(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes) { endpointMetric.addBytesWritten(numberOfBytes); } }
DefaultTcpServerMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void bytesWritten(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes) { endpointMetric.addBytesWritten(numberOfBytes); } DefaultTcpServerMetrics(DefaultServerEndpointMetric endpointMetric); }
DefaultTcpServerMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void bytesWritten(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes) { endpointMetric.addBytesWritten(numberOfBytes); } DefaultTcpServerMetrics(DefaultServerEndpointMetric endpointMetric); DefaultServerEndpointMetric getEndpointMetric(); @Override DefaultTcpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
DefaultTcpServerMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void bytesWritten(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes) { endpointMetric.addBytesWritten(numberOfBytes); } DefaultTcpServerMetrics(DefaultServerEndpointMetric endpointMetric); DefaultServerEndpointMetric getEndpointMetric(); @Override DefaultTcpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
@Test public void createEndpoint() { Assert.assertSame(endpointMetric_a_1, endpointMetric_b_1); Assert.assertNotSame(endpointMetric_a_1, endpointMetric_a_2); Assert.assertNotSame(endpointMetric_a_2, endpointMetric_b_1); Assert.assertSame(endpointMetric_a_2, endpointMetric_b_2); Assert.assertEquals(2, endpointMetric_a_1.getCurrentConnectionCount()); Assert.assertEquals(2, endpointMetric_a_2.getCurrentConnectionCount()); }
@Override public DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize) { return this.clientEndpointMetricManager.getOrCreateEndpointMetric(host + ":" + port); }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize) { return this.clientEndpointMetricManager.getOrCreateEndpointMetric(host + ":" + port); } }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize) { return this.clientEndpointMetricManager.getOrCreateEndpointMetric(host + ":" + port); } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize) { return this.clientEndpointMetricManager.getOrCreateEndpointMetric(host + ":" + port); } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize); @Override void closeEndpoint(String host, int port, DefaultClientEndpointMetric endpointMetric); @Override Object enqueueRequest(DefaultClientEndpointMetric endpointMetric); @Override void dequeueRequest(DefaultClientEndpointMetric endpointMetric, Object taskMetric); @Override void endpointConnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override void endpointDisconnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestEnd(DefaultHttpSocketMetric requestMetric); @Override void responseBegin(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override DefaultHttpSocketMetric responsePushed(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestReset(DefaultHttpSocketMetric requestMetric); @Override void responseEnd(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override Object connected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, WebSocket webSocket); @Override void disconnected(Object webSocketMetric); @Override DefaultHttpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize) { return this.clientEndpointMetricManager.getOrCreateEndpointMetric(host + ":" + port); } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize); @Override void closeEndpoint(String host, int port, DefaultClientEndpointMetric endpointMetric); @Override Object enqueueRequest(DefaultClientEndpointMetric endpointMetric); @Override void dequeueRequest(DefaultClientEndpointMetric endpointMetric, Object taskMetric); @Override void endpointConnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override void endpointDisconnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestEnd(DefaultHttpSocketMetric requestMetric); @Override void responseBegin(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override DefaultHttpSocketMetric responsePushed(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestReset(DefaultHttpSocketMetric requestMetric); @Override void responseEnd(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override Object connected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, WebSocket webSocket); @Override void disconnected(Object webSocketMetric); @Override DefaultHttpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
@Test public void expire() { metricsOptionsEx.setCheckClientEndpointMetricExpiredInNano(10); nanoTime = 2; clientMetrics_a.disconnected(socketMetric_a_1, null); clientMetrics_a.disconnected(socketMetric_a_2, null); nanoTime = 13; defaultVertxMetrics.getClientEndpointMetricManager().onCheckClientEndpointMetricExpired(0); Assert.assertNotNull( defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address1.toString())); Assert.assertNotNull( defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address2.toString())); clientMetrics_b.disconnected(socketMetric_b_1, null); clientMetrics_b.disconnected(socketMetric_b_2, null); nanoTime = 23; defaultVertxMetrics.getClientEndpointMetricManager().onCheckClientEndpointMetricExpired(0); Assert.assertNotNull( defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address1.toString())); Assert.assertNotNull( defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address2.toString())); nanoTime = 24; defaultVertxMetrics.getClientEndpointMetricManager().onCheckClientEndpointMetricExpired(0); Assert .assertNull(defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address1.toString())); Assert .assertNull(defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address2.toString())); }
@Override public void disconnected(Object webSocketMetric) { }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public void disconnected(Object webSocketMetric) { } }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public void disconnected(Object webSocketMetric) { } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public void disconnected(Object webSocketMetric) { } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize); @Override void closeEndpoint(String host, int port, DefaultClientEndpointMetric endpointMetric); @Override Object enqueueRequest(DefaultClientEndpointMetric endpointMetric); @Override void dequeueRequest(DefaultClientEndpointMetric endpointMetric, Object taskMetric); @Override void endpointConnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override void endpointDisconnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestEnd(DefaultHttpSocketMetric requestMetric); @Override void responseBegin(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override DefaultHttpSocketMetric responsePushed(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestReset(DefaultHttpSocketMetric requestMetric); @Override void responseEnd(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override Object connected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, WebSocket webSocket); @Override void disconnected(Object webSocketMetric); @Override DefaultHttpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public void disconnected(Object webSocketMetric) { } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize); @Override void closeEndpoint(String host, int port, DefaultClientEndpointMetric endpointMetric); @Override Object enqueueRequest(DefaultClientEndpointMetric endpointMetric); @Override void dequeueRequest(DefaultClientEndpointMetric endpointMetric, Object taskMetric); @Override void endpointConnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override void endpointDisconnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestEnd(DefaultHttpSocketMetric requestMetric); @Override void responseBegin(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override DefaultHttpSocketMetric responsePushed(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestReset(DefaultHttpSocketMetric requestMetric); @Override void responseEnd(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override Object connected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, WebSocket webSocket); @Override void disconnected(Object webSocketMetric); @Override DefaultHttpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
@Test public void connect() { { Assert.assertSame(endpointMetric_a_1, socketMetric_a_1.getEndpointMetric()); Assert.assertTrue(socketMetric_a_1.isConnected()); Assert.assertEquals(1, socketMetric_a_1.getConnectedTime()); Assert.assertEquals(2, socketMetric_a_1.getEndpointMetric().getConnectCount()); Assert.assertEquals(0, socketMetric_a_1.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(2, socketMetric_a_1.getEndpointMetric().getCurrentConnectionCount()); nanoTime = 2; clientMetrics_a.disconnected(socketMetric_a_1, null); Assert.assertEquals(2, endpointMetric_a_1.getLastNanoTime()); Assert.assertFalse(socketMetric_a_1.isConnected()); Assert.assertEquals(1, socketMetric_a_1.getConnectedTime()); Assert.assertEquals(2, socketMetric_a_1.getEndpointMetric().getConnectCount()); Assert.assertEquals(1, socketMetric_a_1.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(1, socketMetric_a_1.getEndpointMetric().getCurrentConnectionCount()); } { Assert.assertSame(endpointMetric_a_2, socketMetric_a_2.getEndpointMetric()); Assert.assertTrue(socketMetric_a_2.isConnected()); Assert.assertEquals(1, socketMetric_a_2.getConnectedTime()); Assert.assertEquals(2, socketMetric_a_2.getEndpointMetric().getConnectCount()); Assert.assertEquals(0, socketMetric_a_2.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(2, socketMetric_a_2.getEndpointMetric().getCurrentConnectionCount()); nanoTime = 4; clientMetrics_a.disconnected(socketMetric_a_2, null); Assert.assertEquals(4, endpointMetric_a_2.getLastNanoTime()); Assert.assertFalse(socketMetric_a_2.isConnected()); Assert.assertEquals(1, socketMetric_a_2.getConnectedTime()); Assert.assertEquals(2, socketMetric_a_2.getEndpointMetric().getConnectCount()); Assert.assertEquals(1, socketMetric_a_2.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(1, socketMetric_a_2.getEndpointMetric().getCurrentConnectionCount()); } { Assert.assertSame(endpointMetric_b_1, socketMetric_b_1.getEndpointMetric()); Assert.assertTrue(socketMetric_b_1.isConnected()); Assert.assertEquals(1, socketMetric_b_1.getConnectedTime()); Assert.assertEquals(2, socketMetric_b_1.getEndpointMetric().getConnectCount()); Assert.assertEquals(1, socketMetric_b_1.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(1, socketMetric_b_1.getEndpointMetric().getCurrentConnectionCount()); nanoTime = 6; clientMetrics_b.disconnected(socketMetric_b_1, null); Assert.assertEquals(6, endpointMetric_b_1.getLastNanoTime()); Assert.assertFalse(socketMetric_b_1.isConnected()); Assert.assertEquals(1, socketMetric_b_1.getConnectedTime()); Assert.assertEquals(2, socketMetric_b_1.getEndpointMetric().getConnectCount()); Assert.assertEquals(2, socketMetric_b_1.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(0, socketMetric_b_1.getEndpointMetric().getCurrentConnectionCount()); } { Assert.assertSame(endpointMetric_b_2, socketMetric_b_2.getEndpointMetric()); Assert.assertTrue(socketMetric_b_2.isConnected()); Assert.assertEquals(1, socketMetric_b_2.getConnectedTime()); Assert.assertEquals(2, socketMetric_b_2.getEndpointMetric().getConnectCount()); Assert.assertEquals(1, socketMetric_b_2.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(1, socketMetric_b_2.getEndpointMetric().getCurrentConnectionCount()); nanoTime = 7; clientMetrics_b.disconnected(socketMetric_b_2, null); Assert.assertEquals(7, endpointMetric_b_2.getLastNanoTime()); Assert.assertFalse(socketMetric_b_2.isConnected()); Assert.assertEquals(1, socketMetric_b_2.getConnectedTime()); Assert.assertEquals(2, socketMetric_b_2.getEndpointMetric().getConnectCount()); Assert.assertEquals(2, socketMetric_b_2.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(0, socketMetric_b_2.getEndpointMetric().getCurrentConnectionCount()); } }
@Override public void disconnected(Object webSocketMetric) { }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public void disconnected(Object webSocketMetric) { } }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public void disconnected(Object webSocketMetric) { } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public void disconnected(Object webSocketMetric) { } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize); @Override void closeEndpoint(String host, int port, DefaultClientEndpointMetric endpointMetric); @Override Object enqueueRequest(DefaultClientEndpointMetric endpointMetric); @Override void dequeueRequest(DefaultClientEndpointMetric endpointMetric, Object taskMetric); @Override void endpointConnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override void endpointDisconnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestEnd(DefaultHttpSocketMetric requestMetric); @Override void responseBegin(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override DefaultHttpSocketMetric responsePushed(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestReset(DefaultHttpSocketMetric requestMetric); @Override void responseEnd(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override Object connected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, WebSocket webSocket); @Override void disconnected(Object webSocketMetric); @Override DefaultHttpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public void disconnected(Object webSocketMetric) { } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize); @Override void closeEndpoint(String host, int port, DefaultClientEndpointMetric endpointMetric); @Override Object enqueueRequest(DefaultClientEndpointMetric endpointMetric); @Override void dequeueRequest(DefaultClientEndpointMetric endpointMetric, Object taskMetric); @Override void endpointConnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override void endpointDisconnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestEnd(DefaultHttpSocketMetric requestMetric); @Override void responseBegin(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override DefaultHttpSocketMetric responsePushed(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestReset(DefaultHttpSocketMetric requestMetric); @Override void responseEnd(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override Object connected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, WebSocket webSocket); @Override void disconnected(Object webSocketMetric); @Override DefaultHttpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
@Test public void requestBegin(@Mocked HttpClientRequest request) { DefaultHttpSocketMetric socketMetric = clientMetrics_a.connected(address1, host); nanoTime = 2; clientMetrics_a.requestBegin(endpointMetric_a_1, socketMetric, address1, address1, request); nanoTime = 3; clientMetrics_a.requestEnd(socketMetric); Assert.assertEquals(2, socketMetric.getRequestBeginTime()); Assert.assertEquals(3, socketMetric.getRequestEndTime()); }
@Override public DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request) { socketMetric.requestBegin(); return socketMetric; }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request) { socketMetric.requestBegin(); return socketMetric; } }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request) { socketMetric.requestBegin(); return socketMetric; } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request) { socketMetric.requestBegin(); return socketMetric; } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize); @Override void closeEndpoint(String host, int port, DefaultClientEndpointMetric endpointMetric); @Override Object enqueueRequest(DefaultClientEndpointMetric endpointMetric); @Override void dequeueRequest(DefaultClientEndpointMetric endpointMetric, Object taskMetric); @Override void endpointConnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override void endpointDisconnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestEnd(DefaultHttpSocketMetric requestMetric); @Override void responseBegin(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override DefaultHttpSocketMetric responsePushed(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestReset(DefaultHttpSocketMetric requestMetric); @Override void responseEnd(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override Object connected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, WebSocket webSocket); @Override void disconnected(Object webSocketMetric); @Override DefaultHttpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
DefaultHttpClientMetrics implements HttpClientMetrics<DefaultHttpSocketMetric, Object, DefaultHttpSocketMetric, DefaultClientEndpointMetric, Object> { @Override public DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request) { socketMetric.requestBegin(); return socketMetric; } DefaultHttpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultClientEndpointMetric createEndpoint(String host, int port, int maxPoolSize); @Override void closeEndpoint(String host, int port, DefaultClientEndpointMetric endpointMetric); @Override Object enqueueRequest(DefaultClientEndpointMetric endpointMetric); @Override void dequeueRequest(DefaultClientEndpointMetric endpointMetric, Object taskMetric); @Override void endpointConnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override void endpointDisconnected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric); @Override DefaultHttpSocketMetric requestBegin(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestEnd(DefaultHttpSocketMetric requestMetric); @Override void responseBegin(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override DefaultHttpSocketMetric responsePushed(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, SocketAddress localAddress, SocketAddress remoteAddress, HttpClientRequest request); @Override void requestReset(DefaultHttpSocketMetric requestMetric); @Override void responseEnd(DefaultHttpSocketMetric requestMetric, HttpClientResponse response); @Override Object connected(DefaultClientEndpointMetric endpointMetric, DefaultHttpSocketMetric socketMetric, WebSocket webSocket); @Override void disconnected(Object webSocketMetric); @Override DefaultHttpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultHttpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
@SuppressWarnings("deprecation") @Test public void metrics() { MetricsOptions metricsOptions = factory.newOptions(); options.setMetricsOptions(metricsOptions); VertxMetrics vertxMetrics = factory.metrics(options); Assert.assertSame(factory, metricsOptions.getFactory()); Assert.assertTrue(metricsOptions.isEnabled()); Assert.assertSame(factory.getVertxMetrics(), vertxMetrics); Assert.assertTrue(vertxMetrics.isMetricsEnabled()); Assert.assertTrue(vertxMetrics.isEnabled()); }
@Override public synchronized VertxMetrics metrics(VertxOptions options) { if (vertxMetrics == null) { vertxMetrics = new DefaultVertxMetrics(options); } return vertxMetrics; }
DefaultVertxMetricsFactory implements VertxMetricsFactory { @Override public synchronized VertxMetrics metrics(VertxOptions options) { if (vertxMetrics == null) { vertxMetrics = new DefaultVertxMetrics(options); } return vertxMetrics; } }
DefaultVertxMetricsFactory implements VertxMetricsFactory { @Override public synchronized VertxMetrics metrics(VertxOptions options) { if (vertxMetrics == null) { vertxMetrics = new DefaultVertxMetrics(options); } return vertxMetrics; } }
DefaultVertxMetricsFactory implements VertxMetricsFactory { @Override public synchronized VertxMetrics metrics(VertxOptions options) { if (vertxMetrics == null) { vertxMetrics = new DefaultVertxMetrics(options); } return vertxMetrics; } DefaultVertxMetrics getVertxMetrics(); @Override synchronized VertxMetrics metrics(VertxOptions options); @Override MetricsOptions newOptions(); void setVertx(Vertx vertx, VertxOptions options); }
DefaultVertxMetricsFactory implements VertxMetricsFactory { @Override public synchronized VertxMetrics metrics(VertxOptions options) { if (vertxMetrics == null) { vertxMetrics = new DefaultVertxMetrics(options); } return vertxMetrics; } DefaultVertxMetrics getVertxMetrics(); @Override synchronized VertxMetrics metrics(VertxOptions options); @Override MetricsOptions newOptions(); void setVertx(Vertx vertx, VertxOptions options); }
@Test public void expire() { metricsOptionsEx.setCheckClientEndpointMetricExpiredInNano(10); nanoTime = 2; clientMetrics_a.disconnected(socketMetric_a_1, null); clientMetrics_a.disconnected(socketMetric_a_2, null); nanoTime = 13; defaultVertxMetrics.getClientEndpointMetricManager().onCheckClientEndpointMetricExpired(0); Assert.assertNotNull( defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address1.toString())); Assert.assertNotNull( defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address2.toString())); clientMetrics_b.disconnected(socketMetric_b_1, null); clientMetrics_b.disconnected(socketMetric_b_2, null); nanoTime = 23; defaultVertxMetrics.getClientEndpointMetricManager().onCheckClientEndpointMetricExpired(0); Assert.assertNotNull( defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address1.toString())); Assert.assertNotNull( defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address2.toString())); nanoTime = 24; defaultVertxMetrics.getClientEndpointMetricManager().onCheckClientEndpointMetricExpired(0); Assert .assertNull(defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address1.toString())); Assert .assertNull(defaultVertxMetrics.getClientEndpointMetricManager().getClientEndpointMetric(address2.toString())); }
@Override public void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress) { socketMetric.onDisconnect(); }
DefaultTcpClientMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress) { socketMetric.onDisconnect(); } }
DefaultTcpClientMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress) { socketMetric.onDisconnect(); } DefaultTcpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); }
DefaultTcpClientMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress) { socketMetric.onDisconnect(); } DefaultTcpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultTcpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
DefaultTcpClientMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress) { socketMetric.onDisconnect(); } DefaultTcpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultTcpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
@Test public void connect() { { Assert.assertSame(endpointMetric_a_1, socketMetric_a_1.getEndpointMetric()); Assert.assertTrue(socketMetric_a_1.isConnected()); Assert.assertEquals(1, socketMetric_a_1.getConnectedTime()); Assert.assertEquals(2, socketMetric_a_1.getEndpointMetric().getConnectCount()); Assert.assertEquals(0, socketMetric_a_1.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(2, socketMetric_a_1.getEndpointMetric().getCurrentConnectionCount()); nanoTime = 2; clientMetrics_a.disconnected(socketMetric_a_1, null); Assert.assertEquals(2, endpointMetric_a_1.getLastNanoTime()); Assert.assertFalse(socketMetric_a_1.isConnected()); Assert.assertEquals(1, socketMetric_a_1.getConnectedTime()); Assert.assertEquals(2, socketMetric_a_1.getEndpointMetric().getConnectCount()); Assert.assertEquals(1, socketMetric_a_1.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(1, socketMetric_a_1.getEndpointMetric().getCurrentConnectionCount()); } { Assert.assertSame(endpointMetric_a_2, socketMetric_a_2.getEndpointMetric()); Assert.assertTrue(socketMetric_a_2.isConnected()); Assert.assertEquals(1, socketMetric_a_2.getConnectedTime()); Assert.assertEquals(2, socketMetric_a_2.getEndpointMetric().getConnectCount()); Assert.assertEquals(0, socketMetric_a_2.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(2, socketMetric_a_2.getEndpointMetric().getCurrentConnectionCount()); nanoTime = 4; clientMetrics_a.disconnected(socketMetric_a_2, null); Assert.assertEquals(4, endpointMetric_a_2.getLastNanoTime()); Assert.assertFalse(socketMetric_a_2.isConnected()); Assert.assertEquals(1, socketMetric_a_2.getConnectedTime()); Assert.assertEquals(2, socketMetric_a_2.getEndpointMetric().getConnectCount()); Assert.assertEquals(1, socketMetric_a_2.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(1, socketMetric_a_2.getEndpointMetric().getCurrentConnectionCount()); } { Assert.assertSame(endpointMetric_b_1, socketMetric_b_1.getEndpointMetric()); Assert.assertTrue(socketMetric_b_1.isConnected()); Assert.assertEquals(1, socketMetric_b_1.getConnectedTime()); Assert.assertEquals(2, socketMetric_b_1.getEndpointMetric().getConnectCount()); Assert.assertEquals(1, socketMetric_b_1.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(1, socketMetric_b_1.getEndpointMetric().getCurrentConnectionCount()); nanoTime = 6; clientMetrics_b.disconnected(socketMetric_b_1, null); Assert.assertEquals(6, endpointMetric_b_1.getLastNanoTime()); Assert.assertFalse(socketMetric_b_1.isConnected()); Assert.assertEquals(1, socketMetric_b_1.getConnectedTime()); Assert.assertEquals(2, socketMetric_b_1.getEndpointMetric().getConnectCount()); Assert.assertEquals(2, socketMetric_b_1.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(0, socketMetric_b_1.getEndpointMetric().getCurrentConnectionCount()); } { Assert.assertSame(endpointMetric_b_2, socketMetric_b_2.getEndpointMetric()); Assert.assertTrue(socketMetric_b_2.isConnected()); Assert.assertEquals(1, socketMetric_b_2.getConnectedTime()); Assert.assertEquals(2, socketMetric_b_2.getEndpointMetric().getConnectCount()); Assert.assertEquals(1, socketMetric_b_2.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(1, socketMetric_b_2.getEndpointMetric().getCurrentConnectionCount()); nanoTime = 7; clientMetrics_b.disconnected(socketMetric_b_2, null); Assert.assertEquals(7, endpointMetric_b_2.getLastNanoTime()); Assert.assertFalse(socketMetric_b_2.isConnected()); Assert.assertEquals(1, socketMetric_b_2.getConnectedTime()); Assert.assertEquals(2, socketMetric_b_2.getEndpointMetric().getConnectCount()); Assert.assertEquals(2, socketMetric_b_2.getEndpointMetric().getDisconnectCount()); Assert.assertEquals(0, socketMetric_b_2.getEndpointMetric().getCurrentConnectionCount()); } }
@Override public void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress) { socketMetric.onDisconnect(); }
DefaultTcpClientMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress) { socketMetric.onDisconnect(); } }
DefaultTcpClientMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress) { socketMetric.onDisconnect(); } DefaultTcpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); }
DefaultTcpClientMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress) { socketMetric.onDisconnect(); } DefaultTcpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultTcpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
DefaultTcpClientMetrics implements TCPMetrics<DefaultTcpSocketMetric> { @Override public void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress) { socketMetric.onDisconnect(); } DefaultTcpClientMetrics(DefaultClientEndpointMetricManager clientEndpointMetricManager); @Override DefaultTcpSocketMetric connected(SocketAddress remoteAddress, String remoteName); @Override void disconnected(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress); @Override void bytesRead(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void bytesWritten(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, long numberOfBytes); @Override void exceptionOccurred(DefaultTcpSocketMetric socketMetric, SocketAddress remoteAddress, Throwable t); @Override @Deprecated boolean isEnabled(); @Override void close(); }
@Test public void getTransportVertx() { Assert.assertNotNull(SharedVertxFactory.getSharedVertx()); Assert.assertSame(SharedVertxFactory.getSharedVertx(), SharedVertxFactory.getSharedVertx()); SharedVertxFactory.getSharedVertx().close(); }
public static Vertx getSharedVertx() { return VertxUtils.getVertxMap().computeIfAbsent("transport", SharedVertxFactory::createSharedVertx); }
SharedVertxFactory { public static Vertx getSharedVertx() { return VertxUtils.getVertxMap().computeIfAbsent("transport", SharedVertxFactory::createSharedVertx); } }
SharedVertxFactory { public static Vertx getSharedVertx() { return VertxUtils.getVertxMap().computeIfAbsent("transport", SharedVertxFactory::createSharedVertx); } }
SharedVertxFactory { public static Vertx getSharedVertx() { return VertxUtils.getVertxMap().computeIfAbsent("transport", SharedVertxFactory::createSharedVertx); } static DefaultVertxMetricsFactory getMetricsFactory(); static Vertx getSharedVertx(); }
SharedVertxFactory { public static Vertx getSharedVertx() { return VertxUtils.getVertxMap().computeIfAbsent("transport", SharedVertxFactory::createSharedVertx); } static DefaultVertxMetricsFactory getMetricsFactory(); static Vertx getSharedVertx(); }
@Test public void testServiceCombVersion() { ServiceCombVersion version = new ServiceCombVersion(); Assert.assertTrue(version.loadVersion().toString().contains("ServiceComb")); }
@Override public Map<String, String> loadVersion() { Map<String, String> map = new HashMap<>(); map.put("ServiceComb", this.getClass().getPackage().getImplementationVersion()); return map; }
ServiceCombVersion implements Versions { @Override public Map<String, String> loadVersion() { Map<String, String> map = new HashMap<>(); map.put("ServiceComb", this.getClass().getPackage().getImplementationVersion()); return map; } }
ServiceCombVersion implements Versions { @Override public Map<String, String> loadVersion() { Map<String, String> map = new HashMap<>(); map.put("ServiceComb", this.getClass().getPackage().getImplementationVersion()); return map; } }
ServiceCombVersion implements Versions { @Override public Map<String, String> loadVersion() { Map<String, String> map = new HashMap<>(); map.put("ServiceComb", this.getClass().getPackage().getImplementationVersion()); return map; } @Override Map<String, String> loadVersion(); }
ServiceCombVersion implements Versions { @Override public Map<String, String> loadVersion() { Map<String, String> map = new HashMap<>(); map.put("ServiceComb", this.getClass().getPackage().getImplementationVersion()); return map; } @Override Map<String, String> loadVersion(); }
@Test public void testgetBytesFastBufferInputStream() throws IOException { byte[] bytes = new byte[] {1}; ByteBuf byteBuf = Unpooled.wrappedBuffer(bytes); try (BufferInputStream inputStream = new BufferInputStream(byteBuf)) { byte[] result = VertxUtils.getBytesFast(inputStream); Assert.assertSame(bytes, result); } }
public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); static Map<String, Vertx> getVertxMap(); static void deployVerticle(Vertx vertx, Class<T> cls, int instanceCount); static DeploymentOptions createClientDeployOptions( ClientPoolManager<CLIENT_POOL> clientMgr, int instanceCount); static boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls, DeploymentOptions options); static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions); static Vertx init(VertxOptions vertxOptions); static Vertx init(String name, VertxOptions vertxOptions); static byte[] getBytesFast(InputStream inputStream); static byte[] getBytesFast(Buffer buffer); static byte[] getBytesFast(ByteBuf byteBuf); static CompletableFuture<Void> closeVertxByName(String name); static void blockCloseVertxByName(String name); static void blockCloseVertx(Vertx vertx); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); static Map<String, Vertx> getVertxMap(); static void deployVerticle(Vertx vertx, Class<T> cls, int instanceCount); static DeploymentOptions createClientDeployOptions( ClientPoolManager<CLIENT_POOL> clientMgr, int instanceCount); static boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls, DeploymentOptions options); static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions); static Vertx init(VertxOptions vertxOptions); static Vertx init(String name, VertxOptions vertxOptions); static byte[] getBytesFast(InputStream inputStream); static byte[] getBytesFast(Buffer buffer); static byte[] getBytesFast(ByteBuf byteBuf); static CompletableFuture<Void> closeVertxByName(String name); static void blockCloseVertxByName(String name); static void blockCloseVertx(Vertx vertx); }
@Test public void testgetBytesFastNormalInputStream() throws IOException { byte[] bytes = new byte[] {1}; try (InputStream inputStream = new ByteArrayInputStream(bytes)) { byte[] result = VertxUtils.getBytesFast(inputStream); Assert.assertEquals(1, result[0]); } }
public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); static Map<String, Vertx> getVertxMap(); static void deployVerticle(Vertx vertx, Class<T> cls, int instanceCount); static DeploymentOptions createClientDeployOptions( ClientPoolManager<CLIENT_POOL> clientMgr, int instanceCount); static boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls, DeploymentOptions options); static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions); static Vertx init(VertxOptions vertxOptions); static Vertx init(String name, VertxOptions vertxOptions); static byte[] getBytesFast(InputStream inputStream); static byte[] getBytesFast(Buffer buffer); static byte[] getBytesFast(ByteBuf byteBuf); static CompletableFuture<Void> closeVertxByName(String name); static void blockCloseVertxByName(String name); static void blockCloseVertx(Vertx vertx); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); static Map<String, Vertx> getVertxMap(); static void deployVerticle(Vertx vertx, Class<T> cls, int instanceCount); static DeploymentOptions createClientDeployOptions( ClientPoolManager<CLIENT_POOL> clientMgr, int instanceCount); static boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls, DeploymentOptions options); static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions); static Vertx init(VertxOptions vertxOptions); static Vertx init(String name, VertxOptions vertxOptions); static byte[] getBytesFast(InputStream inputStream); static byte[] getBytesFast(Buffer buffer); static byte[] getBytesFast(ByteBuf byteBuf); static CompletableFuture<Void> closeVertxByName(String name); static void blockCloseVertxByName(String name); static void blockCloseVertx(Vertx vertx); }
@Test public void testgetBytesFastBuffer() { Buffer buffer = Buffer.buffer(); buffer.appendByte((byte) 1); byte[] result = VertxUtils.getBytesFast(buffer); Assert.assertEquals(1, result[0]); }
public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); static Map<String, Vertx> getVertxMap(); static void deployVerticle(Vertx vertx, Class<T> cls, int instanceCount); static DeploymentOptions createClientDeployOptions( ClientPoolManager<CLIENT_POOL> clientMgr, int instanceCount); static boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls, DeploymentOptions options); static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions); static Vertx init(VertxOptions vertxOptions); static Vertx init(String name, VertxOptions vertxOptions); static byte[] getBytesFast(InputStream inputStream); static byte[] getBytesFast(Buffer buffer); static byte[] getBytesFast(ByteBuf byteBuf); static CompletableFuture<Void> closeVertxByName(String name); static void blockCloseVertxByName(String name); static void blockCloseVertx(Vertx vertx); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); static Map<String, Vertx> getVertxMap(); static void deployVerticle(Vertx vertx, Class<T> cls, int instanceCount); static DeploymentOptions createClientDeployOptions( ClientPoolManager<CLIENT_POOL> clientMgr, int instanceCount); static boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls, DeploymentOptions options); static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions); static Vertx init(VertxOptions vertxOptions); static Vertx init(String name, VertxOptions vertxOptions); static byte[] getBytesFast(InputStream inputStream); static byte[] getBytesFast(Buffer buffer); static byte[] getBytesFast(ByteBuf byteBuf); static CompletableFuture<Void> closeVertxByName(String name); static void blockCloseVertxByName(String name); static void blockCloseVertx(Vertx vertx); }
@Test public void testgetBytesFastByteBufHasArray() { byte[] bytes = new byte[] {1}; ByteBuf byteBuf = Unpooled.wrappedBuffer(bytes); byte[] result = VertxUtils.getBytesFast(byteBuf); Assert.assertSame(bytes, result); }
public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); static Map<String, Vertx> getVertxMap(); static void deployVerticle(Vertx vertx, Class<T> cls, int instanceCount); static DeploymentOptions createClientDeployOptions( ClientPoolManager<CLIENT_POOL> clientMgr, int instanceCount); static boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls, DeploymentOptions options); static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions); static Vertx init(VertxOptions vertxOptions); static Vertx init(String name, VertxOptions vertxOptions); static byte[] getBytesFast(InputStream inputStream); static byte[] getBytesFast(Buffer buffer); static byte[] getBytesFast(ByteBuf byteBuf); static CompletableFuture<Void> closeVertxByName(String name); static void blockCloseVertxByName(String name); static void blockCloseVertx(Vertx vertx); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); static Map<String, Vertx> getVertxMap(); static void deployVerticle(Vertx vertx, Class<T> cls, int instanceCount); static DeploymentOptions createClientDeployOptions( ClientPoolManager<CLIENT_POOL> clientMgr, int instanceCount); static boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls, DeploymentOptions options); static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions); static Vertx init(VertxOptions vertxOptions); static Vertx init(String name, VertxOptions vertxOptions); static byte[] getBytesFast(InputStream inputStream); static byte[] getBytesFast(Buffer buffer); static byte[] getBytesFast(ByteBuf byteBuf); static CompletableFuture<Void> closeVertxByName(String name); static void blockCloseVertxByName(String name); static void blockCloseVertx(Vertx vertx); }
@Test public void testgetBytesFastByteBufCopy() { ByteBuf byteBuf = Unpooled.directBuffer(); byteBuf.writeByte(1); Assert.assertFalse(byteBuf.hasArray()); byte[] result = VertxUtils.getBytesFast(byteBuf); Assert.assertEquals(1, result[0]); byteBuf.release(); }
public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); static Map<String, Vertx> getVertxMap(); static void deployVerticle(Vertx vertx, Class<T> cls, int instanceCount); static DeploymentOptions createClientDeployOptions( ClientPoolManager<CLIENT_POOL> clientMgr, int instanceCount); static boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls, DeploymentOptions options); static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions); static Vertx init(VertxOptions vertxOptions); static Vertx init(String name, VertxOptions vertxOptions); static byte[] getBytesFast(InputStream inputStream); static byte[] getBytesFast(Buffer buffer); static byte[] getBytesFast(ByteBuf byteBuf); static CompletableFuture<Void> closeVertxByName(String name); static void blockCloseVertxByName(String name); static void blockCloseVertx(Vertx vertx); }
VertxUtils { public static byte[] getBytesFast(InputStream inputStream) throws IOException { if (BufferInputStream.class.isInstance(inputStream)) { return getBytesFast(((BufferInputStream) inputStream).getByteBuf()); } return IOUtils.toByteArray(inputStream); } private VertxUtils(); static Map<String, Vertx> getVertxMap(); static void deployVerticle(Vertx vertx, Class<T> cls, int instanceCount); static DeploymentOptions createClientDeployOptions( ClientPoolManager<CLIENT_POOL> clientMgr, int instanceCount); static boolean blockDeploy(Vertx vertx, Class<VERTICLE> cls, DeploymentOptions options); static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions); static Vertx init(VertxOptions vertxOptions); static Vertx init(String name, VertxOptions vertxOptions); static byte[] getBytesFast(InputStream inputStream); static byte[] getBytesFast(Buffer buffer); static byte[] getBytesFast(ByteBuf byteBuf); static CompletableFuture<Void> closeVertxByName(String name); static void blockCloseVertxByName(String name); static void blockCloseVertx(Vertx vertx); }
@Test public void testRead() { Assert.assertEquals(0, instance.read()); }
@Override public int read() { return byteBuf.readUnsignedByte(); }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testReadByteArray() throws UnsupportedEncodingException { byte[] b = "csr".getBytes("UTF-8"); Assert.assertEquals(-1, instance.read(b)); }
@Override public int read() { return byteBuf.readUnsignedByte(); }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testReadByteArrayIntInt() throws UnsupportedEncodingException { byte[] b = "csr".getBytes("UTF-8"); Assert.assertEquals(-1, instance.read(b, 1, 0)); }
@Override public int read() { return byteBuf.readUnsignedByte(); }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { @Override public int read() { return byteBuf.readUnsignedByte(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testSkip() { Assert.assertEquals(0, instance.skip(1)); }
@Override public long skip(long len) { int skipLen = Math.min((int) len, available()); byteBuf.skipBytes(skipLen); return skipLen; }
BufferInputStream extends ServletInputStream { @Override public long skip(long len) { int skipLen = Math.min((int) len, available()); byteBuf.skipBytes(skipLen); return skipLen; } }
BufferInputStream extends ServletInputStream { @Override public long skip(long len) { int skipLen = Math.min((int) len, available()); byteBuf.skipBytes(skipLen); return skipLen; } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { @Override public long skip(long len) { int skipLen = Math.min((int) len, available()); byteBuf.skipBytes(skipLen); return skipLen; } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { @Override public long skip(long len) { int skipLen = Math.min((int) len, available()); byteBuf.skipBytes(skipLen); return skipLen; } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testAvailable() { Assert.assertEquals(0, instance.available()); }
@Override public int available() { return byteBuf.readableBytes(); }
BufferInputStream extends ServletInputStream { @Override public int available() { return byteBuf.readableBytes(); } }
BufferInputStream extends ServletInputStream { @Override public int available() { return byteBuf.readableBytes(); } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { @Override public int available() { return byteBuf.readableBytes(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { @Override public int available() { return byteBuf.readableBytes(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testDefaultValues() { Assert.assertNull(oRegisterInstanceRequest.getInstance()); }
public MicroserviceInstance getInstance() { return instance; }
RegisterInstanceRequest { public MicroserviceInstance getInstance() { return instance; } }
RegisterInstanceRequest { public MicroserviceInstance getInstance() { return instance; } }
RegisterInstanceRequest { public MicroserviceInstance getInstance() { return instance; } MicroserviceInstance getInstance(); void setInstance(MicroserviceInstance instance); }
RegisterInstanceRequest { public MicroserviceInstance getInstance() { return instance; } MicroserviceInstance getInstance(); void setInstance(MicroserviceInstance instance); }
@Test public void testClose() { try { instance.close(); } catch (Exception e) { Assert.assertTrue(false); } }
@Override public void close() { byteBuf.release(); }
BufferInputStream extends ServletInputStream { @Override public void close() { byteBuf.release(); } }
BufferInputStream extends ServletInputStream { @Override public void close() { byteBuf.release(); } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { @Override public void close() { byteBuf.release(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { @Override public void close() { byteBuf.release(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testBufferInputStream() { Assert.assertNotNull(instance); }
public BufferInputStream(ByteBuf buffer) { this.byteBuf = buffer; }
BufferInputStream extends ServletInputStream { public BufferInputStream(ByteBuf buffer) { this.byteBuf = buffer; } }
BufferInputStream extends ServletInputStream { public BufferInputStream(ByteBuf buffer) { this.byteBuf = buffer; } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { public BufferInputStream(ByteBuf buffer) { this.byteBuf = buffer; } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { public BufferInputStream(ByteBuf buffer) { this.byteBuf = buffer; } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testReadBoolean() { Assert.assertEquals(false, instance.readBoolean()); }
public boolean readBoolean() { return byteBuf.readBoolean(); }
BufferInputStream extends ServletInputStream { public boolean readBoolean() { return byteBuf.readBoolean(); } }
BufferInputStream extends ServletInputStream { public boolean readBoolean() { return byteBuf.readBoolean(); } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { public boolean readBoolean() { return byteBuf.readBoolean(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { public boolean readBoolean() { return byteBuf.readBoolean(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testReadShort() { Assert.assertEquals(0, instance.readShort()); }
public short readShort() { return byteBuf.readShort(); }
BufferInputStream extends ServletInputStream { public short readShort() { return byteBuf.readShort(); } }
BufferInputStream extends ServletInputStream { public short readShort() { return byteBuf.readShort(); } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { public short readShort() { return byteBuf.readShort(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { public short readShort() { return byteBuf.readShort(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testReadInt() { Assert.assertEquals(0, instance.readInt()); }
public int readInt() { return byteBuf.readInt(); }
BufferInputStream extends ServletInputStream { public int readInt() { return byteBuf.readInt(); } }
BufferInputStream extends ServletInputStream { public int readInt() { return byteBuf.readInt(); } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { public int readInt() { return byteBuf.readInt(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { public int readInt() { return byteBuf.readInt(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testReadLong() { Assert.assertEquals(0, instance.readLong()); }
public long readLong() { return byteBuf.readLong(); }
BufferInputStream extends ServletInputStream { public long readLong() { return byteBuf.readLong(); } }
BufferInputStream extends ServletInputStream { public long readLong() { return byteBuf.readLong(); } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { public long readLong() { return byteBuf.readLong(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { public long readLong() { return byteBuf.readLong(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testGetIndex() { Assert.assertEquals(0, instance.getIndex()); }
public int getIndex() { return byteBuf.readerIndex(); }
BufferInputStream extends ServletInputStream { public int getIndex() { return byteBuf.readerIndex(); } }
BufferInputStream extends ServletInputStream { public int getIndex() { return byteBuf.readerIndex(); } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { public int getIndex() { return byteBuf.readerIndex(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { public int getIndex() { return byteBuf.readerIndex(); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testReadString() { Assert.assertNotNull(instance.readString()); }
public String readString() { int length = readInt(); byte[] bytes = new byte[length]; byteBuf.readBytes(bytes); return new String(bytes, StandardCharsets.UTF_8); }
BufferInputStream extends ServletInputStream { public String readString() { int length = readInt(); byte[] bytes = new byte[length]; byteBuf.readBytes(bytes); return new String(bytes, StandardCharsets.UTF_8); } }
BufferInputStream extends ServletInputStream { public String readString() { int length = readInt(); byte[] bytes = new byte[length]; byteBuf.readBytes(bytes); return new String(bytes, StandardCharsets.UTF_8); } BufferInputStream(ByteBuf buffer); }
BufferInputStream extends ServletInputStream { public String readString() { int length = readInt(); byte[] bytes = new byte[length]; byteBuf.readBytes(bytes); return new String(bytes, StandardCharsets.UTF_8); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
BufferInputStream extends ServletInputStream { public String readString() { int length = readInt(); byte[] bytes = new byte[length]; byteBuf.readBytes(bytes); return new String(bytes, StandardCharsets.UTF_8); } BufferInputStream(ByteBuf buffer); @Override long skip(long len); byte readByte(); @Override int read(); boolean readBoolean(); short readShort(); int readInt(); long readLong(); int getIndex(); String readString(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override int available(); @Override void close(); @Override void reset(); ByteBuf getByteBuf(); @Override boolean isFinished(); @Override boolean isReady(); @Override void setReadListener(ReadListener readListener); }
@Test public void testGetResoverFromResource(@Mocked Configuration finalConfig) { ArchaiusUtils.resetConfig(); ArchaiusUtils.setProperty("addressResolver.servers", "8.8.8.8,8.8.4.4"); new Expectations() { { finalConfig.getStringArray("addressResolver.servers"); result = new String[] {"6.6.6.6", "6.6.4.4"}; finalConfig.getStringArray("addressResolver.searchDomains"); result = new String[] {"default.svc.local.cluster"}; finalConfig.getInteger("addressResolver.queryTimeout", null); result = 2000; finalConfig.getInteger("addressResolver.maxQueries", null); result = -2; } }; AddressResolverOptions aroc = AddressResolverConfig.getAddressResover("test", finalConfig); Assert.assertThat(aroc.getServers(), is(Arrays.asList("6.6.6.6", "6.6.4.4"))); Assert.assertThat(aroc.getSearchDomains(), is(Arrays.asList("default.svc.local.cluster"))); Assert.assertEquals(aroc.getQueryTimeout(), 2000); Assert.assertNotEquals(aroc.getMaxQueries(), -2); }
public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } static AddressResolverOptions getAddressResover(String tag); static AddressResolverOptions getAddressResover(String tag, Configuration configSource); }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } static AddressResolverOptions getAddressResover(String tag); static AddressResolverOptions getAddressResover(String tag, Configuration configSource); }
@Test public void testGetResover() { ArchaiusUtils.resetConfig(); ArchaiusUtils.setProperty("addressResolver.servers", "8.8.8.8,8.8.4.4"); ArchaiusUtils.setProperty("addressResolver.optResourceEnabled", true); ArchaiusUtils.setProperty("addressResolver.cacheMinTimeToLive", 0); ArchaiusUtils.setProperty("addressResolver.cacheMaxTimeToLive", 10000); ArchaiusUtils.setProperty("addressResolver.cacheNegativeTimeToLive", 0); ArchaiusUtils.setProperty("addressResolver.queryTimeout", 1000); ArchaiusUtils.setProperty("addressResolver.maxQueries", 3); ArchaiusUtils.setProperty("addressResolver.test.maxQueries", 3); ArchaiusUtils.setProperty("addressResolver.rdFlag", true); ArchaiusUtils.setProperty("addressResolver.searchDomains", "default.svc.local.cluster,svc.local.cluster,local.cluster"); ArchaiusUtils.setProperty("addressResolver.test.searchDomains", "test.svc.local.cluster,svc.local.cluster,local.cluster"); ArchaiusUtils.setProperty("addressResolver.ndots", 3); ArchaiusUtils.setProperty("addressResolver.rotateServers", true); AddressResolverOptions aroc = AddressResolverConfig.getAddressResover("test"); Assert.assertThat(aroc.getServers(), is(Arrays.asList("8.8.8.8", "8.8.4.4"))); Assert.assertThat(aroc.getSearchDomains(), is(Arrays.asList("test.svc.local.cluster", "svc.local.cluster", "local.cluster"))); AddressResolverOptions aroc1 = AddressResolverConfig.getAddressResover("test1"); Assert.assertThat(aroc1.getSearchDomains(), is(Arrays.asList("default.svc.local.cluster", "svc.local.cluster", "local.cluster"))); }
public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } static AddressResolverOptions getAddressResover(String tag); static AddressResolverOptions getAddressResover(String tag, Configuration configSource); }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } static AddressResolverOptions getAddressResover(String tag); static AddressResolverOptions getAddressResover(String tag, Configuration configSource); }
@Test public void testInitializedValues() { initRegisterInstanceRequest(); Assert.assertEquals(oMockMicroserviceInstance, oRegisterInstanceRequest.getInstance()); }
public MicroserviceInstance getInstance() { return instance; }
RegisterInstanceRequest { public MicroserviceInstance getInstance() { return instance; } }
RegisterInstanceRequest { public MicroserviceInstance getInstance() { return instance; } }
RegisterInstanceRequest { public MicroserviceInstance getInstance() { return instance; } MicroserviceInstance getInstance(); void setInstance(MicroserviceInstance instance); }
RegisterInstanceRequest { public MicroserviceInstance getInstance() { return instance; } MicroserviceInstance getInstance(); void setInstance(MicroserviceInstance instance); }
@Test public void testGetResoverDefault() { ArchaiusUtils.resetConfig(); ArchaiusUtils.setProperty("addressResolver.servers", "8.8.8.8,8.8.4.4"); ArchaiusUtils.setProperty("addressResolver.maxQueries", 3); ArchaiusUtils.setProperty("addressResolver.rdFlag", false); AddressResolverOptions aroc = AddressResolverConfig.getAddressResover("test"); Assert.assertThat(aroc.getServers(), is(Arrays.asList("8.8.8.8", "8.8.4.4"))); Assert.assertEquals(3, aroc.getMaxQueries()); Assert.assertEquals(Integer.MAX_VALUE, aroc.getCacheMaxTimeToLive()); Assert.assertTrue(aroc.isOptResourceEnabled()); Assert.assertNull(aroc.getSearchDomains()); }
public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } static AddressResolverOptions getAddressResover(String tag); static AddressResolverOptions getAddressResover(String tag, Configuration configSource); }
AddressResolverConfig { public static AddressResolverOptions getAddressResover(String tag) { return getAddressResover(tag, null); } static AddressResolverOptions getAddressResover(String tag); static AddressResolverOptions getAddressResover(String tag, Configuration configSource); }
@Test public void createClientPool(@Mocked HttpClientWithContext pool) { new Expectations(VertxImpl.class) { { factory.createClientPool(context); result = pool; } }; Assert.assertSame(pool, poolMgr.createClientPool(context)); Assert.assertSame(pool, context.get(id)); Assert.assertThat(pools, Matchers.contains(pool)); }
public CLIENT_POOL createClientPool(Context context) { CLIENT_POOL pool = factory.createClientPool(context); addPool(context, pool); return pool; }
ClientPoolManager { public CLIENT_POOL createClientPool(Context context) { CLIENT_POOL pool = factory.createClientPool(context); addPool(context, pool); return pool; } }
ClientPoolManager { public CLIENT_POOL createClientPool(Context context) { CLIENT_POOL pool = factory.createClientPool(context); addPool(context, pool); return pool; } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); }
ClientPoolManager { public CLIENT_POOL createClientPool(Context context) { CLIENT_POOL pool = factory.createClientPool(context); addPool(context, pool); return pool; } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
ClientPoolManager { public CLIENT_POOL createClientPool(Context context) { CLIENT_POOL pool = factory.createClientPool(context); addPool(context, pool); return pool; } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
@Test public void findThreadBindClientPool(@Mocked HttpClientWithContext pool1, @Mocked HttpClientWithContext pool2) { pools.add(pool1); pools.add(pool2); new MockUp<Thread>() { @Mock long getId() { return 0; } }; Assert.assertSame(pool1, poolMgr.findThreadBindClientPool()); Assert.assertSame(pool1, poolMgr.findThreadBindClientPool()); new MockUp<Thread>() { @Mock long getId() { return 1; } }; Assert.assertSame(pool2, poolMgr.findThreadBindClientPool()); Assert.assertSame(pool2, poolMgr.findThreadBindClientPool()); }
public CLIENT_POOL findThreadBindClientPool() { assertPoolsInitialized(); int idx = (int) (Thread.currentThread().getId() % pools.size()); return pools.get(idx); }
ClientPoolManager { public CLIENT_POOL findThreadBindClientPool() { assertPoolsInitialized(); int idx = (int) (Thread.currentThread().getId() % pools.size()); return pools.get(idx); } }
ClientPoolManager { public CLIENT_POOL findThreadBindClientPool() { assertPoolsInitialized(); int idx = (int) (Thread.currentThread().getId() % pools.size()); return pools.get(idx); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); }
ClientPoolManager { public CLIENT_POOL findThreadBindClientPool() { assertPoolsInitialized(); int idx = (int) (Thread.currentThread().getId() % pools.size()); return pools.get(idx); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
ClientPoolManager { public CLIENT_POOL findThreadBindClientPool() { assertPoolsInitialized(); int idx = (int) (Thread.currentThread().getId() % pools.size()); return pools.get(idx); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
@Test public void findByContext_wrongContext_reverse() { HttpClientWithContext pool1 = new HttpClientWithContext(null, null); HttpClientWithContext pool2 = new HttpClientWithContext(null, null); pools.add(pool1); pools.add(pool2); new Expectations() { { Vertx.currentContext(); result = null; } }; AtomicInteger reactiveNextIndex = Deencapsulation.getField(poolMgr, "reactiveNextIndex"); reactiveNextIndex.set(Integer.MAX_VALUE); Assert.assertSame(pool2, poolMgr.findByContext()); Assert.assertSame(pool1, poolMgr.findByContext()); Assert.assertSame(pool2, poolMgr.findByContext()); Assert.assertSame(pool1, poolMgr.findByContext()); }
protected CLIENT_POOL findByContext() { return findByContext(null); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
@Test public void findByContext_normalThread() { HttpClientWithContext pool = new HttpClientWithContext(null, null); pools.add(pool); new Expectations() { { Vertx.currentContext(); result = null; } }; Assert.assertSame(pool, poolMgr.findByContext()); }
protected CLIENT_POOL findByContext() { return findByContext(null); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
@Test public void findByContext_otherVertx(@Mocked VertxImpl otherVertx, @Mocked Context otherContext) { HttpClientWithContext pool = new HttpClientWithContext(null, null); pools.add(pool); new Expectations() { { Vertx.currentContext(); result = otherContext; otherContext.owner(); result = otherVertx; } }; Assert.assertSame(pool, poolMgr.findByContext()); }
protected CLIENT_POOL findByContext() { return findByContext(null); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
@Test public void findByContext_worker(@Mocked Context workerContext) { HttpClientWithContext pool = new HttpClientWithContext(null, null); pools.add(pool); new Expectations() { { Vertx.currentContext(); result = workerContext; workerContext.owner(); result = vertx; workerContext.isEventLoopContext(); result = false; } }; Assert.assertSame(pool, poolMgr.findByContext()); }
protected CLIENT_POOL findByContext() { return findByContext(null); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
ClientPoolManager { protected CLIENT_POOL findByContext() { return findByContext(null); } ClientPoolManager(Vertx vertx, ClientPoolFactory<CLIENT_POOL> factory); CLIENT_POOL createClientPool(Context context); CLIENT_POOL findClientPool(boolean sync); CLIENT_POOL findClientPool(boolean sync, Context targetContext); CLIENT_POOL findThreadBindClientPool(); }
@Test public void createClientPool(@Mocked VertxInternal vertx, @Mocked ContextInternal context, @Mocked HttpClient httpClient) { new Expectations(VertxImpl.class) { { context.owner(); result = vertx; vertx.createHttpClient(httpClientOptions); result = httpClient; } }; HttpClientWithContext pool = factory.createClientPool(context); Assert.assertSame(context, pool.context()); Assert.assertSame(httpClient, pool.getHttpClient()); }
@Override public HttpClientWithContext createClientPool(Context context) { HttpClient httpClient = context.owner().createHttpClient(httpClientOptions); httpClient.connectionHandler(connection -> { LOGGER.debug("http connection connected, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()); connection.closeHandler(v -> LOGGER.debug("http connection closed, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()) ); connection.exceptionHandler(e -> LOGGER.info("http connection exception, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress(), e) ); }); return new HttpClientWithContext(httpClient, context); }
HttpClientPoolFactory implements ClientPoolFactory<HttpClientWithContext> { @Override public HttpClientWithContext createClientPool(Context context) { HttpClient httpClient = context.owner().createHttpClient(httpClientOptions); httpClient.connectionHandler(connection -> { LOGGER.debug("http connection connected, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()); connection.closeHandler(v -> LOGGER.debug("http connection closed, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()) ); connection.exceptionHandler(e -> LOGGER.info("http connection exception, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress(), e) ); }); return new HttpClientWithContext(httpClient, context); } }
HttpClientPoolFactory implements ClientPoolFactory<HttpClientWithContext> { @Override public HttpClientWithContext createClientPool(Context context) { HttpClient httpClient = context.owner().createHttpClient(httpClientOptions); httpClient.connectionHandler(connection -> { LOGGER.debug("http connection connected, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()); connection.closeHandler(v -> LOGGER.debug("http connection closed, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()) ); connection.exceptionHandler(e -> LOGGER.info("http connection exception, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress(), e) ); }); return new HttpClientWithContext(httpClient, context); } HttpClientPoolFactory(HttpClientOptions httpClientOptions); }
HttpClientPoolFactory implements ClientPoolFactory<HttpClientWithContext> { @Override public HttpClientWithContext createClientPool(Context context) { HttpClient httpClient = context.owner().createHttpClient(httpClientOptions); httpClient.connectionHandler(connection -> { LOGGER.debug("http connection connected, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()); connection.closeHandler(v -> LOGGER.debug("http connection closed, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()) ); connection.exceptionHandler(e -> LOGGER.info("http connection exception, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress(), e) ); }); return new HttpClientWithContext(httpClient, context); } HttpClientPoolFactory(HttpClientOptions httpClientOptions); @Override HttpClientWithContext createClientPool(Context context); }
HttpClientPoolFactory implements ClientPoolFactory<HttpClientWithContext> { @Override public HttpClientWithContext createClientPool(Context context) { HttpClient httpClient = context.owner().createHttpClient(httpClientOptions); httpClient.connectionHandler(connection -> { LOGGER.debug("http connection connected, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()); connection.closeHandler(v -> LOGGER.debug("http connection closed, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()) ); connection.exceptionHandler(e -> LOGGER.info("http connection exception, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress(), e) ); }); return new HttpClientWithContext(httpClient, context); } HttpClientPoolFactory(HttpClientOptions httpClientOptions); @Override HttpClientWithContext createClientPool(Context context); }
@Test public void createLogin() { Assert.assertNull(tcpClientConnection.createLogin()); }
protected TcpOutputStream createLogin() { return null; }
TcpClientConnection extends TcpConnection { protected TcpOutputStream createLogin() { return null; } }
TcpClientConnection extends TcpConnection { protected TcpOutputStream createLogin() { return null; } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); }
TcpClientConnection extends TcpConnection { protected TcpOutputStream createLogin() { return null; } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
TcpClientConnection extends TcpConnection { protected TcpOutputStream createLogin() { return null; } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
@Test public void onLoginResponse_buffer() { Assert.assertTrue(tcpClientConnection.onLoginResponse(null)); }
protected boolean onLoginResponse(Buffer bodyBuffer) { return true; }
TcpClientConnection extends TcpConnection { protected boolean onLoginResponse(Buffer bodyBuffer) { return true; } }
TcpClientConnection extends TcpConnection { protected boolean onLoginResponse(Buffer bodyBuffer) { return true; } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); }
TcpClientConnection extends TcpConnection { protected boolean onLoginResponse(Buffer bodyBuffer) { return true; } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
TcpClientConnection extends TcpConnection { protected boolean onLoginResponse(Buffer bodyBuffer) { return true; } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
@Test public void testDefaultValues() { Assert.assertNull(oCreateServiceRequest.getService()); }
public Microservice getService() { return service; }
CreateServiceRequest { public Microservice getService() { return service; } }
CreateServiceRequest { public Microservice getService() { return service; } }
CreateServiceRequest { public Microservice getService() { return service; } Microservice getService(); void setService(Microservice service); }
CreateServiceRequest { public Microservice getService() { return service; } Microservice getService(); void setService(Microservice service); }
@Test public void testCalcMeasurements(@Mocked Id id, @Mocked Runtime runtime, @Mocked RuntimeMXBean mxBean, @Mocked CharSource charSource) throws IOException { List<Measurement> measurements = new ArrayList<>(); new MockUp<Files>() { @Mock public CharSource asCharSource(File file, Charset encoding) { return charSource; } }; new MockUp<CpuUtils>() { @Mock public int calcHertz() { return 4; } }; new MockUp<ManagementFactory>() { @Mock RuntimeMXBean getRuntimeMXBean() { return mxBean; } }; new MockUp<Runtime>() { @Mock public Runtime getRuntime() { return runtime; } }; new Expectations() { { runtime.availableProcessors(); result = 2; charSource.readFirstLine(); result = "1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1"; } }; CpuMeter cpuMeter = new CpuMeter(id); new Expectations() { { charSource.readFirstLine(); result = "2 2 2 2 2 2 2 2 2 0 0 2 2 2 2 2 2 2 2 2 2"; } }; cpuMeter.calcMeasurements(measurements, 0); Assert.assertEquals(2, measurements.size()); Measurement measurement = measurements.get(0); Assert.assertEquals(0, measurement.timestamp()); Assert.assertEquals(0.875, measurement.value(), 0.0); measurement = measurements.get(1); Assert.assertEquals(0, measurement.timestamp()); Assert.assertEquals(0.5, measurement.value(), 0.0); }
public void calcMeasurements(List<Measurement> measurements, long msNow) { update(); measurements.add(new Measurement(allCpuUsage.getId(), msNow, allCpuUsage.getUsage())); measurements.add(new Measurement(processCpuUsage.getId(), msNow, processCpuUsage.getUsage())); }
CpuMeter { public void calcMeasurements(List<Measurement> measurements, long msNow) { update(); measurements.add(new Measurement(allCpuUsage.getId(), msNow, allCpuUsage.getUsage())); measurements.add(new Measurement(processCpuUsage.getId(), msNow, processCpuUsage.getUsage())); } }
CpuMeter { public void calcMeasurements(List<Measurement> measurements, long msNow) { update(); measurements.add(new Measurement(allCpuUsage.getId(), msNow, allCpuUsage.getUsage())); measurements.add(new Measurement(processCpuUsage.getId(), msNow, processCpuUsage.getUsage())); } CpuMeter(Id id); }
CpuMeter { public void calcMeasurements(List<Measurement> measurements, long msNow) { update(); measurements.add(new Measurement(allCpuUsage.getId(), msNow, allCpuUsage.getUsage())); measurements.add(new Measurement(processCpuUsage.getId(), msNow, processCpuUsage.getUsage())); } CpuMeter(Id id); void calcMeasurements(List<Measurement> measurements, long msNow); void update(); OsCpuUsage getAllCpuUsage(); ProcessCpuUsage getProcessCpuUsage(); }
CpuMeter { public void calcMeasurements(List<Measurement> measurements, long msNow) { update(); measurements.add(new Measurement(allCpuUsage.getId(), msNow, allCpuUsage.getUsage())); measurements.add(new Measurement(processCpuUsage.getId(), msNow, processCpuUsage.getUsage())); } CpuMeter(Id id); void calcMeasurements(List<Measurement> measurements, long msNow); void update(); OsCpuUsage getAllCpuUsage(); ProcessCpuUsage getProcessCpuUsage(); }
@Test public void send_inWorkingStatus(@Mocked AbstractTcpClientPackage tcpClientPackage, @Mocked TcpOutputStream tcpOutputStream) { Deencapsulation.setField(tcpClientConnection, "status", Status.WORKING); long msgId = 1; ByteBuf byteBuf = Unpooled.buffer(); new Expectations(tcpClientConnection) { { tcpClientPackage.getMsgId(); result = msgId; tcpClientPackage.createStream(); result = tcpOutputStream; tcpOutputStream.getByteBuf(); result = byteBuf; } }; new MockUp<Context>(context) { @Mock void runOnContext(Handler<Void> action) { } }; tcpClientConnection.send(tcpClientPackage, ar -> { }); Assert.assertSame(byteBuf, writeQueue.poll()); Assert.assertNull(writeQueue.poll()); Assert.assertEquals(Status.WORKING, Deencapsulation.getField(tcpClientConnection, "status")); }
public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
@Test public void send_inDisconnectedStatus(@Mocked AbstractTcpClientPackage tcpClientPackage, @Mocked TcpOutputStream tcpOutputStream) { long msgId = 1; new Expectations(tcpClientConnection) { { tcpClientPackage.getMsgId(); result = msgId; } }; new MockUp<Context>(context) { @Mock void runOnContext(Handler<Void> action) { action.handle(null); } }; tcpClientConnection.send(tcpClientPackage, ar -> { }); Assert.assertSame(tcpClientPackage, packageQueue.poll()); Assert.assertNull(packageQueue.poll()); Assert.assertEquals(Status.CONNECTING, Deencapsulation.getField(tcpClientConnection, "status")); }
public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
@Test public void send_disconnectedToTryLogin(@Mocked AbstractTcpClientPackage tcpClientPackage, @Mocked TcpOutputStream tcpOutputStream) { long msgId = 1; new Expectations(tcpClientConnection) { { tcpClientPackage.getMsgId(); result = msgId; } }; new MockUp<Context>(context) { @Mock void runOnContext(Handler<Void> action) { Deencapsulation.setField(tcpClientConnection, "status", Status.TRY_LOGIN); action.handle(null); } }; tcpClientConnection.send(tcpClientPackage, ar -> { }); Assert.assertSame(tcpClientPackage, packageQueue.poll()); Assert.assertNull(packageQueue.poll()); Assert.assertEquals(Status.TRY_LOGIN, Deencapsulation.getField(tcpClientConnection, "status")); }
public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
@Test public void send_disconnectedToWorking(@Mocked AbstractTcpClientPackage tcpClientPackage, @Mocked TcpOutputStream tcpOutputStream) { long msgId = 1; new Expectations(tcpClientConnection) { { tcpClientPackage.getMsgId(); result = msgId; tcpClientConnection.write((ByteBuf) any); } }; new MockUp<Context>(context) { @Mock void runOnContext(Handler<Void> action) { Deencapsulation.setField(tcpClientConnection, "status", Status.WORKING); action.handle(null); } }; tcpClientConnection.send(tcpClientPackage, ar -> { }); Assert.assertNull(writeQueue.poll()); Assert.assertNull(packageQueue.poll()); Assert.assertEquals(Status.WORKING, Deencapsulation.getField(tcpClientConnection, "status")); }
public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
TcpClientConnection extends TcpConnection { public void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback) { requestMap.put(tcpClientPackage.getMsgId(), new TcpRequest(tcpClientPackage.getMsRequestTimeout(), callback)); if (writeToBufferQueue(tcpClientPackage)) { return; } context.runOnContext(v -> { if (!writeToBufferQueue(tcpClientPackage)) { packageQueue.add(tcpClientPackage); } if (Status.DISCONNECTED.equals(status)) { connect(); } }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
@Test public void connect_success(@Mocked NetSocketImpl netSocket) { FutureFactoryImpl futureFactory = new FutureFactoryImpl(); new MockUp<NetClientWrapper>(netClientWrapper) { @Mock void connect(boolean ssl, int port, String host, Handler<AsyncResult<NetSocket>> connectHandler) { connectHandler.handle(futureFactory.succeededFuture(netSocket)); } }; tcpClientConnection.connect(); Assert.assertSame(netSocket, tcpClientConnection.getNetSocket()); Assert.assertEquals(Status.WORKING, Deencapsulation.getField(tcpClientConnection, "status")); }
@VisibleForTesting protected void connect() { this.status = Status.CONNECTING; LOGGER.info("connecting to address {}", socketAddress.toString()); netClientWrapper.connect(endpoint.isSslEnabled(), socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { onConnectSuccess(ar.result()); return; } onConnectFailed(ar.cause()); }); }
TcpClientConnection extends TcpConnection { @VisibleForTesting protected void connect() { this.status = Status.CONNECTING; LOGGER.info("connecting to address {}", socketAddress.toString()); netClientWrapper.connect(endpoint.isSslEnabled(), socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { onConnectSuccess(ar.result()); return; } onConnectFailed(ar.cause()); }); } }
TcpClientConnection extends TcpConnection { @VisibleForTesting protected void connect() { this.status = Status.CONNECTING; LOGGER.info("connecting to address {}", socketAddress.toString()); netClientWrapper.connect(endpoint.isSslEnabled(), socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { onConnectSuccess(ar.result()); return; } onConnectFailed(ar.cause()); }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); }
TcpClientConnection extends TcpConnection { @VisibleForTesting protected void connect() { this.status = Status.CONNECTING; LOGGER.info("connecting to address {}", socketAddress.toString()); netClientWrapper.connect(endpoint.isSslEnabled(), socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { onConnectSuccess(ar.result()); return; } onConnectFailed(ar.cause()); }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
TcpClientConnection extends TcpConnection { @VisibleForTesting protected void connect() { this.status = Status.CONNECTING; LOGGER.info("connecting to address {}", socketAddress.toString()); netClientWrapper.connect(endpoint.isSslEnabled(), socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { onConnectSuccess(ar.result()); return; } onConnectFailed(ar.cause()); }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
@Test public void connect_failed() { requestMap.put(10L, new TcpRequest(10, ar -> { })); FutureFactoryImpl futureFactory = new FutureFactoryImpl(); RuntimeException error = new RuntimeExceptionWithoutStackTrace(); new MockUp<NetClientWrapper>(netClientWrapper) { @Mock void connect(boolean ssl, int port, String host, Handler<AsyncResult<NetSocket>> connectHandler) { connectHandler.handle(futureFactory.failedFuture(error)); } }; tcpClientConnection.connect(); Assert.assertEquals(Status.DISCONNECTED, Deencapsulation.getField(tcpClientConnection, "status")); Assert.assertEquals(0, requestMap.size()); }
@VisibleForTesting protected void connect() { this.status = Status.CONNECTING; LOGGER.info("connecting to address {}", socketAddress.toString()); netClientWrapper.connect(endpoint.isSslEnabled(), socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { onConnectSuccess(ar.result()); return; } onConnectFailed(ar.cause()); }); }
TcpClientConnection extends TcpConnection { @VisibleForTesting protected void connect() { this.status = Status.CONNECTING; LOGGER.info("connecting to address {}", socketAddress.toString()); netClientWrapper.connect(endpoint.isSslEnabled(), socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { onConnectSuccess(ar.result()); return; } onConnectFailed(ar.cause()); }); } }
TcpClientConnection extends TcpConnection { @VisibleForTesting protected void connect() { this.status = Status.CONNECTING; LOGGER.info("connecting to address {}", socketAddress.toString()); netClientWrapper.connect(endpoint.isSslEnabled(), socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { onConnectSuccess(ar.result()); return; } onConnectFailed(ar.cause()); }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); }
TcpClientConnection extends TcpConnection { @VisibleForTesting protected void connect() { this.status = Status.CONNECTING; LOGGER.info("connecting to address {}", socketAddress.toString()); netClientWrapper.connect(endpoint.isSslEnabled(), socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { onConnectSuccess(ar.result()); return; } onConnectFailed(ar.cause()); }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
TcpClientConnection extends TcpConnection { @VisibleForTesting protected void connect() { this.status = Status.CONNECTING; LOGGER.info("connecting to address {}", socketAddress.toString()); netClientWrapper.connect(endpoint.isSslEnabled(), socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { onConnectSuccess(ar.result()); return; } onConnectFailed(ar.cause()); }); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
@Test public void onClosed(@Mocked NetSocketImpl netSocket) { requestMap.put(10L, new TcpRequest(10, ar -> { })); tcpClientConnection.initNetSocket(netSocket); Deencapsulation.invoke(tcpClientConnection, "onClosed", new Class<?>[] {Void.class}, new Object[] {null}); Assert.assertEquals(Status.DISCONNECTED, Deencapsulation.getField(tcpClientConnection, "status")); Assert.assertEquals(0, requestMap.size()); }
private void onClosed(Void v) { onDisconnected(new IOException("socket closed")); }
TcpClientConnection extends TcpConnection { private void onClosed(Void v) { onDisconnected(new IOException("socket closed")); } }
TcpClientConnection extends TcpConnection { private void onClosed(Void v) { onDisconnected(new IOException("socket closed")); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); }
TcpClientConnection extends TcpConnection { private void onClosed(Void v) { onDisconnected(new IOException("socket closed")); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
TcpClientConnection extends TcpConnection { private void onClosed(Void v) { onDisconnected(new IOException("socket closed")); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
@Test public void onReply_notExist() { tcpClientConnection.onReply(1, null, null); }
protected void onReply(long msgId, Buffer headerBuffer, Buffer bodyBuffer) { TcpRequest request = requestMap.remove(msgId); if (request == null) { LOGGER.error("Unknown reply msgId {}, waiting count {}", msgId, requestMap.size()); return; } request.onReply(headerBuffer, bodyBuffer); }
TcpClientConnection extends TcpConnection { protected void onReply(long msgId, Buffer headerBuffer, Buffer bodyBuffer) { TcpRequest request = requestMap.remove(msgId); if (request == null) { LOGGER.error("Unknown reply msgId {}, waiting count {}", msgId, requestMap.size()); return; } request.onReply(headerBuffer, bodyBuffer); } }
TcpClientConnection extends TcpConnection { protected void onReply(long msgId, Buffer headerBuffer, Buffer bodyBuffer) { TcpRequest request = requestMap.remove(msgId); if (request == null) { LOGGER.error("Unknown reply msgId {}, waiting count {}", msgId, requestMap.size()); return; } request.onReply(headerBuffer, bodyBuffer); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); }
TcpClientConnection extends TcpConnection { protected void onReply(long msgId, Buffer headerBuffer, Buffer bodyBuffer) { TcpRequest request = requestMap.remove(msgId); if (request == null) { LOGGER.error("Unknown reply msgId {}, waiting count {}", msgId, requestMap.size()); return; } request.onReply(headerBuffer, bodyBuffer); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
TcpClientConnection extends TcpConnection { protected void onReply(long msgId, Buffer headerBuffer, Buffer bodyBuffer) { TcpRequest request = requestMap.remove(msgId); if (request == null) { LOGGER.error("Unknown reply msgId {}, waiting count {}", msgId, requestMap.size()); return; } request.onReply(headerBuffer, bodyBuffer); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
@Test public void on_exist() { long msgId = 1L; AtomicInteger count = new AtomicInteger(); requestMap.put(msgId, new TcpRequest(10, ar -> { count.incrementAndGet(); })); tcpClientConnection.onReply(msgId, null, null); Assert.assertEquals(1, count.get()); }
protected void onReply(long msgId, Buffer headerBuffer, Buffer bodyBuffer) { TcpRequest request = requestMap.remove(msgId); if (request == null) { LOGGER.error("Unknown reply msgId {}, waiting count {}", msgId, requestMap.size()); return; } request.onReply(headerBuffer, bodyBuffer); }
TcpClientConnection extends TcpConnection { protected void onReply(long msgId, Buffer headerBuffer, Buffer bodyBuffer) { TcpRequest request = requestMap.remove(msgId); if (request == null) { LOGGER.error("Unknown reply msgId {}, waiting count {}", msgId, requestMap.size()); return; } request.onReply(headerBuffer, bodyBuffer); } }
TcpClientConnection extends TcpConnection { protected void onReply(long msgId, Buffer headerBuffer, Buffer bodyBuffer) { TcpRequest request = requestMap.remove(msgId); if (request == null) { LOGGER.error("Unknown reply msgId {}, waiting count {}", msgId, requestMap.size()); return; } request.onReply(headerBuffer, bodyBuffer); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); }
TcpClientConnection extends TcpConnection { protected void onReply(long msgId, Buffer headerBuffer, Buffer bodyBuffer) { TcpRequest request = requestMap.remove(msgId); if (request == null) { LOGGER.error("Unknown reply msgId {}, waiting count {}", msgId, requestMap.size()); return; } request.onReply(headerBuffer, bodyBuffer); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
TcpClientConnection extends TcpConnection { protected void onReply(long msgId, Buffer headerBuffer, Buffer bodyBuffer) { TcpRequest request = requestMap.remove(msgId); if (request == null) { LOGGER.error("Unknown reply msgId {}, waiting count {}", msgId, requestMap.size()); return; } request.onReply(headerBuffer, bodyBuffer); } TcpClientConnection(Context context, NetClientWrapper netClientWrapper, String strEndpoint); boolean isLocalSupportLogin(); TcpClientConfig getClientConfig(); void setLocalSupportLogin(boolean localSupportLogin); void send(AbstractTcpClientPackage tcpClientPackage, TcpResponseCallback callback); void checkTimeout(); }
@Test public void createClientPool() { Vertx vertx = Mockito.mock(Vertx.class); Context context = Mockito.mock(Context.class); Mockito.when(context.owner()).thenReturn(vertx); TcpClientConnectionPool pool = factory.createClientPool(context); Assert.assertSame(normalClientConfig, pool.netClientWrapper.getClientConfig(false)); Assert.assertSame(sslClientConfig, pool.netClientWrapper.getClientConfig(true)); }
@Override public CLIENT_POOL createClientPool(Context context) { Vertx vertx = context.owner(); NetClientWrapper netClientWrapper = new NetClientWrapper(vertx, normalClientConfig, sslClientConfig); return doCreateClientPool(context, netClientWrapper); }
AbstractTcpClientPoolFactory implements ClientPoolFactory<CLIENT_POOL> { @Override public CLIENT_POOL createClientPool(Context context) { Vertx vertx = context.owner(); NetClientWrapper netClientWrapper = new NetClientWrapper(vertx, normalClientConfig, sslClientConfig); return doCreateClientPool(context, netClientWrapper); } }
AbstractTcpClientPoolFactory implements ClientPoolFactory<CLIENT_POOL> { @Override public CLIENT_POOL createClientPool(Context context) { Vertx vertx = context.owner(); NetClientWrapper netClientWrapper = new NetClientWrapper(vertx, normalClientConfig, sslClientConfig); return doCreateClientPool(context, netClientWrapper); } AbstractTcpClientPoolFactory(TcpClientConfig normalClientConfig, TcpClientConfig sslClientConfig); }
AbstractTcpClientPoolFactory implements ClientPoolFactory<CLIENT_POOL> { @Override public CLIENT_POOL createClientPool(Context context) { Vertx vertx = context.owner(); NetClientWrapper netClientWrapper = new NetClientWrapper(vertx, normalClientConfig, sslClientConfig); return doCreateClientPool(context, netClientWrapper); } AbstractTcpClientPoolFactory(TcpClientConfig normalClientConfig, TcpClientConfig sslClientConfig); @Override CLIENT_POOL createClientPool(Context context); }
AbstractTcpClientPoolFactory implements ClientPoolFactory<CLIENT_POOL> { @Override public CLIENT_POOL createClientPool(Context context) { Vertx vertx = context.owner(); NetClientWrapper netClientWrapper = new NetClientWrapper(vertx, normalClientConfig, sslClientConfig); return doCreateClientPool(context, netClientWrapper); } AbstractTcpClientPoolFactory(TcpClientConfig normalClientConfig, TcpClientConfig sslClientConfig); @Override CLIENT_POOL createClientPool(Context context); }
@Test public void testInitializedValues() { initCreateServiceRequest(); Assert.assertEquals(oMockMicroservice, oCreateServiceRequest.getService()); }
public Microservice getService() { return service; }
CreateServiceRequest { public Microservice getService() { return service; } }
CreateServiceRequest { public Microservice getService() { return service; } }
CreateServiceRequest { public Microservice getService() { return service; } Microservice getService(); void setService(Microservice service); }
CreateServiceRequest { public Microservice getService() { return service; } Microservice getService(); void setService(Microservice service); }
@Test public void create() { Assert.assertThat(pool.create("rest: }
@Override protected TcpClientConnection create(String endpoint) { return new TcpClientConnection(context, netClientWrapper, endpoint); }
TcpClientConnectionPool extends AbstractTcpClientConnectionPool<TcpClientConnection> { @Override protected TcpClientConnection create(String endpoint) { return new TcpClientConnection(context, netClientWrapper, endpoint); } }
TcpClientConnectionPool extends AbstractTcpClientConnectionPool<TcpClientConnection> { @Override protected TcpClientConnection create(String endpoint) { return new TcpClientConnection(context, netClientWrapper, endpoint); } TcpClientConnectionPool(Context context, NetClientWrapper netClientWrapper); }
TcpClientConnectionPool extends AbstractTcpClientConnectionPool<TcpClientConnection> { @Override protected TcpClientConnection create(String endpoint) { return new TcpClientConnection(context, netClientWrapper, endpoint); } TcpClientConnectionPool(Context context, NetClientWrapper netClientWrapper); }
TcpClientConnectionPool extends AbstractTcpClientConnectionPool<TcpClientConnection> { @Override protected TcpClientConnection create(String endpoint) { return new TcpClientConnection(context, netClientWrapper, endpoint); } TcpClientConnectionPool(Context context, NetClientWrapper netClientWrapper); }
@Test public void testTcpClientConfig() { TcpClientConfig config = new TcpClientConfig(); Assert.assertEquals(config.getMsLoginTimeout(), 30000); Assert.assertEquals(config.isSsl(), false); config.setMsLoginTimeout(500); Assert.assertEquals(config.getMsLoginTimeout(), 500); }
public TcpClientConfig() { msLoginTimeout = DEFAULT_LOGIN_TIMEOUT; }
TcpClientConfig extends NetClientOptions { public TcpClientConfig() { msLoginTimeout = DEFAULT_LOGIN_TIMEOUT; } }
TcpClientConfig extends NetClientOptions { public TcpClientConfig() { msLoginTimeout = DEFAULT_LOGIN_TIMEOUT; } TcpClientConfig(); }
TcpClientConfig extends NetClientOptions { public TcpClientConfig() { msLoginTimeout = DEFAULT_LOGIN_TIMEOUT; } TcpClientConfig(); long getMsLoginTimeout(); void setMsLoginTimeout(long msLoginTimeout); }
TcpClientConfig extends NetClientOptions { public TcpClientConfig() { msLoginTimeout = DEFAULT_LOGIN_TIMEOUT; } TcpClientConfig(); long getMsLoginTimeout(); void setMsLoginTimeout(long msLoginTimeout); static final int DEFAULT_LOGIN_TIMEOUT; }
@Test public void getClientConfig() { Assert.assertSame(normalClientConfig, netClientWrapper.getClientConfig(false)); Assert.assertSame(sslClientConfig, netClientWrapper.getClientConfig(true)); }
public TcpClientConfig getClientConfig(boolean ssl) { if (ssl) { return sslClientConfig; } return normalClientConfig; }
NetClientWrapper { public TcpClientConfig getClientConfig(boolean ssl) { if (ssl) { return sslClientConfig; } return normalClientConfig; } }
NetClientWrapper { public TcpClientConfig getClientConfig(boolean ssl) { if (ssl) { return sslClientConfig; } return normalClientConfig; } NetClientWrapper(Vertx vertx, TcpClientConfig normalClientConfig, TcpClientConfig sslClientConfig); }
NetClientWrapper { public TcpClientConfig getClientConfig(boolean ssl) { if (ssl) { return sslClientConfig; } return normalClientConfig; } NetClientWrapper(Vertx vertx, TcpClientConfig normalClientConfig, TcpClientConfig sslClientConfig); TcpClientConfig getClientConfig(boolean ssl); void connect(boolean ssl, int port, String host, Handler<AsyncResult<NetSocket>> connectHandler); }
NetClientWrapper { public TcpClientConfig getClientConfig(boolean ssl) { if (ssl) { return sslClientConfig; } return normalClientConfig; } NetClientWrapper(Vertx vertx, TcpClientConfig normalClientConfig, TcpClientConfig sslClientConfig); TcpClientConfig getClientConfig(boolean ssl); void connect(boolean ssl, int port, String host, Handler<AsyncResult<NetSocket>> connectHandler); }
@Test public void connect(@Mocked NetSocket normalSocket, @Mocked NetSocket sslSocket) { int port = 8000; String host = "localhost"; FutureFactoryImpl futureFactory = new FutureFactoryImpl(); new MockUp<NetClient>(normalNetClient) { @Mock NetClient connect(int port, String host, Handler<AsyncResult<NetSocket>> connectHandler) { connectHandler.handle(futureFactory.succeededFuture(normalSocket)); return null; } }; new MockUp<NetClient>(sslNetClient) { @Mock NetClient connect(int port, String host, Handler<AsyncResult<NetSocket>> connectHandler) { connectHandler.handle(futureFactory.succeededFuture(sslSocket)); return null; } }; List<NetSocket> socks = new ArrayList<>(); netClientWrapper.connect(false, port, host, asyncSocket -> { socks.add(asyncSocket.result()); }); netClientWrapper.connect(true, port, host, asyncSocket -> { socks.add(asyncSocket.result()); }); Assert.assertThat(socks, Matchers.contains(normalSocket, sslSocket)); }
public void connect(boolean ssl, int port, String host, Handler<AsyncResult<NetSocket>> connectHandler) { if (ssl) { sslNetClient.connect(port, host, connectHandler); return; } normalNetClient.connect(port, host, connectHandler); }
NetClientWrapper { public void connect(boolean ssl, int port, String host, Handler<AsyncResult<NetSocket>> connectHandler) { if (ssl) { sslNetClient.connect(port, host, connectHandler); return; } normalNetClient.connect(port, host, connectHandler); } }
NetClientWrapper { public void connect(boolean ssl, int port, String host, Handler<AsyncResult<NetSocket>> connectHandler) { if (ssl) { sslNetClient.connect(port, host, connectHandler); return; } normalNetClient.connect(port, host, connectHandler); } NetClientWrapper(Vertx vertx, TcpClientConfig normalClientConfig, TcpClientConfig sslClientConfig); }
NetClientWrapper { public void connect(boolean ssl, int port, String host, Handler<AsyncResult<NetSocket>> connectHandler) { if (ssl) { sslNetClient.connect(port, host, connectHandler); return; } normalNetClient.connect(port, host, connectHandler); } NetClientWrapper(Vertx vertx, TcpClientConfig normalClientConfig, TcpClientConfig sslClientConfig); TcpClientConfig getClientConfig(boolean ssl); void connect(boolean ssl, int port, String host, Handler<AsyncResult<NetSocket>> connectHandler); }
NetClientWrapper { public void connect(boolean ssl, int port, String host, Handler<AsyncResult<NetSocket>> connectHandler) { if (ssl) { sslNetClient.connect(port, host, connectHandler); return; } normalNetClient.connect(port, host, connectHandler); } NetClientWrapper(Vertx vertx, TcpClientConfig normalClientConfig, TcpClientConfig sslClientConfig); TcpClientConfig getClientConfig(boolean ssl); void connect(boolean ssl, int port, String host, Handler<AsyncResult<NetSocket>> connectHandler); }
@Test public void start(@Mocked Context context) throws Exception { AtomicInteger count = new AtomicInteger(); ClientPoolManager<HttpClientWithContext> clientMgr = new MockUp<ClientPoolManager<HttpClientWithContext>>() { @Mock HttpClientWithContext createClientPool(Context context) { count.incrementAndGet(); return null; } }.getMockInstance(); clientVerticle.init(null, context); JsonObject config = new SimpleJsonObject(); config.put(ClientVerticle.CLIENT_MGR, clientMgr); new Expectations() { { context.config(); result = config; } }; clientVerticle.start(); Assert.assertEquals(1, count.get()); }
@SuppressWarnings("unchecked") @Override public void start() throws Exception { try { ClientPoolManager<CLIENT_POOL> clientMgr = (ClientPoolManager<CLIENT_POOL>) config().getValue(CLIENT_MGR); clientMgr.createClientPool(context); } catch (Throwable e) { LOGGER.error("", e); throw e; } }
ClientVerticle extends AbstractVerticle { @SuppressWarnings("unchecked") @Override public void start() throws Exception { try { ClientPoolManager<CLIENT_POOL> clientMgr = (ClientPoolManager<CLIENT_POOL>) config().getValue(CLIENT_MGR); clientMgr.createClientPool(context); } catch (Throwable e) { LOGGER.error("", e); throw e; } } }
ClientVerticle extends AbstractVerticle { @SuppressWarnings("unchecked") @Override public void start() throws Exception { try { ClientPoolManager<CLIENT_POOL> clientMgr = (ClientPoolManager<CLIENT_POOL>) config().getValue(CLIENT_MGR); clientMgr.createClientPool(context); } catch (Throwable e) { LOGGER.error("", e); throw e; } } }
ClientVerticle extends AbstractVerticle { @SuppressWarnings("unchecked") @Override public void start() throws Exception { try { ClientPoolManager<CLIENT_POOL> clientMgr = (ClientPoolManager<CLIENT_POOL>) config().getValue(CLIENT_MGR); clientMgr.createClientPool(context); } catch (Throwable e) { LOGGER.error("", e); throw e; } } @SuppressWarnings("unchecked") @Override void start(); }
ClientVerticle extends AbstractVerticle { @SuppressWarnings("unchecked") @Override public void start() throws Exception { try { ClientPoolManager<CLIENT_POOL> clientMgr = (ClientPoolManager<CLIENT_POOL>) config().getValue(CLIENT_MGR); clientMgr.createClientPool(context); } catch (Throwable e) { LOGGER.error("", e); throw e; } } @SuppressWarnings("unchecked") @Override void start(); static final String CLIENT_MGR; }
@Test public void test() throws UnsupportedEncodingException { TcpBufferHandler output = new TcpBufferHandler() { @Override public void handle(long _msgId, Buffer _headerBuffer, Buffer _bodyBuffer) { msgId = _msgId; headerBuffer = _headerBuffer; bodyBuffer = _bodyBuffer; } }; byte[] header = new byte[] {1, 2, 3}; byte[] body = new byte[] {1, 2, 3, 4}; TcpOutputStream os = new TcpOutputStream(1); os.writeInt(header.length + body.length); os.writeInt(header.length); os.write(header); os.write(body); TcpParser parser = new TcpParser(output); parser.handle(os.getBuffer()); os.close(); Assert.assertEquals(1, msgId); Assert.assertArrayEquals(header, headerBuffer.getBytes()); Assert.assertArrayEquals(body, bodyBuffer.getBytes()); }
public void handle(Buffer buf) { parser.handle(buf); }
TcpParser implements Handler<Buffer> { public void handle(Buffer buf) { parser.handle(buf); } }
TcpParser implements Handler<Buffer> { public void handle(Buffer buf) { parser.handle(buf); } TcpParser(TcpBufferHandler output); }
TcpParser implements Handler<Buffer> { public void handle(Buffer buf) { parser.handle(buf); } TcpParser(TcpBufferHandler output); boolean firstNEqual(byte[] a, byte[] b, int n); void handle(Buffer buf); }
TcpParser implements Handler<Buffer> { public void handle(Buffer buf) { parser.handle(buf); } TcpParser(TcpBufferHandler output); boolean firstNEqual(byte[] a, byte[] b, int n); void handle(Buffer buf); static final byte[] TCP_MAGIC; static final int TCP_MAX_REQUEST_LENGTH; static final int TCP_HEADER_LENGTH; }
@SuppressWarnings({"rawtypes", "unchecked"}) @Test public void testTcpServerNonSSL(@Mocked Vertx vertx, @Mocked AsyncResultCallback<InetSocketAddress> callback, @Mocked NetServer netServer) { new Expectations() { { vertx.createNetServer(); result = netServer; netServer.connectHandler((Handler) any); netServer.listen(anyInt, anyString, (Handler) any); } }; URIEndpointObject endpointObject = new URIEndpointObject("highway: TcpServer server = new TcpServerForTest(endpointObject); server.init(vertx, "", callback); }
public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } TcpServer(URIEndpointObject endpointObject); }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } TcpServer(URIEndpointObject endpointObject); void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback); }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } TcpServer(URIEndpointObject endpointObject); void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback); }
@SuppressWarnings({"rawtypes", "unchecked"}) @Test public void testTcpServerSSL(@Mocked Vertx vertx, @Mocked AsyncResultCallback<InetSocketAddress> callback, @Mocked NetServer netServer) { new Expectations() { { vertx.createNetServer((NetServerOptions) any); result = netServer; netServer.connectHandler((Handler) any); netServer.listen(anyInt, anyString, (Handler) any); } }; URIEndpointObject endpointObject = new URIEndpointObject("highway: TcpServer server = new TcpServerForTest(endpointObject); server.init(vertx, "", callback); }
public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } TcpServer(URIEndpointObject endpointObject); }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } TcpServer(URIEndpointObject endpointObject); void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback); }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } TcpServer(URIEndpointObject endpointObject); void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback); }
@SuppressWarnings({"rawtypes", "unchecked"}) @Test public void testConnectionLimit(@Mocked Vertx vertx, @Mocked AsyncResultCallback<InetSocketAddress> callback, @Mocked NetServer netServer, @Mocked NetSocketImpl netSocket) { DefaultServerEndpointMetric endpointMetric = new DefaultServerEndpointMetric(null); DefaultTcpServerMetrics tcpServerMetrics = new DefaultTcpServerMetrics(endpointMetric); new MockUp<NetServer>(netServer) { @Mock NetServer connectHandler(Handler<NetSocket> handler) { connectHandler = handler; return netServer; } }; new MockUp<NetSocketImpl>(netSocket) { @Mock void close() { netSocketClosed = true; } }; new Expectations() { { vertx.createNetServer((NetServerOptions) any); result = netServer; netServer.listen(anyInt, anyString, (Handler) any); netSocket.metrics(); result = tcpServerMetrics; } }; URIEndpointObject endpointObject = new URIEndpointObject("highway: TcpServer server = new TcpServerForTest(endpointObject) { @Override protected int getConnectionLimit() { return 2; } }; server.init(vertx, "", callback); endpointMetric.onConnect(); endpointMetric.onConnect(); connectHandler.handle(netSocket); endpointMetric.onConnect(); connectHandler.handle(netSocket); Assert.assertTrue(netSocketClosed); Assert.assertEquals(1, endpointMetric.getRejectByConnectionLimitCount()); }
public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } TcpServer(URIEndpointObject endpointObject); }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } TcpServer(URIEndpointObject endpointObject); void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback); }
TcpServer { public void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback) { NetServer netServer; if (endpointObject.isSslEnabled()) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); NetServerOptions serverOptions = new NetServerOptions(); VertxTLSBuilder.buildNetServerOptions(sslOption, sslCustom, serverOptions); netServer = vertx.createNetServer(serverOptions); } else { netServer = vertx.createNetServer(); } netServer.connectHandler(netSocket -> { DefaultTcpServerMetrics serverMetrics = (DefaultTcpServerMetrics) ((NetSocketImpl) netSocket).metrics(); DefaultServerEndpointMetric endpointMetric = serverMetrics.getEndpointMetric(); long connectedCount = endpointMetric.getCurrentConnectionCount(); int connectionLimit = getConnectionLimit(); if (connectedCount > connectionLimit) { netSocket.close(); endpointMetric.onRejectByConnectionLimit(); return; } TcpServerConnection connection = createTcpServerConnection(); connection.init(netSocket); }); netServer.exceptionHandler(e -> { LOGGER.error("Unexpected error in server.{}", ExceptionUtils.getExceptionMessageWithoutTrace(e)); }); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { if (ar.succeeded()) { callback.success(socketAddress); return; } String msg = String.format("listen failed, address=%s", socketAddress.toString()); callback.fail(new Exception(msg, ar.cause())); }); } TcpServer(URIEndpointObject endpointObject); void init(Vertx vertx, String sslKey, AsyncResultCallback<InetSocketAddress> callback); }
@Test public void test(@Mocked NetSocketImpl netSocket) { TcpServerConnection connection = new TcpServerConnection(); connection.setProtocol("p"); connection.setZipName("z"); connection.init(netSocket); Assert.assertEquals(netSocket, connection.getNetSocket()); }
public void init(NetSocket netSocket) { this.initNetSocket((NetSocketImpl) netSocket); String remoteAddress = netSocket.remoteAddress().toString(); LOGGER.info("connect from {}, in thread {}", remoteAddress, Thread.currentThread().getName()); netSocket.exceptionHandler(e -> { LOGGER.error("disconected from {}, in thread {}, cause {}", remoteAddress, Thread.currentThread().getName(), e.getMessage()); }); netSocket.closeHandler(Void -> { LOGGER.error("disconected from {}, in thread {}", remoteAddress, Thread.currentThread().getName()); }); netSocket.handler(splitter); }
TcpServerConnection extends TcpConnection { public void init(NetSocket netSocket) { this.initNetSocket((NetSocketImpl) netSocket); String remoteAddress = netSocket.remoteAddress().toString(); LOGGER.info("connect from {}, in thread {}", remoteAddress, Thread.currentThread().getName()); netSocket.exceptionHandler(e -> { LOGGER.error("disconected from {}, in thread {}, cause {}", remoteAddress, Thread.currentThread().getName(), e.getMessage()); }); netSocket.closeHandler(Void -> { LOGGER.error("disconected from {}, in thread {}", remoteAddress, Thread.currentThread().getName()); }); netSocket.handler(splitter); } }
TcpServerConnection extends TcpConnection { public void init(NetSocket netSocket) { this.initNetSocket((NetSocketImpl) netSocket); String remoteAddress = netSocket.remoteAddress().toString(); LOGGER.info("connect from {}, in thread {}", remoteAddress, Thread.currentThread().getName()); netSocket.exceptionHandler(e -> { LOGGER.error("disconected from {}, in thread {}, cause {}", remoteAddress, Thread.currentThread().getName(), e.getMessage()); }); netSocket.closeHandler(Void -> { LOGGER.error("disconected from {}, in thread {}", remoteAddress, Thread.currentThread().getName()); }); netSocket.handler(splitter); } }
TcpServerConnection extends TcpConnection { public void init(NetSocket netSocket) { this.initNetSocket((NetSocketImpl) netSocket); String remoteAddress = netSocket.remoteAddress().toString(); LOGGER.info("connect from {}, in thread {}", remoteAddress, Thread.currentThread().getName()); netSocket.exceptionHandler(e -> { LOGGER.error("disconected from {}, in thread {}, cause {}", remoteAddress, Thread.currentThread().getName(), e.getMessage()); }); netSocket.closeHandler(Void -> { LOGGER.error("disconected from {}, in thread {}", remoteAddress, Thread.currentThread().getName()); }); netSocket.handler(splitter); } void init(NetSocket netSocket); }
TcpServerConnection extends TcpConnection { public void init(NetSocket netSocket) { this.initNetSocket((NetSocketImpl) netSocket); String remoteAddress = netSocket.remoteAddress().toString(); LOGGER.info("connect from {}, in thread {}", remoteAddress, Thread.currentThread().getName()); netSocket.exceptionHandler(e -> { LOGGER.error("disconected from {}, in thread {}, cause {}", remoteAddress, Thread.currentThread().getName(), e.getMessage()); }); netSocket.closeHandler(Void -> { LOGGER.error("disconected from {}, in thread {}", remoteAddress, Thread.currentThread().getName()); }); netSocket.handler(splitter); } void init(NetSocket netSocket); }
@Test public void testDefaultValues() { Assert.assertNull(oCreateServiceResponse.getServiceId()); }
public String getServiceId() { return serviceId; }
CreateServiceResponse { public String getServiceId() { return serviceId; } }
CreateServiceResponse { public String getServiceId() { return serviceId; } }
CreateServiceResponse { public String getServiceId() { return serviceId; } String getServiceId(); void setServiceId(String serviceId); }
CreateServiceResponse { public String getServiceId() { return serviceId; } String getServiceId(); void setServiceId(String serviceId); }
@Test public void testbuildHttpServerOptions() { SSLOption option = SSLOption.buildFromYaml("rest.provider"); SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass()); HttpServerOptions serverOptions = new HttpServerOptions(); VertxTLSBuilder.buildNetServerOptions(option, custom, serverOptions); Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1); Assert.assertEquals(serverOptions.getClientAuth(), ClientAuth.REQUEST); }
public static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions) { buildTCPSSLOptions(sslOption, sslCustom, netServerOptions); if (sslOption.isAuthPeer()) { netServerOptions.setClientAuth(ClientAuth.REQUIRED); } else { netServerOptions.setClientAuth(ClientAuth.REQUEST); } return netServerOptions; }
VertxTLSBuilder { public static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions) { buildTCPSSLOptions(sslOption, sslCustom, netServerOptions); if (sslOption.isAuthPeer()) { netServerOptions.setClientAuth(ClientAuth.REQUIRED); } else { netServerOptions.setClientAuth(ClientAuth.REQUEST); } return netServerOptions; } }
VertxTLSBuilder { public static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions) { buildTCPSSLOptions(sslOption, sslCustom, netServerOptions); if (sslOption.isAuthPeer()) { netServerOptions.setClientAuth(ClientAuth.REQUIRED); } else { netServerOptions.setClientAuth(ClientAuth.REQUEST); } return netServerOptions; } private VertxTLSBuilder(); }
VertxTLSBuilder { public static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions) { buildTCPSSLOptions(sslOption, sslCustom, netServerOptions); if (sslOption.isAuthPeer()) { netServerOptions.setClientAuth(ClientAuth.REQUIRED); } else { netServerOptions.setClientAuth(ClientAuth.REQUEST); } return netServerOptions; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
VertxTLSBuilder { public static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions) { buildTCPSSLOptions(sslOption, sslCustom, netServerOptions); if (sslOption.isAuthPeer()) { netServerOptions.setClientAuth(ClientAuth.REQUIRED); } else { netServerOptions.setClientAuth(ClientAuth.REQUEST); } return netServerOptions; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
@Test public void testbuildHttpClientOptions_sslKey_noFactory() { HttpClientOptions clientOptions = new HttpClientOptions(); VertxTLSBuilder.buildHttpClientOptions("notExist", clientOptions); Assert.assertTrue(clientOptions.isSsl()); }
public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } private VertxTLSBuilder(); }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
@Test public void testbuildHttpClientOptions_ssl_withFactory() { ArchaiusUtils.setProperty("ssl.exist.sslOptionFactory", SSLOptionFactoryForTest.class.getName()); HttpClientOptions clientOptions = new HttpClientOptions(); VertxTLSBuilder.buildHttpClientOptions("exist", clientOptions); Assert.assertTrue(clientOptions.isSsl()); Assert.assertTrue(clientOptions.isVerifyHost()); }
public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } private VertxTLSBuilder(); }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
@Test public void testbuildHttpClientOptions() { SSLOption option = SSLOption.buildFromYaml("rest.consumer"); SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass()); HttpClientOptions serverOptions = new HttpClientOptions(); VertxTLSBuilder.buildHttpClientOptions(option, custom, serverOptions); Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1); Assert.assertEquals(serverOptions.isTrustAll(), true); }
public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } private VertxTLSBuilder(); }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
VertxTLSBuilder { public static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions) { SSLOptionFactory factory = SSLOptionFactory.createSSLOptionFactory(sslKey, null); SSLOption sslOption; if (factory == null) { sslOption = SSLOption.buildFromYaml(sslKey); } else { sslOption = factory.createSSLOption(); } SSLCustom sslCustom = SSLCustom.createSSLCustom(sslOption.getSslCustomClass()); buildHttpClientOptions(sslOption, sslCustom, httpClientOptions); } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
@Test public void testbuildClientOptionsBase() { SSLOption option = SSLOption.buildFromYaml("rest.consumer"); SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass()); HttpClientOptions serverOptions = new HttpClientOptions(); VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions); Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1); Assert.assertEquals(serverOptions.isTrustAll(), true); }
public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
@Test public void testbuildClientOptionsBaseFileNull() { SSLOption option = SSLOption.buildFromYaml("rest.consumer"); option.setKeyStore(null); option.setTrustStore(null); option.setCrl(null); SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass()); HttpClientOptions serverOptions = new HttpClientOptions(); VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions); Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1); Assert.assertEquals(serverOptions.isTrustAll(), true); }
public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
@Test public void testbuildClientOptionsBaseAuthPeerFalse() { SSLOption option = SSLOption.buildFromYaml("rest.consumer"); SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass()); HttpClientOptions serverOptions = new HttpClientOptions(); new MockUp<SSLOption>() { @Mock public boolean isAuthPeer() { return false; } }; VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions); Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1); Assert.assertEquals(serverOptions.isTrustAll(), true); }
public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
@Test public void testbuildClientOptionsBaseSTORE_JKS() { SSLOption option = SSLOption.buildFromYaml("rest.consumer"); SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass()); HttpClientOptions serverOptions = new HttpClientOptions(); new MockUp<SSLOption>() { @Mock public String getKeyStoreType() { return "JKS"; } }; VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions); Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1); Assert.assertEquals(serverOptions.isTrustAll(), true); }
public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
@Test public void testbuildClientOptionsBaseSTORE_PKCS12() { SSLOption option = SSLOption.buildFromYaml("rest.consumer"); SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass()); HttpClientOptions serverOptions = new HttpClientOptions(); new MockUp<SSLOption>() { @Mock public String getTrustStoreType() { return "PKCS12"; } }; VertxTLSBuilder.buildClientOptionsBase(option, custom, serverOptions); Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1); Assert.assertEquals(serverOptions.isTrustAll(), true); }
public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
VertxTLSBuilder { public static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase) { buildTCPSSLOptions(sslOption, sslCustom, clientOptionsBase); if (sslOption.isAuthPeer()) { clientOptionsBase.setTrustAll(false); } else { clientOptionsBase.setTrustAll(true); } return clientOptionsBase; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
@Test public void testbuildHttpServerOptionsRequest() { SSLOption option = SSLOption.buildFromYaml("rest.provider"); SSLCustom custom = SSLCustom.createSSLCustom(option.getSslCustomClass()); HttpServerOptions serverOptions = new HttpServerOptions(); new MockUp<SSLOption>() { @Mock public boolean isAuthPeer() { return false; } }; VertxTLSBuilder.buildNetServerOptions(option, custom, serverOptions); Assert.assertEquals(serverOptions.getEnabledSecureTransportProtocols().toArray().length, 1); Assert.assertEquals(serverOptions.getClientAuth(), ClientAuth.REQUEST); }
public static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions) { buildTCPSSLOptions(sslOption, sslCustom, netServerOptions); if (sslOption.isAuthPeer()) { netServerOptions.setClientAuth(ClientAuth.REQUIRED); } else { netServerOptions.setClientAuth(ClientAuth.REQUEST); } return netServerOptions; }
VertxTLSBuilder { public static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions) { buildTCPSSLOptions(sslOption, sslCustom, netServerOptions); if (sslOption.isAuthPeer()) { netServerOptions.setClientAuth(ClientAuth.REQUIRED); } else { netServerOptions.setClientAuth(ClientAuth.REQUEST); } return netServerOptions; } }
VertxTLSBuilder { public static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions) { buildTCPSSLOptions(sslOption, sslCustom, netServerOptions); if (sslOption.isAuthPeer()) { netServerOptions.setClientAuth(ClientAuth.REQUIRED); } else { netServerOptions.setClientAuth(ClientAuth.REQUEST); } return netServerOptions; } private VertxTLSBuilder(); }
VertxTLSBuilder { public static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions) { buildTCPSSLOptions(sslOption, sslCustom, netServerOptions); if (sslOption.isAuthPeer()) { netServerOptions.setClientAuth(ClientAuth.REQUIRED); } else { netServerOptions.setClientAuth(ClientAuth.REQUEST); } return netServerOptions; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
VertxTLSBuilder { public static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions) { buildTCPSSLOptions(sslOption, sslCustom, netServerOptions); if (sslOption.isAuthPeer()) { netServerOptions.setClientAuth(ClientAuth.REQUIRED); } else { netServerOptions.setClientAuth(ClientAuth.REQUEST); } return netServerOptions; } private VertxTLSBuilder(); static NetServerOptions buildNetServerOptions(SSLOption sslOption, SSLCustom sslCustom, NetServerOptions netServerOptions); static void buildHttpClientOptions(String sslKey, HttpClientOptions httpClientOptions); static HttpClientOptions buildHttpClientOptions(SSLOption sslOption, SSLCustom sslCustom, HttpClientOptions httpClientOptions); static ClientOptionsBase buildClientOptionsBase(SSLOption sslOption, SSLCustom sslCustom, ClientOptionsBase clientOptionsBase); }
@Test public void testInitializedValues() { initFields(); Assert.assertEquals("testServiceId", oCreateServiceResponse.getServiceId()); }
public String getServiceId() { return serviceId; }
CreateServiceResponse { public String getServiceId() { return serviceId; } }
CreateServiceResponse { public String getServiceId() { return serviceId; } }
CreateServiceResponse { public String getServiceId() { return serviceId; } String getServiceId(); void setServiceId(String serviceId); }
CreateServiceResponse { public String getServiceId() { return serviceId; } String getServiceId(); void setServiceId(String serviceId); }
@Test public void testPutObject() { Object value = new Object(); SimpleJsonObject json = new SimpleJsonObject(); json.put("k", value); Assert.assertSame(value, json.getValue("k")); }
@Override public JsonObject put(String key, Object value) { getMap().put(key, value); return this; }
SimpleJsonObject extends JsonObject { @Override public JsonObject put(String key, Object value) { getMap().put(key, value); return this; } }
SimpleJsonObject extends JsonObject { @Override public JsonObject put(String key, Object value) { getMap().put(key, value); return this; } }
SimpleJsonObject extends JsonObject { @Override public JsonObject put(String key, Object value) { getMap().put(key, value); return this; } @Override JsonObject put(String key, Object value); @Override JsonObject copy(); }
SimpleJsonObject extends JsonObject { @Override public JsonObject put(String key, Object value) { getMap().put(key, value); return this; } @Override JsonObject put(String key, Object value); @Override JsonObject copy(); }
@Test public void testCopy() { SimpleJsonObject json = new SimpleJsonObject(); Assert.assertSame(json, json.copy()); }
@Override public JsonObject copy() { return this; }
SimpleJsonObject extends JsonObject { @Override public JsonObject copy() { return this; } }
SimpleJsonObject extends JsonObject { @Override public JsonObject copy() { return this; } }
SimpleJsonObject extends JsonObject { @Override public JsonObject copy() { return this; } @Override JsonObject put(String key, Object value); @Override JsonObject copy(); }
SimpleJsonObject extends JsonObject { @Override public JsonObject copy() { return this; } @Override JsonObject put(String key, Object value); @Override JsonObject copy(); }
@Test public void testMarkerFilter() { MarkerFilter filter = new MarkerFilter(); filter.setMarker("hello"); filter.start(); Assert.assertEquals(filter.getOnMatch(), FilterReply.ACCEPT); Assert.assertEquals(filter.getOnMismatch(), FilterReply.DENY); ILoggingEvent event = Mockito.mock(ILoggingEvent.class); Marker marker = Mockito.mock(Marker.class); Mockito.when(event.getMarker()).thenReturn(marker); Mockito.when(marker.getName()).thenReturn("hello"); Assert.assertEquals(FilterReply.ACCEPT, filter.decide(event)); Mockito.when(event.getMarker()).thenReturn(null); Assert.assertEquals(FilterReply.DENY, filter.decide(event)); }
public MarkerFilter() { setOnMatch(FilterReply.ACCEPT); setOnMismatch(FilterReply.DENY); }
MarkerFilter extends AbstractMatcherFilter<ILoggingEvent> { public MarkerFilter() { setOnMatch(FilterReply.ACCEPT); setOnMismatch(FilterReply.DENY); } }
MarkerFilter extends AbstractMatcherFilter<ILoggingEvent> { public MarkerFilter() { setOnMatch(FilterReply.ACCEPT); setOnMismatch(FilterReply.DENY); } MarkerFilter(); }
MarkerFilter extends AbstractMatcherFilter<ILoggingEvent> { public MarkerFilter() { setOnMatch(FilterReply.ACCEPT); setOnMismatch(FilterReply.DENY); } MarkerFilter(); @Override FilterReply decide(ILoggingEvent event); void setMarker(String marker); @Override void start(); }
MarkerFilter extends AbstractMatcherFilter<ILoggingEvent> { public MarkerFilter() { setOnMatch(FilterReply.ACCEPT); setOnMismatch(FilterReply.DENY); } MarkerFilter(); @Override FilterReply decide(ILoggingEvent event); void setMarker(String marker); @Override void start(); }
@Test public void testIsSuccessCode() { Assert.assertTrue(HttpStatus.isSuccess(200)); Assert.assertFalse(HttpStatus.isSuccess(300)); }
public static boolean isSuccess(int code) { return Status.Family.SUCCESSFUL.equals(Status.Family.familyOf(code)); }
HttpStatus implements StatusType { public static boolean isSuccess(int code) { return Status.Family.SUCCESSFUL.equals(Status.Family.familyOf(code)); } }
HttpStatus implements StatusType { public static boolean isSuccess(int code) { return Status.Family.SUCCESSFUL.equals(Status.Family.familyOf(code)); } HttpStatus(final int statusCode, final String reasonPhrase); }
HttpStatus implements StatusType { public static boolean isSuccess(int code) { return Status.Family.SUCCESSFUL.equals(Status.Family.familyOf(code)); } HttpStatus(final int statusCode, final String reasonPhrase); static boolean isSuccess(int code); static boolean isSuccess(StatusType status); @Override int getStatusCode(); @Override Family getFamily(); @Override String getReasonPhrase(); }
HttpStatus implements StatusType { public static boolean isSuccess(int code) { return Status.Family.SUCCESSFUL.equals(Status.Family.familyOf(code)); } HttpStatus(final int statusCode, final String reasonPhrase); static boolean isSuccess(int code); static boolean isSuccess(StatusType status); @Override int getStatusCode(); @Override Family getFamily(); @Override String getReasonPhrase(); }
@Test public void testIsSuccessType() { Assert.assertTrue(HttpStatus.isSuccess(Status.OK)); Assert.assertFalse(HttpStatus.isSuccess(Status.BAD_REQUEST)); }
public static boolean isSuccess(int code) { return Status.Family.SUCCESSFUL.equals(Status.Family.familyOf(code)); }
HttpStatus implements StatusType { public static boolean isSuccess(int code) { return Status.Family.SUCCESSFUL.equals(Status.Family.familyOf(code)); } }
HttpStatus implements StatusType { public static boolean isSuccess(int code) { return Status.Family.SUCCESSFUL.equals(Status.Family.familyOf(code)); } HttpStatus(final int statusCode, final String reasonPhrase); }
HttpStatus implements StatusType { public static boolean isSuccess(int code) { return Status.Family.SUCCESSFUL.equals(Status.Family.familyOf(code)); } HttpStatus(final int statusCode, final String reasonPhrase); static boolean isSuccess(int code); static boolean isSuccess(StatusType status); @Override int getStatusCode(); @Override Family getFamily(); @Override String getReasonPhrase(); }
HttpStatus implements StatusType { public static boolean isSuccess(int code) { return Status.Family.SUCCESSFUL.equals(Status.Family.familyOf(code)); } HttpStatus(final int statusCode, final String reasonPhrase); static boolean isSuccess(int code); static boolean isSuccess(StatusType status); @Override int getStatusCode(); @Override Family getFamily(); @Override String getReasonPhrase(); }
@Test public void testGetStatusCode() { HttpStatus status = new HttpStatus(200, "ok"); Assert.assertEquals(200, status.getStatusCode()); }
@Override public int getStatusCode() { return statusCode; }
HttpStatus implements StatusType { @Override public int getStatusCode() { return statusCode; } }
HttpStatus implements StatusType { @Override public int getStatusCode() { return statusCode; } HttpStatus(final int statusCode, final String reasonPhrase); }
HttpStatus implements StatusType { @Override public int getStatusCode() { return statusCode; } HttpStatus(final int statusCode, final String reasonPhrase); static boolean isSuccess(int code); static boolean isSuccess(StatusType status); @Override int getStatusCode(); @Override Family getFamily(); @Override String getReasonPhrase(); }
HttpStatus implements StatusType { @Override public int getStatusCode() { return statusCode; } HttpStatus(final int statusCode, final String reasonPhrase); static boolean isSuccess(int code); static boolean isSuccess(StatusType status); @Override int getStatusCode(); @Override Family getFamily(); @Override String getReasonPhrase(); }
@Test public void testGetFamily() { HttpStatus status = new HttpStatus(200, "ok"); Assert.assertEquals(Family.familyOf(200), status.getFamily()); }
@Override public Family getFamily() { return Family.familyOf(statusCode); }
HttpStatus implements StatusType { @Override public Family getFamily() { return Family.familyOf(statusCode); } }
HttpStatus implements StatusType { @Override public Family getFamily() { return Family.familyOf(statusCode); } HttpStatus(final int statusCode, final String reasonPhrase); }
HttpStatus implements StatusType { @Override public Family getFamily() { return Family.familyOf(statusCode); } HttpStatus(final int statusCode, final String reasonPhrase); static boolean isSuccess(int code); static boolean isSuccess(StatusType status); @Override int getStatusCode(); @Override Family getFamily(); @Override String getReasonPhrase(); }
HttpStatus implements StatusType { @Override public Family getFamily() { return Family.familyOf(statusCode); } HttpStatus(final int statusCode, final String reasonPhrase); static boolean isSuccess(int code); static boolean isSuccess(StatusType status); @Override int getStatusCode(); @Override Family getFamily(); @Override String getReasonPhrase(); }
@Test public void testGetReasonPhrase() { HttpStatus status = new HttpStatus(200, "ok"); Assert.assertEquals("ok", status.getReasonPhrase()); }
@Override public String getReasonPhrase() { return reason; }
HttpStatus implements StatusType { @Override public String getReasonPhrase() { return reason; } }
HttpStatus implements StatusType { @Override public String getReasonPhrase() { return reason; } HttpStatus(final int statusCode, final String reasonPhrase); }
HttpStatus implements StatusType { @Override public String getReasonPhrase() { return reason; } HttpStatus(final int statusCode, final String reasonPhrase); static boolean isSuccess(int code); static boolean isSuccess(StatusType status); @Override int getStatusCode(); @Override Family getFamily(); @Override String getReasonPhrase(); }
HttpStatus implements StatusType { @Override public String getReasonPhrase() { return reason; } HttpStatus(final int statusCode, final String reasonPhrase); static boolean isSuccess(int code); static boolean isSuccess(StatusType status); @Override int getStatusCode(); @Override Family getFamily(); @Override String getReasonPhrase(); }
@Test public void parseParamFromHeaderValue_normal() { Assert.assertEquals("v", HttpUtils.parseParamFromHeaderValue("xx;k=v", "k")); }
public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void parseParamFromHeaderValue_normal_ignoreCase() { Assert.assertEquals("v", HttpUtils.parseParamFromHeaderValue("xx;K=v", "k")); }
public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void testDefaultValues() { Assert.assertNull(oGetAllServicesResponse.getServices()); }
public List<Microservice> getServices() { return services; }
GetAllServicesResponse { public List<Microservice> getServices() { return services; } }
GetAllServicesResponse { public List<Microservice> getServices() { return services; } }
GetAllServicesResponse { public List<Microservice> getServices() { return services; } List<Microservice> getServices(); void setServices(List<Microservice> services); }
GetAllServicesResponse { public List<Microservice> getServices() { return services; } List<Microservice> getServices(); void setServices(List<Microservice> services); }
@Test public void parseParamFromHeaderValue_null() { Assert.assertNull(HttpUtils.parseParamFromHeaderValue(null, "k")); }
public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void parseParamFromHeaderValue_noKv() { Assert.assertNull(HttpUtils.parseParamFromHeaderValue("xx", "k")); }
public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void parseParamFromHeaderValue_noV() { Assert.assertEquals("", HttpUtils.parseParamFromHeaderValue("xx;k=", "k")); }
public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void parseParamFromHeaderValue_keyNotFound() { Assert.assertNull(HttpUtils.parseParamFromHeaderValue("xx;k=", "kk")); }
public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String parseParamFromHeaderValue(String headerValue, String paramName) { if (StringUtils.isEmpty(headerValue)) { return null; } for (String value : headerValue.split(";")) { int idx = value.indexOf('='); if (idx == -1) { continue; } if (paramName.equalsIgnoreCase(value.substring(0, idx))) { return value.substring(idx + 1); } } return null; } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void uriEncode_null() { Assert.assertEquals("", HttpUtils.uriEncodePath(null)); }
public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void uriDecode_null() { Assert.assertNull(HttpUtils.uriDecodePath(null)); }
public static String uriDecodePath(String path) { if (path == null) { return null; } try { return new URI(path).getPath(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriDecode failed, path=\"%s\".", path), e); } }
HttpUtils { public static String uriDecodePath(String path) { if (path == null) { return null; } try { return new URI(path).getPath(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriDecode failed, path=\"%s\".", path), e); } } }
HttpUtils { public static String uriDecodePath(String path) { if (path == null) { return null; } try { return new URI(path).getPath(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriDecode failed, path=\"%s\".", path), e); } } private HttpUtils(); }
HttpUtils { public static String uriDecodePath(String path) { if (path == null) { return null; } try { return new URI(path).getPath(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriDecode failed, path=\"%s\".", path), e); } } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String uriDecodePath(String path) { if (path == null) { return null; } try { return new URI(path).getPath(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriDecode failed, path=\"%s\".", path), e); } } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void uriEncode_chineseAndSpace() { String encoded = HttpUtils.uriEncodePath("测 试"); Assert.assertEquals("%E6%B5%8B%20%E8%AF%95", encoded); Assert.assertEquals("测 试", HttpUtils.uriDecodePath(encoded)); }
public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void uriEncode_failed() { expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage(Matchers.is("uriEncode failed, path=\":\".")); expectedException.expectCause(Matchers.instanceOf(URISyntaxException.class)); HttpUtils.uriEncodePath(":"); }
public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void uriEncode_encodeEntirePath() { String encoded = HttpUtils.uriEncodePath("a%%'+b/def"); Assert.assertEquals("a%25%25'+b/def", encoded); }
public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String uriEncodePath(String path) { try { URI uri = new URI(null, null, path, null); return uri.toASCIIString(); } catch (URISyntaxException e) { throw new IllegalArgumentException(String.format("uriEncode failed, path=\"%s\".", path), e); } } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void pathParamEncode() { Assert.assertEquals("a+b", HttpUtils.encodePathParam("a+b")); Assert.assertEquals("a%25b", HttpUtils.encodePathParam("a%b")); Assert.assertEquals("a%25%25b", HttpUtils.encodePathParam("a%%b")); Assert.assertEquals("%3C%20%3E'%22%EF%BC%88)&%2F%20%20", HttpUtils.encodePathParam("< >'\"()&/ ")); Assert.assertEquals("%E6%B5%8B%20%E8%AF%95", HttpUtils.encodePathParam("测 试")); }
public static String encodePathParam(String pathParam) { return UrlEscapers.urlPathSegmentEscaper().escape(pathParam); }
HttpUtils { public static String encodePathParam(String pathParam) { return UrlEscapers.urlPathSegmentEscaper().escape(pathParam); } }
HttpUtils { public static String encodePathParam(String pathParam) { return UrlEscapers.urlPathSegmentEscaper().escape(pathParam); } private HttpUtils(); }
HttpUtils { public static String encodePathParam(String pathParam) { return UrlEscapers.urlPathSegmentEscaper().escape(pathParam); } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String encodePathParam(String pathParam) { return UrlEscapers.urlPathSegmentEscaper().escape(pathParam); } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
@Test public void testInitializedValues() { initFields(); List<Microservice> list = oGetAllServicesResponse.getServices(); Assert.assertEquals(oMockMicroservice, list.get(0)); }
public List<Microservice> getServices() { return services; }
GetAllServicesResponse { public List<Microservice> getServices() { return services; } }
GetAllServicesResponse { public List<Microservice> getServices() { return services; } }
GetAllServicesResponse { public List<Microservice> getServices() { return services; } List<Microservice> getServices(); void setServices(List<Microservice> services); }
GetAllServicesResponse { public List<Microservice> getServices() { return services; } List<Microservice> getServices(); void setServices(List<Microservice> services); }
@Test public void pathParamEncode_SafeChar() { Assert.assertEquals("-._~!$'()*,;&=@:+", HttpUtils.encodePathParam("-._~!$'()*,;&=@:+")); }
public static String encodePathParam(String pathParam) { return UrlEscapers.urlPathSegmentEscaper().escape(pathParam); }
HttpUtils { public static String encodePathParam(String pathParam) { return UrlEscapers.urlPathSegmentEscaper().escape(pathParam); } }
HttpUtils { public static String encodePathParam(String pathParam) { return UrlEscapers.urlPathSegmentEscaper().escape(pathParam); } private HttpUtils(); }
HttpUtils { public static String encodePathParam(String pathParam) { return UrlEscapers.urlPathSegmentEscaper().escape(pathParam); } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }
HttpUtils { public static String encodePathParam(String pathParam) { return UrlEscapers.urlPathSegmentEscaper().escape(pathParam); } private HttpUtils(); static String parseParamFromHeaderValue(String headerValue, String paramName); static String uriEncodePath(String path); static String encodePathParam(String pathParam); static String uriDecodePath(String path); static String parseFileNameFromHeaderValue(String headerValue); static String getCharsetFromContentType(String contentType); }