You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/09/19 15:08:48 UTC

[GitHub] [iotdb] CRZbulabula commented on a diff in pull request #7326: [IOTDB-4394] Build SessionIT environment

CRZbulabula commented on code in PR #7326:
URL: https://github.com/apache/iotdb/pull/7326#discussion_r974373188


##########
integration-test/src/main/java/org/apache/iotdb/itbase/env/BaseEnv.java:
##########
@@ -64,4 +70,63 @@ Connection getConnection(Constant.Version version, String username, String passw
   void setDataNodeWrapperList(List<DataNodeWrapper> dataNodeWrapperList);
 
   IConfigNodeRPCService.Iface getConfigNodeConnection() throws IOException;
+
+  default ISession getSessionConnection() throws IoTDBConnectionException {
+    return getSessionConnection(
+        SessionConfig.DEFAULT_HOST,
+        SessionConfig.DEFAULT_PORT,
+        SessionConfig.DEFAULT_USER,
+        SessionConfig.DEFAULT_PASSWORD,
+        SessionConfig.DEFAULT_FETCH_SIZE,
+        null,
+        SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
+        SessionConfig.DEFAULT_MAX_FRAME_SIZE,
+        SessionConfig.DEFAULT_CACHE_LEADER_MODE,
+        SessionConfig.DEFAULT_VERSION);
+  }
+
+  default ISession getSessionConnection(
+      String host,
+      int rpcPort,
+      String username,
+      String password,
+      int fetchSize,
+      ZoneId zoneId,
+      int thriftDefaultBufferSize,
+      int thriftMaxFrameSize,
+      boolean enableCacheLeader,
+      Version version)
+      throws IoTDBConnectionException {
+    Session session =
+        new Session(
+            host,
+            rpcPort,
+            username,
+            password,
+            fetchSize,
+            zoneId,
+            thriftDefaultBufferSize,
+            thriftMaxFrameSize,
+            enableCacheLeader,
+            version);
+
+    session.open();
+    return session;
+  }
+
+  default ISession getSessionConnection(List<String> nodeUrls) throws IoTDBConnectionException {
+    Session session =
+        new Session(
+            nodeUrls,
+            SessionConfig.DEFAULT_USER,
+            SessionConfig.DEFAULT_PASSWORD,
+            SessionConfig.DEFAULT_FETCH_SIZE,
+            null,
+            SessionConfig.DEFAULT_INITIAL_BUFFER_CAPACITY,
+            SessionConfig.DEFAULT_MAX_FRAME_SIZE,
+            SessionConfig.DEFAULT_CACHE_LEADER_MODE,
+            SessionConfig.DEFAULT_VERSION);
+    session.open();
+    return session;
+  }

Review Comment:
   Is it possible to implement SessionFactory in BaseEnv? Such that we can construct more complex tests in the future.



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org