This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-java.git


The following commit(s) were added to refs/heads/main by this push:
     new 26f1d98  Add plugin for Alibaba Druid connection pool. (#27)
26f1d98 is described below

commit 26f1d986a24b209c60a70298177d35b01c9d3436
Author: 业余布道师 <[email protected]>
AuthorDate: Sun Sep 19 22:52:32 2021 +0800

    Add plugin for Alibaba Druid connection pool. (#27)
---
 .github/workflows/plugins-test.3.yaml              |   1 +
 CHANGES.md                                         |   1 +
 .../network/trace/component/ComponentsDefine.java  |   2 +
 .../apm-sdk-plugin/druid-1.x-plugin/pom.xml        |  44 +++++
 .../druid/v1/PoolingCloseConnectInterceptor.java   |  50 +++++
 .../druid/v1/PoolingGetConnectInterceptor.java     |  50 +++++
 .../v1/define/DruidDataSourceInstrumentation.java  |  97 ++++++++++
 .../DruidPooledConnectionInstrumentation.java      |  79 ++++++++
 .../src/main/resources/skywalking-plugin.def       |  18 ++
 apm-sniffer/apm-sdk-plugin/pom.xml                 |   1 +
 .../setup/service-agent/java-agent/Plugin-list.md  |   1 +
 .../service-agent/java-agent/Supported-list.md     |   1 +
 .../scenarios/druid-1.x-scenario/bin/startup.sh    |  21 +++
 .../druid-1.x-scenario/config/expectedData.yaml    | 205 +++++++++++++++++++++
 .../scenarios/druid-1.x-scenario/configuration.yml |  32 ++++
 test/plugin/scenarios/druid-1.x-scenario/pom.xml   | 126 +++++++++++++
 .../src/main/assembly/assembly.xml                 |  41 +++++
 .../skywalking/apm/testcase/druid/Application.java |  34 ++++
 .../skywalking/apm/testcase/druid/MySQLConfig.java |  57 ++++++
 .../testcase/druid/controller/CaseController.java  |  58 ++++++
 .../apm/testcase/druid/service/CaseService.java    |  68 +++++++
 .../src/main/resources/application.yaml            |  23 +++
 .../src/main/resources/jdbc.properties             |  18 ++
 .../src/main/resources/log4j2.xml                  |  30 +++
 .../druid-1.x-scenario/support-version.list        |  19 ++
 25 files changed, 1077 insertions(+)

diff --git a/.github/workflows/plugins-test.3.yaml 
b/.github/workflows/plugins-test.3.yaml
index e019e19..db7f403 100644
--- a/.github/workflows/plugins-test.3.yaml
+++ b/.github/workflows/plugins-test.3.yaml
@@ -88,6 +88,7 @@ jobs:
           - gateway-3.x-scenario
           - neo4j-4.x-scenario
           - oracle-scenario
+          - druid-1.x-scenario
     steps:
       - uses: actions/checkout@v2
         with:
diff --git a/CHANGES.md b/CHANGES.md
index d62ac17..f2f1e2f 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -19,6 +19,7 @@ Release Notes.
 * fix the bug that the wrong db.instance value displayed on Skywalking-UI when 
existing multi-database-instance on same host port pair.
 * Add thrift plugin support thrift TMultiplexedProcessor.
 * Add benchmark result for `exception-ignore` plugin and polish plugin guide.
+* Provide Alibaba Druid database connection pool plugin.
 
 #### Documentation
 
diff --git 
a/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
 
b/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
index 8fb8ddb..626ba2c 100755
--- 
a/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
+++ 
b/apm-protocol/apm-network/src/main/java/org/apache/skywalking/apm/network/trace/component/ComponentsDefine.java
@@ -207,4 +207,6 @@ public class ComponentsDefine {
   
     public static final OfficialComponent GUAVA_CACHE = new 
OfficialComponent(114, "GuavaCache");
 
+    public static final OfficialComponent ALIBABA_DRUID = new 
OfficialComponent(115, "AlibabaDruid");
+
 }
diff --git a/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/pom.xml 
b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/pom.xml
new file mode 100644
index 0000000..2bf3a36
--- /dev/null
+++ b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <parent>
+        <artifactId>apm-sdk-plugin</artifactId>
+        <groupId>org.apache.skywalking</groupId>
+        <version>8.8.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>druid-1.x-plugin</artifactId>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <druid.version>1.1.22</druid.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+            <version>${druid.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+
+</project>
\ No newline at end of file
diff --git 
a/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/PoolingCloseConnectInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/PoolingCloseConnectInterceptor.java
new file mode 100644
index 0000000..35cdfa5
--- /dev/null
+++ 
b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/PoolingCloseConnectInterceptor.java
@@ -0,0 +1,50 @@
+/*
+ * 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.plugin.druid.v1;
+
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+import java.lang.reflect.Method;
+
+/**
+ * {@link PoolingCloseConnectInterceptor} intercepted the method of Druid 
closing/returning connection.
+ */
+public class PoolingCloseConnectInterceptor implements 
InstanceMethodsAroundInterceptor {
+
+    @Override
+    public void beforeMethod(EnhancedInstance objInst, Method method, Object[] 
allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws 
Throwable {
+        AbstractSpan span = ContextManager.createLocalSpan("Druid/Connection/" 
+ method.getName());
+        span.setComponent(ComponentsDefine.ALIBABA_DRUID);
+    }
+
+    @Override
+    public Object afterMethod(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable {
+        ContextManager.stopSpan();
+        return ret;
+    }
+
+    @Override
+    public void handleMethodException(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
+        ContextManager.activeSpan().errorOccurred().log(t);
+    }
+}
diff --git 
a/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/PoolingGetConnectInterceptor.java
 
b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/PoolingGetConnectInterceptor.java
new file mode 100644
index 0000000..1056269
--- /dev/null
+++ 
b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/PoolingGetConnectInterceptor.java
@@ -0,0 +1,50 @@
+/*
+ * 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.plugin.druid.v1;
+
+import org.apache.skywalking.apm.agent.core.context.ContextManager;
+import org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.EnhancedInstance;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstanceMethodsAroundInterceptor;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.MethodInterceptResult;
+import org.apache.skywalking.apm.network.trace.component.ComponentsDefine;
+
+import java.lang.reflect.Method;
+
+/**
+ * {@link PoolingGetConnectInterceptor} intercepted the method of Druid 
getting connection.
+ */
+public class PoolingGetConnectInterceptor implements 
InstanceMethodsAroundInterceptor {
+
+    @Override
+    public void beforeMethod(EnhancedInstance objInst, Method method, Object[] 
allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws 
Throwable {
+        AbstractSpan span = ContextManager.createLocalSpan("Druid/Connection/" 
+ method.getName());
+        span.setComponent(ComponentsDefine.ALIBABA_DRUID);
+    }
+
+    @Override
+    public Object afterMethod(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable {
+        ContextManager.stopSpan();
+        return ret;
+    }
+
+    @Override
+    public void handleMethodException(EnhancedInstance objInst, Method method, 
Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) {
+        ContextManager.activeSpan().errorOccurred().log(t);
+    }
+}
diff --git 
a/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/define/DruidDataSourceInstrumentation.java
 
b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/define/DruidDataSourceInstrumentation.java
new file mode 100644
index 0000000..1a04685
--- /dev/null
+++ 
b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/define/DruidDataSourceInstrumentation.java
@@ -0,0 +1,97 @@
+/*
+ * 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.plugin.druid.v1.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
+import static net.bytebuddy.matcher.ElementMatchers.takesNoArguments;
+import static 
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
+
+/**
+ * Druid is a database connection pool from Alibaba inc.
+ * <p>
+ * DruidDataSource provides a "one stop" solution for database connection pool 
solution
+ * basic requirements. DruidDataSource#getConnection() or 
DruidDataSource#getConnection(String, String)
+ * creates (if necessary) and return a connection.
+ */
+public class DruidDataSourceInstrumentation extends 
ClassInstanceMethodsEnhancePluginDefine {
+    private static final String ENHANCE_CLASS = 
"com.alibaba.druid.pool.DruidDataSource";
+    private static final String ENHANCE_METHOD = "getConnection";
+    private static final String INTERCEPTOR_CLASS = 
"org.apache.skywalking.apm.plugin.druid.v1.PoolingGetConnectInterceptor";
+
+    @Override
+    protected ClassMatch enhanceClass() {
+        return byName(ENHANCE_CLASS);
+    }
+
+    @Override
+    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+        return new ConstructorInterceptPoint[0];
+    }
+
+    @Override
+    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() 
{
+        return new InstanceMethodsInterceptPoint[]{
+                new InstanceMethodsInterceptPoint() {
+                    @Override
+                    public ElementMatcher<MethodDescription> 
getMethodsMatcher() {
+                        return named(ENHANCE_METHOD).and(takesNoArguments());
+                    }
+
+                    @Override
+                    public String getMethodsInterceptor() {
+                        return INTERCEPTOR_CLASS;
+                    }
+
+                    @Override
+                    public boolean isOverrideArgs() {
+                        return false;
+                    }
+                },
+                new InstanceMethodsInterceptPoint() {
+                    @Override
+                    public ElementMatcher<MethodDescription> 
getMethodsMatcher() {
+                        return 
named(ENHANCE_METHOD).and(takesArguments(String.class, String.class));
+                    }
+
+                    @Override
+                    public String getMethodsInterceptor() {
+                        return INTERCEPTOR_CLASS;
+                    }
+
+                    @Override
+                    public boolean isOverrideArgs() {
+                        return false;
+                    }
+                }
+        };
+    }
+
+    @Override
+    public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
+        return new StaticMethodsInterceptPoint[0];
+    }
+}
diff --git 
a/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/define/DruidPooledConnectionInstrumentation.java
 
b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/define/DruidPooledConnectionInstrumentation.java
new file mode 100644
index 0000000..ff4e64b
--- /dev/null
+++ 
b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/druid/v1/define/DruidPooledConnectionInstrumentation.java
@@ -0,0 +1,79 @@
+/*
+ * 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.plugin.druid.v1.define;
+
+import net.bytebuddy.description.method.MethodDescription;
+import net.bytebuddy.matcher.ElementMatcher;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.ConstructorInterceptPoint;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.InstanceMethodsInterceptPoint;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.StaticMethodsInterceptPoint;
+import 
org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.ClassInstanceMethodsEnhancePluginDefine;
+import org.apache.skywalking.apm.agent.core.plugin.match.ClassMatch;
+
+import static net.bytebuddy.matcher.ElementMatchers.named;
+import static 
org.apache.skywalking.apm.agent.core.plugin.match.NameMatch.byName;
+
+/**
+ * Druid is a database connection pool from Alibaba inc.
+ * <p>
+ * Druid use DruidPooledConnection which is the delegating implementation of 
Connection. All of
+ * the methods from the Connection interface simply check to see that the 
Connection is active.
+ * DruidPooledConnection#close() close/return connection.
+ */
+public class DruidPooledConnectionInstrumentation extends 
ClassInstanceMethodsEnhancePluginDefine {
+    private static final String ENHANCE_CLASS = 
"com.alibaba.druid.pool.DruidPooledConnection";
+    private static final String ENHANCE_METHOD = "close";
+    private static final String INTERCEPTOR_CLASS = 
"org.apache.skywalking.apm.plugin.druid.v1.PoolingCloseConnectInterceptor";
+
+    @Override
+    protected ClassMatch enhanceClass() {
+        return byName(ENHANCE_CLASS);
+    }
+
+    @Override
+    public ConstructorInterceptPoint[] getConstructorsInterceptPoints() {
+        return new ConstructorInterceptPoint[0];
+    }
+
+    @Override
+    public InstanceMethodsInterceptPoint[] getInstanceMethodsInterceptPoints() 
{
+        return new InstanceMethodsInterceptPoint[]{
+                new InstanceMethodsInterceptPoint() {
+                    @Override
+                    public ElementMatcher<MethodDescription> 
getMethodsMatcher() {
+                        return named(ENHANCE_METHOD);
+                    }
+
+                    @Override
+                    public String getMethodsInterceptor() {
+                        return INTERCEPTOR_CLASS;
+                    }
+
+                    @Override
+                    public boolean isOverrideArgs() {
+                        return false;
+                    }
+                }
+        };
+    }
+
+    @Override
+    public StaticMethodsInterceptPoint[] getStaticMethodsInterceptPoints() {
+        return new StaticMethodsInterceptPoint[0];
+    }
+}
\ No newline at end of file
diff --git 
a/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/resources/skywalking-plugin.def
 
b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/resources/skywalking-plugin.def
new file mode 100644
index 0000000..b0746b3
--- /dev/null
+++ 
b/apm-sniffer/apm-sdk-plugin/druid-1.x-plugin/src/main/resources/skywalking-plugin.def
@@ -0,0 +1,18 @@
+# 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.
+
+druid-1.x=org.apache.skywalking.apm.plugin.druid.v1.define.DruidPooledConnectionInstrumentation
+druid-1.x=org.apache.skywalking.apm.plugin.druid.v1.define.DruidDataSourceInstrumentation
\ No newline at end of file
diff --git a/apm-sniffer/apm-sdk-plugin/pom.xml 
b/apm-sniffer/apm-sdk-plugin/pom.xml
index 0faf6df..67b0860 100644
--- a/apm-sniffer/apm-sdk-plugin/pom.xml
+++ b/apm-sniffer/apm-sdk-plugin/pom.xml
@@ -107,6 +107,7 @@
         <module>jsonrpc4j-1.x-plugin</module>
         <module>neo4j-4.x-plugin</module>
         <module>shardingsphere-plugins</module>
+        <module>druid-1.x-plugin</module>
     </modules>
     <packaging>pom</packaging>
 
diff --git a/docs/en/setup/service-agent/java-agent/Plugin-list.md 
b/docs/en/setup/service-agent/java-agent/Plugin-list.md
index 55936b6..7174384 100644
--- a/docs/en/setup/service-agent/java-agent/Plugin-list.md
+++ b/docs/en/setup/service-agent/java-agent/Plugin-list.md
@@ -10,6 +10,7 @@
 - canal-1.x
 - cassandra-java-driver-3.x
 - dbcp-2.x
+- druid-1.x
 - dubbo
 - ehcache-2.x
 - elastic-job-2.x
diff --git a/docs/en/setup/service-agent/java-agent/Supported-list.md 
b/docs/en/setup/service-agent/java-agent/Supported-list.md
index 72475c4..27e4270 100644
--- a/docs/en/setup/service-agent/java-agent/Supported-list.md
+++ b/docs/en/setup/service-agent/java-agent/Supported-list.md
@@ -122,6 +122,7 @@ metrics based on the tracing data.
   * [Graphql](https://github.com/graphql-java) 8.0 -> 15.x
 * Pool
   * [Apache Commons DBCP](https://github.com/apache/commons-dbcp) 2.x
+  * [Alibaba Druid](https://github.com/alibaba/druid) 1.x
 * Logging Framework
   * [log4j](https://github.com/apache/log4j) 2.x
   * [log4j2](https://github.com/apache/logging-log4j2) 1.2.x 
diff --git a/test/plugin/scenarios/druid-1.x-scenario/bin/startup.sh 
b/test/plugin/scenarios/druid-1.x-scenario/bin/startup.sh
new file mode 100644
index 0000000..c8bfaae
--- /dev/null
+++ b/test/plugin/scenarios/druid-1.x-scenario/bin/startup.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# 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.
+
+home="$(cd "$(dirname $0)"; pwd)"
+
+java -jar ${agent_opts} ${home}/../libs/druid-1.x-scenario.jar &
\ No newline at end of file
diff --git a/test/plugin/scenarios/druid-1.x-scenario/config/expectedData.yaml 
b/test/plugin/scenarios/druid-1.x-scenario/config/expectedData.yaml
new file mode 100644
index 0000000..f2f1ca7
--- /dev/null
+++ b/test/plugin/scenarios/druid-1.x-scenario/config/expectedData.yaml
@@ -0,0 +1,205 @@
+# 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.
+segmentItems:
+- serviceName: druid-1.x-scenario
+  segmentSize: ge 0
+  segments:
+  - segmentId: not null
+    spans:
+    - operationName: Druid/Connection/getConnection
+      parentSpanId: 0
+      spanId: 1
+      spanLayer: Unknown
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 115
+      isError: false
+      spanType: Local
+      peer: ''
+    - operationName: Mysql/JDBI/Statement/execute
+      parentSpanId: 0
+      spanId: 2
+      spanLayer: Database
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 33
+      isError: false
+      spanType: Exit
+      peer: mysql-server:3306
+      tags:
+      - {key: db.type, value: sql}
+      - {key: db.instance, value: test}
+      - {key: db.statement, value: 'CREATE TABLE test_DRUID(id VARCHAR(1) 
PRIMARY
+          KEY, value VARCHAR(1) NOT NULL)'}
+    - operationName: Druid/Connection/close
+      parentSpanId: 0
+      spanId: 3
+      spanLayer: Unknown
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 115
+      isError: false
+      spanType: Local
+      peer: ''
+    - operationName: Druid/Connection/getConnection
+      parentSpanId: 0
+      spanId: 4
+      spanLayer: Unknown
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 115
+      isError: false
+      spanType: Local
+      peer: ''
+    - operationName: Mysql/JDBI/Statement/execute
+      parentSpanId: 0
+      spanId: 5
+      spanLayer: Database
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 33
+      isError: false
+      spanType: Exit
+      peer: mysql-server:3306
+      tags:
+      - {key: db.type, value: sql}
+      - {key: db.instance, value: test}
+      - {key: db.statement, value: 'INSERT INTO test_DRUID(id, value) 
VALUES(1,1)'}
+    - operationName: Druid/Connection/close
+      parentSpanId: 0
+      spanId: 6
+      spanLayer: Unknown
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 115
+      isError: false
+      spanType: Local
+      peer: ''
+    - operationName: Druid/Connection/getConnection
+      parentSpanId: 0
+      spanId: 7
+      spanLayer: Unknown
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 115
+      isError: false
+      spanType: Local
+      peer: ''
+    - operationName: Mysql/JDBI/Statement/execute
+      parentSpanId: 0
+      spanId: 8
+      spanLayer: Database
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 33
+      isError: false
+      spanType: Exit
+      peer: mysql-server:3306
+      tags:
+      - {key: db.type, value: sql}
+      - {key: db.instance, value: test}
+      - {key: db.statement, value: 'SELECT id, value FROM test_DRUID WHERE 
id=1'}
+    - operationName: Druid/Connection/close
+      parentSpanId: 0
+      spanId: 9
+      spanLayer: Unknown
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 115
+      isError: false
+      spanType: Local
+      peer: ''
+    - operationName: Druid/Connection/getConnection
+      parentSpanId: 0
+      spanId: 10
+      spanLayer: Unknown
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 115
+      isError: false
+      spanType: Local
+      peer: ''
+    - operationName: Mysql/JDBI/Statement/execute
+      parentSpanId: 0
+      spanId: 11
+      spanLayer: Database
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 33
+      isError: false
+      spanType: Exit
+      peer: mysql-server:3306
+      tags:
+      - {key: db.type, value: sql}
+      - {key: db.instance, value: test}
+      - {key: db.statement, value: 'DELETE FROM test_DRUID WHERE id=1'}
+    - operationName: Druid/Connection/close
+      parentSpanId: 0
+      spanId: 12
+      spanLayer: Unknown
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 115
+      isError: false
+      spanType: Local
+      peer: ''
+    - operationName: Druid/Connection/getConnection
+      parentSpanId: 0
+      spanId: 13
+      spanLayer: Unknown
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 115
+      isError: false
+      spanType: Local
+      peer: ''
+    - operationName: Mysql/JDBI/Statement/execute
+      parentSpanId: 0
+      spanId: 14
+      spanLayer: Database
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 33
+      isError: false
+      spanType: Exit
+      peer: mysql-server:3306
+      tags:
+      - {key: db.type, value: sql}
+      - {key: db.instance, value: test}
+      - {key: db.statement, value: 'DROP table test_DRUID'}
+    - operationName: Druid/Connection/close
+      parentSpanId: 0
+      spanId: 15
+      spanLayer: Unknown
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 115
+      isError: false
+      spanType: Local
+      peer: ''
+    - operationName: /druid-1.x-scenario/case/druid-1.x-scenario
+      parentSpanId: -1
+      spanId: 0
+      spanLayer: Http
+      startTime: gt 0
+      endTime: gt 0
+      componentId: 1
+      isError: false
+      spanType: Entry
+      peer: ''
+      tags:
+      - {key: url, value: 
'http://localhost:8080/druid-1.x-scenario/case/druid-1.x-scenario'}
+      - {key: http.method, value: GET}
diff --git a/test/plugin/scenarios/druid-1.x-scenario/configuration.yml 
b/test/plugin/scenarios/druid-1.x-scenario/configuration.yml
new file mode 100644
index 0000000..11e968c
--- /dev/null
+++ b/test/plugin/scenarios/druid-1.x-scenario/configuration.yml
@@ -0,0 +1,32 @@
+# 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.
+
+type: jvm
+entryService: http://localhost:8080/druid-1.x-scenario/case/druid-1.x-scenario
+healthCheck: http://localhost:8080/druid-1.x-scenario/case/healthCheck
+startScript: ./bin/startup.sh
+environment:
+depends_on:
+  - mysql-server
+dependencies:
+  mysql-server:
+    image: mysql:5.7
+    hostname: mysql-server
+    expose:
+      - "3306"
+    environment:
+      - MYSQL_ROOT_PASSWORD=root
+      - MYSQL_DATABASE=test
diff --git a/test/plugin/scenarios/druid-1.x-scenario/pom.xml 
b/test/plugin/scenarios/druid-1.x-scenario/pom.xml
new file mode 100644
index 0000000..1c1eede
--- /dev/null
+++ b/test/plugin/scenarios/druid-1.x-scenario/pom.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  ~
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+
+    <groupId>org.apache.skywalking.apm.testcase</groupId>
+    <artifactId>druid-1.x-scenario</artifactId>
+    <version>1.0.0</version>
+    <packaging>jar</packaging>
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <compiler.version>1.8</compiler.version>
+
+        <test.framework.version>1.1.22</test.framework.version>
+        <docker.image.version>${test.framework.version}</docker.image.version>
+
+        <spring-boot-version>2.1.6.RELEASE</spring-boot-version>
+    </properties>
+
+    <name>skywalking-druid-1.x-scenario</name>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring-boot-version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-log4j2</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.25</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+            <version>${test.framework.version}</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>druid-1.x-scenario</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>${compiler.version}</source>
+                    <target>${compiler.version}</target>
+                    <encoding>${project.build.sourceEncoding}</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>assemble</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <descriptors>
+                                
<descriptor>src/main/assembly/assembly.xml</descriptor>
+                            </descriptors>
+                            <outputDirectory>./target/</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file
diff --git 
a/test/plugin/scenarios/druid-1.x-scenario/src/main/assembly/assembly.xml 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/assembly/assembly.xml
new file mode 100644
index 0000000..7250d7d
--- /dev/null
+++ b/test/plugin/scenarios/druid-1.x-scenario/src/main/assembly/assembly.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  ~
+  -->
+<assembly
+    
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2";
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+    
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
 http://maven.apache.org/xsd/assembly-1.1.2.xsd";>
+    <formats>
+        <format>zip</format>
+    </formats>
+
+    <fileSets>
+        <fileSet>
+            <directory>./bin</directory>
+            <fileMode>0775</fileMode>
+        </fileSet>
+    </fileSets>
+
+    <files>
+        <file>
+            <source>${project.build.directory}/druid-1.x-scenario.jar</source>
+            <outputDirectory>./libs</outputDirectory>
+            <fileMode>0775</fileMode>
+        </file>
+    </files>
+</assembly>
diff --git 
a/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/Application.java
 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/Application.java
new file mode 100644
index 0000000..2023e31
--- /dev/null
+++ 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/Application.java
@@ -0,0 +1,34 @@
+/*
+ * 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.druid;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+
+    public static void main(String[] args) {
+        try {
+            SpringApplication.run(Application.class, args);
+        } catch (Exception e) {
+            // Never do this
+        }
+    }
+}
diff --git 
a/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/MySQLConfig.java
 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/MySQLConfig.java
new file mode 100644
index 0000000..5833768
--- /dev/null
+++ 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/MySQLConfig.java
@@ -0,0 +1,57 @@
+/*
+ * 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.druid;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+public class MySQLConfig {
+    private static Logger LOGGER = LogManager.getLogger(MySQLConfig.class);
+    private static String URL;
+    private static String USER_NAME;
+    private static String PASSWORD;
+
+    static {
+        InputStream inputStream = 
MySQLConfig.class.getClassLoader().getResourceAsStream("/jdbc.properties");
+        Properties properties = new Properties();
+        try {
+            properties.load(inputStream);
+        } catch (IOException e) {
+            LOGGER.error("Failed to load config", e);
+        }
+        URL = properties.getProperty("mysql.url");
+        USER_NAME = properties.getProperty("mysql.username");
+        PASSWORD = properties.getProperty("mysql.password");
+    }
+
+    public static String getUrl() {
+        return URL;
+    }
+
+    public static String getUserName() {
+        return USER_NAME;
+    }
+
+    public static String getPassword() {
+        return PASSWORD;
+    }
+}
diff --git 
a/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/controller/CaseController.java
 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/controller/CaseController.java
new file mode 100644
index 0000000..0762fea
--- /dev/null
+++ 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/controller/CaseController.java
@@ -0,0 +1,58 @@
+/*
+ * 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.druid.controller;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.apache.skywalking.apm.testcase.druid.service.CaseService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/case")
+public class CaseController {
+
+    @Autowired
+    CaseService caseService;
+
+    private static final Logger LOGGER = 
LogManager.getLogger(CaseController.class);
+
+    private static final String SUCCESS = "Success";
+
+    @RequestMapping("/druid-1.x-scenario")
+    @ResponseBody
+    public String testcase() throws Exception {
+        try {
+            caseService.testCase();
+        } catch (Exception e) {
+            LOGGER.error("Failed to execute sql.", e);
+            throw e;
+        }
+        return SUCCESS;
+    }
+
+    @RequestMapping("/healthCheck")
+    @ResponseBody
+    public String healthCheck() throws Exception {
+        return SUCCESS;
+    }
+
+}
diff --git 
a/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/service/CaseService.java
 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/service/CaseService.java
new file mode 100644
index 0000000..42f13c0
--- /dev/null
+++ 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/java/org/apache/skywalking/apm/testcase/druid/service/CaseService.java
@@ -0,0 +1,68 @@
+/*
+ * 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.druid.service;
+
+import com.alibaba.druid.pool.DruidDataSource;
+import org.apache.skywalking.apm.testcase.druid.MySQLConfig;
+import org.springframework.stereotype.Service;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+@Service
+public class CaseService {
+
+    public static DruidDataSource DS;
+    private static final String CREATE_TABLE_SQL = "CREATE TABLE test_DRUID(id 
VARCHAR(1) PRIMARY KEY, value VARCHAR(1) NOT NULL)";
+    private static final String INSERT_DATA_SQL = "INSERT INTO test_DRUID(id, 
value) VALUES(1,1)";
+    private static final String QUERY_DATA_SQL = "SELECT id, value FROM 
test_DRUID WHERE id=1";
+    private static final String DELETE_DATA_SQL = "DELETE FROM test_DRUID 
WHERE id=1";
+    private static final String DROP_TABLE_SQL = "DROP table test_DRUID";
+
+    static {
+        DS = new DruidDataSource();
+        try {
+            DS.setUrl(MySQLConfig.getUrl());
+            DS.setUsername(MySQLConfig.getUserName());
+            DS.setPassword(MySQLConfig.getPassword());
+            DS.init();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void testCase() {
+        sqlExecutor(CREATE_TABLE_SQL);
+        sqlExecutor(INSERT_DATA_SQL);
+        sqlExecutor(QUERY_DATA_SQL);
+        sqlExecutor(DELETE_DATA_SQL);
+        sqlExecutor(DROP_TABLE_SQL);
+    }
+
+    public void sqlExecutor(String sql) {
+        try (Connection conn = DS.getConnection()) {
+            Statement statement = conn.createStatement();
+            statement.execute(sql);
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+    }
+
+}
diff --git 
a/test/plugin/scenarios/druid-1.x-scenario/src/main/resources/application.yaml 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/resources/application.yaml
new file mode 100644
index 0000000..be5a21e
--- /dev/null
+++ 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/resources/application.yaml
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+#
+server:
+  port: 8080
+  servlet:
+    context-path: /druid-1.x-scenario
+logging:
+  config: classpath:log4j2.xml
\ No newline at end of file
diff --git 
a/test/plugin/scenarios/druid-1.x-scenario/src/main/resources/jdbc.properties 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/resources/jdbc.properties
new file mode 100644
index 0000000..5c266c3
--- /dev/null
+++ 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/resources/jdbc.properties
@@ -0,0 +1,18 @@
+# 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.
+mysql.url=jdbc:mysql://mysql-server:3306/test?serverTimezone=CST
+mysql.username=root
+mysql.password=root
diff --git 
a/test/plugin/scenarios/druid-1.x-scenario/src/main/resources/log4j2.xml 
b/test/plugin/scenarios/druid-1.x-scenario/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..9849ed5
--- /dev/null
+++ b/test/plugin/scenarios/druid-1.x-scenario/src/main/resources/log4j2.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  ~
+  -->
+<Configuration status="WARN">
+    <Appenders>
+        <Console name="Console" target="SYSTEM_ERR">
+            <PatternLayout charset="UTF-8" pattern="[%d{yyyy-MM-dd 
HH:mm:ss:SSS}] [%p] - %l - %m%n"/>
+        </Console>
+    </Appenders>
+    <Loggers>
+        <Root level="WARN">
+            <AppenderRef ref="Console"/>
+        </Root>
+    </Loggers>
+</Configuration>
\ No newline at end of file
diff --git a/test/plugin/scenarios/druid-1.x-scenario/support-version.list 
b/test/plugin/scenarios/druid-1.x-scenario/support-version.list
new file mode 100644
index 0000000..aac5275
--- /dev/null
+++ b/test/plugin/scenarios/druid-1.x-scenario/support-version.list
@@ -0,0 +1,19 @@
+# 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.
+
+1.2.0
+1.1.0
+1.0.0

Reply via email to