ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] alex-plekhanov commented on a change in pull request #6898: IGNITE-12211: Client connections system view
Date Tue, 24 Sep 2019 16:00:55 GMT
alex-plekhanov commented on a change in pull request #6898: IGNITE-12211: Client connections
system view
URL: https://github.com/apache/ignite/pull/6898#discussion_r327698414
 
 

 ##########
 File path: modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 ##########
 @@ -388,6 +401,54 @@ public void testComputeTask() throws Exception {
         }
     }
 
+    /** */
+    @Test
+    public void testClientsConnections() throws Exception {
+        try (IgniteEx g0 = startGrid(0)) {
+            String host = g0.configuration().getClientConnectorConfiguration().getHost();
+
+            if (host == null)
+                host = g0.configuration().getLocalHost();
+
+            int port = g0.configuration().getClientConnectorConfiguration().getPort();
+
+            try (IgniteClient client =
+                     Ignition.startClient(new ClientConfiguration().setAddresses(host + ":"
+ port))) {
+
+                SystemView<ClientConnectionView> conns = g0.context().systemView().view(CLI_CONN_SYS_VIEW);
+
+                assertEquals(1, conns.size());
+
+                ClientConnectionView cliConn = conns.iterator().next();
+
+                assertEquals("THIN", cliConn.type());
+                assertEquals(cliConn.localAddress().getHostName(), cliConn.remoteAddress().getHostName());
+                assertEquals(g0.configuration().getClientConnectorConfiguration().getPort(),
+                    cliConn.localAddress().getPort());
+                assertEquals(cliConn.version(), DEFAULT_VER.asString());
+
+                try (Connection conn =
+                         new IgniteJdbcThinDriver().connect("jdbc:ignite:thin://" + host,
new Properties())) {
+                    assertEquals(2, conns.size());
+                    assertEquals(1, F.size(jdbcConnectionsIterator(conns), alwaysTrue()));
 
 Review comment:
   You can omit predicate here

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message