diff --git a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceLockAspect.java b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceLockAspect.java index add99bb2387460028033a7458db26a7f01542193..67c8b2cfeff30ce5d980b91ec4c8ee4b73494d4e 100644 --- a/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceLockAspect.java +++ b/apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceLockAspect.java @@ -8,10 +8,10 @@ import com.ctrip.framework.apollo.biz.service.ItemService; 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.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.exception.BadRequestException; -import com.ctrip.framework.apollo.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.dto.ItemChangeSets; +import com.ctrip.framework.apollo.common.dto.ItemDTO; +import com.ctrip.framework.apollo.common.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.ServiceException; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; 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 9596e41c909828c1276f5e45205966df5ea5a51c..50b4d1fdd0eafaa9e4527bc70ec1af3151fe9a58 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 @@ -16,9 +16,9 @@ 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.core.dto.AppDTO; -import com.ctrip.framework.apollo.core.exception.BadRequestException; -import com.ctrip.framework.apollo.core.exception.NotFoundException; +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; @RestController 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 38b95fe16cc3df75707535fbbf36d594f418fe26..0e59c2868559b45641578c9f80609816e2cb4473 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,7 +1,6 @@ package com.ctrip.framework.apollo.adminservice.controller; 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; @@ -10,13 +9,11 @@ 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.core.dto.AppNamespaceDTO; +import com.ctrip.framework.apollo.common.dto.AppNamespaceDTO; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.core.utils.StringUtils; -import java.util.List; - @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 2d82f59f84d90b994d03f119dce5265b977f4df2..ecfb19f212a8c9ee4662ed972f1d65f067877692 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 @@ -14,9 +14,9 @@ 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.core.dto.ClusterDTO; -import com.ctrip.framework.apollo.core.exception.BadRequestException; -import com.ctrip.framework.apollo.core.exception.NotFoundException; +import com.ctrip.framework.apollo.common.dto.ClusterDTO; +import com.ctrip.framework.apollo.common.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.NotFoundException; @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 4c4403241c5da66974b5a1c83d0745dfe01a8f45..e4c290a78d2db7db627300eb1c0c27491bc499d7 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 @@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.adminservice.controller; 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.core.dto.CommitDTO; +import com.ctrip.framework.apollo.common.dto.CommitDTO; 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 4765e28b7f0cf12f308c9332e9d7165351b6554e..9f3dd4cd6dded09d115cfa31db39f15bc3710873 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 @@ -19,9 +19,9 @@ 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.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.exception.BadRequestException; -import com.ctrip.framework.apollo.core.exception.NotFoundException; +import com.ctrip.framework.apollo.common.dto.ItemDTO; +import com.ctrip.framework.apollo.common.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.NotFoundException; @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 a52e6980f7c197be5025072391d45b18a636dc7a..43ca40a92110875740c02715d74e56a8f5b743b8 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 @@ -11,7 +11,7 @@ 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.core.dto.ItemChangeSets; +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 85da70eca22f24bb9207a57b151e176a44422684..726e155a08a37bb8c17ad6c6fc1e05892dc186be 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 @@ -14,9 +14,9 @@ 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.core.dto.NamespaceDTO; -import com.ctrip.framework.apollo.core.exception.BadRequestException; -import com.ctrip.framework.apollo.core.exception.NotFoundException; +import com.ctrip.framework.apollo.common.dto.NamespaceDTO; +import com.ctrip.framework.apollo.common.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.NotFoundException; @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 ab640a0d90483d8023885877bfcd848f84abf9f1..15543a6b6144119bb1b5acdbc11ae18b34ad84e6 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 @@ -6,8 +6,8 @@ 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.core.dto.NamespaceLockDTO; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.dto.NamespaceLockDTO; +import com.ctrip.framework.apollo.common.exception.BadRequestException; 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 7c56b490ab3204ec94b6b0d049b8b26d50deccd4..3311b4f35073c18e3c6ab85c71d9c7118d2fa1c7 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 @@ -10,8 +10,8 @@ import com.ctrip.framework.apollo.biz.service.NamespaceService; import com.ctrip.framework.apollo.biz.service.ReleaseService; import com.ctrip.framework.apollo.common.utils.BeanUtils; import com.ctrip.framework.apollo.core.ConfigConsts; -import com.ctrip.framework.apollo.core.dto.ReleaseDTO; -import com.ctrip.framework.apollo.core.exception.NotFoundException; +import com.ctrip.framework.apollo.common.dto.ReleaseDTO; +import com.ctrip.framework.apollo.common.exception.NotFoundException; 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/adminservice/aop/NamespaceLockTest.java b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceLockTest.java index 12a790c9bac48f348b45d991955e3353bf1c2fce..56bb0d1a62b44168f32d6b5d2988cf81b4a1f0a0 100644 --- a/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceLockTest.java +++ b/apollo-adminservice/src/test/java/com/ctrip/framework/apollo/adminservice/aop/NamespaceLockTest.java @@ -7,8 +7,8 @@ import com.ctrip.framework.apollo.biz.service.ItemService; 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.core.exception.BadRequestException; -import com.ctrip.framework.apollo.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.ServiceException; import org.junit.Test; import org.junit.runner.RunWith; 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 c7ab9637fe8f4302e83825648e906e494a441666..fd8e47f1fa6c62525f4a327cb1b77f7068c544f1 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 @@ -12,7 +12,7 @@ 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.core.dto.AppDTO; +import com.ctrip.framework.apollo.common.dto.AppDTO; public class AppControllerTest extends AbstractControllerTest { 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 543cb8c55bec25fddee9b3405dae44daafb1209f..5395b5ccfbc1f4e63b1a65e30ade4a80710b0d37 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 @@ -2,7 +2,7 @@ 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.core.dto.AppNamespaceDTO; +import com.ctrip.framework.apollo.common.dto.AppNamespaceDTO; 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 d8195aa839667829a0fa9ea511a045c7c06bad4f..81f0421f9981778d123ed73324debc29dc5159b7 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 @@ -19,9 +19,9 @@ 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.core.dto.AppDTO; -import com.ctrip.framework.apollo.core.exception.NotFoundException; -import com.ctrip.framework.apollo.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.dto.AppDTO; +import com.ctrip.framework.apollo.common.exception.NotFoundException; +import com.ctrip.framework.apollo.common.exception.ServiceException; @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 36250e2b13afa0e35b3927caea11418bcb29a2fa..0059195a6a0d2dd97c995b319893d8448ceb9fe1 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 @@ -19,7 +19,7 @@ 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.core.dto.AppDTO; +import com.ctrip.framework.apollo.common.dto.AppDTO; import com.google.gson.Gson; 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 8eabdfb5eba328247b82627484436b08527f00f7..de64af868e79d5c3d55981cc62f66898006db7c0 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 @@ -14,11 +14,11 @@ 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.core.dto.AppDTO; -import com.ctrip.framework.apollo.core.dto.ClusterDTO; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.dto.NamespaceDTO; +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; 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 4fecb8b823aa125f30014557b12a06806b9f1d5d..d5ca572371b0754ccef796ce373f919bca64865a 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 @@ -10,11 +10,11 @@ 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.core.dto.AppDTO; -import com.ctrip.framework.apollo.core.dto.ClusterDTO; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.dto.NamespaceDTO; -import com.ctrip.framework.apollo.core.dto.ReleaseDTO; +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 org.junit.Assert; import org.junit.Test; @@ -24,7 +24,6 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; -import org.springframework.security.core.userdetails.UserDetails; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.jdbc.Sql.ExecutionPhase; import org.springframework.test.util.ReflectionTestUtils; 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 9ebb61c8d1f574c2fbd8cb7f46ceb24a904d048c..7aa14313ac10d886f2ed93715deff504443a78b7 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 @@ -11,7 +11,7 @@ import com.ctrip.framework.apollo.common.entity.AppNamespace; 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.core.exception.ServiceException; +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 34a4d04997dc932f6af1f3dc77a6190d5197d955..ad1b4760f84222e8efcc5a27911ba77af8bf60fd 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 @@ -13,7 +13,7 @@ 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.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.exception.ServiceException; @Service public class AppService { 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 0a532badba60d48c9b55730eb69fe81884663372..fb07946b85cd2f3c2ed9414a674e09226ef6f033 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 @@ -13,7 +13,7 @@ import com.ctrip.framework.apollo.biz.entity.Cluster; import com.ctrip.framework.apollo.biz.repository.ClusterRepository; import com.ctrip.framework.apollo.common.utils.BeanUtils; import com.ctrip.framework.apollo.core.ConfigConsts; -import com.ctrip.framework.apollo.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.exception.ServiceException; import com.google.common.base.Strings; 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 c431d9fca364392fb099d22ac8b20db4b11d639d..f41d45fae89947fbf06983e2e84722905e985d35 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 @@ -6,8 +6,8 @@ import com.ctrip.framework.apollo.biz.entity.Namespace; import com.ctrip.framework.apollo.biz.repository.ItemRepository; import com.ctrip.framework.apollo.biz.repository.NamespaceRepository; import com.ctrip.framework.apollo.common.utils.BeanUtils; -import com.ctrip.framework.apollo.core.exception.BadRequestException; -import com.ctrip.framework.apollo.core.exception.NotFoundException; +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 org.springframework.beans.factory.annotation.Autowired; 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 98c9d51bc758d3b219de4e1848bd7cd6df438891..fed0be2f92deb82996b816415eeaa65abda9539b 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 @@ -10,9 +10,9 @@ import com.ctrip.framework.apollo.biz.entity.Commit; import com.ctrip.framework.apollo.biz.entity.Item; import com.ctrip.framework.apollo.biz.utils.ConfigChangeContentBuilder; import com.ctrip.framework.apollo.common.utils.BeanUtils; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.exception.NotFoundException; +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.core.utils.StringUtils; 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 dcffe0fdd7dad42b2f8ffdd630e77b8f20e13fd1..de636976df93799ccbdd3146bb1f14ccccc002d5 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 @@ -13,7 +13,7 @@ import com.ctrip.framework.apollo.biz.entity.Namespace; import com.ctrip.framework.apollo.biz.repository.NamespaceRepository; import com.ctrip.framework.apollo.common.entity.AppNamespace; import com.ctrip.framework.apollo.common.utils.BeanUtils; -import com.ctrip.framework.apollo.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.exception.ServiceException; @Service public class NamespaceService { diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java index 87ec11005fac466d016a99e3d9356544210b0ecf..3c0b8da99950e776c583d4a60ab397e18d60d964 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/ReleaseService.java @@ -9,8 +9,8 @@ import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.repository.ItemRepository; import com.ctrip.framework.apollo.biz.repository.ReleaseRepository; import com.ctrip.framework.apollo.biz.utils.ReleaseKeyGenerator; -import com.ctrip.framework.apollo.core.exception.BadRequestException; -import com.ctrip.framework.apollo.core.exception.NotFoundException; +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 org.springframework.beans.factory.annotation.Autowired; 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 34e55145a85eb5b2a060bccac7cf294be112aeb2..d76dbc306998e8cda3e78ac801c0e3b231da701b 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 @@ -4,9 +4,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.ctrip.framework.apollo.biz.entity.Item; -import com.ctrip.framework.apollo.common.utils.BeanUtils; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; import java.util.Date; import java.util.LinkedList; @@ -56,7 +53,7 @@ public class ConfigChangeContentBuilder { return gson.toJson(this); } - class ItemPair { + static class ItemPair { Item oldItem; Item newItem; 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 6344b8b9d721079bda06e1469afe2583e3ba882c..b7594f4986c0efceb429a8add7c86ffb02210ed5 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 @@ -14,7 +14,7 @@ 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.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.exception.ServiceException; public class AdminServiceTest 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 bf6eb932def85b8f3804b06d7060427dbf2b4c3f..4bbf11921066b0302da25845c2136bfd7db3ea68 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 @@ -7,7 +7,7 @@ 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.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.exception.ServiceException; public class ClusterServiceTest extends AbstractIntegrationTest { diff --git a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseServiceTest.java b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseServiceTest.java index bde0bfb630ced645efc1ed1cbad4991c5c3fe125..6ee2b95421f28219b5f417b4a774c278c1bcd58a 100644 --- a/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseServiceTest.java +++ b/apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseServiceTest.java @@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.biz.service; import com.ctrip.framework.apollo.biz.AbstractUnitTest; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.repository.ReleaseRepository; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import org.junit.Assert; import org.junit.Before; 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 a8f7b4557754753e88ae4e41f9f674c43b43de01..c8e0011deb0266928008dd83ebc4752dd77283df 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 @@ -12,17 +12,12 @@ import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.client.HttpStatusCodeException; -import com.ctrip.framework.apollo.core.exception.AbstractBaseException; -import com.ctrip.framework.apollo.core.exception.BadRequestException; -import com.ctrip.framework.apollo.core.exception.NotFoundException; +import com.ctrip.framework.apollo.common.exception.AbstractApolloHttpException; import com.dianping.cat.Cat; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import java.lang.reflect.Type; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; -import java.util.LinkedHashMap; +import java.util.HashMap; import java.util.Map; import javax.servlet.ServletException; @@ -30,49 +25,30 @@ import javax.servlet.http.HttpServletRequest; import static org.springframework.http.HttpStatus.BAD_REQUEST; import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR; -import static org.springframework.http.HttpStatus.NOT_FOUND; import static org.springframework.http.HttpStatus.UNAUTHORIZED; import static org.springframework.http.MediaType.APPLICATION_JSON; @ControllerAdvice public class GlobalDefaultExceptionHandler { - private static final Logger logger = LoggerFactory.getLogger(GlobalDefaultExceptionHandler.class); - - private Gson gson = new Gson(); - private static Type mapType = new TypeToken>() {}.getType(); + private static final Logger logger = LoggerFactory.getLogger(GlobalDefaultExceptionHandler.class); - @ExceptionHandler(Exception.class) - public ResponseEntity> exception(HttpServletRequest request, Exception ex) { - logger.error("internal server error", ex); + //处理系统内置的Exception + @ExceptionHandler(Throwable.class) + public ResponseEntity> exception(HttpServletRequest request, Throwable ex) { return handleError(request, INTERNAL_SERVER_ERROR, ex); } @ExceptionHandler({HttpRequestMethodNotSupportedException.class, HttpMediaTypeException.class}) public ResponseEntity> badRequest(HttpServletRequest request, - ServletException ex) { - return handleError(request, BAD_REQUEST, ex); - } - - @ExceptionHandler({BadRequestException.class}) - public ResponseEntity> badRequest(HttpServletRequest request, BadRequestException ex) { + ServletException ex) { return handleError(request, BAD_REQUEST, ex); } - @ExceptionHandler(NotFoundException.class) - public ResponseEntity> notFound(HttpServletRequest request, - NotFoundException ex) { - return handleError(request, NOT_FOUND, ex); - } - @ExceptionHandler(HttpStatusCodeException.class) public ResponseEntity> restTemplateException(HttpServletRequest request, - HttpStatusCodeException ex) { - logger.error("rest template exception", ex); - Map errorAttributes = gson.fromJson(ex.getResponseBodyAsString(), mapType); - HttpHeaders headers = new HttpHeaders(); - headers.setContentType(APPLICATION_JSON); - return new ResponseEntity<>(errorAttributes, headers, ex.getStatusCode()); + HttpStatusCodeException ex) { + return handleError(request, ex.getStatusCode(), ex); } @ExceptionHandler(AccessDeniedException.class) @@ -81,39 +57,37 @@ public class GlobalDefaultExceptionHandler { return handleError(request, UNAUTHORIZED, ex); } + //处理自定义Exception + @ExceptionHandler({AbstractApolloHttpException.class}) + public ResponseEntity> badRequest(HttpServletRequest request, AbstractApolloHttpException ex) { + return handleError(request, ex); + } + + private ResponseEntity> handleError(HttpServletRequest request, - HttpStatus status, Throwable ex) { - return handleError(request, status, ex, ex.getMessage()); + AbstractApolloHttpException ex) { + return handleError(request, ex.getHttpStatus(), ex); } + private ResponseEntity> handleError(HttpServletRequest request, - HttpStatus status, Throwable ex, String message) { - ex = resolveError(ex); - if (ex.getCause() instanceof HttpStatusCodeException) { - return restTemplateException(request, (HttpStatusCodeException) ex.getCause()); - } + HttpStatus status, Throwable ex) { + String message = ex.getMessage(); + logger.error(message, ex); Cat.logError(ex); - Map errorAttributes = new LinkedHashMap<>(); + Map errorAttributes = new HashMap<>(); + errorAttributes.put("status", status.value()); errorAttributes.put("message", message); errorAttributes.put("timestamp", LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); - errorAttributes.put("exception", resolveError(ex).getClass().getName()); -// errorAttributes.put("stackTrace", ex.getStackTrace()); - if (ex instanceof AbstractBaseException) { - errorAttributes.put("errorCode", ((AbstractBaseException) ex).getErrorCode()); - } + errorAttributes.put("exception", ex.getClass().getName()); + HttpHeaders headers = new HttpHeaders(); headers.setContentType(APPLICATION_JSON); return new ResponseEntity<>(errorAttributes, headers, status); } - private Throwable resolveError(Throwable ex) { - while (ex instanceof ServletException && ex.getCause() != null) { - ex = ((ServletException) ex).getCause(); - } - return ex; - } } diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/AppDTO.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/AppDTO.java similarity index 95% rename from apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/AppDTO.java rename to apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/AppDTO.java index 0279cd2dd64279d704a4586bfc35e06a603c5eb1..f0d2899b25b331f767f049c82d4b5ae4b5502850 100644 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/AppDTO.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/AppDTO.java @@ -1,4 +1,4 @@ -package com.ctrip.framework.apollo.core.dto; +package com.ctrip.framework.apollo.common.dto; public class AppDTO extends BaseDTO{ diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/AppNamespaceDTO.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/AppNamespaceDTO.java similarity index 95% rename from apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/AppNamespaceDTO.java rename to apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/AppNamespaceDTO.java index 42ee1e1bf14ad53128aa2cc6a758e2fe56f546e1..e4f7f340d2e05f269ee58cef9eb40332449895e2 100644 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/AppNamespaceDTO.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/AppNamespaceDTO.java @@ -1,4 +1,4 @@ -package com.ctrip.framework.apollo.core.dto; +package com.ctrip.framework.apollo.common.dto; public class AppNamespaceDTO extends BaseDTO{ diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/BaseDTO.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/BaseDTO.java similarity index 95% rename from apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/BaseDTO.java rename to apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/BaseDTO.java index caff6d2fe18dfed92b10cb0585a1aecfb06108ce..f4531158b71e220fe948b8cbb4641b03cf691e34 100644 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/BaseDTO.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/BaseDTO.java @@ -1,4 +1,4 @@ -package com.ctrip.framework.apollo.core.dto; +package com.ctrip.framework.apollo.common.dto; import java.util.Date; diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ClusterDTO.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ClusterDTO.java similarity index 90% rename from apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ClusterDTO.java rename to apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ClusterDTO.java index 45b093deb52d05d2d562ca49925e937319cfe6c5..4bce208819b34a71802c48f7bec51c8fe7066d97 100644 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ClusterDTO.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ClusterDTO.java @@ -1,4 +1,4 @@ -package com.ctrip.framework.apollo.core.dto; +package com.ctrip.framework.apollo.common.dto; public class ClusterDTO extends BaseDTO{ diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/CommitDTO.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/CommitDTO.java similarity index 95% rename from apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/CommitDTO.java rename to apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/CommitDTO.java index bfc410ef0e3c5ae98dcf8bcfc204ca9b8696bccb..82535569bff2841e953118f8a4e244a377a0905e 100644 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/CommitDTO.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/CommitDTO.java @@ -1,4 +1,4 @@ -package com.ctrip.framework.apollo.core.dto; +package com.ctrip.framework.apollo.common.dto; public class CommitDTO extends BaseDTO{ diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ItemChangeSets.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ItemChangeSets.java similarity index 96% rename from apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ItemChangeSets.java rename to apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ItemChangeSets.java index 7c64debe987d4cbcdec98f1651bb8740f8b0cb8a..9573016fa065d7effed682ef3ec72ed2a23be7d4 100644 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ItemChangeSets.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ItemChangeSets.java @@ -1,4 +1,4 @@ -package com.ctrip.framework.apollo.core.dto; +package com.ctrip.framework.apollo.common.dto; import java.util.LinkedList; import java.util.List; diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ItemDTO.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ItemDTO.java similarity index 96% rename from apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ItemDTO.java rename to apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ItemDTO.java index 17e7190a0d82c4f6c2a2d4809e722679d435a0f4..cb3ba9cffb59e70b207475d3fba36eb11e877710 100644 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ItemDTO.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ItemDTO.java @@ -1,4 +1,4 @@ -package com.ctrip.framework.apollo.core.dto; +package com.ctrip.framework.apollo.common.dto; public class ItemDTO extends BaseDTO{ diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/NamespaceDTO.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/NamespaceDTO.java similarity index 93% rename from apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/NamespaceDTO.java rename to apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/NamespaceDTO.java index 378c0638ae90c071dd29209d6a60abfef11dc5aa..6ef517f8a17c104dadfe6150ee2e63e3d91f63ef 100644 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/NamespaceDTO.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/NamespaceDTO.java @@ -1,4 +1,4 @@ -package com.ctrip.framework.apollo.core.dto; +package com.ctrip.framework.apollo.common.dto; public class NamespaceDTO extends BaseDTO{ private long id; diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/NamespaceLockDTO.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/NamespaceLockDTO.java similarity index 83% rename from apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/NamespaceLockDTO.java rename to apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/NamespaceLockDTO.java index daa93d8f6393872f3cb33715d14a5cf98a96cdbf..76e6d6c0354121269f96e939480606fe488640a8 100644 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/NamespaceLockDTO.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/NamespaceLockDTO.java @@ -1,4 +1,4 @@ -package com.ctrip.framework.apollo.core.dto; +package com.ctrip.framework.apollo.common.dto; public class NamespaceLockDTO extends BaseDTO{ diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ReleaseDTO.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ReleaseDTO.java similarity index 97% rename from apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ReleaseDTO.java rename to apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ReleaseDTO.java index 59466822db61ed414a99ac57d7665da892163c14..7136b3d4b4c9f8cd045ca8494dd3b4933d197b5c 100644 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/dto/ReleaseDTO.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/ReleaseDTO.java @@ -1,4 +1,4 @@ -package com.ctrip.framework.apollo.core.dto; +package com.ctrip.framework.apollo.common.dto; public class ReleaseDTO extends BaseDTO{ private long id; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/EntityPair.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/EntityPair.java similarity index 90% rename from apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/EntityPair.java rename to apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/EntityPair.java index 5d0c0944a109039e225433c7b8ba250ac48c3445..71109c15a7b5ac1f19e144ab6fa1837f03bb54a1 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/EntityPair.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/EntityPair.java @@ -1,4 +1,4 @@ -package com.ctrip.framework.apollo.portal.entity.vo; +package com.ctrip.framework.apollo.common.entity; public class EntityPair { diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/AbstractApolloHttpException.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/AbstractApolloHttpException.java new file mode 100644 index 0000000000000000000000000000000000000000..4d137fd9b93c408b30cc1da9f00174cd2a201680 --- /dev/null +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/AbstractApolloHttpException.java @@ -0,0 +1,26 @@ +package com.ctrip.framework.apollo.common.exception; + +import org.springframework.http.HttpStatus; + +public abstract class AbstractApolloHttpException extends RuntimeException{ + + private static final long serialVersionUID = -1713129594004951820L; + + protected HttpStatus httpStatus; + + public AbstractApolloHttpException(String msg){ + super(msg); + } + + public AbstractApolloHttpException(String msg, Exception e){ + super(msg,e); + } + + protected void setHttpStatus(HttpStatus httpStatus){ + this.httpStatus = httpStatus; + } + + public HttpStatus getHttpStatus() { + return httpStatus; + } +} diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/BadRequestException.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/BadRequestException.java new file mode 100644 index 0000000000000000000000000000000000000000..168d2b89f9ae519d0a06686b6a9bd8c449eb7069 --- /dev/null +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/BadRequestException.java @@ -0,0 +1,13 @@ +package com.ctrip.framework.apollo.common.exception; + + +import org.springframework.http.HttpStatus; + +public class BadRequestException extends AbstractApolloHttpException { + + + public BadRequestException(String str) { + super(str); + setHttpStatus(HttpStatus.BAD_REQUEST); + } +} diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/BeanUtilsException.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/BeanUtilsException.java new file mode 100644 index 0000000000000000000000000000000000000000..c86eeaab0339b15b276623c1e30f5185cc555ffe --- /dev/null +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/BeanUtilsException.java @@ -0,0 +1,9 @@ +package com.ctrip.framework.apollo.common.exception; + +public class BeanUtilsException extends RuntimeException{ + + public BeanUtilsException(Throwable e){ + super(e); + } + +} diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/NotFoundException.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/NotFoundException.java new file mode 100644 index 0000000000000000000000000000000000000000..5d68ea6f9c2581e63e23e75685861b7a0c4bf109 --- /dev/null +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/NotFoundException.java @@ -0,0 +1,12 @@ +package com.ctrip.framework.apollo.common.exception; + +import org.springframework.http.HttpStatus; + +public class NotFoundException extends AbstractApolloHttpException { + + + public NotFoundException(String str) { + super(str); + setHttpStatus(HttpStatus.NOT_FOUND); + } +} diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/ServiceException.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/ServiceException.java new file mode 100644 index 0000000000000000000000000000000000000000..96db0f7c9faff30df40f624949c73666c9660917 --- /dev/null +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/exception/ServiceException.java @@ -0,0 +1,16 @@ +package com.ctrip.framework.apollo.common.exception; + +import org.springframework.http.HttpStatus; + +public class ServiceException extends AbstractApolloHttpException { + + public ServiceException(String str) { + super(str); + setHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR); + } + + public ServiceException(String str, Exception e) { + super(str, e); + setHttpStatus(HttpStatus.INTERNAL_SERVER_ERROR); + } +} diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java index 4bc0c6e7412dc29708e4215e1c987766891a80d5..c2598a848914e874e6a76c4fa48eaa85f4938241 100644 --- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java @@ -1,5 +1,7 @@ package com.ctrip.framework.apollo.common.utils; +import com.ctrip.framework.apollo.common.exception.BeanUtilsException; + import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.util.ArrayList; @@ -51,7 +53,7 @@ public class BeanUtils { try { instance = clazz.newInstance(); } catch (Exception e) { - throw new RuntimeException(e); + throw new BeanUtilsException(e); } org.springframework.beans.BeanUtils.copyProperties(src, instance, getNullPropertyNames(src)); return instance; @@ -95,7 +97,7 @@ public class BeanUtils { map.put((K) field.get(o), (V) o); } } catch (Exception e) { - throw new RuntimeException(); + throw new BeanUtilsException(e); } return map; } @@ -127,7 +129,7 @@ public class BeanUtils { map.get(k).add((V) o); } } catch (Exception e) { - throw new RuntimeException(); + throw new BeanUtilsException(e); } return map; } @@ -155,7 +157,7 @@ public class BeanUtils { set.add((K)field.get(o)); } } catch (Exception e) { - throw new RuntimeException(e); + throw new BeanUtilsException(e); } return set; } @@ -187,7 +189,7 @@ public class BeanUtils { return field.get(obj); } } catch (Exception e) { - // ig + throw new BeanUtilsException(e); } return null; } @@ -203,7 +205,7 @@ public class BeanUtils { field.set(obj, value); } } catch (Exception e) { - // ig + throw new BeanUtilsException(e); } } diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/RequestPrecondition.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/RequestPrecondition.java index 39459731b7120fcdf50c6dcb838c6cb3236999f6..26de753a9fd17bd0714b3883f84b10f24f54a61f 100644 --- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/RequestPrecondition.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/RequestPrecondition.java @@ -1,7 +1,7 @@ package com.ctrip.framework.apollo.common.utils; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.core.utils.StringUtils; diff --git a/apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/NotificationControllerV2.java b/apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/NotificationControllerV2.java index 89970017055db0fcb313ec35dbc8a0f7e8993da3..fbbccb8678db8f2e17a4ef5d9c1b16a1c5522c43 100644 --- a/apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/NotificationControllerV2.java +++ b/apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/NotificationControllerV2.java @@ -21,7 +21,7 @@ import com.ctrip.framework.apollo.configservice.util.NamespaceUtil; import com.ctrip.framework.apollo.configservice.util.WatchKeysUtil; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.dto.ApolloConfigNotification; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.dianping.cat.Cat; import org.slf4j.Logger; diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/AbstractBaseException.java b/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/AbstractBaseException.java deleted file mode 100644 index 19fb88a97515084e60b35ce4f67cfe0a397542f5..0000000000000000000000000000000000000000 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/AbstractBaseException.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.ctrip.framework.apollo.core.exception; - -public abstract class AbstractBaseException extends RuntimeException{ - - /** - * - */ - private static final long serialVersionUID = -1713129594004951820L; - - private String errorCode; - - public AbstractBaseException(){ - - } - - public AbstractBaseException(String str){ - super(str); - } - - public AbstractBaseException(String str, Exception e){ - super(str,e); - } - - public AbstractBaseException(String str, String errorCode){ - super(str); - this.setErrorCode(errorCode); - } - - public String getErrorCode() { - return errorCode; - } - - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } -} diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/BadRequestException.java b/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/BadRequestException.java deleted file mode 100644 index 295b9b475660175d8203faf56f850db352562fcd..0000000000000000000000000000000000000000 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/BadRequestException.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.ctrip.framework.apollo.core.exception; - -public class BadRequestException extends AbstractBaseException { - - /** - * - */ - private static final long serialVersionUID = 6060826407312134068L; - - - public BadRequestException(String str) { - super(str); - } -} diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/NotFoundException.java b/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/NotFoundException.java deleted file mode 100644 index 64f4601d94993538687b6512446834df0f12a414..0000000000000000000000000000000000000000 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/NotFoundException.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.ctrip.framework.apollo.core.exception; - -public class NotFoundException extends AbstractBaseException { - /** - * - */ - private static final long serialVersionUID = 7611357629749481796L; - - - public NotFoundException(String str) { - super(str); - } -} diff --git a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/ServiceException.java b/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/ServiceException.java deleted file mode 100644 index 9fc0af2d23bb0f64756f9eafea98e8bc8c0b5c46..0000000000000000000000000000000000000000 --- a/apollo-core/src/main/java/com/ctrip/framework/apollo/core/exception/ServiceException.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.ctrip.framework.apollo.core.exception; - -public class ServiceException extends AbstractBaseException { - - /** - * - */ - private static final long serialVersionUID = -6529123764065547791L; - - public ServiceException(String str) { - super(str); - } - - public ServiceException(String str, Exception e) { - super(str, e); - } -} diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java index 7c4cccf5660e9d7c0b1cd5362e5e347db5821384..b10e1929b59f572eb86d6b6c20f3c8fc921fcbb8 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/AdminServiceAPI.java @@ -1,16 +1,16 @@ package com.ctrip.framework.apollo.portal.api; -import com.ctrip.framework.apollo.core.dto.AppNamespaceDTO; -import com.ctrip.framework.apollo.core.dto.CommitDTO; -import com.ctrip.framework.apollo.core.dto.NamespaceLockDTO; +import com.ctrip.framework.apollo.common.dto.AppNamespaceDTO; +import com.ctrip.framework.apollo.common.dto.CommitDTO; +import com.ctrip.framework.apollo.common.dto.NamespaceLockDTO; import com.ctrip.framework.apollo.core.enums.Env; -import com.ctrip.framework.apollo.core.dto.AppDTO; -import com.ctrip.framework.apollo.core.dto.ClusterDTO; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.dto.NamespaceDTO; -import com.ctrip.framework.apollo.core.dto.ReleaseDTO; +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 com.ctrip.framework.apollo.common.dto.ReleaseDTO; import org.springframework.boot.actuate.health.Health; import org.springframework.http.HttpEntity; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/RetryableRestTemplate.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/RetryableRestTemplate.java index 833c2ec7f5f43c2181df220a2702e23a9e7ed487..a0875a149de378f229a3caae50b24d89c77d244b 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/RetryableRestTemplate.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/RetryableRestTemplate.java @@ -2,7 +2,7 @@ package com.ctrip.framework.apollo.portal.api; import com.ctrip.framework.apollo.core.dto.ServiceDTO; import com.ctrip.framework.apollo.core.enums.Env; -import com.ctrip.framework.apollo.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.exception.ServiceException; import com.ctrip.framework.apollo.portal.constant.CatEventType; import com.dianping.cat.Cat; import com.dianping.cat.message.Message; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/AppController.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/AppController.java index b6218f553e12f9e90b9a0106d9bdf472b0d3f26a..68b25f6d108fdbe6bfad4f4acbd4456122192a83 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/AppController.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/AppController.java @@ -6,7 +6,7 @@ import com.ctrip.framework.apollo.common.http.MultiResponseEntity; import com.ctrip.framework.apollo.common.http.RichResponseEntity; import com.ctrip.framework.apollo.common.utils.InputValidator; import com.ctrip.framework.apollo.core.enums.Env; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.portal.PortalSettings; import com.ctrip.framework.apollo.portal.entity.po.UserInfo; import com.ctrip.framework.apollo.portal.entity.vo.EnvClusterInfo; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ClusterController.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ClusterController.java index dcdf3d77e9ae2324e2b4b0e490d4e7d1dfd0bcce..9e3f9f1a41b6d8e4065cd74163e2e24c252b7b64 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ClusterController.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ClusterController.java @@ -1,9 +1,9 @@ package com.ctrip.framework.apollo.portal.controller; import com.ctrip.framework.apollo.common.utils.InputValidator; -import com.ctrip.framework.apollo.core.dto.ClusterDTO; +import com.ctrip.framework.apollo.common.dto.ClusterDTO; import com.ctrip.framework.apollo.core.enums.Env; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.portal.auth.UserInfoHolder; import com.ctrip.framework.apollo.portal.service.ClusterService; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/CommitController.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/CommitController.java index 146b446bcd90c9afba3f82e14b3896bd13047bd0..798653b7674f58031312327017155785fb0a66a8 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/CommitController.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/CommitController.java @@ -1,7 +1,7 @@ package com.ctrip.framework.apollo.portal.controller; import com.ctrip.framework.apollo.common.utils.RequestPrecondition; -import com.ctrip.framework.apollo.core.dto.CommitDTO; +import com.ctrip.framework.apollo.common.dto.CommitDTO; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.portal.service.CommitService; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ItemController.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ItemController.java index 5a42b54227b584c315870466cf9563482343ec66..3dda0c662c799e32c8306e28f21558365e4f1215 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ItemController.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ItemController.java @@ -1,8 +1,8 @@ package com.ctrip.framework.apollo.portal.controller; -import com.ctrip.framework.apollo.core.dto.ItemDTO; +import com.ctrip.framework.apollo.common.dto.ItemDTO; import com.ctrip.framework.apollo.core.enums.Env; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.core.utils.StringUtils; import com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs; import com.ctrip.framework.apollo.portal.entity.form.NamespaceSyncModel; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java index 779a58b605432d3a5cc039937f86ffc9880ab1f5..e476f573e8d981efe2801ba1b5403a5342cf42ea 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java @@ -3,10 +3,10 @@ package com.ctrip.framework.apollo.portal.controller; import com.ctrip.framework.apollo.common.entity.App; import com.ctrip.framework.apollo.common.entity.AppNamespace; import com.ctrip.framework.apollo.common.utils.InputValidator; -import com.ctrip.framework.apollo.core.dto.NamespaceDTO; +import com.ctrip.framework.apollo.common.dto.NamespaceDTO; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.core.enums.Env; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.core.utils.StringUtils; import com.ctrip.framework.apollo.portal.auth.UserInfoHolder; import com.ctrip.framework.apollo.portal.entity.form.NamespaceCreationModel; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceLockController.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceLockController.java index 6a4e38f6d7a52a008dd3647c0476f1994885e34e..44482d8a87987be6318024e54a622233fdb21020 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceLockController.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceLockController.java @@ -1,6 +1,6 @@ package com.ctrip.framework.apollo.portal.controller; -import com.ctrip.framework.apollo.core.dto.NamespaceLockDTO; +import com.ctrip.framework.apollo.common.dto.NamespaceLockDTO; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.portal.service.NamespaceLockService; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PermissionController.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PermissionController.java index a14e1bf95e963dd2a25bebc85c80afbe5dafe070..dcf9669f471e091e551466b05cd07f5047c56194 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PermissionController.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/PermissionController.java @@ -2,7 +2,7 @@ package com.ctrip.framework.apollo.portal.controller; import com.google.common.collect.Sets; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.portal.auth.UserInfoHolder; import com.ctrip.framework.apollo.portal.constant.RoleType; import com.ctrip.framework.apollo.portal.entity.po.UserInfo; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ReleaseController.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ReleaseController.java index 8c0f606f1107db215f87f4b33b8c4506173c85e0..1795f48f62e0c6510de15b185269f233a96fc3a9 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ReleaseController.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/ReleaseController.java @@ -1,7 +1,7 @@ package com.ctrip.framework.apollo.portal.controller; import com.ctrip.framework.apollo.common.utils.RequestPrecondition; -import com.ctrip.framework.apollo.core.dto.ReleaseDTO; +import com.ctrip.framework.apollo.common.dto.ReleaseDTO; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.portal.entity.form.NamespaceReleaseModel; import com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceCreationModel.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceCreationModel.java index 1123b57406c1043a07035a1d28637d1e914c2433..5abaac16639eb2857a19538026eb8791cb498bea 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceCreationModel.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceCreationModel.java @@ -1,6 +1,6 @@ package com.ctrip.framework.apollo.portal.entity.form; -import com.ctrip.framework.apollo.core.dto.NamespaceDTO; +import com.ctrip.framework.apollo.common.dto.NamespaceDTO; public class NamespaceCreationModel { diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceSyncModel.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceSyncModel.java index 8658c2eaaa3507328f1c6cb526680d1421b4a119..8bdae71d551d07c2033bc3b24374f45e84fa84ee 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceSyncModel.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/form/NamespaceSyncModel.java @@ -1,6 +1,6 @@ package com.ctrip.framework.apollo.portal.entity.form; -import com.ctrip.framework.apollo.core.dto.ItemDTO; +import com.ctrip.framework.apollo.common.dto.ItemDTO; import com.ctrip.framework.apollo.portal.entity.vo.NamespaceIdentifer; import org.springframework.util.CollectionUtils; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/Change.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/Change.java index 5d85537f49296ef94c6d7468535fc9ede6002868..863aaaa08c9532df6a7fb517bd1dd8aeda6d6cd7 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/Change.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/Change.java @@ -1,5 +1,6 @@ package com.ctrip.framework.apollo.portal.entity.vo; +import com.ctrip.framework.apollo.common.entity.EntityPair; import com.ctrip.framework.apollo.portal.enums.ChangeType; public class Change { @@ -24,8 +25,7 @@ public class Change { return entity; } - public void setEntity( - EntityPair entity) { + public void setEntity(EntityPair entity) { this.entity = entity; } } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/EnvClusterInfo.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/EnvClusterInfo.java index cdd846cbf9c7443abe46e42422f2a85a0f652400..ecb3f232273dc1b1130512b37d64a36aac4ca242 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/EnvClusterInfo.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/EnvClusterInfo.java @@ -1,6 +1,6 @@ package com.ctrip.framework.apollo.portal.entity.vo; -import com.ctrip.framework.apollo.core.dto.ClusterDTO; +import com.ctrip.framework.apollo.common.dto.ClusterDTO; import com.ctrip.framework.apollo.core.enums.Env; import java.util.List; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ItemDiffs.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ItemDiffs.java index 6a3656352698d3ff18d2bbb37469c0bb15e4320a..c30bcc79ce496c4aeede5052704b2259b4ba0368 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ItemDiffs.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ItemDiffs.java @@ -1,6 +1,6 @@ package com.ctrip.framework.apollo.portal.entity.vo; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; +import com.ctrip.framework.apollo.common.dto.ItemChangeSets; public class ItemDiffs { private NamespaceIdentifer namespace; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/NamespaceVO.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/NamespaceVO.java index f75a3f5af1339c79536e552405b8e686433a1439..b45719df2bc4838653fa62cd5fadd81104f559c8 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/NamespaceVO.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/NamespaceVO.java @@ -1,6 +1,6 @@ package com.ctrip.framework.apollo.portal.entity.vo; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.dto.NamespaceDTO; +import com.ctrip.framework.apollo.common.dto.ItemDTO; +import com.ctrip.framework.apollo.common.dto.NamespaceDTO; import java.util.List; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseCompareResult.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseCompareResult.java index bad3377ff0bcce052ecbdddc8017bb875334b6ae..30788c228e9b51f06008f6782bcb1daf7ecc4aa5 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseCompareResult.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseCompareResult.java @@ -1,5 +1,6 @@ package com.ctrip.framework.apollo.portal.entity.vo; +import com.ctrip.framework.apollo.common.entity.EntityPair; import com.ctrip.framework.apollo.portal.enums.ChangeType; import java.util.LinkedList; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseVO.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseVO.java index 01362a25bf9f81492b8919e099267c1eb17093c0..83efc76529d98f221dd26744809d8a9cd6dbe350 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseVO.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseVO.java @@ -1,6 +1,6 @@ package com.ctrip.framework.apollo.portal.entity.vo; -import com.ctrip.framework.apollo.core.dto.ReleaseDTO; +import com.ctrip.framework.apollo.common.dto.ReleaseDTO; import java.util.Set; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/CreationListener.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/CreationListener.java index 9f98387227c8c955dde3bdbb3608b3dcda061d98..ea78c9e493e8eaaa946de91abc06267f775ca684 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/CreationListener.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/listener/CreationListener.java @@ -1,8 +1,8 @@ package com.ctrip.framework.apollo.portal.listener; import com.ctrip.framework.apollo.common.utils.BeanUtils; -import com.ctrip.framework.apollo.core.dto.AppDTO; -import com.ctrip.framework.apollo.core.dto.AppNamespaceDTO; +import com.ctrip.framework.apollo.common.dto.AppDTO; +import com.ctrip.framework.apollo.common.dto.AppNamespaceDTO; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.portal.PortalSettings; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java index 7bfc0af6e4e430b4625d609d832927d984c8d63e..e719efeb6943af68b30d4181a02047ea382f18d1 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppNamespaceService.java @@ -3,8 +3,8 @@ package com.ctrip.framework.apollo.portal.service; import com.ctrip.framework.apollo.common.entity.AppNamespace; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; -import com.ctrip.framework.apollo.core.exception.BadRequestException; -import com.ctrip.framework.apollo.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.ServiceException; import com.ctrip.framework.apollo.portal.auth.UserInfoHolder; import com.ctrip.framework.apollo.portal.repository.AppNamespaceRepository; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppService.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppService.java index bbc8eacacfbfc79eff52793291e36ef71674e23f..b149f04da56af0dec613a820dcaa322129c22df9 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppService.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/AppService.java @@ -15,9 +15,9 @@ import org.springframework.web.client.HttpStatusCodeException; import com.ctrip.framework.apollo.common.entity.App; import com.ctrip.framework.apollo.common.utils.BeanUtils; import com.ctrip.framework.apollo.common.utils.ExceptionUtils; -import com.ctrip.framework.apollo.core.dto.AppDTO; +import com.ctrip.framework.apollo.common.dto.AppDTO; import com.ctrip.framework.apollo.core.enums.Env; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.auth.UserInfoHolder; import com.ctrip.framework.apollo.portal.constant.CatEventType; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java index f029ce4d7e73239ecdb6890dc0472e39782336a0..b322b83d5a016fa3856fb400a5665fa0caefe9a6 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ClusterService.java @@ -1,8 +1,8 @@ package com.ctrip.framework.apollo.portal.service; import com.ctrip.framework.apollo.core.enums.Env; -import com.ctrip.framework.apollo.core.dto.ClusterDTO; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.dto.ClusterDTO; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.constant.CatEventType; import com.dianping.cat.Cat; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/CommitService.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/CommitService.java index ee48676c21bd634b9cee4ef319f3dac62ad92a24..2f9a9814e0ee7cdf2318c3ea7afdb7835aae82ac 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/CommitService.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/CommitService.java @@ -1,6 +1,6 @@ package com.ctrip.framework.apollo.portal.service; -import com.ctrip.framework.apollo.core.dto.CommitDTO; +import com.ctrip.framework.apollo.common.dto.CommitDTO; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigService.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigService.java index b7eb36b93888504d2130d310b0038e46b6e4afb8..9ef03b22956a215d7670963a62a24731122fb91c 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigService.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ConfigService.java @@ -9,18 +9,16 @@ import org.springframework.util.CollectionUtils; import org.springframework.web.client.HttpClientErrorException; import com.ctrip.framework.apollo.common.utils.BeanUtils; -import com.ctrip.framework.apollo.core.dto.ReleaseDTO; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.core.enums.Env; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.dto.NamespaceDTO; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +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 com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.core.utils.StringUtils; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.auth.UserInfoHolder; import com.ctrip.framework.apollo.portal.constant.CatEventType; -import com.ctrip.framework.apollo.portal.entity.form.NamespaceReleaseModel; import com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs; import com.ctrip.framework.apollo.portal.entity.vo.NamespaceIdentifer; import com.ctrip.framework.apollo.portal.entity.form.NamespaceTextModel; @@ -77,7 +75,8 @@ public class ConfigService { changeSets.setDataChangeLastModifiedBy(userInfoHolder.getUser().getUserId()); itemAPI.updateItemsByChangeSet(appId, env, clusterName, namespaceName, changeSets); - Cat.logEvent(CatEventType.MODIFY_NAMESPACE_BY_TEXT, String.format("%s+%s+%s+%s", appId, env, clusterName, namespaceName)); + Cat.logEvent(CatEventType.MODIFY_NAMESPACE_BY_TEXT, + String.format("%s+%s+%s+%s", appId, env, clusterName, namespaceName)); Cat.logEvent(CatEventType.MODIFY_NAMESPACE, String.format("%s+%s+%s+%s", appId, env, clusterName, namespaceName)); } @@ -128,7 +127,7 @@ public class ConfigService { itemAPI.updateItemsByChangeSet(appId, env, clusterName, namespaceName, changeSets); Cat.logEvent(CatEventType.SYNC_NAMESPACE, String.format("%s+%s+%s+%s", appId, env, clusterName, namespaceName)); - } + } } public List compare(List comparedNamespaces, List sourceItems) { @@ -212,7 +211,7 @@ public class ConfigService { private ItemDTO buildItem(long namespaceId, int lineNum, ItemDTO sourceItem) { ItemDTO createdItem = new ItemDTO(); BeanUtils.copyEntityProperties(sourceItem, createdItem); - createdItem.setLineNum(lineNum++); + createdItem.setLineNum(lineNum); createdItem.setNamespaceId(namespaceId); return createdItem; } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceLockService.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceLockService.java index 21f9420c478e6fdd7e9b0cddd8f4f38487288836..2359bb7e7493c456be8e56a90052d9da1cb47f49 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceLockService.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceLockService.java @@ -1,6 +1,6 @@ package com.ctrip.framework.apollo.portal.service; -import com.ctrip.framework.apollo.core.dto.NamespaceLockDTO; +import com.ctrip.framework.apollo.common.dto.NamespaceLockDTO; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceService.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceService.java index f2f21ec0862b8fa119b73cd11c703f3de0d99433..e87b35b45f4ecdac5756dda0456c9a8ab1348eac 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceService.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/NamespaceService.java @@ -4,9 +4,9 @@ import com.google.gson.Gson; import com.ctrip.framework.apollo.common.entity.AppNamespace; import com.ctrip.framework.apollo.common.utils.BeanUtils; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.dto.NamespaceDTO; -import com.ctrip.framework.apollo.core.dto.ReleaseDTO; +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.enums.ConfigFileFormat; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.core.utils.StringUtils; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ReleaseService.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ReleaseService.java index 0b77eee620fb40bd04234e1b1133db4fb9657e29..d5404d0307fce7a1e5ca7ab373b0b7cc6d1c7472 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ReleaseService.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ReleaseService.java @@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.portal.service; import com.google.common.base.Objects; import com.google.gson.Gson; -import com.ctrip.framework.apollo.core.dto.ReleaseDTO; +import com.ctrip.framework.apollo.common.dto.ReleaseDTO; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.auth.UserInfoHolder; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/ConfigTextResolver.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/ConfigTextResolver.java index 47bf755a6456218900d13df84637b2c1693b6da4..ba0c65852a745b9160882c08e783ff4fde71e272 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/ConfigTextResolver.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/ConfigTextResolver.java @@ -1,7 +1,7 @@ package com.ctrip.framework.apollo.portal.service.txtresolver; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; +import com.ctrip.framework.apollo.common.dto.ItemChangeSets; +import com.ctrip.framework.apollo.common.dto.ItemDTO; import java.util.List; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolver.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolver.java index 498e2d778ca7743bda1adb62f9e36fac9b4872e7..0a319812e0da6f52864b4a928ddd7eb736a35c8c 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolver.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolver.java @@ -1,8 +1,8 @@ package com.ctrip.framework.apollo.portal.service.txtresolver; import com.ctrip.framework.apollo.core.ConfigConsts; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; +import com.ctrip.framework.apollo.common.dto.ItemChangeSets; +import com.ctrip.framework.apollo.common.dto.ItemDTO; import com.ctrip.framework.apollo.core.utils.StringUtils; import org.springframework.stereotype.Component; @@ -37,6 +37,7 @@ public class FileTextResolver implements ConfigTextResolver { item.setId(itemId); item.setNamespaceId(namespaceId); item.setValue(value); + item.setLineNum(1); item.setKey(ConfigConsts.CONFIG_FILE_CONTENT_KEY); return item; } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolver.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolver.java index 476a6412fe5fe17fbc04bd6958f35d825d5a03ff..6f6fe095db7125655438b909bd1415fe792d28c8 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolver.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolver.java @@ -1,8 +1,8 @@ package com.ctrip.framework.apollo.portal.service.txtresolver; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.dto.ItemChangeSets; +import com.ctrip.framework.apollo.common.dto.ItemDTO; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.common.utils.BeanUtils; import org.springframework.stereotype.Component; diff --git a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/RetryableRestTemplateTest.java b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/RetryableRestTemplateTest.java index 13378584a6e72ef01b6479989529fe9983d1977d..bc7e097b358ae80b72462b8c36a64c1aed5f62f6 100644 --- a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/RetryableRestTemplateTest.java +++ b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/RetryableRestTemplateTest.java @@ -2,7 +2,7 @@ package com.ctrip.framework.apollo.portal; import com.ctrip.framework.apollo.core.dto.ServiceDTO; import com.ctrip.framework.apollo.core.enums.Env; -import com.ctrip.framework.apollo.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.exception.ServiceException; import com.ctrip.framework.apollo.portal.api.AdminServiceAddressLocator; import com.ctrip.framework.apollo.portal.api.RetryableRestTemplate; diff --git a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/ServiceExceptionTest.java b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/ServiceExceptionTest.java index 33a4c6db05bf64b8d0f41a16bd5807e6d098bed9..124ae18c3311e40e4a029b10b418bc41a56e3172 100644 --- a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/ServiceExceptionTest.java +++ b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/ServiceExceptionTest.java @@ -23,8 +23,8 @@ import org.springframework.web.client.HttpStatusCodeException; import com.ctrip.framework.apollo.common.entity.App; import com.ctrip.framework.apollo.common.utils.ExceptionUtils; -import com.ctrip.framework.apollo.core.dto.AppDTO; -import com.ctrip.framework.apollo.core.exception.ServiceException; +import com.ctrip.framework.apollo.common.dto.AppDTO; +import com.ctrip.framework.apollo.common.exception.ServiceException; import com.ctrip.framework.apollo.portal.controller.AppController; import com.ctrip.framework.apollo.portal.service.UserService; @@ -69,9 +69,8 @@ public class ServiceExceptionTest extends AbstractIntegrationTest { } catch (HttpStatusCodeException e) { @SuppressWarnings("unchecked") Map attr = new Gson().fromJson(e.getResponseBodyAsString(), Map.class); - System.out.println(ExceptionUtils.toString(e)); - Assert.assertEquals("No available admin service", attr.get("message")); - Assert.assertEquals("8848", attr.get("errorCode")); + Assert.assertEquals("500 admin server error", attr.get("message")); + Assert.assertEquals(500.0, attr.get("status")); } } diff --git a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/AppNamespaceServiceTest.java b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/AppNamespaceServiceTest.java index 3a805c9b8b3d8860ba2db0f49ce2f40846320473..bf164de0897a90c4dce8a33e8fa9276830bf161d 100644 --- a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/AppNamespaceServiceTest.java +++ b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/AppNamespaceServiceTest.java @@ -3,7 +3,7 @@ package com.ctrip.framework.apollo.portal.service; import com.ctrip.framework.apollo.common.entity.AppNamespace; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.portal.AbstractIntegrationTest; import org.junit.Assert; diff --git a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/ConfigServiceTest.java b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/ConfigServiceTest.java index 6104b076185ac4fc10c1a1fd220865e296c2da10..042b0cd33ac1a45fba119ede93be6851a49f3e9e 100644 --- a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/ConfigServiceTest.java +++ b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/ConfigServiceTest.java @@ -1,9 +1,9 @@ package com.ctrip.framework.apollo.portal.service; import com.ctrip.framework.apollo.core.ConfigConsts; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.dto.NamespaceDTO; +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 com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; @@ -12,7 +12,6 @@ import com.ctrip.framework.apollo.portal.entity.po.UserInfo; import com.ctrip.framework.apollo.portal.entity.vo.ItemDiffs; import com.ctrip.framework.apollo.portal.entity.vo.NamespaceIdentifer; import com.ctrip.framework.apollo.portal.entity.form.NamespaceTextModel; -import com.ctrip.framework.apollo.portal.service.ConfigService; import com.ctrip.framework.apollo.portal.service.txtresolver.PropertyResolver; import org.junit.Assert; diff --git a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/NamespaceServiceTest.java b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/NamespaceServiceTest.java index fda938c55ca703f5236042eb9e2bd3df6d9474d1..af807e243cfe7600f7d726acac6d4c0b82362ca3 100644 --- a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/NamespaceServiceTest.java +++ b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/NamespaceServiceTest.java @@ -1,9 +1,9 @@ package com.ctrip.framework.apollo.portal.service; import com.ctrip.framework.apollo.common.entity.AppNamespace; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.dto.NamespaceDTO; -import com.ctrip.framework.apollo.core.dto.ReleaseDTO; +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.enums.ConfigFileFormat; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; diff --git a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolverTest.java b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolverTest.java index 03d0d77024d1be99b352e7a85f392ff8ace17b0b..aacb5d94afe4224006d36a9aa4946db0621d64c6 100644 --- a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolverTest.java +++ b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/FileTextResolverTest.java @@ -1,8 +1,8 @@ package com.ctrip.framework.apollo.portal.service.txtresolver; import com.ctrip.framework.apollo.core.ConfigConsts; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; +import com.ctrip.framework.apollo.common.dto.ItemChangeSets; +import com.ctrip.framework.apollo.common.dto.ItemDTO; import com.ctrip.framework.apollo.portal.AbstractUnitTest; import org.junit.Assert; diff --git a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolverTest.java b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolverTest.java index e36a437920d51dd49a7dc45f744b8ad095c33337..c7ec968aedd05471bcc8b72b0776594b3a2dc114 100644 --- a/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolverTest.java +++ b/apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/service/txtresolver/PropertyResolverTest.java @@ -1,9 +1,9 @@ package com.ctrip.framework.apollo.portal.service.txtresolver; -import com.ctrip.framework.apollo.core.dto.ItemChangeSets; -import com.ctrip.framework.apollo.core.dto.ItemDTO; -import com.ctrip.framework.apollo.core.exception.BadRequestException; +import com.ctrip.framework.apollo.common.dto.ItemChangeSets; +import com.ctrip.framework.apollo.common.dto.ItemDTO; +import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.portal.AbstractUnitTest; import org.junit.Assert;