提交 59e2f69d 编写于 作者: A ascrutae

1.添加redis测试工程

2. 移除log4j shade
上级 4dd00b97
......@@ -21,8 +21,6 @@
<shade.net.bytebuddy.target>com.ai.cloud.skywalking.api.dependencies.net.bytebuddy</shade.net.bytebuddy.target>
<shade.io.netty.source>io.netty</shade.io.netty.source>
<shade.io.netty.target>com.ai.cloud.skywalking.api.dependencies.io.netty</shade.io.netty.target>
<shade.org.apache.logging.log4j>org.apache.logging.log4j</shade.org.apache.logging.log4j>
<shade.org.apache.logging.log4j.target>com.ai.cloud.skywalking.api.dependencies.org.apache.logging.log4j</shade.org.apache.logging.log4j.target>
</properties>
<dependencies>
......@@ -31,21 +29,21 @@
<artifactId>skywalking-jedis-2.x-plugin</artifactId>
<version>1.0-Final</version>
</dependency>
<dependency>
<groupId>com.ai.cloud</groupId>
<artifactId>skywalking-mysql-plugin</artifactId>
<version>1.0-Final</version>
</dependency>
<dependency>
<groupId>com.ai.cloud</groupId>
<artifactId>skywalking-httpClient-4.x-plugin</artifactId>
<version>1.0-Final</version>
</dependency>
<dependency>
<groupId>com.ai.cloud</groupId>
<artifactId>skywalking-httpClient-4.x-plugin-dubbox-rest-attachment</artifactId>
<version>1.0-Final</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.ai.cloud</groupId>-->
<!--<artifactId>skywalking-mysql-plugin</artifactId>-->
<!--<version>1.0-Final</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>com.ai.cloud</groupId>-->
<!--<artifactId>skywalking-httpClient-4.x-plugin</artifactId>-->
<!--<version>1.0-Final</version>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>com.ai.cloud</groupId>-->
<!--<artifactId>skywalking-httpClient-4.x-plugin-dubbox-rest-attachment</artifactId>-->
<!--<version>1.0-Final</version>-->
<!--</dependency>-->
</dependencies>
<build>
<plugins>
......@@ -84,11 +82,6 @@
<pattern>${shade.io.netty.source}</pattern>
<shadedPattern>${shade.io.netty.target}</shadedPattern>
</relocation>
<!--替换log4j -->
<relocation>
<pattern>${shade.org.apache.logging.log4j}</pattern>
<shadedPattern>${shade.org.apache.logging.log4j.target}</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
......
<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>skywalking-agent-test</artifactId>
<groupId>com.ai.skywalking</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>redis-test</artifactId>
<packaging>jar</packaging>
<name>redis-test</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.4.1</version>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
</project>
package com.ai.cloud.skywalking.agent.test;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* Created by xin on 16-6-5.
*/
public class RedisOperator {
private static Logger logger = LogManager.getLogger(RedisOperator.class);
private static JedisPool jedisPool = null;
static {
InputStream inputStream = RedisOperator.class.getResourceAsStream("/redis.conf");
Properties properties = new Properties();
try {
properties.load(inputStream);
} catch (IOException e) {
logger.error("Failed to load redis.conf", e);
System.exit(-1);
}
jedisPool = new JedisPool(properties.getProperty("redis.ip", "127.0.0.1"),
Integer.parseInt(properties.getProperty("redis.port", "2181")));
}
public static void setData(String key, String value) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
jedis.set(key, value);
} catch (Exception e) {
logger.error(e);
} finally {
if (jedis != null)
jedis.close();
}
}
public static String getData(String key) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.get(key);
} catch (Exception e) {
logger.error(e);
} finally {
if (jedis != null)
jedis.close();
}
return "";
}
}
package com.ai.cloud.skywalking.agent.test;
public class RedisPluginTest {
public static void main(String[] args) {
RedisOperator.setData("key1", "value1");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="debug">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d - %c -%-4r [%t] %-5p %x - %m%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
\ No newline at end of file
redis.ip=127.0.0.1
redis.port=6379
\ No newline at end of file
#test
#Mon Dec 28 11:30:29 CST 2015
buriedpoint.businesskey_max_length=300
sender.retry_get_sender_wait_interval=2000
buffer.pool_size=5
senderchecker.check_polling_time=200
sender.is_off=true
sender.max_send_length=20000
consumer.max_consumer=2
consumer.max_wait_time=5
sender.max_copy_num=2
skywalking.application_code=redis-plugin-test
consumer.consumer_fail_retry_wait_interval=50
skywalking.user_id=6
buriedpoint.printf=true
buriedpoint.exclusive_exceptions=
buriedpoint.max_exception_stack_length=4000
sender.connect_percent=100
buffer.buffer_max_size=18000
sender.servers_addr=10.1.235.197:34000;10.1.235.197:35000;
skywalking.sdk_version=1.0a2
skywalking.auth_override=true
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册