diff --git a/apollo-adminservice/pom.xml b/apollo-adminservice/pom.xml
index cf278036b7d..53f8b4d5e50 100644
--- a/apollo-adminservice/pom.xml
+++ b/apollo-adminservice/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.3.0
+ 0.4.0-SNAPSHOT
../pom.xml
4.0.0
@@ -19,11 +19,6 @@
com.ctrip.framework.apollo
apollo-biz
-
- com.ctrip.framework.apollo
- apollo-buildtools
- test
-
org.springframework.cloud
@@ -108,11 +103,6 @@
github
-
-
- com.ctrip.framework.apollo
- apollo-buildtools
-
diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/AdminServiceHealthIndicator.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/AdminServiceHealthIndicator.java
index eb9a0c512cd..95f03ff3c3a 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/AdminServiceHealthIndicator.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/AdminServiceHealthIndicator.java
@@ -1,13 +1,13 @@
package com.ctrip.framework.apollo.adminservice;
+import com.ctrip.framework.apollo.biz.service.AppService;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;
-import com.ctrip.framework.apollo.biz.service.AppService;
-
@Component
public class AdminServiceHealthIndicator implements HealthIndicator {
diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppController.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppController.java
index 50b4d1fdd0e..0e0787cb76e 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppController.java
@@ -1,6 +1,14 @@
package com.ctrip.framework.apollo.adminservice.controller;
-import java.util.List;
+import com.ctrip.framework.apollo.biz.service.AdminService;
+import com.ctrip.framework.apollo.biz.service.AppService;
+import com.ctrip.framework.apollo.common.dto.AppDTO;
+import com.ctrip.framework.apollo.common.entity.App;
+import com.ctrip.framework.apollo.common.exception.BadRequestException;
+import com.ctrip.framework.apollo.common.exception.NotFoundException;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
+import com.ctrip.framework.apollo.common.utils.InputValidator;
+import com.ctrip.framework.apollo.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
@@ -11,15 +19,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import com.ctrip.framework.apollo.common.entity.App;
-import com.ctrip.framework.apollo.biz.service.AdminService;
-import com.ctrip.framework.apollo.biz.service.AppService;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
-import com.ctrip.framework.apollo.common.utils.InputValidator;
-import com.ctrip.framework.apollo.common.dto.AppDTO;
-import com.ctrip.framework.apollo.common.exception.BadRequestException;
-import com.ctrip.framework.apollo.common.exception.NotFoundException;
-import com.ctrip.framework.apollo.core.utils.StringUtils;
+import java.util.List;
@RestController
public class AppController {
diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceController.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceController.java
index 0e59c286855..d8d91d8a225 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceController.java
@@ -1,19 +1,19 @@
package com.ctrip.framework.apollo.adminservice.controller;
+import com.ctrip.framework.apollo.biz.service.AppNamespaceService;
+import com.ctrip.framework.apollo.common.dto.AppNamespaceDTO;
+import com.ctrip.framework.apollo.common.entity.AppNamespace;
+import com.ctrip.framework.apollo.common.exception.BadRequestException;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
+import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
+import com.ctrip.framework.apollo.core.utils.StringUtils;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
-import com.ctrip.framework.apollo.common.entity.AppNamespace;
-import com.ctrip.framework.apollo.biz.service.AppNamespaceService;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
-import com.ctrip.framework.apollo.common.dto.AppNamespaceDTO;
-import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
-import com.ctrip.framework.apollo.common.exception.BadRequestException;
-import com.ctrip.framework.apollo.core.utils.StringUtils;
-
@RestController
public class AppNamespaceController {
diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ClusterController.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ClusterController.java
index c0f4ff72e88..6325c6e43c6 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ClusterController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ClusterController.java
@@ -1,6 +1,12 @@
package com.ctrip.framework.apollo.adminservice.controller;
-import java.util.List;
+import com.ctrip.framework.apollo.biz.entity.Cluster;
+import com.ctrip.framework.apollo.biz.service.ClusterService;
+import com.ctrip.framework.apollo.common.dto.ClusterDTO;
+import com.ctrip.framework.apollo.common.exception.BadRequestException;
+import com.ctrip.framework.apollo.common.exception.NotFoundException;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
+import com.ctrip.framework.apollo.common.utils.InputValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
@@ -10,13 +16,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import com.ctrip.framework.apollo.biz.entity.Cluster;
-import com.ctrip.framework.apollo.biz.service.ClusterService;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
-import com.ctrip.framework.apollo.common.utils.InputValidator;
-import com.ctrip.framework.apollo.common.dto.ClusterDTO;
-import com.ctrip.framework.apollo.common.exception.BadRequestException;
-import com.ctrip.framework.apollo.common.exception.NotFoundException;
+import java.util.List;
@RestController
public class ClusterController {
diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/CommitController.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/CommitController.java
index e4c290a78d2..58a3314bb94 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/CommitController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/CommitController.java
@@ -2,8 +2,8 @@
import com.ctrip.framework.apollo.biz.entity.Commit;
import com.ctrip.framework.apollo.biz.service.CommitService;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.common.dto.CommitDTO;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java
index ad61abb7c00..d74e778b48e 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemController.java
@@ -1,15 +1,5 @@
package com.ctrip.framework.apollo.adminservice.controller;
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
import com.ctrip.framework.apollo.adminservice.aop.PreAcquireNamespaceLock;
import com.ctrip.framework.apollo.biz.entity.Commit;
import com.ctrip.framework.apollo.biz.entity.Item;
@@ -18,10 +8,20 @@
import com.ctrip.framework.apollo.biz.service.ItemService;
import com.ctrip.framework.apollo.biz.service.NamespaceService;
import com.ctrip.framework.apollo.biz.utils.ConfigChangeContentBuilder;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.common.dto.ItemDTO;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.common.exception.NotFoundException;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
@RestController
public class ItemController {
diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetController.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetController.java
index 43ca40a9211..a2a6585f836 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetController.java
@@ -1,5 +1,9 @@
package com.ctrip.framework.apollo.adminservice.controller;
+import com.ctrip.framework.apollo.adminservice.aop.PreAcquireNamespaceLock;
+import com.ctrip.framework.apollo.biz.service.ItemSetService;
+import com.ctrip.framework.apollo.common.dto.ItemChangeSets;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -9,10 +13,6 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
-import com.ctrip.framework.apollo.adminservice.aop.PreAcquireNamespaceLock;
-import com.ctrip.framework.apollo.biz.service.ItemSetService;
-import com.ctrip.framework.apollo.common.dto.ItemChangeSets;
-
@RestController
public class ItemSetController {
diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceController.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceController.java
index 3debe702117..e7d56490dbb 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceController.java
@@ -1,6 +1,12 @@
package com.ctrip.framework.apollo.adminservice.controller;
-import java.util.List;
+import com.ctrip.framework.apollo.biz.entity.Namespace;
+import com.ctrip.framework.apollo.biz.service.NamespaceService;
+import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
+import com.ctrip.framework.apollo.common.exception.BadRequestException;
+import com.ctrip.framework.apollo.common.exception.NotFoundException;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
+import com.ctrip.framework.apollo.common.utils.InputValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
@@ -10,13 +16,7 @@
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
-import com.ctrip.framework.apollo.biz.entity.Namespace;
-import com.ctrip.framework.apollo.biz.service.NamespaceService;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
-import com.ctrip.framework.apollo.common.utils.InputValidator;
-import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
-import com.ctrip.framework.apollo.common.exception.BadRequestException;
-import com.ctrip.framework.apollo.common.exception.NotFoundException;
+import java.util.List;
@RestController
public class NamespaceController {
diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceLockController.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceLockController.java
index 15543a6b614..40101dd131a 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceLockController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceLockController.java
@@ -5,9 +5,9 @@
import com.ctrip.framework.apollo.biz.service.NamespaceLockService;
import com.ctrip.framework.apollo.biz.service.NamespaceService;
import com.ctrip.framework.apollo.biz.utils.ApolloSwitcher;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.common.dto.NamespaceLockDTO;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseController.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseController.java
index 6e14a768b87..3bb32498b24 100644
--- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseController.java
+++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseController.java
@@ -13,9 +13,9 @@
import com.ctrip.framework.apollo.biz.utils.ReleaseMessageKeyGenerator;
import com.ctrip.framework.apollo.common.constants.NamespaceBranchStatus;
import com.ctrip.framework.apollo.common.dto.ItemChangeSets;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
import com.ctrip.framework.apollo.common.exception.NotFoundException;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
diff --git a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/AdminServiceTestConfiguration.java b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/AdminServiceTestConfiguration.java
index 40e47407cf3..ad36730a67b 100644
--- a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/AdminServiceTestConfiguration.java
+++ b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/AdminServiceTestConfiguration.java
@@ -1,5 +1,6 @@
package com.ctrip.framework.apollo;
+import com.ctrip.framework.apollo.adminservice.AdminServiceApplication;
import com.ctrip.framework.apollo.common.controller.HttpMessageConverterConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
@@ -8,8 +9,6 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;
-import com.ctrip.framework.apollo.adminservice.AdminServiceApplication;
-
@Configuration
@ComponentScan(excludeFilters = {@Filter(type = FilterType.ASSIGNABLE_TYPE, value = {
LocalAdminServiceApplication.class, AdminServiceApplication.class,
diff --git a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AbstractControllerTest.java b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AbstractControllerTest.java
index bb9a832a41a..92effe44b95 100644
--- a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AbstractControllerTest.java
+++ b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AbstractControllerTest.java
@@ -1,6 +1,6 @@
package com.ctrip.framework.apollo.adminservice.controller;
-import javax.annotation.PostConstruct;
+import com.ctrip.framework.apollo.AdminServiceTestConfiguration;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -13,7 +13,7 @@
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.RestTemplate;
-import com.ctrip.framework.apollo.AdminServiceTestConfiguration;
+import javax.annotation.PostConstruct;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = AdminServiceTestConfiguration.class)
diff --git a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppControllerTest.java b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppControllerTest.java
index fd8e47f1fa6..04aba413676 100644
--- a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppControllerTest.java
+++ b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppControllerTest.java
@@ -1,5 +1,10 @@
package com.ctrip.framework.apollo.adminservice.controller;
+import com.ctrip.framework.apollo.biz.repository.AppRepository;
+import com.ctrip.framework.apollo.common.dto.AppDTO;
+import com.ctrip.framework.apollo.common.entity.App;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
+
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -9,11 +14,6 @@
import org.springframework.test.context.jdbc.Sql.ExecutionPhase;
import org.springframework.web.client.HttpClientErrorException;
-import com.ctrip.framework.apollo.common.entity.App;
-import com.ctrip.framework.apollo.biz.repository.AppRepository;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
-import com.ctrip.framework.apollo.common.dto.AppDTO;
-
public class AppControllerTest extends AbstractControllerTest {
@Autowired
diff --git a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceControllerTest.java b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceControllerTest.java
index 5395b5ccfbc..554a6f6a81c 100644
--- a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceControllerTest.java
+++ b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/AppNamespaceControllerTest.java
@@ -1,8 +1,8 @@
package com.ctrip.framework.apollo.adminservice.controller;
-import com.ctrip.framework.apollo.common.entity.AppNamespace;
import com.ctrip.framework.apollo.biz.repository.AppNamespaceRepository;
import com.ctrip.framework.apollo.common.dto.AppNamespaceDTO;
+import com.ctrip.framework.apollo.common.entity.AppNamespace;
import org.junit.Assert;
import org.junit.Test;
diff --git a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerExceptionTest.java b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerExceptionTest.java
index 81f0421f998..27b420ed33f 100644
--- a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerExceptionTest.java
+++ b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerExceptionTest.java
@@ -1,10 +1,11 @@
package com.ctrip.framework.apollo.adminservice.controller;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import java.util.ArrayList;
-import java.util.List;
+import com.ctrip.framework.apollo.biz.service.AdminService;
+import com.ctrip.framework.apollo.biz.service.AppService;
+import com.ctrip.framework.apollo.common.dto.AppDTO;
+import com.ctrip.framework.apollo.common.entity.App;
+import com.ctrip.framework.apollo.common.exception.NotFoundException;
+import com.ctrip.framework.apollo.common.exception.ServiceException;
import org.junit.Assert;
import org.junit.Before;
@@ -16,12 +17,11 @@
import org.springframework.data.domain.Pageable;
import org.springframework.test.util.ReflectionTestUtils;
-import com.ctrip.framework.apollo.common.entity.App;
-import com.ctrip.framework.apollo.biz.service.AdminService;
-import com.ctrip.framework.apollo.biz.service.AppService;
-import com.ctrip.framework.apollo.common.dto.AppDTO;
-import com.ctrip.framework.apollo.common.exception.NotFoundException;
-import com.ctrip.framework.apollo.common.exception.ServiceException;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class ControllerExceptionTest {
diff --git a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerIntegrationExceptionTest.java b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerIntegrationExceptionTest.java
index 0059195a6a0..c1f41e72b0e 100644
--- a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerIntegrationExceptionTest.java
+++ b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ControllerIntegrationExceptionTest.java
@@ -1,9 +1,11 @@
package com.ctrip.framework.apollo.adminservice.controller;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
+import com.google.gson.Gson;
-import java.util.Map;
+import com.ctrip.framework.apollo.biz.service.AdminService;
+import com.ctrip.framework.apollo.biz.service.AppService;
+import com.ctrip.framework.apollo.common.dto.AppDTO;
+import com.ctrip.framework.apollo.common.entity.App;
import org.junit.Assert;
import org.junit.Before;
@@ -16,12 +18,10 @@
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.client.HttpStatusCodeException;
-import com.ctrip.framework.apollo.common.entity.App;
-import com.ctrip.framework.apollo.biz.service.AdminService;
-import com.ctrip.framework.apollo.biz.service.AppService;
-import com.ctrip.framework.apollo.common.dto.AppDTO;
+import java.util.Map;
-import com.google.gson.Gson;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.when;
public class ControllerIntegrationExceptionTest extends AbstractControllerTest {
diff --git a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetControllerTest.java b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetControllerTest.java
index de64af868e7..de2a1c17102 100644
--- a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetControllerTest.java
+++ b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ItemSetControllerTest.java
@@ -1,6 +1,12 @@
package com.ctrip.framework.apollo.adminservice.controller;
-import java.util.List;
+import com.ctrip.framework.apollo.biz.entity.Item;
+import com.ctrip.framework.apollo.biz.repository.ItemRepository;
+import com.ctrip.framework.apollo.common.dto.AppDTO;
+import com.ctrip.framework.apollo.common.dto.ClusterDTO;
+import com.ctrip.framework.apollo.common.dto.ItemChangeSets;
+import com.ctrip.framework.apollo.common.dto.ItemDTO;
+import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
import org.junit.Assert;
import org.junit.Test;
@@ -12,13 +18,7 @@
import org.springframework.test.context.jdbc.Sql.ExecutionPhase;
import org.springframework.web.client.RestTemplate;
-import com.ctrip.framework.apollo.biz.entity.Item;
-import com.ctrip.framework.apollo.biz.repository.ItemRepository;
-import com.ctrip.framework.apollo.common.dto.AppDTO;
-import com.ctrip.framework.apollo.common.dto.ClusterDTO;
-import com.ctrip.framework.apollo.common.dto.ItemChangeSets;
-import com.ctrip.framework.apollo.common.dto.ItemDTO;
-import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
+import java.util.List;
public class ItemSetControllerTest extends AbstractControllerTest {
diff --git a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseControllerTest.java b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseControllerTest.java
index d43b798fbf2..636392bb60e 100644
--- a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseControllerTest.java
+++ b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/controller/ReleaseControllerTest.java
@@ -9,12 +9,12 @@
import com.ctrip.framework.apollo.biz.repository.ReleaseRepository;
import com.ctrip.framework.apollo.biz.service.NamespaceService;
import com.ctrip.framework.apollo.biz.service.ReleaseService;
-import com.ctrip.framework.apollo.core.ConfigConsts;
import com.ctrip.framework.apollo.common.dto.AppDTO;
import com.ctrip.framework.apollo.common.dto.ClusterDTO;
import com.ctrip.framework.apollo.common.dto.ItemDTO;
import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
+import com.ctrip.framework.apollo.core.ConfigConsts;
import org.junit.Assert;
import org.junit.Test;
diff --git a/apollo-adminservice/src/test/resources/META-INF/plexus/plexus.xml b/apollo-adminservice/src/test/resources/META-INF/plexus/plexus.xml
deleted file mode 100644
index b4530cd3da3..00000000000
--- a/apollo-adminservice/src/test/resources/META-INF/plexus/plexus.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
- com.dianping.cat.configuration.ClientConfigManager
- com.ctrip.framework.apollo.cat.NullClientConfigManager
-
-
-
- com.dianping.cat.message.io.TransportManager
- com.ctrip.framework.apollo.cat.NullTransportManager
-
-
-
- com.dianping.cat.message.spi.MessageManager
- com.ctrip.framework.apollo.cat.NullMessageManager
-
-
-
- com.dianping.cat.message.internal.MessageIdFactory
-
-
-
-
- com.dianping.cat.message.MessageProducer
- com.ctrip.framework.apollo.cat.NullMessageProducer
-
-
-
- com.dianping.cat.message.spi.MessageManager
-
-
- com.dianping.cat.message.internal.MessageIdFactory
-
-
-
-
- org.codehaus.plexus.logging.LoggerManager
- com.ctrip.framework.apollo.cat.NullLoggerManager
-
-
-
-
diff --git a/apollo-assembly/pom.xml b/apollo-assembly/pom.xml
index c8a0c682192..75bb33a6b8e 100644
--- a/apollo-assembly/pom.xml
+++ b/apollo-assembly/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.3.0
+ 0.4.0-SNAPSHOT
../pom.xml
4.0.0
@@ -27,11 +27,6 @@
com.ctrip.framework.apollo
apollo-portal
-
-
- com.ctrip.framework.apollo
- apollo-buildtools
-
com.h2database
h2
diff --git a/apollo-assembly/src/main/java/com/ctrip/framework/apollo/assembly/ApolloApplication.java b/apollo-assembly/src/main/java/com/ctrip/framework/apollo/assembly/ApolloApplication.java
index 3a8a8053ca6..9b82003bb23 100644
--- a/apollo-assembly/src/main/java/com/ctrip/framework/apollo/assembly/ApolloApplication.java
+++ b/apollo-assembly/src/main/java/com/ctrip/framework/apollo/assembly/ApolloApplication.java
@@ -1,5 +1,9 @@
package com.ctrip.framework.apollo.assembly;
+import com.ctrip.framework.apollo.adminservice.AdminServiceApplication;
+import com.ctrip.framework.apollo.configservice.ConfigServiceApplication;
+import com.ctrip.framework.apollo.portal.PortalApplication;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.actuate.system.ApplicationPidFileWriter;
@@ -10,10 +14,6 @@
import org.springframework.cloud.context.scope.refresh.RefreshScope;
import org.springframework.context.ConfigurableApplicationContext;
-import com.ctrip.framework.apollo.portal.PortalApplication;
-import com.ctrip.framework.apollo.adminservice.AdminServiceApplication;
-import com.ctrip.framework.apollo.configservice.ConfigServiceApplication;
-
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,
HibernateJpaAutoConfiguration.class})
public class ApolloApplication {
diff --git a/apollo-assembly/src/main/resources/META-INF/plexus/plexus.xml b/apollo-assembly/src/main/resources/META-INF/plexus/plexus.xml
deleted file mode 100644
index b4530cd3da3..00000000000
--- a/apollo-assembly/src/main/resources/META-INF/plexus/plexus.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
- com.dianping.cat.configuration.ClientConfigManager
- com.ctrip.framework.apollo.cat.NullClientConfigManager
-
-
-
- com.dianping.cat.message.io.TransportManager
- com.ctrip.framework.apollo.cat.NullTransportManager
-
-
-
- com.dianping.cat.message.spi.MessageManager
- com.ctrip.framework.apollo.cat.NullMessageManager
-
-
-
- com.dianping.cat.message.internal.MessageIdFactory
-
-
-
-
- com.dianping.cat.message.MessageProducer
- com.ctrip.framework.apollo.cat.NullMessageProducer
-
-
-
- com.dianping.cat.message.spi.MessageManager
-
-
- com.dianping.cat.message.internal.MessageIdFactory
-
-
-
-
- org.codehaus.plexus.logging.LoggerManager
- com.ctrip.framework.apollo.cat.NullLoggerManager
-
-
-
-
diff --git a/apollo-assembly/src/test/java/com/ctrip/framework/apollo/assembly/LocalApolloApplication.java b/apollo-assembly/src/test/java/com/ctrip/framework/apollo/assembly/LocalApolloApplication.java
index 7a9d9554c6a..1bb1777be0a 100644
--- a/apollo-assembly/src/test/java/com/ctrip/framework/apollo/assembly/LocalApolloApplication.java
+++ b/apollo-assembly/src/test/java/com/ctrip/framework/apollo/assembly/LocalApolloApplication.java
@@ -1,5 +1,9 @@
package com.ctrip.framework.apollo.assembly;
+import com.ctrip.framework.apollo.adminservice.AdminServiceApplication;
+import com.ctrip.framework.apollo.configservice.ConfigServiceApplication;
+import com.ctrip.framework.apollo.portal.PortalApplication;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.actuate.system.ApplicationPidFileWriter;
@@ -10,10 +14,6 @@
import org.springframework.cloud.context.scope.refresh.RefreshScope;
import org.springframework.context.ConfigurableApplicationContext;
-import com.ctrip.framework.apollo.adminservice.AdminServiceApplication;
-import com.ctrip.framework.apollo.configservice.ConfigServiceApplication;
-import com.ctrip.framework.apollo.portal.PortalApplication;
-
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,
HibernateJpaAutoConfiguration.class})
public class LocalApolloApplication {
diff --git a/apollo-biz/pom.xml b/apollo-biz/pom.xml
index e937fc3b042..272ef85bca5 100644
--- a/apollo-biz/pom.xml
+++ b/apollo-biz/pom.xml
@@ -4,7 +4,7 @@
apollo
com.ctrip.framework.apollo
- 0.3.0
+ 0.4.0-SNAPSHOT
4.0.0
apollo-biz
@@ -24,11 +24,6 @@
spring-cloud-starter-eureka
-
- com.ctrip.framework.apollo
- apollo-buildtools
- test
-
com.h2database
h2
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Audit.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Audit.java
index 0b1c17edcce..3466d58ef3f 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Audit.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Audit.java
@@ -2,13 +2,13 @@
import com.ctrip.framework.apollo.common.entity.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.Where;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import org.hibernate.annotations.SQLDelete;
-import org.hibernate.annotations.Where;
-
@Entity
@Table(name = "Audit")
@SQLDelete(sql = "Update Audit set isDeleted = 1 where id = ?")
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Cluster.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Cluster.java
index 2d79f8afd4b..3051ed3dec5 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Cluster.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Cluster.java
@@ -2,13 +2,13 @@
import com.ctrip.framework.apollo.common.entity.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.Where;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import org.hibernate.annotations.SQLDelete;
-import org.hibernate.annotations.Where;
-
/**
* @author Jason Song(song_s@ctrip.com)
*/
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/GrayReleaseRule.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/GrayReleaseRule.java
index 390bc93b605..bb1a106d1c9 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/GrayReleaseRule.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/GrayReleaseRule.java
@@ -2,7 +2,6 @@
import com.ctrip.framework.apollo.common.entity.BaseEntity;
-
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Item.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Item.java
index f5bf8b27596..cbf7d0f0c25 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Item.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Item.java
@@ -2,14 +2,14 @@
import com.ctrip.framework.apollo.common.entity.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.Where;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.Table;
-import org.hibernate.annotations.SQLDelete;
-import org.hibernate.annotations.Where;
-
@Entity
@Table(name = "Item")
@SQLDelete(sql = "Update Item set isDeleted = 1 where id = ?")
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Namespace.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Namespace.java
index c8f36ffd7e5..08625ec9a1c 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Namespace.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Namespace.java
@@ -2,13 +2,13 @@
import com.ctrip.framework.apollo.common.entity.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.Where;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import org.hibernate.annotations.SQLDelete;
-import org.hibernate.annotations.Where;
-
@Entity
@Table(name = "Namespace")
@SQLDelete(sql = "Update Namespace set isDeleted = 1 where id = ?")
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Privilege.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Privilege.java
index c9669f50bea..eaffe5064e2 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Privilege.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Privilege.java
@@ -2,13 +2,13 @@
import com.ctrip.framework.apollo.common.entity.BaseEntity;
+import org.hibernate.annotations.SQLDelete;
+import org.hibernate.annotations.Where;
+
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
-import org.hibernate.annotations.SQLDelete;
-import org.hibernate.annotations.Where;
-
@Entity
@Table(name = "Privilege")
@SQLDelete(sql = "Update Privilege set isDeleted = 1 where id = ?")
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/grayReleaseRule/GrayReleaseRulesHolder.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/grayReleaseRule/GrayReleaseRulesHolder.java
index 5da6c03f5ed..7f78ad8d845 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/grayReleaseRule/GrayReleaseRulesHolder.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/grayReleaseRule/GrayReleaseRulesHolder.java
@@ -20,9 +20,8 @@
import com.ctrip.framework.apollo.common.utils.GrayReleaseRuleItemTransformer;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory;
-import com.dianping.cat.Cat;
-import com.dianping.cat.message.Message;
-import com.dianping.cat.message.Transaction;
+import com.ctrip.framework.apollo.tracer.Tracer;
+import com.ctrip.framework.apollo.tracer.spi.Transaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -102,12 +101,12 @@ public void handleMessage(ReleaseMessage message, String channel) {
}
private void periodicScanRules() {
- Transaction transaction = Cat.newTransaction("Apollo.GrayReleaseRulesScanner",
+ Transaction transaction = Tracer.newTransaction("Apollo.GrayReleaseRulesScanner",
"scanGrayReleaseRules");
try {
loadVersion.incrementAndGet();
scanGrayReleaseRules();
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
transaction.setStatus(ex);
logger.error("Scan gray release rule failed", ex);
@@ -238,7 +237,7 @@ private GrayReleaseRuleCache transformRuleToRuleCache(GrayReleaseRule grayReleas
ruleItems = GrayReleaseRuleItemTransformer.batchTransformFromJSON(grayReleaseRule.getRules());
} catch (Throwable ex) {
ruleItems = Sets.newHashSet();
- Cat.logError(ex);
+ Tracer.logError(ex);
logger.error("parse rule for gray release rule {} failed", grayReleaseRule.getId(), ex);
}
@@ -257,7 +256,7 @@ private void populateDataBaseInterval() {
databaseScanInterval = Integer.parseInt(interval);
}
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
logger.error("Load apollo gray release rule scan interval from server config failed", ex);
}
}
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/message/DatabaseMessageSender.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/message/DatabaseMessageSender.java
index 758ee48336c..9590773e90c 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/message/DatabaseMessageSender.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/message/DatabaseMessageSender.java
@@ -2,9 +2,8 @@
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository;
-import com.dianping.cat.Cat;
-import com.dianping.cat.message.Message;
-import com.dianping.cat.message.Transaction;
+import com.ctrip.framework.apollo.tracer.Tracer;
+import com.ctrip.framework.apollo.tracer.spi.Transaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -31,11 +30,11 @@ public void sendMessage(String message, String channel) {
return;
}
- Cat.logEvent("Apollo.AdminService.ReleaseMessage", message);
- Transaction transaction = Cat.newTransaction("Apollo.AdminService", "sendMessage");
+ Tracer.logEvent("Apollo.AdminService.ReleaseMessage", message);
+ Transaction transaction = Tracer.newTransaction("Apollo.AdminService", "sendMessage");
try {
releaseMessageRepository.save(new ReleaseMessage(message));
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
logger.error("Sending message to database failed", ex);
transaction.setStatus(ex);
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/message/ReleaseMessageScanner.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/message/ReleaseMessageScanner.java
index 39fea52b5a0..3c501609dfb 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/message/ReleaseMessageScanner.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/message/ReleaseMessageScanner.java
@@ -5,9 +5,8 @@
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository;
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory;
-import com.dianping.cat.Cat;
-import com.dianping.cat.message.Message;
-import com.dianping.cat.message.Transaction;
+import com.ctrip.framework.apollo.tracer.Tracer;
+import com.ctrip.framework.apollo.tracer.spi.Transaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -48,10 +47,10 @@ public void afterPropertiesSet() throws Exception {
populateDataBaseInterval();
maxIdScanned = loadLargestMessageId();
executorService.scheduleWithFixedDelay((Runnable) () -> {
- Transaction transaction = Cat.newTransaction("Apollo.ReleaseMessageScanner", "scanMessage");
+ Transaction transaction = Tracer.newTransaction("Apollo.ReleaseMessageScanner", "scanMessage");
try {
scanMessages();
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
transaction.setStatus(ex);
logger.error("Scan and send message failed", ex);
@@ -119,7 +118,7 @@ private void fireMessageScanned(List messages) {
try {
listener.handleMessage(message, Topics.APOLLO_RELEASE_TOPIC);
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
logger.error("Failed to invoke message listener {}", listener.getClass(), ex);
}
}
@@ -134,7 +133,7 @@ private void populateDataBaseInterval() {
databaseScanInterval = Integer.parseInt(interval);
}
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
logger.error("Load apollo message scan interval from system property failed", ex);
}
}
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppNamespaceRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppNamespaceRepository.java
index 18f376f1388..5c658f2b6a2 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppNamespaceRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppNamespaceRepository.java
@@ -1,9 +1,9 @@
package com.ctrip.framework.apollo.biz.repository;
-import org.springframework.data.repository.PagingAndSortingRepository;
-
import com.ctrip.framework.apollo.common.entity.AppNamespace;
+import org.springframework.data.repository.PagingAndSortingRepository;
+
import java.util.List;
import java.util.Set;
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppRepository.java
index 482e685cfe5..f665307d514 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppRepository.java
@@ -1,12 +1,12 @@
package com.ctrip.framework.apollo.biz.repository;
-import java.util.List;
+import com.ctrip.framework.apollo.common.entity.App;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
-import com.ctrip.framework.apollo.common.entity.App;
+import java.util.List;
public interface AppRepository extends PagingAndSortingRepository {
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AuditRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AuditRepository.java
index e7782531269..c1a1413bc6f 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AuditRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AuditRepository.java
@@ -1,12 +1,12 @@
package com.ctrip.framework.apollo.biz.repository;
-import java.util.List;
+import com.ctrip.framework.apollo.biz.entity.Audit;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
-import com.ctrip.framework.apollo.biz.entity.Audit;
+import java.util.List;
public interface AuditRepository extends PagingAndSortingRepository {
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/GrayReleaseRuleRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/GrayReleaseRuleRepository.java
index 2af184ab564..0eb39de0f56 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/GrayReleaseRuleRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/GrayReleaseRuleRepository.java
@@ -1,6 +1,6 @@
package com.ctrip.framework.apollo.biz.repository;
+
import com.ctrip.framework.apollo.biz.entity.GrayReleaseRule;
-import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import org.springframework.data.repository.PagingAndSortingRepository;
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java
index 928095f647d..827839dd93b 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java
@@ -1,12 +1,12 @@
package com.ctrip.framework.apollo.biz.repository;
-import java.util.List;
+import com.ctrip.framework.apollo.biz.entity.Item;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-import com.ctrip.framework.apollo.biz.entity.Item;
+import java.util.List;
public interface ItemRepository extends PagingAndSortingRepository- {
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/NamespaceRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/NamespaceRepository.java
index e4f02567cf2..63c579717a8 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/NamespaceRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/NamespaceRepository.java
@@ -1,12 +1,12 @@
package com.ctrip.framework.apollo.biz.repository;
-import java.util.List;
+import com.ctrip.framework.apollo.biz.entity.Namespace;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
-import com.ctrip.framework.apollo.biz.entity.Namespace;
+import java.util.List;
public interface NamespaceRepository extends PagingAndSortingRepository {
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/PrivilegeRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/PrivilegeRepository.java
index a0f373488c8..5d2c9873334 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/PrivilegeRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/PrivilegeRepository.java
@@ -1,9 +1,9 @@
package com.ctrip.framework.apollo.biz.repository;
-import org.springframework.data.repository.PagingAndSortingRepository;
-
import com.ctrip.framework.apollo.biz.entity.Privilege;
+import org.springframework.data.repository.PagingAndSortingRepository;
+
import java.util.List;
public interface PrivilegeRepository extends PagingAndSortingRepository {
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseRepository.java
index 61d03eabd97..ceb9827aaaf 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseRepository.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseRepository.java
@@ -1,7 +1,6 @@
package com.ctrip.framework.apollo.biz.repository;
-import java.util.List;
-import java.util.Set;
+import com.ctrip.framework.apollo.biz.entity.Release;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Modifying;
@@ -9,7 +8,8 @@
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
-import com.ctrip.framework.apollo.biz.entity.Release;
+import java.util.List;
+import java.util.Set;
/**
* @author Jason Song(song_s@ctrip.com)
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AdminService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AdminService.java
index acd6a74360c..64796a6e615 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AdminService.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AdminService.java
@@ -1,12 +1,12 @@
package com.ctrip.framework.apollo.biz.service;
+import com.ctrip.framework.apollo.common.entity.App;
+import com.ctrip.framework.apollo.core.ConfigConsts;
+
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import com.ctrip.framework.apollo.common.entity.App;
-import com.ctrip.framework.apollo.core.ConfigConsts;
-
@Service
public class AdminService {
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppNamespaceService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppNamespaceService.java
index 2724a70a03e..0c50ffa47bb 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppNamespaceService.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppNamespaceService.java
@@ -8,10 +8,10 @@
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.biz.repository.AppNamespaceRepository;
import com.ctrip.framework.apollo.common.entity.AppNamespace;
+import com.ctrip.framework.apollo.common.exception.ServiceException;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
-import com.ctrip.framework.apollo.common.exception.ServiceException;
import com.ctrip.framework.apollo.core.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppService.java
index ad1b4760f84..eb0f57b8a1c 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppService.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AppService.java
@@ -1,7 +1,10 @@
package com.ctrip.framework.apollo.biz.service;
-import java.util.List;
-import java.util.Objects;
+import com.ctrip.framework.apollo.biz.entity.Audit;
+import com.ctrip.framework.apollo.biz.repository.AppRepository;
+import com.ctrip.framework.apollo.common.entity.App;
+import com.ctrip.framework.apollo.common.exception.ServiceException;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@@ -9,11 +12,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import com.ctrip.framework.apollo.common.entity.App;
-import com.ctrip.framework.apollo.biz.entity.Audit;
-import com.ctrip.framework.apollo.biz.repository.AppRepository;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
-import com.ctrip.framework.apollo.common.exception.ServiceException;
+import java.util.List;
+import java.util.Objects;
@Service
public class AppService {
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AuditService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AuditService.java
index 3d7cabc87a1..57896324fa9 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AuditService.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/AuditService.java
@@ -1,13 +1,13 @@
package com.ctrip.framework.apollo.biz.service;
-import java.util.List;
+import com.ctrip.framework.apollo.biz.entity.Audit;
+import com.ctrip.framework.apollo.biz.repository.AuditRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import com.ctrip.framework.apollo.biz.entity.Audit;
-import com.ctrip.framework.apollo.biz.repository.AuditRepository;
+import java.util.List;
@Service
public class AuditService {
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ClusterService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ClusterService.java
index 5c8ab93132a..d1b9179b84a 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ClusterService.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ClusterService.java
@@ -1,22 +1,22 @@
package com.ctrip.framework.apollo.biz.service;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
+import com.google.common.base.Strings;
import com.ctrip.framework.apollo.biz.entity.Audit;
import com.ctrip.framework.apollo.biz.entity.Cluster;
import com.ctrip.framework.apollo.biz.repository.ClusterRepository;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
+import com.ctrip.framework.apollo.common.exception.ServiceException;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.core.ConfigConsts;
-import com.ctrip.framework.apollo.common.exception.ServiceException;
-import com.google.common.base.Strings;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
@Service
public class ClusterService {
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/InstanceService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/InstanceService.java
index efcb88af1b7..6b30b9a0dc4 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/InstanceService.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/InstanceService.java
@@ -1,7 +1,6 @@
package com.ctrip.framework.apollo.biz.service;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Interner;
import com.google.common.collect.Lists;
import com.ctrip.framework.apollo.biz.entity.Instance;
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java
index 3ef68185b1f..e3a8e9d839a 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemService.java
@@ -8,14 +8,13 @@
import com.ctrip.framework.apollo.biz.entity.Item;
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.biz.repository.ItemRepository;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.common.exception.NotFoundException;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory;
import com.ctrip.framework.apollo.core.utils.StringUtils;
-import com.dianping.cat.Cat;
-import com.dianping.cat.message.Message;
-import com.dianping.cat.message.Transaction;
+import com.ctrip.framework.apollo.tracer.Tracer;
+import com.ctrip.framework.apollo.tracer.spi.Transaction;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
@@ -74,10 +73,10 @@ public ItemService() {
@Override
public void afterPropertiesSet() throws Exception {
executorService.scheduleWithFixedDelay(() -> {
- Transaction transaction = Cat.newTransaction("Apollo.ItemServiceLimitUpdater", "updateLimit");
+ Transaction transaction = Tracer.newTransaction("Apollo.ItemServiceLimitUpdater", "updateLimit");
try {
updateLimits();
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
transaction.setStatus(ex);
} finally {
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemSetService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemSetService.java
index 629ef8c0e11..ce0b2d4a02b 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemSetService.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ItemSetService.java
@@ -1,19 +1,19 @@
package com.ctrip.framework.apollo.biz.service;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
import com.ctrip.framework.apollo.biz.entity.Audit;
import com.ctrip.framework.apollo.biz.entity.Commit;
import com.ctrip.framework.apollo.biz.entity.Item;
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.biz.utils.ConfigChangeContentBuilder;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.common.dto.ItemChangeSets;
import com.ctrip.framework.apollo.common.dto.ItemDTO;
import com.ctrip.framework.apollo.common.exception.NotFoundException;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
@Service
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/NamespaceService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/NamespaceService.java
index 162b425deaf..01bed607e6b 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/NamespaceService.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/NamespaceService.java
@@ -1,24 +1,24 @@
package com.ctrip.framework.apollo.biz.service;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
import com.ctrip.framework.apollo.biz.entity.Audit;
import com.ctrip.framework.apollo.biz.entity.Cluster;
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.biz.repository.NamespaceRepository;
import com.ctrip.framework.apollo.common.constants.NamespaceBranchStatus;
import com.ctrip.framework.apollo.common.entity.AppNamespace;
-import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.common.exception.ServiceException;
+import com.ctrip.framework.apollo.common.utils.BeanUtils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
@Service
public class NamespaceService {
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseMessageService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseMessageService.java
index e9e4288b0cb..2004313d56f 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseMessageService.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseMessageService.java
@@ -4,7 +4,7 @@
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository;
-import com.dianping.cat.Cat;
+import com.ctrip.framework.apollo.tracer.Tracer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -13,7 +13,6 @@
import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import java.util.Map;
/**
* @author Jason Song(song_s@ctrip.com)
@@ -43,7 +42,7 @@ public List findLatestReleaseMessagesGroupByMessages(Collection<
releaseMessage.setId((Long) o[1]);
releaseMessages.add(releaseMessage);
} catch (Exception ex) {
- Cat.logError("Parsing LatestReleaseMessagesGroupByMessages failed", ex);
+ Tracer.logError("Parsing LatestReleaseMessagesGroupByMessages failed", ex);
}
}
return releaseMessages;
diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/utils/ConfigChangeContentBuilder.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/utils/ConfigChangeContentBuilder.java
index 5080dfd091f..0a7125601f2 100644
--- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/utils/ConfigChangeContentBuilder.java
+++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/utils/ConfigChangeContentBuilder.java
@@ -6,7 +6,6 @@
import com.ctrip.framework.apollo.biz.entity.Item;
import com.ctrip.framework.apollo.core.utils.StringUtils;
-import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
diff --git a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/repository/AppRepositoryTest.java b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/repository/AppRepositoryTest.java
index b2e550dc316..6d4495e44d4 100644
--- a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/repository/AppRepositoryTest.java
+++ b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/repository/AppRepositoryTest.java
@@ -1,12 +1,12 @@
package com.ctrip.framework.apollo.biz.repository;
+import com.ctrip.framework.apollo.biz.AbstractIntegrationTest;
+import com.ctrip.framework.apollo.common.entity.App;
+
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import com.ctrip.framework.apollo.biz.AbstractIntegrationTest;
-import com.ctrip.framework.apollo.common.entity.App;
-
public class AppRepositoryTest extends AbstractIntegrationTest{
@Autowired
diff --git a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AdminServiceTest.java b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AdminServiceTest.java
index 50afbc831cb..f7b6cd4d4fa 100644
--- a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AdminServiceTest.java
+++ b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AdminServiceTest.java
@@ -1,20 +1,20 @@
package com.ctrip.framework.apollo.biz.service;
-import java.util.Date;
-import java.util.List;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
-
import com.ctrip.framework.apollo.biz.AbstractIntegrationTest;
-import com.ctrip.framework.apollo.common.entity.App;
import com.ctrip.framework.apollo.biz.entity.Audit;
import com.ctrip.framework.apollo.biz.entity.Cluster;
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.biz.repository.AppRepository;
-import com.ctrip.framework.apollo.core.ConfigConsts;
+import com.ctrip.framework.apollo.common.entity.App;
import com.ctrip.framework.apollo.common.exception.ServiceException;
+import com.ctrip.framework.apollo.core.ConfigConsts;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Date;
+import java.util.List;
public class AdminServiceTest extends AbstractIntegrationTest{
diff --git a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AdminServiceTransactionTest.java b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AdminServiceTransactionTest.java
index dd12ca46a8e..76f0587ed32 100644
--- a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AdminServiceTransactionTest.java
+++ b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AdminServiceTransactionTest.java
@@ -1,6 +1,11 @@
package com.ctrip.framework.apollo.biz.service;
-import java.util.Date;
+import com.ctrip.framework.apollo.biz.AbstractIntegrationTest;
+import com.ctrip.framework.apollo.biz.repository.AppNamespaceRepository;
+import com.ctrip.framework.apollo.biz.repository.AppRepository;
+import com.ctrip.framework.apollo.biz.repository.ClusterRepository;
+import com.ctrip.framework.apollo.biz.repository.NamespaceRepository;
+import com.ctrip.framework.apollo.common.entity.App;
import org.junit.After;
import org.junit.Assert;
@@ -11,12 +16,7 @@
import org.springframework.test.context.transaction.AfterTransaction;
import org.springframework.test.context.transaction.BeforeTransaction;
-import com.ctrip.framework.apollo.biz.AbstractIntegrationTest;
-import com.ctrip.framework.apollo.common.entity.App;
-import com.ctrip.framework.apollo.biz.repository.AppNamespaceRepository;
-import com.ctrip.framework.apollo.biz.repository.AppRepository;
-import com.ctrip.framework.apollo.biz.repository.ClusterRepository;
-import com.ctrip.framework.apollo.biz.repository.NamespaceRepository;
+import java.util.Date;
public class AdminServiceTransactionTest extends AbstractIntegrationTest {
diff --git a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ClusterServiceTest.java b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ClusterServiceTest.java
index 4bbf1192106..af75738b29a 100644
--- a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ClusterServiceTest.java
+++ b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ClusterServiceTest.java
@@ -1,13 +1,13 @@
package com.ctrip.framework.apollo.biz.service;
-import java.util.Date;
+import com.ctrip.framework.apollo.biz.AbstractIntegrationTest;
+import com.ctrip.framework.apollo.common.entity.App;
+import com.ctrip.framework.apollo.common.exception.ServiceException;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import com.ctrip.framework.apollo.biz.AbstractIntegrationTest;
-import com.ctrip.framework.apollo.common.entity.App;
-import com.ctrip.framework.apollo.common.exception.ServiceException;
+import java.util.Date;
public class ClusterServiceTest extends AbstractIntegrationTest {
diff --git a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceBranchServiceTest.java b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceBranchServiceTest.java
index fdbadd642cf..ff1c3891617 100644
--- a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceBranchServiceTest.java
+++ b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceBranchServiceTest.java
@@ -14,7 +14,6 @@
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.test.context.jdbc.Sql;
-import org.springframework.test.util.AssertionErrors;
public class NamespaceBranchServiceTest extends AbstractIntegrationTest {
diff --git a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/PrivilegeServiceTest.java b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/PrivilegeServiceTest.java
index 86dce20e563..93132ed2a7b 100644
--- a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/PrivilegeServiceTest.java
+++ b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/PrivilegeServiceTest.java
@@ -1,17 +1,17 @@
package com.ctrip.framework.apollo.biz.service;
-import java.util.Date;
-import java.util.List;
+import com.ctrip.framework.apollo.biz.AbstractIntegrationTest;
+import com.ctrip.framework.apollo.biz.entity.Cluster;
+import com.ctrip.framework.apollo.biz.entity.Namespace;
+import com.ctrip.framework.apollo.biz.entity.Privilege;
+import com.ctrip.framework.apollo.common.entity.App;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import com.ctrip.framework.apollo.biz.AbstractIntegrationTest;
-import com.ctrip.framework.apollo.common.entity.App;
-import com.ctrip.framework.apollo.biz.entity.Cluster;
-import com.ctrip.framework.apollo.biz.entity.Namespace;
-import com.ctrip.framework.apollo.biz.entity.Privilege;
+import java.util.Date;
+import java.util.List;
public class PrivilegeServiceTest extends AbstractIntegrationTest {
diff --git a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseCreationTest.java b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseCreationTest.java
index 180f973bcb0..3a40abcbc42 100644
--- a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseCreationTest.java
+++ b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseCreationTest.java
@@ -19,7 +19,6 @@
import org.springframework.test.context.jdbc.Sql;
import java.lang.reflect.Type;
-import java.util.List;
import java.util.Map;
public class ReleaseCreationTest extends AbstractIntegrationTest {
diff --git a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ServerConfigServiceTest.java b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ServerConfigServiceTest.java
index 77446e74661..5bf01526ac0 100644
--- a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ServerConfigServiceTest.java
+++ b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ServerConfigServiceTest.java
@@ -11,7 +11,8 @@
import org.mockito.Mock;
import org.springframework.test.util.ReflectionTestUtils;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
diff --git a/apollo-biz/src/test/resources/META-INF/plexus/plexus.xml b/apollo-biz/src/test/resources/META-INF/plexus/plexus.xml
deleted file mode 100644
index b4530cd3da3..00000000000
--- a/apollo-biz/src/test/resources/META-INF/plexus/plexus.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
- com.dianping.cat.configuration.ClientConfigManager
- com.ctrip.framework.apollo.cat.NullClientConfigManager
-
-
-
- com.dianping.cat.message.io.TransportManager
- com.ctrip.framework.apollo.cat.NullTransportManager
-
-
-
- com.dianping.cat.message.spi.MessageManager
- com.ctrip.framework.apollo.cat.NullMessageManager
-
-
-
- com.dianping.cat.message.internal.MessageIdFactory
-
-
-
-
- com.dianping.cat.message.MessageProducer
- com.ctrip.framework.apollo.cat.NullMessageProducer
-
-
-
- com.dianping.cat.message.spi.MessageManager
-
-
- com.dianping.cat.message.internal.MessageIdFactory
-
-
-
-
- org.codehaus.plexus.logging.LoggerManager
- com.ctrip.framework.apollo.cat.NullLoggerManager
-
-
-
-
diff --git a/apollo-buildtools/pom.xml b/apollo-buildtools/pom.xml
index 86c1c04941d..5a790af9816 100644
--- a/apollo-buildtools/pom.xml
+++ b/apollo-buildtools/pom.xml
@@ -4,22 +4,12 @@
com.ctrip.framework.apollo
apollo
- 0.3.0
+ 0.4.0-SNAPSHOT
../pom.xml
4.0.0
apollo-buildtools
Apollo BuildTools
-
- 1.7
- ${project.artifactId}
-
-
-
- com.dianping.cat
- cat-client
-
-
diff --git a/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullClientConfigManager.java b/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullClientConfigManager.java
deleted file mode 100644
index 5eef25a176f..00000000000
--- a/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullClientConfigManager.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package com.ctrip.framework.apollo.cat;
-
-import java.io.File;
-import java.util.List;
-
-import com.dianping.cat.configuration.ClientConfigManager;
-import com.dianping.cat.configuration.client.entity.Domain;
-import com.dianping.cat.configuration.client.entity.Server;
-
-public class NullClientConfigManager implements ClientConfigManager{
-
- @Override
- public Domain getDomain() {
- return null;
- }
-
- @Override
- public int getMaxMessageLength() {
- return 0;
- }
-
- @Override
- public String getServerConfigUrl() {
- return null;
- }
-
- @Override
- public List getServers() {
- return null;
- }
-
- @Override
- public int getTaggedTransactionCacheSize() {
- return 0;
- }
-
- @Override
- public void initialize(File configFile) throws Exception {
-
- }
-
- @Override
- public boolean isCatEnabled() {
- return false;
- }
-
- @Override
- public boolean isDumpLocked() {
- return false;
- }
-
- @Override
- public int getQueueSize() {
- return 0;
- }
-
-}
diff --git a/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullLoggerManager.java b/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullLoggerManager.java
deleted file mode 100644
index b4026ba166e..00000000000
--- a/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullLoggerManager.java
+++ /dev/null
@@ -1,8 +0,0 @@
-package com.ctrip.framework.apollo.cat;
-
-import org.codehaus.plexus.logging.console.ConsoleLoggerManager;
-
-public class NullLoggerManager extends ConsoleLoggerManager{
-
-
-}
diff --git a/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullMessageManager.java b/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullMessageManager.java
deleted file mode 100644
index 709d083c010..00000000000
--- a/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullMessageManager.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package com.ctrip.framework.apollo.cat;
-
-import java.io.IOException;
-
-import org.codehaus.plexus.logging.LogEnabled;
-import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
-import org.unidal.lookup.ContainerHolder;
-import org.unidal.lookup.annotation.Inject;
-
-import com.dianping.cat.message.Message;
-import com.dianping.cat.message.Transaction;
-import com.dianping.cat.message.internal.MessageIdFactory;
-import com.dianping.cat.message.spi.MessageManager;
-import com.dianping.cat.message.spi.MessageTree;
-
-public class NullMessageManager extends ContainerHolder
- implements
- MessageManager,
- Initializable,
- LogEnabled {
-
- @Inject
- private MessageIdFactory m_factory;
-
- @Override
- public void enableLogging(Logger logger) {
-
- }
-
- @Override
- public void initialize() throws InitializationException {
- try {
- m_factory.initialize("localhost");
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void add(Message message) {
-
- }
-
- @Override
- public void end(Transaction transaction) {
-
- }
-
- @Override
- public Transaction getPeekTransaction() {
- return null;
- }
-
- @Override
- public MessageTree getThreadLocalMessageTree() {
- return null;
- }
-
- @Override
- public boolean hasContext() {
- return false;
- }
-
- @Override
- public boolean isMessageEnabled() {
- return false;
- }
-
- @Override
- public boolean isCatEnabled() {
- return false;
- }
-
- @Override
- public boolean isTraceMode() {
- return false;
- }
-
- @Override
- public void reset() {
-
- }
-
- @Override
- public void setTraceMode(boolean traceMode) {
-
- }
-
- @Override
- public void setup() {
-
- }
-
- @Override
- public void start(Transaction transaction, boolean forked) {
-
- }
-
- @Override
- public void bind(String tag, String title) {
-
- }
-
- @Override
- public String getDomain() {
- return null;
- }
-
-}
diff --git a/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullMessageProducer.java b/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullMessageProducer.java
deleted file mode 100644
index 77f30006868..00000000000
--- a/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullMessageProducer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.ctrip.framework.apollo.cat;
-
-import java.util.Map;
-
-import com.dianping.cat.message.internal.DefaultMessageProducer;
-
-public class NullMessageProducer extends DefaultMessageProducer{
-
- @Override
- public void logError(Throwable cause) {
-
- }
-
- @Override
- public void logError(String message, Throwable cause) {
-
- }
-
- @Override
- public void logEvent(String type, String name) {
-
- }
-
- @Override
- public void logTrace(String type, String name) {
-
- }
-
- @Override
- public void logEvent(String type, String name, String status, String nameValuePairs) {
-
- }
-
- @Override
- public void logTags(String scenario, Map indexedTags,
- Map storedTags) {
-
- }
-
- @Override
- public void logTrace(String type, String name, String status, String nameValuePairs) {
-
- }
-
- @Override
- public void logHeartbeat(String type, String name, String status, String nameValuePairs) {
-
- }
-
- @Override
- public void logMetric(String name, String status, String nameValuePairs) {
-
- }
-
-}
diff --git a/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullTransportManager.java b/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullTransportManager.java
deleted file mode 100644
index 003dbb597c3..00000000000
--- a/apollo-buildtools/src/main/java/com/ctrip/framework/apollo/cat/NullTransportManager.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.ctrip.framework.apollo.cat;
-
-import com.dianping.cat.message.io.MessageSender;
-import com.dianping.cat.message.io.TransportManager;
-import com.dianping.cat.message.spi.MessageTree;
-
-public class NullTransportManager implements TransportManager {
-
- private static final MessageSender nullMessageSender = new MessageSender() {
-
- @Override
- public void initialize() {
-
- }
-
- @Override
- public void send(MessageTree tree) {
-
- }
-
- @Override
- public void shutdown() {
-
- }
-
- };
-
- @Override
- public MessageSender getSender() {
- return nullMessageSender;
- }
-
-}
diff --git a/apollo-client/pom.xml b/apollo-client/pom.xml
index 80d6ede8a93..f9e50fcfc8e 100644
--- a/apollo-client/pom.xml
+++ b/apollo-client/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.3.0
+ 0.4.0-SNAPSHOT
../pom.xml
4.0.0
@@ -20,16 +20,11 @@
com.ctrip.framework.apollo
apollo-core
-
- com.ctrip.framework.apollo
- apollo-buildtools
- test
-
- com.ctrip.framework
- framework-foundation
+ org.unidal.framework
+ foundation-service
@@ -37,27 +32,6 @@
org.slf4j
slf4j-api
-
- org.apache.logging.log4j
- log4j-slf4j-impl
-
-
- org.slf4j
- slf4j-api
-
-
- org.apache.logging.log4j
- log4j-api
-
-
- provided
-
-
- org.apache.logging.log4j
- log4j-core
- provided
-
-
org.eclipse.jetty
@@ -69,13 +43,29 @@
commons-logging
test
+
+ org.apache.logging.log4j
+ log4j-slf4j-impl
+ test
+
+
+ org.apache.logging.log4j
+ log4j-core
+ test
+
org.unidal.framework
dal-jdbc
2.4.0
- provided
+ true
+
+
+ com.dianping.cat
+ cat-client
+
+
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/ConfigService.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/ConfigService.java
index 195b9e6f2a4..7570d627498 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/ConfigService.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/ConfigService.java
@@ -6,7 +6,7 @@
import com.ctrip.framework.apollo.internals.ConfigManager;
import com.ctrip.framework.apollo.spi.ConfigFactory;
import com.ctrip.framework.apollo.spi.ConfigRegistry;
-import com.dianping.cat.Cat;
+import com.ctrip.framework.apollo.tracer.Tracer;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
@@ -51,7 +51,7 @@ private static ConfigManager getManager() {
return s_instance.m_container.lookup(ConfigManager.class);
} catch (ComponentLookupException ex) {
ApolloConfigException exception = new ApolloConfigException("Unable to load ConfigManager!", ex);
- Cat.logError(exception);
+ Tracer.logError(exception);
throw exception;
}
}
@@ -61,7 +61,7 @@ private static ConfigRegistry getRegistry() {
return s_instance.m_container.lookup(ConfigRegistry.class);
} catch (ComponentLookupException ex) {
ApolloConfigException exception = new ApolloConfigException("Unable to load ConfigRegistry!", ex);
- Cat.logError(exception);
+ Tracer.logError(exception);
throw exception;
}
}
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfig.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfig.java
index ee81d21d4d9..19b24d9834b 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfig.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfig.java
@@ -11,10 +11,9 @@
import com.ctrip.framework.apollo.exceptions.ApolloConfigException;
import com.ctrip.framework.apollo.model.ConfigChange;
import com.ctrip.framework.apollo.model.ConfigChangeEvent;
+import com.ctrip.framework.apollo.tracer.Tracer;
+import com.ctrip.framework.apollo.tracer.spi.Transaction;
import com.ctrip.framework.apollo.util.parser.Parsers;
-import com.dianping.cat.Cat;
-import com.dianping.cat.message.Message;
-import com.dianping.cat.message.Transaction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -63,7 +62,7 @@ public Integer getIntProperty(String key, Integer defaultValue) {
return Integer.parseInt(value);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getIntProperty for %s failed, return default value %d", key,
defaultValue), ex));
}
@@ -79,7 +78,7 @@ public Long getLongProperty(String key, Long defaultValue) {
return Long.parseLong(value);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getLongProperty for %s failed, return default value %d", key,
defaultValue), ex));
}
@@ -95,7 +94,7 @@ public Short getShortProperty(String key, Short defaultValue) {
return Short.parseShort(value);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getShortProperty for %s failed, return default value %d", key,
defaultValue), ex));
}
@@ -111,7 +110,7 @@ public Float getFloatProperty(String key, Float defaultValue) {
return Float.parseFloat(value);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getFloatProperty for %s failed, return default value %f", key,
defaultValue), ex));
}
@@ -127,7 +126,7 @@ public Double getDoubleProperty(String key, Double defaultValue) {
return Double.parseDouble(value);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getDoubleProperty for %s failed, return default value %f", key,
defaultValue), ex));
}
@@ -143,7 +142,7 @@ public Byte getByteProperty(String key, Byte defaultValue) {
return Byte.parseByte(value);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getByteProperty for %s failed, return default value %d", key,
defaultValue), ex));
}
@@ -159,7 +158,7 @@ public Boolean getBooleanProperty(String key, Boolean defaultValue) {
return Boolean.parseBoolean(value);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getBooleanProperty for %s failed, return default value %b", key,
defaultValue), ex));
}
@@ -175,7 +174,7 @@ public String[] getArrayProperty(String key, String delimiter, String[] defaultV
return value.split(delimiter);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getArrayProperty for %s failed, return default value", key), ex));
}
return defaultValue;
@@ -190,7 +189,7 @@ public > T getEnumProperty(String key, Class enumType, T de
return Enum.valueOf(enumType, value);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getEnumProperty for %s failed, return default value %s", key,
defaultValue), ex));
}
@@ -207,7 +206,7 @@ public Date getDateProperty(String key, Date defaultValue) {
return Parsers.forDate().parse(value);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getDateProperty for %s failed, return default value %s", key,
defaultValue), ex));
}
@@ -224,7 +223,7 @@ public Date getDateProperty(String key, String format, Date defaultValue) {
return Parsers.forDate().parse(value, format);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getDateProperty for %s failed, return default value %s", key,
defaultValue), ex));
}
@@ -241,7 +240,7 @@ public Date getDateProperty(String key, String format, Locale locale, Date defau
return Parsers.forDate().parse(value, format, locale);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getDateProperty for %s failed, return default value %s", key,
defaultValue), ex));
}
@@ -258,7 +257,7 @@ public long getDurationProperty(String key, long defaultValue) {
return Parsers.forDuration().parseToMillis(value);
}
} catch (Throwable ex) {
- Cat.logError(new ApolloConfigException(
+ Tracer.logError(new ApolloConfigException(
String.format("getDurationProperty for %s failed, return default value %d", key,
defaultValue), ex));
}
@@ -272,13 +271,13 @@ protected void fireConfigChange(final ConfigChangeEvent changeEvent) {
@Override
public void run() {
String listenerName = listener.getClass().getName();
- Transaction transaction = Cat.newTransaction("Apollo.ConfigChangeListener", listenerName);
+ Transaction transaction = Tracer.newTransaction("Apollo.ConfigChangeListener", listenerName);
try {
listener.onChange(changeEvent);
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
transaction.setStatus(ex);
- Cat.logError(ex);
+ Tracer.logError(ex);
logger.error("Failed to invoke config change listener {}", listenerName, ex);
} finally {
transaction.complete();
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfigFile.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfigFile.java
index ee692c77a8a..5b21165c7f9 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfigFile.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfigFile.java
@@ -1,8 +1,8 @@
package com.ctrip.framework.apollo.internals;
import com.ctrip.framework.apollo.ConfigFile;
+import com.ctrip.framework.apollo.tracer.Tracer;
import com.ctrip.framework.apollo.util.ExceptionUtil;
-import com.dianping.cat.Cat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -30,7 +30,7 @@ private void initialize() {
try {
m_configProperties.set(m_configRepository.getConfig());
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
logger.warn("Init Apollo Config File failed - namespace: {}, reason: {}.",
m_namespace, ExceptionUtil.getDetailMessage(ex));
} finally {
@@ -55,7 +55,7 @@ public synchronized void onRepositoryChange(String namespace, Properties newProp
m_configProperties.set(newConfigProperties);
- Cat.logEvent("Apollo.Client.ConfigChanges", m_namespace);
+ Tracer.logEvent("Apollo.Client.ConfigChanges", m_namespace);
}
}
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfigRepository.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfigRepository.java
index 39ca1e13af3..0c51f583b60 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfigRepository.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/AbstractConfigRepository.java
@@ -2,8 +2,8 @@
import com.google.common.collect.Lists;
+import com.ctrip.framework.apollo.tracer.Tracer;
import com.ctrip.framework.apollo.util.ExceptionUtil;
-import com.dianping.cat.Cat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -23,7 +23,7 @@ protected boolean trySync() {
sync();
return true;
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
logger
.warn("Sync config failed, will retry. Repository {}, reason: {}", this.getClass(), ExceptionUtil
.getDetailMessage(ex));
@@ -50,7 +50,7 @@ protected void fireRepositoryChange(String namespace, Properties newProperties)
try {
listener.onRepositoryChange(namespace, newProperties);
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
logger.error("Failed to invoke repository change listener {}", listener.getClass(), ex);
}
}
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/ConfigServiceLocator.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/ConfigServiceLocator.java
index 62704934b79..eb46a507cd2 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/ConfigServiceLocator.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/ConfigServiceLocator.java
@@ -11,13 +11,12 @@
import com.ctrip.framework.apollo.core.dto.ServiceDTO;
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory;
import com.ctrip.framework.apollo.exceptions.ApolloConfigException;
+import com.ctrip.framework.apollo.tracer.Tracer;
+import com.ctrip.framework.apollo.tracer.spi.Transaction;
import com.ctrip.framework.apollo.util.ConfigUtil;
import com.ctrip.framework.apollo.util.http.HttpRequest;
import com.ctrip.framework.apollo.util.http.HttpResponse;
import com.ctrip.framework.apollo.util.http.HttpUtil;
-import com.dianping.cat.Cat;
-import com.dianping.cat.message.Message;
-import com.dianping.cat.message.Transaction;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
@@ -94,7 +93,7 @@ private void schedulePeriodicRefresh() {
@Override
public void run() {
logger.debug("refresh config services");
- Cat.logEvent("Apollo.MetaService", "periodicRefresh");
+ Tracer.logEvent("Apollo.MetaService", "periodicRefresh");
tryUpdateConfigServices();
}
}, m_configUtil.getRefreshInterval(), m_configUtil.getRefreshInterval(),
@@ -109,11 +108,11 @@ private synchronized void updateConfigServices() {
Throwable exception = null;
for (int i = 0; i < maxRetries; i++) {
- Transaction transaction = Cat.newTransaction("Apollo.MetaService", "getConfigService");
+ Transaction transaction = Tracer.newTransaction("Apollo.MetaService", "getConfigService");
transaction.addData("Url", url);
try {
HttpResponse> response = m_httpUtil.doGet(request, m_responseType);
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
List services = response.getBody();
if (services == null || services.isEmpty()) {
logConfigServiceToCat("Empty response!");
@@ -123,7 +122,7 @@ private synchronized void updateConfigServices() {
logConfigServicesToCat(services);
return;
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
transaction.setStatus(ex);
exception = ex;
} finally {
@@ -162,6 +161,6 @@ private void logConfigServicesToCat(List serviceDtos) {
}
private void logConfigServiceToCat(String serviceUrl) {
- Cat.logEvent("Apollo.Config.Services", serviceUrl);
+ Tracer.logEvent("Apollo.Config.Services", serviceUrl);
}
}
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultConfig.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultConfig.java
index a1998b66005..0867a045d0d 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultConfig.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultConfig.java
@@ -6,8 +6,8 @@
import com.ctrip.framework.apollo.enums.PropertyChangeType;
import com.ctrip.framework.apollo.model.ConfigChange;
import com.ctrip.framework.apollo.model.ConfigChangeEvent;
+import com.ctrip.framework.apollo.tracer.Tracer;
import com.ctrip.framework.apollo.util.ExceptionUtil;
-import com.dianping.cat.Cat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,7 +51,7 @@ private void initialize() {
try {
m_configProperties.set(m_configRepository.getConfig());
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
logger.warn("Init Apollo Local Config failed - namespace: {}, reason: {}.",
m_namespace, ExceptionUtil.getDetailMessage(ex));
} finally {
@@ -119,7 +119,7 @@ public synchronized void onRepositoryChange(String namespace, Properties newProp
this.fireConfigChange(new ConfigChangeEvent(m_namespace, actualChanges));
- Cat.logEvent("Apollo.Client.ConfigChanges", m_namespace);
+ Tracer.logEvent("Apollo.Client.ConfigChanges", m_namespace);
}
private Map updateAndCalcConfigChanges(Properties newConfigProperties) {
@@ -185,7 +185,7 @@ private Properties loadFromResource(String namespace) {
try {
properties.load(in);
} catch (IOException ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
logger.error("Load resource config for namespace {} failed", namespace, ex);
} finally {
try {
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/LocalFileConfigRepository.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/LocalFileConfigRepository.java
index bbe0b5a57be..4e095f83d04 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/LocalFileConfigRepository.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/LocalFileConfigRepository.java
@@ -6,11 +6,10 @@
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.ctrip.framework.apollo.core.utils.ClassLoaderUtil;
import com.ctrip.framework.apollo.exceptions.ApolloConfigException;
+import com.ctrip.framework.apollo.tracer.Tracer;
+import com.ctrip.framework.apollo.tracer.spi.Transaction;
import com.ctrip.framework.apollo.util.ConfigUtil;
import com.ctrip.framework.apollo.util.ExceptionUtil;
-import com.dianping.cat.Cat;
-import com.dianping.cat.message.Message;
-import com.dianping.cat.message.Transaction;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
@@ -58,7 +57,7 @@ public LocalFileConfigRepository(String namespace, ConfigRepository upstream) {
try {
m_configUtil = m_container.lookup(ConfigUtil.class);
} catch (ComponentLookupException ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
throw new ApolloConfigException("Unable to load component!", ex);
}
this.setLocalCacheDir(findLocalCacheDir(), false);
@@ -135,14 +134,14 @@ protected void sync() {
return;
}
- Transaction transaction = Cat.newTransaction("Apollo.ConfigService", "syncLocalConfig");
+ Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "syncLocalConfig");
Throwable exception = null;
try {
transaction.addData("Basedir", m_baseDir.getAbsolutePath());
m_fileProperties = this.loadFromLocalCacheFile(m_baseDir, m_namespace);
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
transaction.setStatus(ex);
exception = ex;
//ignore
@@ -165,7 +164,7 @@ private boolean trySyncFromUpstream() {
updateFileProperties(properties);
return true;
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
logger
.warn("Sync config from upstream repository {} failed, reason: {}", m_upstream.getClass(),
ExceptionUtil.getDetailMessage(ex));
@@ -197,7 +196,7 @@ private Properties loadFromLocalCacheFile(File baseDir, String namespace) throws
properties.load(in);
logger.debug("Loading local config file {} successfully!", file.getAbsolutePath());
} catch (IOException ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
throw new ApolloConfigException(String
.format("Loading config from local cache file %s failed", file.getAbsolutePath()), ex);
} finally {
@@ -225,17 +224,17 @@ void persistLocalCacheFile(File baseDir, String namespace) {
OutputStream out = null;
- Transaction transaction = Cat.newTransaction("Apollo.ConfigService", "persistLocalConfigFile");
+ Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "persistLocalConfigFile");
transaction.addData("LocalConfigFile", file.getAbsolutePath());
try {
out = new FileOutputStream(file);
m_fileProperties.store(out, "Persisted by DefaultConfig");
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
} catch (IOException ex) {
ApolloConfigException exception =
new ApolloConfigException(
String.format("Persist local cache file %s failed", file.getAbsolutePath()), ex);
- Cat.logError(exception);
+ Tracer.logError(exception);
transaction.setStatus(exception);
logger.warn("Persist local cache file {} failed, reason: {}.", file.getAbsolutePath(),
ExceptionUtil.getDetailMessage(ex));
@@ -255,17 +254,17 @@ private void checkLocalConfigCacheDir(File baseDir) {
if (baseDir.exists()) {
return;
}
- Transaction transaction = Cat.newTransaction("Apollo.ConfigService", "createLocalConfigDir");
+ Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "createLocalConfigDir");
transaction.addData("BaseDir", baseDir.getAbsolutePath());
try {
Files.createDirectory(baseDir.toPath());
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
} catch (IOException ex) {
ApolloConfigException exception =
new ApolloConfigException(
String.format("Create local config directory %s failed", baseDir.getAbsolutePath()),
ex);
- Cat.logError(exception);
+ Tracer.logError(exception);
transaction.setStatus(exception);
logger.warn(
"Unable to create local config cache directory {}, reason: {}. Will not able to cache config file.",
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/PropertiesConfigFile.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/PropertiesConfigFile.java
index 0b4694f3084..d3fcc20070b 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/PropertiesConfigFile.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/PropertiesConfigFile.java
@@ -3,8 +3,8 @@
import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import com.ctrip.framework.apollo.core.utils.PropertiesUtil;
import com.ctrip.framework.apollo.exceptions.ApolloConfigException;
+import com.ctrip.framework.apollo.tracer.Tracer;
import com.ctrip.framework.apollo.util.ExceptionUtil;
-import com.dianping.cat.Cat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +45,7 @@ String doGetContent() {
new ApolloConfigException(String
.format("Parse properties file content failed for namespace: %s, cause: %s",
m_namespace, ExceptionUtil.getDetailMessage(ex)));
- Cat.logError(exception);
+ Tracer.logError(exception);
throw exception;
}
}
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/RemoteConfigLongPollService.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/RemoteConfigLongPollService.java
index 0aa8be3ed33..d6ccbb151c1 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/RemoteConfigLongPollService.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/RemoteConfigLongPollService.java
@@ -21,14 +21,13 @@
import com.ctrip.framework.apollo.core.schedule.SchedulePolicy;
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory;
import com.ctrip.framework.apollo.exceptions.ApolloConfigException;
+import com.ctrip.framework.apollo.tracer.Tracer;
+import com.ctrip.framework.apollo.tracer.spi.Transaction;
import com.ctrip.framework.apollo.util.ConfigUtil;
import com.ctrip.framework.apollo.util.ExceptionUtil;
import com.ctrip.framework.apollo.util.http.HttpRequest;
import com.ctrip.framework.apollo.util.http.HttpResponse;
import com.ctrip.framework.apollo.util.http.HttpUtil;
-import com.dianping.cat.Cat;
-import com.dianping.cat.message.Message;
-import com.dianping.cat.message.Transaction;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
@@ -123,7 +122,7 @@ public void run() {
m_longPollStarted.set(false);
ApolloConfigException exception =
new ApolloConfigException("Schedule long polling refresh failed", ex);
- Cat.logError(exception);
+ Tracer.logError(exception);
logger.warn(ExceptionUtil.getDetailMessage(exception));
}
}
@@ -143,7 +142,7 @@ private void doLongPollingRefresh(String appId, String cluster, String dataCente
} catch (InterruptedException e) {
}
}
- Transaction transaction = Cat.newTransaction("Apollo.ConfigService", "pollNotification");
+ Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "pollNotification");
try {
if (lastServiceDto == null) {
List configServices = getConfigServices();
@@ -178,10 +177,10 @@ private void doLongPollingRefresh(String appId, String cluster, String dataCente
m_longPollFailSchedulePolicyInSecond.success();
transaction.addData("StatusCode", response.getStatusCode());
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
lastServiceDto = null;
- Cat.logError(ex);
+ Tracer.logError(ex);
transaction.setStatus(ex);
long sleepTimeInSecond = m_longPollFailSchedulePolicyInSecond.fail();
logger.warn(
@@ -215,7 +214,7 @@ private void notify(ServiceDTO lastServiceDto, List no
try {
remoteConfigRepository.onLongPollNotified(lastServiceDto);
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
}
}
}
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/RemoteConfigRepository.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/RemoteConfigRepository.java
index f9d4ddaf59d..63b78e3ff71 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/RemoteConfigRepository.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/RemoteConfigRepository.java
@@ -15,13 +15,12 @@
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory;
import com.ctrip.framework.apollo.exceptions.ApolloConfigException;
import com.ctrip.framework.apollo.exceptions.ApolloConfigStatusCodeException;
+import com.ctrip.framework.apollo.tracer.Tracer;
+import com.ctrip.framework.apollo.tracer.spi.Transaction;
import com.ctrip.framework.apollo.util.ConfigUtil;
import com.ctrip.framework.apollo.util.http.HttpRequest;
import com.ctrip.framework.apollo.util.http.HttpResponse;
import com.ctrip.framework.apollo.util.http.HttpUtil;
-import com.dianping.cat.Cat;
-import com.dianping.cat.message.Message;
-import com.dianping.cat.message.Transaction;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
@@ -78,7 +77,7 @@ public RemoteConfigRepository(String namespace) {
m_serviceLocator = m_container.lookup(ConfigServiceLocator.class);
remoteConfigLongPollService = m_container.lookup(RemoteConfigLongPollService.class);
} catch (ComponentLookupException ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
throw new ApolloConfigException("Unable to load component!", ex);
}
m_longPollServiceDto = new AtomicReference<>();
@@ -108,10 +107,10 @@ private void schedulePeriodicRefresh() {
new Runnable() {
@Override
public void run() {
- Cat.logEvent("Apollo.ConfigService", String.format("periodicRefresh: %s", m_namespace));
+ Tracer.logEvent("Apollo.ConfigService", String.format("periodicRefresh: %s", m_namespace));
logger.debug("refresh config for namespace: {}", m_namespace);
trySync();
- Cat.logEvent("Apollo.Client.Version", Apollo.VERSION);
+ Tracer.logEvent("Apollo.Client.Version", Apollo.VERSION);
}
}, m_configUtil.getRefreshInterval(), m_configUtil.getRefreshInterval(),
m_configUtil.getRefreshIntervalTimeUnit());
@@ -119,7 +118,7 @@ public void run() {
@Override
protected synchronized void sync() {
- Transaction transaction = Cat.newTransaction("Apollo.ConfigService", "syncRemoteConfig");
+ Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "syncRemoteConfig");
try {
ApolloConfig previous = m_configCache.get();
@@ -133,11 +132,11 @@ protected synchronized void sync() {
}
if (current != null) {
- Cat.logEvent(String.format("Apollo.Client.Configs.%s", current.getNamespaceName()),
+ Tracer.logEvent(String.format("Apollo.Client.Configs.%s", current.getNamespaceName()),
current.getReleaseKey());
}
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
transaction.setStatus(ex);
throw ex;
@@ -163,7 +162,7 @@ private ApolloConfig loadApolloConfig() {
String appId = m_configUtil.getAppId();
String cluster = m_configUtil.getCluster();
String dataCenter = m_configUtil.getDataCenter();
- Cat.logEvent("Apollo.Client.ConfigMeta", STRING_JOINER.join(appId, cluster, m_namespace));
+ Tracer.logEvent("Apollo.Client.ConfigMeta", STRING_JOINER.join(appId, cluster, m_namespace));
int maxRetries = 2;
Throwable exception = null;
@@ -184,14 +183,14 @@ private ApolloConfig loadApolloConfig() {
logger.debug("Loading config from {}", url);
HttpRequest request = new HttpRequest(url);
- Transaction transaction = Cat.newTransaction("Apollo.ConfigService", "queryConfig");
+ Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "queryConfig");
transaction.addData("Url", url);
try {
HttpResponse response = m_httpUtil.doGet(request, ApolloConfig.class);
transaction.addData("StatusCode", response.getStatusCode());
- transaction.setStatus(Message.SUCCESS);
+ transaction.setStatus(Transaction.SUCCESS);
if (response.getStatusCode() == 304) {
logger.debug("Config server responds with 304 HTTP status code.");
@@ -214,11 +213,11 @@ private ApolloConfig loadApolloConfig() {
statusCodeException = new ApolloConfigStatusCodeException(ex.getStatusCode(),
message);
}
- Cat.logError(statusCodeException);
+ Tracer.logError(statusCodeException);
transaction.setStatus(statusCodeException);
exception = statusCodeException;
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
transaction.setStatus(ex);
exception = ex;
} finally {
diff --git a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/SimpleConfig.java b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/SimpleConfig.java
index 73e293b7cdd..5f6de3c33bc 100644
--- a/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/SimpleConfig.java
+++ b/apollo-client/src/main/java/com/ctrip/framework/apollo/internals/SimpleConfig.java
@@ -5,8 +5,8 @@
import com.ctrip.framework.apollo.model.ConfigChange;
import com.ctrip.framework.apollo.model.ConfigChangeEvent;
+import com.ctrip.framework.apollo.tracer.Tracer;
import com.ctrip.framework.apollo.util.ExceptionUtil;
-import com.dianping.cat.Cat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -42,7 +42,7 @@ private void initialize() {
try {
m_configProperties = m_configRepository.getConfig();
} catch (Throwable ex) {
- Cat.logError(ex);
+ Tracer.logError(ex);
logger.warn("Init Apollo Simple Config failed - namespace: {}, reason: {}", m_namespace,
ExceptionUtil.getDetailMessage(ex));
} finally {
@@ -93,6 +93,6 @@ public String apply(ConfigChange input) {
this.fireConfigChange(new ConfigChangeEvent(m_namespace, changeMap));
- Cat.logEvent("Apollo.Client.ConfigChanges", m_namespace);
+ Tracer.logEvent("Apollo.Client.ConfigChanges", m_namespace);
}
}
diff --git a/apollo-client/src/test/java/com/ctrip/framework/apollo/BaseIntegrationTest.java b/apollo-client/src/test/java/com/ctrip/framework/apollo/BaseIntegrationTest.java
index 0b007b4c7b3..db8d29341d3 100644
--- a/apollo-client/src/test/java/com/ctrip/framework/apollo/BaseIntegrationTest.java
+++ b/apollo-client/src/test/java/com/ctrip/framework/apollo/BaseIntegrationTest.java
@@ -5,8 +5,8 @@
import com.google.common.io.Files;
import com.google.gson.Gson;
-import com.ctrip.framework.apollo.core.enums.Env;
import com.ctrip.framework.apollo.core.dto.ServiceDTO;
+import com.ctrip.framework.apollo.core.enums.Env;
import com.ctrip.framework.apollo.core.utils.ClassLoaderUtil;
import com.ctrip.framework.apollo.util.ConfigUtil;
diff --git a/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/DefaultConfigManagerTest.java b/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/DefaultConfigManagerTest.java
index 6b119a14638..5321aea6e08 100644
--- a/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/DefaultConfigManagerTest.java
+++ b/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/DefaultConfigManagerTest.java
@@ -5,7 +5,6 @@
import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import com.ctrip.framework.apollo.spi.ConfigFactory;
import com.ctrip.framework.apollo.spi.ConfigFactoryManager;
-import com.ctrip.framework.apollo.spi.ConfigRegistry;
import org.junit.Before;
import org.junit.Test;
diff --git a/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/SimpleConfigTest.java b/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/SimpleConfigTest.java
index e190877352d..c8a8b5537bf 100644
--- a/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/SimpleConfigTest.java
+++ b/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/SimpleConfigTest.java
@@ -12,7 +12,6 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
@@ -20,9 +19,6 @@
import java.util.concurrent.TimeUnit;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
/**
diff --git a/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/XmlConfigFileTest.java b/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/XmlConfigFileTest.java
index cbb062e35ab..a60791fe430 100644
--- a/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/XmlConfigFileTest.java
+++ b/apollo-client/src/test/java/com/ctrip/framework/apollo/internals/XmlConfigFileTest.java
@@ -11,7 +11,10 @@
import java.util.Properties;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
/**
diff --git a/apollo-client/src/test/java/com/ctrip/framework/apollo/util/ExceptionUtilTest.java b/apollo-client/src/test/java/com/ctrip/framework/apollo/util/ExceptionUtilTest.java
index c8f00ec52be..79e7635fc31 100644
--- a/apollo-client/src/test/java/com/ctrip/framework/apollo/util/ExceptionUtilTest.java
+++ b/apollo-client/src/test/java/com/ctrip/framework/apollo/util/ExceptionUtilTest.java
@@ -2,7 +2,7 @@
import org.junit.Test;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
/**
* @author Jason Song(song_s@ctrip.com)
diff --git a/apollo-client/src/test/resources/META-INF/plexus/plexus.xml b/apollo-client/src/test/resources/META-INF/plexus/plexus.xml
deleted file mode 100644
index b4530cd3da3..00000000000
--- a/apollo-client/src/test/resources/META-INF/plexus/plexus.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
- com.dianping.cat.configuration.ClientConfigManager
- com.ctrip.framework.apollo.cat.NullClientConfigManager
-
-
-
- com.dianping.cat.message.io.TransportManager
- com.ctrip.framework.apollo.cat.NullTransportManager
-
-
-
- com.dianping.cat.message.spi.MessageManager
- com.ctrip.framework.apollo.cat.NullMessageManager
-
-
-
- com.dianping.cat.message.internal.MessageIdFactory
-
-
-
-
- com.dianping.cat.message.MessageProducer
- com.ctrip.framework.apollo.cat.NullMessageProducer
-
-
-
- com.dianping.cat.message.spi.MessageManager
-
-
- com.dianping.cat.message.internal.MessageIdFactory
-
-
-
-
- org.codehaus.plexus.logging.LoggerManager
- com.ctrip.framework.apollo.cat.NullLoggerManager
-
-
-
-
diff --git a/apollo-common/pom.xml b/apollo-common/pom.xml
index 0b37083bdc2..94bda666a68 100644
--- a/apollo-common/pom.xml
+++ b/apollo-common/pom.xml
@@ -4,7 +4,7 @@
com.ctrip.framework.apollo
apollo
- 0.3.0
+ 0.4.0-SNAPSHOT
../pom.xml
4.0.0
diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/aop/RepositoryAspect.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/aop/RepositoryAspect.java
index 64abea59604..b74daaef64a 100644
--- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/aop/RepositoryAspect.java
+++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/aop/RepositoryAspect.java
@@ -1,8 +1,7 @@
package com.ctrip.framework.apollo.common.aop;
-import com.dianping.cat.Cat;
-import com.dianping.cat.message.Message;
-import com.dianping.cat.message.Transaction;
+import com.ctrip.framework.apollo.tracer.Tracer;
+import com.ctrip.framework.apollo.tracer.spi.Transaction;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
@@ -23,10 +22,10 @@ public Object invokeWithCatTransaction(ProceedingJoinPoint joinPoint) throws Thr
String name =
joinPoint.getSignature().getDeclaringType().getSimpleName() + "." + joinPoint.getSignature()
.getName();
- Transaction catTransaction = Cat.newTransaction("SQL", name);
+ Transaction catTransaction = Tracer.newTransaction("SQL", name);
try {
Object result = joinPoint.proceed();
- catTransaction.setStatus(Message.SUCCESS);
+ catTransaction.setStatus(Transaction.SUCCESS);
return result;
} catch (Throwable ex) {
catTransaction.setStatus(ex);
diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/constants/GsonType.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/constants/GsonType.java
index b87f4a660c3..5175c977ffb 100644
--- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/constants/GsonType.java
+++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/constants/GsonType.java
@@ -2,11 +2,8 @@
import com.google.gson.reflect.TypeToken;
-import com.ctrip.framework.apollo.common.dto.GrayReleaseRuleItemDTO;
-
import java.lang.reflect.Type;
import java.util.Map;
-import java.util.Set;
public interface GsonType {
diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java
index 8811539e5fb..8149c587ad1 100644
--- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java
+++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/ApolloInfoController.java
@@ -1,11 +1,11 @@
package com.ctrip.framework.apollo.common.controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
import com.ctrip.framework.apollo.Apollo;
import com.ctrip.framework.foundation.Foundation;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
@RestController
@RequestMapping(path = "/apollo")
public class ApolloInfoController {
diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/CatConfig.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/CatConfig.java
deleted file mode 100644
index 9caf81b8f94..00000000000
--- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/CatConfig.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.ctrip.framework.apollo.common.controller;
-
-import javax.servlet.DispatcherType;
-
-import org.springframework.boot.context.embedded.FilterRegistrationBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.Ordered;
-
-import com.dianping.cat.servlet.CatFilter;
-
-@Configuration
-public class CatConfig {
-
- @Bean
- public FilterRegistrationBean catFilter() {
- FilterRegistrationBean bean = new FilterRegistrationBean();
- bean.setFilter(new CatFilter());
- bean.setName("cat-filter");
- bean.addUrlPatterns("/*");
- bean.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.FORWARD);
- bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
- return bean;
- }
-
-}
diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/CharacterEncodingFilterConfiguration.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/CharacterEncodingFilterConfiguration.java
index 2f9882795a1..cf0dc0db628 100644
--- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/CharacterEncodingFilterConfiguration.java
+++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/CharacterEncodingFilterConfiguration.java
@@ -1,12 +1,12 @@
package com.ctrip.framework.apollo.common.controller;
-import javax.servlet.DispatcherType;
-
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CharacterEncodingFilter;
+import javax.servlet.DispatcherType;
+
@Configuration
public class CharacterEncodingFilterConfiguration {
diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/GlobalDefaultExceptionHandler.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/GlobalDefaultExceptionHandler.java
index bab947ed2fc..9e0e0e162fb 100644
--- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/GlobalDefaultExceptionHandler.java
+++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/GlobalDefaultExceptionHandler.java
@@ -4,7 +4,7 @@
import com.google.gson.reflect.TypeToken;
import com.ctrip.framework.apollo.common.exception.AbstractApolloHttpException;
-import com.dianping.cat.Cat;
+import com.ctrip.framework.apollo.tracer.Tracer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -82,7 +82,7 @@ private ResponseEntity