diff --git a/README.md b/README.md
index e80da3803f5d69200147ec9372a147303bdea715..a2b54426e62fe55727078f94a4a207ff4fc96949 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ CAT监控系统将每次URL、Service的请求内部执行情况都封装为一
![Alt text](https://raw.github.com/dianping/cat/master/cat-home/src/main/webapp/images/logviewAll02.png)
-分布式消息树【一台机器CALL另外一台机器】
+分布式消息树【一台机器调用另外一台机器】
---------------------
![Alt text](https://raw.github.com/dianping/cat/master/cat-home/src/main/webapp/images/logviewAll03.png)
@@ -44,7 +44,9 @@ Quick Started
Note:
* Linux\Mac 需要对/data/appdatas/cat和/data/applogs/cat有读写权限
* Windows 则是对系统运行盘下的/data/appdatas/cat和/data/applogs/cat有读写权限
+
#####3、(Optional)如果安装了hadoop集群,需到/data/appdatas/cat/server.xml中配置对应hadoop信息。将localmode设置为false,默认情况下,CAT在开发模式(localmode=true)下工作。
+
#####4、运行CAT
cd cat-home;mvn jetty:run
然后打开浏览器,输入http://localhost:2281/cat/。
diff --git a/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java b/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java
index a81fe0a41d922a1ba2a66b54857c659a35f78104..786c1f3b0b0f3d02cb97e34e2d09440b1a555881 100644
--- a/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java
+++ b/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/build/ComponentsConfigurator.java
@@ -13,9 +13,6 @@ import com.dianping.cat.ServerConfigManager;
import com.dianping.cat.abtest.spi.internal.ABTestCodec;
import com.dianping.cat.analysis.MessageAnalyzer;
import com.dianping.cat.consumer.CatConsumerAdvancedModule;
-import com.dianping.cat.consumer.advanced.MetricAnalyzer;
-import com.dianping.cat.consumer.advanced.MetricConfigManager;
-import com.dianping.cat.consumer.advanced.ProductLineConfigManager;
import com.dianping.cat.consumer.advanced.dal.BusinessReportDao;
import com.dianping.cat.consumer.advanced.dal.SqltableDao;
import com.dianping.cat.consumer.cross.CrossAnalyzer;
@@ -24,6 +21,9 @@ import com.dianping.cat.consumer.dependency.DependencyAnalyzer;
import com.dianping.cat.consumer.dependency.DependencyDelegate;
import com.dianping.cat.consumer.matrix.MatrixAnalyzer;
import com.dianping.cat.consumer.matrix.MatrixDelegate;
+import com.dianping.cat.consumer.metric.MetricAnalyzer;
+import com.dianping.cat.consumer.metric.MetricConfigManager;
+import com.dianping.cat.consumer.metric.ProductLineConfigManager;
import com.dianping.cat.consumer.sql.DatabaseParser;
import com.dianping.cat.consumer.sql.SqlAnalyzer;
import com.dianping.cat.consumer.sql.SqlDelegate;
diff --git a/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/advanced/MetricAnalyzer.java b/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricAnalyzer.java
similarity index 99%
rename from cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/advanced/MetricAnalyzer.java
rename to cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricAnalyzer.java
index 2db9eb58f40fe80dfb99e3316376ac1ed88277e1..b04a2b8f619e4a4c5052c93ae2cba019576af716 100644
--- a/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/advanced/MetricAnalyzer.java
+++ b/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricAnalyzer.java
@@ -1,4 +1,4 @@
-package com.dianping.cat.consumer.advanced;
+package com.dianping.cat.consumer.metric;
import java.util.Date;
import java.util.HashMap;
diff --git a/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/advanced/MetricConfigManager.java b/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricConfigManager.java
similarity index 97%
rename from cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/advanced/MetricConfigManager.java
rename to cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricConfigManager.java
index b6e6e5ea67eabae9f045189416fbec14457a06bf..367d4d26ef312406dc021fcde82a08e1da45dac6 100644
--- a/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/advanced/MetricConfigManager.java
+++ b/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/MetricConfigManager.java
@@ -1,4 +1,4 @@
-package com.dianping.cat.consumer.advanced;
+package com.dianping.cat.consumer.metric;
import java.io.IOException;
import java.util.ArrayList;
@@ -24,7 +24,7 @@ import com.dianping.cat.Cat;
import com.dianping.cat.advanced.metric.config.entity.MetricConfig;
import com.dianping.cat.advanced.metric.config.entity.MetricItemConfig;
import com.dianping.cat.advanced.metric.config.transform.DefaultSaxParser;
-import com.dianping.cat.consumer.advanced.MetricAnalyzer.ConfigItem;
+import com.dianping.cat.consumer.metric.MetricAnalyzer.ConfigItem;
import com.dianping.cat.core.config.Config;
import com.dianping.cat.core.config.ConfigDao;
import com.dianping.cat.core.config.ConfigEntity;
@@ -32,7 +32,7 @@ import com.dianping.cat.core.config.ConfigEntity;
public class MetricConfigManager implements Initializable, LogEnabled {
@Inject
- private ConfigDao m_configDao;
+ protected ConfigDao m_configDao;
private int m_configId;
diff --git a/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/advanced/ProductLineConfigManager.java b/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/ProductLineConfigManager.java
similarity index 98%
rename from cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/advanced/ProductLineConfigManager.java
rename to cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/ProductLineConfigManager.java
index 4c21d758b724036c4e737543a7c42c7d4340fd09..ddce207dc355c593643857e51ab5253abef6e181 100644
--- a/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/advanced/ProductLineConfigManager.java
+++ b/cat-consumer-advanced/src/main/java/com/dianping/cat/consumer/metric/ProductLineConfigManager.java
@@ -1,4 +1,4 @@
-package com.dianping.cat.consumer.advanced;
+package com.dianping.cat.consumer.metric;
import java.io.IOException;
import java.util.ArrayList;
@@ -34,7 +34,7 @@ import com.dianping.cat.core.config.ConfigEntity;
public class ProductLineConfigManager implements Initializable, LogEnabled {
@Inject
- private ConfigDao m_configDao;
+ protected ConfigDao m_configDao;
private int m_configId;
diff --git a/cat-consumer-advanced/src/main/resources/META-INF/plexus/components.xml b/cat-consumer-advanced/src/main/resources/META-INF/plexus/components.xml
index c09eb425dd33cb4063c630c97ae6b667ef228530..608329abf7c10bdd77967b19f280421f0024b360 100644
--- a/cat-consumer-advanced/src/main/resources/META-INF/plexus/components.xml
+++ b/cat-consumer-advanced/src/main/resources/META-INF/plexus/components.xml
@@ -215,8 +215,8 @@
- com.dianping.cat.consumer.advanced.MetricConfigManager
- com.dianping.cat.consumer.advanced.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
com.dianping.cat.core.config.ConfigDao
@@ -224,8 +224,8 @@
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
com.dianping.cat.core.config.ConfigDao
@@ -235,7 +235,7 @@
com.dianping.cat.analysis.MessageAnalyzer
metric
- com.dianping.cat.consumer.advanced.MetricAnalyzer
+ com.dianping.cat.consumer.metric.MetricAnalyzer
per-lookup
@@ -245,10 +245,10 @@
com.dianping.cat.consumer.advanced.dal.BusinessReportDao
- com.dianping.cat.consumer.advanced.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
com.dianping.cat.abtest.spi.internal.ABTestCodec
diff --git a/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/AllTests.java b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/AllTests.java
index 3e4ec01919dcabe5f54fa3eca79c271c2c0e58a0..4f80ea88ca5e9897f37376de1bd1606757ef7108 100644
--- a/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/AllTests.java
+++ b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/AllTests.java
@@ -4,7 +4,6 @@ import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
-import com.dianping.cat.consumer.advanced.MetricAnalyzerTest;
import com.dianping.cat.consumer.cross.CrossAnalyzerTest;
import com.dianping.cat.consumer.cross.CrossInfoTest;
import com.dianping.cat.consumer.cross.CrossReportMergerTest;
@@ -13,6 +12,9 @@ import com.dianping.cat.consumer.dependency.DependencyReportMergerTest;
import com.dianping.cat.consumer.matrix.MatrixAnalyzerTest;
import com.dianping.cat.consumer.matrix.MatrixModelTest;
import com.dianping.cat.consumer.matrix.MatrixReportMergerTest;
+import com.dianping.cat.consumer.metric.MetricAnalyzerTest;
+import com.dianping.cat.consumer.metric.MetricConfigManagerTest;
+import com.dianping.cat.consumer.metric.ProductLineConfigManagerTest;
import com.dianping.cat.consumer.sql.DatabaseParserTest;
import com.dianping.cat.consumer.sql.SqlAnalyzerTest;
import com.dianping.cat.consumer.sql.SqlParsersTest;
@@ -45,7 +47,11 @@ MatrixAnalyzerTest.class,
DependencyAnalyzerTest.class,
-DependencyReportMergerTest.class
+DependencyReportMergerTest.class,
+
+ProductLineConfigManagerTest.class,
+
+MetricConfigManagerTest.class
})
public class AllTests {
diff --git a/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/MockLog.java b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/MockLog.java
new file mode 100644
index 0000000000000000000000000000000000000000..8f9277fc93c6cac57a7c03023b6849a59a4b7c6f
--- /dev/null
+++ b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/MockLog.java
@@ -0,0 +1,110 @@
+package com.dianping.cat.consumer;
+
+import org.codehaus.plexus.logging.Logger;
+
+public class MockLog implements Logger {
+
+ @Override
+ public void debug(String message) {
+
+ }
+
+ @Override
+ public void debug(String message, Throwable throwable) {
+
+ }
+
+ @Override
+ public boolean isDebugEnabled() {
+
+ return false;
+ }
+
+ @Override
+ public void info(String message) {
+
+ }
+
+ @Override
+ public void info(String message, Throwable throwable) {
+
+ }
+
+ @Override
+ public boolean isInfoEnabled() {
+
+ return false;
+ }
+
+ @Override
+ public void warn(String message) {
+
+ }
+
+ @Override
+ public void warn(String message, Throwable throwable) {
+
+ }
+
+ @Override
+ public boolean isWarnEnabled() {
+
+ return false;
+ }
+
+ @Override
+ public void error(String message) {
+
+ }
+
+ @Override
+ public void error(String message, Throwable throwable) {
+
+ }
+
+ @Override
+ public boolean isErrorEnabled() {
+
+ return false;
+ }
+
+ @Override
+ public void fatalError(String message) {
+
+ }
+
+ @Override
+ public void fatalError(String message, Throwable throwable) {
+
+ }
+
+ @Override
+ public boolean isFatalErrorEnabled() {
+
+ return false;
+ }
+
+ @Override
+ public Logger getChildLogger(String name) {
+
+ return null;
+ }
+
+ @Override
+ public int getThreshold() {
+
+ return 0;
+ }
+
+ @Override
+ public void setThreshold(int threshold) {
+
+ }
+
+ @Override
+ public String getName() {
+
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/advanced/MetricAnalyzerTest.java b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/MetricAnalyzerTest.java
similarity index 96%
rename from cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/advanced/MetricAnalyzerTest.java
rename to cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/MetricAnalyzerTest.java
index 67965b5e453a832f35e6f88ab7a3c4a6aee57fcc..03c6bbb537e448a4e41a7e6b5672603a5adade9d 100644
--- a/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/advanced/MetricAnalyzerTest.java
+++ b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/MetricAnalyzerTest.java
@@ -1,4 +1,4 @@
-package com.dianping.cat.consumer.advanced;
+package com.dianping.cat.consumer.metric;
import java.io.IOException;
import java.text.SimpleDateFormat;
@@ -24,10 +24,13 @@ import org.unidal.lookup.ComponentTestCase;
import com.dianping.cat.Constants;
import com.dianping.cat.abtest.spi.internal.DefaultABTestCodec;
import com.dianping.cat.advanced.metric.config.entity.MetricItemConfig;
-import com.dianping.cat.consumer.advanced.MetricAnalyzer.ConfigItem;
import com.dianping.cat.consumer.advanced.dal.BusinessReport;
import com.dianping.cat.consumer.advanced.dal.BusinessReportDao;
import com.dianping.cat.consumer.company.model.entity.ProductLine;
+import com.dianping.cat.consumer.metric.MetricAnalyzer;
+import com.dianping.cat.consumer.metric.MetricConfigManager;
+import com.dianping.cat.consumer.metric.ProductLineConfigManager;
+import com.dianping.cat.consumer.metric.MetricAnalyzer.ConfigItem;
import com.dianping.cat.consumer.metric.model.entity.MetricReport;
import com.dianping.cat.message.internal.DefaultEvent;
import com.dianping.cat.message.internal.DefaultMetric;
diff --git a/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/MetricConfigManagerTest.java b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/MetricConfigManagerTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..45870234b3aa81b9c36ccb14d3ed4b161e711679
--- /dev/null
+++ b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/MetricConfigManagerTest.java
@@ -0,0 +1,143 @@
+package com.dianping.cat.consumer.metric;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.unidal.dal.jdbc.DalException;
+import org.unidal.dal.jdbc.Readset;
+import org.unidal.dal.jdbc.Updateset;
+
+import com.dianping.cat.advanced.metric.config.entity.MetricConfig;
+import com.dianping.cat.advanced.metric.config.entity.MetricItemConfig;
+import com.dianping.cat.consumer.MockLog;
+import com.dianping.cat.consumer.metric.MetricAnalyzer.ConfigItem;
+import com.dianping.cat.core.config.Config;
+import com.dianping.cat.core.config.ConfigDao;
+
+public class MetricConfigManagerTest {
+
+ private static int s_storeCount;
+
+ @Test
+ public void testInitNormal() throws Exception {
+ MetricConfigManager manager = new MockMetricConfigManager();
+
+ ((MockMetricConfigManager) manager).setConfigDao(new MockConfigDao1());
+ manager.initialize();
+
+ String domain1 = "domain1";
+ String domain2 = "domain2";
+ manager.insertIfNotExist(domain1, "type", "metricKey", new ConfigItem());
+
+ Assert.assertEquals(1, s_storeCount);
+ manager.insertIfNotExist(domain1, "type", "metricKey", new ConfigItem());
+ Assert.assertEquals(1, s_storeCount);
+ manager.insertIfNotExist(domain2, "type", "metricKey", new ConfigItem());
+ Assert.assertEquals(2, s_storeCount);
+ manager.insertMetricItemConfig(new MetricItemConfig());
+ Assert.assertEquals(3, s_storeCount);
+
+ MetricItemConfig item = manager.queryMetricItemConfig(manager.buildMetricKey(domain1, "type", "metricKey"));
+ Assert.assertEquals(true, item != null);
+
+ manager.deleteDomainConfig(manager.buildMetricKey(domain1, "type", "metricKey"));
+ Assert.assertEquals(4, s_storeCount);
+ Assert.assertEquals(2, manager.getMetricConfig().getMetricItemConfigs().size());
+
+ HashSet hashSet = new HashSet();
+ hashSet.add(domain1);
+ hashSet.add(domain2);
+ List sets = manager.queryMetricItemConfigs(hashSet);
+ Assert.assertEquals(1, sets.size());
+ manager.enableLogging(new MockLog());
+ manager.refreshMetricConfig();
+ Assert.assertEquals(1, manager.getMetricConfig().getMetricItemConfigs().size());
+ }
+
+ @Test
+ public void testInitThrowException() throws Exception {
+ MetricConfigManager manager = new MockMetricConfigManager();
+
+ ((MockMetricConfigManager) manager).setConfigDao(new MockConfigDao2());
+ manager.enableLogging(new MockLog());
+ try {
+ manager.initialize();
+ } catch (Exception e) {
+ }
+ MetricConfig config = manager.getMetricConfig();
+ Assert.assertEquals(0, config.getMetricItemConfigs().size());
+ }
+
+ public static class MockMetricConfigManager extends MetricConfigManager {
+
+ public void setConfigDao(ConfigDao configDao) {
+ m_configDao = configDao;
+ }
+
+ }
+
+ public static class MockConfigDao2 extends MockConfigDao1 {
+ @Override
+ public Config findByName(String name, Readset readset) throws DalException {
+ throw new DalException("this is a exception for test");
+ }
+ }
+
+ public static class MockConfigDao1 extends ConfigDao {
+
+ @Override
+ public Config createLocal() {
+ return super.createLocal();
+ }
+
+ @Override
+ public int deleteByPK(Config proto) throws DalException {
+ return 1;
+ }
+
+ @Override
+ public Config findByPK(int keyId, Readset readset) throws DalException {
+ Config config = new Config();
+
+ config.setId(keyId);
+ config.setContent(new MetricConfig().toString());
+ config.setModifyDate(new Date());
+ return config;
+ }
+
+ @Override
+ public Config findByName(String name, Readset readset) throws DalException {
+ Config config = new Config();
+
+ config.setName(name);
+ MetricConfig metricConfig = new MetricConfig();
+
+ MetricItemConfig metricItemConfig = new MetricItemConfig();
+
+ metricItemConfig.setDomain("domain");
+ metricItemConfig.setMetricKey("domain:URL:metricKey");
+ metricItemConfig.setType("URL");
+ metricItemConfig.setMetricKey("metricKey");
+ metricConfig.addMetricItemConfig(metricItemConfig);
+ config.setContent(metricConfig.toString());
+ config.setModifyDate(new Date());
+ return config;
+ }
+
+ @Override
+ public int insert(Config proto) throws DalException {
+ return 1;
+ }
+
+ @Override
+ public int updateByPK(Config proto, Updateset updateset) throws DalException {
+ s_storeCount++;
+ return 1;
+ }
+ }
+
+}
diff --git a/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/ProductLineConfigManagerTest.java b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/ProductLineConfigManagerTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..2ef6c0bba7f670104fd374a8820de6bbf5dfc5a7
--- /dev/null
+++ b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/metric/ProductLineConfigManagerTest.java
@@ -0,0 +1,131 @@
+package com.dianping.cat.consumer.metric;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.unidal.dal.jdbc.DalException;
+import org.unidal.dal.jdbc.DalNotFoundException;
+import org.unidal.dal.jdbc.Readset;
+import org.unidal.dal.jdbc.Updateset;
+
+import com.dianping.cat.consumer.MockLog;
+import com.dianping.cat.consumer.company.model.entity.Company;
+import com.dianping.cat.consumer.company.model.entity.ProductLine;
+import com.dianping.cat.core.config.Config;
+import com.dianping.cat.core.config.ConfigDao;
+
+public class ProductLineConfigManagerTest {
+
+ private static int s_storeCount;
+
+ @Test
+ public void testInitNormal() throws Exception {
+ ProductLineConfigManager manager = new MockProductLineConfigManager();
+
+ ((MockProductLineConfigManager) manager).setConfigDao(new MockConfigDao1());
+ manager.initialize();
+
+ ProductLine line1 = new ProductLine("Test1");
+ ProductLine line2 = new ProductLine("Test2");
+ String[] domains1 = { "domain1", "domain2" };
+ String[] domains2 = { "domain3", "domain4" };
+
+ manager.insertProductLine(line1, domains1);
+ manager.insertProductLine(line2, domains2);
+
+ Assert.assertEquals(2, s_storeCount);
+ Assert.assertEquals("Default", manager.queryProductLineByDomain("domain"));
+ Assert.assertEquals("Test1", manager.queryProductLineByDomain("domain1"));
+ List pDomains = manager.queryProductLineDomains("Test1");
+ Assert.assertEquals(2, pDomains.size());
+ Map productLines = manager.queryProductLines();
+
+ Assert.assertEquals(3, productLines.size());
+
+ manager.enableLogging(new MockLog());
+ manager.refreshProductLineConfig();
+ productLines = manager.queryProductLines();
+ Assert.assertEquals(1, productLines.size());
+ }
+
+ @Test
+ public void testInitThrowException() throws Exception {
+ ProductLineConfigManager manager = new MockProductLineConfigManager();
+ ((MockProductLineConfigManager) manager).setConfigDao(new MockConfigDao2());
+
+ try {
+ manager.initialize();
+ } catch (Exception e) {
+ }
+
+ Company config = manager.getCompany();
+ Assert.assertEquals(0, config.getProductLines().size());
+ }
+
+ public static class MockProductLineConfigManager extends ProductLineConfigManager {
+
+ public void setConfigDao(ConfigDao configDao) {
+ m_configDao = configDao;
+ }
+
+ }
+
+ public static class MockConfigDao2 extends MockConfigDao1 {
+ @Override
+ public Config findByName(String name, Readset readset) throws DalNotFoundException {
+ throw new DalNotFoundException("this is a exception for test");
+ }
+ }
+
+ public static class MockConfigDao1 extends ConfigDao {
+
+ @Override
+ public Config createLocal() {
+ return super.createLocal();
+ }
+
+ @Override
+ public int deleteByPK(Config proto) throws DalException {
+ return 1;
+ }
+
+ @Override
+ public Config findByPK(int keyId, Readset readset) throws DalException {
+ Config config = new Config();
+
+ config.setId(keyId);
+ config.setModifyDate(new Date());
+ config.setContent(new Company().toString());
+ return config;
+ }
+
+ @Override
+ public Config findByName(String name, Readset readset) throws DalException {
+ Config config = new Config();
+
+ config.setName(name);
+ Company company = new Company();
+ ProductLine productLine = new ProductLine("Test");
+
+ company.addProductLine(productLine);
+ config.setContent(company.toString());
+ config.setModifyDate(new Date());
+ return config;
+ }
+
+ @Override
+ public int insert(Config proto) throws DalException {
+ return 1;
+ }
+
+ @Override
+ public int updateByPK(Config proto, Updateset updateset) throws DalException {
+ s_storeCount++;
+ return 1;
+ }
+ }
+}
diff --git a/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/performance/MetricPerformanceTest.java b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/performance/MetricPerformanceTest.java
index de78ac6b7e467a1adc64f9205f0cafd64fc5871f..8d1e572e7dfd8762841f60df0f3c431675fda417 100644
--- a/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/performance/MetricPerformanceTest.java
+++ b/cat-consumer-advanced/src/test/java/com/dianping/cat/consumer/performance/MetricPerformanceTest.java
@@ -3,7 +3,7 @@ package com.dianping.cat.consumer.performance;
import org.junit.Test;
import org.unidal.lookup.ComponentTestCase;
-import com.dianping.cat.consumer.advanced.MetricAnalyzer;
+import com.dianping.cat.consumer.metric.MetricAnalyzer;
import com.dianping.cat.message.Message;
import com.dianping.cat.message.internal.MockMessageBuilder;
import com.dianping.cat.message.spi.MessageTree;
diff --git a/cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/advanced/metric_analyzer.xml b/cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/metric/metric_analyzer.xml
similarity index 100%
rename from cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/advanced/metric_analyzer.xml
rename to cat-consumer-advanced/src/test/resources/com/dianping/cat/consumer/metric/metric_analyzer.xml
diff --git a/cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java b/cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
index ac2bdb40555c09511ed4eb7ddd4cc9db019dca7f..ef68315cf85af94040462543f46971c1b757ef50 100644
--- a/cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
+++ b/cat-consumer/src/main/java/com/dianping/cat/consumer/dump/DumpAnalyzer.java
@@ -120,4 +120,20 @@ public class DumpAnalyzer extends AbstractMessageAnalyzer
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
com.dianping.cat.home.dal.report.TopologyGraphDao
@@ -149,10 +149,10 @@
com.dianping.cat.system.config.ConfigReloadTask
- com.dianping.cat.consumer.advanced.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
@@ -194,10 +194,10 @@
com.dianping.cat.report.baseline.BaselineService
- com.dianping.cat.consumer.advanced.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
@@ -730,10 +730,10 @@
com.dianping.cat.report.task.metric.MetricPointParser
- com.dianping.cat.consumer.advanced.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
com.dianping.cat.report.baseline.BaselineCreator
@@ -760,10 +760,10 @@
com.dianping.cat.report.task.metric.MetricPointParser
- com.dianping.cat.consumer.advanced.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
com.dianping.cat.report.baseline.BaselineService
@@ -971,7 +971,7 @@
com.dianping.cat.home.dal.abtest.AbtestReportDao
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
com.dianping.cat.system.page.abtest.service.ABTestService
@@ -1575,30 +1575,6 @@
/data/appdatas/cat/datasources.xml
-
- org.unidal.dal.jdbc.datasource.DataSource
- cat
- org.unidal.dal.jdbc.datasource.JdbcDataSource
-
- cat
- 3
- 1s
- 10m
- 1000
-
- com.mysql.jdbc.Driver
- jdbc:mysql://127.0.0.1:3306/cat
- root
- password
-
-
-
-
-
- org.unidal.dal.jdbc.datasource.JdbcDataSourceDescriptorManager
-
-
-
org.unidal.dal.jdbc.mapping.TableProvider
baseline
@@ -1865,30 +1841,6 @@
-
- org.unidal.dal.jdbc.datasource.DataSource
- user
- org.unidal.dal.jdbc.datasource.JdbcDataSource
-
- user
- 3
- 1s
- 10m
- 1000
-
- com.mysql.jdbc.Driver
- jdbc:mysql://192.168.8.44:3306/hawk
- hawk
- hawk
-
-
-
-
-
- org.unidal.dal.jdbc.datasource.JdbcDataSourceDescriptorManager
-
-
-
org.unidal.dal.jdbc.mapping.TableProvider
dp-admin-login
@@ -1949,7 +1901,7 @@
com.dianping.cat.home.dal.abtest.AbtestReportDao
- com.dianping.cat.consumer.advanced.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
@@ -2849,7 +2801,7 @@
com.dianping.cat.report.page.PayloadNormalizer
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
com.dianping.cat.report.page.metric.chart.GraphCreator
@@ -2866,8 +2818,8 @@
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
com.dianping.cat.core.config.ConfigDao
@@ -2891,16 +2843,16 @@
com.dianping.cat.report.page.metric.chart.CachedMetricReportService
- com.dianping.cat.consumer.advanced.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
- com.dianping.cat.consumer.advanced.MetricConfigManager
- com.dianping.cat.consumer.advanced.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
com.dianping.cat.core.config.ConfigDao
@@ -2938,7 +2890,7 @@
com.dianping.cat.report.page.dependency.graph.TopologyGraphManager
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
com.dianping.cat.report.page.dependency.ExternalInfoBuilder
@@ -2964,7 +2916,7 @@
com.dianping.cat.report.page.dependency.graph.TopologyGraphBuilder
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
com.dianping.cat.ServerConfigManager
@@ -3296,13 +3248,13 @@
com.dianping.cat.report.page.dependency.graph.TopologyGraphConfigManager
- com.dianping.cat.consumer.advanced.ProductLineConfigManager
+ com.dianping.cat.consumer.metric.ProductLineConfigManager
com.dianping.cat.consumer.problem.aggregation.AggregationConfigManager
- com.dianping.cat.consumer.advanced.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager
com.dianping.cat.system.config.ExceptionThresholdConfigManager
@@ -3441,7 +3393,7 @@
com.dianping.cat.home.dal.abtest.AbtestReportDao
- com.dianping.cat.consumer.advanced.MetricConfigManager
+ com.dianping.cat.consumer.metric.MetricConfigManager