diff --git a/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/config/ProfilerConfig.java b/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/config/ProfilerConfig.java
index 436ff05bd..21b15161a 100644
--- a/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/config/ProfilerConfig.java
+++ b/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/config/ProfilerConfig.java
@@ -318,7 +318,7 @@ public class ProfilerConfig {
return ioBufferingEnable;
}
- public int getIoBufferingBufferBufferSize() {
+ public int getIoBufferingBufferSize() {
return ioBufferingBufferSize;
}
diff --git a/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/interceptor/InterceptorRegistry.java b/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/interceptor/InterceptorRegistry.java
index 790e2cda6..d141c8075 100644
--- a/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/interceptor/InterceptorRegistry.java
+++ b/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/interceptor/InterceptorRegistry.java
@@ -37,7 +37,7 @@ public class InterceptorRegistry {
if (interceptor == null) {
return -1;
}
- int newId = nextId();
+ final int newId = nextId();
if (newId >= max) {
throw new IndexOutOfBoundsException("size=" + index.length + " id=" + id);
}
@@ -55,7 +55,7 @@ public class InterceptorRegistry {
if (interceptor == null) {
return -1;
}
- int newId = nextId();
+ final int newId = nextId();
if (newId >= max) {
throw new IndexOutOfBoundsException("size=" + index.length + " id=" + id);
}
diff --git a/bootstrap/src/test/java/com/navercorp/pinpoint/bootstrap/config/ProfilerConfigTest.java b/bootstrap/src/test/java/com/navercorp/pinpoint/bootstrap/config/ProfilerConfigTest.java
index 025196068..cfadad7ec 100644
--- a/bootstrap/src/test/java/com/navercorp/pinpoint/bootstrap/config/ProfilerConfigTest.java
+++ b/bootstrap/src/test/java/com/navercorp/pinpoint/bootstrap/config/ProfilerConfigTest.java
@@ -67,7 +67,7 @@ public class ProfilerConfigTest {
profilerConfig.readConfigFile(path);
Assert.assertEquals(profilerConfig.isIoBufferingEnable(), false);
- Assert.assertEquals(profilerConfig.getIoBufferingBufferBufferSize(), 30);
+ Assert.assertEquals(profilerConfig.getIoBufferingBufferSize(), 30);
}
@Test
@@ -79,7 +79,7 @@ public class ProfilerConfigTest {
profilerConfig.readConfigFile(path);
Assert.assertEquals(profilerConfig.isIoBufferingEnable(), true);
- Assert.assertEquals(profilerConfig.getIoBufferingBufferBufferSize(), 10);
+ Assert.assertEquals(profilerConfig.getIoBufferingBufferSize(), 10);
}
@Test
diff --git a/collector/src/main/resources-local/hbase.properties b/collector/src/main/resources-local/hbase.properties
index 9a0cb44b9..193fa8481 100644
--- a/collector/src/main/resources-local/hbase.properties
+++ b/collector/src/main/resources-local/hbase.properties
@@ -1,5 +1,10 @@
+# local
#hbase.client.host=localhost
+# dev
+#hbase.client.host=dev.zk.pinpoint.navercorp.com
+# local-dev
hbase.client.host=10.101.17.108
+# ??
#hbase.client.host=10.25.149.61
hbase.client.port=2181
hbase.htable.threads.max=4
\ No newline at end of file
diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/receiver/tcp/TCPReceiverBOTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/receiver/tcp/TCPReceiverBOTest.java
index d045011c7..e7d57a61b 100644
--- a/collector/src/test/java/com/navercorp/pinpoint/collector/receiver/tcp/TCPReceiverBOTest.java
+++ b/collector/src/test/java/com/navercorp/pinpoint/collector/receiver/tcp/TCPReceiverBOTest.java
@@ -14,6 +14,8 @@ import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -33,6 +35,8 @@ import com.nhn.pinpoint.thrift.io.HeaderTBaseSerializer;
@ContextConfiguration("classpath:applicationContext-collector.xml")
@RunWith(SpringJUnit4ClassRunner.class)
public class TCPReceiverBOTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
@Autowired
private TCPReceiver tcpReceiver;
@@ -99,7 +103,7 @@ public class TCPReceiverBOTest {
is.read(payload);
for (byte b : payload) {
- System.out.print("!!" + b);
+ logger.warn("!!!{}", b);
}
ChannelBuffer cb = ChannelBuffers.wrappedBuffer(payload);
diff --git a/collector/src/test/java/com/navercorp/pinpoint/collector/receiver/udp/NettyUdpReceiverTest.java b/collector/src/test/java/com/navercorp/pinpoint/collector/receiver/udp/NettyUdpReceiverTest.java
index 49488c05a..640034fa1 100644
--- a/collector/src/test/java/com/navercorp/pinpoint/collector/receiver/udp/NettyUdpReceiverTest.java
+++ b/collector/src/test/java/com/navercorp/pinpoint/collector/receiver/udp/NettyUdpReceiverTest.java
@@ -39,7 +39,7 @@ public class NettyUdpReceiverTest {
public void run() {
udpServer.bind(new InetSocketAddress("127.0.0.1", PORT));
try {
- System.out.println("server-await");
+ logger.debug("server-await");
latch.await();
} catch (InterruptedException e) {
}
@@ -47,7 +47,7 @@ public class NettyUdpReceiverTest {
});
thread.start();
Thread.sleep(1000);
- System.out.println("start--------");
+ logger.debug("start--------");
// ExecutorService executorService = Executors.newFixedThreadPool(10);
// for (int i =0; i< 10; i++) {
// executorService.execute(new Runnable() {
@@ -90,7 +90,7 @@ public class NettyUdpReceiverTest {
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
String name = Thread.currentThread().getName();
- System.out.println("sleep-------------------" + name);
+ logger.debug("sleep-------------------{}", name);
Thread.sleep(10000);
// if (!name.equals("New I/O worker #1")) {
logger.info("messageReceived thread-{} message:", Thread.currentThread().getName());
diff --git a/commons/src/main/java/com/navercorp/pinpoint/common/AnnotationKey.java b/commons/src/main/java/com/navercorp/pinpoint/common/AnnotationKey.java
index 69faf95c1..a97b4faca 100644
--- a/commons/src/main/java/com/navercorp/pinpoint/common/AnnotationKey.java
+++ b/commons/src/main/java/com/navercorp/pinpoint/common/AnnotationKey.java
@@ -1,7 +1,6 @@
package com.nhn.pinpoint.common;
-import java.util.HashMap;
-import java.util.Map;
+import com.nhn.pinpoint.common.util.apache.IntHashMap;
/**
* @author netspider
diff --git a/commons/src/main/java/com/navercorp/pinpoint/common/ServiceType.java b/commons/src/main/java/com/navercorp/pinpoint/common/ServiceType.java
index 118b9ab37..8d8021a14 100644
--- a/commons/src/main/java/com/navercorp/pinpoint/common/ServiceType.java
+++ b/commons/src/main/java/com/navercorp/pinpoint/common/ServiceType.java
@@ -13,6 +13,7 @@ import java.util.List;
import java.util.Map;
import com.nhn.pinpoint.common.util.RpcCodeRange;
+import com.nhn.pinpoint.common.util.apache.IntHashMap;
/**
* @author emeroad
diff --git a/commons/src/main/java/com/navercorp/pinpoint/common/util/BytesUtils.java b/commons/src/main/java/com/navercorp/pinpoint/common/util/BytesUtils.java
index e2b0f986f..8500e3d2a 100644
--- a/commons/src/main/java/com/navercorp/pinpoint/common/util/BytesUtils.java
+++ b/commons/src/main/java/com/navercorp/pinpoint/common/util/BytesUtils.java
@@ -21,13 +21,6 @@ public final class BytesUtils {
private static final String UTF8 = "UTF-8";
private static final Logger LOGGER = Logger.getLogger(BytesUtils.class.getName());
- @Deprecated
- public static byte[] longLongToBytes(final long value1, final long value2) {
- final byte[] buffer = new byte[LONG_LONG_BYTE_LENGTH];
- writeFirstLong0(value1, buffer);
- writeSecondLong0(value2, buffer);
- return buffer;
- }
public static byte[] stringLongLongToBytes(final String string, final int maxStringSize, final long value1, final long value2) {
if (string == null) {
@@ -60,22 +53,6 @@ public final class BytesUtils {
System.arraycopy(stringBytes, 0, buffer, offset, stringBytes.length);
}
- @Deprecated
- public static long[] bytesToLongLong(final byte[] buf) {
- if (buf == null) {
- throw new NullPointerException("buf must not be null");
- }
- if (buf.length < LONG_LONG_BYTE_LENGTH) {
- throw new IllegalArgumentException("Illegal buf size.");
- }
- final long[] result = new long[2];
-
- result[0] = bytesToFirstLong0(buf);
- result[1] = bytesToSecondLong0(buf);
-
- return result;
- }
-
public static long bytesToLong(final byte[] buf, final int offset) {
if (buf == null) {
throw new NullPointerException("buf must not be null");
@@ -137,51 +114,6 @@ public final class BytesUtils {
return (short) (((byte1 & 0xff) << 8) | ((byte2 & 0xff)));
}
- public static long bytesToFirstLong(final byte[] buf) {
- if (buf == null) {
- throw new NullPointerException("buf must not be null");
- }
- if (buf.length < LONG_BYTE_LENGTH) {
- throw new IllegalArgumentException("buf.length is too small(8). buf.length:" + buf.length);
- }
-
- return bytesToFirstLong0(buf);
- }
-
- private static long bytesToFirstLong0(byte[] buf) {
- final long rv = (((long) buf[0] & 0xff) << 56)
- | (((long) buf[1] & 0xff) << 48)
- | (((long) buf[2] & 0xff) << 40)
- | (((long) buf[3] & 0xff) << 32)
- | (((long) buf[4] & 0xff) << 24)
- | (((long) buf[5] & 0xff) << 16)
- | (((long) buf[6] & 0xff) << 8)
- | (((long) buf[7] & 0xff));
- return rv;
- }
-
- public static long bytesToSecondLong(final byte[] buf) {
- if (buf == null) {
- throw new NullPointerException("buf must not be null");
- }
- if (buf.length < LONG_LONG_BYTE_LENGTH) {
- throw new IllegalArgumentException("buf.length is too small(16). buf.length:" + buf.length);
- }
-
- return bytesToSecondLong0(buf);
- }
-
- private static long bytesToSecondLong0(final byte[] buf) {
- final long rv = (((long) buf[8] & 0xff) << 56)
- | (((long) buf[9] & 0xff) << 48)
- | (((long) buf[10] & 0xff) << 40)
- | (((long) buf[11] & 0xff) << 32)
- | (((long) buf[12] & 0xff) << 24)
- | (((long) buf[13] & 0xff) << 16)
- | (((long) buf[14] & 0xff) << 8)
- | (((long) buf[15] & 0xff));
- return rv;
- }
public static int writeLong(final long value, final byte[] buf, int offset) {
if (buf == null) {
@@ -284,30 +216,9 @@ public final class BytesUtils {
}
}
- @Deprecated
- public static void writeFirstLong(final long value, final byte[] buf) {
- if (buf == null) {
- throw new NullPointerException("buf must not be null");
- }
- if (buf.length < LONG_BYTE_LENGTH) {
- throw new IllegalArgumentException("buf.length is too small(8). buf.length:" + buf.length);
- }
- writeFirstLong0(value, buf);
- }
-
- private static void writeFirstLong0(final long value, final byte[] buf) {
- buf[0] = (byte) (value >> 56);
- buf[1] = (byte) (value >> 48);
- buf[2] = (byte) (value >> 40);
- buf[3] = (byte) (value >> 32);
- buf[4] = (byte) (value >> 24);
- buf[5] = (byte) (value >> 16);
- buf[6] = (byte) (value >> 8);
- buf[7] = (byte) (value);
- }
private static void writeFirstLong0(final long value, final byte[] buf, int offset) {
- buf[0 + offset] = (byte) (value >> 56);
+ buf[offset] = (byte) (value >> 56);
buf[1 + offset] = (byte) (value >> 48);
buf[2 + offset] = (byte) (value >> 40);
buf[3 + offset] = (byte) (value >> 32);
@@ -317,32 +228,11 @@ public final class BytesUtils {
buf[7 + offset] = (byte) (value);
}
- @Deprecated
- public static void writeSecondLong(final long value, final byte[] buf) {
- if (buf == null) {
- throw new NullPointerException("buf must not be null");
- }
- if (buf.length < LONG_LONG_BYTE_LENGTH) {
- throw new IllegalArgumentException("buf.length is too small(16). buf.length:" + buf.length);
- }
- writeSecondLong0(value, buf);
- }
-
private static Logger getLogger() {
return Logger.getLogger(BytesUtils.class.getName());
}
- private static void writeSecondLong0(final long value, final byte[] buf) {
- buf[8] = (byte) (value >> 56);
- buf[9] = (byte) (value >> 48);
- buf[10] = (byte) (value >> 40);
- buf[11] = (byte) (value >> 32);
- buf[12] = (byte) (value >> 24);
- buf[13] = (byte) (value >> 16);
- buf[14] = (byte) (value >> 8);
- buf[15] = (byte) (value);
- }
private static void writeSecondLong0(final long value, final byte[] buf, int offset) {
buf[8 + offset] = (byte) (value >> 56);
@@ -459,14 +349,15 @@ public final class BytesUtils {
public static byte[] concat(final byte[]... arrays) {
int totalLength = 0;
- for (int i = 0; i < arrays.length; i++) {
+ final int length = arrays.length;
+ for (int i = 0; i < length; i++) {
totalLength += arrays[i].length;
}
byte[] result = new byte[totalLength];
int currentIndex = 0;
- for (int i = 0; i < arrays.length; i++) {
+ for (int i = 0; i < length; i++) {
System.arraycopy(arrays[i], 0, result, currentIndex, arrays[i].length);
currentIndex += arrays[i].length;
}
diff --git a/commons/src/main/java/com/navercorp/pinpoint/common/util/JvmUtils.java b/commons/src/main/java/com/navercorp/pinpoint/common/util/JvmUtils.java
index 7d248e2e2..20d775246 100644
--- a/commons/src/main/java/com/navercorp/pinpoint/common/util/JvmUtils.java
+++ b/commons/src/main/java/com/navercorp/pinpoint/common/util/JvmUtils.java
@@ -4,9 +4,6 @@ import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.util.Map;
-import com.nhn.pinpoint.common.SystemPropertyKey;
-import com.nhn.pinpoint.common.JvmVersion;
-
/**
* @author hyungil.jeong
*/
diff --git a/commons/src/main/java/com/navercorp/pinpoint/common/JvmVersion.java b/commons/src/main/java/com/navercorp/pinpoint/common/util/JvmVersion.java
similarity index 93%
rename from commons/src/main/java/com/navercorp/pinpoint/common/JvmVersion.java
rename to commons/src/main/java/com/navercorp/pinpoint/common/util/JvmVersion.java
index 8873f4b3e..8a049665f 100644
--- a/commons/src/main/java/com/navercorp/pinpoint/common/JvmVersion.java
+++ b/commons/src/main/java/com/navercorp/pinpoint/common/util/JvmVersion.java
@@ -1,54 +1,54 @@
-package com.nhn.pinpoint.common;
-
-/**
- * @author hyungil.jeong
- */
-public enum JvmVersion {
- JAVA_5(1.5, 49),
- JAVA_6(1.6, 50),
- JAVA_7(1.7, 51),
- JAVA_8(1.8, 52),
- UNSUPPORTED(-1, -1);
-
- private final double version;
- private final int classVersion;
-
- private JvmVersion(double version, int classVersion) {
- this.version = version;
- this.classVersion = classVersion;
- }
-
- public boolean onOrAfter(JvmVersion other) {
- if (this == UNSUPPORTED || other == UNSUPPORTED) {
- return false;
- }
- return this == other || this.version > other.version;
- }
-
- public static JvmVersion getFromVersion(String javaVersion) {
- try {
- double version = Double.parseDouble(javaVersion);
- return getFromVersion(version);
- } catch (NumberFormatException e) {
- return UNSUPPORTED;
- }
- }
-
- public static JvmVersion getFromVersion(double javaVersion) {
- for (JvmVersion version : JvmVersion.values()) {
- if (version.version == javaVersion) {
- return version;
- }
- }
- return JvmVersion.UNSUPPORTED;
- }
-
- public static JvmVersion getFromClassVersion(int classVersion) {
- for (JvmVersion version : JvmVersion.values()) {
- if (version.classVersion == classVersion) {
- return version;
- }
- }
- return JvmVersion.UNSUPPORTED;
- }
-}
+package com.nhn.pinpoint.common.util;
+
+/**
+ * @author hyungil.jeong
+ */
+public enum JvmVersion {
+ JAVA_5(1.5, 49),
+ JAVA_6(1.6, 50),
+ JAVA_7(1.7, 51),
+ JAVA_8(1.8, 52),
+ UNSUPPORTED(-1, -1);
+
+ private final double version;
+ private final int classVersion;
+
+ private JvmVersion(double version, int classVersion) {
+ this.version = version;
+ this.classVersion = classVersion;
+ }
+
+ public boolean onOrAfter(JvmVersion other) {
+ if (this == UNSUPPORTED || other == UNSUPPORTED) {
+ return false;
+ }
+ return this == other || this.version > other.version;
+ }
+
+ public static JvmVersion getFromVersion(String javaVersion) {
+ try {
+ double version = Double.parseDouble(javaVersion);
+ return getFromVersion(version);
+ } catch (NumberFormatException e) {
+ return UNSUPPORTED;
+ }
+ }
+
+ public static JvmVersion getFromVersion(double javaVersion) {
+ for (JvmVersion version : JvmVersion.values()) {
+ if (version.version == javaVersion) {
+ return version;
+ }
+ }
+ return JvmVersion.UNSUPPORTED;
+ }
+
+ public static JvmVersion getFromClassVersion(int classVersion) {
+ for (JvmVersion version : JvmVersion.values()) {
+ if (version.classVersion == classVersion) {
+ return version;
+ }
+ }
+ return JvmVersion.UNSUPPORTED;
+ }
+}
diff --git a/commons/src/main/java/com/navercorp/pinpoint/common/SystemPropertyKey.java b/commons/src/main/java/com/navercorp/pinpoint/common/util/SystemPropertyKey.java
similarity index 90%
rename from commons/src/main/java/com/navercorp/pinpoint/common/SystemPropertyKey.java
rename to commons/src/main/java/com/navercorp/pinpoint/common/util/SystemPropertyKey.java
index 9c07db3ef..3b8a49677 100644
--- a/commons/src/main/java/com/navercorp/pinpoint/common/SystemPropertyKey.java
+++ b/commons/src/main/java/com/navercorp/pinpoint/common/util/SystemPropertyKey.java
@@ -1,27 +1,27 @@
-package com.nhn.pinpoint.common;
-
-/**
- * @author hyungil.jeong
- */
-public enum SystemPropertyKey {
-
- JAVA_VERSION("java.version"),
- JAVA_RUNTIME_VERSION("java.runtime.version"),
- JAVA_RUNTIME_NAME("java.runtime.name"),
- JAVA_SPECIFICATION_VERSION("java.specification.version"),
- JAVA_CLASS_VERSION("java.class.version"),
- JAVA_VM_NAME("java.vm.name"),
- JAVA_VM_VERSION("java.vm.version"),
- JAVA_VM_INFO("java.vm.info"),
- JAVA_VM_SPECIFICATION_VERSION("java.vm.specification.version");
-
- private final String key;
-
- private SystemPropertyKey(String key) {
- this.key = key;
- }
-
- public String getKey() {
- return this.key;
- }
-}
+package com.nhn.pinpoint.common.util;
+
+/**
+ * @author hyungil.jeong
+ */
+public enum SystemPropertyKey {
+
+ JAVA_VERSION("java.version"),
+ JAVA_RUNTIME_VERSION("java.runtime.version"),
+ JAVA_RUNTIME_NAME("java.runtime.name"),
+ JAVA_SPECIFICATION_VERSION("java.specification.version"),
+ JAVA_CLASS_VERSION("java.class.version"),
+ JAVA_VM_NAME("java.vm.name"),
+ JAVA_VM_VERSION("java.vm.version"),
+ JAVA_VM_INFO("java.vm.info"),
+ JAVA_VM_SPECIFICATION_VERSION("java.vm.specification.version");
+
+ private final String key;
+
+ private SystemPropertyKey(String key) {
+ this.key = key;
+ }
+
+ public String getKey() {
+ return this.key;
+ }
+}
diff --git a/commons/src/main/java/com/navercorp/pinpoint/common/IntHashMap.java b/commons/src/main/java/com/navercorp/pinpoint/common/util/apache/IntHashMap.java
similarity index 96%
rename from commons/src/main/java/com/navercorp/pinpoint/common/IntHashMap.java
rename to commons/src/main/java/com/navercorp/pinpoint/common/util/apache/IntHashMap.java
index d16a12f2b..2e13ac5c2 100644
--- a/commons/src/main/java/com/navercorp/pinpoint/common/IntHashMap.java
+++ b/commons/src/main/java/com/navercorp/pinpoint/common/util/apache/IntHashMap.java
@@ -1,256 +1,256 @@
-/*
- * 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.
- */
-
-/*
- * Note: originally released under the GNU LGPL v2.1,
- * but rereleased by the original author under the ASF license (above).
- */
-package com.nhn.pinpoint.common;
-
-/**
- *
A hash map that uses primitive ints for the key rather than objects.
- *
- * Note that this class is for internal optimization purposes only, and may
- * not be supported in future releases of Apache Commons Lang. Utilities of
- * this sort may be included in future releases of Apache Commons Collections.
- *
- * @author Apache Software Foundation
- * @author Justin Couch
- * @author Alex Chaffee (alex@apache.org)
- * @since 2.0
- * @version $Revision$
- * @see java.util.HashMap
- */
-// 내부 튜닝용 가져다 사용하지 말것
-public class IntHashMap {
-
- /**
- * The hash table data.
- */
- private transient Entry table[];
-
- /**
- * The total number of entries in the hash table.
- */
- private transient int count;
-
- /**
- * The table is rehashed when its size exceeds this threshold. (The
- * value of this field is (int)(capacity * loadFactor).)
- *
- * @serial
- */
- private int threshold;
-
- /**
- * The load factor for the hashtable.
- *
- * @serial
- */
- private final float loadFactor;
-
- /**
- * Innerclass that acts as a datastructure to create a new entry in the
- * table.
- */
- private static class Entry {
- final int hash;
- final int key; // TODO not read; seems to be always same as hash
- T value;
- Entry next;
-
- /**
- * Create a new entry with the given values.
- *
- * @param hash The code used to hash the object with
- * @param key The key used to enter this in the table
- * @param value The value for this key
- * @param next A reference to the next entry in the table
- */
- protected Entry(int hash, int key, T value, Entry next) {
- this.hash = hash;
- this.key = key;
- this.value = value;
- this.next = next;
- }
- }
-
- /**
- * Constructs a new, empty hashtable with a default capacity and load
- * factor, which is 20 and 0.75 respectively.
- */
- public IntHashMap() {
- this(20, 0.75f);
- }
-
- /**
- * Constructs a new, empty hashtable with the specified initial capacity
- * and default load factor, which is 0.75.
- *
- * @param initialCapacity the initial capacity of the hashtable.
- * @throws IllegalArgumentException if the initial capacity is less
- * than zero.
- */
- public IntHashMap(int initialCapacity) {
- this(initialCapacity, 0.75f);
- }
-
- /**
- * Constructs a new, empty hashtable with the specified initial
- * capacity and the specified load factor.
- *
- * @param initialCapacity the initial capacity of the hashtable.
- * @param loadFactor the load factor of the hashtable.
- * @throws IllegalArgumentException if the initial capacity is less
- * than zero, or if the load factor is nonpositive.
- */
- public IntHashMap(int initialCapacity, float loadFactor) {
- super();
- if (initialCapacity < 0) {
- throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity);
- }
- if (loadFactor <= 0) {
- throw new IllegalArgumentException("Illegal Load: " + loadFactor);
- }
- if (initialCapacity == 0) {
- initialCapacity = 1;
- }
-
- this.loadFactor = loadFactor;
- table = new Entry[initialCapacity];
- threshold = (int) (initialCapacity * loadFactor);
- }
-
- /**
- * Returns the number of keys in this hashtable.
- *
- * @return the number of keys in this hashtable.
- */
- public int size() {
- return count;
- }
-
- /**
- * Tests if this hashtable maps no keys to values.
- *
- * @return true if this hashtable maps no keys to values;
- * false otherwise.
- */
- public boolean isEmpty() {
- return count == 0;
- }
-
-
- /**
- * Returns the value to which the specified key is mapped in this map.
- *
- * @param key a key in the hashtable.
- * @return the value to which the key is mapped in this hashtable;
- * null if the key is not mapped to any value in
- * this hashtable.
- * @see #put(int, T)
- */
- public T get(int key) {
- Entry tab[] = table;
- int hash = key;
- int index = (hash & 0x7FFFFFFF) % tab.length;
- for (Entry e = tab[index]; e != null; e = e.next) {
- if (e.hash == hash) {
- return e.value;
- }
- }
- return null;
- }
-
- /**
- * Increases the capacity of and internally reorganizes this
- * hashtable, in order to accommodate and access its entries more
- * efficiently.
- *
- * This method is called automatically when the number of keys
- * in the hashtable exceeds this hashtable's capacity and load
- * factor.
- */
- protected void rehash() {
- int oldCapacity = table.length;
- Entry oldMap[] = table;
-
- int newCapacity = oldCapacity * 2 + 1;
- Entry newMap[] = new Entry[newCapacity];
-
- threshold = (int) (newCapacity * loadFactor);
- table = newMap;
-
- for (int i = oldCapacity; i-- > 0;) {
- for (Entry old = oldMap[i]; old != null;) {
- Entry e = old;
- old = old.next;
-
- int index = (e.hash & 0x7FFFFFFF) % newCapacity;
- e.next = newMap[index];
- newMap[index] = e;
- }
- }
- }
-
- /**
- * Maps the specified key to the specified
- * value in this hashtable. The key cannot be
- * null.
- *
- * The value can be retrieved by calling the get method
- * with a key that is equal to the original key.
- *
- * @param key the hashtable key.
- * @param value the value.
- * @return the previous value of the specified key in this hashtable,
- * or null if it did not have one.
- * @throws NullPointerException if the key is null.
- * @see #get(int)
- */
- public T put(int key, T value) {
- // Makes sure the key is not already in the hashtable.
- Entry tab[] = table;
- int hash = key;
- int index = (hash & 0x7FFFFFFF) % tab.length;
- for (Entry e = tab[index]; e != null; e = e.next) {
- if (e.hash == hash) {
- T old = e.value;
- e.value = value;
- return old;
- }
- }
-
- if (count >= threshold) {
- // Rehash the table if the threshold is exceeded
- rehash();
-
- tab = table;
- index = (hash & 0x7FFFFFFF) % tab.length;
- }
-
- // Creates the new entry.
- Entry e = new Entry(hash, key, value, tab[index]);
- tab[index] = e;
- count++;
- return null;
- }
-
-
-
-}
-
+/*
+ * 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.
+ */
+
+/*
+ * Note: originally released under the GNU LGPL v2.1,
+ * but rereleased by the original author under the ASF license (above).
+ */
+package com.nhn.pinpoint.common.util.apache;
+
+/**
+ * A hash map that uses primitive ints for the key rather than objects.
+ *
+ * Note that this class is for internal optimization purposes only, and may
+ * not be supported in future releases of Apache Commons Lang. Utilities of
+ * this sort may be included in future releases of Apache Commons Collections.
+ *
+ * @author Apache Software Foundation
+ * @author Justin Couch
+ * @author Alex Chaffee (alex@apache.org)
+ * @since 2.0
+ * @version $Revision$
+ * @see java.util.HashMap
+ */
+// 내부 튜닝용 가져다 사용하지 말것
+public class IntHashMap {
+
+ /**
+ * The hash table data.
+ */
+ private transient Entry table[];
+
+ /**
+ * The total number of entries in the hash table.
+ */
+ private transient int count;
+
+ /**
+ * The table is rehashed when its size exceeds this threshold. (The
+ * value of this field is (int)(capacity * loadFactor).)
+ *
+ * @serial
+ */
+ private int threshold;
+
+ /**
+ * The load factor for the hashtable.
+ *
+ * @serial
+ */
+ private final float loadFactor;
+
+ /**
+ * Innerclass that acts as a datastructure to create a new entry in the
+ * table.
+ */
+ private static class Entry {
+ final int hash;
+ final int key; // TODO not read; seems to be always same as hash
+ T value;
+ Entry next;
+
+ /**
+ * Create a new entry with the given values.
+ *
+ * @param hash The code used to hash the object with
+ * @param key The key used to enter this in the table
+ * @param value The value for this key
+ * @param next A reference to the next entry in the table
+ */
+ protected Entry(int hash, int key, T value, Entry next) {
+ this.hash = hash;
+ this.key = key;
+ this.value = value;
+ this.next = next;
+ }
+ }
+
+ /**
+ * Constructs a new, empty hashtable with a default capacity and load
+ * factor, which is 20 and 0.75 respectively.
+ */
+ public IntHashMap() {
+ this(20, 0.75f);
+ }
+
+ /**
+ * Constructs a new, empty hashtable with the specified initial capacity
+ * and default load factor, which is 0.75.
+ *
+ * @param initialCapacity the initial capacity of the hashtable.
+ * @throws IllegalArgumentException if the initial capacity is less
+ * than zero.
+ */
+ public IntHashMap(int initialCapacity) {
+ this(initialCapacity, 0.75f);
+ }
+
+ /**
+ * Constructs a new, empty hashtable with the specified initial
+ * capacity and the specified load factor.
+ *
+ * @param initialCapacity the initial capacity of the hashtable.
+ * @param loadFactor the load factor of the hashtable.
+ * @throws IllegalArgumentException if the initial capacity is less
+ * than zero, or if the load factor is nonpositive.
+ */
+ public IntHashMap(int initialCapacity, float loadFactor) {
+ super();
+ if (initialCapacity < 0) {
+ throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity);
+ }
+ if (loadFactor <= 0) {
+ throw new IllegalArgumentException("Illegal Load: " + loadFactor);
+ }
+ if (initialCapacity == 0) {
+ initialCapacity = 1;
+ }
+
+ this.loadFactor = loadFactor;
+ table = new Entry[initialCapacity];
+ threshold = (int) (initialCapacity * loadFactor);
+ }
+
+ /**
+ * Returns the number of keys in this hashtable.
+ *
+ * @return the number of keys in this hashtable.
+ */
+ public int size() {
+ return count;
+ }
+
+ /**
+ * Tests if this hashtable maps no keys to values.
+ *
+ * @return true if this hashtable maps no keys to values;
+ * false otherwise.
+ */
+ public boolean isEmpty() {
+ return count == 0;
+ }
+
+
+ /**
+ * Returns the value to which the specified key is mapped in this map.
+ *
+ * @param key a key in the hashtable.
+ * @return the value to which the key is mapped in this hashtable;
+ * null if the key is not mapped to any value in
+ * this hashtable.
+ * @see #put(int, T)
+ */
+ public T get(int key) {
+ Entry tab[] = table;
+ int hash = key;
+ int index = (hash & 0x7FFFFFFF) % tab.length;
+ for (Entry e = tab[index]; e != null; e = e.next) {
+ if (e.hash == hash) {
+ return e.value;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Increases the capacity of and internally reorganizes this
+ * hashtable, in order to accommodate and access its entries more
+ * efficiently.
+ *
+ * This method is called automatically when the number of keys
+ * in the hashtable exceeds this hashtable's capacity and load
+ * factor.
+ */
+ protected void rehash() {
+ int oldCapacity = table.length;
+ Entry oldMap[] = table;
+
+ int newCapacity = oldCapacity * 2 + 1;
+ Entry newMap[] = new Entry[newCapacity];
+
+ threshold = (int) (newCapacity * loadFactor);
+ table = newMap;
+
+ for (int i = oldCapacity; i-- > 0;) {
+ for (Entry old = oldMap[i]; old != null;) {
+ Entry e = old;
+ old = old.next;
+
+ int index = (e.hash & 0x7FFFFFFF) % newCapacity;
+ e.next = newMap[index];
+ newMap[index] = e;
+ }
+ }
+ }
+
+ /**
+ * Maps the specified key to the specified
+ * value in this hashtable. The key cannot be
+ * null.
+ *
+ * The value can be retrieved by calling the get method
+ * with a key that is equal to the original key.
+ *
+ * @param key the hashtable key.
+ * @param value the value.
+ * @return the previous value of the specified key in this hashtable,
+ * or null if it did not have one.
+ * @throws NullPointerException if the key is null.
+ * @see #get(int)
+ */
+ public T put(int key, T value) {
+ // Makes sure the key is not already in the hashtable.
+ Entry tab[] = table;
+ int hash = key;
+ int index = (hash & 0x7FFFFFFF) % tab.length;
+ for (Entry e = tab[index]; e != null; e = e.next) {
+ if (e.hash == hash) {
+ T old = e.value;
+ e.value = value;
+ return old;
+ }
+ }
+
+ if (count >= threshold) {
+ // Rehash the table if the threshold is exceeded
+ rehash();
+
+ tab = table;
+ index = (hash & 0x7FFFFFFF) % tab.length;
+ }
+
+ // Creates the new entry.
+ Entry e = new Entry(hash, key, value, tab[index]);
+ tab[index] = e;
+ count++;
+ return null;
+ }
+
+
+
+}
+
diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/AnnotationKeyTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/AnnotationKeyTest.java
index 73d6f3dcf..b84ff5b53 100644
--- a/commons/src/test/java/com/navercorp/pinpoint/common/AnnotationKeyTest.java
+++ b/commons/src/test/java/com/navercorp/pinpoint/common/AnnotationKeyTest.java
@@ -2,11 +2,15 @@ package com.nhn.pinpoint.common;
import junit.framework.Assert;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author emeroad
*/
public class AnnotationKeyTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
@Test
public void getCode() {
@@ -18,9 +22,9 @@ public class AnnotationKeyTest {
// @Test
public void intSize() {
// 2147483647
- System.out.println(Integer.MAX_VALUE);
+ logger.debug("{}", Integer.MAX_VALUE);
// -2147483648
- System.out.println(Integer.MIN_VALUE);
+ logger.debug("{}", Integer.MIN_VALUE);
}
@Test
diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/ServiceTypeTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/ServiceTypeTest.java
index a09be2b72..39a463b08 100644
--- a/commons/src/test/java/com/navercorp/pinpoint/common/ServiceTypeTest.java
+++ b/commons/src/test/java/com/navercorp/pinpoint/common/ServiceTypeTest.java
@@ -13,9 +13,9 @@ public class ServiceTypeTest {
@Test
public void testIndexable() {
- System.out.println(ServiceType.TOMCAT.isIndexable());
- System.out.println(ServiceType.BLOC.isIndexable());
- System.out.println(ServiceType.ARCUS.isIndexable());
+ logger.debug("{}", ServiceType.TOMCAT.isIndexable());
+ logger.debug("{}", ServiceType.BLOC.isIndexable());
+ logger.debug("{}", ServiceType.ARCUS.isIndexable());
}
@Test
diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/util/AnnotationTranscoderTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/util/AnnotationTranscoderTest.java
index 355a2df55..344fe9493 100644
--- a/commons/src/test/java/com/navercorp/pinpoint/common/util/AnnotationTranscoderTest.java
+++ b/commons/src/test/java/com/navercorp/pinpoint/common/util/AnnotationTranscoderTest.java
@@ -92,10 +92,10 @@ public class AnnotationTranscoderTest {
@Test
public void testGetTypeCode() throws Exception {
int i = 2 << 8;
- System.out.println(i);
+ logger.debug("{}", i);
write(i);
int j = 3 << 8;
- System.out.println(j);
+ logger.debug("{}", j);
write(j);
write(10);
write(512);
diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/util/ByteSizeTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/util/ByteSizeTest.java
index 1abe69d06..b07e7e06e 100644
--- a/commons/src/test/java/com/navercorp/pinpoint/common/util/ByteSizeTest.java
+++ b/commons/src/test/java/com/navercorp/pinpoint/common/util/ByteSizeTest.java
@@ -5,15 +5,19 @@ import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TIOStreamTransport;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.ByteArrayOutputStream;
-import java.util.Arrays;
import java.util.concurrent.TimeUnit;
/**
*
*/
public class ByteSizeTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+
@Test
public void test() throws TException {
TCompactProtocol.Factory factory = new TCompactProtocol.Factory();
@@ -23,12 +27,12 @@ public class ByteSizeTest {
TProtocol protocol = factory.getProtocol(transport);
long l = TimeUnit.DAYS.toMillis(1);
- System.out.println("day:" + l);
+ logger.debug("day:{}", l);
long currentTime = System.currentTimeMillis();
- System.out.println("currentTime:" + currentTime);
+ logger.debug("currentTime:{}" + currentTime);
protocol.writeI64(l);
byte[] buffer = baos.toByteArray();
- System.out.println(buffer.length);
+ logger.debug("{}", buffer.length);
}
diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/util/BytesUtilsTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/util/BytesUtilsTest.java
index c09d78f28..9e23c45ea 100644
--- a/commons/src/test/java/com/navercorp/pinpoint/common/util/BytesUtilsTest.java
+++ b/commons/src/test/java/com/navercorp/pinpoint/common/util/BytesUtilsTest.java
@@ -16,16 +16,6 @@ import org.slf4j.LoggerFactory;
public class BytesUtilsTest {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
- @Test
- public void testLongLongToBytes() throws Exception {
- long most = Long.MAX_VALUE;
- long least = Long.MAX_VALUE - 1;
-
- test(most, least);
-
- UUID uuid = UUID.randomUUID();
- test(uuid.getMostSignificantBits(), uuid.getLeastSignificantBits());
- }
@Test
public void testStringLongLongToBytes() throws Exception {
@@ -77,29 +67,6 @@ public class BytesUtilsTest {
Assert.assertEquals(i, i3);
}
- private void test(long most, long least) {
- byte[] bytes1 = Bytes.toBytes(most);
- byte[] bytes2 = Bytes.toBytes(least);
- byte[] add = Bytes.add(bytes1, bytes2);
- byte[] bytes = BytesUtils.longLongToBytes(most, least);
- Assert.assertArrayEquals(add, bytes);
-
-
- long[] longLong = BytesUtils.bytesToLongLong(bytes);
- Assert.assertEquals(most, longLong[0]);
- Assert.assertEquals(least, longLong[1]);
-
-
- long bMost = BytesUtils.bytesToLong(bytes, 0);
- long bLeast = BytesUtils.bytesToLong(bytes, 8);
- Assert.assertEquals(most, bMost);
- Assert.assertEquals(least, bLeast);
-
- byte bBytes[] = new byte[16];
- BytesUtils.writeLong(most, bBytes, 0);
- BytesUtils.writeLong(least, bBytes, 8);
- Assert.assertArrayEquals(add, bBytes);
- }
@Test
public void testAddStringLong() throws Exception {
diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/util/HashCodeTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/util/HashCodeTest.java
deleted file mode 100644
index 900e844de..000000000
--- a/commons/src/test/java/com/navercorp/pinpoint/common/util/HashCodeTest.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package com.nhn.pinpoint.common.util;
-
-import org.junit.Test;
-
-import java.util.Random;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-/**
- * test를 위해 hashcode를 찾을때 돌려볼수 있는 코드
- */
-public class HashCodeTest {
- // @Test
- public void test2() throws InterruptedException {
-// "test"
-// "tetU"
-// "uGTt"
-// System.out.println((int)'A');
-// System.out.println((int)'Z');
- System.out.println("test".hashCode());
- System.out.println("tfUU".hashCode());
- String a = "23 123";
- System.out.println(a.hashCode());
- System.out.println("test:" + a.hashCode());
- final int hashCode = a.hashCode();
- final ExecutorService es = Executors.newFixedThreadPool(4);
- Runnable runnable = new Runnable() {
- @Override
- public void run() {
- execute(hashCode);
- }
- };
- es.execute(runnable);
- es.execute(runnable);
- es.execute(runnable);
- es.execute(runnable);
- es.awaitTermination(1, TimeUnit.HOURS);
-// execute(hashCode, random);
-// test
-// -1757224452
-
-
- }
-
- private void execute(int hashCode) {
- Random random = new Random();
- while (true) {
- int i = random.nextInt(30);
-// System.out.println(i);
- StringBuilder sb = new StringBuilder();
-// sb.append("12 ");
- for (int j = 0; j < i; j++) {
- char c = get(random);
- sb.append(c);
- }
- sb.append(" 7");
- String s = sb.toString();
-// System.out.println(s.hashCode());
-// System.out.println(s);
- if (hashCode == s.hashCode()) {
-// if(a.equals(s)) {
-// continue;
-// }
- System.out.println("find!!! equals:" + s);
- break;
- }
- }
- }
-
- // @Test
- public void test() {
-// "test"
-// "tetU"
-// "uGTt"
-// System.out.println((int)'A');
-// System.out.println((int)'Z');
- String a = "test";
- System.out.println("test:" + a.hashCode());
- int hashCode = a.hashCode();
- Random random = new Random();
- while (true) {
- int i = random.nextInt(50);
-// System.out.println(i);
- StringBuilder sb = new StringBuilder();
- for (int j = 0; j < i; j++) {
- char c = get(random);
- sb.append(c);
- }
- String s = sb.toString();
-// System.out.println(s);
- if (hashCode == s.hashCode()) {
- if ("test".equals(s)) {
- continue;
- }
- System.out.println("equals:" + s);
- break;
- }
- }
-// test
-// -1757224452
- }
-
- char get(Random rand) {
-// 65->90 : 25
-// 97->122; 25
- int choice = (char) rand.nextInt(2);
- char ch;
- if (choice == 0) {
- ch = (char) ((rand.nextInt(25)) + 97);
- } else {
- ch = (char) ((rand.nextInt(25)) + 65);
- }
-
- while (true) {
- if (ch >= 'a' && ch <= 'z' || ch >= 'A' && ch <= 'Z') {
- return ch;
- }
- }
- }
-}
diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/util/InetAddressUtilsTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/util/InetAddressUtilsTest.java
index 42da6f270..d8b7e125a 100644
--- a/commons/src/test/java/com/navercorp/pinpoint/common/util/InetAddressUtilsTest.java
+++ b/commons/src/test/java/com/navercorp/pinpoint/common/util/InetAddressUtilsTest.java
@@ -1,6 +1,8 @@
package com.nhn.pinpoint.common.util;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.net.InetAddress;
import java.net.UnknownHostException;
@@ -9,14 +11,16 @@ import java.net.UnknownHostException;
*
*/
public class InetAddressUtilsTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
@Test
public void test() throws UnknownHostException {
InetAddress byName = InetAddress.getByName("0:0:0:0:0:0:0:1");
- System.out.println(byName);
- System.out.println(byName.getAddress().length);
+ logger.debug("{}", byName);
+ logger.debug("{}", byName.getAddress().length);
InetAddress ipv4= InetAddress.getByName("127.0.0.1");
- System.out.println(ipv4);
+ logger.debug("{}", ipv4);
}
}
diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/JvmVersionTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/util/JvmVersionTest.java
similarity index 94%
rename from commons/src/test/java/com/navercorp/pinpoint/common/JvmVersionTest.java
rename to commons/src/test/java/com/navercorp/pinpoint/common/util/JvmVersionTest.java
index 0ebb0b312..69d371999 100644
--- a/commons/src/test/java/com/navercorp/pinpoint/common/JvmVersionTest.java
+++ b/commons/src/test/java/com/navercorp/pinpoint/common/util/JvmVersionTest.java
@@ -1,103 +1,103 @@
-package com.nhn.pinpoint.common;
-
-import static org.junit.Assert.*;
-import static com.nhn.pinpoint.common.JvmVersion.*;
-
-import org.junit.Test;
-
-/**
- * @author hyungil.jeong
- */
-public class JvmVersionTest {
-
- @Test
- public void testOnOrAfter() {
- // JDK 5
- assertTrue(JAVA_5.onOrAfter(JAVA_5));
- assertFalse(JAVA_5.onOrAfter(JAVA_6));
- assertFalse(JAVA_5.onOrAfter(JAVA_7));
- assertFalse(JAVA_5.onOrAfter(JAVA_8));
- assertFalse(JAVA_5.onOrAfter(UNSUPPORTED));
- // JDK 6
- assertTrue(JAVA_6.onOrAfter(JAVA_5));
- assertTrue(JAVA_6.onOrAfter(JAVA_6));
- assertFalse(JAVA_6.onOrAfter(JAVA_7));
- assertFalse(JAVA_6.onOrAfter(JAVA_8));
- assertFalse(JAVA_6.onOrAfter(UNSUPPORTED));
- // JDK 7
- assertTrue(JAVA_7.onOrAfter(JAVA_5));
- assertTrue(JAVA_7.onOrAfter(JAVA_6));
- assertTrue(JAVA_7.onOrAfter(JAVA_7));
- assertFalse(JAVA_7.onOrAfter(JAVA_8));
- assertFalse(JAVA_7.onOrAfter(UNSUPPORTED));
- // JDK 8
- assertTrue(JAVA_8.onOrAfter(JAVA_5));
- assertTrue(JAVA_8.onOrAfter(JAVA_6));
- assertTrue(JAVA_8.onOrAfter(JAVA_7));
- assertTrue(JAVA_8.onOrAfter(JAVA_8));
- assertFalse(JAVA_8.onOrAfter(UNSUPPORTED));
- // Unsupported
- assertFalse(UNSUPPORTED.onOrAfter(JAVA_5));
- assertFalse(UNSUPPORTED.onOrAfter(JAVA_6));
- assertFalse(UNSUPPORTED.onOrAfter(JAVA_7));
- assertFalse(UNSUPPORTED.onOrAfter(JAVA_8));
- assertFalse(UNSUPPORTED.onOrAfter(UNSUPPORTED));
- }
-
- @Test
- public void testGetFromDoubleVersion() {
- // JDK 5
- final JvmVersion java_5 = JvmVersion.getFromVersion(1.5);
- assertSame(java_5, JAVA_5);
- // JDK 6
- final JvmVersion java_6 = JvmVersion.getFromVersion(1.6);
- assertSame(java_6, JAVA_6);
- // JDK 7
- final JvmVersion java_7 = JvmVersion.getFromVersion(1.7);
- assertSame(java_7, JAVA_7);
- // JDK 8
- final JvmVersion java_8 = JvmVersion.getFromVersion(1.8);
- assertSame(java_8, JAVA_8);
- // Unsupported
- final JvmVersion java_unsupported = JvmVersion.getFromVersion(0.9);
- assertSame(java_unsupported, UNSUPPORTED);
- }
-
- @Test
- public void testGetFromStringVersion() {
- // JDK 5
- final JvmVersion java_5 = JvmVersion.getFromVersion("1.5");
- assertSame(java_5, JAVA_5);
- // JDK 6
- final JvmVersion java_6 = JvmVersion.getFromVersion("1.6");
- assertSame(java_6, JAVA_6);
- // JDK 7
- final JvmVersion java_7 = JvmVersion.getFromVersion("1.7");
- assertSame(java_7, JAVA_7);
- // JDK 8
- final JvmVersion java_8 = JvmVersion.getFromVersion("1.8");
- assertSame(java_8, JAVA_8);
- // Unsupported
- final JvmVersion java_unsupported = JvmVersion.getFromVersion("abc");
- assertSame(java_unsupported, UNSUPPORTED);
- }
-
- @Test
- public void testGetFromClassVersion() {
- // JDK 5
- final JvmVersion java_5 = JvmVersion.getFromClassVersion(49);
- assertSame(java_5, JAVA_5);
- // JDK 6
- final JvmVersion java_6 = JvmVersion.getFromClassVersion(50);
- assertSame(java_6, JAVA_6);
- // JDK 7
- final JvmVersion java_7 = JvmVersion.getFromClassVersion(51);
- assertSame(java_7, JAVA_7);
- // JDK 8
- final JvmVersion java_8 = JvmVersion.getFromClassVersion(52);
- assertSame(java_8, JAVA_8);
- // Unsupported
- final JvmVersion java_unsupported = JvmVersion.getFromClassVersion(-1);
- assertSame(java_unsupported, UNSUPPORTED);
- }
-}
+package com.nhn.pinpoint.common.util;
+
+import static org.junit.Assert.*;
+import static com.nhn.pinpoint.common.util.JvmVersion.*;
+
+import org.junit.Test;
+
+/**
+ * @author hyungil.jeong
+ */
+public class JvmVersionTest {
+
+ @Test
+ public void testOnOrAfter() {
+ // JDK 5
+ assertTrue(JAVA_5.onOrAfter(JAVA_5));
+ assertFalse(JAVA_5.onOrAfter(JAVA_6));
+ assertFalse(JAVA_5.onOrAfter(JAVA_7));
+ assertFalse(JAVA_5.onOrAfter(JAVA_8));
+ assertFalse(JAVA_5.onOrAfter(UNSUPPORTED));
+ // JDK 6
+ assertTrue(JAVA_6.onOrAfter(JAVA_5));
+ assertTrue(JAVA_6.onOrAfter(JAVA_6));
+ assertFalse(JAVA_6.onOrAfter(JAVA_7));
+ assertFalse(JAVA_6.onOrAfter(JAVA_8));
+ assertFalse(JAVA_6.onOrAfter(UNSUPPORTED));
+ // JDK 7
+ assertTrue(JAVA_7.onOrAfter(JAVA_5));
+ assertTrue(JAVA_7.onOrAfter(JAVA_6));
+ assertTrue(JAVA_7.onOrAfter(JAVA_7));
+ assertFalse(JAVA_7.onOrAfter(JAVA_8));
+ assertFalse(JAVA_7.onOrAfter(UNSUPPORTED));
+ // JDK 8
+ assertTrue(JAVA_8.onOrAfter(JAVA_5));
+ assertTrue(JAVA_8.onOrAfter(JAVA_6));
+ assertTrue(JAVA_8.onOrAfter(JAVA_7));
+ assertTrue(JAVA_8.onOrAfter(JAVA_8));
+ assertFalse(JAVA_8.onOrAfter(UNSUPPORTED));
+ // Unsupported
+ assertFalse(UNSUPPORTED.onOrAfter(JAVA_5));
+ assertFalse(UNSUPPORTED.onOrAfter(JAVA_6));
+ assertFalse(UNSUPPORTED.onOrAfter(JAVA_7));
+ assertFalse(UNSUPPORTED.onOrAfter(JAVA_8));
+ assertFalse(UNSUPPORTED.onOrAfter(UNSUPPORTED));
+ }
+
+ @Test
+ public void testGetFromDoubleVersion() {
+ // JDK 5
+ final JvmVersion java_5 = JvmVersion.getFromVersion(1.5);
+ assertSame(java_5, JAVA_5);
+ // JDK 6
+ final JvmVersion java_6 = JvmVersion.getFromVersion(1.6);
+ assertSame(java_6, JAVA_6);
+ // JDK 7
+ final JvmVersion java_7 = JvmVersion.getFromVersion(1.7);
+ assertSame(java_7, JAVA_7);
+ // JDK 8
+ final JvmVersion java_8 = JvmVersion.getFromVersion(1.8);
+ assertSame(java_8, JAVA_8);
+ // Unsupported
+ final JvmVersion java_unsupported = JvmVersion.getFromVersion(0.9);
+ assertSame(java_unsupported, UNSUPPORTED);
+ }
+
+ @Test
+ public void testGetFromStringVersion() {
+ // JDK 5
+ final JvmVersion java_5 = JvmVersion.getFromVersion("1.5");
+ assertSame(java_5, JAVA_5);
+ // JDK 6
+ final JvmVersion java_6 = JvmVersion.getFromVersion("1.6");
+ assertSame(java_6, JAVA_6);
+ // JDK 7
+ final JvmVersion java_7 = JvmVersion.getFromVersion("1.7");
+ assertSame(java_7, JAVA_7);
+ // JDK 8
+ final JvmVersion java_8 = JvmVersion.getFromVersion("1.8");
+ assertSame(java_8, JAVA_8);
+ // Unsupported
+ final JvmVersion java_unsupported = JvmVersion.getFromVersion("abc");
+ assertSame(java_unsupported, UNSUPPORTED);
+ }
+
+ @Test
+ public void testGetFromClassVersion() {
+ // JDK 5
+ final JvmVersion java_5 = JvmVersion.getFromClassVersion(49);
+ assertSame(java_5, JAVA_5);
+ // JDK 6
+ final JvmVersion java_6 = JvmVersion.getFromClassVersion(50);
+ assertSame(java_6, JAVA_6);
+ // JDK 7
+ final JvmVersion java_7 = JvmVersion.getFromClassVersion(51);
+ assertSame(java_7, JAVA_7);
+ // JDK 8
+ final JvmVersion java_8 = JvmVersion.getFromClassVersion(52);
+ assertSame(java_8, JAVA_8);
+ // Unsupported
+ final JvmVersion java_unsupported = JvmVersion.getFromClassVersion(-1);
+ assertSame(java_unsupported, UNSUPPORTED);
+ }
+}
diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/util/PinpointThreadFactoryTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/util/PinpointThreadFactoryTest.java
index 2b8cd34aa..ffe932c4f 100644
--- a/commons/src/test/java/com/navercorp/pinpoint/common/util/PinpointThreadFactoryTest.java
+++ b/commons/src/test/java/com/navercorp/pinpoint/common/util/PinpointThreadFactoryTest.java
@@ -15,20 +15,22 @@ public class PinpointThreadFactoryTest {
@Test
public void testCreateThreadFactory() throws Exception {
- final AtomicInteger test = new AtomicInteger(0);
+ final AtomicInteger counter = new AtomicInteger(0);
PinpointThreadFactory pinpoint = new PinpointThreadFactory("pinpoint");
Thread thread = pinpoint.newThread(new Runnable() {
@Override
public void run() {
- test.getAndIncrement();
+ counter.getAndIncrement();
}
});
thread.start();
thread.join();
- Assert.assertEquals(test.get(), 1);
+
+ Assert.assertEquals(counter.get(), 1);
+
String threadName = thread.getName();
- logger.info(threadName);
+ logger.debug(threadName);
Assert.assertTrue(threadName.startsWith("pinpoint("));
Assert.assertTrue(threadName.endsWith(")"));
@@ -37,7 +39,7 @@ public class PinpointThreadFactoryTest {
public void run() {
}
});
- logger.info(thread2.getName());
+ logger.debug(thread2.getName());
}
}
diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/util/PropertyUtilsTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/util/PropertyUtilsTest.java
index 0b51e95ef..08642ef6e 100644
--- a/commons/src/test/java/com/navercorp/pinpoint/common/util/PropertyUtilsTest.java
+++ b/commons/src/test/java/com/navercorp/pinpoint/common/util/PropertyUtilsTest.java
@@ -3,13 +3,15 @@ package com.nhn.pinpoint.common.util;
import junit.framework.Assert;
import org.junit.Test;
+import java.net.URL;
import java.util.Properties;
public class PropertyUtilsTest {
@Test
public void testLoadProperty() throws Exception {
- String path = PropertyUtils.class.getClassLoader().getResource("test.properties").getPath();
+ URL resource = PropertyUtils.class.getClassLoader().getResource("test.properties");
+ String path = resource.getPath();
Properties properties = PropertyUtils.loadProperty(path);
assertProperty(properties);
diff --git a/commons/src/test/java/com/navercorp/pinpoint/common/util/SqlParserTest.java b/commons/src/test/java/com/navercorp/pinpoint/common/util/SqlParserTest.java
index c75bb9e16..53dd701dc 100644
--- a/commons/src/test/java/com/navercorp/pinpoint/common/util/SqlParserTest.java
+++ b/commons/src/test/java/com/navercorp/pinpoint/common/util/SqlParserTest.java
@@ -3,6 +3,8 @@ package com.nhn.pinpoint.common.util;
import junit.framework.Assert;
import junit.framework.AssertionFailedError;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.List;
@@ -10,6 +12,9 @@ import java.util.List;
* @author emeroad
*/
public class SqlParserTest {
+
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
private SqlParser sqlParser = new SqlParser();
private OutputParameterParser outputParameterParser = new OutputParameterParser();
@@ -19,27 +24,26 @@ public class SqlParserTest {
ParsingResult parsingResult = sqlParser.normalizedSql("select * from table a = 1 and b=50 and c=? and d='11'");
String s = parsingResult.getSql();
- System.out.println(s);
- System.out.println(parsingResult.getOutput());
+ logger.debug(s);
+ logger.debug(parsingResult.getOutput());
ParsingResult parsingResult2 = sqlParser.normalizedSql(" ");
String s2 = parsingResult2.getSql();
- System.out.println(s2);
+ logger.debug(s2);
- System.out.println((char) -1);
+ logger.debug("{}", (char) -1);
String str = "s";
- System.out.println(str.codePointAt(0));
- System.out.println((int) str.charAt(0));
- System.out.println("high" + (char) Character.MAX_HIGH_SURROGATE);
- System.out.println("low" + (char) Character.MIN_LOW_SURROGATE);
-
- System.out.println((int) Character.MIN_LOW_SURROGATE);
- System.out.println((int) Character.MAX_HIGH_SURROGATE);
+ logger.debug("{}", str.codePointAt(0));
+ logger.debug("{}", (int) str.charAt(0));
+ logger.debug("high:{}", Character.MAX_HIGH_SURROGATE);
+ logger.debug("low:{}", Character.MIN_LOW_SURROGATE);
+ logger.debug("{}", (int) Character.MIN_LOW_SURROGATE);
+ logger.debug("{}", (int) Character.MAX_HIGH_SURROGATE);
ParsingResult parsingResult3 = sqlParser.normalizedSql("''");
String s3 = parsingResult3.getSql();
- System.out.println("s3:" + s3);
- System.out.println("sb3:" + parsingResult3.getOutput());
+ logger.debug("s3:{}", s3);
+ logger.debug("sb3:{}", parsingResult3.getOutput());
}
@Test
@@ -178,7 +182,7 @@ public class SqlParserTest {
// @Test
public void charout() {
for (int i = 11; i < 67; i++) {
- System.out.println((char) i);
+ logger.debug("{}", (char) i);
}
}
@@ -203,7 +207,7 @@ public class SqlParserTest {
assertEqual("'1234''456,7'", "'0$'", "1234''456,,7");
ParsingResult parsingResult2 = this.sqlParser.normalizedSql("'1234''456,7'");
- System.out.println(parsingResult2);
+ logger.debug("{}", parsingResult2);
// 문자열 토큰
@@ -255,7 +259,7 @@ public class SqlParserTest {
try {
Assert.assertEquals(expected, normalizedSql);
} catch (AssertionFailedError e) {
- System.err.println("Original :" + expected);
+ logger.warn("Original :{}", expected);
throw e;
}
}
@@ -266,7 +270,7 @@ public class SqlParserTest {
try {
Assert.assertEquals(actual, normalizedSql);
} catch (AssertionFailedError e) {
- System.err.println("Original :" + expected);
+ logger.warn("Original :{}", expected);
throw e;
}
}
@@ -277,11 +281,11 @@ public class SqlParserTest {
String output = parsingResult.getOutput();
List outputParams = outputParameterParser.parseOutputParameter(output);
String s = sqlParser.combineOutputParams(normalizedSql, outputParams);
- System.out.println("combine:" + s);
+ logger.debug("combine:" + s);
try {
Assert.assertEquals("normalizedSql check", actual, normalizedSql);
} catch (AssertionFailedError e) {
- System.err.println("Original :" + expected);
+ logger.warn("Original :{}", expected);
throw e;
}
@@ -295,7 +299,7 @@ public class SqlParserTest {
Assert.assertEquals("normalizedSql check", expected, normalizedSql);
Assert.assertSame(expected, normalizedSql);
} catch (AssertionFailedError e) {
- System.err.println("Original :" + expected);
+ logger.warn("Original :{}", expected);
throw e;
}
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/storage/BufferedStorageFactory.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/storage/BufferedStorageFactory.java
index 92b0a22d1..301fc5655 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/storage/BufferedStorageFactory.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/storage/BufferedStorageFactory.java
@@ -23,7 +23,7 @@ public class BufferedStorageFactory implements StorageFactory {
}
this.dataSender = dataSender;
- this.bufferSize = config.getIoBufferingBufferBufferSize();
+ this.bufferSize = config.getIoBufferingBufferSize();
this.spanChunkFactory = new SpanChunkFactory(agentInformation);
}
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/storage/Storage.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/storage/Storage.java
index 3289b105f..a9c832a95 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/storage/Storage.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/storage/Storage.java
@@ -10,14 +10,12 @@ import com.nhn.pinpoint.profiler.sender.DataSender;
public interface Storage {
/**
- * store(SpanEvent spanEvent)와 store(Span span)간 동기화가 구현되어 있어야 한다.
*
* @param spanEvent
*/
void store(SpanEvent spanEvent);
/**
- * store(SpanEvent spanEvent)와 store(Span span)간 동기화가 구현되어 있어야 한다.
*
* @param span
*/
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/cpu/CpuLoadMetricSetSelector.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/cpu/CpuLoadMetricSetSelector.java
index 0a7bdfc89..213ada777 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/cpu/CpuLoadMetricSetSelector.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/cpu/CpuLoadMetricSetSelector.java
@@ -3,7 +3,7 @@ package com.nhn.pinpoint.profiler.monitor.codahale.cpu;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.nhn.pinpoint.common.JvmVersion;
+import com.nhn.pinpoint.common.util.JvmVersion;
import com.nhn.pinpoint.common.util.JvmUtils;
import com.nhn.pinpoint.profiler.monitor.codahale.cpu.metric.CpuLoadMetricSet;
import com.nhn.pinpoint.profiler.monitor.codahale.cpu.metric.DefaultCpuLoadMetricSet;
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/StaticAcceptHistogram.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/StaticAcceptHistogram.java
index 583a979e6..32dd551c4 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/StaticAcceptHistogram.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/metric/StaticAcceptHistogram.java
@@ -1,6 +1,6 @@
package com.nhn.pinpoint.profiler.monitor.metric;
-import com.nhn.pinpoint.common.IntHashMap;
+import com.nhn.pinpoint.common.util.apache.IntHashMap;
import com.nhn.pinpoint.common.ServiceType;
import java.util.concurrent.ConcurrentHashMap;
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/HeaderTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/HeaderTest.java
index a1118793f..aa7b0c254 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/HeaderTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/context/HeaderTest.java
@@ -2,10 +2,16 @@ package com.nhn.pinpoint.profiler.context;
import com.nhn.pinpoint.bootstrap.context.Header;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class HeaderTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+
@Test
public void testToString() throws Exception {
- System.out.println(Header.HTTP_FLAGS);
+ logger.debug("{}", Header.HTTP_FLAGS);
}
}
diff --git a/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/interceptor/AroundInterceptor.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/AroundInterceptor.java
similarity index 72%
rename from bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/interceptor/AroundInterceptor.java
rename to profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/AroundInterceptor.java
index eec2bf884..3367d955c 100644
--- a/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/interceptor/AroundInterceptor.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/AroundInterceptor.java
@@ -1,12 +1,12 @@
-package com.nhn.pinpoint.bootstrap.interceptor;
-
-/**
- * @author emeroad
- */
-@Deprecated
-public interface AroundInterceptor {
-
- void before(InterceptorContext ctx);
-
- void after(InterceptorContext ctx);
-}
+package com.nhn.pinpoint.profiler.interceptor;
+
+/**
+ * @author emeroad
+ */
+@Deprecated
+public interface AroundInterceptor {
+
+ void before(InterceptorContext ctx);
+
+ void after(InterceptorContext ctx);
+}
diff --git a/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/interceptor/InterceptorContext.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/InterceptorContext.java
similarity index 91%
rename from bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/interceptor/InterceptorContext.java
rename to profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/InterceptorContext.java
index 1a9dc5d52..ac663f152 100644
--- a/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/interceptor/InterceptorContext.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/InterceptorContext.java
@@ -1,70 +1,70 @@
-package com.nhn.pinpoint.bootstrap.interceptor;
-
-import java.util.Arrays;
-
-/**
- * @author emeroad
- */
-@Deprecated
-public class InterceptorContext {
- private Object target;
- private String className;
- private String methodName;
- private Object[] parameter;
- private Object value;
-
- private Object result;
-
- public Object getTarget() {
- return target;
- }
-
- public void setTarget(Object target) {
- this.target = target;
- }
-
- public String getClassName() {
- return className;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-
- public String getMethodName() {
- return methodName;
- }
-
- public void setMethodName(String methodName) {
- this.methodName = methodName;
- }
-
- public Object[] getParameter() {
- return parameter;
- }
-
- public void setParameter(Object[] parameter) {
- this.parameter = parameter;
- }
-
- public Object getResult() {
- return result;
- }
-
- public void setResult(Object result) {
- this.result = result;
- }
-
- public Object getValue() {
- return value;
- }
-
- public void setValue(Object value) {
- this.value = value;
- }
-
- @Override
- public String toString() {
- return "InterceptorContext{" + "target=" + target + ", className='" + className + '\'' + ", methodName='" + methodName + '\'' + ", parameter=" + (parameter == null ? null : Arrays.asList(parameter)) + ", value=" + value + ", result=" + result + '}';
- }
-}
+package com.nhn.pinpoint.profiler.interceptor;
+
+import java.util.Arrays;
+
+/**
+ * @author emeroad
+ */
+@Deprecated
+public class InterceptorContext {
+ private Object target;
+ private String className;
+ private String methodName;
+ private Object[] parameter;
+ private Object value;
+
+ private Object result;
+
+ public Object getTarget() {
+ return target;
+ }
+
+ public void setTarget(Object target) {
+ this.target = target;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public void setMethodName(String methodName) {
+ this.methodName = methodName;
+ }
+
+ public Object[] getParameter() {
+ return parameter;
+ }
+
+ public void setParameter(Object[] parameter) {
+ this.parameter = parameter;
+ }
+
+ public Object getResult() {
+ return result;
+ }
+
+ public void setResult(Object result) {
+ this.result = result;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ @Override
+ public String toString() {
+ return "InterceptorContext{" + "target=" + target + ", className='" + className + '\'' + ", methodName='" + methodName + '\'' + ", parameter=" + (parameter == null ? null : Arrays.asList(parameter)) + ", value=" + value + ", result=" + result + '}';
+ }
+}
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/InterceptorRegistryTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/InterceptorRegistryTest.java
index 9a622831f..cf8cc15ed 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/InterceptorRegistryTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/InterceptorRegistryTest.java
@@ -1,8 +1,6 @@
package com.nhn.pinpoint.profiler.interceptor;
-import com.nhn.pinpoint.bootstrap.interceptor.AroundInterceptor;
import com.nhn.pinpoint.bootstrap.interceptor.Interceptor;
-import com.nhn.pinpoint.bootstrap.interceptor.InterceptorContext;
import com.nhn.pinpoint.bootstrap.interceptor.InterceptorRegistry;
import com.nhn.pinpoint.profiler.interceptor.bci.TestObject;
import javassist.*;
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/bci/FormatTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/bci/FormatTest.java
index f54597e31..5be76f2be 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/bci/FormatTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/bci/FormatTest.java
@@ -1,6 +1,9 @@
package com.nhn.pinpoint.profiler.interceptor.bci;
+import junit.framework.Assert;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.text.Format;
import java.util.Formatter;
@@ -9,22 +12,24 @@ import java.util.Formatter;
* @author emeroad
*/
public class FormatTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
@Test
public void format() {
- StringBuilder sb = new StringBuilder();
- Formatter formatter = new Formatter(sb);
- formatter.format("interceptor.after(%1s)", "tsest");
+ StringBuilder buffer = new StringBuilder();
+ Formatter formatter = new Formatter(buffer);
+ formatter.format("%1s", "ab");
- formatter.format("interceptor.afteddddr(%1s)", "tsest", "dd");
- System.out.println();
+ formatter.format("%3s", "a");
+ Assert.assertEquals(buffer.toString(), "ab a");
}
+
@Test
public void format2() {
- StringBuilder sb = new StringBuilder();
- sb.append("dddd");
- Formatter formatter = new Formatter(sb);
+ StringBuilder buffer = new StringBuilder();
+ Formatter formatter = new Formatter(buffer);
+ formatter.format("(%s, %s, %s)", 1, 2, 3);
- formatter.format("interceptor.afteddddr(%s, %s, %s)", 16, 34234, 333);
- System.out.println(sb.toString());
+ Assert.assertEquals(buffer.toString(), "(1, 2, 3)");
}
}
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/bci/ReflectionTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/bci/ReflectionTest.java
index 6190aa48f..a44b1d35b 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/bci/ReflectionTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/interceptor/bci/ReflectionTest.java
@@ -3,6 +3,8 @@ package com.nhn.pinpoint.profiler.interceptor.bci;
import javassist.*;
import org.junit.Before;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
@@ -12,6 +14,8 @@ import java.util.Arrays;
* @author emeroad
*/
public class ReflectionTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
private ClassPool pool = new ClassPool();
@Before
public void setUp() throws Exception {
@@ -22,14 +26,14 @@ public class ReflectionTest {
public void test() throws NotFoundException {
Constructor>[] constructors = String.class.getConstructors();
for(Constructor c: constructors) {
- System.out.println(c.getName());
+ logger.debug(c.getName());
}
CtClass ctClass = pool.get("java.lang.String");
CtConstructor[] constructors1 = ctClass.getConstructors();
for(CtConstructor cc : constructors1) {
- System.out.println(cc.getName());
- System.out.println(cc.getLongName());
- System.out.println(cc.getSignature());
+ logger.debug(cc.getName());
+ logger.debug(cc.getLongName());
+ logger.debug(cc.getSignature());
}
@@ -39,17 +43,15 @@ public class ReflectionTest {
CtClass ctClass = pool.get("java.lang.String");
CtMethod subString = ctClass.getDeclaredMethod("substring", new CtClass[]{pool.get("int")});
- System.out.println("getLongName:" + subString.getLongName());
- System.out.println("getName:"+ subString.getName());
- System.out.println("getDescriptor:"+ subString.getMethodInfo().getDescriptor());
- System.out.println("getDescriptor2:"+ subString.getMethodInfo2().getDescriptor());
- System.out.println("getSignature:"+ subString.getSignature());
+ logger.debug("getLongName:{}", subString.getLongName());
+ logger.debug("getName:{}", subString.getName());
+ logger.debug("getDescriptor:{}", subString.getMethodInfo().getDescriptor());
+ logger.debug("getDescriptor2:{}", subString.getMethodInfo2().getDescriptor());
+ logger.debug("getSignature:{}", subString.getSignature());
Method substring = String.class.getMethod("substring", int.class);
- System.out.println(substring.toString());
- System.out.println(Arrays.toString(substring.getParameterTypes()));
-
-// M
+ logger.debug(substring.toString());
+ logger.debug(Arrays.toString(substring.getParameterTypes()));
}
}
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/javaassist/JavaAssistTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/javaassist/JavaAssistTest.java
index 4438cac18..2a495706e 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/javaassist/JavaAssistTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/javaassist/JavaAssistTest.java
@@ -43,8 +43,8 @@ public class JavaAssistTest {
// ctClass.getMethod("valueOf", "(D)");
CtMethod[] methods = ctClass.getMethods();
-// for(CtMethod method : methods) {
-// System.out.println(method.getMethodInfo() +" " + method.getSignature());
+// for (CtMethod method : methods) {
+// logger.debug("{} {}", method.getMethodInfo(), method.getSignature());
// }
CtMethod endsWith = ctClass.getMethod("endsWith", "(Ljava/lang/String;)Z");
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/metadata/AgentIdentifierCompareTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/metadata/AgentIdentifierCompareTest.java
index 7193733a0..98dc2ee99 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/metadata/AgentIdentifierCompareTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/metadata/AgentIdentifierCompareTest.java
@@ -1,6 +1,8 @@
package com.nhn.pinpoint.profiler.metadata;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -10,16 +12,18 @@ import java.util.Date;
* @author emeroad
*/
public class AgentIdentifierCompareTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
@Test
public void test() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long l = System.currentTimeMillis();
Date date = new Date(l);
- System.out.println(simpleDateFormat.format(date));
+ logger.debug(simpleDateFormat.format(date));
int max = Integer.MAX_VALUE;
Date maxAfter = new Date(l+max);
- System.out.println(simpleDateFormat.format(maxAfter));
+ logger.debug(simpleDateFormat.format(maxAfter));
// Agent의 identifer대신에 서버시작시간 - 실행시간을 구해서 int type으로 전달하는건 좋은 생각아 아님
// int max를 더하더라도 최대 한달 정도가 한계임, unsigned type으로 해도 두달 그냥 사이즈 빼서 가변 인코딩 long으로 보내야 함.
// 2013-05-25 15:39:09
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/modifier/mapping/MappingTableTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/modifier/mapping/MappingTableTest.java
deleted file mode 100644
index 21bf7c8aa..000000000
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/modifier/mapping/MappingTableTest.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.nhn.pinpoint.profiler.modifier.mapping;
-
-import org.junit.Test;
-
-/**
- * @author emeroad
- */
-public class MappingTableTest {
- @Test
- public void testLookupMethodDescriptor() throws Exception {
- // 2147483647
- // xxxxxxxx - yyy xxxx는 class 명, yyy는 함수명매칭하자. 하자.
- int maxValue = Integer.MAX_VALUE;
- int i = 2147483647 / 100;
- System.out.println(i);
-
-
- }
-}
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/monitor/codahale/MetricMonitorRegistryTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/monitor/codahale/MetricMonitorRegistryTest.java
index 167e288f2..7da68da1d 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/monitor/codahale/MetricMonitorRegistryTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/monitor/codahale/MetricMonitorRegistryTest.java
@@ -21,8 +21,12 @@ import com.codahale.metrics.Snapshot;
import com.nhn.pinpoint.thrift.dto.TAgentStat._Fields;
import com.nhn.pinpoint.profiler.monitor.codahale.MetricHistogramMonitor;
import com.nhn.pinpoint.profiler.monitor.codahale.MetricMonitorRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class MetricMonitorRegistryTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
MetricMonitorRegistry registry = new MetricMonitorRegistry();
@@ -111,18 +115,18 @@ public class MetricMonitorRegistryTest {
MetricRegistry r = registry.getRegistry();
Map map = r.getGauges();
// for (Entry each : map.entrySet()) {
-// System.out.println(each.getKey() + " : " + each.getValue().getValue().getClass());
+// logger.debug(each.getKey() + " : " + each.getValue().getValue().getClass());
// }
//
for (Entry<_Fields, FieldMetaData> each : TAgentStat.metaDataMap.entrySet()) {
- System.out.println(toMetricName(each.getKey().name()));
+ logger.debug(toMetricName(each.getKey().name()));
Gauge value = map.get(toMetricName(each.getKey().name()));
if (value != null) {
agentStat.setFieldValue(each.getKey(), value.getValue());
}
}
-
- System.out.println(agentStat);
+
+ logger.debug("{}", agentStat);
}
}
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/monitor/metric/WasStaticAcceptHistogramTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/monitor/metric/WasStaticAcceptHistogramTest.java
index e47f3fd95..2fdb39897 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/monitor/metric/WasStaticAcceptHistogramTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/monitor/metric/WasStaticAcceptHistogramTest.java
@@ -3,12 +3,15 @@ package com.nhn.pinpoint.profiler.monitor.metric;
import com.nhn.pinpoint.common.ServiceType;
import junit.framework.Assert;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class WasStaticAcceptHistogramTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Test
public void testLookUp() throws Exception {
@@ -64,7 +67,7 @@ public class WasStaticAcceptHistogramTest {
}
latch.await();
}
- System.out.println(System.currentTimeMillis() - l);
+ logger.debug("{}", System.currentTimeMillis() - l);
executors.shutdown();
}
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/sampler/SimpleSamplerTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/sampler/SimpleSamplerTest.java
index b3a97e50c..893d79012 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/sampler/SimpleSamplerTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/sampler/SimpleSamplerTest.java
@@ -4,11 +4,16 @@ package com.nhn.pinpoint.profiler.sampler;
import com.nhn.pinpoint.profiler.sampler.SamplingRateSampler;
import org.junit.Assert;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* @author emeroad
*/
public class SimpleSamplerTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+
@Test
public void test() {
SamplingRateSampler simpleSampler = new SamplingRateSampler(1);
@@ -27,10 +32,10 @@ public class SimpleSamplerTest {
@Test
public void mod() {
int i = 0 % 101;
- System.out.println("" + i);
+ logger.debug("{}", i);
int j = Math.abs(-102) % 101;
- System.out.println("" + j);
+ logger.debug("{}", j);
}
private void assertDrop(SamplingRateSampler simpleSampler) {
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/GoavaCacheTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/GuavaCacheTest.java
similarity index 66%
rename from profiler/src/test/java/com/navercorp/pinpoint/profiler/util/GoavaCacheTest.java
rename to profiler/src/test/java/com/navercorp/pinpoint/profiler/util/GuavaCacheTest.java
index 8490e61ca..0249313a4 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/GoavaCacheTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/GuavaCacheTest.java
@@ -1,25 +1,30 @@
-package com.nhn.pinpoint.profiler.util;
-
-import com.google.common.cache.Cache;
-import com.google.common.cache.CacheBuilder;
-import org.junit.Test;
-
-/**
- * @author emeroad
- */
-public class GoavaCacheTest {
- @Test
- public void test() {
- CacheBuilder builder = CacheBuilder.newBuilder();
- builder.concurrencyLevel(8);
- builder.maximumSize(1);
- builder.initialCapacity(1);
- Cache cache = builder.build();
-
- cache.put("test1", "1");
- System.out.println(cache.size());
- cache.put("test3", "2");
- System.out.println(cache.size());
-
- }
-}
+package com.nhn.pinpoint.profiler.util;
+
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author emeroad
+ */
+public class GuavaCacheTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+
+ @Test
+ public void test() {
+ CacheBuilder builder = CacheBuilder.newBuilder();
+ builder.concurrencyLevel(8);
+ builder.maximumSize(1);
+ builder.initialCapacity(1);
+ Cache cache = builder.build();
+
+ cache.put("test1", "1");
+ logger.debug("{}", cache.size());
+ cache.put("test3", "2");
+ logger.debug("{}", cache.size());
+
+ }
+}
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/PreparedStatementUtilsTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/PreparedStatementUtilsTest.java
index e2dc9e480..95fde98d2 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/PreparedStatementUtilsTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/PreparedStatementUtilsTest.java
@@ -2,6 +2,8 @@ package com.nhn.pinpoint.profiler.util;
import org.junit.Assert;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import java.util.List;
@@ -10,11 +12,14 @@ import java.util.List;
* @author emeroad
*/
public class PreparedStatementUtilsTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+
@Test
public void testBindSetMethod() {
List bindVariableSetMethod = PreparedStatementUtils.findBindVariableSetMethod();
for (Method method : bindVariableSetMethod) {
- System.out.println(method);
+ logger.debug("{}", method);
}
}
diff --git a/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/bindvalue/BindValueConverterTest.java b/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/bindvalue/BindValueConverterTest.java
index 34ab8af8b..482089896 100644
--- a/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/bindvalue/BindValueConverterTest.java
+++ b/profiler/src/test/java/com/navercorp/pinpoint/profiler/util/bindvalue/BindValueConverterTest.java
@@ -2,19 +2,23 @@ package com.nhn.pinpoint.profiler.util.bindvalue;
import junit.framework.Assert;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.Date;
public class BindValueConverterTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
@Test
public void testBindValueToString() throws Exception {
Date d = new Date();
- System.out.println(d);
+ logger.debug("{}", d);
byte[] bytes = new byte[] {1, 2, 4};
String s = Arrays.toString(bytes);
- System.out.println(s);
+ logger.debug(s);
}
@Test
diff --git a/rpc/src/test/java/com/navercorp/pinpoint/rpc/server/MessageListenerTest.java b/rpc/src/test/java/com/navercorp/pinpoint/rpc/server/MessageListenerTest.java
index aeb9d8430..ec1a75218 100644
--- a/rpc/src/test/java/com/navercorp/pinpoint/rpc/server/MessageListenerTest.java
+++ b/rpc/src/test/java/com/navercorp/pinpoint/rpc/server/MessageListenerTest.java
@@ -259,7 +259,7 @@ public class MessageListenerTest {
sendPacketRepository.add(sendPacket);
byte[] payload = sendPacket.getPayload();
- System.out.println(new String(payload));
+ logger.debug(new String(payload));
}
@Override
@@ -267,7 +267,7 @@ public class MessageListenerTest {
requestPacketRepository.add(requestPacket);
byte[] payload = requestPacket.getPayload();
- System.out.println(new String(payload));
+ logger.debug(new String(payload));
channel.write(new ResponsePacket(requestPacket.getRequestId(), requestPacket.getPayload()));
}
diff --git a/testweb/src/main/java/com/linecorp/games/common/baseFramework/handlers/HttpCustomServerHandler.java b/testweb/src/main/java/com/linecorp/games/common/baseFramework/handlers/HttpCustomServerHandler.java
index aae9541c4..218c24717 100644
--- a/testweb/src/main/java/com/linecorp/games/common/baseFramework/handlers/HttpCustomServerHandler.java
+++ b/testweb/src/main/java/com/linecorp/games/common/baseFramework/handlers/HttpCustomServerHandler.java
@@ -68,7 +68,7 @@ public class HttpCustomServerHandler extends SimpleChannelUpstreamHandler {
@Override
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws Exception {
- System.out.println("HttpCustomServerHandler.messageReceived (" + Thread.currentThread().getName() + ")");
+ logger.debug("HttpCustomServerHandler.messageReceived ({})", Thread.currentThread().getName());
this.listeningExecutorService.submit(new InvokeTask(ctx, e));
}
@@ -102,7 +102,7 @@ public class HttpCustomServerHandler extends SimpleChannelUpstreamHandler {
}
public void run() {
- System.out.println("InvokeTask.run (" + Thread.currentThread().getName() + ")");
+ logger.debug("InvokeTask.run ({}}", Thread.currentThread().getName());
if (!(e.getMessage() instanceof HttpRequest)) {
logger.debug("[n/a] received message is illegal.");
diff --git a/testweb/src/test/java/com/nhn/pinpoint/testweb/connector/apachehttp4/nhnent/HttpUtilTest.java b/testweb/src/test/java/com/nhn/pinpoint/testweb/connector/apachehttp4/nhnent/HttpUtilTest.java
index 009a759fc..e80a25e3f 100644
--- a/testweb/src/test/java/com/nhn/pinpoint/testweb/connector/apachehttp4/nhnent/HttpUtilTest.java
+++ b/testweb/src/test/java/com/nhn/pinpoint/testweb/connector/apachehttp4/nhnent/HttpUtilTest.java
@@ -1,6 +1,8 @@
package com.nhn.pinpoint.testweb.connector.apachehttp4.nhnent;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*
@@ -8,18 +10,17 @@ import org.junit.Test;
*
*/
public class HttpUtilTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
private final String URL = "http://www.naver.com/";
@Test
public void callUrl() {
- String response = null;
try {
- response = HttpUtil.url(URL).method(HttpUtil.Method.POST).connectionTimeout(10000).readTimeout(10000).getContents();
+ String response = HttpUtil.url(URL).method(HttpUtil.Method.POST).connectionTimeout(10000).readTimeout(10000).getContents();
+ logger.debug(response);
} catch (HttpUtilException e) {
}
-
- System.out.println(response);
}
}
diff --git a/testweb/src/test/java/com/nhn/pinpoint/testweb/npc/NPCTest.java b/testweb/src/test/java/com/nhn/pinpoint/testweb/npc/NPCTest.java
index 9b8a966a2..17be2fe3e 100644
--- a/testweb/src/test/java/com/nhn/pinpoint/testweb/npc/NPCTest.java
+++ b/testweb/src/test/java/com/nhn/pinpoint/testweb/npc/NPCTest.java
@@ -10,8 +10,12 @@ import org.junit.Test;
import com.nhncorp.lucy.net.invoker.InvocationFuture;
import com.nhncorp.lucy.npc.connector.NpcHessianConnector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class NPCTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
@Test
public void connect() {
@@ -29,7 +33,7 @@ public class NPCTest {
// Object result = future.get();
Object result = future.getReturnValue();
- System.out.println(result);
+ logger.debug("{}", result);
Assert.assertNotNull(result);
} catch (Exception e) {
e.printStackTrace();
diff --git a/testweb/src/test/java/com/nhn/pinpoint/testweb/service/http/ApacheClosableAsyncHttpClientTest.java b/testweb/src/test/java/com/nhn/pinpoint/testweb/service/http/ApacheClosableAsyncHttpClientTest.java
index fcb008e9f..63e8a6a97 100644
--- a/testweb/src/test/java/com/nhn/pinpoint/testweb/service/http/ApacheClosableAsyncHttpClientTest.java
+++ b/testweb/src/test/java/com/nhn/pinpoint/testweb/service/http/ApacheClosableAsyncHttpClientTest.java
@@ -2,6 +2,8 @@ package com.nhn.pinpoint.testweb.service.http;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -16,6 +18,7 @@ import com.nhn.pinpoint.testweb.connector.apachehttp4.ApacheClosableAsyncHttpCli
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"/applicationContext-testweb.xml", "/servlet-context.xml" })
public class ApacheClosableAsyncHttpClientTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private ApacheClosableAsyncHttpClient apacheClosableAsyncHttpClient;
@@ -23,6 +26,6 @@ public class ApacheClosableAsyncHttpClientTest {
@Test
public void requestPost() {
String requestPost = apacheClosableAsyncHttpClient.post();
- System.out.println(requestPost);
+ logger.debug(requestPost);
}
}
\ No newline at end of file
diff --git a/testweb/src/test/java/com/nhn/pinpoint/testweb/util/HTClientTest.java b/testweb/src/test/java/com/nhn/pinpoint/testweb/util/HTClientTest.java
index 6370c69f6..3d3226f9e 100644
--- a/testweb/src/test/java/com/nhn/pinpoint/testweb/util/HTClientTest.java
+++ b/testweb/src/test/java/com/nhn/pinpoint/testweb/util/HTClientTest.java
@@ -6,14 +6,18 @@ import org.junit.Test;
import com.nhn.pinpoint.testweb.connector.apachehttp4.HttpConnectorOptions;
import com.nhn.pinpoint.testweb.connector.apachehttp4.ApacheHttpClient4;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class HTClientTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
@Test
public void test() {
ApacheHttpClient4 client = new ApacheHttpClient4(new HttpConnectorOptions());
String executeToBloc = client.execute("http://localhost:9080/", new HashMap());
- System.out.println(executeToBloc);
+ logger.debug(executeToBloc);
}
}
diff --git a/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/HbaseAgentStatDaoTest.java b/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/HbaseAgentStatDaoTest.java
index dc7a71427..110d9d672 100644
--- a/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/HbaseAgentStatDaoTest.java
+++ b/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/HbaseAgentStatDaoTest.java
@@ -7,6 +7,8 @@ import com.nhn.pinpoint.web.vo.Range;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -18,6 +20,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext-web.xml")
public class HbaseAgentStatDaoTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private HbaseAgentStatDao dao;
@@ -27,7 +30,7 @@ public class HbaseAgentStatDaoTest {
long timestamp = System.currentTimeMillis();
Range range = new Range(timestamp - 100000, timestamp);
List result = dao.scanAgentStatList("FRONT-WEB1", range);
- System.out.println(result);
+ logger.debug("{}", result);
}
}
diff --git a/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/filter/HbaseFilterPerformanceTest.java b/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/filter/HbaseFilterPerformanceTest.java
index 368cd8505..90f4f6a9b 100644
--- a/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/filter/HbaseFilterPerformanceTest.java
+++ b/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/filter/HbaseFilterPerformanceTest.java
@@ -2,7 +2,6 @@ package com.nhn.pinpoint.web.dao.hbase.filter;
import java.io.IOException;
import java.util.List;
-import java.util.Properties;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
@@ -17,6 +16,8 @@ import org.apache.hadoop.hbase.util.Bytes;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.data.hadoop.hbase.HbaseConfigurationFactoryBean;
import org.springframework.data.hadoop.hbase.HbaseSystemException;
@@ -24,7 +25,6 @@ import com.nhn.pinpoint.common.buffer.AutomaticBuffer;
import com.nhn.pinpoint.common.buffer.Buffer;
import com.nhn.pinpoint.common.hbase.HBaseTables;
import com.nhn.pinpoint.common.hbase.HbaseTemplate2;
-import com.nhn.pinpoint.common.util.PropertyUtils;
import com.nhn.pinpoint.common.util.SpanUtils;
import com.nhn.pinpoint.web.mapper.TraceIndexScatterMapper;
import com.nhn.pinpoint.web.vo.Range;
@@ -36,6 +36,8 @@ import com.sematext.hbase.wd.AbstractRowKeyDistributor;
import com.sematext.hbase.wd.RowKeyDistributorByHashPrefix.OneByteSimpleHash;
public class HbaseFilterPerformanceTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
private static HbaseConfigurationFactoryBean hbaseConfigurationFactoryBean;
private static AbstractRowKeyDistributor traceIdRowKeyDistributor;
@@ -125,8 +127,8 @@ public class HbaseFilterPerformanceTest {
long startTime = System.currentTimeMillis();
List> dotListList = hbaseTemplate2.find(HBaseTables.APPLICATION_TRACE_INDEX, scan, traceIdRowKeyDistributor, fetchLimit, new TraceIndexScatterMapper());
- System.out.println("elapsed : " + (System.currentTimeMillis() - startTime) + "ms");
- System.out.println("fetched size : " + dotListList.size());
+ logger.debug("elapsed : {}ms", (System.currentTimeMillis() - startTime));
+ logger.debug("fetched size : {}", dotListList.size());
} catch (HbaseSystemException e) {
e.printStackTrace();
} finally {
diff --git a/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/filter/PrefixFilterTest.java b/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/filter/PrefixFilterTest.java
index 605867d31..e86296a96 100644
--- a/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/filter/PrefixFilterTest.java
+++ b/web/src/test/java/com/navercorp/pinpoint/web/dao/hbase/filter/PrefixFilterTest.java
@@ -5,8 +5,12 @@ import java.util.Arrays;
import org.junit.Test;
import com.nhn.pinpoint.common.util.BytesUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class PrefixFilterTest {
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
@Test
public void prefixInt() {
@@ -17,11 +21,11 @@ public class PrefixFilterTest {
byte[] buffer = new byte[4];
BytesUtils.writeVar32(i, buffer, 0);
- System.out.println(compare(before, buffer) + ", " + compare(buffer, before) + ", " + compare(buffer, buffer));
+ logger.debug(compare(before, buffer) + ", " + compare(buffer, before) + ", " + compare(buffer, buffer));
before = Arrays.copyOf(buffer, 4);
- System.out.println(Arrays.toString(buffer));
+ logger.debug(Arrays.toString(buffer));
}
}
diff --git a/web/src/test/java/com/navercorp/pinpoint/web/path/PathTest.java b/web/src/test/java/com/navercorp/pinpoint/web/path/PathTest.java
index 57a1aa46f..fbc241b4b 100644
--- a/web/src/test/java/com/navercorp/pinpoint/web/path/PathTest.java
+++ b/web/src/test/java/com/navercorp/pinpoint/web/path/PathTest.java
@@ -5,12 +5,16 @@ import java.text.SimpleDateFormat;
import org.junit.Test;
import com.nhn.pinpoint.thrift.dto.TSpan;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*
*/
public class PathTest {
- int index;
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ int index;
SimpleDateFormat format = new SimpleDateFormat("ss.SSS");
@Test
@@ -36,7 +40,7 @@ public class PathTest {
// System.out.println(msg + " id:" + span.getSpanID() + " pid:" +
// span.getParentSpanId() + " time:" + format.format(new
// Date(span.getTimestamp())));
- System.out.println(msg + " id:" + span.getSpanId() + " pid:" + span.getParentSpanId() + " time:" + span.getStartTime());
+ logger.debug(msg + " id:" + span.getSpanId() + " pid:" + span.getParentSpanId() + " time:" + span.getStartTime());
}
// private Span root() {
// TraceID traceID = TraceID.newTraceId();
diff --git a/web/src/test/java/com/navercorp/pinpoint/web/vo/TransactionIdTest.java b/web/src/test/java/com/navercorp/pinpoint/web/vo/TransactionIdTest.java
index e815ace4a..8f8d17b55 100644
--- a/web/src/test/java/com/navercorp/pinpoint/web/vo/TransactionIdTest.java
+++ b/web/src/test/java/com/navercorp/pinpoint/web/vo/TransactionIdTest.java
@@ -9,9 +9,13 @@ import java.util.TreeSet;
import junit.framework.Assert;
import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class TransactionIdTest {
- @Test
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+
+ @Test
public void sameAll() {
TransactionId id1 = new TransactionId("A1", 1, 1);
TransactionId id2 = new TransactionId("A1", 1, 1);
@@ -58,13 +62,13 @@ public class TransactionIdTest {
for (int i = 0; i < 10; i++) {
list.add(new TransactionId("A", 1, numbers.get(i)));
}
- System.out.println(list);
+ logger.debug("{}", list);
SortedSet set = new TreeSet(list);
for (int i = 0; i < 10; i++) {
set.add(list.get(i));
}
- System.out.println(set);
+ logger.debug("{}", set);
}
}