You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2019/12/11 03:56:23 UTC

[GitHub] [skywalking] arugal commented on a change in pull request #4040: [test/plugin] immigrate test cassandra scenario.

arugal commented on a change in pull request #4040: [test/plugin] immigrate test cassandra scenario.
URL: https://github.com/apache/skywalking/pull/4040#discussion_r356393142
 
 

 ##########
 File path: test/plugin/scenarios/cassandra-java-driver-3.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/cassandra/controller/CaseController.java
 ##########
 @@ -0,0 +1,172 @@
+/*
+ * 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.skywalking.apm.testcase.cassandra.controller;
+
+import com.datastax.driver.core.Cluster;
+import com.datastax.driver.core.PreparedStatement;
+import com.datastax.driver.core.ResultSet;
+import com.datastax.driver.core.ResultSetFuture;
+import com.datastax.driver.core.Row;
+import com.datastax.driver.core.Session;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+@RequestMapping("/case")
+public class CaseController {
+
+    @Value("${cassandra.host}")
+    private String host;
+
+    @Value("${cassandra.port}")
+    private int port;
+
+    private static final String TEST_EXIST_SQL = "SELECT now() FROM system.local";
+    private static final String CREATE_KEYSPACE_SQL = "CREATE KEYSPACE IF NOT EXISTS demo WITH replication = " +
+        "{'class': 'SimpleStrategy', 'replication_factor': 1}";
+    private static final String CREATE_TABLE_SQL = "CREATE TABLE IF NOT EXISTS demo.test(id TEXT PRIMARY KEY, value TEXT)";
+    private static final String INSERT_DATA_SQL = "INSERT INTO demo.test(id, value) VALUES(?,?)";
+    private static final String SELECT_DATA_SQL = "SELECT * FROM demo.test WHERE id = ?";
+    private static final String DELETE_DATA_SQL = "DELETE FROM demo.test WHERE id = ?";
+    private static final String DROP_TABLE_SQL = "DROP TABLE IF EXISTS demo.test";
+    private static final String DROP_KEYSPACE = "DROP KEYSPACE IF EXISTS demo";
+
+    private Cluster cluster;
+    private Session session;
+
 
 Review comment:
   Hi, `cluster` and `session` should be a local variable, right?

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