Commit 2e05fb70 by Yiming Liu

Integrate EurekaServer into AdminSerivce Test, and update sample test data

parent 0d9d990c
...@@ -23,6 +23,47 @@ ...@@ -23,6 +23,47 @@
<artifactId>spring-cloud-starter-eureka</artifactId> <artifactId>spring-cloud-starter-eureka</artifactId>
</dependency> </dependency>
<!-- end of eureka --> <!-- end of eureka -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka-server</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>
spring-cloud-starter-archaius
</artifactId>
<groupId>org.springframework.cloud</groupId>
</exclusion>
<exclusion>
<artifactId>spring-cloud-starter-ribbon</artifactId>
<groupId>org.springframework.cloud</groupId>
</exclusion>
<exclusion>
<artifactId>ribbon-eureka</artifactId>
<groupId>com.netflix.ribbon</groupId>
</exclusion>
<exclusion>
<artifactId>aws-java-sdk-core</artifactId>
<groupId>com.amazonaws</groupId>
</exclusion>
<exclusion>
<artifactId>aws-java-sdk-ec2</artifactId>
<groupId>com.amazonaws</groupId>
</exclusion>
<exclusion>
<artifactId>aws-java-sdk-autoscaling</artifactId>
<groupId>com.amazonaws</groupId>
</exclusion>
<exclusion>
<artifactId>aws-java-sdk-sts</artifactId>
<groupId>com.amazonaws</groupId>
</exclusion>
<exclusion>
<artifactId>aws-java-sdk-route53</artifactId>
<groupId>com.amazonaws</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
......
...@@ -2,10 +2,10 @@ package com.ctrip.apollo; ...@@ -2,10 +2,10 @@ package com.ctrip.apollo;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication @SpringBootApplication
@EnableEurekaClient @EnableEurekaServer
public class SampleAdminServiceApplication { public class SampleAdminServiceApplication {
public static void main(String[] args) { public static void main(String[] args) {
new SpringApplicationBuilder(SampleAdminServiceApplication.class).run(args); new SpringApplicationBuilder(SampleAdminServiceApplication.class).run(args);
......
spring:
application:
name: apollo-adminservice
server:
port: ${port:8090}
logging:
level:
org.springframework.cloud: 'DEBUG'
file: /opt/logs/${ctrip.appid}/apollo-adminservice.log
ctrip:
appid: 100003172
eureka:
instance:
hostname: ${hostname:localhost}
client:
serviceUrl:
defaultZone: http://${eureka.instance.hostname}:8090/eureka/
healthcheck:
enabled: true
\ No newline at end of file
...@@ -22,10 +22,10 @@ INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (3, '100003 ...@@ -22,10 +22,10 @@ INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (3, '100003
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (4, '100003173', 'default', 'application'); INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (4, '100003173', 'default', 'application');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (5, '100003171', 'default', 'application'); INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (5, '100003171', 'default', 'application');
INSERT INTO Item (GroupId, `Key`, Value, Comment) VALUES (1, 'k1', 'v1', 'comment1'); INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (1, 'k1', 'v1', 'comment1');
INSERT INTO Item (GroupId, `Key`, Value, Comment) VALUES (1, 'k2', 'v2', 'comment2'); INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (1, 'k2', 'v2', 'comment2');
INSERT INTO Item (GroupId, `Key`, Value, Comment) VALUES (2, 'k3', 'v3', 'comment3'); INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (2, 'k3', 'v3', 'comment3');
INSERT INTO Item (GroupId, `Key`, Value, Comment) VALUES (5, 'k3', 'v4', 'comment4'); INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (5, 'k3', 'v4', 'comment4');
INSERT INTO `RELEASE` (Name, Comment, AppId, ClusterName, NamespaceName, Configurations) VALUES ('REV1','First Release','100003171', 'default', 'application', '{"k1":"v1"}'); INSERT INTO RELEASE (Name, Comment, AppId, ClusterName, NamespaceName, Configurations) VALUES ('REV1','First Release','100003171', 'default', 'application', '{"k1":"v1"}');
...@@ -8,7 +8,7 @@ import org.hibernate.annotations.Where; ...@@ -8,7 +8,7 @@ import org.hibernate.annotations.Where;
@Entity @Entity
@SQLDelete(sql = "Update App set isDeleted = 'false' where id = ?") @SQLDelete(sql = "Update App set isDeleted = 'false' where id = ?")
@Where(clause = "isDeleted = 'false'") @Where(clause = "isDeleted = 0")
public class App extends BaseEntity { public class App extends BaseEntity {
@Column(nullable = false) @Column(nullable = false)
......
...@@ -8,10 +8,10 @@ import org.hibernate.annotations.Where; ...@@ -8,10 +8,10 @@ import org.hibernate.annotations.Where;
@Entity @Entity
@SQLDelete(sql = "Update AppNamespace set isDeleted = 'false' where id = ?") @SQLDelete(sql = "Update AppNamespace set isDeleted = 'false' where id = ?")
@Where(clause = "isDeleted = 'false'") @Where(clause = "isDeleted = 0")
public class AppNamespace extends BaseEntity{ public class AppNamespace extends BaseEntity{
@Column(nullable = false, unique = true) @Column(nullable = false)
private String name; private String name;
@Column(nullable = false) @Column(nullable = false)
......
...@@ -11,7 +11,7 @@ import org.hibernate.annotations.Where; ...@@ -11,7 +11,7 @@ import org.hibernate.annotations.Where;
*/ */
@Entity @Entity
@SQLDelete(sql = "Update Cluster set isDeleted = 'false' where id = ?") @SQLDelete(sql = "Update Cluster set isDeleted = 'false' where id = ?")
@Where(clause = "isDeleted = 'false'") @Where(clause = "isDeleted = 0")
public class Cluster extends BaseEntity { public class Cluster extends BaseEntity {
@Column(nullable = false) @Column(nullable = false)
......
...@@ -8,7 +8,7 @@ import org.hibernate.annotations.Where; ...@@ -8,7 +8,7 @@ import org.hibernate.annotations.Where;
@Entity @Entity
@SQLDelete(sql = "Update Item set isDeleted = 'false' where id = ?") @SQLDelete(sql = "Update Item set isDeleted = 'false' where id = ?")
@Where(clause = "isDeleted = 'false'") @Where(clause = "isDeleted = 0")
public class Item extends BaseEntity { public class Item extends BaseEntity {
@Column(nullable = false) @Column(nullable = false)
......
...@@ -8,7 +8,7 @@ import org.hibernate.annotations.Where; ...@@ -8,7 +8,7 @@ import org.hibernate.annotations.Where;
@Entity @Entity
@SQLDelete(sql = "Update Namespace set isDeleted = 'false' where id = ?") @SQLDelete(sql = "Update Namespace set isDeleted = 'false' where id = ?")
@Where(clause = "isDeleted = 'false'") @Where(clause = "isDeleted = 0")
public class Namespace extends BaseEntity { public class Namespace extends BaseEntity {
@Column(nullable = false) @Column(nullable = false)
......
...@@ -8,7 +8,7 @@ import org.hibernate.annotations.Where; ...@@ -8,7 +8,7 @@ import org.hibernate.annotations.Where;
@Entity @Entity
@SQLDelete(sql = "Update Privilege set isDeleted = 'false' where id = ?") @SQLDelete(sql = "Update Privilege set isDeleted = 'false' where id = ?")
@Where(clause = "isDeleted = 'false'") @Where(clause = "isDeleted = 0")
public class Privilege extends BaseEntity { public class Privilege extends BaseEntity {
@Column @Column
......
...@@ -3,7 +3,6 @@ package com.ctrip.apollo.biz.entity; ...@@ -3,7 +3,6 @@ package com.ctrip.apollo.biz.entity;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Lob; import javax.persistence.Lob;
import javax.persistence.Table;
import org.hibernate.annotations.SQLDelete; import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where; import org.hibernate.annotations.Where;
...@@ -12,9 +11,8 @@ import org.hibernate.annotations.Where; ...@@ -12,9 +11,8 @@ import org.hibernate.annotations.Where;
* @author Jason Song(song_s@ctrip.com) * @author Jason Song(song_s@ctrip.com)
*/ */
@Entity @Entity
@Table(name = "\"Release\"")
@SQLDelete(sql = "Update Release set isDeleted = 'false' where id = ?") @SQLDelete(sql = "Update Release set isDeleted = 'false' where id = ?")
@Where(clause = "isDeleted = 'false'") @Where(clause = "isDeleted = 0")
public class Release extends BaseEntity { public class Release extends BaseEntity {
@Column(nullable = false) @Column(nullable = false)
......
...@@ -22,10 +22,10 @@ INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (3, '100003 ...@@ -22,10 +22,10 @@ INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (3, '100003
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (4, '100003173', 'default', 'application'); INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (4, '100003173', 'default', 'application');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (5, '100003171', 'default', 'application'); INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (5, '100003171', 'default', 'application');
INSERT INTO Item (GroupId, `Key`, Value, Comment) VALUES (1, 'k1', 'v1', 'comment1'); INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (1, 'k1', 'v1', 'comment1');
INSERT INTO Item (GroupId, `Key`, Value, Comment) VALUES (1, 'k2', 'v2', 'comment2'); INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (1, 'k2', 'v2', 'comment2');
INSERT INTO Item (GroupId, `Key`, Value, Comment) VALUES (2, 'k3', 'v3', 'comment3'); INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (2, 'k3', 'v3', 'comment3');
INSERT INTO Item (GroupId, `Key`, Value, Comment) VALUES (5, 'k3', 'v4', 'comment4'); INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (5, 'k3', 'v4', 'comment4');
INSERT INTO `RELEASE` (Name, Comment, AppId, ClusterName, NamespaceName, Configurations) VALUES ('REV1','First Release','100003171', 'default', 'application', '{"k1":"v1"}'); INSERT INTO RELEASE (Name, Comment, AppId, ClusterName, NamespaceName, Configurations) VALUES ('REV1','First Release','100003171', 'default', 'application', '{"k1":"v1"}');
spring.datasource.url = jdbc:h2:mem:~/fxapolloconfigdb;mode=mysql
spring.jpa.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.h2.console.enabled = true
spring.h2.console.settings.web-allow-others=true
hibernate.globally_quoted_identifiers=true
hibernate.show_sql=true
\ No newline at end of file
spring: spring:
application: application:
name: apollo-configservice name: apollo-configservice
datasource:
url: jdbc:h2:mem:~/fxapolloconfigdb;DB_CLOSE_ON_EXIT=FALSE
server: server:
port: ${port:8080} port: ${port:8080}
......
INSERT INTO App (AppId, Name, OwnerName, OwnerEmail) VALUES ('100003171','apollo-config-service','刘一鸣','liuym@ctrip.com');
INSERT INTO App (AppId, Name, OwnerName, OwnerEmail) VALUES ('100003172','apollo-admin-service','宋顺','song_s@ctrip.com');
INSERT INTO App (AppId, Name, OwnerName, OwnerEmail) VALUES ('100003173','apollo-portal','张乐','zhanglea@ctrip.com');
INSERT INTO App (AppId, Name, OwnerName, OwnerEmail) VALUES ('fxhermesproducer','fx-hermes-producer','梁锦华','jhliang@ctrip.com');
INSERT INTO Cluster (AppId, Name) VALUES ('100003171', 'default');
INSERT INTO Cluster (AppId, Name) VALUES ('100003171', 'cluster1');
INSERT INTO Cluster (AppId, Name) VALUES ('100003172', 'default');
INSERT INTO Cluster (AppId, Name) VALUES ('100003172', 'cluster2');
INSERT INTO Cluster (AppId, Name) VALUES ('100003173', 'default');
INSERT INTO Cluster (AppId, Name) VALUES ('100003173', 'cluster3');
INSERT INTO Cluster (AppId, Name) VALUES ('fxhermesproducer', 'default');
INSERT INTO AppNamespace (AppId, Name) VALUES ('100003171', 'application');
INSERT INTO AppNamespace (AppId, Name) VALUES ('100003172', 'application');
INSERT INTO AppNamespace (AppId, Name) VALUES ('100003173', 'application');
INSERT INTO AppNamespace (AppID, Name) VALUES ('fxhermesproducer', 'application');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (1, '100003171', 'default', 'application');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (2, 'fxhermesproducer', 'default', 'application');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (3, '100003172', 'default', 'application');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (4, '100003173', 'default', 'application');
INSERT INTO Namespace (Id, AppId, ClusterName, NamespaceName) VALUES (5, '100003171', 'default', 'application');
INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (1, 'k1', 'v1', 'comment1');
INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (1, 'k2', 'v2', 'comment2');
INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (2, 'k3', 'v3', 'comment3');
INSERT INTO Item (NamespaceId, `Key`, Value, Comment) VALUES (5, 'k3', 'v4', 'comment4');
INSERT INTO RELEASE (Name, Comment, AppId, ClusterName, NamespaceName, Configurations) VALUES ('REV1','First Release','100003171', 'default', 'application', '{"k1":"v1"}');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment