Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apollo
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
apollo
Commits
3a2f6f72
Commit
3a2f6f72
authored
May 13, 2016
by
Yiming Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate all server side components into one application
parent
2e76a342
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
311 additions
and
86 deletions
+311
-86
apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/AdminServiceApplication.java
...om/ctrip/apollo/adminservice/AdminServiceApplication.java
+29
-0
apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/AppNamespaceController.java
...pollo/adminservice/controller/AppNamespaceController.java
+0
-1
apollo-adminservice/src/main/resources/adminservice.properties
...o-adminservice/src/main/resources/adminservice.properties
+4
-0
apollo-adminservice/src/main/resources/application.yml
apollo-adminservice/src/main/resources/application.yml
+0
-16
apollo-adminservice/src/test/java/com/ctrip/apollo/AdminServiceTestConfiguration.java
.../java/com/ctrip/apollo/AdminServiceTestConfiguration.java
+2
-0
apollo-adminservice/src/test/java/com/ctrip/apollo/adminservice/controller/AbstractControllerTest.java
...pollo/adminservice/controller/AbstractControllerTest.java
+8
-2
apollo-adminservice/src/test/java/com/ctrip/apollo/adminservice/controller/ItemSetControllerTest.java
...apollo/adminservice/controller/ItemSetControllerTest.java
+18
-12
apollo-assembly/pom.xml
apollo-assembly/pom.xml
+65
-0
apollo-assembly/src/main/java/com/ctrip/apollo/assembly/ApolloApplication.java
...ain/java/com/ctrip/apollo/assembly/ApolloApplication.java
+63
-0
apollo-assembly/src/main/resources/application.yml
apollo-assembly/src/main/resources/application.yml
+8
-0
apollo-assembly/src/main/resources/logback.xml
apollo-assembly/src/main/resources/logback.xml
+10
-0
apollo-biz/src/main/java/com/ctrip/apollo/biz/ApolloBizConfig.java
...z/src/main/java/com/ctrip/apollo/biz/ApolloBizConfig.java
+12
-0
apollo-biz/src/main/java/com/ctrip/apollo/biz/eureka/ApolloEurekaClientConfig.java
...com/ctrip/apollo/biz/eureka/ApolloEurekaClientConfig.java
+2
-0
apollo-common/src/main/java/com/ctrip/apollo/common/ApolloCommonConfig.java
...main/java/com/ctrip/apollo/common/ApolloCommonConfig.java
+12
-0
apollo-configservice/src/main/java/com/ctrip/apollo/configservice/ConfigServiceApplication.java
.../ctrip/apollo/configservice/ConfigServiceApplication.java
+12
-3
apollo-configservice/src/main/java/com/ctrip/apollo/configservice/ServletInitializer.java
...va/com/ctrip/apollo/configservice/ServletInitializer.java
+1
-1
apollo-configservice/src/main/resources/configservice.properties
...configservice/src/main/resources/configservice.properties
+4
-0
apollo-configservice/src/test/java/com/ctrip/apollo/ConfigServiceTestConfiguration.java
...java/com/ctrip/apollo/ConfigServiceTestConfiguration.java
+1
-0
apollo-portal/src/main/java/com/ctrip/apollo/portal/PortalApplication.java
.../main/java/com/ctrip/apollo/portal/PortalApplication.java
+10
-3
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/PortalAppController.java
...m/ctrip/apollo/portal/controller/PortalAppController.java
+3
-3
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/PortalConfigController.java
...trip/apollo/portal/controller/PortalConfigController.java
+3
-3
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/PortalEnvController.java
...m/ctrip/apollo/portal/controller/PortalEnvController.java
+1
-1
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/PortalNamespaceController.java
...p/apollo/portal/controller/PortalNamespaceController.java
+3
-3
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/PortalAppService.java
...ava/com/ctrip/apollo/portal/service/PortalAppService.java
+5
-4
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/PortalClusterService.java
...com/ctrip/apollo/portal/service/PortalClusterService.java
+1
-1
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/PortalConfigService.java
.../com/ctrip/apollo/portal/service/PortalConfigService.java
+2
-2
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/PortalNamespaceService.java
...m/ctrip/apollo/portal/service/PortalNamespaceService.java
+2
-2
apollo-portal/src/main/resources/application.yml
apollo-portal/src/main/resources/application.yml
+0
-20
apollo-portal/src/main/resources/portal.properties
apollo-portal/src/main/resources/portal.properties
+5
-0
apollo-portal/src/test/java/com/ctrip/apollo/portal/AbstractPortalTest.java
...test/java/com/ctrip/apollo/portal/AbstractPortalTest.java
+1
-1
apollo-portal/src/test/java/com/ctrip/apollo/portal/ConfigServiceTest.java
.../test/java/com/ctrip/apollo/portal/ConfigServiceTest.java
+2
-2
apollo-portal/src/test/java/com/ctrip/apollo/portal/NamespaceServiceTest.java
...st/java/com/ctrip/apollo/portal/NamespaceServiceTest.java
+2
-2
apollo-portal/src/test/java/com/ctrip/apollo/portal/ServiceExceptionTest.java
...st/java/com/ctrip/apollo/portal/ServiceExceptionTest.java
+2
-2
pom.xml
pom.xml
+18
-2
No files found.
apollo-adminservice/src/main/java/com/ctrip/apollo/AdminServiceApplication.java
→
apollo-adminservice/src/main/java/com/ctrip/apollo/
adminservice/
AdminServiceApplication.java
View file @
3a2f6f72
package
com
.
ctrip
.
apollo
;
package
com
.
ctrip
.
apollo
.
adminservice
;
import
org.springframework.boot.actuate.system.ApplicationPidFileWriter
;
import
org.springframework.boot.actuate.system.EmbeddedServerPortFileWriter
;
import
org.springframework.boot.autoconfigure.
SpringBootApplic
ation
;
import
org.springframework.boot.autoconfigure.
EnableAutoConfigur
ation
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.cloud.netflix.eureka.EnableEurekaClient
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.context.annotation.PropertySource
;
@SpringBootApplication
@EnableEurekaClient
@EnableAspectJAutoProxy
@EnableEurekaClient
@Configuration
@PropertySource
(
value
=
{
"classpath:adminservice.properties"
})
@EnableAutoConfiguration
@ComponentScan
(
basePackageClasses
=
{
com
.
ctrip
.
apollo
.
common
.
ApolloCommonConfig
.
class
,
com
.
ctrip
.
apollo
.
biz
.
ApolloBizConfig
.
class
,
com
.
ctrip
.
apollo
.
adminservice
.
AdminServiceApplication
.
class
})
public
class
AdminServiceApplication
{
public
static
void
main
(
String
[]
args
)
{
ConfigurableApplicationContext
context
=
new
SpringApplicationBuilder
(
AdminServiceApplication
.
class
).
run
(
args
);
ConfigurableApplicationContext
context
=
new
SpringApplicationBuilder
(
AdminServiceApplication
.
class
).
run
(
args
);
context
.
addApplicationListener
(
new
ApplicationPidFileWriter
());
context
.
addApplicationListener
(
new
EmbeddedServerPortFileWriter
());
}
...
...
apollo-adminservice/src/main/java/com/ctrip/apollo/adminservice/controller/AppNamespaceController.java
View file @
3a2f6f72
package
com
.
ctrip
.
apollo
.
adminservice
.
controller
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
apollo-adminservice/src/main/resources/adminservice.properties
0 → 100644
View file @
3a2f6f72
spring.application.name
=
apollo-adminservice
ctrip.appid
=
100003172
server.port
=
8090
logging.file
=
/opt/logs/100003172/apollo-adminservice.log
\ No newline at end of file
apollo-adminservice/src/main/resources/application.yml
deleted
100644 → 0
View file @
2e76a342
spring
:
application
:
name
:
apollo-adminservice
profiles
:
active
:
ctrip
server
:
port
:
${port:8090}
logging
:
level
:
org.springframework.cloud
:
'
DEBUG'
file
:
/opt/logs/${ctrip.appid}/apollo-adminservice.log
ctrip
:
appid
:
100003172
apollo-adminservice/src/test/java/com/ctrip/apollo/AdminServiceTestConfiguration.java
View file @
3a2f6f72
...
...
@@ -8,6 +8,8 @@ import org.springframework.context.annotation.ComponentScan.Filter;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.FilterType
;
import
com.ctrip.apollo.adminservice.AdminServiceApplication
;
@Configuration
@ComponentScan
(
excludeFilters
=
{
@Filter
(
type
=
FilterType
.
ASSIGNABLE_TYPE
,
value
=
{
SampleAdminServiceApplication
.
class
,
AdminServiceApplication
.
class
,
...
...
apollo-adminservice/src/test/java/com/ctrip/apollo/adminservice/controller/AbstractControllerTest.java
View file @
3a2f6f72
package
com
.
ctrip
.
apollo
.
adminservice
.
controller
;
import
com.ctrip.apollo.AdminServiceTestConfiguration
;
import
javax.annotation.PostConstruct
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.web.HttpMessageConverters
;
import
org.springframework.boot.test.SpringApplicationConfiguration
;
import
org.springframework.boot.test.TestRestTemplate
;
import
org.springframework.boot.test.WebIntegrationTest
;
...
...
@@ -11,18 +13,22 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import
org.springframework.web.client.DefaultResponseErrorHandler
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.PostConstruct
;
import
com.ctrip.apollo.AdminServiceTestConfiguration
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringApplicationConfiguration
(
classes
=
AdminServiceTestConfiguration
.
class
)
@WebIntegrationTest
(
randomPort
=
true
)
public
abstract
class
AbstractControllerTest
{
@Autowired
private
HttpMessageConverters
httpMessageConverters
;
RestTemplate
restTemplate
=
new
TestRestTemplate
(
"apollo"
,
""
);
@PostConstruct
private
void
postConstruct
()
{
restTemplate
.
setErrorHandler
(
new
DefaultResponseErrorHandler
());
restTemplate
.
setMessageConverters
(
httpMessageConverters
.
getConverters
());
}
@Value
(
"${local.server.port}"
)
...
...
apollo-adminservice/src/test/java/com/ctrip/apollo/adminservice/controller/ItemSetControllerTest.java
View file @
3a2f6f72
...
...
@@ -10,6 +10,7 @@ import org.springframework.http.HttpStatus;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.test.context.jdbc.Sql
;
import
org.springframework.test.context.jdbc.Sql.ExecutionPhase
;
import
org.springframework.web.client.RestTemplate
;
import
com.ctrip.apollo.biz.entity.Item
;
import
com.ctrip.apollo.biz.repository.ItemRepository
;
...
...
@@ -45,8 +46,9 @@ public class ItemSetControllerTest extends AbstractControllerTest {
Assert
.
assertEquals
(
"application"
,
namespace
.
getNamespaceName
());
ItemChangeSets
itemSet
=
new
ItemChangeSets
();
restTemplate
=
new
TestRestTemplate
(
"created"
,
""
);
RestTemplate
createdTemplate
=
new
TestRestTemplate
(
"created"
,
""
);
createdTemplate
.
setMessageConverters
(
restTemplate
.
getMessageConverters
());
int
createdSize
=
3
;
for
(
int
i
=
0
;
i
<
createdSize
;
i
++)
{
ItemDTO
item
=
new
ItemDTO
();
...
...
@@ -57,7 +59,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
}
ResponseEntity
<
Void
>
response
=
rest
Template
.
postForEntity
(
created
Template
.
postForEntity
(
"http://localhost:"
+
port
+
"/apps/"
+
app
.
getAppId
()
+
"/clusters/"
+
cluster
.
getName
()
+
"/namespaces/"
+
namespace
.
getNamespaceName
()
+
"/itemset"
,
itemSet
,
Void
.
class
);
...
...
@@ -92,7 +94,8 @@ public class ItemSetControllerTest extends AbstractControllerTest {
Assert
.
assertEquals
(
"application"
,
namespace
.
getNamespaceName
());
ItemChangeSets
createChangeSet
=
new
ItemChangeSets
();
restTemplate
=
new
TestRestTemplate
(
"created"
,
""
);
RestTemplate
createdRestTemplate
=
new
TestRestTemplate
(
"created"
,
""
);
createdRestTemplate
.
setMessageConverters
(
restTemplate
.
getMessageConverters
());
int
createdSize
=
3
;
for
(
int
i
=
0
;
i
<
createdSize
;
i
++)
{
...
...
@@ -103,20 +106,21 @@ public class ItemSetControllerTest extends AbstractControllerTest {
createChangeSet
.
addCreateItem
(
item
);
}
ResponseEntity
<
Void
>
response
=
r
estTemplate
.
postForEntity
(
ResponseEntity
<
Void
>
response
=
createdR
estTemplate
.
postForEntity
(
"http://localhost:"
+
port
+
"/apps/"
+
app
.
getAppId
()
+
"/clusters/"
+
cluster
.
getName
()
+
"/namespaces/"
+
namespace
.
getNamespaceName
()
+
"/itemset"
,
createChangeSet
,
Void
.
class
);
Assert
.
assertEquals
(
HttpStatus
.
OK
,
response
.
getStatusCode
());
ItemDTO
[]
items
=
r
estTemplate
.
getForObject
(
createdR
estTemplate
.
getForObject
(
"http://localhost:"
+
port
+
"/apps/"
+
app
.
getAppId
()
+
"/clusters/"
+
cluster
.
getName
()
+
"/namespaces/"
+
namespace
.
getNamespaceName
()
+
"/items"
,
ItemDTO
[].
class
);
ItemChangeSets
udpateChangeSet
=
new
ItemChangeSets
();
restTemplate
=
new
TestRestTemplate
(
"updated"
,
""
);
RestTemplate
updatedRestTemplate
=
new
TestRestTemplate
(
"updated"
,
""
);
updatedRestTemplate
.
setMessageConverters
(
restTemplate
.
getMessageConverters
());
int
updatedSize
=
2
;
for
(
int
i
=
0
;
i
<
updatedSize
;
i
++)
{
...
...
@@ -124,7 +128,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
udpateChangeSet
.
addUpdateItem
(
items
[
i
]);
}
response
=
r
estTemplate
.
postForEntity
(
response
=
updatedR
estTemplate
.
postForEntity
(
"http://localhost:"
+
port
+
"/apps/"
+
app
.
getAppId
()
+
"/clusters/"
+
cluster
.
getName
()
+
"/namespaces/"
+
namespace
.
getNamespaceName
()
+
"/itemset"
,
udpateChangeSet
,
Void
.
class
);
...
...
@@ -161,7 +165,8 @@ public class ItemSetControllerTest extends AbstractControllerTest {
Assert
.
assertEquals
(
"application"
,
namespace
.
getNamespaceName
());
ItemChangeSets
createChangeSet
=
new
ItemChangeSets
();
restTemplate
=
new
TestRestTemplate
(
"created"
,
""
);
RestTemplate
createdTemplate
=
new
TestRestTemplate
(
"created"
,
""
);
createdTemplate
.
setMessageConverters
(
restTemplate
.
getMessageConverters
());
int
createdSize
=
3
;
for
(
int
i
=
0
;
i
<
createdSize
;
i
++)
{
...
...
@@ -172,7 +177,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
createChangeSet
.
addCreateItem
(
item
);
}
ResponseEntity
<
Void
>
response
=
rest
Template
.
postForEntity
(
ResponseEntity
<
Void
>
response
=
created
Template
.
postForEntity
(
"http://localhost:"
+
port
+
"/apps/"
+
app
.
getAppId
()
+
"/clusters/"
+
cluster
.
getName
()
+
"/namespaces/"
+
namespace
.
getNamespaceName
()
+
"/itemset"
,
createChangeSet
,
Void
.
class
);
...
...
@@ -185,7 +190,8 @@ public class ItemSetControllerTest extends AbstractControllerTest {
ItemDTO
[].
class
);
ItemChangeSets
deleteChangeSet
=
new
ItemChangeSets
();
restTemplate
=
new
TestRestTemplate
(
"deleted"
,
""
);
RestTemplate
deletedTemplate
=
new
TestRestTemplate
(
"deleted"
,
""
);
deletedTemplate
.
setMessageConverters
(
restTemplate
.
getMessageConverters
());
int
deletedSize
=
1
;
for
(
int
i
=
0
;
i
<
deletedSize
;
i
++)
{
...
...
@@ -193,7 +199,7 @@ public class ItemSetControllerTest extends AbstractControllerTest {
deleteChangeSet
.
addDeleteItem
(
items
[
i
]);
}
response
=
rest
Template
.
postForEntity
(
response
=
deleted
Template
.
postForEntity
(
"http://localhost:"
+
port
+
"/apps/"
+
app
.
getAppId
()
+
"/clusters/"
+
cluster
.
getName
()
+
"/namespaces/"
+
namespace
.
getNamespaceName
()
+
"/itemset"
,
deleteChangeSet
,
Void
.
class
);
...
...
apollo-assembly/pom.xml
0 → 100644
View file @
3a2f6f72
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
>
<parent>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo
</artifactId>
<version>
0.0.1-SNAPSHOT
</version>
<relativePath>
../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
apollo-assembly
</artifactId>
<name>
Apollo Assembly
</name>
<properties>
<github.path>
${project.artifactId}
</github.path>
</properties>
<dependencies>
<!-- apollo -->
<dependency>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo-configservice
</artifactId>
</dependency>
<dependency>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo-adminservice
</artifactId>
</dependency>
<dependency>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo-portal
</artifactId>
</dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<executable>
true
</executable>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<executions>
<execution>
<phase>
package
</phase>
<goals>
<goal>
single
</goal>
</goals>
<configuration>
<finalName>
${project.artifactId}-${project.version}-${package.environment}
</finalName>
<appendAssemblyId>
false
</appendAssemblyId>
<descriptors>
<descriptor>
src/assembly/assembly-descriptor.xml
</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
apollo-assembly/src/main/java/com/ctrip/apollo/assembly/ApolloApplication.java
0 → 100644
View file @
3a2f6f72
package
com
.
ctrip
.
apollo
.
assembly
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.actuate.system.ApplicationPidFileWriter
;
import
org.springframework.boot.actuate.system.EmbeddedServerPortFileWriter
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
import
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.cloud.context.scope.refresh.RefreshScope
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
com.ctrip.apollo.adminservice.AdminServiceApplication
;
import
com.ctrip.apollo.configservice.ConfigServiceApplication
;
import
com.ctrip.apollo.portal.PortalApplication
;
@SpringBootApplication
(
exclude
=
{
DataSourceAutoConfiguration
.
class
,
HibernateJpaAutoConfiguration
.
class
})
public
class
ApolloApplication
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ApolloApplication
.
class
);
public
static
void
main
(
String
[]
args
)
throws
Exception
{
/**
* Common
*/
ConfigurableApplicationContext
commonContext
=
new
SpringApplicationBuilder
(
ApolloApplication
.
class
).
web
(
false
).
run
(
args
);
commonContext
.
addApplicationListener
(
new
ApplicationPidFileWriter
());
logger
.
info
(
commonContext
.
getId
()
+
" isActive: "
+
commonContext
.
isActive
());
/**
* ConfigService
*/
if
(
commonContext
.
getEnvironment
().
containsProperty
(
"configservice"
))
{
ConfigurableApplicationContext
configContext
=
new
SpringApplicationBuilder
(
ConfigServiceApplication
.
class
).
parent
(
commonContext
)
.
sources
(
RefreshScope
.
class
).
run
(
args
);
logger
.
info
(
configContext
.
getId
()
+
" isActive: "
+
configContext
.
isActive
());
}
/**
* AdminService
*/
if
(
commonContext
.
getEnvironment
().
containsProperty
(
"adminservice"
))
{
ConfigurableApplicationContext
adminContext
=
new
SpringApplicationBuilder
(
AdminServiceApplication
.
class
).
parent
(
commonContext
)
.
sources
(
RefreshScope
.
class
).
run
(
args
);
logger
.
info
(
adminContext
.
getId
()
+
" isActive: "
+
adminContext
.
isActive
());
}
/**
* Portal
*/
if
(
commonContext
.
getEnvironment
().
containsProperty
(
"portal"
))
{
ConfigurableApplicationContext
portalContext
=
new
SpringApplicationBuilder
(
PortalApplication
.
class
).
parent
(
commonContext
).
run
(
args
);
logger
.
info
(
portalContext
.
getId
()
+
" isActive: "
+
portalContext
.
isActive
());
}
}
}
apollo-
configservice
/src/main/resources/application.yml
→
apollo-
assembly
/src/main/resources/application.yml
View file @
3a2f6f72
spring
:
application
:
name
:
apollo-configservice
profiles
:
active
:
ctrip
server
:
port
:
${port:8080}
logging
:
level
:
org.springframework.cloud
:
'
DEBUG'
file
:
/opt/logs/${ctrip.appid}/apollo-configservice.log
ctrip
:
appid
:
100003171
\ No newline at end of file
file
:
/opt/logs/100003171/apollo-assembly.log
\ No newline at end of file
apollo-assembly/src/main/resources/logback.xml
0 → 100644
View file @
3a2f6f72
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include
resource=
"org/springframework/boot/logging/logback/defaults.xml"
/>
<property
name=
"LOG_FILE"
value=
"${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}apollo-assembly.log}"
/>
<include
resource=
"org/springframework/boot/logging/logback/file-appender.xml"
/>
<root
level=
"INFO"
>
<appender-ref
ref=
"FILE"
/>
</root>
</configuration>
\ No newline at end of file
apollo-biz/src/main/java/com/ctrip/apollo/biz/ApolloBizConfig.java
0 → 100644
View file @
3a2f6f72
package
com
.
ctrip
.
apollo
.
biz
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
@EnableAutoConfiguration
@Configuration
@ComponentScan
(
basePackageClasses
=
com
.
ctrip
.
apollo
.
biz
.
ApolloBizConfig
.
class
)
public
class
ApolloBizConfig
{
}
apollo-biz/src/main/java/com/ctrip/apollo/biz/eureka/ApolloEurekaClientConfig.java
View file @
3a2f6f72
...
...
@@ -8,6 +8,7 @@ import com.ctrip.apollo.biz.repository.ServerConfigRepository;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cloud.netflix.eureka.EurekaClientConfigBean
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.core.env.Environment
;
import
org.springframework.stereotype.Component
;
...
...
@@ -15,6 +16,7 @@ import java.util.List;
import
java.util.Objects
;
@Component
@Primary
public
class
ApolloEurekaClientConfig
extends
EurekaClientConfigBean
{
static
final
String
EUREKA_URL_CONFIG
=
"eureka.service.url"
;
private
static
final
Splitter
URL_SPLITTER
=
Splitter
.
on
(
","
).
omitEmptyStrings
();
...
...
apollo-common/src/main/java/com/ctrip/apollo/common/ApolloCommonConfig.java
0 → 100644
View file @
3a2f6f72
package
com
.
ctrip
.
apollo
.
common
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
@EnableAutoConfiguration
@Configuration
@ComponentScan
(
basePackageClasses
=
com
.
ctrip
.
apollo
.
common
.
ApolloCommonConfig
.
class
)
public
class
ApolloCommonConfig
{
}
apollo-configservice/src/main/java/com/ctrip/apollo/ConfigServiceApplication.java
→
apollo-configservice/src/main/java/com/ctrip/apollo/
configservice/
ConfigServiceApplication.java
View file @
3a2f6f72
package
com
.
ctrip
.
apollo
;
package
com
.
ctrip
.
apollo
.
configservice
;
import
org.springframework.boot.actuate.system.ApplicationPidFileWriter
;
import
org.springframework.boot.actuate.system.EmbeddedServerPortFileWriter
;
import
org.springframework.boot.autoconfigure.
SpringBootApplic
ation
;
import
org.springframework.boot.autoconfigure.
EnableAutoConfigur
ation
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.cloud.netflix.eureka.server.EnableEurekaServer
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.annotation.EnableAspectJAutoProxy
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.PropertySource
;
/**
* Spring boot application entry point
*
* @author Jason Song(song_s@ctrip.com)
*/
@SpringBootApplication
@EnableEurekaServer
@EnableAspectJAutoProxy
@EnableAutoConfiguration
//(exclude = EurekaClientConfigBean.class)
@Configuration
@PropertySource
(
value
=
{
"classpath:configservice.properties"
})
@ComponentScan
(
basePackageClasses
=
{
com
.
ctrip
.
apollo
.
common
.
ApolloCommonConfig
.
class
,
com
.
ctrip
.
apollo
.
biz
.
ApolloBizConfig
.
class
,
com
.
ctrip
.
apollo
.
configservice
.
ConfigServiceApplication
.
class
})
public
class
ConfigServiceApplication
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
...
...
apollo-configservice/src/main/java/com/ctrip/apollo/ServletInitializer.java
→
apollo-configservice/src/main/java/com/ctrip/apollo/
configservice/
ServletInitializer.java
View file @
3a2f6f72
package
com
.
ctrip
.
apollo
;
package
com
.
ctrip
.
apollo
.
configservice
;
import
org.springframework.boot.builder.SpringApplicationBuilder
;
import
org.springframework.boot.context.web.SpringBootServletInitializer
;
...
...
apollo-configservice/src/main/resources/configservice.properties
0 → 100644
View file @
3a2f6f72
spring.application.name
=
apollo-configservice
ctrip.appid
=
100003171
server.port
=
8080
logging.file
=
/opt/logs/100003171/apollo-configservice.log
\ No newline at end of file
apollo-configservice/src/test/java/com/ctrip/apollo/ConfigServiceTestConfiguration.java
View file @
3a2f6f72
package
com
.
ctrip
.
apollo
;
import
com.ctrip.apollo.common.controller.WebSecurityConfig
;
import
com.ctrip.apollo.configservice.ConfigServiceApplication
;
import
org.springframework.boot.autoconfigure.EnableAutoConfiguration
;
import
org.springframework.context.annotation.ComponentScan
;
...
...
apollo-portal/src/main/java/com/ctrip/apollo/PortalApplication.java
→
apollo-portal/src/main/java/com/ctrip/apollo/
portal/
PortalApplication.java
View file @
3a2f6f72
package
com
.
ctrip
.
apollo
;
package
com
.
ctrip
.
apollo
.
portal
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.actuate.system.ApplicationPidFileWriter
;
import
org.springframework.boot.actuate.system.EmbeddedServerPortFileWriter
;
import
org.springframework.boot.autoconfigure.
SpringBootApplic
ation
;
import
org.springframework.boot.autoconfigure.
EnableAutoConfigur
ation
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.PropertySource
;
@SpringBootApplication
@EnableAutoConfiguration
@Configuration
@PropertySource
(
value
=
{
"classpath:portal.properties"
})
@ComponentScan
(
basePackageClasses
=
{
com
.
ctrip
.
apollo
.
common
.
ApolloCommonConfig
.
class
,
com
.
ctrip
.
apollo
.
portal
.
PortalApplication
.
class
})
public
class
PortalApplication
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/AppController.java
→
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/
Portal
AppController.java
View file @
3a2f6f72
...
...
@@ -18,16 +18,16 @@ import com.ctrip.apollo.core.exception.BadRequestException;
import
com.ctrip.apollo.core.utils.StringUtils
;
import
com.ctrip.apollo.portal.PortalSettings
;
import
com.ctrip.apollo.portal.entity.EnvClusterInfo
;
import
com.ctrip.apollo.portal.service.AppService
;
import
com.ctrip.apollo.portal.service.
Portal
AppService
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/apps"
)
public
class
AppController
{
public
class
Portal
AppController
{
@Autowired
private
AppService
appService
;
private
Portal
AppService
appService
;
@Autowired
private
PortalSettings
portalSettings
;
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/ConfigController.java
→
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/
Portal
ConfigController.java
View file @
3a2f6f72
...
...
@@ -10,7 +10,7 @@ import com.ctrip.apollo.portal.entity.ItemDiffs;
import
com.ctrip.apollo.portal.entity.form.NamespaceSyncModel
;
import
com.ctrip.apollo.portal.entity.form.NamespaceTextModel
;
import
com.ctrip.apollo.portal.entity.form.NamespaceReleaseModel
;
import
com.ctrip.apollo.portal.service.ConfigService
;
import
com.ctrip.apollo.portal.service.
Portal
ConfigService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpStatus
;
...
...
@@ -25,10 +25,10 @@ import java.util.List;
@RestController
@RequestMapping
(
""
)
public
class
ConfigController
{
public
class
Portal
ConfigController
{
@Autowired
private
ConfigService
configService
;
private
Portal
ConfigService
configService
;
@RequestMapping
(
value
=
"/apps/{appId}/env/{env}/clusters/{clusterName}/namespaces/{namespaceName}/items"
,
method
=
RequestMethod
.
PUT
,
consumes
=
{
"application/json"
})
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/EnvController.java
→
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/
Portal
EnvController.java
View file @
3a2f6f72
...
...
@@ -12,7 +12,7 @@ import java.util.List;
@RestController
@RequestMapping
(
"/envs"
)
public
class
EnvController
{
public
class
Portal
EnvController
{
@Autowired
private
PortalSettings
portalSettings
;
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/NamespaceController.java
→
apollo-portal/src/main/java/com/ctrip/apollo/portal/controller/
Portal
NamespaceController.java
View file @
3a2f6f72
...
...
@@ -6,7 +6,7 @@ import com.ctrip.apollo.core.enums.Env;
import
com.ctrip.apollo.core.exception.BadRequestException
;
import
com.ctrip.apollo.core.utils.StringUtils
;
import
com.ctrip.apollo.portal.entity.NamespaceVO
;
import
com.ctrip.apollo.portal.service.NamespaceService
;
import
com.ctrip.apollo.portal.service.
Portal
NamespaceService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PathVariable
;
...
...
@@ -18,10 +18,10 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.List
;
@RestController
public
class
NamespaceController
{
public
class
Portal
NamespaceController
{
@Autowired
private
NamespaceService
namespaceService
;
private
Portal
NamespaceService
namespaceService
;
@RequestMapping
(
"/appnamespaces/public"
)
public
List
<
AppNamespaceDTO
>
findPublicAppNamespaces
(){
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/AppService.java
→
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/
Portal
AppService.java
View file @
3a2f6f72
...
...
@@ -20,9 +20,12 @@ import com.ctrip.apollo.portal.api.AdminServiceAPI;
import
com.ctrip.apollo.portal.entity.EnvClusterInfo
;
@Service
public
class
AppService
{
public
class
Portal
AppService
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
AppService
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
PortalAppService
.
class
);
@Autowired
private
PortalClusterService
clusterService
;
@Autowired
private
PortalSettings
portalSettings
;
...
...
@@ -30,8 +33,6 @@ public class AppService {
@Autowired
private
AdminServiceAPI
.
AppAPI
appAPI
;
@Autowired
ClusterService
clusterService
;
public
List
<
AppDTO
>
findAll
(
Env
env
)
{
return
appAPI
.
findApps
(
env
);
}
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/ClusterService.java
→
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/
Portal
ClusterService.java
View file @
3a2f6f72
...
...
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Service;
import
java.util.List
;
@Service
public
class
ClusterService
{
public
class
Portal
ClusterService
{
@Autowired
private
AdminServiceAPI
.
ClusterAPI
clusterAPI
;
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/ConfigService.java
→
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/
Portal
ConfigService.java
View file @
3a2f6f72
...
...
@@ -36,9 +36,9 @@ import java.util.List;
import
java.util.Map
;
@Service
public
class
ConfigService
{
public
class
Portal
ConfigService
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
ConfigService
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
Portal
ConfigService
.
class
);
@Autowired
private
AdminServiceAPI
.
NamespaceAPI
namespaceAPI
;
...
...
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/NamespaceService.java
→
apollo-portal/src/main/java/com/ctrip/apollo/portal/service/
Portal
NamespaceService.java
View file @
3a2f6f72
...
...
@@ -28,9 +28,9 @@ import java.util.List;
import
java.util.Map
;
@Service
public
class
NamespaceService
{
public
class
Portal
NamespaceService
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
NamespaceService
.
class
);
private
Logger
logger
=
LoggerFactory
.
getLogger
(
Portal
NamespaceService
.
class
);
@Autowired
private
AdminServiceAPI
.
ItemAPI
itemAPI
;
...
...
apollo-portal/src/main/resources/application.yml
deleted
100644 → 0
View file @
2e76a342
server
:
port
:
8070
spring
:
application
:
name
:
apollo-portal
profiles
:
active
:
ctrip
logging
:
level
:
org.springframework.cloud
:
'
DEBUG'
file
:
/opt/logs/${ctrip.appid}/apollo-portal.log
ctrip
:
appid
:
100003173
apollo
:
portal
:
env
:
dev,fat,uat
apollo-portal/src/main/resources/portal.properties
0 → 100644
View file @
3a2f6f72
spring.application.name
=
apollo-portal
apollo.portal.env
=
dev,fat,uat
ctrip.appid
=
100003173
server.port
=
8070
logging.file
=
/opt/logs/100003173/apollo-portal.log
\ No newline at end of file
apollo-portal/src/test/java/com/ctrip/apollo/portal/AbstractPortalTest.java
View file @
3a2f6f72
package
com
.
ctrip
.
apollo
.
portal
;
import
com.ctrip.apollo.PortalApplication
;
import
com.ctrip.apollo.
portal.
PortalApplication
;
import
org.junit.runner.RunWith
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
apollo-portal/src/test/java/com/ctrip/apollo/portal/ConfigServiceTest.java
View file @
3a2f6f72
...
...
@@ -9,7 +9,7 @@ import com.ctrip.apollo.portal.api.AdminServiceAPI;
import
com.ctrip.apollo.portal.entity.ItemDiffs
;
import
com.ctrip.apollo.portal.entity.NamespaceIdentifer
;
import
com.ctrip.apollo.portal.entity.form.NamespaceTextModel
;
import
com.ctrip.apollo.portal.service.ConfigService
;
import
com.ctrip.apollo.portal.service.
Portal
ConfigService
;
import
com.ctrip.apollo.portal.service.txtresolver.PropertyResolver
;
import
org.junit.Assert
;
...
...
@@ -39,7 +39,7 @@ public class ConfigServiceTest {
private
PropertyResolver
resolver
;
@InjectMocks
private
ConfigService
configService
;
private
Portal
ConfigService
configService
;
@Before
public
void
setup
()
{
...
...
apollo-portal/src/test/java/com/ctrip/apollo/portal/NamespaceServiceTest.java
View file @
3a2f6f72
...
...
@@ -6,7 +6,7 @@ import com.ctrip.apollo.core.dto.ReleaseDTO;
import
com.ctrip.apollo.core.enums.Env
;
import
com.ctrip.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.apollo.portal.entity.NamespaceVO
;
import
com.ctrip.apollo.portal.service.NamespaceService
;
import
com.ctrip.apollo.portal.service.
Portal
NamespaceService
;
import
com.ctrip.apollo.portal.service.txtresolver.PropertyResolver
;
import
org.junit.Before
;
...
...
@@ -35,7 +35,7 @@ public class NamespaceServiceTest {
private
PropertyResolver
resolver
;
@InjectMocks
private
NamespaceService
namespaceService
;
private
Portal
NamespaceService
namespaceService
;
@Before
public
void
setup
()
{
...
...
apollo-portal/src/test/java/com/ctrip/apollo/portal/ServiceExceptionTest.java
View file @
3a2f6f72
...
...
@@ -26,13 +26,13 @@ import com.ctrip.apollo.core.dto.AppDTO;
import
com.ctrip.apollo.core.enums.Env
;
import
com.ctrip.apollo.core.exception.ServiceException
;
import
com.ctrip.apollo.portal.api.AdminServiceAPI
;
import
com.ctrip.apollo.portal.service.AppService
;
import
com.ctrip.apollo.portal.service.
Portal
AppService
;
import
com.google.gson.Gson
;
public
class
ServiceExceptionTest
extends
AbstractPortalTest
{
@Autowired
private
AppService
appService
;
private
Portal
AppService
appService
;
@Mock
private
AdminServiceAPI
.
AppAPI
appAPI
;
...
...
pom.xml
View file @
3a2f6f72
...
...
@@ -95,6 +95,7 @@
<module>
apollo-configservice
</module>
<module>
apollo-adminservice
</module>
<module>
apollo-portal
</module>
<module>
apollo-assembly
</module>
<module>
apollo-demo
</module>
</modules>
...
...
@@ -120,6 +121,21 @@
<artifactId>
apollo-buildtools
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo-configservice
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo-adminservice
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.ctrip.apollo
</groupId>
<artifactId>
apollo-portal
</artifactId>
<version>
${project.version}
</version>
</dependency>
<dependency>
<groupId>
com.ctrip.framework
</groupId>
<artifactId>
framework-foundation
</artifactId>
...
...
@@ -234,7 +250,7 @@
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
1.3.
3
.RELEASE
</version>
<version>
1.3.
4
.RELEASE
</version>
<executions>
<execution>
<goals>
...
...
@@ -259,7 +275,7 @@
<dependency>
<groupId>
com.puppycrawl.tools
</groupId>
<artifactId>
checkstyle
</artifactId>
<version>
6.1
7
</version>
<version>
6.1
8
</version>
</dependency>
<dependency>
<groupId>
com.ctrip.apollo
</groupId>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment