提交 51978dd6 编写于 作者: J Jason Song

Merge pull request #26 from yiming187/rename

Rename Server to Service
......@@ -8,8 +8,8 @@
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apollo-configadmin</artifactId>
<name>Apollo ConfigAdmin</name>
<artifactId>apollo-adminservice</artifactId>
<name>Apollo AdminService</name>
<dependencies>
<!-- apollo -->
<dependency>
......
package com.ctrip.apollo.configadmin;
package com.ctrip.apollo.adminservice;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
......
spring:
application:
name: apollo-configadmin
name: apollo-adminservice
server:
port: ${port:8080}
......@@ -8,5 +8,5 @@ server:
logging:
level:
org.springframework.cloud: 'DEBUG'
file: /opt/logs/apollo-configadmin.log
file: /opt/logs/apollo-adminservice.log
......@@ -8,9 +8,8 @@
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apollo-configserver</artifactId>
<name>Apollo ConfigServer</name>
<packaging>war</packaging>
<artifactId>apollo-configservice</artifactId>
<name>Apollo ConfigService</name>
<dependencies>
<!-- apollo -->
<dependency>
......
package com.ctrip.apollo.configserver.controller;
package com.ctrip.apollo.configservice.controller;
import com.ctrip.apollo.biz.entity.Version;
import com.ctrip.apollo.biz.service.ConfigService;
......
package com.ctrip.apollo.metaserver.controller;
package com.ctrip.apollo.metaservice.controller;
import java.util.List;
......@@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ctrip.apollo.metaserver.service.DiscoveryService;
import com.ctrip.apollo.metaservice.service.DiscoveryService;
import com.netflix.appinfo.InstanceInfo;
@RestController
......@@ -18,12 +18,17 @@ public class ServiceController {
@RequestMapping("/meta")
public List<InstanceInfo> metaServer() {
return discoveryService.getMetaServerServiceInstance();
public List<InstanceInfo> getMetaService() {
return discoveryService.getMetaServiceInstances();
}
@RequestMapping("/config")
public List<InstanceInfo> configServer() {
return discoveryService.getConfigServerServiceInstance();
public List<InstanceInfo> getConfigService() {
return discoveryService.getConfigServiceInstances();
}
@RequestMapping("/admin")
public List<InstanceInfo> getAdminService(){
return discoveryService.getAdminServiceInstances();
}
}
package com.ctrip.apollo.metaserver.service;
package com.ctrip.apollo.metaservice.service;
import java.util.ArrayList;
import java.util.List;
......@@ -17,14 +17,18 @@ public class DiscoveryService {
@Autowired
private EurekaClient eurekaClient;
public List<InstanceInfo> getConfigServerServiceInstance() {
Application application = eurekaClient.getApplication(ServiceIdConsts.APOLLO_CONFIGSERVER);
public List<InstanceInfo> getConfigServiceInstances() {
Application application = eurekaClient.getApplication(ServiceIdConsts.APOLLO_CONFIGSERVICE);
return application != null ? application.getInstances() : new ArrayList<>();
}
public List<InstanceInfo> getMetaServerServiceInstance() {
Application application = eurekaClient.getApplication(ServiceIdConsts.APOLLO_METASERVER);
public List<InstanceInfo> getMetaServiceInstances() {
Application application = eurekaClient.getApplication(ServiceIdConsts.APOLLO_METASERVICE);
return application != null ? application.getInstances() : new ArrayList<>();
}
public List<InstanceInfo> getAdminServiceInstances(){
Application application = eurekaClient.getApplication(ServiceIdConsts.APOLLO_ADMINSERVICE);
return application != null ? application.getInstances() : new ArrayList<>();
}
}
spring:
application:
name: apollo-configserver
name: apollo-configservice
server:
port: ${port:80}
......@@ -8,5 +8,5 @@ server:
logging:
level:
org.springframework.cloud: 'DEBUG'
file: /opt/logs/apollo-configserver.log
file: /opt/logs/apollo-configservice.log
package com.ctrip.apollo.configserver;
package com.ctrip.apollo.configservice;
import com.ctrip.apollo.ServerApplication;
import org.junit.runner.RunWith;
......@@ -7,6 +7,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = ServerApplication.class)
public abstract class AbstractConfigServerTest {
public abstract class AbstractConfigServiceTest {
}
package com.ctrip.apollo.configserver;
package com.ctrip.apollo.configservice;
import com.ctrip.apollo.configserver.controller.ConfigControllerTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
import com.ctrip.apollo.configservice.controller.ConfigControllerTest;
@RunWith(Suite.class)
@SuiteClasses({
ConfigControllerTest.class
......
package com.ctrip.apollo.configserver.controller;
package com.ctrip.apollo.configservice.controller;
import com.ctrip.apollo.biz.entity.Version;
import com.ctrip.apollo.biz.service.ConfigService;
import com.ctrip.apollo.configservice.controller.ConfigController;
import com.ctrip.apollo.core.dto.ApolloConfig;
import org.junit.Before;
import org.junit.Test;
......
......@@ -7,7 +7,7 @@ logging:
spring:
application:
name: apollo-configserver
name: apollo-configservice
datasource:
url: jdbc:h2:file:~/fxapolloconfigdb;DB_CLOSE_ON_EXIT=FALSE
username: sa
......
......@@ -2,9 +2,11 @@ package com.ctrip.apollo.core;
public class ServiceIdConsts {
public static final String APOLLO_METASERVER = "apollo-metaserver";
public static final String APOLLO_METASERVICE = "apollo-metaservice";
public static final String APOLLO_CONFIGSERVER = "apollo-configserver";
public static final String APOLLO_CONFIGSERVICE = "apollo-configservice";
public static final String APOLLO_ADMINSERVICE = "apollo-adminservice";
public static final String APOLLO_PORTAL = "apollo-portal";
}
......@@ -67,8 +67,8 @@
<module>apollo-core</module>
<module>apollo-client</module>
<module>apollo-biz</module>
<module>apollo-configserver</module>
<module>apollo-configadmin</module>
<module>apollo-configservice</module>
<module>apollo-adminservice</module>
<module>apollo-portal</module>
<module>apollo-demo</module>
</modules>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册