cjj2010 commented on code in PR #4756:
URL: https://github.com/apache/calcite/pull/4756#discussion_r2715144331


##########
redis/src/test/java/org/apache/calcite/adapter/redis/RedisAdapterConfigCaseBase.java:
##########
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.calcite.adapter.redis;
+
+import org.apache.calcite.config.CalciteSystemProperty;
+import org.apache.calcite.test.CalciteAssert;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import org.junit.jupiter.api.Test;
+
+import redis.clients.jedis.Protocol;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
+/**
+ * Tests for the {@code org.apache.calcite.adapter.redis} package.
+ */
+public class RedisAdapterConfigCaseBase extends RedisAdapterCaseBase {
+
+  private String model;
+
+  /** Test case of
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-7388";>[CALCITE-7388]
+   * Redis Adapter operand config should not support empty string</a>. */
+  protected void readModelFromJsonString(String jsonString) {
+    String strResult = null;
+    try {
+      ObjectMapper objMapper = new ObjectMapper();
+      objMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true)
+          .configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true)
+          .configure(JsonParser.Feature.ALLOW_COMMENTS, true);
+      JsonNode rootNode = objMapper.readTree(jsonString);
+      strResult =
+          rootNode.toString().replace(Integer.toString(Protocol.DEFAULT_PORT),
+              Integer.toString(getRedisServerPort()));
+    } catch (Exception e) {
+      // Log the exception for debugging purposes
+      System.err.println("Error parsing model from JSON string: " + 
e.getMessage());
+      e.printStackTrace();

Review Comment:
   > What I mean is that all we need is one log output or throw a 
RuntimeException.
   
   Okay, it's done



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to