repo_name
stringclasses
5 values
pr_number
int64
1.52k
15.5k
pr_title
stringlengths
8
143
pr_description
stringlengths
0
10.2k
author
stringlengths
3
18
date_created
timestamp[ns, tz=UTC]
date_merged
timestamp[ns, tz=UTC]
previous_commit
stringlengths
40
40
pr_commit
stringlengths
40
40
query
stringlengths
11
10.2k
filepath
stringlengths
6
220
before_content
stringlengths
0
597M
after_content
stringlengths
0
597M
label
int64
-1
1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./scripts/helm/README.md
# Apollo Helm Chart [Apollo](https://github.com/ctripcorp/apollo) is a reliable configuration management system. ## 1. Introduction The apollo-service and apollo-portal charts create deployments for apollo-configservice, apollo-adminservice and apollo-portal, which utilize the kubernetes native service discovery. ## 2. Prerequisites - Kubernetes 1.10+ - Helm 3 ## 3. Add Apollo Helm Chart Repository ```bash $ helm repo add apollo https://www.apolloconfig.com/charts $ helm search repo apollo ``` ## 4. Deployments of apollo-configservice and apollo-adminservice ### 4.1 Install apollo-configservice and apollo-adminservice should be installed per environment, so it is suggested to indicate environment in the release name, e.g. `apollo-service-dev` ```bash $ helm install apollo-service-dev \ --set configdb.host=1.2.3.4 \ --set configdb.userName=apollo \ --set configdb.password=apollo \ --set configdb.service.enabled=true \ --set configService.replicaCount=1 \ --set adminService.replicaCount=1 \ -n your-namespace \ apollo/apollo-service ``` Or customize it with values.yaml ```bash $ helm install apollo-service-dev -f values.yaml -n your-namespace apollo/apollo-service ``` ### 4.2 Uninstall To uninstall/delete the `apollo-service-dev` deployment: ```bash $ helm uninstall -n your-namespace apollo-service-dev ``` ### 4.3 Configuration The following table lists the configurable parameters of the apollo-service chart and their default values. | Parameter | Description | Default | |----------------------|---------------------------------------------|---------------------| | `configdb.host` | The host for apollo config db | `nil` | | `configdb.port` | The port for apollo config db | `3306` | | `configdb.dbName` | The database name for apollo config db | `ApolloConfigDB` | | `configdb.userName` | The user name for apollo config db | `nil` | | `configdb.password` | The password for apollo config db | `nil` | | `configdb.connectionStringProperties` | The connection string properties for apollo config db | `characterEncoding=utf8` | | `configdb.service.enabled` | Whether to create a Kubernetes Service for `configdb.host` or not. Set it to `true` if `configdb.host` is an endpoint outside of the kubernetes cluster | `false` | | `configdb.service.fullNameOverride` | Override the service name for apollo config db | `nil` | | `configdb.service.port` | The port for the service of apollo config db | `3306` | | `configdb.service.type` | The service type of apollo config db: `ClusterIP` or `ExternalName`. If the host is a DNS name, please specify `ExternalName` as the service type, e.g. xxx.mysql.rds.aliyuncs.com | `ClusterIP` | | `configService.fullNameOverride` | Override the deployment name for apollo-configservice | `nil` | | `configService.replicaCount` | Replica count of apollo-configservice | `2` | | `configService.containerPort` | Container port of apollo-configservice | `8080` | | `configService.image.repository` | Image repository of apollo-configservice | `apolloconfig/apollo-configservice` | | `configService.image.tag` | Image tag of apollo-configservice, e.g. `1.8.0`, leave it to `nil` to use the default version | `nil` | | `configService.image.pullPolicy` | Image pull policy of apollo-configservice | `IfNotPresent` | | `configService.imagePullSecrets` | Image pull secrets of apollo-configservice | `[]` | | `configService.service.fullNameOverride` | Override the service name for apollo-configservice | `nil` | | `configService.service.port` | The port for the service of apollo-configservice | `8080` | | `configService.service.targetPort` | The target port for the service of apollo-configservice | `8080` | | `configService.service.type` | The service type of apollo-configservice | `ClusterIP` | | `configService.ingress.enabled` | Whether to enable the ingress for config-service or not | `false` | | `configService.ingress.annotations` | The annotations of the ingress for config-service | `{}` | | `configService.ingress.hosts.host` | The host of the ingress for config-service | `nil` | | `configService.ingress.hosts.paths` | The paths of the ingress for config-service | `[]` | | `configService.ingress.tls` | The tls definition of the ingress for config-service | `[]` | | `configService.liveness.initialDelaySeconds` | The initial delay seconds of liveness probe | `100` | | `configService.liveness.periodSeconds` | The period seconds of liveness probe | `10` | | `configService.readiness.initialDelaySeconds` | The initial delay seconds of readiness probe | `30` | | `configService.readiness.periodSeconds` | The period seconds of readiness probe | `5` | | `configService.config.profiles` | specify the spring profiles to activate | `github,kubernetes` | | `configService.config.configServiceUrlOverride` | Override `apollo.config-service.url`: config service url to be accessed by apollo-client | `nil` | | `configService.config.adminServiceUrlOverride` | Override `apollo.admin-service.url`: admin service url to be accessed by apollo-portal | `nil` | | `configService.config.contextPath` | specify the context path, e.g. `/apollo`, then users could access config service via `http://{config_service_address}/apollo` | `nil` | | `configService.env` | Environment variables passed to the container, e.g. <br />`JAVA_OPTS: -Xss256k` | `{}` | | `configService.strategy` | The deployment strategy of apollo-configservice | `{}` | | `configService.resources` | The resources definition of apollo-configservice | `{}` | | `configService.nodeSelector` | The node selector definition of apollo-configservice | `{}` | | `configService.tolerations` | The tolerations definition of apollo-configservice | `[]` | | `configService.affinity` | The affinity definition of apollo-configservice | `{}` | | `adminService.fullNameOverride` | Override the deployment name for apollo-adminservice | `nil` | | `adminService.replicaCount` | Replica count of apollo-adminservice | `2` | | `adminService.containerPort` | Container port of apollo-adminservice | `8090` | | `adminService.image.repository` | Image repository of apollo-adminservice | `apolloconfig/apollo-adminservice` | | `adminService.image.tag` | Image tag of apollo-adminservice, e.g. `1.8.0`, leave it to `nil` to use the default version | `nil` | | `adminService.image.pullPolicy` | Image pull policy of apollo-adminservice | `IfNotPresent` | | `adminService.imagePullSecrets` | Image pull secrets of apollo-adminservice | `[]` | | `adminService.service.fullNameOverride` | Override the service name for apollo-adminservice | `nil` | | `adminService.service.port` | The port for the service of apollo-adminservice | `8090` | | `adminService.service.targetPort` | The target port for the service of apollo-adminservice | `8090` | | `adminService.service.type` | The service type of apollo-adminservice | `ClusterIP` | | `adminService.ingress.enabled` | Whether to enable the ingress for admin-service or not | `false` | | `adminService.ingress.annotations` | The annotations of the ingress for admin-service | `{}` | | `adminService.ingress.hosts.host` | The host of the ingress for admin-service | `nil` | | `adminService.ingress.hosts.paths` | The paths of the ingress for admin-service | `[]` | | `adminService.ingress.tls` | The tls definition of the ingress for admin-service | `[]` | | `adminService.liveness.initialDelaySeconds` | The initial delay seconds of liveness probe | `100` | | `adminService.liveness.periodSeconds` | The period seconds of liveness probe | `10` | | `adminService.readiness.initialDelaySeconds` | The initial delay seconds of readiness probe | `30` | | `adminService.readiness.periodSeconds` | The period seconds of readiness probe | `5` | | `adminService.config.profiles` | specify the spring profiles to activate | `github,kubernetes` | | `adminService.config.contextPath` | specify the context path, e.g. `/apollo`, then users could access admin service via `http://{admin_service_address}/apollo` | `nil` | | `adminService.env` | Environment variables passed to the container, e.g. <br />`JAVA_OPTS: -Xss256k` | `{}` | | `adminService.strategy` | The deployment strategy of apollo-adminservice | `{}` | | `adminService.resources` | The resources definition of apollo-adminservice | `{}` | | `adminService.nodeSelector` | The node selector definition of apollo-adminservice | `{}` | | `adminService.tolerations` | The tolerations definition of apollo-adminservice | `[]` | | `adminService.affinity` | The affinity definition of apollo-adminservice | `{}` | ### 4.4 Sample 1. ConfigDB host is an IP outside of kubernetes cluster ```yaml configdb: host: 1.2.3.4 dbName: ApolloConfigDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false service: enabled: true ``` 2. ConfigDB host is a dns name outside of kubernetes cluster ```yaml configdb: host: xxx.mysql.rds.aliyuncs.com dbName: ApolloConfigDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false service: enabled: true type: ExternalName ``` 3. ConfigDB host is a kubernetes service ```yaml configdb: host: apollodb-mysql.mysql dbName: ApolloConfigDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false ``` 4. Expose config service as Ingress with custom path `/config` ```yaml # use /config as root, should specify configService.config.contextPath as /config configService: config: contextPath: /config ingress: enabled: true hosts: - paths: - /config ``` 5. Expose admin service as Ingress with custom path `/admin` ```yaml # use /admin as root, should specify adminService.config.contextPath as /admin adminService: config: contextPath: /admin ingress: enabled: true hosts: - paths: - /admin ``` ## 5. Deployments of apollo-portal ### 5.1 Install To install the apollo-portal chart with the release name `apollo-portal`: ```bash $ helm install apollo-portal \ --set portaldb.host=1.2.3.4 \ --set portaldb.userName=apollo \ --set portaldb.password=apollo \ --set portaldb.service.enabled=true \ --set config.envs="dev\,pro" \ --set config.metaServers.dev=http://apollo-service-dev-apollo-configservice:8080 \ --set config.metaServers.pro=http://apollo-service-pro-apollo-configservice:8080 \ --set replicaCount=1 \ -n your-namespace \ apollo/apollo-portal ``` Or customize it with values.yaml ```bash $ helm install apollo-portal -f values.yaml -n your-namespace apollo/apollo-portal ``` ### 5.2 Uninstallation To uninstall/delete the `apollo-portal` deployment: ```bash $ helm uninstall -n your-namespace apollo-portal ``` ### 5.3 Configuration The following table lists the configurable parameters of the apollo-portal chart and their default values. | Parameter | Description | Default | |----------------------|---------------------------------------------|-----------------------| | `fullNameOverride` | Override the deployment name for apollo-portal | `nil` | | `replicaCount` | Replica count of apollo-portal | `2` | | `containerPort` | Container port of apollo-portal | `8070` | | `image.repository` | Image repository of apollo-portal | `apolloconfig/apollo-portal` | | `image.tag` | Image tag of apollo-portal, e.g. `1.8.0`, leave it to `nil` to use the default version | `nil` | | `image.pullPolicy` | Image pull policy of apollo-portal | `IfNotPresent` | | `imagePullSecrets` | Image pull secrets of apollo-portal | `[]` | | `service.fullNameOverride` | Override the service name for apollo-portal | `nil` | | `service.port` | The port for the service of apollo-portal | `8070` | | `service.targetPort` | The target port for the service of apollo-portal | `8070` | | `service.type` | The service type of apollo-portal | `ClusterIP` | | `service.sessionAffinity` | The session affinity for the service of apollo-portal | `ClientIP` | | `ingress.enabled` | Whether to enable the ingress or not | `false` | | `ingress.annotations` | The annotations of the ingress | `{}` | | `ingress.hosts.host` | The host of the ingress | `nil` | | `ingress.hosts.paths` | The paths of the ingress | `[]` | | `ingress.tls` | The tls definition of the ingress | `[]` | | `liveness.initialDelaySeconds` | The initial delay seconds of liveness probe | `100` | | `liveness.periodSeconds` | The period seconds of liveness probe | `10` | | `readiness.initialDelaySeconds` | The initial delay seconds of readiness probe | `30` | | `readiness.periodSeconds` | The period seconds of readiness probe | `5` | | `env` | Environment variables passed to the container, e.g. <br />`JAVA_OPTS: -Xss256k` | `{}` | | `strategy` | The deployment strategy of apollo-portal | `{}` | | `resources` | The resources definition of apollo-portal | `{}` | | `nodeSelector` | The node selector definition of apollo-portal | `{}` | | `tolerations` | The tolerations definition of apollo-portal | `[]` | | `affinity` | The affinity definition of apollo-portal | `{}` | | `config.profiles` | specify the spring profiles to activate | `github,auth` | | `config.envs` | specify the env names, e.g. dev,pro | `nil` | | `config.contextPath` | specify the context path, e.g. `/apollo`, then users could access portal via `http://{portal_address}/apollo` | `nil` | | `config.metaServers` | specify the meta servers, e.g.<br />`dev: http://apollo-configservice-dev:8080`<br />`pro: http://apollo-configservice-pro:8080` | `{}` | | `config.files` | specify the extra config files for apollo-portal, e.g. application-ldap.yml | `{}` | | `portaldb.host` | The host for apollo portal db | `nil` | | `portaldb.port` | The port for apollo portal db | `3306` | | `portaldb.dbName` | The database name for apollo portal db | `ApolloPortalDB` | | `portaldb.userName` | The user name for apollo portal db | `nil` | | `portaldb.password` | The password for apollo portal db | `nil` | | `portaldb.connectionStringProperties` | The connection string properties for apollo portal db | `characterEncoding=utf8` | | `portaldb.service.enabled` | Whether to create a Kubernetes Service for `portaldb.host` or not. Set it to `true` if `portaldb.host` is an endpoint outside of the kubernetes cluster | `false` | | `portaldb.service.fullNameOverride` | Override the service name for apollo portal db | `nil` | | `portaldb.service.port` | The port for the service of apollo portal db | `3306` | | `portaldb.service.type` | The service type of apollo portal db: `ClusterIP` or `ExternalName`. If the host is a DNS name, please specify `ExternalName` as the service type, e.g. xxx.mysql.rds.aliyuncs.com | `ClusterIP` | ### 5.4 Sample 1. PortalDB host is an IP outside of kubernetes cluster ```yaml portaldb: host: 1.2.3.4 dbName: ApolloPortalDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false service: enabled: true ``` 2. PortalDB host is a dns name outside of kubernetes cluster ```yaml portaldb: host: xxx.mysql.rds.aliyuncs.com dbName: ApolloPortalDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false service: enabled: true type: ExternalName ``` 3. PortalDB host is a kubernetes service ```yaml portaldb: host: apollodb-mysql.mysql dbName: ApolloPortalDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false ``` 4. Specify environments ```yaml config: envs: dev,pro metaServers: dev: http://apollo-service-dev-apollo-configservice:8080 pro: http://apollo-service-pro-apollo-configservice:8080 ``` 5. Expose service as Load Balancer ```yaml service: type: LoadBalancer ``` 6. Expose service as Ingress ```yaml ingress: enabled: true hosts: - paths: - / ``` 7. Expose service as Ingress with custom path `/apollo` ```yaml # use /apollo as root, should specify config.contextPath as /apollo ingress: enabled: true hosts: - paths: - /apollo config: ... contextPath: /apollo ... ``` 8. Expose service as Ingress with session affinity ```yaml ingress: enabled: true annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/affinity: "cookie" nginx.ingress.kubernetes.io/affinity-mode: "persistent" nginx.ingress.kubernetes.io/session-cookie-conditional-samesite-none: "true" nginx.ingress.kubernetes.io/session-cookie-expires: "172800" nginx.ingress.kubernetes.io/session-cookie-max-age: "172800" hosts: - host: xxx.somedomain.com # host is required to make session affinity work paths: - / ``` 9. Enable LDAP support ```yaml config: ... profiles: github,ldap ... files: application-ldap.yml: | spring: ldap: base: "dc=example,dc=org" username: "cn=admin,dc=example,dc=org" password: "password" searchFilter: "(uid={0})" urls: - "ldap://xxx.somedomain.com:389" ldap: mapping: objectClass: "inetOrgPerson" loginId: "uid" userDisplayName: "cn" email: "mail" ```
# Apollo Helm Chart [Apollo](https://github.com/ctripcorp/apollo) is a reliable configuration management system. ## 1. Introduction The apollo-service and apollo-portal charts create deployments for apollo-configservice, apollo-adminservice and apollo-portal, which utilize the kubernetes native service discovery. ## 2. Prerequisites - Kubernetes 1.10+ - Helm 3 ## 3. Add Apollo Helm Chart Repository ```bash $ helm repo add apollo https://www.apolloconfig.com/charts $ helm search repo apollo ``` ## 4. Deployments of apollo-configservice and apollo-adminservice ### 4.1 Install apollo-configservice and apollo-adminservice should be installed per environment, so it is suggested to indicate environment in the release name, e.g. `apollo-service-dev` ```bash $ helm install apollo-service-dev \ --set configdb.host=1.2.3.4 \ --set configdb.userName=apollo \ --set configdb.password=apollo \ --set configdb.service.enabled=true \ --set configService.replicaCount=1 \ --set adminService.replicaCount=1 \ -n your-namespace \ apollo/apollo-service ``` Or customize it with values.yaml ```bash $ helm install apollo-service-dev -f values.yaml -n your-namespace apollo/apollo-service ``` ### 4.2 Uninstall To uninstall/delete the `apollo-service-dev` deployment: ```bash $ helm uninstall -n your-namespace apollo-service-dev ``` ### 4.3 Configuration The following table lists the configurable parameters of the apollo-service chart and their default values. | Parameter | Description | Default | |----------------------|---------------------------------------------|---------------------| | `configdb.host` | The host for apollo config db | `nil` | | `configdb.port` | The port for apollo config db | `3306` | | `configdb.dbName` | The database name for apollo config db | `ApolloConfigDB` | | `configdb.userName` | The user name for apollo config db | `nil` | | `configdb.password` | The password for apollo config db | `nil` | | `configdb.connectionStringProperties` | The connection string properties for apollo config db | `characterEncoding=utf8` | | `configdb.service.enabled` | Whether to create a Kubernetes Service for `configdb.host` or not. Set it to `true` if `configdb.host` is an endpoint outside of the kubernetes cluster | `false` | | `configdb.service.fullNameOverride` | Override the service name for apollo config db | `nil` | | `configdb.service.port` | The port for the service of apollo config db | `3306` | | `configdb.service.type` | The service type of apollo config db: `ClusterIP` or `ExternalName`. If the host is a DNS name, please specify `ExternalName` as the service type, e.g. xxx.mysql.rds.aliyuncs.com | `ClusterIP` | | `configService.fullNameOverride` | Override the deployment name for apollo-configservice | `nil` | | `configService.replicaCount` | Replica count of apollo-configservice | `2` | | `configService.containerPort` | Container port of apollo-configservice | `8080` | | `configService.image.repository` | Image repository of apollo-configservice | `apolloconfig/apollo-configservice` | | `configService.image.tag` | Image tag of apollo-configservice, e.g. `1.8.0`, leave it to `nil` to use the default version | `nil` | | `configService.image.pullPolicy` | Image pull policy of apollo-configservice | `IfNotPresent` | | `configService.imagePullSecrets` | Image pull secrets of apollo-configservice | `[]` | | `configService.service.fullNameOverride` | Override the service name for apollo-configservice | `nil` | | `configService.service.port` | The port for the service of apollo-configservice | `8080` | | `configService.service.targetPort` | The target port for the service of apollo-configservice | `8080` | | `configService.service.type` | The service type of apollo-configservice | `ClusterIP` | | `configService.ingress.enabled` | Whether to enable the ingress for config-service or not | `false` | | `configService.ingress.annotations` | The annotations of the ingress for config-service | `{}` | | `configService.ingress.hosts.host` | The host of the ingress for config-service | `nil` | | `configService.ingress.hosts.paths` | The paths of the ingress for config-service | `[]` | | `configService.ingress.tls` | The tls definition of the ingress for config-service | `[]` | | `configService.liveness.initialDelaySeconds` | The initial delay seconds of liveness probe | `100` | | `configService.liveness.periodSeconds` | The period seconds of liveness probe | `10` | | `configService.readiness.initialDelaySeconds` | The initial delay seconds of readiness probe | `30` | | `configService.readiness.periodSeconds` | The period seconds of readiness probe | `5` | | `configService.config.profiles` | specify the spring profiles to activate | `github,kubernetes` | | `configService.config.configServiceUrlOverride` | Override `apollo.config-service.url`: config service url to be accessed by apollo-client | `nil` | | `configService.config.adminServiceUrlOverride` | Override `apollo.admin-service.url`: admin service url to be accessed by apollo-portal | `nil` | | `configService.config.contextPath` | specify the context path, e.g. `/apollo`, then users could access config service via `http://{config_service_address}/apollo` | `nil` | | `configService.env` | Environment variables passed to the container, e.g. <br />`JAVA_OPTS: -Xss256k` | `{}` | | `configService.strategy` | The deployment strategy of apollo-configservice | `{}` | | `configService.resources` | The resources definition of apollo-configservice | `{}` | | `configService.nodeSelector` | The node selector definition of apollo-configservice | `{}` | | `configService.tolerations` | The tolerations definition of apollo-configservice | `[]` | | `configService.affinity` | The affinity definition of apollo-configservice | `{}` | | `adminService.fullNameOverride` | Override the deployment name for apollo-adminservice | `nil` | | `adminService.replicaCount` | Replica count of apollo-adminservice | `2` | | `adminService.containerPort` | Container port of apollo-adminservice | `8090` | | `adminService.image.repository` | Image repository of apollo-adminservice | `apolloconfig/apollo-adminservice` | | `adminService.image.tag` | Image tag of apollo-adminservice, e.g. `1.8.0`, leave it to `nil` to use the default version | `nil` | | `adminService.image.pullPolicy` | Image pull policy of apollo-adminservice | `IfNotPresent` | | `adminService.imagePullSecrets` | Image pull secrets of apollo-adminservice | `[]` | | `adminService.service.fullNameOverride` | Override the service name for apollo-adminservice | `nil` | | `adminService.service.port` | The port for the service of apollo-adminservice | `8090` | | `adminService.service.targetPort` | The target port for the service of apollo-adminservice | `8090` | | `adminService.service.type` | The service type of apollo-adminservice | `ClusterIP` | | `adminService.ingress.enabled` | Whether to enable the ingress for admin-service or not | `false` | | `adminService.ingress.annotations` | The annotations of the ingress for admin-service | `{}` | | `adminService.ingress.hosts.host` | The host of the ingress for admin-service | `nil` | | `adminService.ingress.hosts.paths` | The paths of the ingress for admin-service | `[]` | | `adminService.ingress.tls` | The tls definition of the ingress for admin-service | `[]` | | `adminService.liveness.initialDelaySeconds` | The initial delay seconds of liveness probe | `100` | | `adminService.liveness.periodSeconds` | The period seconds of liveness probe | `10` | | `adminService.readiness.initialDelaySeconds` | The initial delay seconds of readiness probe | `30` | | `adminService.readiness.periodSeconds` | The period seconds of readiness probe | `5` | | `adminService.config.profiles` | specify the spring profiles to activate | `github,kubernetes` | | `adminService.config.contextPath` | specify the context path, e.g. `/apollo`, then users could access admin service via `http://{admin_service_address}/apollo` | `nil` | | `adminService.env` | Environment variables passed to the container, e.g. <br />`JAVA_OPTS: -Xss256k` | `{}` | | `adminService.strategy` | The deployment strategy of apollo-adminservice | `{}` | | `adminService.resources` | The resources definition of apollo-adminservice | `{}` | | `adminService.nodeSelector` | The node selector definition of apollo-adminservice | `{}` | | `adminService.tolerations` | The tolerations definition of apollo-adminservice | `[]` | | `adminService.affinity` | The affinity definition of apollo-adminservice | `{}` | ### 4.4 Sample 1. ConfigDB host is an IP outside of kubernetes cluster ```yaml configdb: host: 1.2.3.4 dbName: ApolloConfigDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false service: enabled: true ``` 2. ConfigDB host is a dns name outside of kubernetes cluster ```yaml configdb: host: xxx.mysql.rds.aliyuncs.com dbName: ApolloConfigDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false service: enabled: true type: ExternalName ``` 3. ConfigDB host is a kubernetes service ```yaml configdb: host: apollodb-mysql.mysql dbName: ApolloConfigDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false ``` 4. Expose config service as Ingress with custom path `/config` ```yaml # use /config as root, should specify configService.config.contextPath as /config configService: config: contextPath: /config ingress: enabled: true hosts: - paths: - /config ``` 5. Expose admin service as Ingress with custom path `/admin` ```yaml # use /admin as root, should specify adminService.config.contextPath as /admin adminService: config: contextPath: /admin ingress: enabled: true hosts: - paths: - /admin ``` ## 5. Deployments of apollo-portal ### 5.1 Install To install the apollo-portal chart with the release name `apollo-portal`: ```bash $ helm install apollo-portal \ --set portaldb.host=1.2.3.4 \ --set portaldb.userName=apollo \ --set portaldb.password=apollo \ --set portaldb.service.enabled=true \ --set config.envs="dev\,pro" \ --set config.metaServers.dev=http://apollo-service-dev-apollo-configservice:8080 \ --set config.metaServers.pro=http://apollo-service-pro-apollo-configservice:8080 \ --set replicaCount=1 \ -n your-namespace \ apollo/apollo-portal ``` Or customize it with values.yaml ```bash $ helm install apollo-portal -f values.yaml -n your-namespace apollo/apollo-portal ``` ### 5.2 Uninstallation To uninstall/delete the `apollo-portal` deployment: ```bash $ helm uninstall -n your-namespace apollo-portal ``` ### 5.3 Configuration The following table lists the configurable parameters of the apollo-portal chart and their default values. | Parameter | Description | Default | |----------------------|---------------------------------------------|-----------------------| | `fullNameOverride` | Override the deployment name for apollo-portal | `nil` | | `replicaCount` | Replica count of apollo-portal | `2` | | `containerPort` | Container port of apollo-portal | `8070` | | `image.repository` | Image repository of apollo-portal | `apolloconfig/apollo-portal` | | `image.tag` | Image tag of apollo-portal, e.g. `1.8.0`, leave it to `nil` to use the default version | `nil` | | `image.pullPolicy` | Image pull policy of apollo-portal | `IfNotPresent` | | `imagePullSecrets` | Image pull secrets of apollo-portal | `[]` | | `service.fullNameOverride` | Override the service name for apollo-portal | `nil` | | `service.port` | The port for the service of apollo-portal | `8070` | | `service.targetPort` | The target port for the service of apollo-portal | `8070` | | `service.type` | The service type of apollo-portal | `ClusterIP` | | `service.sessionAffinity` | The session affinity for the service of apollo-portal | `ClientIP` | | `ingress.enabled` | Whether to enable the ingress or not | `false` | | `ingress.annotations` | The annotations of the ingress | `{}` | | `ingress.hosts.host` | The host of the ingress | `nil` | | `ingress.hosts.paths` | The paths of the ingress | `[]` | | `ingress.tls` | The tls definition of the ingress | `[]` | | `liveness.initialDelaySeconds` | The initial delay seconds of liveness probe | `100` | | `liveness.periodSeconds` | The period seconds of liveness probe | `10` | | `readiness.initialDelaySeconds` | The initial delay seconds of readiness probe | `30` | | `readiness.periodSeconds` | The period seconds of readiness probe | `5` | | `env` | Environment variables passed to the container, e.g. <br />`JAVA_OPTS: -Xss256k` | `{}` | | `strategy` | The deployment strategy of apollo-portal | `{}` | | `resources` | The resources definition of apollo-portal | `{}` | | `nodeSelector` | The node selector definition of apollo-portal | `{}` | | `tolerations` | The tolerations definition of apollo-portal | `[]` | | `affinity` | The affinity definition of apollo-portal | `{}` | | `config.profiles` | specify the spring profiles to activate | `github,auth` | | `config.envs` | specify the env names, e.g. dev,pro | `nil` | | `config.contextPath` | specify the context path, e.g. `/apollo`, then users could access portal via `http://{portal_address}/apollo` | `nil` | | `config.metaServers` | specify the meta servers, e.g.<br />`dev: http://apollo-configservice-dev:8080`<br />`pro: http://apollo-configservice-pro:8080` | `{}` | | `config.files` | specify the extra config files for apollo-portal, e.g. application-ldap.yml | `{}` | | `portaldb.host` | The host for apollo portal db | `nil` | | `portaldb.port` | The port for apollo portal db | `3306` | | `portaldb.dbName` | The database name for apollo portal db | `ApolloPortalDB` | | `portaldb.userName` | The user name for apollo portal db | `nil` | | `portaldb.password` | The password for apollo portal db | `nil` | | `portaldb.connectionStringProperties` | The connection string properties for apollo portal db | `characterEncoding=utf8` | | `portaldb.service.enabled` | Whether to create a Kubernetes Service for `portaldb.host` or not. Set it to `true` if `portaldb.host` is an endpoint outside of the kubernetes cluster | `false` | | `portaldb.service.fullNameOverride` | Override the service name for apollo portal db | `nil` | | `portaldb.service.port` | The port for the service of apollo portal db | `3306` | | `portaldb.service.type` | The service type of apollo portal db: `ClusterIP` or `ExternalName`. If the host is a DNS name, please specify `ExternalName` as the service type, e.g. xxx.mysql.rds.aliyuncs.com | `ClusterIP` | ### 5.4 Sample 1. PortalDB host is an IP outside of kubernetes cluster ```yaml portaldb: host: 1.2.3.4 dbName: ApolloPortalDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false service: enabled: true ``` 2. PortalDB host is a dns name outside of kubernetes cluster ```yaml portaldb: host: xxx.mysql.rds.aliyuncs.com dbName: ApolloPortalDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false service: enabled: true type: ExternalName ``` 3. PortalDB host is a kubernetes service ```yaml portaldb: host: apollodb-mysql.mysql dbName: ApolloPortalDBName userName: someUserName password: somePassword connectionStringProperties: characterEncoding=utf8&useSSL=false ``` 4. Specify environments ```yaml config: envs: dev,pro metaServers: dev: http://apollo-service-dev-apollo-configservice:8080 pro: http://apollo-service-pro-apollo-configservice:8080 ``` 5. Expose service as Load Balancer ```yaml service: type: LoadBalancer ``` 6. Expose service as Ingress ```yaml ingress: enabled: true hosts: - paths: - / ``` 7. Expose service as Ingress with custom path `/apollo` ```yaml # use /apollo as root, should specify config.contextPath as /apollo ingress: enabled: true hosts: - paths: - /apollo config: ... contextPath: /apollo ... ``` 8. Expose service as Ingress with session affinity ```yaml ingress: enabled: true annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/affinity: "cookie" nginx.ingress.kubernetes.io/affinity-mode: "persistent" nginx.ingress.kubernetes.io/session-cookie-conditional-samesite-none: "true" nginx.ingress.kubernetes.io/session-cookie-expires: "172800" nginx.ingress.kubernetes.io/session-cookie-max-age: "172800" hosts: - host: xxx.somedomain.com # host is required to make session affinity work paths: - / ``` 9. Enable LDAP support ```yaml config: ... profiles: github,ldap ... files: application-ldap.yml: | spring: ldap: base: "dc=example,dc=org" username: "cn=admin,dc=example,dc=org" password: "password" searchFilter: "(uid={0})" urls: - "ldap://xxx.somedomain.com:389" ldap: mapping: objectClass: "inetOrgPerson" loginId: "uid" userDisplayName: "cn" email: "mail" ```
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/test/resources/spring/XmlConfigPlaceholderTest2.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:apollo="http://www.ctrip.com/schema/apollo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"> <apollo:config namespaces="application"/> <bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest.TestXmlBean"> <property name="timeout" value="${timeout:100}"/> <property name="batch" value="${batch:200}"/> </bean> </beans>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:apollo="http://www.ctrip.com/schema/apollo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"> <apollo:config namespaces="application"/> <bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest.TestXmlBean"> <property name="timeout" value="${timeout:100}"/> <property name="batch" value="${batch:200}"/> </bean> </beans>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/test/resources/spring/XmlConfigPlaceholderTest11.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:apollo="http://www.ctrip.com/schema/apollo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"> <bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest.TestXmlBean"> <property name="timeout" value="${timeout:100}"/> <property name="batch" value="${batch:200}"/> </bean> </beans>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:apollo="http://www.ctrip.com/schema/apollo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"> <bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest.TestXmlBean"> <property name="timeout" value="${timeout:100}"/> <property name="batch" value="${batch:200}"/> </bean> </beans>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-buildtools/pom.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <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.framework.apollo</groupId> <artifactId>apollo</artifactId> <version>${revision}</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>apollo-buildtools</artifactId> <name>Apollo BuildTools</name> <build> <plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>copy-resources</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target</outputDirectory> <resources> <resource> <directory>src/main/scripts</directory> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <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.framework.apollo</groupId> <artifactId>apollo</artifactId> <version>${revision}</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>apollo-buildtools</artifactId> <name>Apollo BuildTools</name> <build> <plugins> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>copy-resources</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/target</outputDirectory> <resources> <resource> <directory>src/main/scripts</directory> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-adminservice/src/test/resources/logback-test.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <configuration scan="true"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <charset>utf-8</charset> <Pattern>[%p] %c - %m%n</Pattern> </encoder> </appender> <logger name="org.springframework.test" level="OFF" /> <root level="WARN"> <appender-ref ref="CONSOLE" /> </root> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <configuration scan="true"> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <charset>utf-8</charset> <Pattern>[%p] %c - %m%n</Pattern> </encoder> </appender> <logger name="org.springframework.test" level="OFF" /> <root level="WARN"> <appender-ref ref="CONSOLE" /> </root> </configuration>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/test/resources/spring/XmlConfigPlaceholderTest10.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:apollo="http://www.ctrip.com/schema/apollo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"> <apollo:config /> <bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderAutoUpdateTest.TestAllKindsOfDataTypesBean"> <property name="intProperty" value="${intProperty}"/> <property name="intArrayProperty" value="${intArrayProperty}"/> <property name="longProperty" value="${longProperty}"/> <property name="shortProperty" value="${shortProperty}"/> <property name="floatProperty" value="${floatProperty}"/> <property name="doubleProperty" value="${doubleProperty}"/> <property name="byteProperty" value="${byteProperty}"/> <property name="booleanProperty" value="${booleanProperty}"/> <property name="stringProperty" value="${stringProperty}"/> <property name="dateProperty" value="#{new java.text.SimpleDateFormat('${dateFormat}').parse('${dateProperty}')}"/> </bean> </beans>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:apollo="http://www.ctrip.com/schema/apollo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"> <apollo:config /> <bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderAutoUpdateTest.TestAllKindsOfDataTypesBean"> <property name="intProperty" value="${intProperty}"/> <property name="intArrayProperty" value="${intArrayProperty}"/> <property name="longProperty" value="${longProperty}"/> <property name="shortProperty" value="${shortProperty}"/> <property name="floatProperty" value="${floatProperty}"/> <property name="doubleProperty" value="${doubleProperty}"/> <property name="byteProperty" value="${byteProperty}"/> <property name="booleanProperty" value="${booleanProperty}"/> <property name="stringProperty" value="${stringProperty}"/> <property name="dateProperty" value="#{new java.text.SimpleDateFormat('${dateFormat}').parse('${dateProperty}')}"/> </bean> </beans>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-adminservice/src/assembly/assembly-descriptor.xml
<!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> <id>apollo-assembly</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <!--scripts --> <fileSet> <directory>src/main/scripts</directory> <outputDirectory>scripts</outputDirectory> <includes> <include>*.sh</include> </includes> <fileMode>0755</fileMode> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>src/main/config</directory> <outputDirectory>config</outputDirectory> <excludes> <exclude>apollo-adminservice.conf</exclude> <exclude>application-github.properties</exclude> </excludes> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>src/main/config</directory> <outputDirectory>/</outputDirectory> <includes> <include>apollo-adminservice.conf</include> </includes> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>target/classes</directory> <outputDirectory>/config</outputDirectory> <includes> <include>application-github.properties</include> </includes> </fileSet> <!--artifact --> <fileSet> <directory>target</directory> <outputDirectory>/</outputDirectory> <includes> <include>${project.artifactId}-*.jar</include> </includes> <fileMode>0755</fileMode> </fileSet> </fileSets> </assembly>
<!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> <id>apollo-assembly</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <!--scripts --> <fileSet> <directory>src/main/scripts</directory> <outputDirectory>scripts</outputDirectory> <includes> <include>*.sh</include> </includes> <fileMode>0755</fileMode> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>src/main/config</directory> <outputDirectory>config</outputDirectory> <excludes> <exclude>apollo-adminservice.conf</exclude> <exclude>application-github.properties</exclude> </excludes> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>src/main/config</directory> <outputDirectory>/</outputDirectory> <includes> <include>apollo-adminservice.conf</include> </includes> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>target/classes</directory> <outputDirectory>/config</outputDirectory> <includes> <include>application-github.properties</include> </includes> </fileSet> <!--artifact --> <fileSet> <directory>target</directory> <outputDirectory>/</outputDirectory> <includes> <include>${project.artifactId}-*.jar</include> </includes> <fileMode>0755</fileMode> </fileSet> </fileSets> </assembly>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/test/resources/spring/XmlConfigPlaceholderTest5.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:apollo="http://www.ctrip.com/schema/apollo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"> <apollo:config namespaces="application" order="abc"/> <bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest.TestXmlBean"> <property name="timeout" value="${timeout:100}"/> <property name="batch" value="${batch:200}"/> </bean> </beans>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:apollo="http://www.ctrip.com/schema/apollo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"> <apollo:config namespaces="application" order="abc"/> <bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest.TestXmlBean"> <property name="timeout" value="${timeout:100}"/> <property name="batch" value="${batch:200}"/> </bean> </beans>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./GOVERNANCE.md
# Overview Apollo is a meritocratic, consensus-based community project. Anyone with an interest in the project can join the community, contribute to the project design and participate in the decision-making process. This document describes how that participation takes place and how to set about earning merit within the project community. # Roles and Responsibilities Apollo community is composed of and operated by the following roles: - Users - Contributors - Committers - Project Management Committee (PMC) ## Users Users are community members who have a need for the project. They are the most important members of the community and without them the project would have no purpose. Anyone can be a user and there are no special requirements. ## Contributors Contributors are community members who contribute in concrete ways to the project. ### How to become a Contributor - merged at least 1 pull request You are also encouraged to participate in the projects in the following ways: - Actively answer technical questions raised by community users in GitHub issues. - Help test the projects - Help review the pull requests (PRs) submitted by others - Help improve technical documents - Submit valuable issues - Report or fix known and unknown bugs - Write articles about source code analysis and usage cases for a project. - Give representations of Apollo topic in conferences. - Take part in our discussions of features, enhancements, etc. ## Committers Committers are contributors who have shown that they are committed to the continued development of the project through ongoing engagement with the community and recognized by PMCs for their outstanding contributions. ### How to become a Committer A Committer must have accomplished one or more of the following items: - Demonstrated a good sense of responsibility in PR reviews. - Demonstrated deep understanding of Apollo components by contributing significantly as: - Finished 2 or more tasks of Medium difficulty - Fixed 1 or more tasks of Hard difficulty - Nominated by one PMC member and gained more +1 than -1. ### Privileges and responsibilities - Control overall code quality of projects - Guide Contributors to contribute to the community continuously - Participate in design discussions ## Project Management Committee The PMC(Project Management Committee) functions as the core management team that oversees the Apollo community. The PMC has additional responsibilities over and above those of Committers. These responsibilities ensure the smooth running of the project. ### How to become a PMC member - Membership of the PMC is by invitation from the existing PMC members. - A nomination will result in discussion and then a vote by the existing PMC members. - PMC membership votes are subject to consensus approval of the current PMC members. ### Privileges and responsibilities - Handle reported security issues (CVE, etc.) - Nominate new committers and PMC members - Vote on new committers and new PMC members - Make major decisions for the future with respect to Apollo, such as project-level governance policies, management of sub-structures, security processes and so on - Make decisions when community consensus cannot be reached # Decision-making and voting Proposals and ideas can be submitted for agreement via a GitHub issue, PR, or GitHub Discussion. Major changes such as feature proposals and organization or process changes should be brought to the PMC. For the change to happen, the change must earn more +1 than -1. # Conflict resolution In general, we prefer that technical issues and other disputes upon which consensus can't be reached are amicably worked out between the persons involved. If a dispute cannot be decided independently, the PMC can be called in to resolve the issue by voting. The same PR can be used, or a separate PR can be opened for voting. # Changes in Governance Any change in this Governance document, or similar nature of changes to other governance related documents, shall go through the voting process as described in [Decision-making and voting](#decision-making-and-voting). # Credits The contents of this document are based on <http://oss-watch.ac.uk/resources/meritocraticgovernancemodel> by Ross Gardler and Gabriel Hanganu, and [TiDB Governance](https://github.com/pingcap/community/blob/master/GOVERNANCE.md).
# Overview Apollo is a meritocratic, consensus-based community project. Anyone with an interest in the project can join the community, contribute to the project design and participate in the decision-making process. This document describes how that participation takes place and how to set about earning merit within the project community. # Roles and Responsibilities Apollo community is composed of and operated by the following roles: - Users - Contributors - Committers - Project Management Committee (PMC) ## Users Users are community members who have a need for the project. They are the most important members of the community and without them the project would have no purpose. Anyone can be a user and there are no special requirements. ## Contributors Contributors are community members who contribute in concrete ways to the project. ### How to become a Contributor - merged at least 1 pull request You are also encouraged to participate in the projects in the following ways: - Actively answer technical questions raised by community users in GitHub issues. - Help test the projects - Help review the pull requests (PRs) submitted by others - Help improve technical documents - Submit valuable issues - Report or fix known and unknown bugs - Write articles about source code analysis and usage cases for a project. - Give representations of Apollo topic in conferences. - Take part in our discussions of features, enhancements, etc. ## Committers Committers are contributors who have shown that they are committed to the continued development of the project through ongoing engagement with the community and recognized by PMCs for their outstanding contributions. ### How to become a Committer A Committer must have accomplished one or more of the following items: - Demonstrated a good sense of responsibility in PR reviews. - Demonstrated deep understanding of Apollo components by contributing significantly as: - Finished 2 or more tasks of Medium difficulty - Fixed 1 or more tasks of Hard difficulty - Nominated by one PMC member and gained more +1 than -1. ### Privileges and responsibilities - Control overall code quality of projects - Guide Contributors to contribute to the community continuously - Participate in design discussions ## Project Management Committee The PMC(Project Management Committee) functions as the core management team that oversees the Apollo community. The PMC has additional responsibilities over and above those of Committers. These responsibilities ensure the smooth running of the project. ### How to become a PMC member - Membership of the PMC is by invitation from the existing PMC members. - A nomination will result in discussion and then a vote by the existing PMC members. - PMC membership votes are subject to consensus approval of the current PMC members. ### Privileges and responsibilities - Handle reported security issues (CVE, etc.) - Nominate new committers and PMC members - Vote on new committers and new PMC members - Make major decisions for the future with respect to Apollo, such as project-level governance policies, management of sub-structures, security processes and so on - Make decisions when community consensus cannot be reached # Decision-making and voting Proposals and ideas can be submitted for agreement via a GitHub issue, PR, or GitHub Discussion. Major changes such as feature proposals and organization or process changes should be brought to the PMC. For the change to happen, the change must earn more +1 than -1. # Conflict resolution In general, we prefer that technical issues and other disputes upon which consensus can't be reached are amicably worked out between the persons involved. If a dispute cannot be decided independently, the PMC can be called in to resolve the issue by voting. The same PR can be used, or a separate PR can be opened for voting. # Changes in Governance Any change in this Governance document, or similar nature of changes to other governance related documents, shall go through the voting process as described in [Decision-making and voting](#decision-making-and-voting). # Credits The contents of this document are based on <http://oss-watch.ac.uk/resources/meritocraticgovernancemodel> by Ross Gardler and Gabriel Hanganu, and [TiDB Governance](https://github.com/pingcap/community/blob/master/GOVERNANCE.md).
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./SECURITY.md
# Security Policy ## Reporting a Vulnerability If you have apprehensions regarding Apollo's security or you discover vulnerability or potential threat, don’t hesitate to get in touch with us by dropping a mail at apollo-config@googlegroups.com. In the mail, specify the description of the issue or potential threat. You are also urged to recommend the way to reproduce and replicate the issue. The Apollo community will get back to you after assessing and analysing the findings. PLEASE PAY ATTENTION to report the security issue on the security email before disclosing it on public domain.
# Security Policy ## Reporting a Vulnerability If you have apprehensions regarding Apollo's security or you discover vulnerability or potential threat, don’t hesitate to get in touch with us by dropping a mail at apollo-config@googlegroups.com. In the mail, specify the description of the issue or potential threat. You are also urged to recommend the way to reproduce and replicate the issue. The Apollo community will get back to you after assessing and analysing the findings. PLEASE PAY ATTENTION to report the security issue on the security email before disclosing it on public domain.
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/test/resources/spring/config.namespace.placeholder.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:apollo="http://www.ctrip.com/schema/apollo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"> <apollo:config namespaces="${xxx.from.system.property}"/> <apollo:config namespaces="${yyy.from.system.property}" order="10"/> <bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest.TestXmlBean"> <property name="timeout" value="${timeout:100}"/> <property name="batch" value="${batch:200}"/> </bean> </beans>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:apollo="http://www.ctrip.com/schema/apollo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.ctrip.com/schema/apollo http://www.ctrip.com/schema/apollo.xsd"> <apollo:config namespaces="${xxx.from.system.property}"/> <apollo:config namespaces="${yyy.from.system.property}" order="10"/> <bean class="com.ctrip.framework.apollo.spring.XmlConfigPlaceholderTest.TestXmlBean"> <property name="timeout" value="${timeout:100}"/> <property name="batch" value="${batch:200}"/> </bean> </beans>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/assembly/assembly-descriptor.xml
<!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> <id>apollo-assembly</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <!--scripts --> <fileSet> <directory>src/main/scripts</directory> <outputDirectory>scripts</outputDirectory> <includes> <include>*.sh</include> </includes> <fileMode>0755</fileMode> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>src/main/config</directory> <outputDirectory>config</outputDirectory> <includes> <include>app.properties</include> </includes> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>src/main/config</directory> <outputDirectory>/</outputDirectory> <includes> <include>apollo-portal.conf</include> </includes> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>target/classes</directory> <outputDirectory>/config</outputDirectory> <includes> <include>application-github.properties</include> <include>apollo-env.properties</include> </includes> </fileSet> <!--artifact --> <fileSet> <directory>target</directory> <outputDirectory>/</outputDirectory> <includes> <include>${project.artifactId}-*.jar</include> </includes> <fileMode>0755</fileMode> </fileSet> </fileSets> </assembly>
<!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> <id>apollo-assembly</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <!--scripts --> <fileSet> <directory>src/main/scripts</directory> <outputDirectory>scripts</outputDirectory> <includes> <include>*.sh</include> </includes> <fileMode>0755</fileMode> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>src/main/config</directory> <outputDirectory>config</outputDirectory> <includes> <include>app.properties</include> </includes> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>src/main/config</directory> <outputDirectory>/</outputDirectory> <includes> <include>apollo-portal.conf</include> </includes> <lineEnding>unix</lineEnding> </fileSet> <fileSet> <directory>target/classes</directory> <outputDirectory>/config</outputDirectory> <includes> <include>application-github.properties</include> <include>apollo-env.properties</include> </includes> </fileSet> <!--artifact --> <fileSet> <directory>target</directory> <outputDirectory>/</outputDirectory> <includes> <include>${project.artifactId}-*.jar</include> </includes> <fileMode>0755</fileMode> </fileSet> </fileSets> </assembly>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./.github/ISSUE_TEMPLATE/bug_report_en.md
--- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- <!-- The content in here will not be show。To forbid duplication,easier search in the feature,before you create an issue,please check the following. If your question is a newer/beginner's,recommand to https://github.com/ctripcorp/apollo/discussions to ask it. --> - [ ] I have checked the [discussions](https://github.com/ctripcorp/apollo/discussions) - [ ] I have searched the [issues](https://github.com/ctripcorp/apollo/issues) of this repository and believe that this is not a duplicate. - [ ] I have checked the [FAQ](https://www.apolloconfig.com/#/zh/faq/common-issues-in-deployment-and-development-phase) of this repository and believe that this is not a duplicate. **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. 2. 3. 4. **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. ### Additional Details & Logs - Version - Error logs - Configuration - Platform and Operating System
--- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- <!-- The content in here will not be show。To forbid duplication,easier search in the feature,before you create an issue,please check the following. If your question is a newer/beginner's,recommand to https://github.com/ctripcorp/apollo/discussions to ask it. --> - [ ] I have checked the [discussions](https://github.com/ctripcorp/apollo/discussions) - [ ] I have searched the [issues](https://github.com/ctripcorp/apollo/issues) of this repository and believe that this is not a duplicate. - [ ] I have checked the [FAQ](https://www.apolloconfig.com/#/zh/faq/common-issues-in-deployment-and-development-phase) of this repository and believe that this is not a duplicate. **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. 2. 3. 4. **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. ### Additional Details & Logs - Version - Error logs - Configuration - Platform and Operating System
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./docs/zh/misc/apollo-benchmark.md
很多同学关心Apollo的性能和可靠性,以下数据是采集携程内部生产环境单台机器的数据。监控工具是[Cat](https://github.com/dianping/cat)。 ### 一、测试机器配置 #### 1.1 机器配置 4C12G #### 1.2 JVM参数 ```` -Xms6144m -Xmx6144m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=4096m -XX:MaxNewSize=4096m -XX:SurvivorRatio=8 -XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom ```` #### 1.3 JVM版本 1.8.0_60 #### 1.4 Apollo版本 0.9.0 #### 1.5 单台机器客户端连接数(客户端数) 5600 #### 1.6 集群总客户端连接数(客户端数) 10W+ ### 二、性能指标 #### 2.1 获取配置Http接口响应时间 QPS: 160 平均响应时间: 0.1ms 95线响应时间: 0.3ms 999线响应时间: 2.5ms >注:config service开启了配置缓存,更多信息可以参考[分布式部署指南中的缓存配置](zh/deployment/distributed-deployment-guide#_323-config-servicecacheenabled-是否开启配置缓存) #### 2.2 Config Server GC情况 YGC: 平均2Min一次,一次耗时300ms OGC: 平均1H一次,一次耗时380ms #### 2.3 CPU指标 LoadAverage:0.5 System CPU利用率:6% Process CPU利用率:8%
很多同学关心Apollo的性能和可靠性,以下数据是采集携程内部生产环境单台机器的数据。监控工具是[Cat](https://github.com/dianping/cat)。 ### 一、测试机器配置 #### 1.1 机器配置 4C12G #### 1.2 JVM参数 ```` -Xms6144m -Xmx6144m -Xss256k -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=384m -XX:NewSize=4096m -XX:MaxNewSize=4096m -XX:SurvivorRatio=8 -XX:+UseParNewGC -XX:ParallelGCThreads=4 -XX:MaxTenuringThreshold=9 -XX:+UseConcMarkSweepGC -XX:+DisableExplicitGC -XX:+UseCMSInitiatingOccupancyOnly -XX:+ScavengeBeforeFullGC -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=9 -XX:CMSInitiatingOccupancyFraction=60 -XX:+CMSClassUnloadingEnabled -XX:SoftRefLRUPolicyMSPerMB=0 -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingPermOccupancyFraction=70 -XX:+ExplicitGCInvokesConcurrent -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintHeapAtGC -XX:+HeapDumpOnOutOfMemoryError -XX:-OmitStackTraceInFastThrow -Duser.timezone=Asia/Shanghai -Dclient.encoding.override=UTF-8 -Dfile.encoding=UTF-8 -Djava.security.egd=file:/dev/./urandom ```` #### 1.3 JVM版本 1.8.0_60 #### 1.4 Apollo版本 0.9.0 #### 1.5 单台机器客户端连接数(客户端数) 5600 #### 1.6 集群总客户端连接数(客户端数) 10W+ ### 二、性能指标 #### 2.1 获取配置Http接口响应时间 QPS: 160 平均响应时间: 0.1ms 95线响应时间: 0.3ms 999线响应时间: 2.5ms >注:config service开启了配置缓存,更多信息可以参考[分布式部署指南中的缓存配置](zh/deployment/distributed-deployment-guide#_323-config-servicecacheenabled-是否开启配置缓存) #### 2.2 Config Server GC情况 YGC: 平均2Min一次,一次耗时300ms OGC: 平均1H一次,一次耗时380ms #### 2.3 CPU指标 LoadAverage:0.5 System CPU利用率:6% Process CPU利用率:8%
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-demo/pom.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <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/xsd/maven-4.0.0.xsd"> <parent> <artifactId>apollo</artifactId> <groupId>com.ctrip.framework.apollo</groupId> <version>${revision}</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>apollo-demo</artifactId> <name>Apollo Demo</name> <packaging>jar</packaging> <properties> <java.version>1.7</java.version> <github.path>${project.artifactId}</github.path> </properties> <dependencies> <dependency> <groupId>com.ctrip.framework.apollo</groupId> <artifactId>apollo-client</artifactId> <version>${project.version}</version> </dependency> <!-- for spring demo --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </dependency> <!-- for spring boot demo --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifactId> </dependency> <!-- for refresh scope demo --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-context</artifactId> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> </dependency> <!-- take over jcl --> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> </dependency> </dependencies> </project>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <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/xsd/maven-4.0.0.xsd"> <parent> <artifactId>apollo</artifactId> <groupId>com.ctrip.framework.apollo</groupId> <version>${revision}</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>apollo-demo</artifactId> <name>Apollo Demo</name> <packaging>jar</packaging> <properties> <java.version>1.7</java.version> <github.path>${project.artifactId}</github.path> </properties> <dependencies> <dependency> <groupId>com.ctrip.framework.apollo</groupId> <artifactId>apollo-client</artifactId> <version>${project.version}</version> </dependency> <!-- for spring demo --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> </dependency> <!-- for spring boot demo --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifactId> </dependency> <!-- for refresh scope demo --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-context</artifactId> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> </dependency> <!-- take over jcl --> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> </dependency> </dependencies> </project>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-demo/src/main/resources/log4j2.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <configuration monitorInterval="60"> <appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="[apollo-demo][%t]%d %-5p [%c] %m%n"/> </Console> <Async name="Async" includeLocation="true"> <AppenderRef ref="Console"/> </Async> </appenders> <loggers> <logger name="com.ctrip.framework.apollo" additivity="false" level="INFO"> <AppenderRef ref="Async"/> </logger> <logger name="com.ctrip.framework.apollo.demo" additivity="false" level="DEBUG"> <AppenderRef ref="Async"/> </logger> <root level="INFO"> <AppenderRef ref="Async"/> </root> </loggers> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <configuration monitorInterval="60"> <appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="[apollo-demo][%t]%d %-5p [%c] %m%n"/> </Console> <Async name="Async" includeLocation="true"> <AppenderRef ref="Console"/> </Async> </appenders> <loggers> <logger name="com.ctrip.framework.apollo" additivity="false" level="INFO"> <AppenderRef ref="Async"/> </logger> <logger name="com.ctrip.framework.apollo.demo" additivity="false" level="DEBUG"> <AppenderRef ref="Async"/> </logger> <root level="INFO"> <AppenderRef ref="Async"/> </root> </loggers> </configuration>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./docs/zh/usage/apollo-user-practices.md
Apollo 配置中心的实践案例,供大家参考: * [Apollo+ES源码改造,构建民生银行的ELK日志平台配置管理中心](https://mp.weixin.qq.com/s/VHugn0vgNu4m56V49geC4w) * [Apollo在有赞的实践](https://mp.weixin.qq.com/s/Ge14UeY9Gm2Hrk--E47eJQ) * [微服务版本切换初始设计思路](https://blog.llyweb.com/articles/2020/08/11/1597149013480.html) * [Alibaba Sentinel Push模式 规则推送至Apollo配置中心](https://anilople.github.io/Sentinel)
Apollo 配置中心的实践案例,供大家参考: * [Apollo+ES源码改造,构建民生银行的ELK日志平台配置管理中心](https://mp.weixin.qq.com/s/VHugn0vgNu4m56V49geC4w) * [Apollo在有赞的实践](https://mp.weixin.qq.com/s/Ge14UeY9Gm2Hrk--E47eJQ) * [微服务版本切换初始设计思路](https://blog.llyweb.com/articles/2020/08/11/1597149013480.html) * [Alibaba Sentinel Push模式 规则推送至Apollo配置中心](https://anilople.github.io/Sentinel)
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./docs/zh/faq/common-issues-in-deployment-and-development-phase.md
### 1. windows怎么执行build.sh? 安装[Git Bash](https://git-for-windows.github.io/),然后运行 “./build.sh” 注意前面 “./” ### 2. 本地运行时Portal一直报Env is down. 默认config service启动在8080端口,admin service启动在8090端口。请确认这两个端口是否被其它应用程序占用。 如果还伴有异常信息:org.springframework.web.client.HttpClientErrorException: 405 Method Not Allowed,一般是由于本地启动了`ShadowSocks`,因为`ShadowSocks`默认会占用8090端口。 1.1.0版本增加了**系统信息**页面,可以通过`管理员工具` -> `系统信息`查看当前各个环境的Meta Server以及admin service信息,有助于排查问题。 ### 3. admin server 或者 config server 注册了内网IP,导致portal或者client访问不了admin server或config server 请参考[网络策略](zh/deployment/distributed-deployment-guide?id=_14-网络策略)。 ### 4. Portal如何增加环境? #### 4.1 1.6.0及以上的版本 1.6.0版本增加了自定义环境的功能,可以在不修改代码的情况增加环境 1. protaldb增加环境,参考[3.1 调整ApolloPortalDB配置](zh/deployment/distributed-deployment-guide?id=_31-调整apolloportaldb配置) 2. 为apollo-portal添加新增环境对应的meta server地址,具体参考:[2.2.1.1.2.4 配置apollo-portal的meta service信息](zh/deployment/distributed-deployment-guide?id=_221124-配置apollo-portal的meta-service信息)。apollo-client在新的环境下使用时也需要做好相应的配置,具体参考:[1.2.2 Apollo Meta Server](zh/usage/java-sdk-user-guide?id=_122-apollo-meta-server)。 >注1:一套Portal可以管理多个环境,但是每个环境都需要独立部署一套Config Service、Admin Service和ApolloConfigDB,具体请参考:[2.1.2 创建ApolloConfigDB](zh/deployment/distributed-deployment-guide?id=_212-创建apolloconfigdb),[3.2 调整ApolloConfigDB配置](zh/deployment/distributed-deployment-guide?id=_32-调整apolloconfigdb配置),[2.2.1.1.2 配置数据库连接信息](zh/deployment/distributed-deployment-guide?id=_22112-配置数据库连接信息) > 注2:如果是为已经运行了一段时间的Apollo配置中心增加环境,别忘了参考[2.1.2.4 从别的环境导入ApolloConfigDB的项目数据](zh/deployment/distributed-deployment-guide?id=_2124-从别的环境导入apolloconfigdb的项目数据)对新的环境做初始化 #### 4.2 1.5.1及之前的版本 ##### 4.2.1 添加Apollo预先定义好的环境 如果需要添加的环境是Apollo预先定义的环境(DEV, FAT, UAT, PRO),需要两步操作: 1. protaldb增加环境,参考[3.1 调整ApolloPortalDB配置](zh/deployment/distributed-deployment-guide?id=_31-调整apolloportaldb配置) 2. 为apollo-portal添加新增环境对应的meta server地址,具体参考:[2.2.1.1.2.4 配置apollo-portal的meta service信息](zh/deployment/distributed-deployment-guide?id=_221124-配置apollo-portal的meta-service信息)。apollo-client在新的环境下使用时也需要做好相应的配置,具体参考:[1.2.2 Apollo Meta Server](zh/usage/java-sdk-user-guide?id=_122-apollo-meta-server)。 >注1:一套Portal可以管理多个环境,但是每个环境都需要独立部署一套Config Service、Admin Service和ApolloConfigDB,具体请参考:[2.1.2 创建ApolloConfigDB](zh/deployment/distributed-deployment-guide?id=_212-创建apolloconfigdb),[3.2 调整ApolloConfigDB配置](zh/deployment/distributed-deployment-guide?id=_32-调整apolloconfigdb配置),[2.2.1.1.2 配置数据库连接信息](zh/deployment/distributed-deployment-guide?id=_22112-配置数据库连接信息) > 注2:如果是为已经运行了一段时间的Apollo配置中心增加环境,别忘了参考[2.1.2.4 从别的环境导入ApolloConfigDB的项目数据](zh/deployment/distributed-deployment-guide?id=_2124-从别的环境导入apolloconfigdb的项目数据)对新的环境做初始化 ##### 4.2.2 添加自定义的环境 如果需要添加的环境不是Apollo预先定义的环境,请参照如下步骤操作: 1. 假设需要添加的环境名称叫beta 2. 修改[com.ctrip.framework.apollo.core.enums.Env](https://github.com/ctripcorp/apollo/blob/master/apollo-core/src/main/java/com/ctrip/framework/apollo/core/enums/Env.java)类,在其中加入`BETA`枚举: ```java public enum Env{ LOCAL, DEV, BETA, FWS, FAT, UAT, LPT, PRO, TOOLS, UNKNOWN; ... } ``` 3. 修改[com.ctrip.framework.apollo.core.enums.EnvUtils](https://github.com/ctripcorp/apollo/blob/master/apollo-core/src/main/java/com/ctrip/framework/apollo/core/enums/EnvUtils.java)类,在其中加入`BETA`枚举的转换逻辑: ```java public final class EnvUtils { public static Env transformEnv(String envName) { if (StringUtils.isBlank(envName)) { return Env.UNKNOWN; } switch (envName.trim().toUpperCase()) { ... case "BETA": return Env.BETA; ... default: return Env.UNKNOWN; } } } ``` 4. 修改[apollo-env.properties](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/resources/apollo-env.properties),增加`beta.meta`占位符: ```properties local.meta=http://localhost:8080 dev.meta=${dev_meta} fat.meta=${fat_meta} beta.meta=${beta_meta} uat.meta=${uat_meta} lpt.meta=${lpt_meta} pro.meta=${pro_meta} ``` 5. 修改[com.ctrip.framework.apollo.core.internals.LegacyMetaServerProvider](https://github.com/ctripcorp/apollo/blob/master/apollo-core/src/main/java/com/ctrip/framework/apollo/core/internals/LegacyMetaServerProvider.java)类,增加读取`BETA`环境的meta server地址逻辑: ```java public class LegacyMetaServerProvider { ... domains.put(Env.BETA, getMetaServerAddress(prop, "beta_meta", "beta.meta")); ... } ``` 6. protaldb增加`BETA`环境,参考[3.1 调整ApolloPortalDB配置](zh/deployment/distributed-deployment-guide?id=_31-调整apolloportaldb配置) 7. 为apollo-portal添加新增环境对应的meta server地址,具体参考:[2.2.1.1.2.4 配置apollo-portal的meta service信息](zh/deployment/distributed-deployment-guide?id=_221124-配置apollo-portal的meta-service信息)。apollo-client在新的环境下使用时也需要做好相应的配置,具体参考:[1.2.2 Apollo Meta Server](zh/usage/java-sdk-user-guide?id=_122-apollo-meta-server)。 >注1:一套Portal可以管理多个环境,但是每个环境都需要独立部署一套Config Service、Admin Service和ApolloConfigDB,具体请参考:[2.1.2 创建ApolloConfigDB](zh/deployment/distributed-deployment-guide?id=_212-创建apolloconfigdb),[3.2 调整ApolloConfigDB配置](zh/deployment/distributed-deployment-guide?id=_32-调整apolloconfigdb配置),[2.2.1.1.2 配置数据库连接信息](zh/deployment/distributed-deployment-guide?id=_22112-配置数据库连接信息) > 注2:如果是为已经运行了一段时间的Apollo配置中心增加环境,别忘了参考[2.1.2.4 从别的环境导入ApolloConfigDB的项目数据](zh/deployment/distributed-deployment-guide?id=_2124-从别的环境导入apolloconfigdb的项目数据)对新的环境做初始化 ### 5. 如何删除应用、集群、Namespace? 0.11.0版本开始Apollo管理员增加了删除应用、集群和AppNamespace的页面,建议使用该页面进行删除。 页面入口: ![delete-app-cluster-namespace-entry](https://raw.githubusercontent.com/ctripcorp/apollo/master/doc/images/delete-app-cluster-namespace-entry.png) 页面详情: ![delete-app-cluster-namespace-detail](https://raw.githubusercontent.com/ctripcorp/apollo/master/doc/images/delete-app-cluster-namespace-detail.png) ### 6. 客户端多块网卡造成获取IP不准,如何解决? 获取客户端网卡逻辑在1.4.0版本有所调整,所以需要根据客户端版本区分 #### 6.1 apollo-client为1.3.0及之前的版本 如果有多网卡,且都是普通网卡的话,需要在/etc/hosts里面加一条映射关系来提升权重。 格式:`ip ${hostname}` 这里的${hostname}就是你在机器上执行hostname的结果。 比如正确IP为:192.168.1.50,hostname执行结果为:jim-ubuntu-pc 那么最终在hosts文件映射的记录为: ``` 192.168.1.50 jim-ubuntu-pc ``` #### 6.2 apollo-client为1.4.0及之后的版本 如果有多网卡,且都是普通网卡的话,可以通过调整它们在系统中的顺序来改变优先级,顺序在前的优先级更高。 ### 7. 通过Apollo动态调整Spring Boot的Logging level 可以参考[apollo-use-cases](https://github.com/ctripcorp/apollo-use-cases)项目中的[spring-cloud-logger](https://github.com/ctripcorp/apollo-use-cases/tree/master/spring-cloud-logger)和[spring-boot-logger](https://github.com/ctripcorp/apollo-use-cases/tree/master/spring-boot-logger)代码示例。 ### 8. 将Config Service和Admin Service注册到单独的Eureka Server上 Apollo默认自带了Eureka作为内部的注册中心实现,一般情况下不需要考虑为Apollo单独部署注册中心。 不过有些公司自己已经有了一套Eureka,如果希望把Apollo的Config Service和Admin Service也注册过去实现统一管理的话,可以按照如下步骤操作: #### 1. 配置Config Service不启动内置Eureka Server ##### 1.1 1.5.0及以上版本 为apollo-configservice配置`apollo.eureka.server.enabled=false`即可,通过bootstrap.yml或-D参数等方式皆可。 ##### 1.2 1.5.0之前的版本 修改[com.ctrip.framework.apollo.configservice.ConfigServiceApplication](https://github.com/ctripcorp/apollo/blob/master/apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ConfigServiceApplication.java),把`@EnableEurekaServer`改为`@EnableEurekaClient` ```java @EnableEurekaClient @EnableAspectJAutoProxy @EnableAutoConfiguration // (exclude = EurekaClientConfigBean.class) @Configuration @EnableTransactionManagement @PropertySource(value = {"classpath:configservice.properties"}) @ComponentScan(basePackageClasses = {ApolloCommonConfig.class, ApolloBizConfig.class, ConfigServiceApplication.class, ApolloMetaServiceConfig.class}) public class ConfigServiceApplication { ... } ``` #### 2. 修改ApolloConfigDB.ServerConfig表中的`eureka.service.url`,指向自己的Eureka地址 比如自己的Eureka服务地址是1.1.1.1:8761和2.2.2.2:8761,那么就将ApolloConfigDB.ServerConfig表中设置eureka.service.url为: ``` http://1.1.1.1:8761/eureka/,http://2.2.2.2:8761/eureka/ ``` 需要注意的是更改Eureka地址只需要改ApolloConfigDB.ServerConfig表中的`eureka.service.url`即可,不需要修改meta server地址。 > 默认情况下,meta service和config service是部署在同一个JVM进程,所以meta service的地址就是config service的地址,修改Eureka地址时不需要修改meta server地址。 ### 9. Spring Boot中使用`ConditionalOnProperty`读取不到配置 `@ConditionalOnProperty`功能从0.10.0版本开始支持,具体可以参考 [Spring Boot集成方式](zh/usage/java-sdk-user-guide?id=_3213-spring-boot集成方式(推荐)) ### 10. 多机房如何实现A机房的客户端就近读取A机房的config service,B机房的客户端就近读取B机房的config service? 请参考[Issue 1294](https://github.com/ctripcorp/apollo/issues/1294),该案例中由于中美机房相距甚远,所以需要config db两地部署,如果是同城多机房的话,两个机房的config service可以连同一个config db。 ### 11. apollo是否有支持HEAD请求的页面?阿里云slb配置健康检查只支持HEAD请求 apollo的每个服务都有`/health`页面的,该页面是apollo用来做健康检测的,支持各种请求方法,如GET, POST, HEAD等。 ### 12. apollo如何配置查看权限? 从1.1.0版本开始,apollo-portal增加了查看权限的支持,可以支持配置某个环境只允许项目成员查看私有Namespace的配置。 这里的项目成员是指: 1. 项目的管理员 2. 具备该私有Namespace在该环境下的修改或发布权限 配置方式很简单,用超级管理员账号登录后,进入`管理员工具 - 系统参数`页面新增或修改`configView.memberOnly.envs`配置项即可。 ![configView.memberOnly.envs](https://user-images.githubusercontent.com/837658/46456519-c155e100-c7e1-11e8-969b-8f332379fa29.png) ### 13. apollo如何放在独立的tomcat中跑? 有些公司的运维策略可能会要求必须使用独立的tomcat跑应用,不允许apollo默认的startup.sh方式运行,下面以apollo-configservice为例简述一下如何使apollo服务端运行在独立的tomcat中: 1. 获取apollo代码(生产部署建议用release的版本) 2. 修改apollo-configservice的pom.xml,增加`<packaging>war</packaging>` 3. 按照分布式部署文档配置build.sh,然后打包 4. 把apollo-configservice的war包放到tomcat下 * cp apollo-configservice/target/apollo-configservice-xxx.war ${tomcat-dir}/webapps/ROOT.war 运行tomcat的startup.sh 5. 运行tomcat的startup.sh 另外,apollo还有一些调优参数建议在tomcat的server.xml中配置一下,可以参考[application.properties](https://github.com/ctripcorp/apollo/blob/master/apollo-common/src/main/resources/application.properties#L12) ### 14. 注册中心Eureka如何替换为zookeeper? 许多公司微服务项目已经在使用zookeeper,如果出于方便服务管理的目的,希望Eureka替换为zookeeper的情况,可以参考[@hanyidreamer](https://github.com/hanyidreamer)贡献的改造步骤:[注册中心Eureka替换为zookeeper](https://blog.csdn.net/u014732209/article/details/89555535) ### 15. 本地多人同时开发,如何实现配置不一样且互不影响? 参考[#1560](https://github.com/ctripcorp/apollo/issues/1560) ### 16. Portal挂载到nginx/slb后如何设置相对路径? 一般情况下建议直接使用根目录来挂载portal,不过如果有些情况希望和其它应用共用nginx/slb,需要加上相对路径(如/apollo),那么可以按照下面的方式配置。 #### 16.1 Portal为1.7.0及以上版本 首先为apollo-portal增加-D参数`server.servlet.context-path=/apollo`或系统环境变量`SERVER_SERVLET_CONTEXT_PATH=/apollo`。 然后在nginx/slb上配置转发即可,以nginx为例: ``` location /apollo/ { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8070/apollo/; } ``` #### 16.2 Portal为1.6.0及以上版本 首先为portal加上`prefix.path=/apollo`配置参数,配置方式很简单,用超级管理员账号登录后,进入`管理员工具 - 系统参数`页面新增或修改`prefix.path`配置项即可。 然后在nginx/slb上配置转发即可,以nginx为例: ``` location /apollo/ { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8070/; } ```
### 1. windows怎么执行build.sh? 安装[Git Bash](https://git-for-windows.github.io/),然后运行 “./build.sh” 注意前面 “./” ### 2. 本地运行时Portal一直报Env is down. 默认config service启动在8080端口,admin service启动在8090端口。请确认这两个端口是否被其它应用程序占用。 如果还伴有异常信息:org.springframework.web.client.HttpClientErrorException: 405 Method Not Allowed,一般是由于本地启动了`ShadowSocks`,因为`ShadowSocks`默认会占用8090端口。 1.1.0版本增加了**系统信息**页面,可以通过`管理员工具` -> `系统信息`查看当前各个环境的Meta Server以及admin service信息,有助于排查问题。 ### 3. admin server 或者 config server 注册了内网IP,导致portal或者client访问不了admin server或config server 请参考[网络策略](zh/deployment/distributed-deployment-guide?id=_14-网络策略)。 ### 4. Portal如何增加环境? #### 4.1 1.6.0及以上的版本 1.6.0版本增加了自定义环境的功能,可以在不修改代码的情况增加环境 1. protaldb增加环境,参考[3.1 调整ApolloPortalDB配置](zh/deployment/distributed-deployment-guide?id=_31-调整apolloportaldb配置) 2. 为apollo-portal添加新增环境对应的meta server地址,具体参考:[2.2.1.1.2.4 配置apollo-portal的meta service信息](zh/deployment/distributed-deployment-guide?id=_221124-配置apollo-portal的meta-service信息)。apollo-client在新的环境下使用时也需要做好相应的配置,具体参考:[1.2.2 Apollo Meta Server](zh/usage/java-sdk-user-guide?id=_122-apollo-meta-server)。 >注1:一套Portal可以管理多个环境,但是每个环境都需要独立部署一套Config Service、Admin Service和ApolloConfigDB,具体请参考:[2.1.2 创建ApolloConfigDB](zh/deployment/distributed-deployment-guide?id=_212-创建apolloconfigdb),[3.2 调整ApolloConfigDB配置](zh/deployment/distributed-deployment-guide?id=_32-调整apolloconfigdb配置),[2.2.1.1.2 配置数据库连接信息](zh/deployment/distributed-deployment-guide?id=_22112-配置数据库连接信息) > 注2:如果是为已经运行了一段时间的Apollo配置中心增加环境,别忘了参考[2.1.2.4 从别的环境导入ApolloConfigDB的项目数据](zh/deployment/distributed-deployment-guide?id=_2124-从别的环境导入apolloconfigdb的项目数据)对新的环境做初始化 #### 4.2 1.5.1及之前的版本 ##### 4.2.1 添加Apollo预先定义好的环境 如果需要添加的环境是Apollo预先定义的环境(DEV, FAT, UAT, PRO),需要两步操作: 1. protaldb增加环境,参考[3.1 调整ApolloPortalDB配置](zh/deployment/distributed-deployment-guide?id=_31-调整apolloportaldb配置) 2. 为apollo-portal添加新增环境对应的meta server地址,具体参考:[2.2.1.1.2.4 配置apollo-portal的meta service信息](zh/deployment/distributed-deployment-guide?id=_221124-配置apollo-portal的meta-service信息)。apollo-client在新的环境下使用时也需要做好相应的配置,具体参考:[1.2.2 Apollo Meta Server](zh/usage/java-sdk-user-guide?id=_122-apollo-meta-server)。 >注1:一套Portal可以管理多个环境,但是每个环境都需要独立部署一套Config Service、Admin Service和ApolloConfigDB,具体请参考:[2.1.2 创建ApolloConfigDB](zh/deployment/distributed-deployment-guide?id=_212-创建apolloconfigdb),[3.2 调整ApolloConfigDB配置](zh/deployment/distributed-deployment-guide?id=_32-调整apolloconfigdb配置),[2.2.1.1.2 配置数据库连接信息](zh/deployment/distributed-deployment-guide?id=_22112-配置数据库连接信息) > 注2:如果是为已经运行了一段时间的Apollo配置中心增加环境,别忘了参考[2.1.2.4 从别的环境导入ApolloConfigDB的项目数据](zh/deployment/distributed-deployment-guide?id=_2124-从别的环境导入apolloconfigdb的项目数据)对新的环境做初始化 ##### 4.2.2 添加自定义的环境 如果需要添加的环境不是Apollo预先定义的环境,请参照如下步骤操作: 1. 假设需要添加的环境名称叫beta 2. 修改[com.ctrip.framework.apollo.core.enums.Env](https://github.com/ctripcorp/apollo/blob/master/apollo-core/src/main/java/com/ctrip/framework/apollo/core/enums/Env.java)类,在其中加入`BETA`枚举: ```java public enum Env{ LOCAL, DEV, BETA, FWS, FAT, UAT, LPT, PRO, TOOLS, UNKNOWN; ... } ``` 3. 修改[com.ctrip.framework.apollo.core.enums.EnvUtils](https://github.com/ctripcorp/apollo/blob/master/apollo-core/src/main/java/com/ctrip/framework/apollo/core/enums/EnvUtils.java)类,在其中加入`BETA`枚举的转换逻辑: ```java public final class EnvUtils { public static Env transformEnv(String envName) { if (StringUtils.isBlank(envName)) { return Env.UNKNOWN; } switch (envName.trim().toUpperCase()) { ... case "BETA": return Env.BETA; ... default: return Env.UNKNOWN; } } } ``` 4. 修改[apollo-env.properties](https://github.com/ctripcorp/apollo/blob/master/apollo-portal/src/main/resources/apollo-env.properties),增加`beta.meta`占位符: ```properties local.meta=http://localhost:8080 dev.meta=${dev_meta} fat.meta=${fat_meta} beta.meta=${beta_meta} uat.meta=${uat_meta} lpt.meta=${lpt_meta} pro.meta=${pro_meta} ``` 5. 修改[com.ctrip.framework.apollo.core.internals.LegacyMetaServerProvider](https://github.com/ctripcorp/apollo/blob/master/apollo-core/src/main/java/com/ctrip/framework/apollo/core/internals/LegacyMetaServerProvider.java)类,增加读取`BETA`环境的meta server地址逻辑: ```java public class LegacyMetaServerProvider { ... domains.put(Env.BETA, getMetaServerAddress(prop, "beta_meta", "beta.meta")); ... } ``` 6. protaldb增加`BETA`环境,参考[3.1 调整ApolloPortalDB配置](zh/deployment/distributed-deployment-guide?id=_31-调整apolloportaldb配置) 7. 为apollo-portal添加新增环境对应的meta server地址,具体参考:[2.2.1.1.2.4 配置apollo-portal的meta service信息](zh/deployment/distributed-deployment-guide?id=_221124-配置apollo-portal的meta-service信息)。apollo-client在新的环境下使用时也需要做好相应的配置,具体参考:[1.2.2 Apollo Meta Server](zh/usage/java-sdk-user-guide?id=_122-apollo-meta-server)。 >注1:一套Portal可以管理多个环境,但是每个环境都需要独立部署一套Config Service、Admin Service和ApolloConfigDB,具体请参考:[2.1.2 创建ApolloConfigDB](zh/deployment/distributed-deployment-guide?id=_212-创建apolloconfigdb),[3.2 调整ApolloConfigDB配置](zh/deployment/distributed-deployment-guide?id=_32-调整apolloconfigdb配置),[2.2.1.1.2 配置数据库连接信息](zh/deployment/distributed-deployment-guide?id=_22112-配置数据库连接信息) > 注2:如果是为已经运行了一段时间的Apollo配置中心增加环境,别忘了参考[2.1.2.4 从别的环境导入ApolloConfigDB的项目数据](zh/deployment/distributed-deployment-guide?id=_2124-从别的环境导入apolloconfigdb的项目数据)对新的环境做初始化 ### 5. 如何删除应用、集群、Namespace? 0.11.0版本开始Apollo管理员增加了删除应用、集群和AppNamespace的页面,建议使用该页面进行删除。 页面入口: ![delete-app-cluster-namespace-entry](https://raw.githubusercontent.com/ctripcorp/apollo/master/doc/images/delete-app-cluster-namespace-entry.png) 页面详情: ![delete-app-cluster-namespace-detail](https://raw.githubusercontent.com/ctripcorp/apollo/master/doc/images/delete-app-cluster-namespace-detail.png) ### 6. 客户端多块网卡造成获取IP不准,如何解决? 获取客户端网卡逻辑在1.4.0版本有所调整,所以需要根据客户端版本区分 #### 6.1 apollo-client为1.3.0及之前的版本 如果有多网卡,且都是普通网卡的话,需要在/etc/hosts里面加一条映射关系来提升权重。 格式:`ip ${hostname}` 这里的${hostname}就是你在机器上执行hostname的结果。 比如正确IP为:192.168.1.50,hostname执行结果为:jim-ubuntu-pc 那么最终在hosts文件映射的记录为: ``` 192.168.1.50 jim-ubuntu-pc ``` #### 6.2 apollo-client为1.4.0及之后的版本 如果有多网卡,且都是普通网卡的话,可以通过调整它们在系统中的顺序来改变优先级,顺序在前的优先级更高。 ### 7. 通过Apollo动态调整Spring Boot的Logging level 可以参考[apollo-use-cases](https://github.com/ctripcorp/apollo-use-cases)项目中的[spring-cloud-logger](https://github.com/ctripcorp/apollo-use-cases/tree/master/spring-cloud-logger)和[spring-boot-logger](https://github.com/ctripcorp/apollo-use-cases/tree/master/spring-boot-logger)代码示例。 ### 8. 将Config Service和Admin Service注册到单独的Eureka Server上 Apollo默认自带了Eureka作为内部的注册中心实现,一般情况下不需要考虑为Apollo单独部署注册中心。 不过有些公司自己已经有了一套Eureka,如果希望把Apollo的Config Service和Admin Service也注册过去实现统一管理的话,可以按照如下步骤操作: #### 1. 配置Config Service不启动内置Eureka Server ##### 1.1 1.5.0及以上版本 为apollo-configservice配置`apollo.eureka.server.enabled=false`即可,通过bootstrap.yml或-D参数等方式皆可。 ##### 1.2 1.5.0之前的版本 修改[com.ctrip.framework.apollo.configservice.ConfigServiceApplication](https://github.com/ctripcorp/apollo/blob/master/apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/ConfigServiceApplication.java),把`@EnableEurekaServer`改为`@EnableEurekaClient` ```java @EnableEurekaClient @EnableAspectJAutoProxy @EnableAutoConfiguration // (exclude = EurekaClientConfigBean.class) @Configuration @EnableTransactionManagement @PropertySource(value = {"classpath:configservice.properties"}) @ComponentScan(basePackageClasses = {ApolloCommonConfig.class, ApolloBizConfig.class, ConfigServiceApplication.class, ApolloMetaServiceConfig.class}) public class ConfigServiceApplication { ... } ``` #### 2. 修改ApolloConfigDB.ServerConfig表中的`eureka.service.url`,指向自己的Eureka地址 比如自己的Eureka服务地址是1.1.1.1:8761和2.2.2.2:8761,那么就将ApolloConfigDB.ServerConfig表中设置eureka.service.url为: ``` http://1.1.1.1:8761/eureka/,http://2.2.2.2:8761/eureka/ ``` 需要注意的是更改Eureka地址只需要改ApolloConfigDB.ServerConfig表中的`eureka.service.url`即可,不需要修改meta server地址。 > 默认情况下,meta service和config service是部署在同一个JVM进程,所以meta service的地址就是config service的地址,修改Eureka地址时不需要修改meta server地址。 ### 9. Spring Boot中使用`ConditionalOnProperty`读取不到配置 `@ConditionalOnProperty`功能从0.10.0版本开始支持,具体可以参考 [Spring Boot集成方式](zh/usage/java-sdk-user-guide?id=_3213-spring-boot集成方式(推荐)) ### 10. 多机房如何实现A机房的客户端就近读取A机房的config service,B机房的客户端就近读取B机房的config service? 请参考[Issue 1294](https://github.com/ctripcorp/apollo/issues/1294),该案例中由于中美机房相距甚远,所以需要config db两地部署,如果是同城多机房的话,两个机房的config service可以连同一个config db。 ### 11. apollo是否有支持HEAD请求的页面?阿里云slb配置健康检查只支持HEAD请求 apollo的每个服务都有`/health`页面的,该页面是apollo用来做健康检测的,支持各种请求方法,如GET, POST, HEAD等。 ### 12. apollo如何配置查看权限? 从1.1.0版本开始,apollo-portal增加了查看权限的支持,可以支持配置某个环境只允许项目成员查看私有Namespace的配置。 这里的项目成员是指: 1. 项目的管理员 2. 具备该私有Namespace在该环境下的修改或发布权限 配置方式很简单,用超级管理员账号登录后,进入`管理员工具 - 系统参数`页面新增或修改`configView.memberOnly.envs`配置项即可。 ![configView.memberOnly.envs](https://user-images.githubusercontent.com/837658/46456519-c155e100-c7e1-11e8-969b-8f332379fa29.png) ### 13. apollo如何放在独立的tomcat中跑? 有些公司的运维策略可能会要求必须使用独立的tomcat跑应用,不允许apollo默认的startup.sh方式运行,下面以apollo-configservice为例简述一下如何使apollo服务端运行在独立的tomcat中: 1. 获取apollo代码(生产部署建议用release的版本) 2. 修改apollo-configservice的pom.xml,增加`<packaging>war</packaging>` 3. 按照分布式部署文档配置build.sh,然后打包 4. 把apollo-configservice的war包放到tomcat下 * cp apollo-configservice/target/apollo-configservice-xxx.war ${tomcat-dir}/webapps/ROOT.war 运行tomcat的startup.sh 5. 运行tomcat的startup.sh 另外,apollo还有一些调优参数建议在tomcat的server.xml中配置一下,可以参考[application.properties](https://github.com/ctripcorp/apollo/blob/master/apollo-common/src/main/resources/application.properties#L12) ### 14. 注册中心Eureka如何替换为zookeeper? 许多公司微服务项目已经在使用zookeeper,如果出于方便服务管理的目的,希望Eureka替换为zookeeper的情况,可以参考[@hanyidreamer](https://github.com/hanyidreamer)贡献的改造步骤:[注册中心Eureka替换为zookeeper](https://blog.csdn.net/u014732209/article/details/89555535) ### 15. 本地多人同时开发,如何实现配置不一样且互不影响? 参考[#1560](https://github.com/ctripcorp/apollo/issues/1560) ### 16. Portal挂载到nginx/slb后如何设置相对路径? 一般情况下建议直接使用根目录来挂载portal,不过如果有些情况希望和其它应用共用nginx/slb,需要加上相对路径(如/apollo),那么可以按照下面的方式配置。 #### 16.1 Portal为1.7.0及以上版本 首先为apollo-portal增加-D参数`server.servlet.context-path=/apollo`或系统环境变量`SERVER_SERVLET_CONTEXT_PATH=/apollo`。 然后在nginx/slb上配置转发即可,以nginx为例: ``` location /apollo/ { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8070/apollo/; } ``` #### 16.2 Portal为1.6.0及以上版本 首先为portal加上`prefix.path=/apollo`配置参数,配置方式很简单,用超级管理员账号登录后,进入`管理员工具 - 系统参数`页面新增或修改`prefix.path`配置项即可。 然后在nginx/slb上配置转发即可,以nginx为例: ``` location /apollo/ { proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Server $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8070/; } ```
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-biz/pom.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <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/xsd/maven-4.0.0.xsd"> <parent> <groupId>com.ctrip.framework.apollo</groupId> <artifactId>apollo</artifactId> <version>${revision}</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>apollo-biz</artifactId> <name>Apollo Biz</name> <packaging>jar</packaging> <properties> <github.path>${project.artifactId}</github.path> </properties> <dependencies> <dependency> <groupId>com.ctrip.framework.apollo</groupId> <artifactId>apollo-common</artifactId> </dependency> <!-- eureka --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <!-- end of eureka --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-discovery</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>test</scope> </dependency> </dependencies> </project>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <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/xsd/maven-4.0.0.xsd"> <parent> <groupId>com.ctrip.framework.apollo</groupId> <artifactId>apollo</artifactId> <version>${revision}</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>apollo-biz</artifactId> <name>Apollo Biz</name> <packaging>jar</packaging> <properties> <github.path>${project.artifactId}</github.path> </properties> <dependencies> <dependency> <groupId>com.ctrip.framework.apollo</groupId> <artifactId>apollo-common</artifactId> </dependency> <!-- eureka --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <!-- end of eureka --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-consul-discovery</artifactId> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>test</scope> </dependency> </dependencies> </project>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-adminservice/src/main/resources/logback.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <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-adminservice.log}" /> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <include resource="org/springframework/boot/logging/logback/console-appender.xml" /> <root level="INFO"> <if condition='isDefined("LOG_APPENDERS")'> <then> <if condition='property("LOG_APPENDERS").contains("CONSOLE")'> <then> <appender-ref ref="CONSOLE"/> </then> </if> <if condition='property("LOG_APPENDERS").contains("FILE")'> <then> <appender-ref ref="FILE"/> </then> </if> </then> <else> <appender-ref ref="FILE" /> <appender-ref ref="CONSOLE" /> </else> </if> </root> </configuration>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <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-adminservice.log}" /> <include resource="org/springframework/boot/logging/logback/file-appender.xml" /> <include resource="org/springframework/boot/logging/logback/console-appender.xml" /> <root level="INFO"> <if condition='isDefined("LOG_APPENDERS")'> <then> <if condition='property("LOG_APPENDERS").contains("CONSOLE")'> <then> <appender-ref ref="CONSOLE"/> </then> </if> <if condition='property("LOG_APPENDERS").contains("FILE")'> <then> <appender-ref ref="FILE"/> </then> </if> </then> <else> <appender-ref ref="FILE" /> <appender-ref ref="CONSOLE" /> </else> </if> </root> </configuration>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./docs/zh/development/portal-how-to-enable-webhook-notification.md
从 1.8.0 版本开始,apollo 增加了 webhook 支持,从而可以在配置发布时触发 webhook 并告知配置发布的信息。 ## 启用方式 > 配置项统一存储在ApolloPortalDB.ServerConfig表中,也可以通过`管理员工具 - 系统参数`页面进行配置,修改完一分钟实时生效。 1. webhook.supported.envs 开启 webhook 的环境列表,多个环境以英文逗号分隔,如 ``` DEV,FAT,UAT,PRO ``` 2. config.release.webhook.service.url webhook 通知的 url 地址,需要接收 HTTP POST 请求。如有多个地址,以英文逗号分隔,如 ``` http://www.xxx.com/webhook1,http://www.xxx.com/webhook2 ``` ## Webhook 接入方式 1. URL 参数 参数名 | 参数说明 --- | --- env | 该次配置发布所在的环境 2. Request body sample ```json { "appId": "", // appId "clusterName": "", // 集群 "namespaceName": "", // namespace "operator": "", // 发布人 "releaseId": 2, // releaseId "releaseTitle": "", // releaseTitle "releaseComment": "", // releaseComment "releaseTime": "", // 发布时间 eg:2020-01-01T00:00:00.000+0800 "configuration": [ { // 发布后的全部配置,如果为灰度发布,则为灰度发布后的全部配置 "firstEntity": "", // 配置的key "secondEntity": "" // 配置的value } ], "isReleaseAbandoned": false, "previousReleaseId": 1, // 上一次正式发布的releaseId "operation": // 0-正常发布 1-配置回滚 2-灰度发布 4-全量发布 "operationContext": { // 操作设置的属性配置 "isEmergencyPublish": true/false, // 是否紧急发布 "rules": [ { // 灰度规则 "clientAppId": "", // appId "clientIpList": [ "10.0.0.2", "10.0.0.3" ] // IP列表 } ], "branchReleaseKeys": [ "", "" ] // 灰度发布的key } } ```
从 1.8.0 版本开始,apollo 增加了 webhook 支持,从而可以在配置发布时触发 webhook 并告知配置发布的信息。 ## 启用方式 > 配置项统一存储在ApolloPortalDB.ServerConfig表中,也可以通过`管理员工具 - 系统参数`页面进行配置,修改完一分钟实时生效。 1. webhook.supported.envs 开启 webhook 的环境列表,多个环境以英文逗号分隔,如 ``` DEV,FAT,UAT,PRO ``` 2. config.release.webhook.service.url webhook 通知的 url 地址,需要接收 HTTP POST 请求。如有多个地址,以英文逗号分隔,如 ``` http://www.xxx.com/webhook1,http://www.xxx.com/webhook2 ``` ## Webhook 接入方式 1. URL 参数 参数名 | 参数说明 --- | --- env | 该次配置发布所在的环境 2. Request body sample ```json { "appId": "", // appId "clusterName": "", // 集群 "namespaceName": "", // namespace "operator": "", // 发布人 "releaseId": 2, // releaseId "releaseTitle": "", // releaseTitle "releaseComment": "", // releaseComment "releaseTime": "", // 发布时间 eg:2020-01-01T00:00:00.000+0800 "configuration": [ { // 发布后的全部配置,如果为灰度发布,则为灰度发布后的全部配置 "firstEntity": "", // 配置的key "secondEntity": "" // 配置的value } ], "isReleaseAbandoned": false, "previousReleaseId": 1, // 上一次正式发布的releaseId "operation": // 0-正常发布 1-配置回滚 2-灰度发布 4-全量发布 "operationContext": { // 操作设置的属性配置 "isEmergencyPublish": true/false, // 是否紧急发布 "rules": [ { // 灰度规则 "clientAppId": "", // appId "clientIpList": [ "10.0.0.2", "10.0.0.3" ] // IP列表 } ], "branchReleaseKeys": [ "", "" ] // 灰度发布的key } } ```
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AdminServiceTransactionTest.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.biz.service; import com.ctrip.framework.apollo.biz.AbstractIntegrationTest; import com.ctrip.framework.apollo.biz.repository.AppNamespaceRepository; import com.ctrip.framework.apollo.biz.repository.AppRepository; import com.ctrip.framework.apollo.biz.repository.ClusterRepository; import com.ctrip.framework.apollo.biz.repository.NamespaceRepository; import com.ctrip.framework.apollo.common.entity.App; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.transaction.AfterTransaction; import org.springframework.test.context.transaction.BeforeTransaction; import java.util.Date; public class AdminServiceTransactionTest extends AbstractIntegrationTest { @Autowired AdminService adminService; @Autowired private AppRepository appRepository; @Autowired private AppNamespaceRepository appNamespaceRepository; @Autowired private NamespaceRepository namespaceRepository; @Autowired private ClusterRepository clusterRepository; @BeforeTransaction public void verifyInitialDatabaseState() { for (App app : appRepository.findAll()) { System.out.println(app.getAppId()); } Assert.assertEquals(0, appRepository.count()); Assert.assertEquals(7, appNamespaceRepository.count()); Assert.assertEquals(0, namespaceRepository.count()); Assert.assertEquals(0, clusterRepository.count()); } @Before public void setUpTestDataWithinTransaction() { Assert.assertEquals(0, appRepository.count()); Assert.assertEquals(7, appNamespaceRepository.count()); Assert.assertEquals(0, namespaceRepository.count()); Assert.assertEquals(0, clusterRepository.count()); } @Test @Rollback public void modifyDatabaseWithinTransaction() { String appId = "someAppId"; App app = new App(); app.setAppId(appId); app.setName("someAppName"); String owner = "someOwnerName"; app.setOwnerName(owner); app.setOwnerEmail("someOwnerName@ctrip.com"); app.setDataChangeCreatedBy(owner); app.setDataChangeLastModifiedBy(owner); app.setDataChangeCreatedTime(new Date()); adminService.createNewApp(app); } @After public void tearDownWithinTransaction() { Assert.assertEquals(1, appRepository.count()); Assert.assertEquals(8, appNamespaceRepository.count()); Assert.assertEquals(1, namespaceRepository.count()); Assert.assertEquals(1, clusterRepository.count()); } @AfterTransaction public void verifyFinalDatabaseState() { Assert.assertEquals(0, appRepository.count()); Assert.assertEquals(7, appNamespaceRepository.count()); Assert.assertEquals(0, namespaceRepository.count()); Assert.assertEquals(0, clusterRepository.count()); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.biz.service; import com.ctrip.framework.apollo.biz.AbstractIntegrationTest; import com.ctrip.framework.apollo.biz.repository.AppNamespaceRepository; import com.ctrip.framework.apollo.biz.repository.AppRepository; import com.ctrip.framework.apollo.biz.repository.ClusterRepository; import com.ctrip.framework.apollo.biz.repository.NamespaceRepository; import com.ctrip.framework.apollo.common.entity.App; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.Rollback; import org.springframework.test.context.transaction.AfterTransaction; import org.springframework.test.context.transaction.BeforeTransaction; import java.util.Date; public class AdminServiceTransactionTest extends AbstractIntegrationTest { @Autowired AdminService adminService; @Autowired private AppRepository appRepository; @Autowired private AppNamespaceRepository appNamespaceRepository; @Autowired private NamespaceRepository namespaceRepository; @Autowired private ClusterRepository clusterRepository; @BeforeTransaction public void verifyInitialDatabaseState() { for (App app : appRepository.findAll()) { System.out.println(app.getAppId()); } Assert.assertEquals(0, appRepository.count()); Assert.assertEquals(7, appNamespaceRepository.count()); Assert.assertEquals(0, namespaceRepository.count()); Assert.assertEquals(0, clusterRepository.count()); } @Before public void setUpTestDataWithinTransaction() { Assert.assertEquals(0, appRepository.count()); Assert.assertEquals(7, appNamespaceRepository.count()); Assert.assertEquals(0, namespaceRepository.count()); Assert.assertEquals(0, clusterRepository.count()); } @Test @Rollback public void modifyDatabaseWithinTransaction() { String appId = "someAppId"; App app = new App(); app.setAppId(appId); app.setName("someAppName"); String owner = "someOwnerName"; app.setOwnerName(owner); app.setOwnerEmail("someOwnerName@ctrip.com"); app.setDataChangeCreatedBy(owner); app.setDataChangeLastModifiedBy(owner); app.setDataChangeCreatedTime(new Date()); adminService.createNewApp(app); } @After public void tearDownWithinTransaction() { Assert.assertEquals(1, appRepository.count()); Assert.assertEquals(8, appNamespaceRepository.count()); Assert.assertEquals(1, namespaceRepository.count()); Assert.assertEquals(1, clusterRepository.count()); } @AfterTransaction public void verifyFinalDatabaseState() { Assert.assertEquals(0, appRepository.count()); Assert.assertEquals(7, appNamespaceRepository.count()); Assert.assertEquals(0, namespaceRepository.count()); Assert.assertEquals(0, clusterRepository.count()); } }
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./doc/images/apollo-client-maven-artifacts.png
PNG  IHDRIzgAMA|Q cHRMT+}>: iCCPICC ProfileXíw\SBB D@JM^tH*vtQZ.lI]{3w9̙ߙ;fEkV^^6@@LLJft#- ,nD^[Qpl(ȩ!;puvB'.dUsŜ*Ih_^, nf!;Qksx|Ր=,'BV$C6M.N?bdYx¼l\.9٢1af9y 3q~jD$dxfdl/3asX~ 3DYq2e $}?+q 7Z-gGq W3  Wz(#6A(G@V-̊ }X1#E5B~&`9±0+6K2\ WAFl/&ip0'ӆ-[%jفy c^- L:أLVHlwyQRm8 €/L 5Llw @:KeG^c@ HrA!J MrP# <k^θX?بD1@4a– k-)pKI,^LzaYv0n U;>; \X0o+k6?'V}>2LE1wsām菞 0v;]Ďc̀ZN섘WJ-Z- X7ZXall|| s /on\/= \f0m5ikm.taH7[~.И2S ^lPjc(·B`  x"A,H3gy6PւMl;A=fpe n{p]`#BG4]@lgGh$ IA>"B#K2d=R@_ci"҃A5 P*jdFCXtE2t5Z֢{&4z/a `,1gĒ4L-Jrۏ| 8L <gB|^Mx~ ÇA`Ap% لB9a7(,|o D"hBte18xF!>&H$ ɝIb H%-S~<YlK 'br9y$*yDNIHU.R#7Wn.V+rr#e ŝK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~"9Yun๹r7w'<HF]NiR]DaޭMg2O mV1FV\CJ~87^?3W ꛸\>#ZhayNWy9<FVq0J.U%T]r[B{έ&N^[.wײ籱Sr:}p ٜ#Ш84#={"0:0RTBc;ػ[v*oyu;$ˍy T` TyݓSIV2:cˁۢࡾ³)HO>+J/#f0s[q ŇX%K-Gcnj.r:kK$@nUiaqh3$AQeBSvز]RM,Gb9c=h5uey?t˒LV+S>,> w4٬UWNZ&7XSNdaF)}fNB]d֡#:72L9'^.3Vq;{wg>tޕlWN!.[o$EN~t/ Kuۆ$#&@nop]d6$e(<"@ D"@ Ny.wwu] ۏ%D\ٻGG~,)'p gT*8{a$)c" v &dﭩ{k׀fW6#G_G* S'@K%@R[E VCu cA D"@ OK]$! D"@ Dඐj"@ D"@Z;rp[P D"@ -9-!D"@ DNDǔd2hIENDB`
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./doc/images/tech-support-qq-4.png
PNG  IHDR.."h<IDATx puqkkKw]c/%-BD],Vv%X,Ɨ "xK)rG ""xb@$ ׄ 1 A`5vhAMuu&=3=sVB@@EB! (* QT(DQPB! B QT(PBEB (*P(DQEB! (* QT(DQPB! B QT(Pn4=l-G\W^c(((((((((grBœ/rk|EQEQEQEQEQEQEQEQEQ<6l.Ɉ(((((((((Ŧ]'࿧(((((((((XX'z,GEQEQEQEQEQEQEQEQE1)s"sLEQEQEQEQEQEQEQEQ2E?#ro 2=DQ(EQE-#eDQEQˈbFc~"üG((((((((؄)$c"{>EQEQEQEQEQEQEQEQEQw  y\;~4ȃ+(((((((((<WO~YІR6\$((((((((M/S~?;ǣ TmxCEQEQEQEQEQEQEQEQE1 q| fktNDQEQEQEQEQEQEQEQEQ9nw?3mϊXDLEQEQEQEQl>[n駟^paqq-ƿXXUDQE1◹EEQEQE~ME>EQEQE(o^EQLqʔ)u Q&DSNW d(6<H]CŠuvҴlٲ.oG]"c{駟E(*EQ($Fq˒l8o}ֲ\+9+VQ?  (bCw ,wC5_=V0"(Y-Z())9Q ,ٽ狃G dSlPx4C$P\yGSxra#l Y?غ ;:c?[rca^ᶽՇahal(cWUYոC )x"QEQ9Xem#G =<O(Jiֲ-;X[GAKE2XҰRVVNۏe0y& y:+(M 9+V]PdfiNVڸ|~窟uoruONb( Zw1n, G}IM@ `)}: ow]}A+Zl}.IȜiDk9SCL^<5;}qΜ9"s)8!ѤX!go*cFiiš~p+2σHܒ?׭^e9agG V|/pKԱy˗Hjd vn(%>CƛoTGa6@2@ˇumtM#3'o9I A8~}/"qݯx{nGdɰv#;qEQ⶝ Y6[lgbKUVM AZz|_w ].Jvj̜oyӗ-&'mI@ZKΰKwcǎ(@ه+ٸUӤ3ZL"dʟ#q(4C|5#o{LksLN9=S#̐I¤>G%iӦ( B.O>jC oTAh63noʚC_Hf# ™vBV$%Zzɍ;ek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w}ohd/۵;]4}D=z( )&/aZ5_ ܬ<{ؿ$%ιfdi1cvӋ)ڹuׅ3s cJ,TcQ{[SDQK1%%ݷ?ODK4IqMI8x$tuƹ2RiU%'.ZT4ҘP߰l}.,|7 PE1( JS̀ظ)4 o|2/Sd-jPT}AX[Um%TwsЭ]^r_'t USMDCUEQ<-{ODiyF QG%YV <wxg)P$=KZmJ|EoV.:vSڽ> Gzo(1xscWETwUV`4' u D E H[bd1괨"UV((VY٣qx㓓SA,?CQ%-Z()){~rT'<3e T SYJ HV*(9/ yQئxT-QײiP̘4ؐ NjC_,2Mh4=>) 'rg(b<P<jEgN+Y_O9}R<`qtSb;&Eim(Cjil|SIxnIykSh^NC-a2EQIg|uj$~Ȑ$0V~(%Y|H`{EW~^ k7$_^muTCh%4%EZ#f:Z"{&*;7t9(F$XW:??qz{&J,+ccƪ(Jj{|oծJ 3Y]s((7DQ) ߻{(qHE1Oc;#qK1h]~^^^b:~`([^`((F]*(YQEQEQ Q|S znHQEx /ovMMMvv1cܟ3(iFqqqFFưa:tgeXEQ΋{(xF%(((F yІdC/EQEQEQEQEQEQEQEQŦC1><iyA;DQEQEQEQEQEQEQEQEQc2;;(((((((((xk=}V FSy(((((((((ظ/S^+E,~x(((((((((wDbt;٣{\~~,E,EQEQEQEQEQEQEQEQ&C1ݎ'q䆑DQEQEQEQEQEQEQEQEQI1A{ۢ\}}:GEQEQEQEQEQEQEQEQEQ>Og{((((((((((9aGEQEQEQEQEQEQEQEQE1V(6։ `QEQEQEQEQEQEQEQEQ sm%>DQEQEQEQEQEQEQEQEQĊŁ>(((((((((* QT(DQPB! B QT(PBEB (* QT(DQPB! B QT(PBEB (*P(DQEB! (*FIENDB`
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/FavoriteRepository.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.repository; import com.ctrip.framework.apollo.portal.entity.po.Favorite; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.PagingAndSortingRepository; import java.util.List; public interface FavoriteRepository extends PagingAndSortingRepository<Favorite, Long> { List<Favorite> findByUserIdOrderByPositionAscDataChangeCreatedTimeAsc(String userId, Pageable page); List<Favorite> findByAppIdOrderByPositionAscDataChangeCreatedTimeAsc(String appId, Pageable page); Favorite findFirstByUserIdOrderByPositionAscDataChangeCreatedTimeAsc(String userId); Favorite findByUserIdAndAppId(String userId, String appId); @Modifying @Query("UPDATE Favorite SET IsDeleted=1,DataChange_LastModifiedBy = ?2 WHERE AppId=?1") int batchDeleteByAppId(String appId, String operator); }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.repository; import com.ctrip.framework.apollo.portal.entity.po.Favorite; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.PagingAndSortingRepository; import java.util.List; public interface FavoriteRepository extends PagingAndSortingRepository<Favorite, Long> { List<Favorite> findByUserIdOrderByPositionAscDataChangeCreatedTimeAsc(String userId, Pageable page); List<Favorite> findByAppIdOrderByPositionAscDataChangeCreatedTimeAsc(String appId, Pageable page); Favorite findFirstByUserIdOrderByPositionAscDataChangeCreatedTimeAsc(String userId); Favorite findByUserIdAndAppId(String userId, String appId); @Modifying @Query("UPDATE Favorite SET IsDeleted=1,DataChange_LastModifiedBy = ?2 WHERE AppId=?1") int batchDeleteByAppId(String appId, String operator); }
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.common.utils; import com.ctrip.framework.apollo.common.exception.BeanUtilsException; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; import org.springframework.util.CollectionUtils; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; public class BeanUtils { /** * <pre> * List<UserBean> userBeans = userDao.queryUsers(); * List<UserDTO> userDTOs = BeanUtil.batchTransform(UserDTO.class, userBeans); * </pre> */ public static <T> List<T> batchTransform(final Class<T> clazz, List<?> srcList) { if (CollectionUtils.isEmpty(srcList)) { return Collections.emptyList(); } List<T> result = new ArrayList<>(srcList.size()); for (Object srcObject : srcList) { result.add(transform(clazz, srcObject)); } return result; } /** * 封装{@link org.springframework.beans.BeanUtils#copyProperties},惯用与直接将转换结果返回 * * <pre> * UserBean userBean = new UserBean("username"); * return BeanUtil.transform(UserDTO.class, userBean); * </pre> */ public static <T> T transform(Class<T> clazz, Object src) { if (src == null) { return null; } T instance; try { instance = clazz.newInstance(); } catch (Exception e) { throw new BeanUtilsException(e); } org.springframework.beans.BeanUtils.copyProperties(src, instance, getNullPropertyNames(src)); return instance; } private static String[] getNullPropertyNames(Object source) { final BeanWrapper src = new BeanWrapperImpl(source); PropertyDescriptor[] pds = src.getPropertyDescriptors(); Set<String> emptyNames = new HashSet<>(); for (PropertyDescriptor pd : pds) { Object srcValue = src.getPropertyValue(pd.getName()); if (srcValue == null) { emptyNames.add(pd.getName()); } } String[] result = new String[emptyNames.size()]; return emptyNames.toArray(result); } /** * 用于将一个列表转换为列表中的对象的某个属性映射到列表中的对象 * * <pre> * List<UserDTO> userList = userService.queryUsers(); * Map<Integer, userDTO> userIdToUser = BeanUtil.mapByKey("userId", userList); * </pre> * * @param key 属性名 */ @SuppressWarnings("unchecked") public static <K, V> Map<K, V> mapByKey(String key, List<?> list) { Map<K, V> map = new HashMap<>(); if (CollectionUtils.isEmpty(list)) { return map; } try { Class<?> clazz = list.get(0).getClass(); Field field = deepFindField(clazz, key); if (field == null) { throw new IllegalArgumentException("Could not find the key"); } field.setAccessible(true); for (Object o : list) { map.put((K) field.get(o), (V) o); } } catch (Exception e) { throw new BeanUtilsException(e); } return map; } /** * 根据列表里面的属性聚合 * * <pre> * List<ShopDTO> shopList = shopService.queryShops(); * Map<Integer, List<ShopDTO>> city2Shops = BeanUtil.aggByKeyToList("cityId", shopList); * </pre> */ @SuppressWarnings("unchecked") public static <K, V> Map<K, List<V>> aggByKeyToList(String key, List<?> list) { Map<K, List<V>> map = new HashMap<>(); if (CollectionUtils.isEmpty(list)) {// 防止外面传入空list return map; } try { Class<?> clazz = list.get(0).getClass(); Field field = deepFindField(clazz, key); if (field == null) { throw new IllegalArgumentException("Could not find the key"); } field.setAccessible(true); for (Object o : list) { K k = (K) field.get(o); map.computeIfAbsent(k, k1 -> new ArrayList<>()); map.get(k).add((V) o); } } catch (Exception e) { throw new BeanUtilsException(e); } return map; } /** * 用于将一个对象的列表转换为列表中对象的属性集合 * * <pre> * List<UserDTO> userList = userService.queryUsers(); * Set<Integer> userIds = BeanUtil.toPropertySet("userId", userList); * </pre> */ @SuppressWarnings("unchecked") public static <K> Set<K> toPropertySet(String key, List<?> list) { Set<K> set = new HashSet<>(); if (CollectionUtils.isEmpty(list)) {// 防止外面传入空list return set; } try { Class<?> clazz = list.get(0).getClass(); Field field = deepFindField(clazz, key); if (field == null) { throw new IllegalArgumentException("Could not find the key"); } field.setAccessible(true); for (Object o : list) { set.add((K)field.get(o)); } } catch (Exception e) { throw new BeanUtilsException(e); } return set; } private static Field deepFindField(Class<?> clazz, String key) { Field field = null; while (!clazz.getName().equals(Object.class.getName())) { try { field = clazz.getDeclaredField(key); if (field != null) { break; } } catch (Exception e) { clazz = clazz.getSuperclass(); } } return field; } /** * 获取某个对象的某个属性 */ public static Object getProperty(Object obj, String fieldName) { try { Field field = deepFindField(obj.getClass(), fieldName); if (field != null) { field.setAccessible(true); return field.get(obj); } } catch (Exception e) { throw new BeanUtilsException(e); } return null; } /** * 设置某个对象的某个属性 */ public static void setProperty(Object obj, String fieldName, Object value) { try { Field field = deepFindField(obj.getClass(), fieldName); if (field != null) { field.setAccessible(true); field.set(obj, value); } } catch (Exception e) { throw new BeanUtilsException(e); } } /** * * @param source * @param target */ public static void copyProperties(Object source, Object target, String... ignoreProperties) { org.springframework.beans.BeanUtils.copyProperties(source, target, ignoreProperties); } /** * The copy will ignore <em>BaseEntity</em> field * * @param source * @param target */ public static void copyEntityProperties(Object source, Object target) { org.springframework.beans.BeanUtils.copyProperties(source, target, COPY_IGNORED_PROPERTIES); } private static final String[] COPY_IGNORED_PROPERTIES = {"id", "dataChangeCreatedBy", "dataChangeCreatedTime", "dataChangeLastModifiedTime"}; }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.common.utils; import com.ctrip.framework.apollo.common.exception.BeanUtilsException; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; import org.springframework.util.CollectionUtils; import java.beans.PropertyDescriptor; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; public class BeanUtils { /** * <pre> * List<UserBean> userBeans = userDao.queryUsers(); * List<UserDTO> userDTOs = BeanUtil.batchTransform(UserDTO.class, userBeans); * </pre> */ public static <T> List<T> batchTransform(final Class<T> clazz, List<?> srcList) { if (CollectionUtils.isEmpty(srcList)) { return Collections.emptyList(); } List<T> result = new ArrayList<>(srcList.size()); for (Object srcObject : srcList) { result.add(transform(clazz, srcObject)); } return result; } /** * 封装{@link org.springframework.beans.BeanUtils#copyProperties},惯用与直接将转换结果返回 * * <pre> * UserBean userBean = new UserBean("username"); * return BeanUtil.transform(UserDTO.class, userBean); * </pre> */ public static <T> T transform(Class<T> clazz, Object src) { if (src == null) { return null; } T instance; try { instance = clazz.newInstance(); } catch (Exception e) { throw new BeanUtilsException(e); } org.springframework.beans.BeanUtils.copyProperties(src, instance, getNullPropertyNames(src)); return instance; } private static String[] getNullPropertyNames(Object source) { final BeanWrapper src = new BeanWrapperImpl(source); PropertyDescriptor[] pds = src.getPropertyDescriptors(); Set<String> emptyNames = new HashSet<>(); for (PropertyDescriptor pd : pds) { Object srcValue = src.getPropertyValue(pd.getName()); if (srcValue == null) { emptyNames.add(pd.getName()); } } String[] result = new String[emptyNames.size()]; return emptyNames.toArray(result); } /** * 用于将一个列表转换为列表中的对象的某个属性映射到列表中的对象 * * <pre> * List<UserDTO> userList = userService.queryUsers(); * Map<Integer, userDTO> userIdToUser = BeanUtil.mapByKey("userId", userList); * </pre> * * @param key 属性名 */ @SuppressWarnings("unchecked") public static <K, V> Map<K, V> mapByKey(String key, List<?> list) { Map<K, V> map = new HashMap<>(); if (CollectionUtils.isEmpty(list)) { return map; } try { Class<?> clazz = list.get(0).getClass(); Field field = deepFindField(clazz, key); if (field == null) { throw new IllegalArgumentException("Could not find the key"); } field.setAccessible(true); for (Object o : list) { map.put((K) field.get(o), (V) o); } } catch (Exception e) { throw new BeanUtilsException(e); } return map; } /** * 根据列表里面的属性聚合 * * <pre> * List<ShopDTO> shopList = shopService.queryShops(); * Map<Integer, List<ShopDTO>> city2Shops = BeanUtil.aggByKeyToList("cityId", shopList); * </pre> */ @SuppressWarnings("unchecked") public static <K, V> Map<K, List<V>> aggByKeyToList(String key, List<?> list) { Map<K, List<V>> map = new HashMap<>(); if (CollectionUtils.isEmpty(list)) {// 防止外面传入空list return map; } try { Class<?> clazz = list.get(0).getClass(); Field field = deepFindField(clazz, key); if (field == null) { throw new IllegalArgumentException("Could not find the key"); } field.setAccessible(true); for (Object o : list) { K k = (K) field.get(o); map.computeIfAbsent(k, k1 -> new ArrayList<>()); map.get(k).add((V) o); } } catch (Exception e) { throw new BeanUtilsException(e); } return map; } /** * 用于将一个对象的列表转换为列表中对象的属性集合 * * <pre> * List<UserDTO> userList = userService.queryUsers(); * Set<Integer> userIds = BeanUtil.toPropertySet("userId", userList); * </pre> */ @SuppressWarnings("unchecked") public static <K> Set<K> toPropertySet(String key, List<?> list) { Set<K> set = new HashSet<>(); if (CollectionUtils.isEmpty(list)) {// 防止外面传入空list return set; } try { Class<?> clazz = list.get(0).getClass(); Field field = deepFindField(clazz, key); if (field == null) { throw new IllegalArgumentException("Could not find the key"); } field.setAccessible(true); for (Object o : list) { set.add((K)field.get(o)); } } catch (Exception e) { throw new BeanUtilsException(e); } return set; } private static Field deepFindField(Class<?> clazz, String key) { Field field = null; while (!clazz.getName().equals(Object.class.getName())) { try { field = clazz.getDeclaredField(key); if (field != null) { break; } } catch (Exception e) { clazz = clazz.getSuperclass(); } } return field; } /** * 获取某个对象的某个属性 */ public static Object getProperty(Object obj, String fieldName) { try { Field field = deepFindField(obj.getClass(), fieldName); if (field != null) { field.setAccessible(true); return field.get(obj); } } catch (Exception e) { throw new BeanUtilsException(e); } return null; } /** * 设置某个对象的某个属性 */ public static void setProperty(Object obj, String fieldName, Object value) { try { Field field = deepFindField(obj.getClass(), fieldName); if (field != null) { field.setAccessible(true); field.set(obj, value); } } catch (Exception e) { throw new BeanUtilsException(e); } } /** * * @param source * @param target */ public static void copyProperties(Object source, Object target, String... ignoreProperties) { org.springframework.beans.BeanUtils.copyProperties(source, target, ignoreProperties); } /** * The copy will ignore <em>BaseEntity</em> field * * @param source * @param target */ public static void copyEntityProperties(Object source, Object target) { org.springframework.beans.BeanUtils.copyProperties(source, target, COPY_IGNORED_PROPERTIES); } private static final String[] COPY_IGNORED_PROPERTIES = {"id", "dataChangeCreatedBy", "dataChangeCreatedTime", "dataChangeLastModifiedTime"}; }
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/txtresolver/FileTextResolver.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.component.txtresolver; import com.ctrip.framework.apollo.common.dto.ItemChangeSets; import com.ctrip.framework.apollo.common.dto.ItemDTO; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.utils.StringUtils; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.util.List; @Component("fileTextResolver") public class FileTextResolver implements ConfigTextResolver { @Override public ItemChangeSets resolve(long namespaceId, String configText, List<ItemDTO> baseItems) { ItemChangeSets changeSets = new ItemChangeSets(); if (CollectionUtils.isEmpty(baseItems) && StringUtils.isEmpty(configText)) { return changeSets; } if (CollectionUtils.isEmpty(baseItems)) { changeSets.addCreateItem(createItem(namespaceId, 0, configText)); } else { ItemDTO beforeItem = baseItems.get(0); if (!configText.equals(beforeItem.getValue())) {//update changeSets.addUpdateItem(createItem(namespaceId, beforeItem.getId(), configText)); } } return changeSets; } private ItemDTO createItem(long namespaceId, long itemId, String value) { ItemDTO item = new ItemDTO(); item.setId(itemId); item.setNamespaceId(namespaceId); item.setValue(value); item.setLineNum(1); item.setKey(ConfigConsts.CONFIG_FILE_CONTENT_KEY); return item; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.component.txtresolver; import com.ctrip.framework.apollo.common.dto.ItemChangeSets; import com.ctrip.framework.apollo.common.dto.ItemDTO; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.utils.StringUtils; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.util.List; @Component("fileTextResolver") public class FileTextResolver implements ConfigTextResolver { @Override public ItemChangeSets resolve(long namespaceId, String configText, List<ItemDTO> baseItems) { ItemChangeSets changeSets = new ItemChangeSets(); if (CollectionUtils.isEmpty(baseItems) && StringUtils.isEmpty(configText)) { return changeSets; } if (CollectionUtils.isEmpty(baseItems)) { changeSets.addCreateItem(createItem(namespaceId, 0, configText)); } else { ItemDTO beforeItem = baseItems.get(0); if (!configText.equals(beforeItem.getValue())) {//update changeSets.addUpdateItem(createItem(namespaceId, beforeItem.getId(), configText)); } } return changeSets; } private ItemDTO createItem(long namespaceId, long itemId, String value) { ItemDTO item = new ItemDTO(); item.setId(itemId); item.setNamespaceId(namespaceId); item.setValue(value); item.setLineNum(1); item.setKey(ConfigConsts.CONFIG_FILE_CONTENT_KEY); return item; } }
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./.git/hooks/pre-receive.sample
#!/bin/sh # # An example hook script to make use of push options. # The example simply echoes all push options that start with 'echoback=' # and rejects all pushes when the "reject" push option is used. # # To enable this hook, rename this file to "pre-receive". if test -n "$GIT_PUSH_OPTION_COUNT" then i=0 while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" do eval "value=\$GIT_PUSH_OPTION_$i" case "$value" in echoback=*) echo "echo from the pre-receive-hook: ${value#*=}" >&2 ;; reject) exit 1 esac i=$((i + 1)) done fi
#!/bin/sh # # An example hook script to make use of push options. # The example simply echoes all push options that start with 'echoback=' # and rejects all pushes when the "reject" push option is used. # # To enable this hook, rename this file to "pre-receive". if test -n "$GIT_PUSH_OPTION_COUNT" then i=0 while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" do eval "value=\$GIT_PUSH_OPTION_$i" case "$value" in echoback=*) echo "echo from the pre-receive-hook: ${value#*=}" >&2 ;; reject) exit 1 esac i=$((i + 1)) done fi
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./scripts/sql/delta/v170-v180/apolloconfigdb-v170-v180.sql
-- -- Copyright 2021 Apollo Authors -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- # delta schema to upgrade apollo config db from v1.7.0 to v1.8.0 Use ApolloConfigDB; alter table `AppNamespace` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; alter table `Cluster` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; alter table `GrayReleaseRule` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; alter table `Instance` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; alter table `InstanceConfig` change ConfigAppId ConfigAppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Config App Id'; alter table `ReleaseHistory` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id';
-- -- Copyright 2021 Apollo Authors -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- # delta schema to upgrade apollo config db from v1.7.0 to v1.8.0 Use ApolloConfigDB; alter table `AppNamespace` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; alter table `Cluster` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; alter table `GrayReleaseRule` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; alter table `Instance` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id'; alter table `InstanceConfig` change ConfigAppId ConfigAppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Config App Id'; alter table `ReleaseHistory` change AppId AppId varchar(64) NOT NULL DEFAULT 'default' COMMENT 'app id';
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./scripts/sql/delta/v151-v160/apolloconfigdb-v151-v160.sql
-- -- Copyright 2021 Apollo Authors -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- # delta schema to upgrade apollo config db from v1.5.1 to v1.6.0 Use ApolloConfigDB; CREATE TABLE `AccessKey` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', `Secret` varchar(128) NOT NULL DEFAULT '' COMMENT 'Secret', `IsEnabled` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: enabled, 0: disabled', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `AppId` (`AppId`(191)), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='访问密钥';
-- -- Copyright 2021 Apollo Authors -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- # delta schema to upgrade apollo config db from v1.5.1 to v1.6.0 Use ApolloConfigDB; CREATE TABLE `AccessKey` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', `Secret` varchar(128) NOT NULL DEFAULT '' COMMENT 'Secret', `IsEnabled` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: enabled, 0: disabled', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `AppId` (`AppId`(191)), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='访问密钥';
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./docs/css/dark.css
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ @import url("fonts.css");*{-webkit-font-smoothing:antialiased;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;-webkit-touch-callout:none;box-sizing:border-box}body:not(.ready){overflow:hidden}body:not(.ready) .app-nav,body:not(.ready)>nav,body:not(.ready) [data-cloak]{display:none}div#app{font-size:30px;font-weight:lighter;margin:40vh auto;text-align:center}div#app:empty:before{content:"Loading..."}.emoji{height:1.2rem;vertical-align:middle}.progress{background-color:var(--theme-color,#ea6f5a);height:2px;left:0;position:fixed;right:0;top:0;transition:width .2s,opacity .4s;width:0;z-index:999999}.search .search-keyword,.search a:hover{color:var(--theme-color,#ea6f5a)}.search .search-keyword{font-style:normal;font-weight:700}body,html{height:100%}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:#c8c8c8;font-family:Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:15px;letter-spacing:0;margin:0;overflow-x:hidden}img{max-width:100%}a[disabled]{cursor:not-allowed;opacity:.6}kbd{border:1px solid #ccc;border-radius:3px;display:inline-block;font-size:12px!important;line-height:12px;margin-bottom:3px;padding:3px 5px;vertical-align:middle}li input[type=checkbox]{margin:0 .2em .25em 0;vertical-align:middle}.app-nav{margin:25px 60px 0 0;position:absolute;right:0;text-align:right;z-index:10}.app-nav.no-badge{margin-right:25px}.app-nav p{margin:0}.app-nav>a{margin:0 1rem;padding:5px 0}.app-nav li,.app-nav ul{display:inline-block;list-style:none;margin:0}.app-nav a{color:inherit;font-size:16px;text-decoration:none;transition:color .3s}.app-nav a.active,.app-nav a:hover{color:var(--theme-color,#ea6f5a)}.app-nav a.active{border-bottom:2px solid var(--theme-color,#ea6f5a)}.app-nav li{display:inline-block;margin:0 1rem;padding:5px 0;position:relative;cursor:pointer}.app-nav li ul{background-color:#fff;border:1px solid;border-color:#ddd #ddd #ccc;border-radius:4px;box-sizing:border-box;display:none;max-height:calc(100vh - 61px);overflow-y:auto;padding:10px 0;position:absolute;right:-15px;text-align:left;top:100%;white-space:nowrap}.app-nav li ul li{display:block;font-size:14px;line-height:1rem;margin:8px 14px;white-space:nowrap}.app-nav li ul a{display:block;font-size:inherit;margin:0;padding:0}.app-nav li ul a.active{border-bottom:0}.app-nav li:hover ul{display:block}.github-corner{border-bottom:0;position:fixed;right:0;text-decoration:none;top:0;z-index:1}.github-corner:hover .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}.github-corner svg{color:#3f3f3f;fill:var(--theme-color,#ea6f5a);height:80px;width:80px}main{display:block;position:relative;width:100vw;height:100%;z-index:0}main.hidden{display:none}.anchor{display:inline-block;text-decoration:none;transition:all .3s}.anchor span{color:#c8c8c8}.anchor:hover{text-decoration:underline}.sidebar{border-right:1px solid rgba(0,0,0,.07);overflow-y:auto;padding:40px 0 0;position:absolute;top:0;bottom:0;left:0;transition:transform .25s ease-out;width:300px;z-index:20}.sidebar>h1{margin:0 auto 1rem;font-size:1.5rem;font-weight:300;text-align:center}.sidebar>h1 a{color:inherit;text-decoration:none}.sidebar>h1 .app-nav{display:block;position:static}.sidebar .sidebar-nav{line-height:2em;padding-bottom:40px}.sidebar li.collapse .app-sub-sidebar{display:none}.sidebar ul{margin:0 0 0 15px;padding:0}.sidebar li>p{font-weight:700;margin:0}.sidebar ul,.sidebar ul li{list-style:none}.sidebar ul li a{border-bottom:none;display:block}.sidebar ul li ul{padding-left:20px}.sidebar::-webkit-scrollbar{width:4px}.sidebar::-webkit-scrollbar-thumb{background:transparent;border-radius:4px}.sidebar:hover::-webkit-scrollbar-thumb{background:hsla(0,0%,53.3%,.4)}.sidebar:hover::-webkit-scrollbar-track{background:hsla(0,0%,53.3%,.1)}.sidebar-toggle{background-color:transparent;background-color:rgba(63,63,63,.8);border:0;outline:none;padding:10px;position:absolute;bottom:0;left:0;text-align:center;transition:opacity .3s;width:284px;z-index:30;cursor:pointer}.sidebar-toggle:hover .sidebar-toggle-button{opacity:.4}.sidebar-toggle span{background-color:var(--theme-color,#ea6f5a);display:block;margin-bottom:4px;width:16px;height:2px}body.sticky .sidebar,body.sticky .sidebar-toggle{position:fixed}.content{padding-top:60px;position:absolute;top:0;right:0;bottom:0;left:300px;transition:left .25s ease}.markdown-section{margin:0 auto;max-width:80%;padding:30px 15px 40px;position:relative}.markdown-section>*{box-sizing:border-box;font-size:inherit}.markdown-section>:first-child{margin-top:0!important}.markdown-section hr{border:none;border-bottom:1px solid #eee;margin:2em 0}.markdown-section iframe{border:1px solid #eee;width:1px;min-width:100%}.markdown-section table{border-collapse:collapse;border-spacing:0;display:block;margin-bottom:1rem;overflow:auto;width:100%}.markdown-section th{font-weight:700}.markdown-section td,.markdown-section th{border:1px solid #ddd;padding:6px 13px}.markdown-section tr{border-top:1px solid #ccc}.markdown-section p.tip,.markdown-section tr:nth-child(2n){background-color:#f8f8f8}.markdown-section p.tip{border-bottom-right-radius:2px;border-left:4px solid #f66;border-top-right-radius:2px;margin:2em 0;padding:12px 24px 12px 30px;position:relative}.markdown-section p.tip:before{background-color:#f66;border-radius:100%;color:#3f3f3f;content:"!";font-family:Dosis,Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:14px;font-weight:700;left:-12px;line-height:20px;position:absolute;height:20px;width:20px;text-align:center;top:14px}.markdown-section p.tip code{background-color:#efefef}.markdown-section p.tip em{color:#c8c8c8}.markdown-section p.warn{background:rgba(234,111,90,.1);border-radius:2px;padding:1rem}.markdown-section ul.task-list>li{list-style-type:none}body.close .sidebar{transform:translateX(-300px)}body.close .sidebar-toggle{width:auto}body.close .content{left:0}@media print{.app-nav,.github-corner,.sidebar,.sidebar-toggle{display:none}}@media screen and (max-width:768px){.github-corner,.sidebar,.sidebar-toggle{position:fixed}.app-nav{margin-top:16px}.app-nav li ul{top:30px}main{height:auto;overflow-x:hidden}.sidebar{left:-300px;transition:transform .25s ease-out}.content{left:0;max-width:100vw;position:static;padding-top:20px;transition:transform .25s ease}.app-nav,.github-corner{transition:transform .25s ease-out}.sidebar-toggle{background-color:transparent;width:auto;padding:30px 30px 10px 10px}body.close .sidebar{transform:translateX(300px)}body.close .sidebar-toggle{background-color:rgba(63,63,63,.8);transition:background-color 1s;width:284px;padding:10px}body.close .content{transform:translateX(300px)}body.close .app-nav,body.close .github-corner{display:none}.github-corner:hover .octo-arm{-webkit-animation:none;animation:none}.github-corner .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}}@-webkit-keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}section.cover{align-items:center;background-position:50%;background-repeat:no-repeat;background-size:cover;height:100vh;width:100vw;display:none}section.cover.show{display:flex}section.cover.has-mask .mask{background-color:#3f3f3f;opacity:.8;position:absolute;top:0;height:100%;width:100%}section.cover .cover-main{flex:1;margin:-20px 16px 0;text-align:center;position:relative}section.cover a{color:inherit}section.cover a,section.cover a:hover{text-decoration:none}section.cover p{line-height:1.5rem;margin:1em 0}section.cover h1{color:inherit;font-size:2.5rem;font-weight:300;margin:.625rem 0 2.5rem;position:relative;text-align:center}section.cover h1 a{display:block}section.cover h1 small{bottom:-.4375rem;font-size:1rem;position:absolute}section.cover blockquote{font-size:1.5rem;text-align:center}section.cover ul{line-height:1.8;list-style-type:none;margin:1em auto;max-width:500px;padding:0}section.cover .cover-main>p:last-child a{border-radius:2rem;border:1px solid var(--theme-color,#ea6f5a);box-sizing:border-box;color:var(--theme-color,#ea6f5a);display:inline-block;font-size:1.05rem;letter-spacing:.1rem;margin:.5rem 1rem;padding:.75em 2rem;text-decoration:none;transition:all .15s ease}section.cover .cover-main>p:last-child a:last-child{background-color:var(--theme-color,#ea6f5a);color:#fff}section.cover .cover-main>p:last-child a:last-child:hover{color:inherit;opacity:.8}section.cover .cover-main>p:last-child a:hover{color:inherit}section.cover blockquote>p>a{border-bottom:2px solid var(--theme-color,#ea6f5a);transition:color .3s}section.cover blockquote>p>a:hover{color:var(--theme-color,#ea6f5a)}.sidebar,body{background-color:#3f3f3f}.sidebar{color:#c8c8c8}.sidebar li{margin:6px 15px 6px 0}.sidebar ul li a{color:#c8c8c8;font-size:14px;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.sidebar ul li a:hover{text-decoration:underline}.sidebar ul li ul{padding:0}.sidebar ul li.active>a{color:var(--theme-color,#ea6f5a);font-weight:600}.markdown-section h1,.markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section strong{color:#657b83;font-weight:600}.markdown-section a{color:var(--theme-color,#ea6f5a);font-weight:600}.markdown-section h1{font-size:2rem;margin:0 0 1rem}.markdown-section h2{font-size:1.75rem;margin:45px 0 .8rem}.markdown-section h3{font-size:1.5rem;margin:40px 0 .6rem}.markdown-section h4{font-size:1.25rem}.markdown-section h5{font-size:1rem}.markdown-section h6{color:#777;font-size:1rem}.markdown-section figure,.markdown-section ol,.markdown-section p,.markdown-section ul{margin:1.2em 0}.markdown-section ol,.markdown-section p,.markdown-section ul{line-height:1.6rem;word-spacing:.05rem}.markdown-section ol,.markdown-section ul{padding-left:1.5rem}.markdown-section blockquote{border-left:4px solid var(--theme-color,#ea6f5a);color:#858585;margin:2em 0;padding-left:20px}.markdown-section blockquote p{font-weight:600;margin-left:0}.markdown-section iframe{margin:1em 0}.markdown-section em{color:#7f8c8d}.markdown-section code{background-color:#282828;border-radius:2px;color:#657b83;font-family:Roboto Mono,Monaco,courier,monospace;margin:0 2px;padding:3px 5px;white-space:pre-wrap}.markdown-section>:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) code{font-size:.8rem}.markdown-section pre{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;background-color:#282828;font-family:Roboto Mono,Monaco,courier,monospace;line-height:1.5rem;margin:1.2em 0;overflow:auto;padding:0 1.4rem;position:relative;word-wrap:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#8e908c}.token.namespace{opacity:.7}.token.boolean,.token.number{color:#c76b29}.token.punctuation{color:#525252}.token.property{color:#c08b30}.token.tag{color:#2973b7}.token.string{color:var(--theme-color,#ea6f5a)}.token.selector{color:#6679cc}.token.attr-name{color:#2973b7}.language-css .token.string,.style .token.string,.token.entity,.token.url{color:#22a2c9}.token.attr-value,.token.control,.token.directive,.token.unit{color:var(--theme-color,#ea6f5a)}.token.keyword{color:#e96900}.token.atrule,.token.regex,.token.statement{color:#22a2c9}.token.placeholder,.token.variable{color:#3d8fd1}.token.deleted{text-decoration:line-through}.token.inserted{border-bottom:1px dotted #202746;text-decoration:none}.token.italic{font-style:italic}.token.bold,.token.important{font-weight:700}.token.important{color:#c94922}.token.entity{cursor:help}.markdown-section pre>code{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;background-color:#282828;border-radius:2px;color:#657b83;display:block;font-family:Roboto Mono,Monaco,courier,monospace;font-size:.8rem;line-height:inherit;margin:0 2px;max-width:inherit;overflow:inherit;padding:2.2em 5px;white-space:inherit}.markdown-section code:after,.markdown-section code:before{letter-spacing:.05rem}code .token{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;min-height:1.5rem;position:relative;left:auto}pre:after{color:#ccc;content:attr(data-lang);font-size:.6rem;font-weight:600;height:15px;line-height:15px;padding:5px 10px 0;position:absolute;right:0;text-align:right;top:0}.markdown-section p.tip{background-color:#282828;color:#657b83}input[type=search]{background:#4f4f4f;border-color:#4f4f4f;color:#c8c8c8}
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ @import url("fonts.css");*{-webkit-font-smoothing:antialiased;-webkit-overflow-scrolling:touch;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-text-size-adjust:none;-webkit-touch-callout:none;box-sizing:border-box}body:not(.ready){overflow:hidden}body:not(.ready) .app-nav,body:not(.ready)>nav,body:not(.ready) [data-cloak]{display:none}div#app{font-size:30px;font-weight:lighter;margin:40vh auto;text-align:center}div#app:empty:before{content:"Loading..."}.emoji{height:1.2rem;vertical-align:middle}.progress{background-color:var(--theme-color,#ea6f5a);height:2px;left:0;position:fixed;right:0;top:0;transition:width .2s,opacity .4s;width:0;z-index:999999}.search .search-keyword,.search a:hover{color:var(--theme-color,#ea6f5a)}.search .search-keyword{font-style:normal;font-weight:700}body,html{height:100%}body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;color:#c8c8c8;font-family:Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:15px;letter-spacing:0;margin:0;overflow-x:hidden}img{max-width:100%}a[disabled]{cursor:not-allowed;opacity:.6}kbd{border:1px solid #ccc;border-radius:3px;display:inline-block;font-size:12px!important;line-height:12px;margin-bottom:3px;padding:3px 5px;vertical-align:middle}li input[type=checkbox]{margin:0 .2em .25em 0;vertical-align:middle}.app-nav{margin:25px 60px 0 0;position:absolute;right:0;text-align:right;z-index:10}.app-nav.no-badge{margin-right:25px}.app-nav p{margin:0}.app-nav>a{margin:0 1rem;padding:5px 0}.app-nav li,.app-nav ul{display:inline-block;list-style:none;margin:0}.app-nav a{color:inherit;font-size:16px;text-decoration:none;transition:color .3s}.app-nav a.active,.app-nav a:hover{color:var(--theme-color,#ea6f5a)}.app-nav a.active{border-bottom:2px solid var(--theme-color,#ea6f5a)}.app-nav li{display:inline-block;margin:0 1rem;padding:5px 0;position:relative;cursor:pointer}.app-nav li ul{background-color:#fff;border:1px solid;border-color:#ddd #ddd #ccc;border-radius:4px;box-sizing:border-box;display:none;max-height:calc(100vh - 61px);overflow-y:auto;padding:10px 0;position:absolute;right:-15px;text-align:left;top:100%;white-space:nowrap}.app-nav li ul li{display:block;font-size:14px;line-height:1rem;margin:8px 14px;white-space:nowrap}.app-nav li ul a{display:block;font-size:inherit;margin:0;padding:0}.app-nav li ul a.active{border-bottom:0}.app-nav li:hover ul{display:block}.github-corner{border-bottom:0;position:fixed;right:0;text-decoration:none;top:0;z-index:1}.github-corner:hover .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}.github-corner svg{color:#3f3f3f;fill:var(--theme-color,#ea6f5a);height:80px;width:80px}main{display:block;position:relative;width:100vw;height:100%;z-index:0}main.hidden{display:none}.anchor{display:inline-block;text-decoration:none;transition:all .3s}.anchor span{color:#c8c8c8}.anchor:hover{text-decoration:underline}.sidebar{border-right:1px solid rgba(0,0,0,.07);overflow-y:auto;padding:40px 0 0;position:absolute;top:0;bottom:0;left:0;transition:transform .25s ease-out;width:300px;z-index:20}.sidebar>h1{margin:0 auto 1rem;font-size:1.5rem;font-weight:300;text-align:center}.sidebar>h1 a{color:inherit;text-decoration:none}.sidebar>h1 .app-nav{display:block;position:static}.sidebar .sidebar-nav{line-height:2em;padding-bottom:40px}.sidebar li.collapse .app-sub-sidebar{display:none}.sidebar ul{margin:0 0 0 15px;padding:0}.sidebar li>p{font-weight:700;margin:0}.sidebar ul,.sidebar ul li{list-style:none}.sidebar ul li a{border-bottom:none;display:block}.sidebar ul li ul{padding-left:20px}.sidebar::-webkit-scrollbar{width:4px}.sidebar::-webkit-scrollbar-thumb{background:transparent;border-radius:4px}.sidebar:hover::-webkit-scrollbar-thumb{background:hsla(0,0%,53.3%,.4)}.sidebar:hover::-webkit-scrollbar-track{background:hsla(0,0%,53.3%,.1)}.sidebar-toggle{background-color:transparent;background-color:rgba(63,63,63,.8);border:0;outline:none;padding:10px;position:absolute;bottom:0;left:0;text-align:center;transition:opacity .3s;width:284px;z-index:30;cursor:pointer}.sidebar-toggle:hover .sidebar-toggle-button{opacity:.4}.sidebar-toggle span{background-color:var(--theme-color,#ea6f5a);display:block;margin-bottom:4px;width:16px;height:2px}body.sticky .sidebar,body.sticky .sidebar-toggle{position:fixed}.content{padding-top:60px;position:absolute;top:0;right:0;bottom:0;left:300px;transition:left .25s ease}.markdown-section{margin:0 auto;max-width:80%;padding:30px 15px 40px;position:relative}.markdown-section>*{box-sizing:border-box;font-size:inherit}.markdown-section>:first-child{margin-top:0!important}.markdown-section hr{border:none;border-bottom:1px solid #eee;margin:2em 0}.markdown-section iframe{border:1px solid #eee;width:1px;min-width:100%}.markdown-section table{border-collapse:collapse;border-spacing:0;display:block;margin-bottom:1rem;overflow:auto;width:100%}.markdown-section th{font-weight:700}.markdown-section td,.markdown-section th{border:1px solid #ddd;padding:6px 13px}.markdown-section tr{border-top:1px solid #ccc}.markdown-section p.tip,.markdown-section tr:nth-child(2n){background-color:#f8f8f8}.markdown-section p.tip{border-bottom-right-radius:2px;border-left:4px solid #f66;border-top-right-radius:2px;margin:2em 0;padding:12px 24px 12px 30px;position:relative}.markdown-section p.tip:before{background-color:#f66;border-radius:100%;color:#3f3f3f;content:"!";font-family:Dosis,Source Sans Pro,Helvetica Neue,Arial,sans-serif;font-size:14px;font-weight:700;left:-12px;line-height:20px;position:absolute;height:20px;width:20px;text-align:center;top:14px}.markdown-section p.tip code{background-color:#efefef}.markdown-section p.tip em{color:#c8c8c8}.markdown-section p.warn{background:rgba(234,111,90,.1);border-radius:2px;padding:1rem}.markdown-section ul.task-list>li{list-style-type:none}body.close .sidebar{transform:translateX(-300px)}body.close .sidebar-toggle{width:auto}body.close .content{left:0}@media print{.app-nav,.github-corner,.sidebar,.sidebar-toggle{display:none}}@media screen and (max-width:768px){.github-corner,.sidebar,.sidebar-toggle{position:fixed}.app-nav{margin-top:16px}.app-nav li ul{top:30px}main{height:auto;overflow-x:hidden}.sidebar{left:-300px;transition:transform .25s ease-out}.content{left:0;max-width:100vw;position:static;padding-top:20px;transition:transform .25s ease}.app-nav,.github-corner{transition:transform .25s ease-out}.sidebar-toggle{background-color:transparent;width:auto;padding:30px 30px 10px 10px}body.close .sidebar{transform:translateX(300px)}body.close .sidebar-toggle{background-color:rgba(63,63,63,.8);transition:background-color 1s;width:284px;padding:10px}body.close .content{transform:translateX(300px)}body.close .app-nav,body.close .github-corner{display:none}.github-corner:hover .octo-arm{-webkit-animation:none;animation:none}.github-corner .octo-arm{-webkit-animation:octocat-wave .56s ease-in-out;animation:octocat-wave .56s ease-in-out}}@-webkit-keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@keyframes octocat-wave{0%,to{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}section.cover{align-items:center;background-position:50%;background-repeat:no-repeat;background-size:cover;height:100vh;width:100vw;display:none}section.cover.show{display:flex}section.cover.has-mask .mask{background-color:#3f3f3f;opacity:.8;position:absolute;top:0;height:100%;width:100%}section.cover .cover-main{flex:1;margin:-20px 16px 0;text-align:center;position:relative}section.cover a{color:inherit}section.cover a,section.cover a:hover{text-decoration:none}section.cover p{line-height:1.5rem;margin:1em 0}section.cover h1{color:inherit;font-size:2.5rem;font-weight:300;margin:.625rem 0 2.5rem;position:relative;text-align:center}section.cover h1 a{display:block}section.cover h1 small{bottom:-.4375rem;font-size:1rem;position:absolute}section.cover blockquote{font-size:1.5rem;text-align:center}section.cover ul{line-height:1.8;list-style-type:none;margin:1em auto;max-width:500px;padding:0}section.cover .cover-main>p:last-child a{border-radius:2rem;border:1px solid var(--theme-color,#ea6f5a);box-sizing:border-box;color:var(--theme-color,#ea6f5a);display:inline-block;font-size:1.05rem;letter-spacing:.1rem;margin:.5rem 1rem;padding:.75em 2rem;text-decoration:none;transition:all .15s ease}section.cover .cover-main>p:last-child a:last-child{background-color:var(--theme-color,#ea6f5a);color:#fff}section.cover .cover-main>p:last-child a:last-child:hover{color:inherit;opacity:.8}section.cover .cover-main>p:last-child a:hover{color:inherit}section.cover blockquote>p>a{border-bottom:2px solid var(--theme-color,#ea6f5a);transition:color .3s}section.cover blockquote>p>a:hover{color:var(--theme-color,#ea6f5a)}.sidebar,body{background-color:#3f3f3f}.sidebar{color:#c8c8c8}.sidebar li{margin:6px 15px 6px 0}.sidebar ul li a{color:#c8c8c8;font-size:14px;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.sidebar ul li a:hover{text-decoration:underline}.sidebar ul li ul{padding:0}.sidebar ul li.active>a{color:var(--theme-color,#ea6f5a);font-weight:600}.markdown-section h1,.markdown-section h2,.markdown-section h3,.markdown-section h4,.markdown-section strong{color:#657b83;font-weight:600}.markdown-section a{color:var(--theme-color,#ea6f5a);font-weight:600}.markdown-section h1{font-size:2rem;margin:0 0 1rem}.markdown-section h2{font-size:1.75rem;margin:45px 0 .8rem}.markdown-section h3{font-size:1.5rem;margin:40px 0 .6rem}.markdown-section h4{font-size:1.25rem}.markdown-section h5{font-size:1rem}.markdown-section h6{color:#777;font-size:1rem}.markdown-section figure,.markdown-section ol,.markdown-section p,.markdown-section ul{margin:1.2em 0}.markdown-section ol,.markdown-section p,.markdown-section ul{line-height:1.6rem;word-spacing:.05rem}.markdown-section ol,.markdown-section ul{padding-left:1.5rem}.markdown-section blockquote{border-left:4px solid var(--theme-color,#ea6f5a);color:#858585;margin:2em 0;padding-left:20px}.markdown-section blockquote p{font-weight:600;margin-left:0}.markdown-section iframe{margin:1em 0}.markdown-section em{color:#7f8c8d}.markdown-section code{background-color:#282828;border-radius:2px;color:#657b83;font-family:Roboto Mono,Monaco,courier,monospace;margin:0 2px;padding:3px 5px;white-space:pre-wrap}.markdown-section>:not(h1):not(h2):not(h3):not(h4):not(h5):not(h6) code{font-size:.8rem}.markdown-section pre{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;background-color:#282828;font-family:Roboto Mono,Monaco,courier,monospace;line-height:1.5rem;margin:1.2em 0;overflow:auto;padding:0 1.4rem;position:relative;word-wrap:normal}.token.cdata,.token.comment,.token.doctype,.token.prolog{color:#8e908c}.token.namespace{opacity:.7}.token.boolean,.token.number{color:#c76b29}.token.punctuation{color:#525252}.token.property{color:#c08b30}.token.tag{color:#2973b7}.token.string{color:var(--theme-color,#ea6f5a)}.token.selector{color:#6679cc}.token.attr-name{color:#2973b7}.language-css .token.string,.style .token.string,.token.entity,.token.url{color:#22a2c9}.token.attr-value,.token.control,.token.directive,.token.unit{color:var(--theme-color,#ea6f5a)}.token.keyword{color:#e96900}.token.atrule,.token.regex,.token.statement{color:#22a2c9}.token.placeholder,.token.variable{color:#3d8fd1}.token.deleted{text-decoration:line-through}.token.inserted{border-bottom:1px dotted #202746;text-decoration:none}.token.italic{font-style:italic}.token.bold,.token.important{font-weight:700}.token.important{color:#c94922}.token.entity{cursor:help}.markdown-section pre>code{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;background-color:#282828;border-radius:2px;color:#657b83;display:block;font-family:Roboto Mono,Monaco,courier,monospace;font-size:.8rem;line-height:inherit;margin:0 2px;max-width:inherit;overflow:inherit;padding:2.2em 5px;white-space:inherit}.markdown-section code:after,.markdown-section code:before{letter-spacing:.05rem}code .token{-moz-osx-font-smoothing:initial;-webkit-font-smoothing:initial;min-height:1.5rem;position:relative;left:auto}pre:after{color:#ccc;content:attr(data-lang);font-size:.6rem;font-weight:600;height:15px;line-height:15px;padding:5px 10px 0;position:absolute;right:0;text-align:right;top:0}.markdown-section p.tip{background-color:#282828;color:#657b83}input[type=search]{background:#4f4f4f;border-color:#4f4f4f;color:#c8c8c8}
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/EnvController.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.controller; import com.ctrip.framework.apollo.portal.component.PortalSettings; import com.ctrip.framework.apollo.portal.environment.Env; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; @RestController @RequestMapping("/envs") public class EnvController { private final PortalSettings portalSettings; public EnvController(final PortalSettings portalSettings) { this.portalSettings = portalSettings; } @GetMapping public List<String> envs() { List<String> environments = new ArrayList<>(); for(Env env : portalSettings.getActiveEnvs()) { environments.add(env.toString()); } return environments; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.controller; import com.ctrip.framework.apollo.portal.component.PortalSettings; import com.ctrip.framework.apollo.portal.environment.Env; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; @RestController @RequestMapping("/envs") public class EnvController { private final PortalSettings portalSettings; public EnvController(final PortalSettings portalSettings) { this.portalSettings = portalSettings; } @GetMapping public List<String> envs() { List<String> environments = new ArrayList<>(); for(Env env : portalSettings.getActiveEnvs()) { environments.add(env.toString()); } return environments; } }
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/resources/static/scripts/services/OrganizationService.js
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ appService.service("OrganizationService", ['$resource', '$q', 'AppUtil', function ($resource, $q, AppUtil) { var organization_source = $resource("", {}, { find_organizations: { method: 'GET', isArray: true, url: AppUtil.prefixPath() + '/organizations' } }); return { find_organizations: function () { var d = $q.defer(); organization_source.find_organizations({}, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; } } }]);
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ appService.service("OrganizationService", ['$resource', '$q', 'AppUtil', function ($resource, $q, AppUtil) { var organization_source = $resource("", {}, { find_organizations: { method: 'GET', isArray: true, url: AppUtil.prefixPath() + '/organizations' } }); return { find_organizations: function () { var d = $q.defer(); organization_source.find_organizations({}, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; } } }]);
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./scripts/flyway/configdb/V1.0.0__initialization.sql
-- -- Copyright 2021 Apollo Authors -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; # Create Database # ------------------------------------------------------------ CREATE DATABASE IF NOT EXISTS ApolloConfigDB DEFAULT CHARACTER SET = utf8mb4; Use ApolloConfigDB; # Dump of table app # ------------------------------------------------------------ DROP TABLE IF EXISTS `App`; CREATE TABLE `App` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名', `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id', `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字', `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName', `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `AppId` (`AppId`(191)), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_Name` (`Name`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用表'; # Dump of table appnamespace # ------------------------------------------------------------ DROP TABLE IF EXISTS `AppNamespace`; CREATE TABLE `AppNamespace` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `Name` varchar(32) NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一', `AppId` varchar(32) NOT NULL DEFAULT '' COMMENT 'app id', `Format` varchar(32) NOT NULL DEFAULT 'properties' COMMENT 'namespace的format类型', `IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace是否为公共', `Comment` varchar(64) NOT NULL DEFAULT '' COMMENT '注释', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `IX_AppId` (`AppId`), KEY `Name_AppId` (`Name`,`AppId`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义'; # Dump of table audit # ------------------------------------------------------------ DROP TABLE IF EXISTS `Audit`; CREATE TABLE `Audit` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `EntityName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '表名', `EntityId` int(10) unsigned DEFAULT NULL COMMENT '记录ID', `OpName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '操作类型', `Comment` varchar(500) DEFAULT NULL COMMENT '备注', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='日志审计表'; # Dump of table cluster # ------------------------------------------------------------ DROP TABLE IF EXISTS `Cluster`; CREATE TABLE `Cluster` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `Name` varchar(32) NOT NULL DEFAULT '' COMMENT '集群名字', `AppId` varchar(32) NOT NULL DEFAULT '' COMMENT 'App id', `ParentClusterId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父cluster', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `IX_AppId_Name` (`AppId`,`Name`), KEY `IX_ParentClusterId` (`ParentClusterId`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='集群'; # Dump of table commit # ------------------------------------------------------------ DROP TABLE IF EXISTS `Commit`; CREATE TABLE `Commit` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `ChangeSets` longtext NOT NULL COMMENT '修改变更集', `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName', `Comment` varchar(500) DEFAULT NULL COMMENT '备注', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `AppId` (`AppId`(191)), KEY `ClusterName` (`ClusterName`(191)), KEY `NamespaceName` (`NamespaceName`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='commit 历史表'; # Dump of table grayreleaserule # ------------------------------------------------------------ DROP TABLE IF EXISTS `GrayReleaseRule`; CREATE TABLE `GrayReleaseRule` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name', `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name', `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'branch name', `Rules` varchar(16000) DEFAULT '[]' COMMENT '灰度规则', `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '灰度对应的release', `BranchStatus` tinyint(2) DEFAULT '1' COMMENT '灰度分支状态: 0:删除分支,1:正在使用的规则 2:全量发布', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='灰度规则表'; # Dump of table instance # ------------------------------------------------------------ DROP TABLE IF EXISTS `Instance`; CREATE TABLE `Instance` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `DataCenter` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Data Center Name', `Ip` varchar(32) NOT NULL DEFAULT '' COMMENT 'instance ip', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), UNIQUE KEY `IX_UNIQUE_KEY` (`AppId`,`ClusterName`,`Ip`,`DataCenter`), KEY `IX_IP` (`Ip`), KEY `IX_DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='使用配置的应用实例'; # Dump of table instanceconfig # ------------------------------------------------------------ DROP TABLE IF EXISTS `InstanceConfig`; CREATE TABLE `InstanceConfig` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', `InstanceId` int(11) unsigned DEFAULT NULL COMMENT 'Instance Id', `ConfigAppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config App Id', `ConfigClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Cluster Name', `ConfigNamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Namespace Name', `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key', `ReleaseDeliveryTime` timestamp NULL DEFAULT NULL COMMENT '配置获取时间', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), UNIQUE KEY `IX_UNIQUE_KEY` (`InstanceId`,`ConfigAppId`,`ConfigNamespaceName`), KEY `IX_ReleaseKey` (`ReleaseKey`), KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_Valid_Namespace` (`ConfigAppId`,`ConfigClusterName`,`ConfigNamespaceName`,`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用实例的配置信息'; # Dump of table item # ------------------------------------------------------------ DROP TABLE IF EXISTS `Item`; CREATE TABLE `Item` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId', `Key` varchar(128) NOT NULL DEFAULT 'default' COMMENT '配置项Key', `Value` longtext NOT NULL COMMENT '配置项值', `Comment` varchar(1024) DEFAULT '' COMMENT '注释', `LineNum` int(10) unsigned DEFAULT '0' COMMENT '行号', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `IX_GroupId` (`NamespaceId`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置项目'; # Dump of table namespace # ------------------------------------------------------------ DROP TABLE IF EXISTS `Namespace`; CREATE TABLE `Namespace` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name', `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `AppId_ClusterName_NamespaceName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_NamespaceName` (`NamespaceName`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='命名空间'; # Dump of table namespacelock # ------------------------------------------------------------ DROP TABLE IF EXISTS `NamespaceLock`; CREATE TABLE `NamespaceLock` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT 'default' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', `IsDeleted` bit(1) DEFAULT b'0' COMMENT '软删除', PRIMARY KEY (`Id`), UNIQUE KEY `IX_NamespaceId` (`NamespaceId`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='namespace的编辑锁'; # Dump of table release # ------------------------------------------------------------ DROP TABLE IF EXISTS `Release`; CREATE TABLE `Release` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key', `Name` varchar(64) NOT NULL DEFAULT 'default' COMMENT '发布名字', `Comment` varchar(256) DEFAULT NULL COMMENT '发布说明', `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName', `Configurations` longtext NOT NULL COMMENT '发布配置', `IsAbandoned` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否废弃', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `AppId_ClusterName_GroupName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_ReleaseKey` (`ReleaseKey`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布'; # Dump of table releasehistory # ------------------------------------------------------------ DROP TABLE IF EXISTS `ReleaseHistory`; CREATE TABLE `ReleaseHistory` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'namespaceName', `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT '发布分支名', `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '关联的Release Id', `PreviousReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '前一次发布的ReleaseId', `Operation` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '发布类型,0: 普通发布,1: 回滚,2: 灰度发布,3: 灰度规则更新,4: 灰度合并回主分支发布,5: 主分支发布灰度自动发布,6: 主分支回滚灰度自动发布,7: 放弃灰度', `OperationContext` longtext NOT NULL COMMENT '发布上下文信息', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`,`BranchName`), KEY `IX_ReleaseId` (`ReleaseId`), KEY `IX_DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布历史'; # Dump of table releasemessage # ------------------------------------------------------------ DROP TABLE IF EXISTS `ReleaseMessage`; CREATE TABLE `ReleaseMessage` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `Message` varchar(1024) NOT NULL DEFAULT '' COMMENT '发布的消息内容', `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_Message` (`Message`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布消息'; # Dump of table serverconfig # ------------------------------------------------------------ DROP TABLE IF EXISTS `ServerConfig`; CREATE TABLE `ServerConfig` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', `Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key', `Cluster` varchar(32) NOT NULL DEFAULT 'default' COMMENT '配置对应的集群,default为不针对特定的集群', `Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值', `Comment` varchar(1024) DEFAULT '' COMMENT '注释', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `IX_Key` (`Key`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置'; # Config # ------------------------------------------------------------ INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`, `Comment`) VALUES ('eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'), ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'), ('item.key.length.limit', 'default', '128', 'item key 最大长度限制'), ('item.value.length.limit', 'default', '20000', 'item value最大长度限制'), ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'); /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-- -- Copyright 2021 Apollo Authors -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; # Create Database # ------------------------------------------------------------ CREATE DATABASE IF NOT EXISTS ApolloConfigDB DEFAULT CHARACTER SET = utf8mb4; Use ApolloConfigDB; # Dump of table app # ------------------------------------------------------------ DROP TABLE IF EXISTS `App`; CREATE TABLE `App` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', `Name` varchar(500) NOT NULL DEFAULT 'default' COMMENT '应用名', `OrgId` varchar(32) NOT NULL DEFAULT 'default' COMMENT '部门Id', `OrgName` varchar(64) NOT NULL DEFAULT 'default' COMMENT '部门名字', `OwnerName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerName', `OwnerEmail` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ownerEmail', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `AppId` (`AppId`(191)), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_Name` (`Name`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用表'; # Dump of table appnamespace # ------------------------------------------------------------ DROP TABLE IF EXISTS `AppNamespace`; CREATE TABLE `AppNamespace` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `Name` varchar(32) NOT NULL DEFAULT '' COMMENT 'namespace名字,注意,需要全局唯一', `AppId` varchar(32) NOT NULL DEFAULT '' COMMENT 'app id', `Format` varchar(32) NOT NULL DEFAULT 'properties' COMMENT 'namespace的format类型', `IsPublic` bit(1) NOT NULL DEFAULT b'0' COMMENT 'namespace是否为公共', `Comment` varchar(64) NOT NULL DEFAULT '' COMMENT '注释', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `IX_AppId` (`AppId`), KEY `Name_AppId` (`Name`,`AppId`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用namespace定义'; # Dump of table audit # ------------------------------------------------------------ DROP TABLE IF EXISTS `Audit`; CREATE TABLE `Audit` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `EntityName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '表名', `EntityId` int(10) unsigned DEFAULT NULL COMMENT '记录ID', `OpName` varchar(50) NOT NULL DEFAULT 'default' COMMENT '操作类型', `Comment` varchar(500) DEFAULT NULL COMMENT '备注', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='日志审计表'; # Dump of table cluster # ------------------------------------------------------------ DROP TABLE IF EXISTS `Cluster`; CREATE TABLE `Cluster` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `Name` varchar(32) NOT NULL DEFAULT '' COMMENT '集群名字', `AppId` varchar(32) NOT NULL DEFAULT '' COMMENT 'App id', `ParentClusterId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父cluster', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT '' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `IX_AppId_Name` (`AppId`,`Name`), KEY `IX_ParentClusterId` (`ParentClusterId`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='集群'; # Dump of table commit # ------------------------------------------------------------ DROP TABLE IF EXISTS `Commit`; CREATE TABLE `Commit` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `ChangeSets` longtext NOT NULL COMMENT '修改变更集', `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName', `Comment` varchar(500) DEFAULT NULL COMMENT '备注', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `AppId` (`AppId`(191)), KEY `ClusterName` (`ClusterName`(191)), KEY `NamespaceName` (`NamespaceName`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='commit 历史表'; # Dump of table grayreleaserule # ------------------------------------------------------------ DROP TABLE IF EXISTS `GrayReleaseRule`; CREATE TABLE `GrayReleaseRule` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键', `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name', `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name', `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'branch name', `Rules` varchar(16000) DEFAULT '[]' COMMENT '灰度规则', `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '灰度对应的release', `BranchStatus` tinyint(2) DEFAULT '1' COMMENT '灰度分支状态: 0:删除分支,1:正在使用的规则 2:全量发布', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='灰度规则表'; # Dump of table instance # ------------------------------------------------------------ DROP TABLE IF EXISTS `Instance`; CREATE TABLE `Instance` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `DataCenter` varchar(64) NOT NULL DEFAULT 'default' COMMENT 'Data Center Name', `Ip` varchar(32) NOT NULL DEFAULT '' COMMENT 'instance ip', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), UNIQUE KEY `IX_UNIQUE_KEY` (`AppId`,`ClusterName`,`Ip`,`DataCenter`), KEY `IX_IP` (`Ip`), KEY `IX_DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='使用配置的应用实例'; # Dump of table instanceconfig # ------------------------------------------------------------ DROP TABLE IF EXISTS `InstanceConfig`; CREATE TABLE `InstanceConfig` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', `InstanceId` int(11) unsigned DEFAULT NULL COMMENT 'Instance Id', `ConfigAppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config App Id', `ConfigClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Cluster Name', `ConfigNamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'Config Namespace Name', `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key', `ReleaseDeliveryTime` timestamp NULL DEFAULT NULL COMMENT '配置获取时间', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), UNIQUE KEY `IX_UNIQUE_KEY` (`InstanceId`,`ConfigAppId`,`ConfigNamespaceName`), KEY `IX_ReleaseKey` (`ReleaseKey`), KEY `IX_DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_Valid_Namespace` (`ConfigAppId`,`ConfigClusterName`,`ConfigNamespaceName`,`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='应用实例的配置信息'; # Dump of table item # ------------------------------------------------------------ DROP TABLE IF EXISTS `Item`; CREATE TABLE `Item` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId', `Key` varchar(128) NOT NULL DEFAULT 'default' COMMENT '配置项Key', `Value` longtext NOT NULL COMMENT '配置项值', `Comment` varchar(1024) DEFAULT '' COMMENT '注释', `LineNum` int(10) unsigned DEFAULT '0' COMMENT '行号', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `IX_GroupId` (`NamespaceId`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置项目'; # Dump of table namespace # ------------------------------------------------------------ DROP TABLE IF EXISTS `Namespace`; CREATE TABLE `Namespace` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Cluster Name', `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'Namespace Name', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `AppId_ClusterName_NamespaceName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_NamespaceName` (`NamespaceName`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='命名空间'; # Dump of table namespacelock # ------------------------------------------------------------ DROP TABLE IF EXISTS `NamespaceLock`; CREATE TABLE `NamespaceLock` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id', `NamespaceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '集群NamespaceId', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT 'default' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', `IsDeleted` bit(1) DEFAULT b'0' COMMENT '软删除', PRIMARY KEY (`Id`), UNIQUE KEY `IX_NamespaceId` (`NamespaceId`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='namespace的编辑锁'; # Dump of table release # ------------------------------------------------------------ DROP TABLE IF EXISTS `Release`; CREATE TABLE `Release` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `ReleaseKey` varchar(64) NOT NULL DEFAULT '' COMMENT '发布的Key', `Name` varchar(64) NOT NULL DEFAULT 'default' COMMENT '发布名字', `Comment` varchar(256) DEFAULT NULL COMMENT '发布说明', `AppId` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `NamespaceName` varchar(500) NOT NULL DEFAULT 'default' COMMENT 'namespaceName', `Configurations` longtext NOT NULL COMMENT '发布配置', `IsAbandoned` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否废弃', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `AppId_ClusterName_GroupName` (`AppId`(191),`ClusterName`(191),`NamespaceName`(191)), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_ReleaseKey` (`ReleaseKey`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布'; # Dump of table releasehistory # ------------------------------------------------------------ DROP TABLE IF EXISTS `ReleaseHistory`; CREATE TABLE `ReleaseHistory` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', `AppId` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'AppID', `ClusterName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'ClusterName', `NamespaceName` varchar(32) NOT NULL DEFAULT 'default' COMMENT 'namespaceName', `BranchName` varchar(32) NOT NULL DEFAULT 'default' COMMENT '发布分支名', `ReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '关联的Release Id', `PreviousReleaseId` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '前一次发布的ReleaseId', `Operation` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '发布类型,0: 普通发布,1: 回滚,2: 灰度发布,3: 灰度规则更新,4: 灰度合并回主分支发布,5: 主分支发布灰度自动发布,6: 主分支回滚灰度自动发布,7: 放弃灰度', `OperationContext` longtext NOT NULL COMMENT '发布上下文信息', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `IX_Namespace` (`AppId`,`ClusterName`,`NamespaceName`,`BranchName`), KEY `IX_ReleaseId` (`ReleaseId`), KEY `IX_DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布历史'; # Dump of table releasemessage # ------------------------------------------------------------ DROP TABLE IF EXISTS `ReleaseMessage`; CREATE TABLE `ReleaseMessage` ( `Id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增主键', `Message` varchar(1024) NOT NULL DEFAULT '' COMMENT '发布的消息内容', `DataChange_LastTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `DataChange_LastTime` (`DataChange_LastTime`), KEY `IX_Message` (`Message`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='发布消息'; # Dump of table serverconfig # ------------------------------------------------------------ DROP TABLE IF EXISTS `ServerConfig`; CREATE TABLE `ServerConfig` ( `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增Id', `Key` varchar(64) NOT NULL DEFAULT 'default' COMMENT '配置项Key', `Cluster` varchar(32) NOT NULL DEFAULT 'default' COMMENT '配置对应的集群,default为不针对特定的集群', `Value` varchar(2048) NOT NULL DEFAULT 'default' COMMENT '配置项值', `Comment` varchar(1024) DEFAULT '' COMMENT '注释', `IsDeleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '1: deleted, 0: normal', `DataChange_CreatedBy` varchar(32) NOT NULL DEFAULT 'default' COMMENT '创建人邮箱前缀', `DataChange_CreatedTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `DataChange_LastModifiedBy` varchar(32) DEFAULT '' COMMENT '最后修改人邮箱前缀', `DataChange_LastTime` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '最后修改时间', PRIMARY KEY (`Id`), KEY `IX_Key` (`Key`), KEY `DataChange_LastTime` (`DataChange_LastTime`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='配置服务自身配置'; # Config # ------------------------------------------------------------ INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`, `Comment`) VALUES ('eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔'), ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关'), ('item.key.length.limit', 'default', '128', 'item key 最大长度限制'), ('item.value.length.limit', 'default', '20000', 'item value最大长度限制'), ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!'); /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/controller/NamespaceController.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.controller; import com.ctrip.framework.apollo.common.dto.AppNamespaceDTO; import com.ctrip.framework.apollo.common.dto.NamespaceDTO; import com.ctrip.framework.apollo.common.entity.AppNamespace; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.common.http.MultiResponseEntity; import com.ctrip.framework.apollo.common.http.RichResponseEntity; import com.ctrip.framework.apollo.common.utils.BeanUtils; import com.ctrip.framework.apollo.common.utils.InputValidator; import com.ctrip.framework.apollo.common.utils.RequestPrecondition; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.component.PermissionValidator; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO; import com.ctrip.framework.apollo.portal.entity.model.NamespaceCreationModel; import com.ctrip.framework.apollo.portal.listener.AppNamespaceCreationEvent; import com.ctrip.framework.apollo.portal.listener.AppNamespaceDeletionEvent; import com.ctrip.framework.apollo.portal.service.AppNamespaceService; import com.ctrip.framework.apollo.portal.service.NamespaceService; import com.ctrip.framework.apollo.portal.service.RoleInitializationService; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.ctrip.framework.apollo.tracer.Tracer; import com.google.common.collect.Sets; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationEventPublisher; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import static com.ctrip.framework.apollo.common.utils.RequestPrecondition.checkModel; @RestController public class NamespaceController { private static final Logger logger = LoggerFactory.getLogger(NamespaceController.class); private final ApplicationEventPublisher publisher; private final UserInfoHolder userInfoHolder; private final NamespaceService namespaceService; private final AppNamespaceService appNamespaceService; private final RoleInitializationService roleInitializationService; private final PortalConfig portalConfig; private final PermissionValidator permissionValidator; private final AdminServiceAPI.NamespaceAPI namespaceAPI; public NamespaceController( final ApplicationEventPublisher publisher, final UserInfoHolder userInfoHolder, final NamespaceService namespaceService, final AppNamespaceService appNamespaceService, final RoleInitializationService roleInitializationService, final PortalConfig portalConfig, final PermissionValidator permissionValidator, final AdminServiceAPI.NamespaceAPI namespaceAPI) { this.publisher = publisher; this.userInfoHolder = userInfoHolder; this.namespaceService = namespaceService; this.appNamespaceService = appNamespaceService; this.roleInitializationService = roleInitializationService; this.portalConfig = portalConfig; this.permissionValidator = permissionValidator; this.namespaceAPI = namespaceAPI; } @GetMapping("/appnamespaces/public") public List<AppNamespace> findPublicAppNamespaces() { return appNamespaceService.findPublicAppNamespaces(); } @GetMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces") public List<NamespaceBO> findNamespaces(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName) { List<NamespaceBO> namespaceBOs = namespaceService.findNamespaceBOs(appId, Env.valueOf(env), clusterName); for (NamespaceBO namespaceBO : namespaceBOs) { if (permissionValidator.shouldHideConfigToCurrentUser(appId, env, namespaceBO.getBaseInfo().getNamespaceName())) { namespaceBO.hideItems(); } } return namespaceBOs; } @GetMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName:.+}") public NamespaceBO findNamespace(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName) { NamespaceBO namespaceBO = namespaceService.loadNamespaceBO(appId, Env.valueOf(env), clusterName, namespaceName); if (namespaceBO != null && permissionValidator.shouldHideConfigToCurrentUser(appId, env, namespaceName)) { namespaceBO.hideItems(); } return namespaceBO; } @GetMapping("/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/associated-public-namespace") public NamespaceBO findPublicNamespaceForAssociatedNamespace(@PathVariable String env, @PathVariable String appId, @PathVariable String namespaceName, @PathVariable String clusterName) { return namespaceService.findPublicNamespaceForAssociatedNamespace(Env.valueOf(env), appId, clusterName, namespaceName); } @PreAuthorize(value = "@permissionValidator.hasCreateNamespacePermission(#appId)") @PostMapping("/apps/{appId}/namespaces") public ResponseEntity<Void> createNamespace(@PathVariable String appId, @RequestBody List<NamespaceCreationModel> models) { checkModel(!CollectionUtils.isEmpty(models)); String namespaceName = models.get(0).getNamespace().getNamespaceName(); String operator = userInfoHolder.getUser().getUserId(); roleInitializationService.initNamespaceRoles(appId, namespaceName, operator); roleInitializationService.initNamespaceEnvRoles(appId, namespaceName, operator); for (NamespaceCreationModel model : models) { NamespaceDTO namespace = model.getNamespace(); RequestPrecondition.checkArgumentsNotEmpty(model.getEnv(), namespace.getAppId(), namespace.getClusterName(), namespace.getNamespaceName()); try { namespaceService.createNamespace(Env.valueOf(model.getEnv()), namespace); } catch (Exception e) { logger.error("create namespace fail.", e); Tracer.logError( String.format("create namespace fail. (env=%s namespace=%s)", model.getEnv(), namespace.getNamespaceName()), e); } } namespaceService.assignNamespaceRoleToOperator(appId, namespaceName,userInfoHolder.getUser().getUserId()); return ResponseEntity.ok().build(); } @PreAuthorize(value = "@permissionValidator.hasDeleteNamespacePermission(#appId)") @DeleteMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName:.+}") public ResponseEntity<Void> deleteNamespace(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName) { namespaceService.deleteNamespace(appId, Env.valueOf(env), clusterName, namespaceName); return ResponseEntity.ok().build(); } @PreAuthorize(value = "@permissionValidator.isSuperAdmin()") @DeleteMapping("/apps/{appId}/appnamespaces/{namespaceName:.+}") public ResponseEntity<Void> deleteAppNamespace(@PathVariable String appId, @PathVariable String namespaceName) { AppNamespace appNamespace = appNamespaceService.deleteAppNamespace(appId, namespaceName); publisher.publishEvent(new AppNamespaceDeletionEvent(appNamespace)); return ResponseEntity.ok().build(); } @GetMapping("/apps/{appId}/appnamespaces/{namespaceName:.+}") public AppNamespaceDTO findAppNamespace(@PathVariable String appId, @PathVariable String namespaceName) { AppNamespace appNamespace = appNamespaceService.findByAppIdAndName(appId, namespaceName); if (appNamespace == null) { throw new BadRequestException( String.format("AppNamespace not exists. AppId = %s, NamespaceName = %s", appId, namespaceName)); } return BeanUtils.transform(AppNamespaceDTO.class, appNamespace); } @PreAuthorize(value = "@permissionValidator.hasCreateAppNamespacePermission(#appId, #appNamespace)") @PostMapping("/apps/{appId}/appnamespaces") public AppNamespace createAppNamespace(@PathVariable String appId, @RequestParam(defaultValue = "true") boolean appendNamespacePrefix, @Valid @RequestBody AppNamespace appNamespace) { if (!InputValidator.isValidAppNamespace(appNamespace.getName())) { throw new BadRequestException(String.format("Invalid Namespace format: %s", InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE + " & " + InputValidator.INVALID_NAMESPACE_NAMESPACE_MESSAGE)); } AppNamespace createdAppNamespace = appNamespaceService.createAppNamespaceInLocal(appNamespace, appendNamespacePrefix); if (portalConfig.canAppAdminCreatePrivateNamespace() || createdAppNamespace.isPublic()) { namespaceService.assignNamespaceRoleToOperator(appId, appNamespace.getName(), userInfoHolder.getUser().getUserId()); } publisher.publishEvent(new AppNamespaceCreationEvent(createdAppNamespace)); return createdAppNamespace; } /** * env -> cluster -> cluster has not published namespace? * Example: * dev -> * default -> true (default cluster has not published namespace) * customCluster -> false (customCluster cluster's all namespaces had published) */ @GetMapping("/apps/{appId}/namespaces/publish_info") public Map<String, Map<String, Boolean>> getNamespacesPublishInfo(@PathVariable String appId) { return namespaceService.getNamespacesPublishInfo(appId); } @GetMapping("/envs/{env}/appnamespaces/{publicNamespaceName}/namespaces") public List<NamespaceDTO> getPublicAppNamespaceAllNamespaces(@PathVariable String env, @PathVariable String publicNamespaceName, @RequestParam(name = "page", defaultValue = "0") int page, @RequestParam(name = "size", defaultValue = "10") int size) { return namespaceService.getPublicAppNamespaceAllNamespaces(Env.valueOf(env), publicNamespaceName, page, size); } @GetMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/missing-namespaces") public MultiResponseEntity<String> findMissingNamespaces(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName) { MultiResponseEntity<String> response = MultiResponseEntity.ok(); Set<String> missingNamespaces = findMissingNamespaceNames(appId, env, clusterName); for (String missingNamespace : missingNamespaces) { response.addResponseEntity(RichResponseEntity.ok(missingNamespace)); } return response; } @PostMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/missing-namespaces") public ResponseEntity<Void> createMissingNamespaces(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName) { Set<String> missingNamespaces = findMissingNamespaceNames(appId, env, clusterName); for (String missingNamespace : missingNamespaces) { namespaceAPI.createMissingAppNamespace(Env.valueOf(env), findAppNamespace(appId, missingNamespace)); } return ResponseEntity.ok().build(); } private Set<String> findMissingNamespaceNames(String appId, String env, String clusterName) { List<AppNamespaceDTO> configDbAppNamespaces = namespaceAPI.getAppNamespaces(appId, Env.valueOf(env)); List<NamespaceDTO> configDbNamespaces = namespaceService.findNamespaces(appId, Env.valueOf(env), clusterName); List<AppNamespace> portalDbAppNamespaces = appNamespaceService.findByAppId(appId); Set<String> configDbAppNamespaceNames = configDbAppNamespaces.stream().map(AppNamespaceDTO::getName) .collect(Collectors.toSet()); Set<String> configDbNamespaceNames = configDbNamespaces.stream().map(NamespaceDTO::getNamespaceName) .collect(Collectors.toSet()); Set<String> portalDbAllAppNamespaceNames = Sets.newHashSet(); Set<String> portalDbPrivateAppNamespaceNames = Sets.newHashSet(); for (AppNamespace appNamespace : portalDbAppNamespaces) { portalDbAllAppNamespaceNames.add(appNamespace.getName()); if (!appNamespace.isPublic()) { portalDbPrivateAppNamespaceNames.add(appNamespace.getName()); } } // AppNamespaces should be the same Set<String> missingAppNamespaceNames = Sets.difference(portalDbAllAppNamespaceNames, configDbAppNamespaceNames); // Private namespaces should all exist Set<String> missingNamespaceNames = Sets.difference(portalDbPrivateAppNamespaceNames, configDbNamespaceNames); return Sets.union(missingAppNamespaceNames, missingNamespaceNames); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.controller; import com.ctrip.framework.apollo.common.dto.AppNamespaceDTO; import com.ctrip.framework.apollo.common.dto.NamespaceDTO; import com.ctrip.framework.apollo.common.entity.AppNamespace; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.common.http.MultiResponseEntity; import com.ctrip.framework.apollo.common.http.RichResponseEntity; import com.ctrip.framework.apollo.common.utils.BeanUtils; import com.ctrip.framework.apollo.common.utils.InputValidator; import com.ctrip.framework.apollo.common.utils.RequestPrecondition; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.component.PermissionValidator; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.entity.bo.NamespaceBO; import com.ctrip.framework.apollo.portal.entity.model.NamespaceCreationModel; import com.ctrip.framework.apollo.portal.listener.AppNamespaceCreationEvent; import com.ctrip.framework.apollo.portal.listener.AppNamespaceDeletionEvent; import com.ctrip.framework.apollo.portal.service.AppNamespaceService; import com.ctrip.framework.apollo.portal.service.NamespaceService; import com.ctrip.framework.apollo.portal.service.RoleInitializationService; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.ctrip.framework.apollo.tracer.Tracer; import com.google.common.collect.Sets; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationEventPublisher; import org.springframework.http.ResponseEntity; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.validation.Valid; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import static com.ctrip.framework.apollo.common.utils.RequestPrecondition.checkModel; @RestController public class NamespaceController { private static final Logger logger = LoggerFactory.getLogger(NamespaceController.class); private final ApplicationEventPublisher publisher; private final UserInfoHolder userInfoHolder; private final NamespaceService namespaceService; private final AppNamespaceService appNamespaceService; private final RoleInitializationService roleInitializationService; private final PortalConfig portalConfig; private final PermissionValidator permissionValidator; private final AdminServiceAPI.NamespaceAPI namespaceAPI; public NamespaceController( final ApplicationEventPublisher publisher, final UserInfoHolder userInfoHolder, final NamespaceService namespaceService, final AppNamespaceService appNamespaceService, final RoleInitializationService roleInitializationService, final PortalConfig portalConfig, final PermissionValidator permissionValidator, final AdminServiceAPI.NamespaceAPI namespaceAPI) { this.publisher = publisher; this.userInfoHolder = userInfoHolder; this.namespaceService = namespaceService; this.appNamespaceService = appNamespaceService; this.roleInitializationService = roleInitializationService; this.portalConfig = portalConfig; this.permissionValidator = permissionValidator; this.namespaceAPI = namespaceAPI; } @GetMapping("/appnamespaces/public") public List<AppNamespace> findPublicAppNamespaces() { return appNamespaceService.findPublicAppNamespaces(); } @GetMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces") public List<NamespaceBO> findNamespaces(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName) { List<NamespaceBO> namespaceBOs = namespaceService.findNamespaceBOs(appId, Env.valueOf(env), clusterName); for (NamespaceBO namespaceBO : namespaceBOs) { if (permissionValidator.shouldHideConfigToCurrentUser(appId, env, namespaceBO.getBaseInfo().getNamespaceName())) { namespaceBO.hideItems(); } } return namespaceBOs; } @GetMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName:.+}") public NamespaceBO findNamespace(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName) { NamespaceBO namespaceBO = namespaceService.loadNamespaceBO(appId, Env.valueOf(env), clusterName, namespaceName); if (namespaceBO != null && permissionValidator.shouldHideConfigToCurrentUser(appId, env, namespaceName)) { namespaceBO.hideItems(); } return namespaceBO; } @GetMapping("/envs/{env}/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/associated-public-namespace") public NamespaceBO findPublicNamespaceForAssociatedNamespace(@PathVariable String env, @PathVariable String appId, @PathVariable String namespaceName, @PathVariable String clusterName) { return namespaceService.findPublicNamespaceForAssociatedNamespace(Env.valueOf(env), appId, clusterName, namespaceName); } @PreAuthorize(value = "@permissionValidator.hasCreateNamespacePermission(#appId)") @PostMapping("/apps/{appId}/namespaces") public ResponseEntity<Void> createNamespace(@PathVariable String appId, @RequestBody List<NamespaceCreationModel> models) { checkModel(!CollectionUtils.isEmpty(models)); String namespaceName = models.get(0).getNamespace().getNamespaceName(); String operator = userInfoHolder.getUser().getUserId(); roleInitializationService.initNamespaceRoles(appId, namespaceName, operator); roleInitializationService.initNamespaceEnvRoles(appId, namespaceName, operator); for (NamespaceCreationModel model : models) { NamespaceDTO namespace = model.getNamespace(); RequestPrecondition.checkArgumentsNotEmpty(model.getEnv(), namespace.getAppId(), namespace.getClusterName(), namespace.getNamespaceName()); try { namespaceService.createNamespace(Env.valueOf(model.getEnv()), namespace); } catch (Exception e) { logger.error("create namespace fail.", e); Tracer.logError( String.format("create namespace fail. (env=%s namespace=%s)", model.getEnv(), namespace.getNamespaceName()), e); } } namespaceService.assignNamespaceRoleToOperator(appId, namespaceName,userInfoHolder.getUser().getUserId()); return ResponseEntity.ok().build(); } @PreAuthorize(value = "@permissionValidator.hasDeleteNamespacePermission(#appId)") @DeleteMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName:.+}") public ResponseEntity<Void> deleteNamespace(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName) { namespaceService.deleteNamespace(appId, Env.valueOf(env), clusterName, namespaceName); return ResponseEntity.ok().build(); } @PreAuthorize(value = "@permissionValidator.isSuperAdmin()") @DeleteMapping("/apps/{appId}/appnamespaces/{namespaceName:.+}") public ResponseEntity<Void> deleteAppNamespace(@PathVariable String appId, @PathVariable String namespaceName) { AppNamespace appNamespace = appNamespaceService.deleteAppNamespace(appId, namespaceName); publisher.publishEvent(new AppNamespaceDeletionEvent(appNamespace)); return ResponseEntity.ok().build(); } @GetMapping("/apps/{appId}/appnamespaces/{namespaceName:.+}") public AppNamespaceDTO findAppNamespace(@PathVariable String appId, @PathVariable String namespaceName) { AppNamespace appNamespace = appNamespaceService.findByAppIdAndName(appId, namespaceName); if (appNamespace == null) { throw new BadRequestException( String.format("AppNamespace not exists. AppId = %s, NamespaceName = %s", appId, namespaceName)); } return BeanUtils.transform(AppNamespaceDTO.class, appNamespace); } @PreAuthorize(value = "@permissionValidator.hasCreateAppNamespacePermission(#appId, #appNamespace)") @PostMapping("/apps/{appId}/appnamespaces") public AppNamespace createAppNamespace(@PathVariable String appId, @RequestParam(defaultValue = "true") boolean appendNamespacePrefix, @Valid @RequestBody AppNamespace appNamespace) { if (!InputValidator.isValidAppNamespace(appNamespace.getName())) { throw new BadRequestException(String.format("Invalid Namespace format: %s", InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE + " & " + InputValidator.INVALID_NAMESPACE_NAMESPACE_MESSAGE)); } AppNamespace createdAppNamespace = appNamespaceService.createAppNamespaceInLocal(appNamespace, appendNamespacePrefix); if (portalConfig.canAppAdminCreatePrivateNamespace() || createdAppNamespace.isPublic()) { namespaceService.assignNamespaceRoleToOperator(appId, appNamespace.getName(), userInfoHolder.getUser().getUserId()); } publisher.publishEvent(new AppNamespaceCreationEvent(createdAppNamespace)); return createdAppNamespace; } /** * env -> cluster -> cluster has not published namespace? * Example: * dev -> * default -> true (default cluster has not published namespace) * customCluster -> false (customCluster cluster's all namespaces had published) */ @GetMapping("/apps/{appId}/namespaces/publish_info") public Map<String, Map<String, Boolean>> getNamespacesPublishInfo(@PathVariable String appId) { return namespaceService.getNamespacesPublishInfo(appId); } @GetMapping("/envs/{env}/appnamespaces/{publicNamespaceName}/namespaces") public List<NamespaceDTO> getPublicAppNamespaceAllNamespaces(@PathVariable String env, @PathVariable String publicNamespaceName, @RequestParam(name = "page", defaultValue = "0") int page, @RequestParam(name = "size", defaultValue = "10") int size) { return namespaceService.getPublicAppNamespaceAllNamespaces(Env.valueOf(env), publicNamespaceName, page, size); } @GetMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/missing-namespaces") public MultiResponseEntity<String> findMissingNamespaces(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName) { MultiResponseEntity<String> response = MultiResponseEntity.ok(); Set<String> missingNamespaces = findMissingNamespaceNames(appId, env, clusterName); for (String missingNamespace : missingNamespaces) { response.addResponseEntity(RichResponseEntity.ok(missingNamespace)); } return response; } @PostMapping("/apps/{appId}/envs/{env}/clusters/{clusterName}/missing-namespaces") public ResponseEntity<Void> createMissingNamespaces(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName) { Set<String> missingNamespaces = findMissingNamespaceNames(appId, env, clusterName); for (String missingNamespace : missingNamespaces) { namespaceAPI.createMissingAppNamespace(Env.valueOf(env), findAppNamespace(appId, missingNamespace)); } return ResponseEntity.ok().build(); } private Set<String> findMissingNamespaceNames(String appId, String env, String clusterName) { List<AppNamespaceDTO> configDbAppNamespaces = namespaceAPI.getAppNamespaces(appId, Env.valueOf(env)); List<NamespaceDTO> configDbNamespaces = namespaceService.findNamespaces(appId, Env.valueOf(env), clusterName); List<AppNamespace> portalDbAppNamespaces = appNamespaceService.findByAppId(appId); Set<String> configDbAppNamespaceNames = configDbAppNamespaces.stream().map(AppNamespaceDTO::getName) .collect(Collectors.toSet()); Set<String> configDbNamespaceNames = configDbNamespaces.stream().map(NamespaceDTO::getNamespaceName) .collect(Collectors.toSet()); Set<String> portalDbAllAppNamespaceNames = Sets.newHashSet(); Set<String> portalDbPrivateAppNamespaceNames = Sets.newHashSet(); for (AppNamespace appNamespace : portalDbAppNamespaces) { portalDbAllAppNamespaceNames.add(appNamespace.getName()); if (!appNamespace.isPublic()) { portalDbPrivateAppNamespaceNames.add(appNamespace.getName()); } } // AppNamespaces should be the same Set<String> missingAppNamespaceNames = Sets.difference(portalDbAllAppNamespaceNames, configDbAppNamespaceNames); // Private namespaces should all exist Set<String> missingNamespaceNames = Sets.difference(portalDbPrivateAppNamespaceNames, configDbNamespaceNames); return Sets.union(missingAppNamespaceNames, missingNamespaceNames); } }
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/AccessKeyServiceTest.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.biz.service; import static org.junit.Assert.assertNotNull; import com.ctrip.framework.apollo.biz.AbstractIntegrationTest; import com.ctrip.framework.apollo.biz.entity.AccessKey; import com.ctrip.framework.apollo.common.exception.BadRequestException; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; /** * @author nisiyong */ public class AccessKeyServiceTest extends AbstractIntegrationTest { @Autowired private AccessKeyService accessKeyService; @Test public void testCreate() { String appId = "someAppId"; String secret = "someSecret"; AccessKey entity = assembleAccessKey(appId, secret); AccessKey accessKey = accessKeyService.create(appId, entity); assertNotNull(accessKey); } @Test(expected = BadRequestException.class) public void testCreateWithException() { String appId = "someAppId"; String secret = "someSecret"; int maxCount = 5; for (int i = 0; i <= maxCount; i++) { AccessKey entity = assembleAccessKey(appId, secret); accessKeyService.create(appId, entity); } } private AccessKey assembleAccessKey(String appId, String secret) { AccessKey accessKey = new AccessKey(); accessKey.setAppId(appId); accessKey.setSecret(secret); return accessKey; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.biz.service; import static org.junit.Assert.assertNotNull; import com.ctrip.framework.apollo.biz.AbstractIntegrationTest; import com.ctrip.framework.apollo.biz.entity.AccessKey; import com.ctrip.framework.apollo.common.exception.BadRequestException; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; /** * @author nisiyong */ public class AccessKeyServiceTest extends AbstractIntegrationTest { @Autowired private AccessKeyService accessKeyService; @Test public void testCreate() { String appId = "someAppId"; String secret = "someSecret"; AccessKey entity = assembleAccessKey(appId, secret); AccessKey accessKey = accessKeyService.create(appId, entity); assertNotNull(accessKey); } @Test(expected = BadRequestException.class) public void testCreateWithException() { String appId = "someAppId"; String secret = "someSecret"; int maxCount = 5; for (int i = 0; i <= maxCount; i++) { AccessKey entity = assembleAccessKey(appId, secret); accessKeyService.create(appId, entity); } } private AccessKey assembleAccessKey(String appId, String secret) { AccessKey accessKey = new AccessKey(); accessKey.setAppId(appId); accessKey.setSecret(secret); return accessKey; } }
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-openapi/src/test/java/com/ctrip/framework/apollo/openapi/client/service/ClusterOpenApiServiceTest.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.openapi.client.service; import static org.junit.Assert.*; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.ctrip.framework.apollo.openapi.dto.OpenClusterDTO; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.util.EntityUtils; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; public class ClusterOpenApiServiceTest extends AbstractOpenApiServiceTest { private ClusterOpenApiService clusterOpenApiService; private String someAppId; private String someEnv; @Before public void setUp() throws Exception { super.setUp(); someAppId = "someAppId"; someEnv = "someEnv"; StringEntity responseEntity = new StringEntity("{}"); when(someHttpResponse.getEntity()).thenReturn(responseEntity); clusterOpenApiService = new ClusterOpenApiService(httpClient, someBaseUrl, gson); } @Test public void testGetCluster() throws Exception { String someCluster = "someCluster"; final ArgumentCaptor<HttpGet> request = ArgumentCaptor.forClass(HttpGet.class); clusterOpenApiService.getCluster(someAppId, someEnv, someCluster); verify(httpClient, times(1)).execute(request.capture()); HttpGet get = request.getValue(); assertEquals(String .format("%s/envs/%s/apps/%s/clusters/%s", someBaseUrl, someEnv, someAppId, someCluster), get.getURI().toString()); } @Test(expected = RuntimeException.class) public void testGetClusterWithError() throws Exception { String someCluster = "someCluster"; when(statusLine.getStatusCode()).thenReturn(404); clusterOpenApiService.getCluster(someAppId, someEnv, someCluster); } @Test public void testCreateCluster() throws Exception { String someCluster = "someCluster"; String someCreatedBy = "someCreatedBy"; OpenClusterDTO clusterDTO = new OpenClusterDTO(); clusterDTO.setAppId(someAppId); clusterDTO.setName(someCluster); clusterDTO.setDataChangeCreatedBy(someCreatedBy); final ArgumentCaptor<HttpPost> request = ArgumentCaptor.forClass(HttpPost.class); clusterOpenApiService.createCluster(someEnv, clusterDTO); verify(httpClient, times(1)).execute(request.capture()); HttpPost post = request.getValue(); assertEquals(String .format("%s/envs/%s/apps/%s/clusters", someBaseUrl, someEnv, someAppId), post.getURI().toString()); StringEntity entity = (StringEntity) post.getEntity(); assertEquals(ContentType.APPLICATION_JSON.toString(), entity.getContentType().getValue()); assertEquals(gson.toJson(clusterDTO), EntityUtils.toString(entity)); } @Test(expected = RuntimeException.class) public void testCreateClusterWithError() throws Exception { String someCluster = "someCluster"; String someCreatedBy = "someCreatedBy"; OpenClusterDTO clusterDTO = new OpenClusterDTO(); clusterDTO.setAppId(someAppId); clusterDTO.setName(someCluster); clusterDTO.setDataChangeCreatedBy(someCreatedBy); when(statusLine.getStatusCode()).thenReturn(400); clusterOpenApiService.createCluster(someEnv, clusterDTO); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.openapi.client.service; import static org.junit.Assert.*; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.ctrip.framework.apollo.openapi.dto.OpenClusterDTO; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.util.EntityUtils; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; public class ClusterOpenApiServiceTest extends AbstractOpenApiServiceTest { private ClusterOpenApiService clusterOpenApiService; private String someAppId; private String someEnv; @Before public void setUp() throws Exception { super.setUp(); someAppId = "someAppId"; someEnv = "someEnv"; StringEntity responseEntity = new StringEntity("{}"); when(someHttpResponse.getEntity()).thenReturn(responseEntity); clusterOpenApiService = new ClusterOpenApiService(httpClient, someBaseUrl, gson); } @Test public void testGetCluster() throws Exception { String someCluster = "someCluster"; final ArgumentCaptor<HttpGet> request = ArgumentCaptor.forClass(HttpGet.class); clusterOpenApiService.getCluster(someAppId, someEnv, someCluster); verify(httpClient, times(1)).execute(request.capture()); HttpGet get = request.getValue(); assertEquals(String .format("%s/envs/%s/apps/%s/clusters/%s", someBaseUrl, someEnv, someAppId, someCluster), get.getURI().toString()); } @Test(expected = RuntimeException.class) public void testGetClusterWithError() throws Exception { String someCluster = "someCluster"; when(statusLine.getStatusCode()).thenReturn(404); clusterOpenApiService.getCluster(someAppId, someEnv, someCluster); } @Test public void testCreateCluster() throws Exception { String someCluster = "someCluster"; String someCreatedBy = "someCreatedBy"; OpenClusterDTO clusterDTO = new OpenClusterDTO(); clusterDTO.setAppId(someAppId); clusterDTO.setName(someCluster); clusterDTO.setDataChangeCreatedBy(someCreatedBy); final ArgumentCaptor<HttpPost> request = ArgumentCaptor.forClass(HttpPost.class); clusterOpenApiService.createCluster(someEnv, clusterDTO); verify(httpClient, times(1)).execute(request.capture()); HttpPost post = request.getValue(); assertEquals(String .format("%s/envs/%s/apps/%s/clusters", someBaseUrl, someEnv, someAppId), post.getURI().toString()); StringEntity entity = (StringEntity) post.getEntity(); assertEquals(ContentType.APPLICATION_JSON.toString(), entity.getContentType().getValue()); assertEquals(gson.toJson(clusterDTO), EntityUtils.toString(entity)); } @Test(expected = RuntimeException.class) public void testCreateClusterWithError() throws Exception { String someCluster = "someCluster"; String someCreatedBy = "someCreatedBy"; OpenClusterDTO clusterDTO = new OpenClusterDTO(); clusterDTO.setAppId(someAppId); clusterDTO.setName(someCluster); clusterDTO.setDataChangeCreatedBy(someCreatedBy); when(statusLine.getStatusCode()).thenReturn(400); clusterOpenApiService.createCluster(someEnv, clusterDTO); } }
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-assembly/src/test/java/com/ctrip/framework/apollo/assembly/LocalApolloApplication.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.assembly; import com.ctrip.framework.apollo.adminservice.AdminServiceApplication; import com.ctrip.framework.apollo.configservice.ConfigServiceApplication; import com.ctrip.framework.apollo.portal.PortalApplication; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.WebApplicationType; 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; @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) public class LocalApolloApplication { 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(WebApplicationType.NONE).run(args); 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()); } } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.assembly; import com.ctrip.framework.apollo.adminservice.AdminServiceApplication; import com.ctrip.framework.apollo.configservice.ConfigServiceApplication; import com.ctrip.framework.apollo.portal.PortalApplication; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.WebApplicationType; 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; @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) public class LocalApolloApplication { 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(WebApplicationType.NONE).run(args); 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()); } } }
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./scripts/apollo-on-kubernetes/apollo-admin-server/config/app.properties
# # Copyright 2021 Apollo Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # appId=100003172 jdkVersion=1.8
# # Copyright 2021 Apollo Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # appId=100003172 jdkVersion=1.8
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/src/main/resources/META-INF/services/com.ctrip.framework.apollo.spring.spi.ConfigPropertySourcesProcessorHelper
com.ctrip.framework.apollo.spring.spi.DefaultConfigPropertySourcesProcessorHelper
com.ctrip.framework.apollo.spring.spi.DefaultConfigPropertySourcesProcessorHelper
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-core/src/test/java/com/ctrip/framework/apollo/tracer/internals/MockMessageProducerManager.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.tracer.internals; import com.ctrip.framework.apollo.tracer.spi.MessageProducer; import com.ctrip.framework.apollo.tracer.spi.MessageProducerManager; /** * @author Jason Song(song_s@ctrip.com) */ public class MockMessageProducerManager implements MessageProducerManager { private static MessageProducer s_producer; @Override public MessageProducer getProducer() { return s_producer; } public static void setProducer(MessageProducer producer) { s_producer = producer; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.tracer.internals; import com.ctrip.framework.apollo.tracer.spi.MessageProducer; import com.ctrip.framework.apollo.tracer.spi.MessageProducerManager; /** * @author Jason Song(song_s@ctrip.com) */ public class MockMessageProducerManager implements MessageProducerManager { private static MessageProducer s_producer; @Override public MessageProducer getProducer() { return s_producer; } public static void setProducer(MessageProducer producer) { s_producer = producer; } }
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./scripts/apollo-on-kubernetes/kubernetes/apollo-env-dev/service-apollo-admin-server-dev.yaml
# # Copyright 2021 Apollo Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # --- # configmap for apollo-admin-server-dev kind: ConfigMap apiVersion: v1 metadata: namespace: sre name: configmap-apollo-admin-server-dev data: application-github.properties: | spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-dev-env.sre:3306/DevApolloConfigDB?characterEncoding=utf8 spring.datasource.username = FillInCorrectUser spring.datasource.password = FillInCorrectPassword eureka.service.url = http://statefulset-apollo-config-server-dev-0.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-1.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-2.service-apollo-meta-server-dev:8080/eureka/ --- kind: Service apiVersion: v1 metadata: namespace: sre name: service-apollo-admin-server-dev labels: app: service-apollo-admin-server-dev spec: ports: - protocol: TCP port: 8090 targetPort: 8090 selector: app: pod-apollo-admin-server-dev type: ClusterIP sessionAffinity: ClientIP --- kind: Deployment apiVersion: apps/v1 metadata: namespace: sre name: deployment-apollo-admin-server-dev labels: app: deployment-apollo-admin-server-dev spec: replicas: 3 selector: matchLabels: app: pod-apollo-admin-server-dev strategy: rollingUpdate: maxSurge: 1 maxUnavailable: 1 type: RollingUpdate template: metadata: labels: app: pod-apollo-admin-server-dev spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: app operator: In values: - pod-apollo-admin-server-dev topologyKey: kubernetes.io/hostname volumes: - name: volume-configmap-apollo-admin-server-dev configMap: name: configmap-apollo-admin-server-dev items: - key: application-github.properties path: application-github.properties initContainers: - image: alpine-bash:3.8 name: check-service-apollo-config-server-dev command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-config-server-dev.sre:8080"] containers: - image: apollo-admin-server:v1.0.0 securityContext: privileged: true imagePullPolicy: IfNotPresent name: container-apollo-admin-server-dev ports: - protocol: TCP containerPort: 8090 volumeMounts: - name: volume-configmap-apollo-admin-server-dev mountPath: /apollo-admin-server/config/application-github.properties subPath: application-github.properties env: - name: APOLLO_ADMIN_SERVICE_NAME value: "service-apollo-admin-server-dev.sre" readinessProbe: tcpSocket: port: 8090 initialDelaySeconds: 10 periodSeconds: 5 livenessProbe: tcpSocket: port: 8090 initialDelaySeconds: 120 periodSeconds: 10 dnsPolicy: ClusterFirst restartPolicy: Always
# # Copyright 2021 Apollo Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # --- # configmap for apollo-admin-server-dev kind: ConfigMap apiVersion: v1 metadata: namespace: sre name: configmap-apollo-admin-server-dev data: application-github.properties: | spring.datasource.url = jdbc:mysql://service-mysql-for-apollo-dev-env.sre:3306/DevApolloConfigDB?characterEncoding=utf8 spring.datasource.username = FillInCorrectUser spring.datasource.password = FillInCorrectPassword eureka.service.url = http://statefulset-apollo-config-server-dev-0.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-1.service-apollo-meta-server-dev:8080/eureka/,http://statefulset-apollo-config-server-dev-2.service-apollo-meta-server-dev:8080/eureka/ --- kind: Service apiVersion: v1 metadata: namespace: sre name: service-apollo-admin-server-dev labels: app: service-apollo-admin-server-dev spec: ports: - protocol: TCP port: 8090 targetPort: 8090 selector: app: pod-apollo-admin-server-dev type: ClusterIP sessionAffinity: ClientIP --- kind: Deployment apiVersion: apps/v1 metadata: namespace: sre name: deployment-apollo-admin-server-dev labels: app: deployment-apollo-admin-server-dev spec: replicas: 3 selector: matchLabels: app: pod-apollo-admin-server-dev strategy: rollingUpdate: maxSurge: 1 maxUnavailable: 1 type: RollingUpdate template: metadata: labels: app: pod-apollo-admin-server-dev spec: affinity: podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: app operator: In values: - pod-apollo-admin-server-dev topologyKey: kubernetes.io/hostname volumes: - name: volume-configmap-apollo-admin-server-dev configMap: name: configmap-apollo-admin-server-dev items: - key: application-github.properties path: application-github.properties initContainers: - image: alpine-bash:3.8 name: check-service-apollo-config-server-dev command: ['bash', '-c', "curl --connect-timeout 2 --max-time 5 --retry 60 --retry-delay 1 --retry-max-time 120 service-apollo-config-server-dev.sre:8080"] containers: - image: apollo-admin-server:v1.0.0 securityContext: privileged: true imagePullPolicy: IfNotPresent name: container-apollo-admin-server-dev ports: - protocol: TCP containerPort: 8090 volumeMounts: - name: volume-configmap-apollo-admin-server-dev mountPath: /apollo-admin-server/config/application-github.properties subPath: application-github.properties env: - name: APOLLO_ADMIN_SERVICE_NAME value: "service-apollo-admin-server-dev.sre" readinessProbe: tcpSocket: port: 8090 initialDelaySeconds: 10 periodSeconds: 5 livenessProbe: tcpSocket: port: 8090 initialDelaySeconds: 120 periodSeconds: 10 dnsPolicy: ClusterFirst restartPolicy: Always
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-common/src/main/java/com/ctrip/framework/apollo/common/condition/OnProfileCondition.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.common.condition; import com.google.common.collect.Sets; import org.springframework.context.annotation.Condition; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; import org.springframework.util.MultiValueMap; import java.util.Collections; import java.util.List; import java.util.Set; /** * @author Jason Song(song_s@ctrip.com) */ public class OnProfileCondition implements Condition { @Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { Set<String> activeProfiles = Sets.newHashSet(context.getEnvironment().getActiveProfiles()); Set<String> requiredActiveProfiles = retrieveAnnotatedProfiles(metadata, ConditionalOnProfile.class.getName()); Set<String> requiredInactiveProfiles = retrieveAnnotatedProfiles(metadata, ConditionalOnMissingProfile.class .getName()); return Sets.difference(requiredActiveProfiles, activeProfiles).isEmpty() && Sets.intersection(requiredInactiveProfiles, activeProfiles).isEmpty(); } private Set<String> retrieveAnnotatedProfiles(AnnotatedTypeMetadata metadata, String annotationType) { if (!metadata.isAnnotated(annotationType)) { return Collections.emptySet(); } MultiValueMap<String, Object> attributes = metadata.getAllAnnotationAttributes(annotationType); if (attributes == null) { return Collections.emptySet(); } Set<String> profiles = Sets.newHashSet(); List<?> values = attributes.get("value"); if (values != null) { for (Object value : values) { if (value instanceof String[]) { Collections.addAll(profiles, (String[]) value); } else { profiles.add((String) value); } } } return profiles; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.common.condition; import com.google.common.collect.Sets; import org.springframework.context.annotation.Condition; import org.springframework.context.annotation.ConditionContext; import org.springframework.core.type.AnnotatedTypeMetadata; import org.springframework.util.MultiValueMap; import java.util.Collections; import java.util.List; import java.util.Set; /** * @author Jason Song(song_s@ctrip.com) */ public class OnProfileCondition implements Condition { @Override public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { Set<String> activeProfiles = Sets.newHashSet(context.getEnvironment().getActiveProfiles()); Set<String> requiredActiveProfiles = retrieveAnnotatedProfiles(metadata, ConditionalOnProfile.class.getName()); Set<String> requiredInactiveProfiles = retrieveAnnotatedProfiles(metadata, ConditionalOnMissingProfile.class .getName()); return Sets.difference(requiredActiveProfiles, activeProfiles).isEmpty() && Sets.intersection(requiredInactiveProfiles, activeProfiles).isEmpty(); } private Set<String> retrieveAnnotatedProfiles(AnnotatedTypeMetadata metadata, String annotationType) { if (!metadata.isAnnotated(annotationType)) { return Collections.emptySet(); } MultiValueMap<String, Object> attributes = metadata.getAllAnnotationAttributes(annotationType); if (attributes == null) { return Collections.emptySet(); } Set<String> profiles = Sets.newHashSet(); List<?> values = attributes.get("value"); if (values != null) { for (Object value : values) { if (value instanceof String[]) { Collections.addAll(profiles, (String[]) value); } else { profiles.add((String) value); } } } return profiles; } }
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-client/pom.xml
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <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.framework.apollo</groupId> <artifactId>apollo</artifactId> <version>${revision}</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>apollo-client</artifactId> <name>Apollo Client</name> <properties> <java.version>1.7</java.version> <github.path>${project.artifactId}</github.path> </properties> <dependencyManagement> <dependencies> <!-- Spring Boot 2 requires Java 8, so we need to manually stick to 1.5.x version in order to compile apollo-client against Java 7 --> <!-- This is only for apollo-client compilation use, because optional Spring dependencies are not transitive --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>1.5.16.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- apollo --> <dependency> <groupId>com.ctrip.framework.apollo</groupId> <artifactId>apollo-core</artifactId> </dependency> <!-- end of apollo --> <!-- guice --> <dependency> <groupId>com.google.inject</groupId> <artifactId>guice</artifactId> </dependency> <!-- end of guice --> <!-- log --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> <!-- yml processing --> <dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> </dependency> <!-- end of yml processing --> <!-- optional spring dependency --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <optional>true</optional> </dependency> <!-- optional spring boot dependency --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-autoconfigure</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> <!-- test --> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> <scope>test</scope> </dependency> <!-- take over jcl --> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <scope>test</scope> </dependency> <!-- end of test --> </dependencies> </project>
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2021 Apollo Authors ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. ~ --> <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.framework.apollo</groupId> <artifactId>apollo</artifactId> <version>${revision}</version> <relativePath>../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>apollo-client</artifactId> <name>Apollo Client</name> <properties> <java.version>1.7</java.version> <github.path>${project.artifactId}</github.path> </properties> <dependencyManagement> <dependencies> <!-- Spring Boot 2 requires Java 8, so we need to manually stick to 1.5.x version in order to compile apollo-client against Java 7 --> <!-- This is only for apollo-client compilation use, because optional Spring dependencies are not transitive --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>1.5.16.RELEASE</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- apollo --> <dependency> <groupId>com.ctrip.framework.apollo</groupId> <artifactId>apollo-core</artifactId> </dependency> <!-- end of apollo --> <!-- guice --> <dependency> <groupId>com.google.inject</groupId> <artifactId>guice</artifactId> </dependency> <!-- end of guice --> <!-- log --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> </dependency> <!-- yml processing --> <dependency> <groupId>org.yaml</groupId> <artifactId>snakeyaml</artifactId> </dependency> <!-- end of yml processing --> <!-- optional spring dependency --> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <optional>true</optional> </dependency> <!-- optional spring boot dependency --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-autoconfigure</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-configuration-processor</artifactId> <optional>true</optional> </dependency> <!-- test --> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> <scope>test</scope> </dependency> <!-- take over jcl --> <dependency> <groupId>org.slf4j</groupId> <artifactId>jcl-over-slf4j</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <scope>test</scope> </dependency> <!-- end of test --> </dependencies> </project>
-1
apolloconfig/apollo
3,713
add apollo team introduction and community releated contents
## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
nobodyiam
2021-05-26T10:05:24Z
2021-05-28T05:38:22Z
4e1a5c13d784c5d80ba3b36b6ce169bd3f547e0e
b4893914af3a6a3754c2d5685ae2ec9fb23119c2
add apollo team introduction and community releated contents. ## What's the purpose of this PR add apollo team introduction and community releated contents Reference issues: #3684 #3705 #3706 #3707 #3708 #3709 ## Brief changelog 1. add team introduction page 2. add links to community governance Follow this checklist to help us incorporate your contribution quickly and easily: - [x] Read the [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md) before making this pull request. - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why. - [x] Write necessary unit tests to verify the code. - [x] Run `mvn clean test` to make sure this pull request doesn't break anything.
./apollo-core/src/test/java/com/ctrip/framework/apollo/core/utils/NetUtilTest.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.core.utils; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import com.ctrip.framework.apollo.BaseIntegrationTest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.handler.ContextHandler; import org.junit.Test; /** * Created by gl49 on 2018/6/8. */ public class NetUtilTest extends BaseIntegrationTest { @Test public void testPingUrlWithStatusCode200() throws Exception { String someResponse = "some response"; ContextHandler handler = mockServerHandler(HttpServletResponse.SC_OK, someResponse); startServerWithHandlers(handler); assertTrue(NetUtil.pingUrl("http://localhost:" + PORT)); } @Test public void testPingUrlWithStatusCode404() throws Exception { String someResponse = "some response"; startServerWithHandlers(mockServerHandler(HttpServletResponse.SC_NOT_FOUND, someResponse)); assertFalse(NetUtil.pingUrl("http://localhost:" + PORT)); } @Test public void testPingUrlWithServerNotStarted() throws Exception { assertFalse(NetUtil.pingUrl("http://localhost:" + PORT)); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.core.utils; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import com.ctrip.framework.apollo.BaseIntegrationTest; import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.handler.ContextHandler; import org.junit.Test; /** * Created by gl49 on 2018/6/8. */ public class NetUtilTest extends BaseIntegrationTest { @Test public void testPingUrlWithStatusCode200() throws Exception { String someResponse = "some response"; ContextHandler handler = mockServerHandler(HttpServletResponse.SC_OK, someResponse); startServerWithHandlers(handler); assertTrue(NetUtil.pingUrl("http://localhost:" + PORT)); } @Test public void testPingUrlWithStatusCode404() throws Exception { String someResponse = "some response"; startServerWithHandlers(mockServerHandler(HttpServletResponse.SC_NOT_FOUND, someResponse)); assertFalse(NetUtil.pingUrl("http://localhost:" + PORT)); } @Test public void testPingUrlWithServerNotStarted() throws Exception { assertFalse(NetUtil.pingUrl("http://localhost:" + PORT)); } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-client/src/main/java/com/ctrip/framework/apollo/internals/LocalFileConfigRepository.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.internals; import com.ctrip.framework.apollo.enums.ConfigSourceType; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Properties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ctrip.framework.apollo.build.ApolloInjector; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.utils.ClassLoaderUtil; import com.ctrip.framework.apollo.exceptions.ApolloConfigException; import com.ctrip.framework.apollo.tracer.Tracer; import com.ctrip.framework.apollo.tracer.spi.Transaction; import com.ctrip.framework.apollo.util.ConfigUtil; import com.ctrip.framework.apollo.util.ExceptionUtil; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; /** * @author Jason Song(song_s@ctrip.com) */ public class LocalFileConfigRepository extends AbstractConfigRepository implements RepositoryChangeListener { private static final Logger logger = LoggerFactory.getLogger(LocalFileConfigRepository.class); private static final String CONFIG_DIR = "/config-cache"; private final String m_namespace; private File m_baseDir; private final ConfigUtil m_configUtil; private volatile Properties m_fileProperties; private volatile ConfigRepository m_upstream; private volatile ConfigSourceType m_sourceType = ConfigSourceType.LOCAL; /** * Constructor. * * @param namespace the namespace */ public LocalFileConfigRepository(String namespace) { this(namespace, null); } public LocalFileConfigRepository(String namespace, ConfigRepository upstream) { m_namespace = namespace; m_configUtil = ApolloInjector.getInstance(ConfigUtil.class); this.setLocalCacheDir(findLocalCacheDir(), false); this.setUpstreamRepository(upstream); this.trySync(); } void setLocalCacheDir(File baseDir, boolean syncImmediately) { m_baseDir = baseDir; this.checkLocalConfigCacheDir(m_baseDir); if (syncImmediately) { this.trySync(); } } private File findLocalCacheDir() { try { String defaultCacheDir = m_configUtil.getDefaultLocalCacheDir(); Path path = Paths.get(defaultCacheDir); if (!Files.exists(path)) { Files.createDirectories(path); } if (Files.exists(path) && Files.isWritable(path)) { return new File(defaultCacheDir, CONFIG_DIR); } } catch (Throwable ex) { //ignore } return new File(ClassLoaderUtil.getClassPath(), CONFIG_DIR); } @Override public Properties getConfig() { if (m_fileProperties == null) { sync(); } Properties result = propertiesFactory.getPropertiesInstance(); result.putAll(m_fileProperties); return result; } @Override public void setUpstreamRepository(ConfigRepository upstreamConfigRepository) { if (upstreamConfigRepository == null) { return; } //clear previous listener if (m_upstream != null) { m_upstream.removeChangeListener(this); } m_upstream = upstreamConfigRepository; trySyncFromUpstream(); upstreamConfigRepository.addChangeListener(this); } @Override public ConfigSourceType getSourceType() { return m_sourceType; } @Override public void onRepositoryChange(String namespace, Properties newProperties) { if (newProperties.equals(m_fileProperties)) { return; } Properties newFileProperties = propertiesFactory.getPropertiesInstance(); newFileProperties.putAll(newProperties); updateFileProperties(newFileProperties, m_upstream.getSourceType()); this.fireRepositoryChange(namespace, newProperties); } @Override protected void sync() { //sync with upstream immediately boolean syncFromUpstreamResultSuccess = trySyncFromUpstream(); if (syncFromUpstreamResultSuccess) { return; } Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "syncLocalConfig"); Throwable exception = null; try { transaction.addData("Basedir", m_baseDir.getAbsolutePath()); m_fileProperties = this.loadFromLocalCacheFile(m_baseDir, m_namespace); m_sourceType = ConfigSourceType.LOCAL; transaction.setStatus(Transaction.SUCCESS); } catch (Throwable ex) { Tracer.logEvent("ApolloConfigException", ExceptionUtil.getDetailMessage(ex)); transaction.setStatus(ex); exception = ex; //ignore } finally { transaction.complete(); } if (m_fileProperties == null) { m_sourceType = ConfigSourceType.NONE; throw new ApolloConfigException( "Load config from local config failed!", exception); } } private boolean trySyncFromUpstream() { if (m_upstream == null) { return false; } try { updateFileProperties(m_upstream.getConfig(), m_upstream.getSourceType()); return true; } catch (Throwable ex) { Tracer.logError(ex); logger .warn("Sync config from upstream repository {} failed, reason: {}", m_upstream.getClass(), ExceptionUtil.getDetailMessage(ex)); } return false; } private synchronized void updateFileProperties(Properties newProperties, ConfigSourceType sourceType) { this.m_sourceType = sourceType; if (newProperties.equals(m_fileProperties)) { return; } this.m_fileProperties = newProperties; persistLocalCacheFile(m_baseDir, m_namespace); } private Properties loadFromLocalCacheFile(File baseDir, String namespace) throws IOException { Preconditions.checkNotNull(baseDir, "Basedir cannot be null"); File file = assembleLocalCacheFile(baseDir, namespace); Properties properties = null; if (file.isFile() && file.canRead()) { InputStream in = null; try { in = new FileInputStream(file); properties = propertiesFactory.getPropertiesInstance(); properties.load(in); logger.debug("Loading local config file {} successfully!", file.getAbsolutePath()); } catch (IOException ex) { Tracer.logError(ex); throw new ApolloConfigException(String .format("Loading config from local cache file %s failed", file.getAbsolutePath()), ex); } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { // ignore } } } else { throw new ApolloConfigException( String.format("Cannot read from local cache file %s", file.getAbsolutePath())); } return properties; } void persistLocalCacheFile(File baseDir, String namespace) { if (baseDir == null) { return; } File file = assembleLocalCacheFile(baseDir, namespace); OutputStream out = null; Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "persistLocalConfigFile"); transaction.addData("LocalConfigFile", file.getAbsolutePath()); try { out = new FileOutputStream(file); m_fileProperties.store(out, "Persisted by DefaultConfig"); transaction.setStatus(Transaction.SUCCESS); } catch (IOException ex) { ApolloConfigException exception = new ApolloConfigException( String.format("Persist local cache file %s failed", file.getAbsolutePath()), ex); Tracer.logError(exception); transaction.setStatus(exception); logger.warn("Persist local cache file {} failed, reason: {}.", file.getAbsolutePath(), ExceptionUtil.getDetailMessage(ex)); } finally { if (out != null) { try { out.close(); } catch (IOException ex) { //ignore } } transaction.complete(); } } private void checkLocalConfigCacheDir(File baseDir) { if (baseDir.exists()) { return; } Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "createLocalConfigDir"); transaction.addData("BaseDir", baseDir.getAbsolutePath()); try { Files.createDirectory(baseDir.toPath()); transaction.setStatus(Transaction.SUCCESS); } catch (IOException ex) { ApolloConfigException exception = new ApolloConfigException( String.format("Create local config directory %s failed", baseDir.getAbsolutePath()), ex); Tracer.logError(exception); transaction.setStatus(exception); logger.warn( "Unable to create local config cache directory {}, reason: {}. Will not able to cache config file.", baseDir.getAbsolutePath(), ExceptionUtil.getDetailMessage(ex)); } finally { transaction.complete(); } } File assembleLocalCacheFile(File baseDir, String namespace) { String fileName = String.format("%s.properties", Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR) .join(m_configUtil.getAppId(), m_configUtil.getCluster(), namespace)); return new File(baseDir, fileName); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.internals; import com.ctrip.framework.apollo.enums.ConfigSourceType; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Properties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ctrip.framework.apollo.build.ApolloInjector; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.utils.ClassLoaderUtil; import com.ctrip.framework.apollo.exceptions.ApolloConfigException; import com.ctrip.framework.apollo.tracer.Tracer; import com.ctrip.framework.apollo.tracer.spi.Transaction; import com.ctrip.framework.apollo.util.ConfigUtil; import com.ctrip.framework.apollo.util.ExceptionUtil; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; /** * @author Jason Song(song_s@ctrip.com) */ public class LocalFileConfigRepository extends AbstractConfigRepository implements RepositoryChangeListener { private static final Logger logger = LoggerFactory.getLogger(LocalFileConfigRepository.class); private static final String CONFIG_DIR = "/config-cache"; private final String m_namespace; private File m_baseDir; private final ConfigUtil m_configUtil; private volatile Properties m_fileProperties; private volatile ConfigRepository m_upstream; private volatile ConfigSourceType m_sourceType = ConfigSourceType.LOCAL; /** * Constructor. * * @param namespace the namespace */ public LocalFileConfigRepository(String namespace) { this(namespace, null); } public LocalFileConfigRepository(String namespace, ConfigRepository upstream) { m_namespace = namespace; m_configUtil = ApolloInjector.getInstance(ConfigUtil.class); this.setLocalCacheDir(findLocalCacheDir(), false); this.setUpstreamRepository(upstream); this.trySync(); } void setLocalCacheDir(File baseDir, boolean syncImmediately) { m_baseDir = baseDir; this.checkLocalConfigCacheDir(m_baseDir); if (syncImmediately) { this.trySync(); } } private File findLocalCacheDir() { try { String defaultCacheDir = m_configUtil.getDefaultLocalCacheDir(); Path path = Paths.get(defaultCacheDir); if (!Files.exists(path)) { Files.createDirectories(path); } if (Files.exists(path) && Files.isWritable(path)) { return new File(defaultCacheDir, CONFIG_DIR); } } catch (Throwable ex) { //ignore } return new File(ClassLoaderUtil.getClassPath(), CONFIG_DIR); } @Override public Properties getConfig() { if (m_fileProperties == null) { sync(); } Properties result = propertiesFactory.getPropertiesInstance(); result.putAll(m_fileProperties); return result; } @Override public void setUpstreamRepository(ConfigRepository upstreamConfigRepository) { if (upstreamConfigRepository == null) { return; } //clear previous listener if (m_upstream != null) { m_upstream.removeChangeListener(this); } m_upstream = upstreamConfigRepository; upstreamConfigRepository.addChangeListener(this); } @Override public ConfigSourceType getSourceType() { return m_sourceType; } @Override public void onRepositoryChange(String namespace, Properties newProperties) { if (newProperties.equals(m_fileProperties)) { return; } Properties newFileProperties = propertiesFactory.getPropertiesInstance(); newFileProperties.putAll(newProperties); updateFileProperties(newFileProperties, m_upstream.getSourceType()); this.fireRepositoryChange(namespace, newProperties); } @Override protected void sync() { //sync with upstream immediately boolean syncFromUpstreamResultSuccess = trySyncFromUpstream(); if (syncFromUpstreamResultSuccess) { return; } Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "syncLocalConfig"); Throwable exception = null; try { transaction.addData("Basedir", m_baseDir.getAbsolutePath()); m_fileProperties = this.loadFromLocalCacheFile(m_baseDir, m_namespace); m_sourceType = ConfigSourceType.LOCAL; transaction.setStatus(Transaction.SUCCESS); } catch (Throwable ex) { Tracer.logEvent("ApolloConfigException", ExceptionUtil.getDetailMessage(ex)); transaction.setStatus(ex); exception = ex; //ignore } finally { transaction.complete(); } if (m_fileProperties == null) { m_sourceType = ConfigSourceType.NONE; throw new ApolloConfigException( "Load config from local config failed!", exception); } } private boolean trySyncFromUpstream() { if (m_upstream == null) { return false; } try { updateFileProperties(m_upstream.getConfig(), m_upstream.getSourceType()); return true; } catch (Throwable ex) { Tracer.logError(ex); logger .warn("Sync config from upstream repository {} failed, reason: {}", m_upstream.getClass(), ExceptionUtil.getDetailMessage(ex)); } return false; } private synchronized void updateFileProperties(Properties newProperties, ConfigSourceType sourceType) { this.m_sourceType = sourceType; if (newProperties.equals(m_fileProperties)) { return; } this.m_fileProperties = newProperties; persistLocalCacheFile(m_baseDir, m_namespace); } private Properties loadFromLocalCacheFile(File baseDir, String namespace) throws IOException { Preconditions.checkNotNull(baseDir, "Basedir cannot be null"); File file = assembleLocalCacheFile(baseDir, namespace); Properties properties = null; if (file.isFile() && file.canRead()) { InputStream in = null; try { in = new FileInputStream(file); properties = propertiesFactory.getPropertiesInstance(); properties.load(in); logger.debug("Loading local config file {} successfully!", file.getAbsolutePath()); } catch (IOException ex) { Tracer.logError(ex); throw new ApolloConfigException(String .format("Loading config from local cache file %s failed", file.getAbsolutePath()), ex); } finally { try { if (in != null) { in.close(); } } catch (IOException ex) { // ignore } } } else { throw new ApolloConfigException( String.format("Cannot read from local cache file %s", file.getAbsolutePath())); } return properties; } void persistLocalCacheFile(File baseDir, String namespace) { if (baseDir == null) { return; } File file = assembleLocalCacheFile(baseDir, namespace); OutputStream out = null; Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "persistLocalConfigFile"); transaction.addData("LocalConfigFile", file.getAbsolutePath()); try { out = new FileOutputStream(file); m_fileProperties.store(out, "Persisted by DefaultConfig"); transaction.setStatus(Transaction.SUCCESS); } catch (IOException ex) { ApolloConfigException exception = new ApolloConfigException( String.format("Persist local cache file %s failed", file.getAbsolutePath()), ex); Tracer.logError(exception); transaction.setStatus(exception); logger.warn("Persist local cache file {} failed, reason: {}.", file.getAbsolutePath(), ExceptionUtil.getDetailMessage(ex)); } finally { if (out != null) { try { out.close(); } catch (IOException ex) { //ignore } } transaction.complete(); } } private void checkLocalConfigCacheDir(File baseDir) { if (baseDir.exists()) { return; } Transaction transaction = Tracer.newTransaction("Apollo.ConfigService", "createLocalConfigDir"); transaction.addData("BaseDir", baseDir.getAbsolutePath()); try { Files.createDirectory(baseDir.toPath()); transaction.setStatus(Transaction.SUCCESS); } catch (IOException ex) { ApolloConfigException exception = new ApolloConfigException( String.format("Create local config directory %s failed", baseDir.getAbsolutePath()), ex); Tracer.logError(exception); transaction.setStatus(exception); logger.warn( "Unable to create local config cache directory {}, reason: {}. Will not able to cache config file.", baseDir.getAbsolutePath(), ExceptionUtil.getDetailMessage(ex)); } finally { transaction.complete(); } } File assembleLocalCacheFile(File baseDir, String namespace) { String fileName = String.format("%s.properties", Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR) .join(m_configUtil.getAppId(), m_configUtil.getCluster(), namespace)); return new File(baseDir, fileName); } }
1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/controller/ConfigController.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.configservice.controller; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.common.entity.AppNamespace; import com.ctrip.framework.apollo.configservice.service.AppNamespaceServiceWithCache; import com.ctrip.framework.apollo.configservice.service.config.ConfigService; import com.ctrip.framework.apollo.configservice.util.InstanceConfigAuditUtil; import com.ctrip.framework.apollo.configservice.util.NamespaceUtil; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.dto.ApolloConfig; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.ctrip.framework.apollo.tracer.Tracer; import com.google.common.base.Splitter; import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.lang.reflect.Type; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; /** * @author Jason Song(song_s@ctrip.com) */ @RestController @RequestMapping("/configs") public class ConfigController { private static final Splitter X_FORWARDED_FOR_SPLITTER = Splitter.on(",").omitEmptyStrings() .trimResults(); private final ConfigService configService; private final AppNamespaceServiceWithCache appNamespaceService; private final NamespaceUtil namespaceUtil; private final InstanceConfigAuditUtil instanceConfigAuditUtil; private final Gson gson; private static final Type configurationTypeReference = new TypeToken<Map<String, String>>() { }.getType(); public ConfigController( final ConfigService configService, final AppNamespaceServiceWithCache appNamespaceService, final NamespaceUtil namespaceUtil, final InstanceConfigAuditUtil instanceConfigAuditUtil, final Gson gson) { this.configService = configService; this.appNamespaceService = appNamespaceService; this.namespaceUtil = namespaceUtil; this.instanceConfigAuditUtil = instanceConfigAuditUtil; this.gson = gson; } @GetMapping(value = "/{appId}/{clusterName}/{namespace:.+}") public ApolloConfig queryConfig(@PathVariable String appId, @PathVariable String clusterName, @PathVariable String namespace, @RequestParam(value = "dataCenter", required = false) String dataCenter, @RequestParam(value = "releaseKey", defaultValue = "-1") String clientSideReleaseKey, @RequestParam(value = "ip", required = false) String clientIp, @RequestParam(value = "messages", required = false) String messagesAsString, HttpServletRequest request, HttpServletResponse response) throws IOException { String originalNamespace = namespace; //strip out .properties suffix namespace = namespaceUtil.filterNamespaceName(namespace); //fix the character case issue, such as FX.apollo <-> fx.apollo namespace = namespaceUtil.normalizeNamespace(appId, namespace); if (Strings.isNullOrEmpty(clientIp)) { clientIp = tryToGetClientIp(request); } ApolloNotificationMessages clientMessages = transformMessages(messagesAsString); List<Release> releases = Lists.newLinkedList(); String appClusterNameLoaded = clusterName; if (!ConfigConsts.NO_APPID_PLACEHOLDER.equalsIgnoreCase(appId)) { Release currentAppRelease = configService.loadConfig(appId, clientIp, appId, clusterName, namespace, dataCenter, clientMessages); if (currentAppRelease != null) { releases.add(currentAppRelease); //we have cluster search process, so the cluster name might be overridden appClusterNameLoaded = currentAppRelease.getClusterName(); } } //if namespace does not belong to this appId, should check if there is a public configuration if (!namespaceBelongsToAppId(appId, namespace)) { Release publicRelease = this.findPublicConfig(appId, clientIp, clusterName, namespace, dataCenter, clientMessages); if (!Objects.isNull(publicRelease)) { releases.add(publicRelease); } } if (releases.isEmpty()) { response.sendError(HttpServletResponse.SC_NOT_FOUND, String.format( "Could not load configurations with appId: %s, clusterName: %s, namespace: %s", appId, clusterName, originalNamespace)); Tracer.logEvent("Apollo.Config.NotFound", assembleKey(appId, clusterName, originalNamespace, dataCenter)); return null; } auditReleases(appId, clusterName, dataCenter, clientIp, releases); String mergedReleaseKey = releases.stream().map(Release::getReleaseKey) .collect(Collectors.joining(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR)); if (mergedReleaseKey.equals(clientSideReleaseKey)) { // Client side configuration is the same with server side, return 304 response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); Tracer.logEvent("Apollo.Config.NotModified", assembleKey(appId, appClusterNameLoaded, originalNamespace, dataCenter)); return null; } ApolloConfig apolloConfig = new ApolloConfig(appId, appClusterNameLoaded, originalNamespace, mergedReleaseKey); apolloConfig.setConfigurations(mergeReleaseConfigurations(releases)); Tracer.logEvent("Apollo.Config.Found", assembleKey(appId, appClusterNameLoaded, originalNamespace, dataCenter)); return apolloConfig; } private boolean namespaceBelongsToAppId(String appId, String namespaceName) { //Every app has an 'application' namespace if (Objects.equals(ConfigConsts.NAMESPACE_APPLICATION, namespaceName)) { return true; } //if no appId is present, then no other namespace belongs to it if (ConfigConsts.NO_APPID_PLACEHOLDER.equalsIgnoreCase(appId)) { return false; } AppNamespace appNamespace = appNamespaceService.findByAppIdAndNamespace(appId, namespaceName); return appNamespace != null; } /** * @param clientAppId the application which uses public config * @param namespace the namespace * @param dataCenter the datacenter */ private Release findPublicConfig(String clientAppId, String clientIp, String clusterName, String namespace, String dataCenter, ApolloNotificationMessages clientMessages) { AppNamespace appNamespace = appNamespaceService.findPublicNamespaceByName(namespace); //check whether the namespace's appId equals to current one if (Objects.isNull(appNamespace) || Objects.equals(clientAppId, appNamespace.getAppId())) { return null; } String publicConfigAppId = appNamespace.getAppId(); return configService.loadConfig(clientAppId, clientIp, publicConfigAppId, clusterName, namespace, dataCenter, clientMessages); } /** * Merge configurations of releases. * Release in lower index override those in higher index */ Map<String, String> mergeReleaseConfigurations(List<Release> releases) { Map<String, String> result = Maps.newLinkedHashMap(); for (Release release : Lists.reverse(releases)) { result.putAll(gson.fromJson(release.getConfigurations(), configurationTypeReference)); } return result; } private String assembleKey(String appId, String cluster, String namespace, String dataCenter) { List<String> keyParts = Lists.newArrayList(appId, cluster, namespace); if (!Strings.isNullOrEmpty(dataCenter)) { keyParts.add(dataCenter); } return String.join(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR, keyParts); } private void auditReleases(String appId, String cluster, String dataCenter, String clientIp, List<Release> releases) { if (Strings.isNullOrEmpty(clientIp)) { //no need to audit instance config when there is no ip return; } for (Release release : releases) { instanceConfigAuditUtil.audit(appId, cluster, dataCenter, clientIp, release.getAppId(), release.getClusterName(), release.getNamespaceName(), release.getReleaseKey()); } } private String tryToGetClientIp(HttpServletRequest request) { String forwardedFor = request.getHeader("X-FORWARDED-FOR"); if (!Strings.isNullOrEmpty(forwardedFor)) { return X_FORWARDED_FOR_SPLITTER.splitToList(forwardedFor).get(0); } return request.getRemoteAddr(); } ApolloNotificationMessages transformMessages(String messagesAsString) { ApolloNotificationMessages notificationMessages = null; if (!Strings.isNullOrEmpty(messagesAsString)) { try { notificationMessages = gson.fromJson(messagesAsString, ApolloNotificationMessages.class); } catch (Throwable ex) { Tracer.logError(ex); } } return notificationMessages; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.configservice.controller; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.common.entity.AppNamespace; import com.ctrip.framework.apollo.configservice.service.AppNamespaceServiceWithCache; import com.ctrip.framework.apollo.configservice.service.config.ConfigService; import com.ctrip.framework.apollo.configservice.util.InstanceConfigAuditUtil; import com.ctrip.framework.apollo.configservice.util.NamespaceUtil; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.dto.ApolloConfig; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.ctrip.framework.apollo.tracer.Tracer; import com.google.common.base.Splitter; import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.lang.reflect.Type; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; /** * @author Jason Song(song_s@ctrip.com) */ @RestController @RequestMapping("/configs") public class ConfigController { private static final Splitter X_FORWARDED_FOR_SPLITTER = Splitter.on(",").omitEmptyStrings() .trimResults(); private final ConfigService configService; private final AppNamespaceServiceWithCache appNamespaceService; private final NamespaceUtil namespaceUtil; private final InstanceConfigAuditUtil instanceConfigAuditUtil; private final Gson gson; private static final Type configurationTypeReference = new TypeToken<Map<String, String>>() { }.getType(); public ConfigController( final ConfigService configService, final AppNamespaceServiceWithCache appNamespaceService, final NamespaceUtil namespaceUtil, final InstanceConfigAuditUtil instanceConfigAuditUtil, final Gson gson) { this.configService = configService; this.appNamespaceService = appNamespaceService; this.namespaceUtil = namespaceUtil; this.instanceConfigAuditUtil = instanceConfigAuditUtil; this.gson = gson; } @GetMapping(value = "/{appId}/{clusterName}/{namespace:.+}") public ApolloConfig queryConfig(@PathVariable String appId, @PathVariable String clusterName, @PathVariable String namespace, @RequestParam(value = "dataCenter", required = false) String dataCenter, @RequestParam(value = "releaseKey", defaultValue = "-1") String clientSideReleaseKey, @RequestParam(value = "ip", required = false) String clientIp, @RequestParam(value = "messages", required = false) String messagesAsString, HttpServletRequest request, HttpServletResponse response) throws IOException { String originalNamespace = namespace; //strip out .properties suffix namespace = namespaceUtil.filterNamespaceName(namespace); //fix the character case issue, such as FX.apollo <-> fx.apollo namespace = namespaceUtil.normalizeNamespace(appId, namespace); if (Strings.isNullOrEmpty(clientIp)) { clientIp = tryToGetClientIp(request); } ApolloNotificationMessages clientMessages = transformMessages(messagesAsString); List<Release> releases = Lists.newLinkedList(); String appClusterNameLoaded = clusterName; if (!ConfigConsts.NO_APPID_PLACEHOLDER.equalsIgnoreCase(appId)) { Release currentAppRelease = configService.loadConfig(appId, clientIp, appId, clusterName, namespace, dataCenter, clientMessages); if (currentAppRelease != null) { releases.add(currentAppRelease); //we have cluster search process, so the cluster name might be overridden appClusterNameLoaded = currentAppRelease.getClusterName(); } } //if namespace does not belong to this appId, should check if there is a public configuration if (!namespaceBelongsToAppId(appId, namespace)) { Release publicRelease = this.findPublicConfig(appId, clientIp, clusterName, namespace, dataCenter, clientMessages); if (Objects.nonNull(publicRelease)) { releases.add(publicRelease); } } if (releases.isEmpty()) { response.sendError(HttpServletResponse.SC_NOT_FOUND, String.format( "Could not load configurations with appId: %s, clusterName: %s, namespace: %s", appId, clusterName, originalNamespace)); Tracer.logEvent("Apollo.Config.NotFound", assembleKey(appId, clusterName, originalNamespace, dataCenter)); return null; } auditReleases(appId, clusterName, dataCenter, clientIp, releases); String mergedReleaseKey = releases.stream().map(Release::getReleaseKey) .collect(Collectors.joining(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR)); if (mergedReleaseKey.equals(clientSideReleaseKey)) { // Client side configuration is the same with server side, return 304 response.setStatus(HttpServletResponse.SC_NOT_MODIFIED); Tracer.logEvent("Apollo.Config.NotModified", assembleKey(appId, appClusterNameLoaded, originalNamespace, dataCenter)); return null; } ApolloConfig apolloConfig = new ApolloConfig(appId, appClusterNameLoaded, originalNamespace, mergedReleaseKey); apolloConfig.setConfigurations(mergeReleaseConfigurations(releases)); Tracer.logEvent("Apollo.Config.Found", assembleKey(appId, appClusterNameLoaded, originalNamespace, dataCenter)); return apolloConfig; } private boolean namespaceBelongsToAppId(String appId, String namespaceName) { //Every app has an 'application' namespace if (Objects.equals(ConfigConsts.NAMESPACE_APPLICATION, namespaceName)) { return true; } //if no appId is present, then no other namespace belongs to it if (ConfigConsts.NO_APPID_PLACEHOLDER.equalsIgnoreCase(appId)) { return false; } AppNamespace appNamespace = appNamespaceService.findByAppIdAndNamespace(appId, namespaceName); return appNamespace != null; } /** * @param clientAppId the application which uses public config * @param namespace the namespace * @param dataCenter the datacenter */ private Release findPublicConfig(String clientAppId, String clientIp, String clusterName, String namespace, String dataCenter, ApolloNotificationMessages clientMessages) { AppNamespace appNamespace = appNamespaceService.findPublicNamespaceByName(namespace); //check whether the namespace's appId equals to current one if (Objects.isNull(appNamespace) || Objects.equals(clientAppId, appNamespace.getAppId())) { return null; } String publicConfigAppId = appNamespace.getAppId(); return configService.loadConfig(clientAppId, clientIp, publicConfigAppId, clusterName, namespace, dataCenter, clientMessages); } /** * Merge configurations of releases. * Release in lower index override those in higher index */ Map<String, String> mergeReleaseConfigurations(List<Release> releases) { Map<String, String> result = Maps.newLinkedHashMap(); for (Release release : Lists.reverse(releases)) { result.putAll(gson.fromJson(release.getConfigurations(), configurationTypeReference)); } return result; } private String assembleKey(String appId, String cluster, String namespace, String dataCenter) { List<String> keyParts = Lists.newArrayList(appId, cluster, namespace); if (!Strings.isNullOrEmpty(dataCenter)) { keyParts.add(dataCenter); } return String.join(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR, keyParts); } private void auditReleases(String appId, String cluster, String dataCenter, String clientIp, List<Release> releases) { if (Strings.isNullOrEmpty(clientIp)) { //no need to audit instance config when there is no ip return; } for (Release release : releases) { instanceConfigAuditUtil.audit(appId, cluster, dataCenter, clientIp, release.getAppId(), release.getClusterName(), release.getNamespaceName(), release.getReleaseKey()); } } private String tryToGetClientIp(HttpServletRequest request) { String forwardedFor = request.getHeader("X-FORWARDED-FOR"); if (!Strings.isNullOrEmpty(forwardedFor)) { return X_FORWARDED_FOR_SPLITTER.splitToList(forwardedFor).get(0); } return request.getRemoteAddr(); } ApolloNotificationMessages transformMessages(String messagesAsString) { ApolloNotificationMessages notificationMessages = null; if (!Strings.isNullOrEmpty(messagesAsString)) { try { notificationMessages = gson.fromJson(messagesAsString, ApolloNotificationMessages.class); } catch (Throwable ex) { Tracer.logError(ex); } } return notificationMessages; } }
1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/service/config/AbstractConfigService.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.configservice.service.config; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.grayReleaseRule.GrayReleaseRulesHolder; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.google.common.base.Strings; import java.util.Objects; import org.springframework.beans.factory.annotation.Autowired; /** * @author Jason Song(song_s@ctrip.com) */ public abstract class AbstractConfigService implements ConfigService { @Autowired private GrayReleaseRulesHolder grayReleaseRulesHolder; @Override public Release loadConfig(String clientAppId, String clientIp, String configAppId, String configClusterName, String configNamespace, String dataCenter, ApolloNotificationMessages clientMessages) { // load from specified cluster fist if (!Objects.equals(ConfigConsts.CLUSTER_NAME_DEFAULT, configClusterName)) { Release clusterRelease = findRelease(clientAppId, clientIp, configAppId, configClusterName, configNamespace, clientMessages); if (!Objects.isNull(clusterRelease)) { return clusterRelease; } } // try to load via data center if (!Strings.isNullOrEmpty(dataCenter) && !Objects.equals(dataCenter, configClusterName)) { Release dataCenterRelease = findRelease(clientAppId, clientIp, configAppId, dataCenter, configNamespace, clientMessages); if (!Objects.isNull(dataCenterRelease)) { return dataCenterRelease; } } // fallback to default release return findRelease(clientAppId, clientIp, configAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, configNamespace, clientMessages); } /** * Find release * * @param clientAppId the client's app id * @param clientIp the client ip * @param configAppId the requested config's app id * @param configClusterName the requested config's cluster name * @param configNamespace the requested config's namespace name * @param clientMessages the messages received in client side * @return the release */ private Release findRelease(String clientAppId, String clientIp, String configAppId, String configClusterName, String configNamespace, ApolloNotificationMessages clientMessages) { Long grayReleaseId = grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule(clientAppId, clientIp, configAppId, configClusterName, configNamespace); Release release = null; if (grayReleaseId != null) { release = findActiveOne(grayReleaseId, clientMessages); } if (release == null) { release = findLatestActiveRelease(configAppId, configClusterName, configNamespace, clientMessages); } return release; } /** * Find active release by id */ protected abstract Release findActiveOne(long id, ApolloNotificationMessages clientMessages); /** * Find active release by app id, cluster name and namespace name */ protected abstract Release findLatestActiveRelease(String configAppId, String configClusterName, String configNamespaceName, ApolloNotificationMessages clientMessages); }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.configservice.service.config; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.grayReleaseRule.GrayReleaseRulesHolder; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.google.common.base.Strings; import java.util.Objects; import org.springframework.beans.factory.annotation.Autowired; /** * @author Jason Song(song_s@ctrip.com) */ public abstract class AbstractConfigService implements ConfigService { @Autowired private GrayReleaseRulesHolder grayReleaseRulesHolder; @Override public Release loadConfig(String clientAppId, String clientIp, String configAppId, String configClusterName, String configNamespace, String dataCenter, ApolloNotificationMessages clientMessages) { // load from specified cluster fist if (!Objects.equals(ConfigConsts.CLUSTER_NAME_DEFAULT, configClusterName)) { Release clusterRelease = findRelease(clientAppId, clientIp, configAppId, configClusterName, configNamespace, clientMessages); if (Objects.nonNull(clusterRelease)) { return clusterRelease; } } // try to load via data center if (!Strings.isNullOrEmpty(dataCenter) && !Objects.equals(dataCenter, configClusterName)) { Release dataCenterRelease = findRelease(clientAppId, clientIp, configAppId, dataCenter, configNamespace, clientMessages); if (Objects.nonNull(dataCenterRelease)) { return dataCenterRelease; } } // fallback to default release return findRelease(clientAppId, clientIp, configAppId, ConfigConsts.CLUSTER_NAME_DEFAULT, configNamespace, clientMessages); } /** * Find release * * @param clientAppId the client's app id * @param clientIp the client ip * @param configAppId the requested config's app id * @param configClusterName the requested config's cluster name * @param configNamespace the requested config's namespace name * @param clientMessages the messages received in client side * @return the release */ private Release findRelease(String clientAppId, String clientIp, String configAppId, String configClusterName, String configNamespace, ApolloNotificationMessages clientMessages) { Long grayReleaseId = grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule(clientAppId, clientIp, configAppId, configClusterName, configNamespace); Release release = null; if (grayReleaseId != null) { release = findActiveOne(grayReleaseId, clientMessages); } if (release == null) { release = findLatestActiveRelease(configAppId, configClusterName, configNamespace, clientMessages); } return release; } /** * Find active release by id */ protected abstract Release findActiveOne(long id, ApolloNotificationMessages clientMessages); /** * Find active release by app id, cluster name and namespace name */ protected abstract Release findLatestActiveRelease(String configAppId, String configClusterName, String configNamespaceName, ApolloNotificationMessages clientMessages); }
1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/config/ConfigServiceWithCacheTest.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.configservice.service.config; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.google.common.collect.Lists; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.service.ReleaseMessageService; import com.ctrip.framework.apollo.biz.service.ReleaseService; import com.ctrip.framework.apollo.biz.utils.ReleaseMessageKeyGenerator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** * @author Jason Song(song_s@ctrip.com) */ @RunWith(MockitoJUnitRunner.class) public class ConfigServiceWithCacheTest { private ConfigServiceWithCache configServiceWithCache; @Mock private ReleaseService releaseService; @Mock private ReleaseMessageService releaseMessageService; @Mock private Release someRelease; @Mock private ReleaseMessage someReleaseMessage; private String someAppId; private String someClusterName; private String someNamespaceName; private String someKey; private long someNotificationId; private ApolloNotificationMessages someNotificationMessages; @Before public void setUp() throws Exception { configServiceWithCache = new ConfigServiceWithCache(); ReflectionTestUtils.setField(configServiceWithCache, "releaseService", releaseService); ReflectionTestUtils.setField(configServiceWithCache, "releaseMessageService", releaseMessageService); configServiceWithCache.initialize(); someAppId = "someAppId"; someClusterName = "someClusterName"; someNamespaceName = "someNamespaceName"; someNotificationId = 1; someKey = ReleaseMessageKeyGenerator.generate(someAppId, someClusterName, someNamespaceName); someNotificationMessages = new ApolloNotificationMessages(); } @Test public void testFindActiveOne() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithSameIdMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithMultipleIdMultipleTimes() throws Exception { long someId = 1; long anotherId = 2; Release anotherRelease = mock(Release.class); when(releaseService.findActiveOne(someId)).thenReturn(someRelease); when(releaseService.findActiveOne(anotherId)).thenReturn(anotherRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); verify(releaseService, times(1)).findActiveOne(anotherId); } @Test public void testFindActiveOneWithReleaseNotFoundMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(null); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindLatestActiveRelease() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertEquals(someRelease, release); assertEquals(someRelease, anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseNotFound() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn(null); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn(null); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertNull(release); assertNull(anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithDirtyRelease() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someKey, someNewNotificationId); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseMessageNotification() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getMessage()).thenReturn(someKey); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); configServiceWithCache.handleMessage(anotherReleaseMessage, Topics.APOLLO_RELEASE_TOPIC); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithIrrelevantMessages() throws Exception { long someNewNotificationId = someNotificationId + 1; String someIrrelevantKey = "someIrrelevantKey"; when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someIrrelevantKey, someNewNotificationId); Release shouldStillBeOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(someRelease, shouldStillBeOldRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.configservice.service.config; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.google.common.collect.Lists; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.service.ReleaseMessageService; import com.ctrip.framework.apollo.biz.service.ReleaseService; import com.ctrip.framework.apollo.biz.utils.ReleaseMessageKeyGenerator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** * @author Jason Song(song_s@ctrip.com) */ @RunWith(MockitoJUnitRunner.class) public class ConfigServiceWithCacheTest { private ConfigServiceWithCache configServiceWithCache; @Mock private ReleaseService releaseService; @Mock private ReleaseMessageService releaseMessageService; @Mock private Release someRelease; @Mock private ReleaseMessage someReleaseMessage; private String someAppId; private String someClusterName; private String someNamespaceName; private String someKey; private long someNotificationId; private ApolloNotificationMessages someNotificationMessages; @Before public void setUp() throws Exception { configServiceWithCache = new ConfigServiceWithCache(); ReflectionTestUtils.setField(configServiceWithCache, "releaseService", releaseService); ReflectionTestUtils.setField(configServiceWithCache, "releaseMessageService", releaseMessageService); configServiceWithCache.initialize(); someAppId = "someAppId"; someClusterName = "someClusterName"; someNamespaceName = "someNamespaceName"; someNotificationId = 1; someKey = ReleaseMessageKeyGenerator.generate(someAppId, someClusterName, someNamespaceName); someNotificationMessages = new ApolloNotificationMessages(); } @Test public void testFindActiveOne() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithSameIdMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithMultipleIdMultipleTimes() throws Exception { long someId = 1; long anotherId = 2; Release anotherRelease = mock(Release.class); when(releaseService.findActiveOne(someId)).thenReturn(someRelease); when(releaseService.findActiveOne(anotherId)).thenReturn(anotherRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); verify(releaseService, times(1)).findActiveOne(anotherId); } @Test public void testFindActiveOneWithReleaseNotFoundMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(null); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindLatestActiveRelease() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertEquals(someRelease, release); assertEquals(someRelease, anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseNotFound() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn(null); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn(null); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertNull(release); assertNull(anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithDirtyRelease() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someKey, someNewNotificationId); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseMessageNotification() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getMessage()).thenReturn(someKey); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); configServiceWithCache.handleMessage(anotherReleaseMessage, Topics.APOLLO_RELEASE_TOPIC); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithIrrelevantMessages() throws Exception { long someNewNotificationId = someNotificationId + 1; String someIrrelevantKey = "someIrrelevantKey"; when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someIrrelevantKey, someNewNotificationId); Release shouldStillBeOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(someRelease, shouldStillBeOldRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/util/RoleUtils.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.util; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.portal.constant.RoleType; import com.google.common.base.Joiner; import com.google.common.base.Splitter; import java.util.Iterator; public class RoleUtils { private static final Joiner STRING_JOINER = Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR).skipNulls(); private static final Splitter STRING_SPLITTER = Splitter.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR) .omitEmptyStrings().trimResults(); public static String buildAppMasterRoleName(String appId) { return STRING_JOINER.join(RoleType.MASTER, appId); } public static String extractAppIdFromMasterRoleName(String masterRoleName) { Iterator<String> parts = STRING_SPLITTER.split(masterRoleName).iterator(); // skip role type if (parts.hasNext() && parts.next().equals(RoleType.MASTER) && parts.hasNext()) { return parts.next(); } return null; } public static String extractAppIdFromRoleName(String roleName) { Iterator<String> parts = STRING_SPLITTER.split(roleName).iterator(); if (parts.hasNext()) { String roleType = parts.next(); if (RoleType.isValidRoleType(roleType) && parts.hasNext()) { return parts.next(); } } return null; } public static String buildAppRoleName(String appId, String roleType) { return STRING_JOINER.join(roleType, appId); } public static String buildModifyNamespaceRoleName(String appId, String namespaceName) { return buildModifyNamespaceRoleName(appId, namespaceName, null); } public static String buildModifyNamespaceRoleName(String appId, String namespaceName, String env) { return STRING_JOINER.join(RoleType.MODIFY_NAMESPACE, appId, namespaceName, env); } public static String buildModifyDefaultNamespaceRoleName(String appId) { return STRING_JOINER.join(RoleType.MODIFY_NAMESPACE, appId, ConfigConsts.NAMESPACE_APPLICATION); } public static String buildReleaseNamespaceRoleName(String appId, String namespaceName) { return buildReleaseNamespaceRoleName(appId, namespaceName, null); } public static String buildReleaseNamespaceRoleName(String appId, String namespaceName, String env) { return STRING_JOINER.join(RoleType.RELEASE_NAMESPACE, appId, namespaceName, env); } public static String buildNamespaceRoleName(String appId, String namespaceName, String roleType) { return buildNamespaceRoleName(appId, namespaceName, roleType, null); } public static String buildNamespaceRoleName(String appId, String namespaceName, String roleType, String env) { return STRING_JOINER.join(roleType, appId, namespaceName, env); } public static String buildReleaseDefaultNamespaceRoleName(String appId) { return STRING_JOINER.join(RoleType.RELEASE_NAMESPACE, appId, ConfigConsts.NAMESPACE_APPLICATION); } public static String buildNamespaceTargetId(String appId, String namespaceName) { return buildNamespaceTargetId(appId, namespaceName, null); } public static String buildNamespaceTargetId(String appId, String namespaceName, String env) { return STRING_JOINER.join(appId, namespaceName, env); } public static String buildDefaultNamespaceTargetId(String appId) { return STRING_JOINER.join(appId, ConfigConsts.NAMESPACE_APPLICATION); } public static String buildCreateApplicationRoleName(String permissionType, String permissionTargetId) { return STRING_JOINER.join(permissionType, permissionTargetId); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.util; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.portal.constant.RoleType; import com.google.common.base.Joiner; import com.google.common.base.Splitter; import java.util.Iterator; public class RoleUtils { private static final Joiner STRING_JOINER = Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR).skipNulls(); private static final Splitter STRING_SPLITTER = Splitter.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR) .omitEmptyStrings().trimResults(); public static String buildAppMasterRoleName(String appId) { return STRING_JOINER.join(RoleType.MASTER, appId); } public static String extractAppIdFromMasterRoleName(String masterRoleName) { Iterator<String> parts = STRING_SPLITTER.split(masterRoleName).iterator(); // skip role type if (parts.hasNext() && parts.next().equals(RoleType.MASTER) && parts.hasNext()) { return parts.next(); } return null; } public static String extractAppIdFromRoleName(String roleName) { Iterator<String> parts = STRING_SPLITTER.split(roleName).iterator(); if (parts.hasNext()) { String roleType = parts.next(); if (RoleType.isValidRoleType(roleType) && parts.hasNext()) { return parts.next(); } } return null; } public static String buildAppRoleName(String appId, String roleType) { return STRING_JOINER.join(roleType, appId); } public static String buildModifyNamespaceRoleName(String appId, String namespaceName) { return buildModifyNamespaceRoleName(appId, namespaceName, null); } public static String buildModifyNamespaceRoleName(String appId, String namespaceName, String env) { return STRING_JOINER.join(RoleType.MODIFY_NAMESPACE, appId, namespaceName, env); } public static String buildModifyDefaultNamespaceRoleName(String appId) { return STRING_JOINER.join(RoleType.MODIFY_NAMESPACE, appId, ConfigConsts.NAMESPACE_APPLICATION); } public static String buildReleaseNamespaceRoleName(String appId, String namespaceName) { return buildReleaseNamespaceRoleName(appId, namespaceName, null); } public static String buildReleaseNamespaceRoleName(String appId, String namespaceName, String env) { return STRING_JOINER.join(RoleType.RELEASE_NAMESPACE, appId, namespaceName, env); } public static String buildNamespaceRoleName(String appId, String namespaceName, String roleType) { return buildNamespaceRoleName(appId, namespaceName, roleType, null); } public static String buildNamespaceRoleName(String appId, String namespaceName, String roleType, String env) { return STRING_JOINER.join(roleType, appId, namespaceName, env); } public static String buildReleaseDefaultNamespaceRoleName(String appId) { return STRING_JOINER.join(RoleType.RELEASE_NAMESPACE, appId, ConfigConsts.NAMESPACE_APPLICATION); } public static String buildNamespaceTargetId(String appId, String namespaceName) { return buildNamespaceTargetId(appId, namespaceName, null); } public static String buildNamespaceTargetId(String appId, String namespaceName, String env) { return STRING_JOINER.join(appId, namespaceName, env); } public static String buildDefaultNamespaceTargetId(String appId) { return STRING_JOINER.join(appId, ConfigConsts.NAMESPACE_APPLICATION); } public static String buildCreateApplicationRoleName(String permissionType, String permissionTargetId) { return STRING_JOINER.join(permissionType, permissionTargetId); } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-client/src/main/java/com/ctrip/framework/apollo/internals/DefaultMetaServerProvider.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.internals; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.core.spi.MetaServerProvider; import com.ctrip.framework.foundation.Foundation; import com.google.common.base.Strings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class DefaultMetaServerProvider implements MetaServerProvider { public static final int ORDER = 0; private static final Logger logger = LoggerFactory.getLogger(DefaultMetaServerProvider.class); private final String metaServerAddress; public DefaultMetaServerProvider() { metaServerAddress = initMetaServerAddress(); } private String initMetaServerAddress() { // 1. Get from System Property String metaAddress = System.getProperty(ConfigConsts.APOLLO_META_KEY); if (Strings.isNullOrEmpty(metaAddress)) { // 2. Get from OS environment variable, which could not contain dot and is normally in UPPER case metaAddress = System.getenv("APOLLO_META"); } if (Strings.isNullOrEmpty(metaAddress)) { // 3. Get from server.properties metaAddress = Foundation.server().getProperty(ConfigConsts.APOLLO_META_KEY, null); } if (Strings.isNullOrEmpty(metaAddress)) { // 4. Get from app.properties metaAddress = Foundation.app().getProperty(ConfigConsts.APOLLO_META_KEY, null); } if (Strings.isNullOrEmpty(metaAddress)) { logger.warn("Could not find meta server address, because it is not available in neither (1) JVM system property 'apollo.meta', (2) OS env variable 'APOLLO_META' (3) property 'apollo.meta' from server.properties nor (4) property 'apollo.meta' from app.properties"); } else { metaAddress = metaAddress.trim(); logger.info("Located meta services from apollo.meta configuration: {}!", metaAddress); } return metaAddress; } @Override public String getMetaServerAddress(Env targetEnv) { //for default meta server provider, we don't care the actual environment return metaServerAddress; } @Override public int getOrder() { return ORDER; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.internals; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.core.spi.MetaServerProvider; import com.ctrip.framework.foundation.Foundation; import com.google.common.base.Strings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class DefaultMetaServerProvider implements MetaServerProvider { public static final int ORDER = 0; private static final Logger logger = LoggerFactory.getLogger(DefaultMetaServerProvider.class); private final String metaServerAddress; public DefaultMetaServerProvider() { metaServerAddress = initMetaServerAddress(); } private String initMetaServerAddress() { // 1. Get from System Property String metaAddress = System.getProperty(ConfigConsts.APOLLO_META_KEY); if (Strings.isNullOrEmpty(metaAddress)) { // 2. Get from OS environment variable, which could not contain dot and is normally in UPPER case metaAddress = System.getenv("APOLLO_META"); } if (Strings.isNullOrEmpty(metaAddress)) { // 3. Get from server.properties metaAddress = Foundation.server().getProperty(ConfigConsts.APOLLO_META_KEY, null); } if (Strings.isNullOrEmpty(metaAddress)) { // 4. Get from app.properties metaAddress = Foundation.app().getProperty(ConfigConsts.APOLLO_META_KEY, null); } if (Strings.isNullOrEmpty(metaAddress)) { logger.warn("Could not find meta server address, because it is not available in neither (1) JVM system property 'apollo.meta', (2) OS env variable 'APOLLO_META' (3) property 'apollo.meta' from server.properties nor (4) property 'apollo.meta' from app.properties"); } else { metaAddress = metaAddress.trim(); logger.info("Located meta services from apollo.meta configuration: {}!", metaAddress); } return metaAddress; } @Override public String getMetaServerAddress(Env targetEnv) { //for default meta server provider, we don't care the actual environment return metaServerAddress; } @Override public int getOrder() { return ORDER; } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/environment/DefaultPortalMetaServerProvider.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.environment; import static com.ctrip.framework.apollo.portal.environment.Env.transformToEnvMap; import com.ctrip.framework.apollo.core.utils.ResourceUtils; import com.ctrip.framework.apollo.portal.util.KeyValueUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Map; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; /** * Only use in apollo-portal * load all meta server address from * - System Property [key ends with "_meta" (case insensitive)] * - OS environment variable [key ends with "_meta" (case insensitive)] * - user's configuration file [key ends with ".meta" (case insensitive)] * when apollo-portal start up. * @see com.ctrip.framework.apollo.core.internals.LegacyMetaServerProvider * @author wxq */ class DefaultPortalMetaServerProvider implements PortalMetaServerProvider { private static final Logger logger = LoggerFactory.getLogger(DefaultPortalMetaServerProvider.class); /** * environments and their meta server address * properties file path */ private static final String APOLLO_ENV_PROPERTIES_FILE_PATH = "apollo-env.properties"; private volatile Map<Env, String> domains; DefaultPortalMetaServerProvider() { reload(); } @Override public String getMetaServerAddress(Env targetEnv) { String metaServerAddress = domains.get(targetEnv); return metaServerAddress == null ? null : metaServerAddress.trim(); } @Override public boolean exists(Env targetEnv) { return domains.containsKey(targetEnv); } @Override public void reload() { domains = initializeDomains(); logger.info("Loaded meta server addresses from system property, os environment and properties file: {}", domains); } /** * load all environment's meta address dynamically when this class loaded by JVM */ private Map<Env, String> initializeDomains() { // add to domain Map<Env, String> map = new ConcurrentHashMap<>(); // lower priority add first map.putAll(getDomainsFromPropertiesFile()); map.putAll(getDomainsFromOSEnvironment()); map.putAll(getDomainsFromSystemProperty()); // log all return map; } private Map<Env, String> getDomainsFromSystemProperty() { // find key-value from System Property which key ends with "_meta" (case insensitive) Map<String, String> metaServerAddressesFromSystemProperty = KeyValueUtils.filterWithKeyIgnoreCaseEndsWith(System.getProperties(), "_meta"); // remove key's suffix "_meta" (case insensitive) metaServerAddressesFromSystemProperty = KeyValueUtils.removeKeySuffix(metaServerAddressesFromSystemProperty, "_meta".length()); return transformToEnvMap(metaServerAddressesFromSystemProperty); } private Map<Env, String> getDomainsFromOSEnvironment() { // find key-value from OS environment variable which key ends with "_meta" (case insensitive) Map<String, String> metaServerAddressesFromOSEnvironment = KeyValueUtils.filterWithKeyIgnoreCaseEndsWith(System.getenv(), "_meta"); // remove key's suffix "_meta" (case insensitive) metaServerAddressesFromOSEnvironment = KeyValueUtils.removeKeySuffix(metaServerAddressesFromOSEnvironment, "_meta".length()); return transformToEnvMap(metaServerAddressesFromOSEnvironment); } private Map<Env, String> getDomainsFromPropertiesFile() { // find key-value from properties file which key ends with ".meta" (case insensitive) Properties properties = new Properties(); properties = ResourceUtils.readConfigFile(APOLLO_ENV_PROPERTIES_FILE_PATH, properties); Map<String, String> metaServerAddressesFromPropertiesFile = KeyValueUtils.filterWithKeyIgnoreCaseEndsWith(properties, ".meta"); // remove key's suffix ".meta" (case insensitive) metaServerAddressesFromPropertiesFile = KeyValueUtils.removeKeySuffix(metaServerAddressesFromPropertiesFile, ".meta".length()); return transformToEnvMap(metaServerAddressesFromPropertiesFile); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.environment; import static com.ctrip.framework.apollo.portal.environment.Env.transformToEnvMap; import com.ctrip.framework.apollo.core.utils.ResourceUtils; import com.ctrip.framework.apollo.portal.util.KeyValueUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Map; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; /** * Only use in apollo-portal * load all meta server address from * - System Property [key ends with "_meta" (case insensitive)] * - OS environment variable [key ends with "_meta" (case insensitive)] * - user's configuration file [key ends with ".meta" (case insensitive)] * when apollo-portal start up. * @see com.ctrip.framework.apollo.core.internals.LegacyMetaServerProvider * @author wxq */ class DefaultPortalMetaServerProvider implements PortalMetaServerProvider { private static final Logger logger = LoggerFactory.getLogger(DefaultPortalMetaServerProvider.class); /** * environments and their meta server address * properties file path */ private static final String APOLLO_ENV_PROPERTIES_FILE_PATH = "apollo-env.properties"; private volatile Map<Env, String> domains; DefaultPortalMetaServerProvider() { reload(); } @Override public String getMetaServerAddress(Env targetEnv) { String metaServerAddress = domains.get(targetEnv); return metaServerAddress == null ? null : metaServerAddress.trim(); } @Override public boolean exists(Env targetEnv) { return domains.containsKey(targetEnv); } @Override public void reload() { domains = initializeDomains(); logger.info("Loaded meta server addresses from system property, os environment and properties file: {}", domains); } /** * load all environment's meta address dynamically when this class loaded by JVM */ private Map<Env, String> initializeDomains() { // add to domain Map<Env, String> map = new ConcurrentHashMap<>(); // lower priority add first map.putAll(getDomainsFromPropertiesFile()); map.putAll(getDomainsFromOSEnvironment()); map.putAll(getDomainsFromSystemProperty()); // log all return map; } private Map<Env, String> getDomainsFromSystemProperty() { // find key-value from System Property which key ends with "_meta" (case insensitive) Map<String, String> metaServerAddressesFromSystemProperty = KeyValueUtils.filterWithKeyIgnoreCaseEndsWith(System.getProperties(), "_meta"); // remove key's suffix "_meta" (case insensitive) metaServerAddressesFromSystemProperty = KeyValueUtils.removeKeySuffix(metaServerAddressesFromSystemProperty, "_meta".length()); return transformToEnvMap(metaServerAddressesFromSystemProperty); } private Map<Env, String> getDomainsFromOSEnvironment() { // find key-value from OS environment variable which key ends with "_meta" (case insensitive) Map<String, String> metaServerAddressesFromOSEnvironment = KeyValueUtils.filterWithKeyIgnoreCaseEndsWith(System.getenv(), "_meta"); // remove key's suffix "_meta" (case insensitive) metaServerAddressesFromOSEnvironment = KeyValueUtils.removeKeySuffix(metaServerAddressesFromOSEnvironment, "_meta".length()); return transformToEnvMap(metaServerAddressesFromOSEnvironment); } private Map<Env, String> getDomainsFromPropertiesFile() { // find key-value from properties file which key ends with ".meta" (case insensitive) Properties properties = new Properties(); properties = ResourceUtils.readConfigFile(APOLLO_ENV_PROPERTIES_FILE_PATH, properties); Map<String, String> metaServerAddressesFromPropertiesFile = KeyValueUtils.filterWithKeyIgnoreCaseEndsWith(properties, ".meta"); // remove key's suffix ".meta" (case insensitive) metaServerAddressesFromPropertiesFile = KeyValueUtils.removeKeySuffix(metaServerAddressesFromPropertiesFile, ".meta".length()); return transformToEnvMap(metaServerAddressesFromPropertiesFile); } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/ServiceExceptionTest.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal; import com.ctrip.framework.apollo.common.exception.ServiceException; import com.ctrip.framework.apollo.portal.controller.AppController; import com.ctrip.framework.apollo.portal.entity.model.AppModel; import com.ctrip.framework.apollo.portal.service.AppService; import com.google.gson.Gson; import java.nio.charset.Charset; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.LinkedHashMap; import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.springframework.http.HttpStatus; import org.springframework.web.client.HttpServerErrorException; import org.springframework.web.client.HttpStatusCodeException; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; public class ServiceExceptionTest extends AbstractUnitTest { @InjectMocks private AppController appController; @Mock private AppService appService; private static final Gson GSON = new Gson(); @Test public void testAdminServiceException() { String errorMsg = "No available admin service"; String errorCode = "errorCode"; String status = "500"; Map<String, Object> errorAttributes = new LinkedHashMap<>(); errorAttributes.put("status", status); errorAttributes.put("message", errorMsg); errorAttributes.put("timestamp", LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); errorAttributes.put("exception", ServiceException.class.getName()); errorAttributes.put("errorCode", errorCode); HttpStatusCodeException adminException = new HttpServerErrorException( HttpStatus.INTERNAL_SERVER_ERROR, "admin server error", GSON.toJson(errorAttributes).getBytes(), Charset.defaultCharset() ); when(appService.createAppInLocal(any())).thenThrow(adminException); AppModel app = generateSampleApp(); try { appController.create(app); } catch (HttpStatusCodeException e) { @SuppressWarnings("unchecked") Map<String, String> attr = new Gson().fromJson(e.getResponseBodyAsString(), Map.class); Assert.assertEquals(errorMsg, attr.get("message")); Assert.assertEquals(errorCode, attr.get("errorCode")); Assert.assertEquals(status, attr.get("status")); } } private AppModel generateSampleApp() { AppModel app = new AppModel(); app.setAppId("someAppId"); app.setName("someName"); app.setOrgId("someOrgId"); app.setOrgName("someOrgNam"); app.setOwnerName("someOwner"); return app; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal; import com.ctrip.framework.apollo.common.exception.ServiceException; import com.ctrip.framework.apollo.portal.controller.AppController; import com.ctrip.framework.apollo.portal.entity.model.AppModel; import com.ctrip.framework.apollo.portal.service.AppService; import com.google.gson.Gson; import java.nio.charset.Charset; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.LinkedHashMap; import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.springframework.http.HttpStatus; import org.springframework.web.client.HttpServerErrorException; import org.springframework.web.client.HttpStatusCodeException; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; public class ServiceExceptionTest extends AbstractUnitTest { @InjectMocks private AppController appController; @Mock private AppService appService; private static final Gson GSON = new Gson(); @Test public void testAdminServiceException() { String errorMsg = "No available admin service"; String errorCode = "errorCode"; String status = "500"; Map<String, Object> errorAttributes = new LinkedHashMap<>(); errorAttributes.put("status", status); errorAttributes.put("message", errorMsg); errorAttributes.put("timestamp", LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)); errorAttributes.put("exception", ServiceException.class.getName()); errorAttributes.put("errorCode", errorCode); HttpStatusCodeException adminException = new HttpServerErrorException( HttpStatus.INTERNAL_SERVER_ERROR, "admin server error", GSON.toJson(errorAttributes).getBytes(), Charset.defaultCharset() ); when(appService.createAppInLocal(any())).thenThrow(adminException); AppModel app = generateSampleApp(); try { appController.create(app); } catch (HttpStatusCodeException e) { @SuppressWarnings("unchecked") Map<String, String> attr = new Gson().fromJson(e.getResponseBodyAsString(), Map.class); Assert.assertEquals(errorMsg, attr.get("message")); Assert.assertEquals(errorCode, attr.get("errorCode")); Assert.assertEquals(status, attr.get("status")); } } private AppModel generateSampleApp() { AppModel app = new AppModel(); app.setAppId("someAppId"); app.setName("someName"); app.setOrgId("someOrgId"); app.setOrgName("someOrgNam"); app.setOwnerName("someOwner"); return app; } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/NamespaceBranchServiceTest.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.biz.service; import com.ctrip.framework.apollo.biz.AbstractIntegrationTest; import com.ctrip.framework.apollo.biz.entity.GrayReleaseRule; import com.ctrip.framework.apollo.biz.entity.Namespace; import com.ctrip.framework.apollo.biz.entity.ReleaseHistory; import com.ctrip.framework.apollo.common.constants.NamespaceBranchStatus; import com.ctrip.framework.apollo.common.constants.ReleaseOperation; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.test.context.jdbc.Sql; public class NamespaceBranchServiceTest extends AbstractIntegrationTest { @Autowired private NamespaceBranchService namespaceBranchService; @Autowired private ReleaseHistoryService releaseHistoryService; private String testApp = "test"; private String testCluster = "default"; private String testNamespace = "application"; private String testBranchName = "child-cluster"; private String operator = "apollo"; private Pageable pageable = PageRequest.of(0, 10); @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testFindBranch() { Namespace branch = namespaceBranchService.findBranch(testApp, testCluster, testNamespace); Assert.assertNotNull(branch); Assert.assertEquals(testBranchName, branch.getClusterName()); } @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testUpdateBranchGrayRulesWithUpdateOnce() { GrayReleaseRule rule = instanceGrayReleaseRule(); namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, rule); GrayReleaseRule activeRule = namespaceBranchService.findBranchGrayRules(testApp, testCluster, testNamespace, testBranchName); Assert.assertNotNull(activeRule); Assert.assertEquals(rule.getAppId(), activeRule.getAppId()); Assert.assertEquals(rule.getRules(), activeRule.getRules()); Assert.assertEquals(Long.valueOf(0), activeRule.getReleaseId()); Page<ReleaseHistory> releaseHistories = releaseHistoryService.findReleaseHistoriesByNamespace (testApp, testCluster, testNamespace, pageable); ReleaseHistory releaseHistory = releaseHistories.getContent().get(0); Assert.assertEquals(1, releaseHistories.getTotalElements()); Assert.assertEquals(ReleaseOperation.APPLY_GRAY_RULES, releaseHistory.getOperation()); Assert.assertEquals(0, releaseHistory.getReleaseId()); Assert.assertEquals(0, releaseHistory.getPreviousReleaseId()); Assert.assertTrue(releaseHistory.getOperationContext().contains(rule.getRules())); } @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testUpdateBranchGrayRulesWithUpdateTwice() { GrayReleaseRule firstRule = instanceGrayReleaseRule(); namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, firstRule); GrayReleaseRule secondRule = instanceGrayReleaseRule(); secondRule.setRules("[{\"clientAppId\":\"branch-test\",\"clientIpList\":[\"10.38.57.112\"]}]"); namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, secondRule); GrayReleaseRule activeRule = namespaceBranchService.findBranchGrayRules(testApp, testCluster, testNamespace, testBranchName); Assert.assertNotNull(secondRule); Assert.assertEquals(secondRule.getAppId(), activeRule.getAppId()); Assert.assertEquals(secondRule.getRules(), activeRule.getRules()); Assert.assertEquals(Long.valueOf(0), activeRule.getReleaseId()); Page<ReleaseHistory> releaseHistories = releaseHistoryService.findReleaseHistoriesByNamespace (testApp, testCluster, testNamespace, pageable); ReleaseHistory firstReleaseHistory = releaseHistories.getContent().get(1); ReleaseHistory secondReleaseHistory = releaseHistories.getContent().get(0); Assert.assertEquals(2, releaseHistories.getTotalElements()); Assert.assertEquals(ReleaseOperation.APPLY_GRAY_RULES, firstReleaseHistory.getOperation()); Assert.assertEquals(ReleaseOperation.APPLY_GRAY_RULES, secondReleaseHistory.getOperation()); Assert.assertTrue(firstReleaseHistory.getOperationContext().contains(firstRule.getRules())); Assert.assertFalse(firstReleaseHistory.getOperationContext().contains(secondRule.getRules())); Assert.assertTrue(secondReleaseHistory.getOperationContext().contains(firstRule.getRules())); Assert.assertTrue(secondReleaseHistory.getOperationContext().contains(secondRule.getRules())); } @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testUpdateRulesReleaseIdWithOldRuleNotExist() { long latestReleaseId = 100; namespaceBranchService .updateRulesReleaseId(testApp, testCluster, testNamespace, testBranchName, latestReleaseId, operator); GrayReleaseRule activeRule = namespaceBranchService.findBranchGrayRules(testApp, testCluster, testNamespace, testBranchName); Assert.assertNull(activeRule); } @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testUpdateRulesReleaseIdWithOldRuleExist() { GrayReleaseRule rule = instanceGrayReleaseRule(); namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, rule); long latestReleaseId = 100; namespaceBranchService .updateRulesReleaseId(testApp, testCluster, testNamespace, testBranchName, latestReleaseId, operator); GrayReleaseRule activeRule = namespaceBranchService.findBranchGrayRules(testApp, testCluster, testNamespace, testBranchName); Assert.assertNotNull(activeRule); Assert.assertEquals(Long.valueOf(latestReleaseId), activeRule.getReleaseId()); Assert.assertEquals(rule.getRules(), activeRule.getRules()); Assert.assertEquals(NamespaceBranchStatus.ACTIVE, activeRule.getBranchStatus()); } @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testDeleteBranch() { GrayReleaseRule rule = instanceGrayReleaseRule(); namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, rule); namespaceBranchService.deleteBranch(testApp, testCluster, testNamespace, testBranchName, NamespaceBranchStatus.DELETED, operator); Namespace branch = namespaceBranchService.findBranch(testApp, testCluster, testNamespace); Assert.assertNull(branch); GrayReleaseRule latestRule = namespaceBranchService.findBranchGrayRules(testApp, testCluster, testNamespace, testBranchName); Assert.assertNotNull(latestRule); Assert.assertEquals(NamespaceBranchStatus.DELETED, latestRule.getBranchStatus()); Assert.assertEquals("[]", latestRule.getRules()); Page<ReleaseHistory> releaseHistories = releaseHistoryService.findReleaseHistoriesByNamespace (testApp, testCluster, testNamespace, pageable); ReleaseHistory firstReleaseHistory = releaseHistories.getContent().get(1); ReleaseHistory secondReleaseHistory = releaseHistories.getContent().get(0); Assert.assertEquals(2, releaseHistories.getTotalElements()); Assert.assertEquals(ReleaseOperation.APPLY_GRAY_RULES, firstReleaseHistory.getOperation()); Assert.assertEquals(ReleaseOperation.ABANDON_GRAY_RELEASE, secondReleaseHistory.getOperation()); } private GrayReleaseRule instanceGrayReleaseRule() { GrayReleaseRule rule = new GrayReleaseRule(); rule.setAppId(testApp); rule.setClusterName(testCluster); rule.setNamespaceName(testNamespace); rule.setBranchName(testBranchName); rule.setBranchStatus(NamespaceBranchStatus.ACTIVE); rule.setRules("[{\"clientAppId\":\"test\",\"clientIpList\":[\"1.0.0.4\"]}]"); return rule; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.biz.service; import com.ctrip.framework.apollo.biz.AbstractIntegrationTest; import com.ctrip.framework.apollo.biz.entity.GrayReleaseRule; import com.ctrip.framework.apollo.biz.entity.Namespace; import com.ctrip.framework.apollo.biz.entity.ReleaseHistory; import com.ctrip.framework.apollo.common.constants.NamespaceBranchStatus; import com.ctrip.framework.apollo.common.constants.ReleaseOperation; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.test.context.jdbc.Sql; public class NamespaceBranchServiceTest extends AbstractIntegrationTest { @Autowired private NamespaceBranchService namespaceBranchService; @Autowired private ReleaseHistoryService releaseHistoryService; private String testApp = "test"; private String testCluster = "default"; private String testNamespace = "application"; private String testBranchName = "child-cluster"; private String operator = "apollo"; private Pageable pageable = PageRequest.of(0, 10); @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testFindBranch() { Namespace branch = namespaceBranchService.findBranch(testApp, testCluster, testNamespace); Assert.assertNotNull(branch); Assert.assertEquals(testBranchName, branch.getClusterName()); } @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testUpdateBranchGrayRulesWithUpdateOnce() { GrayReleaseRule rule = instanceGrayReleaseRule(); namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, rule); GrayReleaseRule activeRule = namespaceBranchService.findBranchGrayRules(testApp, testCluster, testNamespace, testBranchName); Assert.assertNotNull(activeRule); Assert.assertEquals(rule.getAppId(), activeRule.getAppId()); Assert.assertEquals(rule.getRules(), activeRule.getRules()); Assert.assertEquals(Long.valueOf(0), activeRule.getReleaseId()); Page<ReleaseHistory> releaseHistories = releaseHistoryService.findReleaseHistoriesByNamespace (testApp, testCluster, testNamespace, pageable); ReleaseHistory releaseHistory = releaseHistories.getContent().get(0); Assert.assertEquals(1, releaseHistories.getTotalElements()); Assert.assertEquals(ReleaseOperation.APPLY_GRAY_RULES, releaseHistory.getOperation()); Assert.assertEquals(0, releaseHistory.getReleaseId()); Assert.assertEquals(0, releaseHistory.getPreviousReleaseId()); Assert.assertTrue(releaseHistory.getOperationContext().contains(rule.getRules())); } @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testUpdateBranchGrayRulesWithUpdateTwice() { GrayReleaseRule firstRule = instanceGrayReleaseRule(); namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, firstRule); GrayReleaseRule secondRule = instanceGrayReleaseRule(); secondRule.setRules("[{\"clientAppId\":\"branch-test\",\"clientIpList\":[\"10.38.57.112\"]}]"); namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, secondRule); GrayReleaseRule activeRule = namespaceBranchService.findBranchGrayRules(testApp, testCluster, testNamespace, testBranchName); Assert.assertNotNull(secondRule); Assert.assertEquals(secondRule.getAppId(), activeRule.getAppId()); Assert.assertEquals(secondRule.getRules(), activeRule.getRules()); Assert.assertEquals(Long.valueOf(0), activeRule.getReleaseId()); Page<ReleaseHistory> releaseHistories = releaseHistoryService.findReleaseHistoriesByNamespace (testApp, testCluster, testNamespace, pageable); ReleaseHistory firstReleaseHistory = releaseHistories.getContent().get(1); ReleaseHistory secondReleaseHistory = releaseHistories.getContent().get(0); Assert.assertEquals(2, releaseHistories.getTotalElements()); Assert.assertEquals(ReleaseOperation.APPLY_GRAY_RULES, firstReleaseHistory.getOperation()); Assert.assertEquals(ReleaseOperation.APPLY_GRAY_RULES, secondReleaseHistory.getOperation()); Assert.assertTrue(firstReleaseHistory.getOperationContext().contains(firstRule.getRules())); Assert.assertFalse(firstReleaseHistory.getOperationContext().contains(secondRule.getRules())); Assert.assertTrue(secondReleaseHistory.getOperationContext().contains(firstRule.getRules())); Assert.assertTrue(secondReleaseHistory.getOperationContext().contains(secondRule.getRules())); } @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testUpdateRulesReleaseIdWithOldRuleNotExist() { long latestReleaseId = 100; namespaceBranchService .updateRulesReleaseId(testApp, testCluster, testNamespace, testBranchName, latestReleaseId, operator); GrayReleaseRule activeRule = namespaceBranchService.findBranchGrayRules(testApp, testCluster, testNamespace, testBranchName); Assert.assertNull(activeRule); } @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testUpdateRulesReleaseIdWithOldRuleExist() { GrayReleaseRule rule = instanceGrayReleaseRule(); namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, rule); long latestReleaseId = 100; namespaceBranchService .updateRulesReleaseId(testApp, testCluster, testNamespace, testBranchName, latestReleaseId, operator); GrayReleaseRule activeRule = namespaceBranchService.findBranchGrayRules(testApp, testCluster, testNamespace, testBranchName); Assert.assertNotNull(activeRule); Assert.assertEquals(Long.valueOf(latestReleaseId), activeRule.getReleaseId()); Assert.assertEquals(rule.getRules(), activeRule.getRules()); Assert.assertEquals(NamespaceBranchStatus.ACTIVE, activeRule.getBranchStatus()); } @Test @Sql(scripts = "/sql/namespace-branch-test.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testDeleteBranch() { GrayReleaseRule rule = instanceGrayReleaseRule(); namespaceBranchService.updateBranchGrayRules(testApp, testCluster, testNamespace, testBranchName, rule); namespaceBranchService.deleteBranch(testApp, testCluster, testNamespace, testBranchName, NamespaceBranchStatus.DELETED, operator); Namespace branch = namespaceBranchService.findBranch(testApp, testCluster, testNamespace); Assert.assertNull(branch); GrayReleaseRule latestRule = namespaceBranchService.findBranchGrayRules(testApp, testCluster, testNamespace, testBranchName); Assert.assertNotNull(latestRule); Assert.assertEquals(NamespaceBranchStatus.DELETED, latestRule.getBranchStatus()); Assert.assertEquals("[]", latestRule.getRules()); Page<ReleaseHistory> releaseHistories = releaseHistoryService.findReleaseHistoriesByNamespace (testApp, testCluster, testNamespace, pageable); ReleaseHistory firstReleaseHistory = releaseHistories.getContent().get(1); ReleaseHistory secondReleaseHistory = releaseHistories.getContent().get(0); Assert.assertEquals(2, releaseHistories.getTotalElements()); Assert.assertEquals(ReleaseOperation.APPLY_GRAY_RULES, firstReleaseHistory.getOperation()); Assert.assertEquals(ReleaseOperation.ABANDON_GRAY_RELEASE, secondReleaseHistory.getOperation()); } private GrayReleaseRule instanceGrayReleaseRule() { GrayReleaseRule rule = new GrayReleaseRule(); rule.setAppId(testApp); rule.setClusterName(testCluster); rule.setNamespaceName(testNamespace); rule.setBranchName(testBranchName); rule.setBranchStatus(NamespaceBranchStatus.ACTIVE); rule.setRules("[{\"clientAppId\":\"test\",\"clientIpList\":[\"1.0.0.4\"]}]"); return rule; } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-client/src/test/java/com/ctrip/framework/apollo/spi/DefaultConfigFactoryTest.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.spi; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import com.ctrip.framework.apollo.internals.PropertiesCompatibleFileConfigRepository; import java.util.Properties; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.springframework.test.util.ReflectionTestUtils; import com.ctrip.framework.apollo.Config; import com.ctrip.framework.apollo.ConfigFile; import com.ctrip.framework.apollo.build.MockInjector; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.internals.DefaultConfig; import com.ctrip.framework.apollo.internals.JsonConfigFile; import com.ctrip.framework.apollo.internals.LocalFileConfigRepository; import com.ctrip.framework.apollo.internals.PropertiesConfigFile; import com.ctrip.framework.apollo.internals.XmlConfigFile; import com.ctrip.framework.apollo.internals.YamlConfigFile; import com.ctrip.framework.apollo.internals.YmlConfigFile; import com.ctrip.framework.apollo.util.ConfigUtil; /** * @author Jason Song(song_s@ctrip.com) */ public class DefaultConfigFactoryTest { private DefaultConfigFactory defaultConfigFactory; private static String someAppId; private static Env someEnv; @Before public void setUp() throws Exception { someAppId = "someId"; someEnv = Env.DEV; MockInjector.setInstance(ConfigUtil.class, new MockConfigUtil()); defaultConfigFactory = spy(new DefaultConfigFactory()); } @After public void tearDown() throws Exception { MockInjector.reset(); } @Test public void testCreate() throws Exception { String someNamespace = "someName"; Properties someProperties = new Properties(); String someKey = "someKey"; String someValue = "someValue"; someProperties.setProperty(someKey, someValue); LocalFileConfigRepository someLocalConfigRepo = mock(LocalFileConfigRepository.class); when(someLocalConfigRepo.getConfig()).thenReturn(someProperties); doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(someNamespace); Config result = defaultConfigFactory.create(someNamespace); assertThat("DefaultConfigFactory should create DefaultConfig", result, is(instanceOf(DefaultConfig.class))); assertEquals(someValue, result.getProperty(someKey, null)); } @Test public void testCreateLocalConfigRepositoryInLocalDev() throws Exception { String someNamespace = "someName"; someEnv = Env.LOCAL; LocalFileConfigRepository localFileConfigRepository = defaultConfigFactory.createLocalConfigRepository(someNamespace); assertNull(ReflectionTestUtils.getField(localFileConfigRepository, "m_upstream")); } @Test public void testCreatePropertiesCompatibleFileConfigRepository() throws Exception { ConfigFileFormat somePropertiesCompatibleFormat = ConfigFileFormat.YML; String someNamespace = "someName" + "." + somePropertiesCompatibleFormat; Properties someProperties = new Properties(); String someKey = "someKey"; String someValue = "someValue"; someProperties.setProperty(someKey, someValue); PropertiesCompatibleFileConfigRepository someRepository = mock(PropertiesCompatibleFileConfigRepository.class); when(someRepository.getConfig()).thenReturn(someProperties); doReturn(someRepository).when(defaultConfigFactory) .createPropertiesCompatibleFileConfigRepository(someNamespace, somePropertiesCompatibleFormat); Config result = defaultConfigFactory.create(someNamespace); assertThat("DefaultConfigFactory should create DefaultConfig", result, is(instanceOf(DefaultConfig.class))); assertEquals(someValue, result.getProperty(someKey, null)); } @Test public void testCreateConfigFile() throws Exception { String someNamespace = "someName"; String anotherNamespace = "anotherName"; String yetAnotherNamespace = "yetAnotherNamespace"; Properties someProperties = new Properties(); LocalFileConfigRepository someLocalConfigRepo = mock(LocalFileConfigRepository.class); when(someLocalConfigRepo.getConfig()).thenReturn(someProperties); doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(someNamespace); doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(anotherNamespace); doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(yetAnotherNamespace); ConfigFile propertyConfigFile = defaultConfigFactory.createConfigFile(someNamespace, ConfigFileFormat.Properties); ConfigFile xmlConfigFile = defaultConfigFactory.createConfigFile(anotherNamespace, ConfigFileFormat.XML); ConfigFile jsonConfigFile = defaultConfigFactory.createConfigFile(yetAnotherNamespace, ConfigFileFormat.JSON); ConfigFile ymlConfigFile = defaultConfigFactory.createConfigFile(someNamespace, ConfigFileFormat.YML); ConfigFile yamlConfigFile = defaultConfigFactory.createConfigFile(someNamespace, ConfigFileFormat.YAML); assertThat("Should create PropertiesConfigFile for properties format", propertyConfigFile, is(instanceOf( PropertiesConfigFile.class))); assertEquals(someNamespace, propertyConfigFile.getNamespace()); assertThat("Should create XmlConfigFile for xml format", xmlConfigFile, is(instanceOf( XmlConfigFile.class))); assertEquals(anotherNamespace, xmlConfigFile.getNamespace()); assertThat("Should create JsonConfigFile for json format", jsonConfigFile, is(instanceOf( JsonConfigFile.class))); assertEquals(yetAnotherNamespace, jsonConfigFile.getNamespace()); assertThat("Should create YmlConfigFile for yml format", ymlConfigFile, is(instanceOf( YmlConfigFile.class))); assertEquals(someNamespace, ymlConfigFile.getNamespace()); assertThat("Should create YamlConfigFile for yaml format", yamlConfigFile, is(instanceOf( YamlConfigFile.class))); assertEquals(someNamespace, yamlConfigFile.getNamespace()); } @Test public void testDetermineFileFormat() throws Exception { checkFileFormat("abc", ConfigFileFormat.Properties); checkFileFormat("abc.properties", ConfigFileFormat.Properties); checkFileFormat("abc.pRopErties", ConfigFileFormat.Properties); checkFileFormat("abc.xml", ConfigFileFormat.XML); checkFileFormat("abc.xmL", ConfigFileFormat.XML); checkFileFormat("abc.json", ConfigFileFormat.JSON); checkFileFormat("abc.jsOn", ConfigFileFormat.JSON); checkFileFormat("abc.yaml", ConfigFileFormat.YAML); checkFileFormat("abc.yAml", ConfigFileFormat.YAML); checkFileFormat("abc.yml", ConfigFileFormat.YML); checkFileFormat("abc.yMl", ConfigFileFormat.YML); checkFileFormat("abc.properties.yml", ConfigFileFormat.YML); } @Test public void testTrimNamespaceFormat() throws Exception { checkNamespaceName("abc", ConfigFileFormat.Properties, "abc"); checkNamespaceName("abc.properties", ConfigFileFormat.Properties, "abc"); checkNamespaceName("abcproperties", ConfigFileFormat.Properties, "abcproperties"); checkNamespaceName("abc.pRopErties", ConfigFileFormat.Properties, "abc"); checkNamespaceName("abc.xml", ConfigFileFormat.XML, "abc"); checkNamespaceName("abc.xmL", ConfigFileFormat.XML, "abc"); checkNamespaceName("abc.json", ConfigFileFormat.JSON, "abc"); checkNamespaceName("abc.jsOn", ConfigFileFormat.JSON, "abc"); checkNamespaceName("abc.yaml", ConfigFileFormat.YAML, "abc"); checkNamespaceName("abc.yAml", ConfigFileFormat.YAML, "abc"); checkNamespaceName("abc.yml", ConfigFileFormat.YML, "abc"); checkNamespaceName("abc.yMl", ConfigFileFormat.YML, "abc"); checkNamespaceName("abc.proPerties.yml", ConfigFileFormat.YML, "abc.proPerties"); } private void checkFileFormat(String namespaceName, ConfigFileFormat expectedFormat) { assertEquals(expectedFormat, defaultConfigFactory.determineFileFormat(namespaceName)); } private void checkNamespaceName(String namespaceName, ConfigFileFormat format, String expectedNamespaceName) { assertEquals(expectedNamespaceName, defaultConfigFactory.trimNamespaceFormat(namespaceName, format)); } public static class MockConfigUtil extends ConfigUtil { @Override public String getAppId() { return someAppId; } @Override public Env getApolloEnv() { return someEnv; } } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.spi; import static org.hamcrest.core.Is.is; import static org.hamcrest.core.IsInstanceOf.instanceOf; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import com.ctrip.framework.apollo.internals.PropertiesCompatibleFileConfigRepository; import java.util.Properties; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.springframework.test.util.ReflectionTestUtils; import com.ctrip.framework.apollo.Config; import com.ctrip.framework.apollo.ConfigFile; import com.ctrip.framework.apollo.build.MockInjector; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; import com.ctrip.framework.apollo.core.enums.Env; import com.ctrip.framework.apollo.internals.DefaultConfig; import com.ctrip.framework.apollo.internals.JsonConfigFile; import com.ctrip.framework.apollo.internals.LocalFileConfigRepository; import com.ctrip.framework.apollo.internals.PropertiesConfigFile; import com.ctrip.framework.apollo.internals.XmlConfigFile; import com.ctrip.framework.apollo.internals.YamlConfigFile; import com.ctrip.framework.apollo.internals.YmlConfigFile; import com.ctrip.framework.apollo.util.ConfigUtil; /** * @author Jason Song(song_s@ctrip.com) */ public class DefaultConfigFactoryTest { private DefaultConfigFactory defaultConfigFactory; private static String someAppId; private static Env someEnv; @Before public void setUp() throws Exception { someAppId = "someId"; someEnv = Env.DEV; MockInjector.setInstance(ConfigUtil.class, new MockConfigUtil()); defaultConfigFactory = spy(new DefaultConfigFactory()); } @After public void tearDown() throws Exception { MockInjector.reset(); } @Test public void testCreate() throws Exception { String someNamespace = "someName"; Properties someProperties = new Properties(); String someKey = "someKey"; String someValue = "someValue"; someProperties.setProperty(someKey, someValue); LocalFileConfigRepository someLocalConfigRepo = mock(LocalFileConfigRepository.class); when(someLocalConfigRepo.getConfig()).thenReturn(someProperties); doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(someNamespace); Config result = defaultConfigFactory.create(someNamespace); assertThat("DefaultConfigFactory should create DefaultConfig", result, is(instanceOf(DefaultConfig.class))); assertEquals(someValue, result.getProperty(someKey, null)); } @Test public void testCreateLocalConfigRepositoryInLocalDev() throws Exception { String someNamespace = "someName"; someEnv = Env.LOCAL; LocalFileConfigRepository localFileConfigRepository = defaultConfigFactory.createLocalConfigRepository(someNamespace); assertNull(ReflectionTestUtils.getField(localFileConfigRepository, "m_upstream")); } @Test public void testCreatePropertiesCompatibleFileConfigRepository() throws Exception { ConfigFileFormat somePropertiesCompatibleFormat = ConfigFileFormat.YML; String someNamespace = "someName" + "." + somePropertiesCompatibleFormat; Properties someProperties = new Properties(); String someKey = "someKey"; String someValue = "someValue"; someProperties.setProperty(someKey, someValue); PropertiesCompatibleFileConfigRepository someRepository = mock(PropertiesCompatibleFileConfigRepository.class); when(someRepository.getConfig()).thenReturn(someProperties); doReturn(someRepository).when(defaultConfigFactory) .createPropertiesCompatibleFileConfigRepository(someNamespace, somePropertiesCompatibleFormat); Config result = defaultConfigFactory.create(someNamespace); assertThat("DefaultConfigFactory should create DefaultConfig", result, is(instanceOf(DefaultConfig.class))); assertEquals(someValue, result.getProperty(someKey, null)); } @Test public void testCreateConfigFile() throws Exception { String someNamespace = "someName"; String anotherNamespace = "anotherName"; String yetAnotherNamespace = "yetAnotherNamespace"; Properties someProperties = new Properties(); LocalFileConfigRepository someLocalConfigRepo = mock(LocalFileConfigRepository.class); when(someLocalConfigRepo.getConfig()).thenReturn(someProperties); doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(someNamespace); doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(anotherNamespace); doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(yetAnotherNamespace); ConfigFile propertyConfigFile = defaultConfigFactory.createConfigFile(someNamespace, ConfigFileFormat.Properties); ConfigFile xmlConfigFile = defaultConfigFactory.createConfigFile(anotherNamespace, ConfigFileFormat.XML); ConfigFile jsonConfigFile = defaultConfigFactory.createConfigFile(yetAnotherNamespace, ConfigFileFormat.JSON); ConfigFile ymlConfigFile = defaultConfigFactory.createConfigFile(someNamespace, ConfigFileFormat.YML); ConfigFile yamlConfigFile = defaultConfigFactory.createConfigFile(someNamespace, ConfigFileFormat.YAML); assertThat("Should create PropertiesConfigFile for properties format", propertyConfigFile, is(instanceOf( PropertiesConfigFile.class))); assertEquals(someNamespace, propertyConfigFile.getNamespace()); assertThat("Should create XmlConfigFile for xml format", xmlConfigFile, is(instanceOf( XmlConfigFile.class))); assertEquals(anotherNamespace, xmlConfigFile.getNamespace()); assertThat("Should create JsonConfigFile for json format", jsonConfigFile, is(instanceOf( JsonConfigFile.class))); assertEquals(yetAnotherNamespace, jsonConfigFile.getNamespace()); assertThat("Should create YmlConfigFile for yml format", ymlConfigFile, is(instanceOf( YmlConfigFile.class))); assertEquals(someNamespace, ymlConfigFile.getNamespace()); assertThat("Should create YamlConfigFile for yaml format", yamlConfigFile, is(instanceOf( YamlConfigFile.class))); assertEquals(someNamespace, yamlConfigFile.getNamespace()); } @Test public void testDetermineFileFormat() throws Exception { checkFileFormat("abc", ConfigFileFormat.Properties); checkFileFormat("abc.properties", ConfigFileFormat.Properties); checkFileFormat("abc.pRopErties", ConfigFileFormat.Properties); checkFileFormat("abc.xml", ConfigFileFormat.XML); checkFileFormat("abc.xmL", ConfigFileFormat.XML); checkFileFormat("abc.json", ConfigFileFormat.JSON); checkFileFormat("abc.jsOn", ConfigFileFormat.JSON); checkFileFormat("abc.yaml", ConfigFileFormat.YAML); checkFileFormat("abc.yAml", ConfigFileFormat.YAML); checkFileFormat("abc.yml", ConfigFileFormat.YML); checkFileFormat("abc.yMl", ConfigFileFormat.YML); checkFileFormat("abc.properties.yml", ConfigFileFormat.YML); } @Test public void testTrimNamespaceFormat() throws Exception { checkNamespaceName("abc", ConfigFileFormat.Properties, "abc"); checkNamespaceName("abc.properties", ConfigFileFormat.Properties, "abc"); checkNamespaceName("abcproperties", ConfigFileFormat.Properties, "abcproperties"); checkNamespaceName("abc.pRopErties", ConfigFileFormat.Properties, "abc"); checkNamespaceName("abc.xml", ConfigFileFormat.XML, "abc"); checkNamespaceName("abc.xmL", ConfigFileFormat.XML, "abc"); checkNamespaceName("abc.json", ConfigFileFormat.JSON, "abc"); checkNamespaceName("abc.jsOn", ConfigFileFormat.JSON, "abc"); checkNamespaceName("abc.yaml", ConfigFileFormat.YAML, "abc"); checkNamespaceName("abc.yAml", ConfigFileFormat.YAML, "abc"); checkNamespaceName("abc.yml", ConfigFileFormat.YML, "abc"); checkNamespaceName("abc.yMl", ConfigFileFormat.YML, "abc"); checkNamespaceName("abc.proPerties.yml", ConfigFileFormat.YML, "abc.proPerties"); } private void checkFileFormat(String namespaceName, ConfigFileFormat expectedFormat) { assertEquals(expectedFormat, defaultConfigFactory.determineFileFormat(namespaceName)); } private void checkNamespaceName(String namespaceName, ConfigFileFormat format, String expectedNamespaceName) { assertEquals(expectedNamespaceName, defaultConfigFactory.trimNamespaceFormat(namespaceName, format)); } public static class MockConfigUtil extends ConfigUtil { @Override public String getAppId() { return someAppId; } @Override public Env getApolloEnv() { return someEnv; } } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/PageDTO.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.common.dto; import org.springframework.data.domain.Pageable; import java.util.Collections; import java.util.List; /** * @author Jason Song(song_s@ctrip.com) */ public class PageDTO<T> { private final long total; private final List<T> content; private final int page; private final int size; public PageDTO(List<T> content, Pageable pageable, long total) { this.total = total; this.content = content; this.page = pageable.getPageNumber(); this.size = pageable.getPageSize(); } public long getTotal() { return total; } public List<T> getContent() { return Collections.unmodifiableList(content); } public int getPage() { return page; } public int getSize() { return size; } public boolean hasContent(){ return content != null && content.size() > 0; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.common.dto; import org.springframework.data.domain.Pageable; import java.util.Collections; import java.util.List; /** * @author Jason Song(song_s@ctrip.com) */ public class PageDTO<T> { private final long total; private final List<T> content; private final int page; private final int size; public PageDTO(List<T> content, Pageable pageable, long total) { this.total = total; this.content = content; this.page = pageable.getPageNumber(); this.size = pageable.getPageSize(); } public long getTotal() { return total; } public List<T> getContent() { return Collections.unmodifiableList(content); } public int getPage() { return page; } public int getSize() { return size; } public boolean hasContent(){ return content != null && content.size() > 0; } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-client/src/main/java/com/ctrip/framework/apollo/ConfigFileChangeListener.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo; import com.ctrip.framework.apollo.model.ConfigFileChangeEvent; /** * @author Jason Song(song_s@ctrip.com) */ public interface ConfigFileChangeListener { /** * Invoked when there is any config change for the namespace. * @param changeEvent the event for this change */ void onChange(ConfigFileChangeEvent changeEvent); }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo; import com.ctrip.framework.apollo.model.ConfigFileChangeEvent; /** * @author Jason Song(song_s@ctrip.com) */ public interface ConfigFileChangeListener { /** * Invoked when there is any config change for the namespace. * @param changeEvent the event for this change */ void onChange(ConfigFileChangeEvent changeEvent); }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-core/src/test/java/com/ctrip/framework/apollo/core/signature/HmacSha1UtilsTest.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.core.signature; import static org.junit.Assert.assertEquals; import org.junit.Test; /** * @author nisiyong */ public class HmacSha1UtilsTest { @Test public void testSignString() { String stringToSign = "1576478257344\n/configs/100004458/default/application?ip=10.0.0.1"; String accessKeySecret = "df23df3f59884980844ff3dada30fa97"; String actualSignature = HmacSha1Utils.signString(stringToSign, accessKeySecret); String expectedSignature = "EoKyziXvKqzHgwx+ijDJwgVTDgE="; assertEquals(expectedSignature, actualSignature); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.core.signature; import static org.junit.Assert.assertEquals; import org.junit.Test; /** * @author nisiyong */ public class HmacSha1UtilsTest { @Test public void testSignString() { String stringToSign = "1576478257344\n/configs/100004458/default/application?ip=10.0.0.1"; String accessKeySecret = "df23df3f59884980844ff3dada30fa97"; String actualSignature = HmacSha1Utils.signString(stringToSign, accessKeySecret); String expectedSignature = "EoKyziXvKqzHgwx+ijDJwgVTDgE="; assertEquals(expectedSignature, actualSignature); } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-common/src/main/java/com/ctrip/framework/apollo/common/constants/ReleaseOperation.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.common.constants; /** * @author Jason Song(song_s@ctrip.com) */ public interface ReleaseOperation { int NORMAL_RELEASE = 0; int ROLLBACK = 1; int GRAY_RELEASE = 2; int APPLY_GRAY_RULES = 3; int GRAY_RELEASE_MERGE_TO_MASTER = 4; int MASTER_NORMAL_RELEASE_MERGE_TO_GRAY = 5; int MATER_ROLLBACK_MERGE_TO_GRAY = 6; int ABANDON_GRAY_RELEASE = 7; int GRAY_RELEASE_DELETED_AFTER_MERGE = 8; }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.common.constants; /** * @author Jason Song(song_s@ctrip.com) */ public interface ReleaseOperation { int NORMAL_RELEASE = 0; int ROLLBACK = 1; int GRAY_RELEASE = 2; int APPLY_GRAY_RULES = 3; int GRAY_RELEASE_MERGE_TO_MASTER = 4; int MASTER_NORMAL_RELEASE_MERGE_TO_GRAY = 5; int MATER_ROLLBACK_MERGE_TO_GRAY = 6; int ABANDON_GRAY_RELEASE = 7; int GRAY_RELEASE_DELETED_AFTER_MERGE = 8; }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/SpringValueDefinitionProcessor.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.spring.property; import com.ctrip.framework.apollo.spring.util.SpringInjector; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import java.util.List; import java.util.Map; import java.util.Set; import org.springframework.beans.BeansException; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.PropertyValue; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.TypedStringValue; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; import com.ctrip.framework.apollo.build.ApolloInjector; import com.ctrip.framework.apollo.util.ConfigUtil; import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Multimap; /** * To process xml config placeholders, e.g. * * <pre> * &lt;bean class=&quot;com.ctrip.framework.apollo.demo.spring.xmlConfigDemo.bean.XmlBean&quot;&gt; * &lt;property name=&quot;timeout&quot; value=&quot;${timeout:200}&quot;/&gt; * &lt;property name=&quot;batch&quot; value=&quot;${batch:100}&quot;/&gt; * &lt;/bean&gt; * </pre> */ public class SpringValueDefinitionProcessor implements BeanDefinitionRegistryPostProcessor { private static final Map<BeanDefinitionRegistry, Multimap<String, SpringValueDefinition>> beanName2SpringValueDefinitions = Maps.newConcurrentMap(); private static final Set<BeanDefinitionRegistry> PROPERTY_VALUES_PROCESSED_BEAN_FACTORIES = Sets.newConcurrentHashSet(); private final ConfigUtil configUtil; private final PlaceholderHelper placeholderHelper; public SpringValueDefinitionProcessor() { configUtil = ApolloInjector.getInstance(ConfigUtil.class); placeholderHelper = SpringInjector.getInstance(PlaceholderHelper.class); } @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { if (configUtil.isAutoUpdateInjectedSpringPropertiesEnabled()) { processPropertyValues(registry); } } @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { } public static Multimap<String, SpringValueDefinition> getBeanName2SpringValueDefinitions(BeanDefinitionRegistry registry) { Multimap<String, SpringValueDefinition> springValueDefinitions = beanName2SpringValueDefinitions.get(registry); if (springValueDefinitions == null) { springValueDefinitions = LinkedListMultimap.create(); } return springValueDefinitions; } private void processPropertyValues(BeanDefinitionRegistry beanRegistry) { if (!PROPERTY_VALUES_PROCESSED_BEAN_FACTORIES.add(beanRegistry)) { // already initialized return; } if (!beanName2SpringValueDefinitions.containsKey(beanRegistry)) { beanName2SpringValueDefinitions.put(beanRegistry, LinkedListMultimap.<String, SpringValueDefinition>create()); } Multimap<String, SpringValueDefinition> springValueDefinitions = beanName2SpringValueDefinitions.get(beanRegistry); String[] beanNames = beanRegistry.getBeanDefinitionNames(); for (String beanName : beanNames) { BeanDefinition beanDefinition = beanRegistry.getBeanDefinition(beanName); MutablePropertyValues mutablePropertyValues = beanDefinition.getPropertyValues(); List<PropertyValue> propertyValues = mutablePropertyValues.getPropertyValueList(); for (PropertyValue propertyValue : propertyValues) { Object value = propertyValue.getValue(); if (!(value instanceof TypedStringValue)) { continue; } String placeholder = ((TypedStringValue) value).getValue(); Set<String> keys = placeholderHelper.extractPlaceholderKeys(placeholder); if (keys.isEmpty()) { continue; } for (String key : keys) { springValueDefinitions.put(beanName, new SpringValueDefinition(key, placeholder, propertyValue.getName())); } } } } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.spring.property; import com.ctrip.framework.apollo.spring.util.SpringInjector; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import java.util.List; import java.util.Map; import java.util.Set; import org.springframework.beans.BeansException; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.PropertyValue; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.TypedStringValue; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor; import com.ctrip.framework.apollo.build.ApolloInjector; import com.ctrip.framework.apollo.util.ConfigUtil; import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Multimap; /** * To process xml config placeholders, e.g. * * <pre> * &lt;bean class=&quot;com.ctrip.framework.apollo.demo.spring.xmlConfigDemo.bean.XmlBean&quot;&gt; * &lt;property name=&quot;timeout&quot; value=&quot;${timeout:200}&quot;/&gt; * &lt;property name=&quot;batch&quot; value=&quot;${batch:100}&quot;/&gt; * &lt;/bean&gt; * </pre> */ public class SpringValueDefinitionProcessor implements BeanDefinitionRegistryPostProcessor { private static final Map<BeanDefinitionRegistry, Multimap<String, SpringValueDefinition>> beanName2SpringValueDefinitions = Maps.newConcurrentMap(); private static final Set<BeanDefinitionRegistry> PROPERTY_VALUES_PROCESSED_BEAN_FACTORIES = Sets.newConcurrentHashSet(); private final ConfigUtil configUtil; private final PlaceholderHelper placeholderHelper; public SpringValueDefinitionProcessor() { configUtil = ApolloInjector.getInstance(ConfigUtil.class); placeholderHelper = SpringInjector.getInstance(PlaceholderHelper.class); } @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { if (configUtil.isAutoUpdateInjectedSpringPropertiesEnabled()) { processPropertyValues(registry); } } @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { } public static Multimap<String, SpringValueDefinition> getBeanName2SpringValueDefinitions(BeanDefinitionRegistry registry) { Multimap<String, SpringValueDefinition> springValueDefinitions = beanName2SpringValueDefinitions.get(registry); if (springValueDefinitions == null) { springValueDefinitions = LinkedListMultimap.create(); } return springValueDefinitions; } private void processPropertyValues(BeanDefinitionRegistry beanRegistry) { if (!PROPERTY_VALUES_PROCESSED_BEAN_FACTORIES.add(beanRegistry)) { // already initialized return; } if (!beanName2SpringValueDefinitions.containsKey(beanRegistry)) { beanName2SpringValueDefinitions.put(beanRegistry, LinkedListMultimap.<String, SpringValueDefinition>create()); } Multimap<String, SpringValueDefinition> springValueDefinitions = beanName2SpringValueDefinitions.get(beanRegistry); String[] beanNames = beanRegistry.getBeanDefinitionNames(); for (String beanName : beanNames) { BeanDefinition beanDefinition = beanRegistry.getBeanDefinition(beanName); MutablePropertyValues mutablePropertyValues = beanDefinition.getPropertyValues(); List<PropertyValue> propertyValues = mutablePropertyValues.getPropertyValueList(); for (PropertyValue propertyValue : propertyValues) { Object value = propertyValue.getValue(); if (!(value instanceof TypedStringValue)) { continue; } String placeholder = ((TypedStringValue) value).getValue(); Set<String> keys = placeholderHelper.extractPlaceholderKeys(placeholder); if (keys.isEmpty()) { continue; } for (String key : keys) { springValueDefinitions.put(beanName, new SpringValueDefinition(key, placeholder, propertyValue.getName())); } } } } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/model/NamespaceGrayDelReleaseModel.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.entity.model; import java.util.Set; public class NamespaceGrayDelReleaseModel extends NamespaceReleaseModel implements Verifiable { private Set<String> grayDelKeys; public Set<String> getGrayDelKeys() { return grayDelKeys; } public void setGrayDelKeys(Set<String> grayDelKeys) { this.grayDelKeys = grayDelKeys; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.entity.model; import java.util.Set; public class NamespaceGrayDelReleaseModel extends NamespaceReleaseModel implements Verifiable { private Set<String> grayDelKeys; public Set<String> getGrayDelKeys() { return grayDelKeys; } public void setGrayDelKeys(Set<String> grayDelKeys) { this.grayDelKeys = grayDelKeys; } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/AuthFilterConfiguration.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.spi.configuration; import com.ctrip.framework.apollo.openapi.filter.ConsumerAuthenticationFilter; import com.ctrip.framework.apollo.openapi.util.ConsumerAuditUtil; import com.ctrip.framework.apollo.openapi.util.ConsumerAuthUtil; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class AuthFilterConfiguration { @Bean public FilterRegistrationBean openApiAuthenticationFilter(ConsumerAuthUtil consumerAuthUtil, ConsumerAuditUtil consumerAuditUtil) { FilterRegistrationBean openApiFilter = new FilterRegistrationBean(); openApiFilter.setFilter(new ConsumerAuthenticationFilter(consumerAuthUtil, consumerAuditUtil)); openApiFilter.addUrlPatterns("/openapi/*"); return openApiFilter; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.spi.configuration; import com.ctrip.framework.apollo.openapi.filter.ConsumerAuthenticationFilter; import com.ctrip.framework.apollo.openapi.util.ConsumerAuditUtil; import com.ctrip.framework.apollo.openapi.util.ConsumerAuthUtil; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class AuthFilterConfiguration { @Bean public FilterRegistrationBean openApiAuthenticationFilter(ConsumerAuthUtil consumerAuthUtil, ConsumerAuditUtil consumerAuditUtil) { FilterRegistrationBean openApiFilter = new FilterRegistrationBean(); openApiFilter.setFilter(new ConsumerAuthenticationFilter(consumerAuthUtil, consumerAuditUtil)); openApiFilter.addUrlPatterns("/openapi/*"); return openApiFilter; } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-client/src/test/java/com/ctrip/framework/apollo/internals/JsonConfigFileTest.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.internals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; import com.ctrip.framework.apollo.enums.ConfigSourceType; import java.util.Properties; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; /** * @author Jason Song(song_s@ctrip.com) */ @RunWith(MockitoJUnitRunner.class) public class JsonConfigFileTest { private String someNamespace; @Mock private ConfigRepository configRepository; private ConfigSourceType someSourceType; @Before public void setUp() throws Exception { someNamespace = "someName"; } @Test public void testWhenHasContent() throws Exception { Properties someProperties = new Properties(); String key = ConfigConsts.CONFIG_FILE_CONTENT_KEY; String someValue = "someValue"; someProperties.setProperty(key, someValue); someSourceType = ConfigSourceType.LOCAL; when(configRepository.getConfig()).thenReturn(someProperties); when(configRepository.getSourceType()).thenReturn(someSourceType); JsonConfigFile configFile = new JsonConfigFile(someNamespace, configRepository); assertEquals(ConfigFileFormat.JSON, configFile.getConfigFileFormat()); assertEquals(someNamespace, configFile.getNamespace()); assertTrue(configFile.hasContent()); assertEquals(someValue, configFile.getContent()); assertEquals(someSourceType, configFile.getSourceType()); } @Test public void testWhenHasNoContent() throws Exception { when(configRepository.getConfig()).thenReturn(null); JsonConfigFile configFile = new JsonConfigFile(someNamespace, configRepository); assertFalse(configFile.hasContent()); assertNull(configFile.getContent()); } @Test public void testWhenConfigRepositoryHasError() throws Exception { when(configRepository.getConfig()).thenThrow(new RuntimeException("someError")); JsonConfigFile configFile = new JsonConfigFile(someNamespace, configRepository); assertFalse(configFile.hasContent()); assertNull(configFile.getContent()); assertEquals(ConfigSourceType.NONE, configFile.getSourceType()); } @Test public void testOnRepositoryChange() throws Exception { Properties someProperties = new Properties(); String key = ConfigConsts.CONFIG_FILE_CONTENT_KEY; String someValue = "someValue"; String anotherValue = "anotherValue"; someProperties.setProperty(key, someValue); someSourceType = ConfigSourceType.LOCAL; when(configRepository.getConfig()).thenReturn(someProperties); when(configRepository.getSourceType()).thenReturn(someSourceType); JsonConfigFile configFile = new JsonConfigFile(someNamespace, configRepository); assertEquals(someValue, configFile.getContent()); assertEquals(someSourceType, configFile.getSourceType()); Properties anotherProperties = new Properties(); anotherProperties.setProperty(key, anotherValue); ConfigSourceType anotherSourceType = ConfigSourceType.REMOTE; when(configRepository.getSourceType()).thenReturn(anotherSourceType); configFile.onRepositoryChange(someNamespace, anotherProperties); assertEquals(anotherValue, configFile.getContent()); assertEquals(anotherSourceType, configFile.getSourceType()); } @Test public void testWhenConfigRepositoryHasErrorAndThenRecovered() throws Exception { Properties someProperties = new Properties(); String key = ConfigConsts.CONFIG_FILE_CONTENT_KEY; String someValue = "someValue"; someProperties.setProperty(key, someValue); someSourceType = ConfigSourceType.LOCAL; when(configRepository.getConfig()).thenThrow(new RuntimeException("someError")); when(configRepository.getSourceType()).thenReturn(someSourceType); JsonConfigFile configFile = new JsonConfigFile(someNamespace, configRepository); assertFalse(configFile.hasContent()); assertNull(configFile.getContent()); assertEquals(ConfigSourceType.NONE, configFile.getSourceType()); configFile.onRepositoryChange(someNamespace, someProperties); assertTrue(configFile.hasContent()); assertEquals(someValue, configFile.getContent()); assertEquals(someSourceType, configFile.getSourceType()); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.internals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; import com.ctrip.framework.apollo.enums.ConfigSourceType; import java.util.Properties; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import com.ctrip.framework.apollo.core.ConfigConsts; import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; /** * @author Jason Song(song_s@ctrip.com) */ @RunWith(MockitoJUnitRunner.class) public class JsonConfigFileTest { private String someNamespace; @Mock private ConfigRepository configRepository; private ConfigSourceType someSourceType; @Before public void setUp() throws Exception { someNamespace = "someName"; } @Test public void testWhenHasContent() throws Exception { Properties someProperties = new Properties(); String key = ConfigConsts.CONFIG_FILE_CONTENT_KEY; String someValue = "someValue"; someProperties.setProperty(key, someValue); someSourceType = ConfigSourceType.LOCAL; when(configRepository.getConfig()).thenReturn(someProperties); when(configRepository.getSourceType()).thenReturn(someSourceType); JsonConfigFile configFile = new JsonConfigFile(someNamespace, configRepository); assertEquals(ConfigFileFormat.JSON, configFile.getConfigFileFormat()); assertEquals(someNamespace, configFile.getNamespace()); assertTrue(configFile.hasContent()); assertEquals(someValue, configFile.getContent()); assertEquals(someSourceType, configFile.getSourceType()); } @Test public void testWhenHasNoContent() throws Exception { when(configRepository.getConfig()).thenReturn(null); JsonConfigFile configFile = new JsonConfigFile(someNamespace, configRepository); assertFalse(configFile.hasContent()); assertNull(configFile.getContent()); } @Test public void testWhenConfigRepositoryHasError() throws Exception { when(configRepository.getConfig()).thenThrow(new RuntimeException("someError")); JsonConfigFile configFile = new JsonConfigFile(someNamespace, configRepository); assertFalse(configFile.hasContent()); assertNull(configFile.getContent()); assertEquals(ConfigSourceType.NONE, configFile.getSourceType()); } @Test public void testOnRepositoryChange() throws Exception { Properties someProperties = new Properties(); String key = ConfigConsts.CONFIG_FILE_CONTENT_KEY; String someValue = "someValue"; String anotherValue = "anotherValue"; someProperties.setProperty(key, someValue); someSourceType = ConfigSourceType.LOCAL; when(configRepository.getConfig()).thenReturn(someProperties); when(configRepository.getSourceType()).thenReturn(someSourceType); JsonConfigFile configFile = new JsonConfigFile(someNamespace, configRepository); assertEquals(someValue, configFile.getContent()); assertEquals(someSourceType, configFile.getSourceType()); Properties anotherProperties = new Properties(); anotherProperties.setProperty(key, anotherValue); ConfigSourceType anotherSourceType = ConfigSourceType.REMOTE; when(configRepository.getSourceType()).thenReturn(anotherSourceType); configFile.onRepositoryChange(someNamespace, anotherProperties); assertEquals(anotherValue, configFile.getContent()); assertEquals(anotherSourceType, configFile.getSourceType()); } @Test public void testWhenConfigRepositoryHasErrorAndThenRecovered() throws Exception { Properties someProperties = new Properties(); String key = ConfigConsts.CONFIG_FILE_CONTENT_KEY; String someValue = "someValue"; someProperties.setProperty(key, someValue); someSourceType = ConfigSourceType.LOCAL; when(configRepository.getConfig()).thenThrow(new RuntimeException("someError")); when(configRepository.getSourceType()).thenReturn(someSourceType); JsonConfigFile configFile = new JsonConfigFile(someNamespace, configRepository); assertFalse(configFile.hasContent()); assertNull(configFile.getContent()); assertEquals(ConfigSourceType.NONE, configFile.getSourceType()); configFile.onRepositoryChange(someNamespace, someProperties); assertTrue(configFile.hasContent()); assertEquals(someValue, configFile.getContent()); assertEquals(someSourceType, configFile.getSourceType()); } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-core/src/main/java/com/ctrip/framework/apollo/core/utils/PropertiesUtil.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.core.utils; import java.io.IOException; import java.io.StringWriter; import java.util.Properties; /** * @author Jason Song(song_s@ctrip.com) */ public class PropertiesUtil { /** * Transform the properties to string format * @param properties the properties object * @return the string containing the properties * @throws IOException */ public static String toString(Properties properties) throws IOException { StringWriter writer = new StringWriter(); properties.store(writer, null); StringBuffer stringBuffer = writer.getBuffer(); filterPropertiesComment(stringBuffer); return stringBuffer.toString(); } /** * filter out the first comment line * @param stringBuffer the string buffer * @return true if filtered successfully, false otherwise */ static boolean filterPropertiesComment(StringBuffer stringBuffer) { //check whether has comment in the first line if (stringBuffer.charAt(0) != '#') { return false; } int commentLineIndex = stringBuffer.indexOf("\n"); if (commentLineIndex == -1) { return false; } stringBuffer.delete(0, commentLineIndex + 1); return true; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.core.utils; import java.io.IOException; import java.io.StringWriter; import java.util.Properties; /** * @author Jason Song(song_s@ctrip.com) */ public class PropertiesUtil { /** * Transform the properties to string format * @param properties the properties object * @return the string containing the properties * @throws IOException */ public static String toString(Properties properties) throws IOException { StringWriter writer = new StringWriter(); properties.store(writer, null); StringBuffer stringBuffer = writer.getBuffer(); filterPropertiesComment(stringBuffer); return stringBuffer.toString(); } /** * filter out the first comment line * @param stringBuffer the string buffer * @return true if filtered successfully, false otherwise */ static boolean filterPropertiesComment(StringBuffer stringBuffer) { //check whether has comment in the first line if (stringBuffer.charAt(0) != '#') { return false; } int commentLineIndex = stringBuffer.indexOf("\n"); if (commentLineIndex == -1) { return false; } stringBuffer.delete(0, commentLineIndex + 1); return true; } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/package-info.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * This package defines common interfaces so that each company could provide their own implementations.<br/> * Currently we provide 2 implementations: Ctrip and Default.<br/> * Ctrip implementation will be activated only when spring.profiles.active = ctrip. * So if spring.profiles.active is not ctrip, the default implementation will be activated. * You may refer com.ctrip.framework.apollo.portal.spi.configuration.AuthConfiguration when providing your own implementation. * * @see com.ctrip.framework.apollo.portal.spi.configuration.AuthConfiguration */ package com.ctrip.framework.apollo.portal.spi;
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ /** * This package defines common interfaces so that each company could provide their own implementations.<br/> * Currently we provide 2 implementations: Ctrip and Default.<br/> * Ctrip implementation will be activated only when spring.profiles.active = ctrip. * So if spring.profiles.active is not ctrip, the default implementation will be activated. * You may refer com.ctrip.framework.apollo.portal.spi.configuration.AuthConfiguration when providing your own implementation. * * @see com.ctrip.framework.apollo.portal.spi.configuration.AuthConfiguration */ package com.ctrip.framework.apollo.portal.spi;
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/PortalApplication.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal; import com.ctrip.framework.apollo.common.ApolloCommonConfig; import com.ctrip.framework.apollo.openapi.PortalOpenApiConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.transaction.annotation.EnableTransactionManagement; @EnableAspectJAutoProxy @Configuration @EnableAutoConfiguration(exclude = {LdapAutoConfiguration.class}) @EnableTransactionManagement @ComponentScan(basePackageClasses = {ApolloCommonConfig.class, PortalApplication.class, PortalOpenApiConfig.class}) public class PortalApplication { public static void main(String[] args) throws Exception { SpringApplication.run(PortalApplication.class, args); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal; import com.ctrip.framework.apollo.common.ApolloCommonConfig; import com.ctrip.framework.apollo.openapi.PortalOpenApiConfig; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.transaction.annotation.EnableTransactionManagement; @EnableAspectJAutoProxy @Configuration @EnableAutoConfiguration(exclude = {LdapAutoConfiguration.class}) @EnableTransactionManagement @ComponentScan(basePackageClasses = {ApolloCommonConfig.class, PortalApplication.class, PortalOpenApiConfig.class}) public class PortalApplication { public static void main(String[] args) throws Exception { SpringApplication.run(PortalApplication.class, args); } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/CharacterEncodingFilterConfiguration.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.common.controller; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.filter.CharacterEncodingFilter; import javax.servlet.DispatcherType; @Configuration public class CharacterEncodingFilterConfiguration { @Bean public FilterRegistrationBean encodingFilter() { FilterRegistrationBean bean = new FilterRegistrationBean(); bean.setFilter(new CharacterEncodingFilter()); bean.addInitParameter("encoding", "UTF-8"); //FIXME: https://github.com/Netflix/eureka/issues/702 // bean.addInitParameter("forceEncoding", "true"); bean.setName("encodingFilter"); bean.addUrlPatterns("/*"); bean.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.FORWARD); return bean; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.common.controller; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.filter.CharacterEncodingFilter; import javax.servlet.DispatcherType; @Configuration public class CharacterEncodingFilterConfiguration { @Bean public FilterRegistrationBean encodingFilter() { FilterRegistrationBean bean = new FilterRegistrationBean(); bean.setFilter(new CharacterEncodingFilter()); bean.addInitParameter("encoding", "UTF-8"); //FIXME: https://github.com/Netflix/eureka/issues/702 // bean.addInitParameter("forceEncoding", "true"); bean.setName("encodingFilter"); bean.addUrlPatterns("/*"); bean.setDispatcherTypes(DispatcherType.REQUEST, DispatcherType.FORWARD); return bean; } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./doc/images/gray-release/select-gray-release-ip.png
PNG  IHDRMvOj IDATxygW}3:څ]HBha5 8`!TbNUJyST$*10f1 $о4,<:÷ӯ{G|N}={Ν_!!!!!!!!!p<k @@@@@@@@@tk!B B B B B`&yss8#!0 o#!!!!!R fgg֭͛[[^F_* LNN׷ 6쑽N b_.؃fffړO>EC9oMR!!ZAk۶mkGyd@7$!!!!!{>l8$bLO4˾~=CxT9zwYmriCmȰ=M7@@@,F@߆֬Yo1X @{a[li7n| )%j>V9[d^_ [~w5~c߯;z7@R}C^7&81o\1h_q-발K|MOO2y43<ӇDڴiS;E4yC^/1a.e u~~ǺWuW9F-1å^2Nމ!!!C}ʡ_C B  {cRY}td(&$ i巿۷bh<+፟yfR8+|*6/<>W<?OO=T28<*\!\uLecw-iԲw.࣏>څM&C B B B B B B B$> f*e]jwG[4L{o{l_~|n.ڵkyV&o.*"<* 2t;ܨ_GuT;s?֭[ׇXSeO:flSzK諰/b|w)N?ᦛneT7|O=ԝ襤0!!!!!!!!p#bO<чoʱ<ec=vQ!5_ SC1O]PP/&\W_}uӈko>W\1/:>,rO($eb'A.k0?ҩ43Bb]:r)z,Ak0괫!!!!!!!2tAqLF!l/Ys>C4Ë#,E3UYz*u [~+ܞZ˃e![ێ;V~NMeοn{kQب{Gt\8tF~}poY,r8XOcyGs= ~ꉥ4UXUe_UZSdz>x:XεsJMC`Y\381{wqxC+nWmnn}aF62lξʺ/x<^m޼[UB=qxwSh:u֋ŭ0]<ꍁx^,Fo<>Lu\B7>@[ 'NzNkW WWU}xĵH}k_=kww:_URƅʔ!!!!nj9cD~5=QoS~cNUqkF폮o&n3fW]q[&huŭh=v哷}ƍw:gŹʸ<,CC` r?y w]Ic#]<e VW{o-O\ xj |4K.F볯u0žG~'Bu /j~nb`p:p'`0sE OXI8:7n,nK9$RsR*uk9yUqIkVu %IsӰTp\X]wuNu=?>+λL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ig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseCompareResult.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.entity.vo; import com.ctrip.framework.apollo.common.entity.EntityPair; import com.ctrip.framework.apollo.portal.entity.bo.KVEntity; import com.ctrip.framework.apollo.portal.enums.ChangeType; import java.util.LinkedList; import java.util.List; public class ReleaseCompareResult { private List<Change> changes = new LinkedList<>(); public void addEntityPair(ChangeType type, KVEntity firstEntity, KVEntity secondEntity) { changes.add(new Change(type, new EntityPair<>(firstEntity, secondEntity))); } public boolean hasContent(){ return !changes.isEmpty(); } public List<Change> getChanges() { return changes; } public void setChanges(List<Change> changes) { this.changes = changes; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.portal.entity.vo; import com.ctrip.framework.apollo.common.entity.EntityPair; import com.ctrip.framework.apollo.portal.entity.bo.KVEntity; import com.ctrip.framework.apollo.portal.enums.ChangeType; import java.util.LinkedList; import java.util.List; public class ReleaseCompareResult { private List<Change> changes = new LinkedList<>(); public void addEntityPair(ChangeType type, KVEntity firstEntity, KVEntity secondEntity) { changes.add(new Change(type, new EntityPair<>(firstEntity, secondEntity))); } public boolean hasContent(){ return !changes.isEmpty(); } public List<Change> getChanges() { return changes; } public void setChanges(List<Change> changes) { this.changes = changes; } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/test/resources/application.properties
# # Copyright 2021 Apollo Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # spring.datasource.url = jdbc:h2:mem:~/apolloportaldb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1 spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl spring.jpa.properties.hibernate.show_sql=false spring.h2.console.enabled = true spring.h2.console.settings.web-allow-others=true spring.main.allow-bean-definition-overriding=true
# # Copyright 2021 Apollo Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # spring.datasource.url = jdbc:h2:mem:~/apolloportaldb;mode=mysql;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1 spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl spring.jpa.properties.hibernate.show_sql=false spring.h2.console.enabled = true spring.h2.console.settings.web-allow-others=true spring.main.allow-bean-definition-overriding=true
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/service/ConsumerService.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.openapi.service; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.openapi.entity.Consumer; import com.ctrip.framework.apollo.openapi.entity.ConsumerAudit; import com.ctrip.framework.apollo.openapi.entity.ConsumerRole; import com.ctrip.framework.apollo.openapi.entity.ConsumerToken; import com.ctrip.framework.apollo.openapi.repository.ConsumerAuditRepository; import com.ctrip.framework.apollo.openapi.repository.ConsumerRepository; import com.ctrip.framework.apollo.openapi.repository.ConsumerRoleRepository; import com.ctrip.framework.apollo.openapi.repository.ConsumerTokenRepository; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.entity.bo.UserInfo; import com.ctrip.framework.apollo.portal.entity.po.Role; import com.ctrip.framework.apollo.portal.service.RolePermissionService; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.ctrip.framework.apollo.portal.spi.UserService; import com.ctrip.framework.apollo.portal.util.RoleUtils; import com.google.common.base.Charsets; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.hash.Hashing; import org.apache.commons.lang.time.FastDateFormat; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.Date; import java.util.List; /** * @author Jason Song(song_s@ctrip.com) */ @Service public class ConsumerService { private static final FastDateFormat TIMESTAMP_FORMAT = FastDateFormat.getInstance("yyyyMMddHHmmss"); private static final Joiner KEY_JOINER = Joiner.on("|"); private final UserInfoHolder userInfoHolder; private final ConsumerTokenRepository consumerTokenRepository; private final ConsumerRepository consumerRepository; private final ConsumerAuditRepository consumerAuditRepository; private final ConsumerRoleRepository consumerRoleRepository; private final PortalConfig portalConfig; private final RolePermissionService rolePermissionService; private final UserService userService; public ConsumerService( final UserInfoHolder userInfoHolder, final ConsumerTokenRepository consumerTokenRepository, final ConsumerRepository consumerRepository, final ConsumerAuditRepository consumerAuditRepository, final ConsumerRoleRepository consumerRoleRepository, final PortalConfig portalConfig, final RolePermissionService rolePermissionService, final UserService userService) { this.userInfoHolder = userInfoHolder; this.consumerTokenRepository = consumerTokenRepository; this.consumerRepository = consumerRepository; this.consumerAuditRepository = consumerAuditRepository; this.consumerRoleRepository = consumerRoleRepository; this.portalConfig = portalConfig; this.rolePermissionService = rolePermissionService; this.userService = userService; } public Consumer createConsumer(Consumer consumer) { String appId = consumer.getAppId(); Consumer managedConsumer = consumerRepository.findByAppId(appId); if (managedConsumer != null) { throw new BadRequestException("Consumer already exist"); } String ownerName = consumer.getOwnerName(); UserInfo owner = userService.findByUserId(ownerName); if (owner == null) { throw new BadRequestException(String.format("User does not exist. UserId = %s", ownerName)); } consumer.setOwnerEmail(owner.getEmail()); String operator = userInfoHolder.getUser().getUserId(); consumer.setDataChangeCreatedBy(operator); consumer.setDataChangeLastModifiedBy(operator); return consumerRepository.save(consumer); } public ConsumerToken generateAndSaveConsumerToken(Consumer consumer, Date expires) { Preconditions.checkArgument(consumer != null, "Consumer can not be null"); ConsumerToken consumerToken = generateConsumerToken(consumer, expires); consumerToken.setId(0); return consumerTokenRepository.save(consumerToken); } public ConsumerToken getConsumerTokenByAppId(String appId) { Consumer consumer = consumerRepository.findByAppId(appId); if (consumer == null) { return null; } return consumerTokenRepository.findByConsumerId(consumer.getId()); } public Long getConsumerIdByToken(String token) { if (Strings.isNullOrEmpty(token)) { return null; } ConsumerToken consumerToken = consumerTokenRepository.findTopByTokenAndExpiresAfter(token, new Date()); return consumerToken == null ? null : consumerToken.getConsumerId(); } public Consumer getConsumerByConsumerId(long consumerId) { return consumerRepository.findById(consumerId).orElse(null); } public List<ConsumerRole> assignNamespaceRoleToConsumer(String token, String appId, String namespaceName) { return assignNamespaceRoleToConsumer(token, appId, namespaceName, null); } @Transactional public List<ConsumerRole> assignNamespaceRoleToConsumer(String token, String appId, String namespaceName, String env) { Long consumerId = getConsumerIdByToken(token); if (consumerId == null) { throw new BadRequestException("Token is Illegal"); } Role namespaceModifyRole = rolePermissionService.findRoleByRoleName(RoleUtils.buildModifyNamespaceRoleName(appId, namespaceName, env)); Role namespaceReleaseRole = rolePermissionService.findRoleByRoleName(RoleUtils.buildReleaseNamespaceRoleName(appId, namespaceName, env)); if (namespaceModifyRole == null || namespaceReleaseRole == null) { throw new BadRequestException("Namespace's role does not exist. Please check whether namespace has created."); } long namespaceModifyRoleId = namespaceModifyRole.getId(); long namespaceReleaseRoleId = namespaceReleaseRole.getId(); ConsumerRole managedModifyRole = consumerRoleRepository.findByConsumerIdAndRoleId(consumerId, namespaceModifyRoleId); ConsumerRole managedReleaseRole = consumerRoleRepository.findByConsumerIdAndRoleId(consumerId, namespaceReleaseRoleId); if (managedModifyRole != null && managedReleaseRole != null) { return Arrays.asList(managedModifyRole, managedReleaseRole); } String operator = userInfoHolder.getUser().getUserId(); ConsumerRole namespaceModifyConsumerRole = createConsumerRole(consumerId, namespaceModifyRoleId, operator); ConsumerRole namespaceReleaseConsumerRole = createConsumerRole(consumerId, namespaceReleaseRoleId, operator); ConsumerRole createdModifyConsumerRole = consumerRoleRepository.save(namespaceModifyConsumerRole); ConsumerRole createdReleaseConsumerRole = consumerRoleRepository.save(namespaceReleaseConsumerRole); return Arrays.asList(createdModifyConsumerRole, createdReleaseConsumerRole); } @Transactional public ConsumerRole assignAppRoleToConsumer(String token, String appId) { Long consumerId = getConsumerIdByToken(token); if (consumerId == null) { throw new BadRequestException("Token is Illegal"); } Role masterRole = rolePermissionService.findRoleByRoleName(RoleUtils.buildAppMasterRoleName(appId)); if (masterRole == null) { throw new BadRequestException("App's role does not exist. Please check whether app has created."); } long roleId = masterRole.getId(); ConsumerRole managedModifyRole = consumerRoleRepository.findByConsumerIdAndRoleId(consumerId, roleId); if (managedModifyRole != null) { return managedModifyRole; } String operator = userInfoHolder.getUser().getUserId(); ConsumerRole consumerRole = createConsumerRole(consumerId, roleId, operator); return consumerRoleRepository.save(consumerRole); } @Transactional public void createConsumerAudits(Iterable<ConsumerAudit> consumerAudits) { consumerAuditRepository.saveAll(consumerAudits); } @Transactional public ConsumerToken createConsumerToken(ConsumerToken entity) { entity.setId(0); //for protection return consumerTokenRepository.save(entity); } private ConsumerToken generateConsumerToken(Consumer consumer, Date expires) { long consumerId = consumer.getId(); String createdBy = userInfoHolder.getUser().getUserId(); Date createdTime = new Date(); ConsumerToken consumerToken = new ConsumerToken(); consumerToken.setConsumerId(consumerId); consumerToken.setExpires(expires); consumerToken.setDataChangeCreatedBy(createdBy); consumerToken.setDataChangeCreatedTime(createdTime); consumerToken.setDataChangeLastModifiedBy(createdBy); consumerToken.setDataChangeLastModifiedTime(createdTime); generateAndEnrichToken(consumer, consumerToken); return consumerToken; } void generateAndEnrichToken(Consumer consumer, ConsumerToken consumerToken) { Preconditions.checkArgument(consumer != null); if (consumerToken.getDataChangeCreatedTime() == null) { consumerToken.setDataChangeCreatedTime(new Date()); } consumerToken.setToken(generateToken(consumer.getAppId(), consumerToken .getDataChangeCreatedTime(), portalConfig.consumerTokenSalt())); } String generateToken(String consumerAppId, Date generationTime, String consumerTokenSalt) { return Hashing.sha1().hashString(KEY_JOINER.join(consumerAppId, TIMESTAMP_FORMAT.format (generationTime), consumerTokenSalt), Charsets.UTF_8).toString(); } ConsumerRole createConsumerRole(Long consumerId, Long roleId, String operator) { ConsumerRole consumerRole = new ConsumerRole(); consumerRole.setConsumerId(consumerId); consumerRole.setRoleId(roleId); consumerRole.setDataChangeCreatedBy(operator); consumerRole.setDataChangeLastModifiedBy(operator); return consumerRole; } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.openapi.service; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.openapi.entity.Consumer; import com.ctrip.framework.apollo.openapi.entity.ConsumerAudit; import com.ctrip.framework.apollo.openapi.entity.ConsumerRole; import com.ctrip.framework.apollo.openapi.entity.ConsumerToken; import com.ctrip.framework.apollo.openapi.repository.ConsumerAuditRepository; import com.ctrip.framework.apollo.openapi.repository.ConsumerRepository; import com.ctrip.framework.apollo.openapi.repository.ConsumerRoleRepository; import com.ctrip.framework.apollo.openapi.repository.ConsumerTokenRepository; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import com.ctrip.framework.apollo.portal.entity.bo.UserInfo; import com.ctrip.framework.apollo.portal.entity.po.Role; import com.ctrip.framework.apollo.portal.service.RolePermissionService; import com.ctrip.framework.apollo.portal.spi.UserInfoHolder; import com.ctrip.framework.apollo.portal.spi.UserService; import com.ctrip.framework.apollo.portal.util.RoleUtils; import com.google.common.base.Charsets; import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.hash.Hashing; import org.apache.commons.lang.time.FastDateFormat; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.Date; import java.util.List; /** * @author Jason Song(song_s@ctrip.com) */ @Service public class ConsumerService { private static final FastDateFormat TIMESTAMP_FORMAT = FastDateFormat.getInstance("yyyyMMddHHmmss"); private static final Joiner KEY_JOINER = Joiner.on("|"); private final UserInfoHolder userInfoHolder; private final ConsumerTokenRepository consumerTokenRepository; private final ConsumerRepository consumerRepository; private final ConsumerAuditRepository consumerAuditRepository; private final ConsumerRoleRepository consumerRoleRepository; private final PortalConfig portalConfig; private final RolePermissionService rolePermissionService; private final UserService userService; public ConsumerService( final UserInfoHolder userInfoHolder, final ConsumerTokenRepository consumerTokenRepository, final ConsumerRepository consumerRepository, final ConsumerAuditRepository consumerAuditRepository, final ConsumerRoleRepository consumerRoleRepository, final PortalConfig portalConfig, final RolePermissionService rolePermissionService, final UserService userService) { this.userInfoHolder = userInfoHolder; this.consumerTokenRepository = consumerTokenRepository; this.consumerRepository = consumerRepository; this.consumerAuditRepository = consumerAuditRepository; this.consumerRoleRepository = consumerRoleRepository; this.portalConfig = portalConfig; this.rolePermissionService = rolePermissionService; this.userService = userService; } public Consumer createConsumer(Consumer consumer) { String appId = consumer.getAppId(); Consumer managedConsumer = consumerRepository.findByAppId(appId); if (managedConsumer != null) { throw new BadRequestException("Consumer already exist"); } String ownerName = consumer.getOwnerName(); UserInfo owner = userService.findByUserId(ownerName); if (owner == null) { throw new BadRequestException(String.format("User does not exist. UserId = %s", ownerName)); } consumer.setOwnerEmail(owner.getEmail()); String operator = userInfoHolder.getUser().getUserId(); consumer.setDataChangeCreatedBy(operator); consumer.setDataChangeLastModifiedBy(operator); return consumerRepository.save(consumer); } public ConsumerToken generateAndSaveConsumerToken(Consumer consumer, Date expires) { Preconditions.checkArgument(consumer != null, "Consumer can not be null"); ConsumerToken consumerToken = generateConsumerToken(consumer, expires); consumerToken.setId(0); return consumerTokenRepository.save(consumerToken); } public ConsumerToken getConsumerTokenByAppId(String appId) { Consumer consumer = consumerRepository.findByAppId(appId); if (consumer == null) { return null; } return consumerTokenRepository.findByConsumerId(consumer.getId()); } public Long getConsumerIdByToken(String token) { if (Strings.isNullOrEmpty(token)) { return null; } ConsumerToken consumerToken = consumerTokenRepository.findTopByTokenAndExpiresAfter(token, new Date()); return consumerToken == null ? null : consumerToken.getConsumerId(); } public Consumer getConsumerByConsumerId(long consumerId) { return consumerRepository.findById(consumerId).orElse(null); } public List<ConsumerRole> assignNamespaceRoleToConsumer(String token, String appId, String namespaceName) { return assignNamespaceRoleToConsumer(token, appId, namespaceName, null); } @Transactional public List<ConsumerRole> assignNamespaceRoleToConsumer(String token, String appId, String namespaceName, String env) { Long consumerId = getConsumerIdByToken(token); if (consumerId == null) { throw new BadRequestException("Token is Illegal"); } Role namespaceModifyRole = rolePermissionService.findRoleByRoleName(RoleUtils.buildModifyNamespaceRoleName(appId, namespaceName, env)); Role namespaceReleaseRole = rolePermissionService.findRoleByRoleName(RoleUtils.buildReleaseNamespaceRoleName(appId, namespaceName, env)); if (namespaceModifyRole == null || namespaceReleaseRole == null) { throw new BadRequestException("Namespace's role does not exist. Please check whether namespace has created."); } long namespaceModifyRoleId = namespaceModifyRole.getId(); long namespaceReleaseRoleId = namespaceReleaseRole.getId(); ConsumerRole managedModifyRole = consumerRoleRepository.findByConsumerIdAndRoleId(consumerId, namespaceModifyRoleId); ConsumerRole managedReleaseRole = consumerRoleRepository.findByConsumerIdAndRoleId(consumerId, namespaceReleaseRoleId); if (managedModifyRole != null && managedReleaseRole != null) { return Arrays.asList(managedModifyRole, managedReleaseRole); } String operator = userInfoHolder.getUser().getUserId(); ConsumerRole namespaceModifyConsumerRole = createConsumerRole(consumerId, namespaceModifyRoleId, operator); ConsumerRole namespaceReleaseConsumerRole = createConsumerRole(consumerId, namespaceReleaseRoleId, operator); ConsumerRole createdModifyConsumerRole = consumerRoleRepository.save(namespaceModifyConsumerRole); ConsumerRole createdReleaseConsumerRole = consumerRoleRepository.save(namespaceReleaseConsumerRole); return Arrays.asList(createdModifyConsumerRole, createdReleaseConsumerRole); } @Transactional public ConsumerRole assignAppRoleToConsumer(String token, String appId) { Long consumerId = getConsumerIdByToken(token); if (consumerId == null) { throw new BadRequestException("Token is Illegal"); } Role masterRole = rolePermissionService.findRoleByRoleName(RoleUtils.buildAppMasterRoleName(appId)); if (masterRole == null) { throw new BadRequestException("App's role does not exist. Please check whether app has created."); } long roleId = masterRole.getId(); ConsumerRole managedModifyRole = consumerRoleRepository.findByConsumerIdAndRoleId(consumerId, roleId); if (managedModifyRole != null) { return managedModifyRole; } String operator = userInfoHolder.getUser().getUserId(); ConsumerRole consumerRole = createConsumerRole(consumerId, roleId, operator); return consumerRoleRepository.save(consumerRole); } @Transactional public void createConsumerAudits(Iterable<ConsumerAudit> consumerAudits) { consumerAuditRepository.saveAll(consumerAudits); } @Transactional public ConsumerToken createConsumerToken(ConsumerToken entity) { entity.setId(0); //for protection return consumerTokenRepository.save(entity); } private ConsumerToken generateConsumerToken(Consumer consumer, Date expires) { long consumerId = consumer.getId(); String createdBy = userInfoHolder.getUser().getUserId(); Date createdTime = new Date(); ConsumerToken consumerToken = new ConsumerToken(); consumerToken.setConsumerId(consumerId); consumerToken.setExpires(expires); consumerToken.setDataChangeCreatedBy(createdBy); consumerToken.setDataChangeCreatedTime(createdTime); consumerToken.setDataChangeLastModifiedBy(createdBy); consumerToken.setDataChangeLastModifiedTime(createdTime); generateAndEnrichToken(consumer, consumerToken); return consumerToken; } void generateAndEnrichToken(Consumer consumer, ConsumerToken consumerToken) { Preconditions.checkArgument(consumer != null); if (consumerToken.getDataChangeCreatedTime() == null) { consumerToken.setDataChangeCreatedTime(new Date()); } consumerToken.setToken(generateToken(consumer.getAppId(), consumerToken .getDataChangeCreatedTime(), portalConfig.consumerTokenSalt())); } String generateToken(String consumerAppId, Date generationTime, String consumerTokenSalt) { return Hashing.sha1().hashString(KEY_JOINER.join(consumerAppId, TIMESTAMP_FORMAT.format (generationTime), consumerTokenSalt), Charsets.UTF_8).toString(); } ConsumerRole createConsumerRole(Long consumerId, Long roleId, String operator) { ConsumerRole consumerRole = new ConsumerRole(); consumerRole.setConsumerId(consumerId); consumerRole.setRoleId(roleId); consumerRole.setDataChangeCreatedBy(operator); consumerRole.setDataChangeLastModifiedBy(operator); return consumerRole; } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/v1/controller/ReleaseController.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.openapi.v1.controller; import com.ctrip.framework.apollo.common.dto.ReleaseDTO; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.common.utils.BeanUtils; import com.ctrip.framework.apollo.common.utils.RequestPrecondition; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.core.utils.StringUtils; import com.ctrip.framework.apollo.openapi.auth.ConsumerPermissionValidator; import com.ctrip.framework.apollo.openapi.dto.NamespaceGrayDelReleaseDTO; import com.ctrip.framework.apollo.openapi.dto.NamespaceReleaseDTO; import com.ctrip.framework.apollo.openapi.dto.OpenReleaseDTO; import com.ctrip.framework.apollo.openapi.util.OpenApiBeanUtils; import com.ctrip.framework.apollo.portal.entity.model.NamespaceGrayDelReleaseModel; import com.ctrip.framework.apollo.portal.entity.model.NamespaceReleaseModel; import com.ctrip.framework.apollo.portal.service.NamespaceBranchService; import com.ctrip.framework.apollo.portal.service.ReleaseService; import com.ctrip.framework.apollo.portal.spi.UserService; import javax.servlet.http.HttpServletRequest; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController("openapiReleaseController") @RequestMapping("/openapi/v1/envs/{env}") public class ReleaseController { private final ReleaseService releaseService; private final UserService userService; private final NamespaceBranchService namespaceBranchService; private final ConsumerPermissionValidator consumerPermissionValidator; public ReleaseController( final ReleaseService releaseService, final UserService userService, final NamespaceBranchService namespaceBranchService, final ConsumerPermissionValidator consumerPermissionValidator) { this.releaseService = releaseService; this.userService = userService; this.namespaceBranchService = namespaceBranchService; this.consumerPermissionValidator = consumerPermissionValidator; } @PreAuthorize(value = "@consumerPermissionValidator.hasReleaseNamespacePermission(#request, #appId, #namespaceName, #env)") @PostMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases") public OpenReleaseDTO createRelease(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @RequestBody NamespaceReleaseDTO model, HttpServletRequest request) { RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(model.getReleasedBy(), model .getReleaseTitle()), "Params(releaseTitle and releasedBy) can not be empty"); if (userService.findByUserId(model.getReleasedBy()) == null) { throw new BadRequestException("user(releaseBy) not exists"); } NamespaceReleaseModel releaseModel = BeanUtils.transform(NamespaceReleaseModel.class, model); releaseModel.setAppId(appId); releaseModel.setEnv(Env.valueOf(env).toString()); releaseModel.setClusterName(clusterName); releaseModel.setNamespaceName(namespaceName); return OpenApiBeanUtils.transformFromReleaseDTO(releaseService.publish(releaseModel)); } @GetMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/latest") public OpenReleaseDTO loadLatestActiveRelease(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName) { ReleaseDTO releaseDTO = releaseService.loadLatestRelease(appId, Env.valueOf (env), clusterName, namespaceName); if (releaseDTO == null) { return null; } return OpenApiBeanUtils.transformFromReleaseDTO(releaseDTO); } @PreAuthorize(value = "@consumerPermissionValidator.hasReleaseNamespacePermission(#request, #appId, #namespaceName, #env)") @PostMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/merge") public OpenReleaseDTO merge(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @PathVariable String branchName, @RequestParam(value = "deleteBranch", defaultValue = "true") boolean deleteBranch, @RequestBody NamespaceReleaseDTO model, HttpServletRequest request) { RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(model.getReleasedBy(), model .getReleaseTitle()), "Params(releaseTitle and releasedBy) can not be empty"); if (userService.findByUserId(model.getReleasedBy()) == null) { throw new BadRequestException("user(releaseBy) not exists"); } ReleaseDTO mergedRelease = namespaceBranchService.merge(appId, Env.valueOf(env.toUpperCase()), clusterName, namespaceName, branchName, model.getReleaseTitle(), model.getReleaseComment(), model.isEmergencyPublish(), deleteBranch, model.getReleasedBy()); return OpenApiBeanUtils.transformFromReleaseDTO(mergedRelease); } @PreAuthorize(value = "@consumerPermissionValidator.hasReleaseNamespacePermission(#request, #appId, #namespaceName, #env)") @PostMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/releases") public OpenReleaseDTO createGrayRelease(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @PathVariable String branchName, @RequestBody NamespaceReleaseDTO model, HttpServletRequest request) { RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(model.getReleasedBy(), model .getReleaseTitle()), "Params(releaseTitle and releasedBy) can not be empty"); if (userService.findByUserId(model.getReleasedBy()) == null) { throw new BadRequestException("user(releaseBy) not exists"); } NamespaceReleaseModel releaseModel = BeanUtils.transform(NamespaceReleaseModel.class, model); releaseModel.setAppId(appId); releaseModel.setEnv(Env.valueOf(env).toString()); releaseModel.setClusterName(branchName); releaseModel.setNamespaceName(namespaceName); return OpenApiBeanUtils.transformFromReleaseDTO(releaseService.publish(releaseModel)); } @PreAuthorize(value = "@consumerPermissionValidator.hasReleaseNamespacePermission(#request, #appId, #namespaceName, #env)") @PostMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/gray-del-releases") public OpenReleaseDTO createGrayDelRelease(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @PathVariable String branchName, @RequestBody NamespaceGrayDelReleaseDTO model, HttpServletRequest request) { RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(model.getReleasedBy(), model .getReleaseTitle()), "Params(releaseTitle and releasedBy) can not be empty"); RequestPrecondition.checkArguments(model.getGrayDelKeys() != null, "Params(grayDelKeys) can not be null"); if (userService.findByUserId(model.getReleasedBy()) == null) { throw new BadRequestException("user(releaseBy) not exists"); } NamespaceGrayDelReleaseModel releaseModel = BeanUtils.transform(NamespaceGrayDelReleaseModel.class, model); releaseModel.setAppId(appId); releaseModel.setEnv(env.toUpperCase()); releaseModel.setClusterName(branchName); releaseModel.setNamespaceName(namespaceName); return OpenApiBeanUtils.transformFromReleaseDTO(releaseService.publish(releaseModel, releaseModel.getReleasedBy())); } @PutMapping(path = "/releases/{releaseId}/rollback") public void rollback(@PathVariable String env, @PathVariable long releaseId, @RequestParam String operator, HttpServletRequest request) { RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(operator), "Param operator can not be empty"); if (userService.findByUserId(operator) == null) { throw new BadRequestException("user(operator) not exists"); } ReleaseDTO release = releaseService.findReleaseById(Env.valueOf(env), releaseId); if (release == null) { throw new BadRequestException("release not found"); } if (!consumerPermissionValidator.hasReleaseNamespacePermission(request,release.getAppId(), release.getNamespaceName(), env)) { throw new AccessDeniedException("Forbidden operation. you don't have release permission"); } releaseService.rollback(Env.valueOf(env), releaseId, operator); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.openapi.v1.controller; import com.ctrip.framework.apollo.common.dto.ReleaseDTO; import com.ctrip.framework.apollo.common.exception.BadRequestException; import com.ctrip.framework.apollo.common.utils.BeanUtils; import com.ctrip.framework.apollo.common.utils.RequestPrecondition; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.core.utils.StringUtils; import com.ctrip.framework.apollo.openapi.auth.ConsumerPermissionValidator; import com.ctrip.framework.apollo.openapi.dto.NamespaceGrayDelReleaseDTO; import com.ctrip.framework.apollo.openapi.dto.NamespaceReleaseDTO; import com.ctrip.framework.apollo.openapi.dto.OpenReleaseDTO; import com.ctrip.framework.apollo.openapi.util.OpenApiBeanUtils; import com.ctrip.framework.apollo.portal.entity.model.NamespaceGrayDelReleaseModel; import com.ctrip.framework.apollo.portal.entity.model.NamespaceReleaseModel; import com.ctrip.framework.apollo.portal.service.NamespaceBranchService; import com.ctrip.framework.apollo.portal.service.ReleaseService; import com.ctrip.framework.apollo.portal.spi.UserService; import javax.servlet.http.HttpServletRequest; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController("openapiReleaseController") @RequestMapping("/openapi/v1/envs/{env}") public class ReleaseController { private final ReleaseService releaseService; private final UserService userService; private final NamespaceBranchService namespaceBranchService; private final ConsumerPermissionValidator consumerPermissionValidator; public ReleaseController( final ReleaseService releaseService, final UserService userService, final NamespaceBranchService namespaceBranchService, final ConsumerPermissionValidator consumerPermissionValidator) { this.releaseService = releaseService; this.userService = userService; this.namespaceBranchService = namespaceBranchService; this.consumerPermissionValidator = consumerPermissionValidator; } @PreAuthorize(value = "@consumerPermissionValidator.hasReleaseNamespacePermission(#request, #appId, #namespaceName, #env)") @PostMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases") public OpenReleaseDTO createRelease(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @RequestBody NamespaceReleaseDTO model, HttpServletRequest request) { RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(model.getReleasedBy(), model .getReleaseTitle()), "Params(releaseTitle and releasedBy) can not be empty"); if (userService.findByUserId(model.getReleasedBy()) == null) { throw new BadRequestException("user(releaseBy) not exists"); } NamespaceReleaseModel releaseModel = BeanUtils.transform(NamespaceReleaseModel.class, model); releaseModel.setAppId(appId); releaseModel.setEnv(Env.valueOf(env).toString()); releaseModel.setClusterName(clusterName); releaseModel.setNamespaceName(namespaceName); return OpenApiBeanUtils.transformFromReleaseDTO(releaseService.publish(releaseModel)); } @GetMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/releases/latest") public OpenReleaseDTO loadLatestActiveRelease(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName) { ReleaseDTO releaseDTO = releaseService.loadLatestRelease(appId, Env.valueOf (env), clusterName, namespaceName); if (releaseDTO == null) { return null; } return OpenApiBeanUtils.transformFromReleaseDTO(releaseDTO); } @PreAuthorize(value = "@consumerPermissionValidator.hasReleaseNamespacePermission(#request, #appId, #namespaceName, #env)") @PostMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/merge") public OpenReleaseDTO merge(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @PathVariable String branchName, @RequestParam(value = "deleteBranch", defaultValue = "true") boolean deleteBranch, @RequestBody NamespaceReleaseDTO model, HttpServletRequest request) { RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(model.getReleasedBy(), model .getReleaseTitle()), "Params(releaseTitle and releasedBy) can not be empty"); if (userService.findByUserId(model.getReleasedBy()) == null) { throw new BadRequestException("user(releaseBy) not exists"); } ReleaseDTO mergedRelease = namespaceBranchService.merge(appId, Env.valueOf(env.toUpperCase()), clusterName, namespaceName, branchName, model.getReleaseTitle(), model.getReleaseComment(), model.isEmergencyPublish(), deleteBranch, model.getReleasedBy()); return OpenApiBeanUtils.transformFromReleaseDTO(mergedRelease); } @PreAuthorize(value = "@consumerPermissionValidator.hasReleaseNamespacePermission(#request, #appId, #namespaceName, #env)") @PostMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/releases") public OpenReleaseDTO createGrayRelease(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @PathVariable String branchName, @RequestBody NamespaceReleaseDTO model, HttpServletRequest request) { RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(model.getReleasedBy(), model .getReleaseTitle()), "Params(releaseTitle and releasedBy) can not be empty"); if (userService.findByUserId(model.getReleasedBy()) == null) { throw new BadRequestException("user(releaseBy) not exists"); } NamespaceReleaseModel releaseModel = BeanUtils.transform(NamespaceReleaseModel.class, model); releaseModel.setAppId(appId); releaseModel.setEnv(Env.valueOf(env).toString()); releaseModel.setClusterName(branchName); releaseModel.setNamespaceName(namespaceName); return OpenApiBeanUtils.transformFromReleaseDTO(releaseService.publish(releaseModel)); } @PreAuthorize(value = "@consumerPermissionValidator.hasReleaseNamespacePermission(#request, #appId, #namespaceName, #env)") @PostMapping(value = "/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/gray-del-releases") public OpenReleaseDTO createGrayDelRelease(@PathVariable String appId, @PathVariable String env, @PathVariable String clusterName, @PathVariable String namespaceName, @PathVariable String branchName, @RequestBody NamespaceGrayDelReleaseDTO model, HttpServletRequest request) { RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(model.getReleasedBy(), model .getReleaseTitle()), "Params(releaseTitle and releasedBy) can not be empty"); RequestPrecondition.checkArguments(model.getGrayDelKeys() != null, "Params(grayDelKeys) can not be null"); if (userService.findByUserId(model.getReleasedBy()) == null) { throw new BadRequestException("user(releaseBy) not exists"); } NamespaceGrayDelReleaseModel releaseModel = BeanUtils.transform(NamespaceGrayDelReleaseModel.class, model); releaseModel.setAppId(appId); releaseModel.setEnv(env.toUpperCase()); releaseModel.setClusterName(branchName); releaseModel.setNamespaceName(namespaceName); return OpenApiBeanUtils.transformFromReleaseDTO(releaseService.publish(releaseModel, releaseModel.getReleasedBy())); } @PutMapping(path = "/releases/{releaseId}/rollback") public void rollback(@PathVariable String env, @PathVariable long releaseId, @RequestParam String operator, HttpServletRequest request) { RequestPrecondition.checkArguments(!StringUtils.isContainEmpty(operator), "Param operator can not be empty"); if (userService.findByUserId(operator) == null) { throw new BadRequestException("user(operator) not exists"); } ReleaseDTO release = releaseService.findReleaseById(Env.valueOf(env), releaseId); if (release == null) { throw new BadRequestException("release not found"); } if (!consumerPermissionValidator.hasReleaseNamespacePermission(request,release.getAppId(), release.getNamespaceName(), env)) { throw new AccessDeniedException("Forbidden operation. you don't have release permission"); } releaseService.rollback(Env.valueOf(env), releaseId, operator); } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-core/src/main/java/com/ctrip/framework/apollo/core/utils/ClassLoaderUtil.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.core.utils; import com.google.common.base.Strings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.URL; import java.net.URLDecoder; /** * @author Jason Song(song_s@ctrip.com) */ public class ClassLoaderUtil { private static final Logger logger = LoggerFactory.getLogger(ClassLoaderUtil.class); private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static String classPath = ""; static { if (loader == null) { logger.warn("Using system class loader"); loader = ClassLoader.getSystemClassLoader(); } try { URL url = loader.getResource(""); // get class path if (url != null) { classPath = url.getPath(); classPath = URLDecoder.decode(classPath, "utf-8"); } // 如果是jar包内的,则返回当前路径 if (Strings.isNullOrEmpty(classPath) || classPath.contains(".jar!")) { classPath = System.getProperty("user.dir"); } } catch (Throwable ex) { classPath = System.getProperty("user.dir"); logger.warn("Failed to locate class path, fallback to user.dir: {}", classPath, ex); } } public static ClassLoader getLoader() { return loader; } public static String getClassPath() { return classPath; } public static boolean isClassPresent(String className) { try { Class.forName(className); return true; } catch (ClassNotFoundException ex) { return false; } } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.core.utils; import com.google.common.base.Strings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.URL; import java.net.URLDecoder; /** * @author Jason Song(song_s@ctrip.com) */ public class ClassLoaderUtil { private static final Logger logger = LoggerFactory.getLogger(ClassLoaderUtil.class); private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static String classPath = ""; static { if (loader == null) { logger.warn("Using system class loader"); loader = ClassLoader.getSystemClassLoader(); } try { URL url = loader.getResource(""); // get class path if (url != null) { classPath = url.getPath(); classPath = URLDecoder.decode(classPath, "utf-8"); } // 如果是jar包内的,则返回当前路径 if (Strings.isNullOrEmpty(classPath) || classPath.contains(".jar!")) { classPath = System.getProperty("user.dir"); } } catch (Throwable ex) { classPath = System.getProperty("user.dir"); logger.warn("Failed to locate class path, fallback to user.dir: {}", classPath, ex); } } public static ClassLoader getLoader() { return loader; } public static String getClassPath() { return classPath; } public static boolean isClassPresent(String className) { try { Class.forName(className); return true; } catch (ClassNotFoundException ex) { return false; } } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/main/resources/static/scripts/services/AppService.js
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ appService.service('AppService', ['$resource', '$q', 'AppUtil', function ($resource, $q, AppUtil) { var app_resource = $resource(AppUtil.prefixPath() + '/apps/:appId', {}, { find_apps: { method: 'GET', isArray: true, url: AppUtil.prefixPath() + '/apps' }, find_app_by_owner: { method: 'GET', isArray: true, url: AppUtil.prefixPath() + '/apps/by-owner' }, load_navtree: { method: 'GET', isArray: false, url: AppUtil.prefixPath() + '/apps/:appId/navtree' }, load_app: { method: 'GET', isArray: false }, create_app: { method: 'POST', url: AppUtil.prefixPath() + '/apps' }, update_app: { method: 'PUT', url: AppUtil.prefixPath() + '/apps/:appId' }, create_app_remote: { method: 'POST', url: AppUtil.prefixPath() + '/apps/envs/:env' }, find_miss_envs: { method: 'GET', url: AppUtil.prefixPath() + '/apps/:appId/miss_envs' }, create_missing_namespaces: { method: 'POST', url: AppUtil.prefixPath() + '/apps/:appId/envs/:env/clusters/:clusterName/missing-namespaces' }, find_missing_namespaces: { method: 'GET', url: AppUtil.prefixPath() + '/apps/:appId/envs/:env/clusters/:clusterName/missing-namespaces' }, delete_app: { method: 'DELETE', isArray: false }, allow_app_master_assign_role: { method: 'POST', url: AppUtil.prefixPath() + '/apps/:appId/system/master/:userId' }, delete_app_master_assign_role: { method: 'DELETE', url: AppUtil.prefixPath() + '/apps/:appId/system/master/:userId' }, has_create_application_role: { method: 'GET', url: AppUtil.prefixPath() + '/system/role/createApplication/:userId' } }); return { find_apps: function (appIds) { if (!appIds) { appIds = ''; } var d = $q.defer(); app_resource.find_apps({appIds: appIds}, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, find_app_by_owner: function (owner, page, size) { var d = $q.defer(); app_resource.find_app_by_owner({ owner: owner, page: page, size: size }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, load_nav_tree: function (appId) { var d = $q.defer(); app_resource.load_navtree({ appId: appId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, create: function (app) { var d = $q.defer(); app_resource.create_app({}, app, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, update: function (app) { var d = $q.defer(); app_resource.update_app({ appId: app.appId }, app, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, create_remote: function (env, app) { var d = $q.defer(); app_resource.create_app_remote({env: env}, app, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, load: function (appId) { var d = $q.defer(); app_resource.load_app({ appId: appId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, find_miss_envs: function (appId) { var d = $q.defer(); app_resource.find_miss_envs({ appId: appId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, create_missing_namespaces: function (appId, env, clusterName) { var d = $q.defer(); app_resource.create_missing_namespaces({ appId: appId, env: env, clusterName: clusterName }, null, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, find_missing_namespaces: function (appId, env, clusterName) { var d = $q.defer(); app_resource.find_missing_namespaces({ appId: appId, env: env, clusterName: clusterName }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, delete_app: function (appId) { var d = $q.defer(); app_resource.delete_app({ appId: appId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, allow_app_master_assign_role: function (appId, userId) { var d = $q.defer(); app_resource.allow_app_master_assign_role({ appId: appId, userId: userId }, null, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, delete_app_master_assign_role: function (appId, userId) { var d = $q.defer(); app_resource.delete_app_master_assign_role({ appId: appId, userId: userId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, has_create_application_role: function (userId) { var d = $q.defer(); app_resource.has_create_application_role({ userId: userId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; } } }]);
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ appService.service('AppService', ['$resource', '$q', 'AppUtil', function ($resource, $q, AppUtil) { var app_resource = $resource(AppUtil.prefixPath() + '/apps/:appId', {}, { find_apps: { method: 'GET', isArray: true, url: AppUtil.prefixPath() + '/apps' }, find_app_by_owner: { method: 'GET', isArray: true, url: AppUtil.prefixPath() + '/apps/by-owner' }, load_navtree: { method: 'GET', isArray: false, url: AppUtil.prefixPath() + '/apps/:appId/navtree' }, load_app: { method: 'GET', isArray: false }, create_app: { method: 'POST', url: AppUtil.prefixPath() + '/apps' }, update_app: { method: 'PUT', url: AppUtil.prefixPath() + '/apps/:appId' }, create_app_remote: { method: 'POST', url: AppUtil.prefixPath() + '/apps/envs/:env' }, find_miss_envs: { method: 'GET', url: AppUtil.prefixPath() + '/apps/:appId/miss_envs' }, create_missing_namespaces: { method: 'POST', url: AppUtil.prefixPath() + '/apps/:appId/envs/:env/clusters/:clusterName/missing-namespaces' }, find_missing_namespaces: { method: 'GET', url: AppUtil.prefixPath() + '/apps/:appId/envs/:env/clusters/:clusterName/missing-namespaces' }, delete_app: { method: 'DELETE', isArray: false }, allow_app_master_assign_role: { method: 'POST', url: AppUtil.prefixPath() + '/apps/:appId/system/master/:userId' }, delete_app_master_assign_role: { method: 'DELETE', url: AppUtil.prefixPath() + '/apps/:appId/system/master/:userId' }, has_create_application_role: { method: 'GET', url: AppUtil.prefixPath() + '/system/role/createApplication/:userId' } }); return { find_apps: function (appIds) { if (!appIds) { appIds = ''; } var d = $q.defer(); app_resource.find_apps({appIds: appIds}, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, find_app_by_owner: function (owner, page, size) { var d = $q.defer(); app_resource.find_app_by_owner({ owner: owner, page: page, size: size }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, load_nav_tree: function (appId) { var d = $q.defer(); app_resource.load_navtree({ appId: appId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, create: function (app) { var d = $q.defer(); app_resource.create_app({}, app, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, update: function (app) { var d = $q.defer(); app_resource.update_app({ appId: app.appId }, app, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, create_remote: function (env, app) { var d = $q.defer(); app_resource.create_app_remote({env: env}, app, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, load: function (appId) { var d = $q.defer(); app_resource.load_app({ appId: appId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, find_miss_envs: function (appId) { var d = $q.defer(); app_resource.find_miss_envs({ appId: appId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, create_missing_namespaces: function (appId, env, clusterName) { var d = $q.defer(); app_resource.create_missing_namespaces({ appId: appId, env: env, clusterName: clusterName }, null, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, find_missing_namespaces: function (appId, env, clusterName) { var d = $q.defer(); app_resource.find_missing_namespaces({ appId: appId, env: env, clusterName: clusterName }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, delete_app: function (appId) { var d = $q.defer(); app_resource.delete_app({ appId: appId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, allow_app_master_assign_role: function (appId, userId) { var d = $q.defer(); app_resource.allow_app_master_assign_role({ appId: appId, userId: userId }, null, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, delete_app_master_assign_role: function (appId, userId) { var d = $q.defer(); app_resource.delete_app_master_assign_role({ appId: appId, userId: userId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; }, has_create_application_role: function (userId) { var d = $q.defer(); app_resource.has_create_application_role({ userId: userId }, function (result) { d.resolve(result); }, function (result) { d.reject(result); }); return d.promise; } } }]);
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./.git/HEAD
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/repository/AccessKeyRepositoryTest.java
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.biz.repository; import static org.assertj.core.api.Assertions.assertThat; import com.ctrip.framework.apollo.biz.AbstractIntegrationTest; import com.ctrip.framework.apollo.biz.entity.AccessKey; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Date; import java.util.List; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.jdbc.Sql.ExecutionPhase; public class AccessKeyRepositoryTest extends AbstractIntegrationTest { @Autowired private AccessKeyRepository accessKeyRepository; @Test public void testSave() { String appId = "someAppId"; String secret = "someSecret"; AccessKey entity = new AccessKey(); entity.setAppId(appId); entity.setSecret(secret); AccessKey accessKey = accessKeyRepository.save(entity); assertThat(accessKey).isNotNull(); assertThat(accessKey.getAppId()).isEqualTo(appId); assertThat(accessKey.getSecret()).isEqualTo(secret); } @Test @Sql(scripts = "/sql/accesskey-test.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testFindByAppId() { String appId = "someAppId"; List<AccessKey> accessKeyList = accessKeyRepository.findByAppId(appId); assertThat(accessKeyList).hasSize(1); assertThat(accessKeyList.get(0).getAppId()).isEqualTo(appId); assertThat(accessKeyList.get(0).getSecret()).isEqualTo("someSecret"); } @Test @Sql(scripts = "/sql/accesskey-test.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testFindFirst500ByDataChangeLastModifiedTimeGreaterThanOrderByDataChangeLastModifiedTime() { Instant instant = LocalDateTime.of(2019, 12, 19, 13, 44, 20) .atZone(ZoneId.systemDefault()) .toInstant(); Date date = Date.from(instant); List<AccessKey> accessKeyList = accessKeyRepository .findFirst500ByDataChangeLastModifiedTimeGreaterThanOrderByDataChangeLastModifiedTimeAsc(date); assertThat(accessKeyList).hasSize(2); assertThat(accessKeyList.get(0).getAppId()).isEqualTo("100004458"); assertThat(accessKeyList.get(0).getSecret()).isEqualTo("4003c4d7783443dc9870932bebf3b7fe"); assertThat(accessKeyList.get(1).getAppId()).isEqualTo("100004458"); assertThat(accessKeyList.get(1).getSecret()).isEqualTo("c715cbc80fc44171b43732c3119c9456"); } }
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.biz.repository; import static org.assertj.core.api.Assertions.assertThat; import com.ctrip.framework.apollo.biz.AbstractIntegrationTest; import com.ctrip.framework.apollo.biz.entity.AccessKey; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Date; import java.util.List; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.jdbc.Sql.ExecutionPhase; public class AccessKeyRepositoryTest extends AbstractIntegrationTest { @Autowired private AccessKeyRepository accessKeyRepository; @Test public void testSave() { String appId = "someAppId"; String secret = "someSecret"; AccessKey entity = new AccessKey(); entity.setAppId(appId); entity.setSecret(secret); AccessKey accessKey = accessKeyRepository.save(entity); assertThat(accessKey).isNotNull(); assertThat(accessKey.getAppId()).isEqualTo(appId); assertThat(accessKey.getSecret()).isEqualTo(secret); } @Test @Sql(scripts = "/sql/accesskey-test.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testFindByAppId() { String appId = "someAppId"; List<AccessKey> accessKeyList = accessKeyRepository.findByAppId(appId); assertThat(accessKeyList).hasSize(1); assertThat(accessKeyList.get(0).getAppId()).isEqualTo(appId); assertThat(accessKeyList.get(0).getSecret()).isEqualTo("someSecret"); } @Test @Sql(scripts = "/sql/accesskey-test.sql", executionPhase = ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/clean.sql", executionPhase = ExecutionPhase.AFTER_TEST_METHOD) public void testFindFirst500ByDataChangeLastModifiedTimeGreaterThanOrderByDataChangeLastModifiedTime() { Instant instant = LocalDateTime.of(2019, 12, 19, 13, 44, 20) .atZone(ZoneId.systemDefault()) .toInstant(); Date date = Date.from(instant); List<AccessKey> accessKeyList = accessKeyRepository .findFirst500ByDataChangeLastModifiedTimeGreaterThanOrderByDataChangeLastModifiedTimeAsc(date); assertThat(accessKeyList).hasSize(2); assertThat(accessKeyList.get(0).getAppId()).isEqualTo("100004458"); assertThat(accessKeyList.get(0).getSecret()).isEqualTo("4003c4d7783443dc9870932bebf3b7fe"); assertThat(accessKeyList.get(1).getAppId()).isEqualTo("100004458"); assertThat(accessKeyList.get(1).getSecret()).isEqualTo("c715cbc80fc44171b43732c3119c9456"); } }
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./doc/images/local-development/ConfigAdminApplication-Run.png
PNG  IHDR. iCCPICC ProfileHT[̤ZB{5A:JHc Pೠ"6!ERDEĂ PPׇ*;=o|͝g ,Q'3&62z,@؜LGhh@53Uhrm:Y߯Ws29@('r39(B#es\2]6ININ;Ss"¼P@aE)?yf6'Cl!({ᱹ(ltlOuRR3QZNL񿕑.y? դ- q~ S'aNW sށ3,Nah^~+bEKäXRN d/kx3͏?Ùiၳsy8LsWqسE#퇛# "YҚpY6é:+`,@JʝRr?@wM%0,,܃ӟ1C9^7g:3H@$pĢf$toӁ2PgvB@@l@9p -,  (!CT)C.d YA+AaP,@H CP Tj_ =F` L`=v=@8^<UQ߀<0Mq@$IFDj)E Bn#50L)㏉p0011L36f3bUX', M` jl2.v1p8{?.[یۋkuzq1<7ƻCl|߇& +/! #> 8QKt"ĭ6Mq$O'"H2R21=L";|r8*y@1xQ)bJ=JգSY-ZESg K+FBYO,QVWCvllIٛrzr^rlrri!+|  .* 6͋ơ] qt}:J/Gms+)JCb32N01Q1'iΦ9 s|R䮔TԨtW2SG9Myr}*U^ϥu˙[4܇j Cݪcjj~jB=j^3Swh4\5;5kd*2=2%樦Xf渖V:F'$mdڝڣ:::+uuutyut?EmkWg?6,32c3t0L3kx65U4{{M&&*~Sii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5?6vm >ݻwۼ]Uc_~ǫXD=d=0N>s}e{0jk$KʸӓciA`Sl:'Yn'Srl(z \ LF`-3Lp4ou2Lt]qcvHh1w#M*<UG6r|[|Ǐ:Syi+4: lgy͖kV_|(E3#Ї ǝt0]ci%$&&8vpHZ,^f"ly{<⎧$\6Ӑ>ЦѮ|t Z:1.r>6<Ԍ8jdS*d|wԷIrl/F:^sxJƔ;Y 4Tv&Y\y4q >͂HwS."7# +̧MGEqysŊd#k 7QV#.)_'yZX8DOT$'̗u*k>׮B|>ـ盡I @/Z:.^qɈZ3khY&%fsXi?W3U!4 Y_&!h{PPSy@pb,VMC߆ap` C`Mp v1v+?m0O&Y|! [#W6P`:*d,6;k)v&u* i \Z|1pk8|}$فMN6ґ)NdTqYg27BMh K&dfѴ%IkQ>HYWo¨/sd8D?gD8O6aҙ:=\3߹ҺT-*>SM Tju8 f :3im}US$pIָ '&r= ;Ak^MGi/ZhѩɔãӔ{E~+x,4|v{4٦Eecd_Gv[Su]5~ViϤyfq[ hI HPJQYӪ-I#J@*.v|N}r ^% @asHKq_|$I(}) \;?xyobIENDB`
-1
apolloconfig/apollo
3,699
Remove redundant invoke of trySyncFromUpstream
Fix #3698
Technoboy-
2021-05-21T08:58:57Z
2021-05-21T09:38:14Z
0fb159f5f28fa379351e978c7aba0ec3a00aa4e9
f41a73b92d19383bbb542c51b0f6d062e9e80e3b
Remove redundant invoke of trySyncFromUpstream. Fix #3698
./apollo-portal/src/main/config/application-ldap-apacheds-sample.yml
# # Copyright 2021 Apollo Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # ldap sample for apache ds, need to rename this file to application-ldap.yml to make it effective spring: ldap: base: "dc=example,dc=com" username: "uid=admin,ou=system" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:10389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id rdnKey: "cn" # ldap rdn key,可选项,如需启用group search需要配置 userDisplayName: "displayName" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 # group: # 配置ldap group,可选配置,启用后只有特定group的用户可以登录apollo # objectClass: "groupOfNames" # 配置groupClassName # groupBase: "ou=group" # group search base # groupSearch: "(&(cn=dev))" # group filter # groupMembership: "member" # group memberShip eg. member or memberUid
# # Copyright 2021 Apollo Authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # ldap sample for apache ds, need to rename this file to application-ldap.yml to make it effective spring: ldap: base: "dc=example,dc=com" username: "uid=admin,ou=system" # 配置管理员账号,用于搜索、匹配用户 password: "password" searchFilter: "(uid={0})" # 用户过滤器,登录的时候用这个过滤器来搜索用户 urls: - "ldap://localhost:10389" ldap: mapping: # 配置 ldap 属性 objectClass: "inetOrgPerson" # ldap 用户 objectClass 配置 loginId: "uid" # ldap 用户惟一 id,用来作为登录的 id rdnKey: "cn" # ldap rdn key,可选项,如需启用group search需要配置 userDisplayName: "displayName" # ldap 用户名,用来作为显示名 email: "mail" # ldap 邮箱属性 # group: # 配置ldap group,可选配置,启用后只有特定group的用户可以登录apollo # objectClass: "groupOfNames" # 配置groupClassName # groupBase: "ou=group" # group search base # groupSearch: "(&(cn=dev))" # group filter # groupMembership: "member" # group memberShip eg. member or memberUid
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-assembly/src/main/resources/application.yml
spring: profiles: active: ${apollo_profile} cloud: consul: enabled: false logging: file: name: /opt/logs/100003171/apollo-assembly.log management: health: status: order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP ldap: enabled: false eureka: instance: hostname: ${hostname:localhost} preferIpAddress: true status-page-url-path: /info health-check-url-path: /health server: peerEurekaNodesUpdateIntervalMs: 60000 enableSelfPreservation: false client: serviceUrl: # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig defaultZone: http://${eureka.instance.hostname}:8080/eureka/ healthcheck: enabled: true eurekaServiceUrlPollIntervalSeconds: 60
spring: profiles: active: ${apollo_profile} cloud: consul: enabled: false logging: file: name: /opt/logs/100003171/apollo-assembly.log management: health: status: order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP ldap: enabled: false eureka: instance: hostname: ${hostname:localhost} preferIpAddress: true status-page-url-path: /info health-check-url-path: /health server: peerEurekaNodesUpdateIntervalMs: 60000 enableSelfPreservation: false client: serviceUrl: # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig defaultZone: http://${eureka.instance.hostname}:8080/eureka/ healthcheck: enabled: true eurekaServiceUrlPollIntervalSeconds: 60 fetch-registry: false registerWithEureka: false
1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/eureka/ApolloEurekaClientConfig.java
package com.ctrip.framework.apollo.biz.eureka; import com.ctrip.framework.apollo.biz.config.BizConfig; import org.springframework.cloud.netflix.eureka.EurekaClientConfigBean; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.util.List; @Component @Primary public class ApolloEurekaClientConfig extends EurekaClientConfigBean { private final BizConfig bizConfig; public ApolloEurekaClientConfig(final BizConfig bizConfig) { this.bizConfig = bizConfig; } /** * Assert only one zone: defaultZone, but multiple environments. */ public List<String> getEurekaServerServiceUrls(String myZone) { List<String> urls = bizConfig.eurekaServiceUrls(); return CollectionUtils.isEmpty(urls) ? super.getEurekaServerServiceUrls(myZone) : urls; } @Override public boolean equals(Object o) { return super.equals(o); } }
package com.ctrip.framework.apollo.biz.eureka; import com.ctrip.framework.apollo.biz.config.BizConfig; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.cloud.context.scope.refresh.RefreshScope; import org.springframework.cloud.netflix.eureka.EurekaClientConfigBean; import org.springframework.context.annotation.Primary; import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.util.List; @Component @Primary @ConditionalOnProperty(value = {"eureka.client.enabled"}, havingValue = "true", matchIfMissing = true) public class ApolloEurekaClientConfig extends EurekaClientConfigBean { private final BizConfig bizConfig; private final RefreshScope refreshScope; private static final String EUREKA_CLIENT_BEAN_NAME = "eurekaClient"; public ApolloEurekaClientConfig(final BizConfig bizConfig, final RefreshScope refreshScope) { this.bizConfig = bizConfig; this.refreshScope = refreshScope; } /** * Assert only one zone: defaultZone, but multiple environments. */ public List<String> getEurekaServerServiceUrls(String myZone) { List<String> urls = bizConfig.eurekaServiceUrls(); return CollectionUtils.isEmpty(urls) ? super.getEurekaServerServiceUrls(myZone) : urls; } @EventListener public void listenApplicationReadyEvent(ApplicationReadyEvent event) { this.refreshEurekaClient(); } private void refreshEurekaClient() { if (!super.isFetchRegistry()) { super.setFetchRegistry(true); super.setRegisterWithEureka(true); refreshScope.refresh(EUREKA_CLIENT_BEAN_NAME); } } @Override public boolean equals(Object o) { return super.equals(o); } }
1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-configservice/src/main/resources/application.yml
spring: application: name: apollo-configservice profiles: active: ${apollo_profile} cloud: consul: enabled: false ctrip: appid: 100003171 server: port: 8080 logging: file: name: /opt/logs/100003171/apollo-configservice.log eureka: instance: hostname: ${hostname:localhost} preferIpAddress: true status-page-url-path: /info health-check-url-path: /health server: peerEurekaNodesUpdateIntervalMs: 60000 enableSelfPreservation: false client: serviceUrl: # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig defaultZone: http://${eureka.instance.hostname}:8080/eureka/ healthcheck: enabled: true eurekaServiceUrlPollIntervalSeconds: 60 management: health: status: order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
spring: application: name: apollo-configservice profiles: active: ${apollo_profile} cloud: consul: enabled: false ctrip: appid: 100003171 server: port: 8080 logging: file: name: /opt/logs/100003171/apollo-configservice.log eureka: instance: hostname: ${hostname:localhost} preferIpAddress: true status-page-url-path: /info health-check-url-path: /health server: peerEurekaNodesUpdateIntervalMs: 60000 enableSelfPreservation: false client: serviceUrl: # This setting will be overridden by eureka.service.url setting from ApolloConfigDB.ServerConfig or System Property # see com.ctrip.framework.apollo.biz.eureka.ApolloEurekaClientConfig defaultZone: http://${eureka.instance.hostname}:8080/eureka/ healthcheck: enabled: true eurekaServiceUrlPollIntervalSeconds: 60 fetch-registry: false registerWithEureka: false management: health: status: order: DOWN, OUT_OF_SERVICE, UNKNOWN, UP
1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/api/API.java
package com.ctrip.framework.apollo.portal.api; import com.ctrip.framework.apollo.portal.component.RetryableRestTemplate; import org.springframework.beans.factory.annotation.Autowired; public abstract class API { @Autowired protected RetryableRestTemplate restTemplate; }
package com.ctrip.framework.apollo.portal.api; import com.ctrip.framework.apollo.portal.component.RetryableRestTemplate; import org.springframework.beans.factory.annotation.Autowired; public abstract class API { @Autowired protected RetryableRestTemplate restTemplate; }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/EntityPair.java
package com.ctrip.framework.apollo.common.entity; public class EntityPair<E> { private E firstEntity; private E secondEntity; public EntityPair(E firstEntity, E secondEntity){ this.firstEntity = firstEntity; this.secondEntity = secondEntity; } public E getFirstEntity() { return firstEntity; } public void setFirstEntity(E firstEntity) { this.firstEntity = firstEntity; } public E getSecondEntity() { return secondEntity; } public void setSecondEntity(E secondEntity) { this.secondEntity = secondEntity; } }
package com.ctrip.framework.apollo.common.entity; public class EntityPair<E> { private E firstEntity; private E secondEntity; public EntityPair(E firstEntity, E secondEntity){ this.firstEntity = firstEntity; this.secondEntity = secondEntity; } public E getFirstEntity() { return firstEntity; } public void setFirstEntity(E firstEntity) { this.firstEntity = firstEntity; } public E getSecondEntity() { return secondEntity; } public void setSecondEntity(E secondEntity) { this.secondEntity = secondEntity; } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-demo/src/main/java/com/ctrip/framework/apollo/demo/spring/common/config/AppConfig.java
package com.ctrip.framework.apollo.demo.spring.common.config; import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig; import org.springframework.context.annotation.Configuration; /** * @author Jason Song(song_s@ctrip.com) */ @Configuration @EnableApolloConfig(value = "application", order = 10) public class AppConfig { }
package com.ctrip.framework.apollo.demo.spring.common.config; import com.ctrip.framework.apollo.spring.annotation.EnableApolloConfig; import org.springframework.context.annotation.Configuration; /** * @author Jason Song(song_s@ctrip.com) */ @Configuration @EnableApolloConfig(value = "application", order = 10) public class AppConfig { }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/service/ConsumerRolePermissionServiceTest.java
package com.ctrip.framework.apollo.openapi.service; import com.ctrip.framework.apollo.portal.AbstractIntegrationTest; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.jdbc.Sql; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** * @author Jason Song(song_s@ctrip.com) */ public class ConsumerRolePermissionServiceTest extends AbstractIntegrationTest { @Autowired private ConsumerRolePermissionService consumerRolePermissionService; @Before public void setUp() throws Exception { } @Test @Sql(scripts = "/sql/permission/insert-test-roles.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/permission/insert-test-permissions.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/permission/insert-test-consumerroles.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/permission/insert-test-rolepermissions.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testConsumerHasPermission() throws Exception { String someTargetId = "someTargetId"; String anotherTargetId = "anotherTargetId"; String somePermissionType = "somePermissionType"; String anotherPermissionType = "anotherPermissionType"; long someConsumerId = 1; long anotherConsumerId = 2; long someConsumerWithNoPermission = 3; assertTrue(consumerRolePermissionService.consumerHasPermission(someConsumerId, somePermissionType, someTargetId)); assertTrue(consumerRolePermissionService.consumerHasPermission(someConsumerId, anotherPermissionType, anotherTargetId)); assertTrue(consumerRolePermissionService.consumerHasPermission(anotherConsumerId, somePermissionType, someTargetId)); assertTrue(consumerRolePermissionService.consumerHasPermission(anotherConsumerId, anotherPermissionType, anotherTargetId)); assertFalse(consumerRolePermissionService.consumerHasPermission(someConsumerWithNoPermission, somePermissionType, someTargetId)); assertFalse(consumerRolePermissionService.consumerHasPermission(someConsumerWithNoPermission, anotherPermissionType, anotherTargetId)); } }
package com.ctrip.framework.apollo.openapi.service; import com.ctrip.framework.apollo.portal.AbstractIntegrationTest; import org.junit.Before; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.jdbc.Sql; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; /** * @author Jason Song(song_s@ctrip.com) */ public class ConsumerRolePermissionServiceTest extends AbstractIntegrationTest { @Autowired private ConsumerRolePermissionService consumerRolePermissionService; @Before public void setUp() throws Exception { } @Test @Sql(scripts = "/sql/permission/insert-test-roles.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/permission/insert-test-permissions.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/permission/insert-test-consumerroles.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/permission/insert-test-rolepermissions.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD) @Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) public void testConsumerHasPermission() throws Exception { String someTargetId = "someTargetId"; String anotherTargetId = "anotherTargetId"; String somePermissionType = "somePermissionType"; String anotherPermissionType = "anotherPermissionType"; long someConsumerId = 1; long anotherConsumerId = 2; long someConsumerWithNoPermission = 3; assertTrue(consumerRolePermissionService.consumerHasPermission(someConsumerId, somePermissionType, someTargetId)); assertTrue(consumerRolePermissionService.consumerHasPermission(someConsumerId, anotherPermissionType, anotherTargetId)); assertTrue(consumerRolePermissionService.consumerHasPermission(anotherConsumerId, somePermissionType, someTargetId)); assertTrue(consumerRolePermissionService.consumerHasPermission(anotherConsumerId, anotherPermissionType, anotherTargetId)); assertFalse(consumerRolePermissionService.consumerHasPermission(someConsumerWithNoPermission, somePermissionType, someTargetId)); assertFalse(consumerRolePermissionService.consumerHasPermission(someConsumerWithNoPermission, anotherPermissionType, anotherTargetId)); } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/grayReleaseRule/GrayReleaseRulesHolderTest.java
package com.ctrip.framework.apollo.biz.grayReleaseRule; import com.google.common.base.Joiner; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.google.gson.Gson; import com.ctrip.framework.apollo.biz.config.BizConfig; import com.ctrip.framework.apollo.biz.entity.GrayReleaseRule; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.repository.GrayReleaseRuleRepository; import com.ctrip.framework.apollo.common.constants.NamespaceBranchStatus; import com.ctrip.framework.apollo.common.dto.GrayReleaseRuleItemDTO; import com.ctrip.framework.apollo.core.ConfigConsts; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicLong; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; /** * @author Jason Song(song_s@ctrip.com) */ @RunWith(MockitoJUnitRunner.class) public class GrayReleaseRulesHolderTest { private static final Joiner STRING_JOINER = Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR); private GrayReleaseRulesHolder grayReleaseRulesHolder; @Mock private BizConfig bizConfig; @Mock private GrayReleaseRuleRepository grayReleaseRuleRepository; private static final Gson GSON = new Gson(); private AtomicLong idCounter; @Before public void setUp() throws Exception { grayReleaseRulesHolder = spy(new GrayReleaseRulesHolder()); ReflectionTestUtils.setField(grayReleaseRulesHolder, "bizConfig", bizConfig); ReflectionTestUtils.setField(grayReleaseRulesHolder, "grayReleaseRuleRepository", grayReleaseRuleRepository); idCounter = new AtomicLong(); } @Test public void testScanGrayReleaseRules() throws Exception { String someAppId = "someAppId"; String someClusterName = "someClusterName"; String someNamespaceName = "someNamespaceName"; String anotherNamespaceName = "anotherNamespaceName"; Long someReleaseId = 1L; int activeBranchStatus = NamespaceBranchStatus.ACTIVE; String someClientAppId = "clientAppId1"; String someClientIp = "1.1.1.1"; String anotherClientAppId = "clientAppId2"; String anotherClientIp = "2.2.2.2"; GrayReleaseRule someRule = assembleGrayReleaseRule(someAppId, someClusterName, someNamespaceName, Lists.newArrayList(assembleRuleItem(someClientAppId, Sets.newHashSet (someClientIp))), someReleaseId, activeBranchStatus); when(bizConfig.grayReleaseRuleScanInterval()).thenReturn(30); when(grayReleaseRuleRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)).thenReturn(Lists .newArrayList(someRule)); //scan rules grayReleaseRulesHolder.afterPropertiesSet(); assertEquals(someReleaseId, grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule (someClientAppId, someClientIp, someAppId, someClusterName, someNamespaceName)); assertEquals(someReleaseId, grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule (someClientAppId.toUpperCase(), someClientIp, someAppId.toUpperCase(), someClusterName, someNamespaceName.toUpperCase())); assertNull(grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule(someClientAppId, anotherClientIp, someAppId, someClusterName, someNamespaceName)); assertNull(grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule(anotherClientAppId, someClientIp, someAppId, someClusterName, someNamespaceName)); assertNull(grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule(anotherClientAppId, anotherClientIp, someAppId, someClusterName, someNamespaceName)); assertTrue(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId, someClientIp, someNamespaceName)); assertTrue(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId.toUpperCase(), someClientIp, someNamespaceName.toUpperCase())); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId, anotherClientIp, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId, someClientIp, anotherNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(anotherClientAppId, anotherClientIp, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(anotherClientAppId, anotherClientIp, anotherNamespaceName)); GrayReleaseRule anotherRule = assembleGrayReleaseRule(someAppId, someClusterName, someNamespaceName, Lists.newArrayList(assembleRuleItem(anotherClientAppId, Sets.newHashSet (anotherClientIp))), someReleaseId, activeBranchStatus); when(grayReleaseRuleRepository.findByAppIdAndClusterNameAndNamespaceName(someAppId, someClusterName, someNamespaceName)).thenReturn(Lists.newArrayList(anotherRule)); //send message grayReleaseRulesHolder.handleMessage(assembleReleaseMessage(someAppId, someClusterName, someNamespaceName), Topics.APOLLO_RELEASE_TOPIC); assertNull(grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule (someClientAppId, someClientIp, someAppId, someClusterName, someNamespaceName)); assertEquals(someReleaseId, grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule (anotherClientAppId, anotherClientIp, someAppId, someClusterName, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId, someClientIp, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId, someClientIp, anotherNamespaceName)); assertTrue(grayReleaseRulesHolder.hasGrayReleaseRule(anotherClientAppId, anotherClientIp, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(anotherClientAppId, someClientIp, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(anotherClientAppId, anotherClientIp, anotherNamespaceName)); } private GrayReleaseRule assembleGrayReleaseRule(String appId, String clusterName, String namespaceName, List<GrayReleaseRuleItemDTO> ruleItems, long releaseId, int branchStatus) { GrayReleaseRule rule = new GrayReleaseRule(); rule.setId(idCounter.incrementAndGet()); rule.setAppId(appId); rule.setClusterName(clusterName); rule.setNamespaceName(namespaceName); rule.setBranchName("someBranch"); rule.setRules(GSON.toJson(ruleItems)); rule.setReleaseId(releaseId); rule.setBranchStatus(branchStatus); return rule; } private GrayReleaseRuleItemDTO assembleRuleItem(String clientAppId, Set<String> clientIpList) { return new GrayReleaseRuleItemDTO(clientAppId, clientIpList); } private ReleaseMessage assembleReleaseMessage(String appId, String clusterName, String namespaceName) { String message = STRING_JOINER.join(appId, clusterName, namespaceName); ReleaseMessage releaseMessage = new ReleaseMessage(message); return releaseMessage; } }
package com.ctrip.framework.apollo.biz.grayReleaseRule; import com.google.common.base.Joiner; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.google.gson.Gson; import com.ctrip.framework.apollo.biz.config.BizConfig; import com.ctrip.framework.apollo.biz.entity.GrayReleaseRule; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.repository.GrayReleaseRuleRepository; import com.ctrip.framework.apollo.common.constants.NamespaceBranchStatus; import com.ctrip.framework.apollo.common.dto.GrayReleaseRuleItemDTO; import com.ctrip.framework.apollo.core.ConfigConsts; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicLong; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; /** * @author Jason Song(song_s@ctrip.com) */ @RunWith(MockitoJUnitRunner.class) public class GrayReleaseRulesHolderTest { private static final Joiner STRING_JOINER = Joiner.on(ConfigConsts.CLUSTER_NAMESPACE_SEPARATOR); private GrayReleaseRulesHolder grayReleaseRulesHolder; @Mock private BizConfig bizConfig; @Mock private GrayReleaseRuleRepository grayReleaseRuleRepository; private static final Gson GSON = new Gson(); private AtomicLong idCounter; @Before public void setUp() throws Exception { grayReleaseRulesHolder = spy(new GrayReleaseRulesHolder()); ReflectionTestUtils.setField(grayReleaseRulesHolder, "bizConfig", bizConfig); ReflectionTestUtils.setField(grayReleaseRulesHolder, "grayReleaseRuleRepository", grayReleaseRuleRepository); idCounter = new AtomicLong(); } @Test public void testScanGrayReleaseRules() throws Exception { String someAppId = "someAppId"; String someClusterName = "someClusterName"; String someNamespaceName = "someNamespaceName"; String anotherNamespaceName = "anotherNamespaceName"; Long someReleaseId = 1L; int activeBranchStatus = NamespaceBranchStatus.ACTIVE; String someClientAppId = "clientAppId1"; String someClientIp = "1.1.1.1"; String anotherClientAppId = "clientAppId2"; String anotherClientIp = "2.2.2.2"; GrayReleaseRule someRule = assembleGrayReleaseRule(someAppId, someClusterName, someNamespaceName, Lists.newArrayList(assembleRuleItem(someClientAppId, Sets.newHashSet (someClientIp))), someReleaseId, activeBranchStatus); when(bizConfig.grayReleaseRuleScanInterval()).thenReturn(30); when(grayReleaseRuleRepository.findFirst500ByIdGreaterThanOrderByIdAsc(0L)).thenReturn(Lists .newArrayList(someRule)); //scan rules grayReleaseRulesHolder.afterPropertiesSet(); assertEquals(someReleaseId, grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule (someClientAppId, someClientIp, someAppId, someClusterName, someNamespaceName)); assertEquals(someReleaseId, grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule (someClientAppId.toUpperCase(), someClientIp, someAppId.toUpperCase(), someClusterName, someNamespaceName.toUpperCase())); assertNull(grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule(someClientAppId, anotherClientIp, someAppId, someClusterName, someNamespaceName)); assertNull(grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule(anotherClientAppId, someClientIp, someAppId, someClusterName, someNamespaceName)); assertNull(grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule(anotherClientAppId, anotherClientIp, someAppId, someClusterName, someNamespaceName)); assertTrue(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId, someClientIp, someNamespaceName)); assertTrue(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId.toUpperCase(), someClientIp, someNamespaceName.toUpperCase())); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId, anotherClientIp, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId, someClientIp, anotherNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(anotherClientAppId, anotherClientIp, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(anotherClientAppId, anotherClientIp, anotherNamespaceName)); GrayReleaseRule anotherRule = assembleGrayReleaseRule(someAppId, someClusterName, someNamespaceName, Lists.newArrayList(assembleRuleItem(anotherClientAppId, Sets.newHashSet (anotherClientIp))), someReleaseId, activeBranchStatus); when(grayReleaseRuleRepository.findByAppIdAndClusterNameAndNamespaceName(someAppId, someClusterName, someNamespaceName)).thenReturn(Lists.newArrayList(anotherRule)); //send message grayReleaseRulesHolder.handleMessage(assembleReleaseMessage(someAppId, someClusterName, someNamespaceName), Topics.APOLLO_RELEASE_TOPIC); assertNull(grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule (someClientAppId, someClientIp, someAppId, someClusterName, someNamespaceName)); assertEquals(someReleaseId, grayReleaseRulesHolder.findReleaseIdFromGrayReleaseRule (anotherClientAppId, anotherClientIp, someAppId, someClusterName, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId, someClientIp, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(someClientAppId, someClientIp, anotherNamespaceName)); assertTrue(grayReleaseRulesHolder.hasGrayReleaseRule(anotherClientAppId, anotherClientIp, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(anotherClientAppId, someClientIp, someNamespaceName)); assertFalse(grayReleaseRulesHolder.hasGrayReleaseRule(anotherClientAppId, anotherClientIp, anotherNamespaceName)); } private GrayReleaseRule assembleGrayReleaseRule(String appId, String clusterName, String namespaceName, List<GrayReleaseRuleItemDTO> ruleItems, long releaseId, int branchStatus) { GrayReleaseRule rule = new GrayReleaseRule(); rule.setId(idCounter.incrementAndGet()); rule.setAppId(appId); rule.setClusterName(clusterName); rule.setNamespaceName(namespaceName); rule.setBranchName("someBranch"); rule.setRules(GSON.toJson(ruleItems)); rule.setReleaseId(releaseId); rule.setBranchStatus(branchStatus); return rule; } private GrayReleaseRuleItemDTO assembleRuleItem(String clientAppId, Set<String> clientIpList) { return new GrayReleaseRuleItemDTO(clientAppId, clientIpList); } private ReleaseMessage assembleReleaseMessage(String appId, String clusterName, String namespaceName) { String message = STRING_JOINER.join(appId, clusterName, namespaceName); ReleaseMessage releaseMessage = new ReleaseMessage(message); return releaseMessage; } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-biz/src/test/java/com/ctrip/framework/apollo/biz/service/ReleaseServiceTest.java
package com.ctrip.framework.apollo.biz.service; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.ctrip.framework.apollo.biz.AbstractUnitTest; import com.ctrip.framework.apollo.biz.MockBeanFactory; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.repository.ReleaseRepository; import com.ctrip.framework.apollo.common.exception.BadRequestException; import java.util.ArrayList; import java.util.Optional; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.springframework.data.domain.PageRequest; import java.util.Arrays; import java.util.List; import java.util.Set; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class ReleaseServiceTest extends AbstractUnitTest { @Mock private ReleaseRepository releaseRepository; @Mock private NamespaceService namespaceService; @Mock private ReleaseHistoryService releaseHistoryService; @Mock private ItemSetService itemSetService; @InjectMocks private ReleaseService releaseService; private String appId = "appId-test"; private String clusterName = "cluster-test"; private String namespaceName = "namespace-test"; private String user = "user-test"; private long releaseId = 1; private Release firstRelease; private Release secondRelease; private PageRequest pageRequest; @Before public void init() { firstRelease = new Release(); firstRelease.setId(releaseId); firstRelease.setAppId(appId); firstRelease.setClusterName(clusterName); firstRelease.setNamespaceName(namespaceName); firstRelease.setAbandoned(false); secondRelease = new Release(); secondRelease.setAppId(appId); secondRelease.setClusterName(clusterName); secondRelease.setNamespaceName(namespaceName); secondRelease.setAbandoned(false); pageRequest = PageRequest.of(0, 2); } @Test(expected = BadRequestException.class) public void testNamespaceNotExist() { when(releaseRepository.findById(releaseId)).thenReturn(Optional.of(firstRelease)); releaseService.rollback(releaseId, user); } @Test(expected = BadRequestException.class) public void testHasNoRelease() { when(releaseRepository.findById(releaseId)).thenReturn(Optional.of(firstRelease)); when(releaseRepository.findByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(appId, clusterName, namespaceName, pageRequest)) .thenReturn(null); releaseService.rollback(releaseId, user); } @Test public void testRollback() { when(releaseRepository.findById(releaseId)).thenReturn(Optional.of(firstRelease)); when(releaseRepository.findByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(appId, clusterName, namespaceName, pageRequest)) .thenReturn( Arrays.asList(firstRelease, secondRelease)); releaseService.rollback(releaseId, user); verify(releaseRepository).save(firstRelease); Assert.assertEquals(true, firstRelease.isAbandoned()); Assert.assertEquals(user, firstRelease.getDataChangeLastModifiedBy()); } @Test public void testRollbackTo() { List<Release> releaseList = new ArrayList<>(); for (int i = 0; i < 3; i++) { Release release = new Release(); release.setId(3 - i); release.setAppId(appId); release.setClusterName(clusterName); release.setNamespaceName(namespaceName); release.setAbandoned(false); releaseList.add(release); } long releaseId1 = 1; long releaseId3 = 3; when(releaseRepository.findById(releaseId1)).thenReturn(Optional.of(releaseList.get(2))); when(releaseRepository.findById(releaseId3)).thenReturn(Optional.of(releaseList.get(0))); when(releaseRepository.findByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseAndIdBetweenOrderByIdDesc(appId, clusterName, namespaceName, releaseId1, releaseId3)) .thenReturn(releaseList); releaseService.rollbackTo(releaseId3, releaseId1, user); verify(releaseRepository).saveAll(releaseList); Assert.assertTrue(releaseList.get(0).isAbandoned()); Assert.assertTrue(releaseList.get(1).isAbandoned()); Assert.assertFalse(releaseList.get(2).isAbandoned()); Assert.assertEquals(user, releaseList.get(0).getDataChangeLastModifiedBy()); Assert.assertEquals(user, releaseList.get(1).getDataChangeLastModifiedBy()); } @Test public void testFindRelease() throws Exception { String someAppId = "1"; String someClusterName = "someClusterName"; String someNamespaceName = "someNamespaceName"; long someReleaseId = 1; String someReleaseKey = "someKey"; String someValidConfiguration = "{\"apollo.bar\": \"foo\"}"; Release someRelease = MockBeanFactory.mockRelease(someReleaseId, someReleaseKey, someAppId, someClusterName, someNamespaceName, someValidConfiguration); when(releaseRepository.findFirstByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(someAppId, someClusterName, someNamespaceName)) .thenReturn(someRelease); Release result = releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); verify(releaseRepository, times(1)) .findFirstByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(someAppId, someClusterName, someNamespaceName); assertEquals(someAppId, result.getAppId()); assertEquals(someClusterName, result.getClusterName()); assertEquals(someReleaseId, result.getId()); assertEquals(someReleaseKey, result.getReleaseKey()); assertEquals(someValidConfiguration, result.getConfigurations()); } @Test public void testLoadConfigWithConfigNotFound() throws Exception { String someAppId = "1"; String someClusterName = "someClusterName"; String someNamespaceName = "someNamespaceName"; when(releaseRepository.findFirstByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(someAppId, someClusterName, someNamespaceName)) .thenReturn(null); Release result = releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); assertNull(result); verify(releaseRepository, times(1)).findFirstByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc( someAppId, someClusterName, someNamespaceName); } @Test public void testFindByReleaseIds() throws Exception { Release someRelease = mock(Release.class); Release anotherRelease = mock(Release.class); long someReleaseId = 1; long anotherReleaseId = 2; List<Release> someReleases = Lists.newArrayList(someRelease, anotherRelease); Set<Long> someReleaseIds = Sets.newHashSet(someReleaseId, anotherReleaseId); when(releaseRepository.findAllById(someReleaseIds)).thenReturn(someReleases); List<Release> result = releaseService.findByReleaseIds(someReleaseIds); assertEquals(someReleases, result); } @Test public void testFindByReleaseKeys() throws Exception { Release someRelease = mock(Release.class); Release anotherRelease = mock(Release.class); String someReleaseKey = "key1"; String anotherReleaseKey = "key2"; List<Release> someReleases = Lists.newArrayList(someRelease, anotherRelease); Set<String> someReleaseKeys = Sets.newHashSet(someReleaseKey, anotherReleaseKey); when(releaseRepository.findByReleaseKeyIn(someReleaseKeys)).thenReturn(someReleases); List<Release> result = releaseService.findByReleaseKeys(someReleaseKeys); assertEquals(someReleases, result); } }
package com.ctrip.framework.apollo.biz.service; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.ctrip.framework.apollo.biz.AbstractUnitTest; import com.ctrip.framework.apollo.biz.MockBeanFactory; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.repository.ReleaseRepository; import com.ctrip.framework.apollo.common.exception.BadRequestException; import java.util.ArrayList; import java.util.Optional; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.springframework.data.domain.PageRequest; import java.util.Arrays; import java.util.List; import java.util.Set; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; public class ReleaseServiceTest extends AbstractUnitTest { @Mock private ReleaseRepository releaseRepository; @Mock private NamespaceService namespaceService; @Mock private ReleaseHistoryService releaseHistoryService; @Mock private ItemSetService itemSetService; @InjectMocks private ReleaseService releaseService; private String appId = "appId-test"; private String clusterName = "cluster-test"; private String namespaceName = "namespace-test"; private String user = "user-test"; private long releaseId = 1; private Release firstRelease; private Release secondRelease; private PageRequest pageRequest; @Before public void init() { firstRelease = new Release(); firstRelease.setId(releaseId); firstRelease.setAppId(appId); firstRelease.setClusterName(clusterName); firstRelease.setNamespaceName(namespaceName); firstRelease.setAbandoned(false); secondRelease = new Release(); secondRelease.setAppId(appId); secondRelease.setClusterName(clusterName); secondRelease.setNamespaceName(namespaceName); secondRelease.setAbandoned(false); pageRequest = PageRequest.of(0, 2); } @Test(expected = BadRequestException.class) public void testNamespaceNotExist() { when(releaseRepository.findById(releaseId)).thenReturn(Optional.of(firstRelease)); releaseService.rollback(releaseId, user); } @Test(expected = BadRequestException.class) public void testHasNoRelease() { when(releaseRepository.findById(releaseId)).thenReturn(Optional.of(firstRelease)); when(releaseRepository.findByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(appId, clusterName, namespaceName, pageRequest)) .thenReturn(null); releaseService.rollback(releaseId, user); } @Test public void testRollback() { when(releaseRepository.findById(releaseId)).thenReturn(Optional.of(firstRelease)); when(releaseRepository.findByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(appId, clusterName, namespaceName, pageRequest)) .thenReturn( Arrays.asList(firstRelease, secondRelease)); releaseService.rollback(releaseId, user); verify(releaseRepository).save(firstRelease); Assert.assertEquals(true, firstRelease.isAbandoned()); Assert.assertEquals(user, firstRelease.getDataChangeLastModifiedBy()); } @Test public void testRollbackTo() { List<Release> releaseList = new ArrayList<>(); for (int i = 0; i < 3; i++) { Release release = new Release(); release.setId(3 - i); release.setAppId(appId); release.setClusterName(clusterName); release.setNamespaceName(namespaceName); release.setAbandoned(false); releaseList.add(release); } long releaseId1 = 1; long releaseId3 = 3; when(releaseRepository.findById(releaseId1)).thenReturn(Optional.of(releaseList.get(2))); when(releaseRepository.findById(releaseId3)).thenReturn(Optional.of(releaseList.get(0))); when(releaseRepository.findByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseAndIdBetweenOrderByIdDesc(appId, clusterName, namespaceName, releaseId1, releaseId3)) .thenReturn(releaseList); releaseService.rollbackTo(releaseId3, releaseId1, user); verify(releaseRepository).saveAll(releaseList); Assert.assertTrue(releaseList.get(0).isAbandoned()); Assert.assertTrue(releaseList.get(1).isAbandoned()); Assert.assertFalse(releaseList.get(2).isAbandoned()); Assert.assertEquals(user, releaseList.get(0).getDataChangeLastModifiedBy()); Assert.assertEquals(user, releaseList.get(1).getDataChangeLastModifiedBy()); } @Test public void testFindRelease() throws Exception { String someAppId = "1"; String someClusterName = "someClusterName"; String someNamespaceName = "someNamespaceName"; long someReleaseId = 1; String someReleaseKey = "someKey"; String someValidConfiguration = "{\"apollo.bar\": \"foo\"}"; Release someRelease = MockBeanFactory.mockRelease(someReleaseId, someReleaseKey, someAppId, someClusterName, someNamespaceName, someValidConfiguration); when(releaseRepository.findFirstByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(someAppId, someClusterName, someNamespaceName)) .thenReturn(someRelease); Release result = releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); verify(releaseRepository, times(1)) .findFirstByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(someAppId, someClusterName, someNamespaceName); assertEquals(someAppId, result.getAppId()); assertEquals(someClusterName, result.getClusterName()); assertEquals(someReleaseId, result.getId()); assertEquals(someReleaseKey, result.getReleaseKey()); assertEquals(someValidConfiguration, result.getConfigurations()); } @Test public void testLoadConfigWithConfigNotFound() throws Exception { String someAppId = "1"; String someClusterName = "someClusterName"; String someNamespaceName = "someNamespaceName"; when(releaseRepository.findFirstByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc(someAppId, someClusterName, someNamespaceName)) .thenReturn(null); Release result = releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); assertNull(result); verify(releaseRepository, times(1)).findFirstByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderByIdDesc( someAppId, someClusterName, someNamespaceName); } @Test public void testFindByReleaseIds() throws Exception { Release someRelease = mock(Release.class); Release anotherRelease = mock(Release.class); long someReleaseId = 1; long anotherReleaseId = 2; List<Release> someReleases = Lists.newArrayList(someRelease, anotherRelease); Set<Long> someReleaseIds = Sets.newHashSet(someReleaseId, anotherReleaseId); when(releaseRepository.findAllById(someReleaseIds)).thenReturn(someReleases); List<Release> result = releaseService.findByReleaseIds(someReleaseIds); assertEquals(someReleases, result); } @Test public void testFindByReleaseKeys() throws Exception { Release someRelease = mock(Release.class); Release anotherRelease = mock(Release.class); String someReleaseKey = "key1"; String anotherReleaseKey = "key2"; List<Release> someReleases = Lists.newArrayList(someRelease, anotherRelease); Set<String> someReleaseKeys = Sets.newHashSet(someReleaseKey, anotherReleaseKey); when(releaseRepository.findByReleaseKeyIn(someReleaseKeys)).thenReturn(someReleases); List<Release> result = releaseService.findByReleaseKeys(someReleaseKeys); assertEquals(someReleases, result); } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/oidc/OidcAuthenticationSuccessEventListener.java
package com.ctrip.framework.apollo.portal.spi.oidc; import com.ctrip.framework.apollo.portal.entity.bo.UserInfo; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationListener; import org.springframework.security.authentication.event.AuthenticationSuccessEvent; import org.springframework.security.oauth2.core.oidc.user.OidcUser; import org.springframework.security.oauth2.jwt.Jwt; /** * @author vdisk <vdisk@foxmail.com> */ public class OidcAuthenticationSuccessEventListener implements ApplicationListener<AuthenticationSuccessEvent> { private static final Logger log = LoggerFactory .getLogger(OidcAuthenticationSuccessEventListener.class); private final OidcLocalUserService oidcLocalUserService; private final ConcurrentMap<String, String> userIdCache = new ConcurrentHashMap<>(); public OidcAuthenticationSuccessEventListener( OidcLocalUserService oidcLocalUserService) { this.oidcLocalUserService = oidcLocalUserService; } @Override public void onApplicationEvent(AuthenticationSuccessEvent event) { Object principal = event.getAuthentication().getPrincipal(); if (principal instanceof OidcUser) { this.oidcUserLogin((OidcUser) principal); return; } if (principal instanceof Jwt) { this.jwtLogin((Jwt) principal); return; } log.warn("principal is neither oidcUser nor jwt, principal=[{}]", principal); } private void oidcUserLogin(OidcUser oidcUser) { if (this.contains(oidcUser.getSubject())) { return; } UserInfo newUserInfo = new UserInfo(); newUserInfo.setUserId(oidcUser.getSubject()); newUserInfo.setName(oidcUser.getPreferredUsername()); newUserInfo.setEmail(oidcUser.getEmail()); this.oidcLocalUserService.createLocalUser(newUserInfo); } private boolean contains(String userId) { if (this.userIdCache.containsKey(userId)) { return true; } UserInfo userInfo = this.oidcLocalUserService.findByUserId(userId); if (userInfo != null) { this.userIdCache.put(userId, userId); return true; } return false; } private void jwtLogin(Jwt jwt) { if (this.contains(jwt.getSubject())) { return; } UserInfo newUserInfo = new UserInfo(); newUserInfo.setUserId(jwt.getSubject()); this.oidcLocalUserService.createLocalUser(newUserInfo); } }
package com.ctrip.framework.apollo.portal.spi.oidc; import com.ctrip.framework.apollo.portal.entity.bo.UserInfo; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.ApplicationListener; import org.springframework.security.authentication.event.AuthenticationSuccessEvent; import org.springframework.security.oauth2.core.oidc.user.OidcUser; import org.springframework.security.oauth2.jwt.Jwt; /** * @author vdisk <vdisk@foxmail.com> */ public class OidcAuthenticationSuccessEventListener implements ApplicationListener<AuthenticationSuccessEvent> { private static final Logger log = LoggerFactory .getLogger(OidcAuthenticationSuccessEventListener.class); private final OidcLocalUserService oidcLocalUserService; private final ConcurrentMap<String, String> userIdCache = new ConcurrentHashMap<>(); public OidcAuthenticationSuccessEventListener( OidcLocalUserService oidcLocalUserService) { this.oidcLocalUserService = oidcLocalUserService; } @Override public void onApplicationEvent(AuthenticationSuccessEvent event) { Object principal = event.getAuthentication().getPrincipal(); if (principal instanceof OidcUser) { this.oidcUserLogin((OidcUser) principal); return; } if (principal instanceof Jwt) { this.jwtLogin((Jwt) principal); return; } log.warn("principal is neither oidcUser nor jwt, principal=[{}]", principal); } private void oidcUserLogin(OidcUser oidcUser) { if (this.contains(oidcUser.getSubject())) { return; } UserInfo newUserInfo = new UserInfo(); newUserInfo.setUserId(oidcUser.getSubject()); newUserInfo.setName(oidcUser.getPreferredUsername()); newUserInfo.setEmail(oidcUser.getEmail()); this.oidcLocalUserService.createLocalUser(newUserInfo); } private boolean contains(String userId) { if (this.userIdCache.containsKey(userId)) { return true; } UserInfo userInfo = this.oidcLocalUserService.findByUserId(userId); if (userInfo != null) { this.userIdCache.put(userId, userId); return true; } return false; } private void jwtLogin(Jwt jwt) { if (this.contains(jwt.getSubject())) { return; } UserInfo newUserInfo = new UserInfo(); newUserInfo.setUserId(jwt.getSubject()); this.oidcLocalUserService.createLocalUser(newUserInfo); } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-client/src/main/java/com/ctrip/framework/apollo/spi/DefaultConfigRegistry.java
package com.ctrip.framework.apollo.spi; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.Maps; /** * @author Jason Song(song_s@ctrip.com) */ public class DefaultConfigRegistry implements ConfigRegistry { private static final Logger s_logger = LoggerFactory.getLogger(DefaultConfigRegistry.class); private Map<String, ConfigFactory> m_instances = Maps.newConcurrentMap(); @Override public void register(String namespace, ConfigFactory factory) { if (m_instances.containsKey(namespace)) { s_logger.warn("ConfigFactory({}) is overridden by {}!", namespace, factory.getClass()); } m_instances.put(namespace, factory); } @Override public ConfigFactory getFactory(String namespace) { ConfigFactory config = m_instances.get(namespace); return config; } }
package com.ctrip.framework.apollo.spi; import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.google.common.collect.Maps; /** * @author Jason Song(song_s@ctrip.com) */ public class DefaultConfigRegistry implements ConfigRegistry { private static final Logger s_logger = LoggerFactory.getLogger(DefaultConfigRegistry.class); private Map<String, ConfigFactory> m_instances = Maps.newConcurrentMap(); @Override public void register(String namespace, ConfigFactory factory) { if (m_instances.containsKey(namespace)) { s_logger.warn("ConfigFactory({}) is overridden by {}!", namespace, factory.getClass()); } m_instances.put(namespace, factory); } @Override public ConfigFactory getFactory(String namespace) { ConfigFactory config = m_instances.get(namespace); return config; } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-core/src/main/java/com/ctrip/framework/foundation/internals/provider/NullProvider.java
package com.ctrip.framework.foundation.internals.provider; import java.io.InputStream; import com.ctrip.framework.foundation.spi.provider.ApplicationProvider; import com.ctrip.framework.foundation.spi.provider.NetworkProvider; import com.ctrip.framework.foundation.spi.provider.Provider; import com.ctrip.framework.foundation.spi.provider.ServerProvider; public class NullProvider implements ApplicationProvider, NetworkProvider, ServerProvider { @Override public Class<? extends Provider> getType() { return null; } @Override public String getProperty(String name, String defaultValue) { return defaultValue; } @Override public void initialize() { } @Override public String getAppId() { return null; } @Override public String getAccessKeySecret() { return null; } @Override public boolean isAppIdSet() { return false; } @Override public String getEnvType() { return null; } @Override public boolean isEnvTypeSet() { return false; } @Override public String getDataCenter() { return null; } @Override public boolean isDataCenterSet() { return false; } @Override public void initialize(InputStream in) { } @Override public String getHostAddress() { return null; } @Override public String getHostName() { return null; } @Override public String toString() { return "(NullProvider)"; } }
package com.ctrip.framework.foundation.internals.provider; import java.io.InputStream; import com.ctrip.framework.foundation.spi.provider.ApplicationProvider; import com.ctrip.framework.foundation.spi.provider.NetworkProvider; import com.ctrip.framework.foundation.spi.provider.Provider; import com.ctrip.framework.foundation.spi.provider.ServerProvider; public class NullProvider implements ApplicationProvider, NetworkProvider, ServerProvider { @Override public Class<? extends Provider> getType() { return null; } @Override public String getProperty(String name, String defaultValue) { return defaultValue; } @Override public void initialize() { } @Override public String getAppId() { return null; } @Override public String getAccessKeySecret() { return null; } @Override public boolean isAppIdSet() { return false; } @Override public String getEnvType() { return null; } @Override public boolean isEnvTypeSet() { return false; } @Override public String getDataCenter() { return null; } @Override public boolean isDataCenterSet() { return false; } @Override public void initialize(InputStream in) { } @Override public String getHostAddress() { return null; } @Override public String getHostName() { return null; } @Override public String toString() { return "(NullProvider)"; } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-core/src/main/java/com/ctrip/framework/apollo/core/utils/ClassLoaderUtil.java
package com.ctrip.framework.apollo.core.utils; import com.google.common.base.Strings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.URL; import java.net.URLDecoder; /** * @author Jason Song(song_s@ctrip.com) */ public class ClassLoaderUtil { private static final Logger logger = LoggerFactory.getLogger(ClassLoaderUtil.class); private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static String classPath = ""; static { if (loader == null) { logger.warn("Using system class loader"); loader = ClassLoader.getSystemClassLoader(); } try { URL url = loader.getResource(""); // get class path if (url != null) { classPath = url.getPath(); classPath = URLDecoder.decode(classPath, "utf-8"); } // 如果是jar包内的,则返回当前路径 if (Strings.isNullOrEmpty(classPath) || classPath.contains(".jar!")) { classPath = System.getProperty("user.dir"); } } catch (Throwable ex) { classPath = System.getProperty("user.dir"); logger.warn("Failed to locate class path, fallback to user.dir: {}", classPath, ex); } } public static ClassLoader getLoader() { return loader; } public static String getClassPath() { return classPath; } public static boolean isClassPresent(String className) { try { Class.forName(className); return true; } catch (ClassNotFoundException ex) { return false; } } }
package com.ctrip.framework.apollo.core.utils; import com.google.common.base.Strings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.URL; import java.net.URLDecoder; /** * @author Jason Song(song_s@ctrip.com) */ public class ClassLoaderUtil { private static final Logger logger = LoggerFactory.getLogger(ClassLoaderUtil.class); private static ClassLoader loader = Thread.currentThread().getContextClassLoader(); private static String classPath = ""; static { if (loader == null) { logger.warn("Using system class loader"); loader = ClassLoader.getSystemClassLoader(); } try { URL url = loader.getResource(""); // get class path if (url != null) { classPath = url.getPath(); classPath = URLDecoder.decode(classPath, "utf-8"); } // 如果是jar包内的,则返回当前路径 if (Strings.isNullOrEmpty(classPath) || classPath.contains(".jar!")) { classPath = System.getProperty("user.dir"); } } catch (Throwable ex) { classPath = System.getProperty("user.dir"); logger.warn("Failed to locate class path, fallback to user.dir: {}", classPath, ex); } } public static ClassLoader getLoader() { return loader; } public static String getClassPath() { return classPath; } public static boolean isClassPresent(String className) { try { Class.forName(className); return true; } catch (ClassNotFoundException ex) { return false; } } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-client/src/main/java/com/ctrip/framework/apollo/ConfigChangeListener.java
package com.ctrip.framework.apollo; import com.ctrip.framework.apollo.model.ConfigChangeEvent; /** * @author Jason Song(song_s@ctrip.com) */ public interface ConfigChangeListener { /** * Invoked when there is any config change for the namespace. * @param changeEvent the event for this change */ void onChange(ConfigChangeEvent changeEvent); }
package com.ctrip.framework.apollo; import com.ctrip.framework.apollo.model.ConfigChangeEvent; /** * @author Jason Song(song_s@ctrip.com) */ public interface ConfigChangeListener { /** * Invoked when there is any config change for the namespace. * @param changeEvent the event for this change */ void onChange(ConfigChangeEvent changeEvent); }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/GrayReleaseRuleItemDTO.java
package com.ctrip.framework.apollo.common.dto; import com.google.common.collect.Sets; import java.util.Set; import static com.google.common.base.MoreObjects.toStringHelper; /** * @author Jason Song(song_s@ctrip.com) */ public class GrayReleaseRuleItemDTO { public static final String ALL_IP = "*"; private String clientAppId; private Set<String> clientIpList; public GrayReleaseRuleItemDTO(String clientAppId) { this(clientAppId, Sets.newHashSet()); } public GrayReleaseRuleItemDTO(String clientAppId, Set<String> clientIpList) { this.clientAppId = clientAppId; this.clientIpList = clientIpList; } public String getClientAppId() { return clientAppId; } public Set<String> getClientIpList() { return clientIpList; } public boolean matches(String clientAppId, String clientIp) { return appIdMatches(clientAppId) && ipMatches(clientIp); } private boolean appIdMatches(String clientAppId) { return this.clientAppId.equalsIgnoreCase(clientAppId); } private boolean ipMatches(String clientIp) { return this.clientIpList.contains(ALL_IP) || clientIpList.contains(clientIp); } @Override public String toString() { return toStringHelper(this).add("clientAppId", clientAppId) .add("clientIpList", clientIpList).toString(); } }
package com.ctrip.framework.apollo.common.dto; import com.google.common.collect.Sets; import java.util.Set; import static com.google.common.base.MoreObjects.toStringHelper; /** * @author Jason Song(song_s@ctrip.com) */ public class GrayReleaseRuleItemDTO { public static final String ALL_IP = "*"; private String clientAppId; private Set<String> clientIpList; public GrayReleaseRuleItemDTO(String clientAppId) { this(clientAppId, Sets.newHashSet()); } public GrayReleaseRuleItemDTO(String clientAppId, Set<String> clientIpList) { this.clientAppId = clientAppId; this.clientIpList = clientIpList; } public String getClientAppId() { return clientAppId; } public Set<String> getClientIpList() { return clientIpList; } public boolean matches(String clientAppId, String clientIp) { return appIdMatches(clientAppId) && ipMatches(clientIp); } private boolean appIdMatches(String clientAppId) { return this.clientAppId.equalsIgnoreCase(clientAppId); } private boolean ipMatches(String clientIp) { return this.clientIpList.contains(ALL_IP) || clientIpList.contains(clientIp); } @Override public String toString() { return toStringHelper(this).add("clientAppId", clientAppId) .add("clientIpList", clientIpList).toString(); } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-client/src/main/java/com/ctrip/framework/apollo/Config.java
package com.ctrip.framework.apollo; import com.ctrip.framework.apollo.enums.ConfigSourceType; import com.google.common.base.Function; import java.util.Date; import java.util.Locale; import java.util.Set; /** * @author Jason Song(song_s@ctrip.com) */ public interface Config { /** * Return the property value with the given key, or {@code defaultValue} if the key doesn't exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value */ String getProperty(String key, String defaultValue); /** * Return the integer property value with the given key, or {@code defaultValue} if the key * doesn't exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as integer */ Integer getIntProperty(String key, Integer defaultValue); /** * Return the long property value with the given key, or {@code defaultValue} if the key doesn't * exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as long */ Long getLongProperty(String key, Long defaultValue); /** * Return the short property value with the given key, or {@code defaultValue} if the key doesn't * exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as short */ Short getShortProperty(String key, Short defaultValue); /** * Return the float property value with the given key, or {@code defaultValue} if the key doesn't * exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as float */ Float getFloatProperty(String key, Float defaultValue); /** * Return the double property value with the given key, or {@code defaultValue} if the key doesn't * exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as double */ Double getDoubleProperty(String key, Double defaultValue); /** * Return the byte property value with the given key, or {@code defaultValue} if the key doesn't * exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as byte */ Byte getByteProperty(String key, Byte defaultValue); /** * Return the boolean property value with the given key, or {@code defaultValue} if the key * doesn't exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as boolean */ Boolean getBooleanProperty(String key, Boolean defaultValue); /** * Return the array property value with the given key, or {@code defaultValue} if the key doesn't exist. * * @param key the property name * @param delimiter the delimiter regex * @param defaultValue the default value when key is not found or any error occurred */ String[] getArrayProperty(String key, String delimiter, String[] defaultValue); /** * Return the Date property value with the given name, or {@code defaultValue} if the name doesn't exist. * Will try to parse the date with Locale.US and formats as follows: yyyy-MM-dd HH:mm:ss.SSS, * yyyy-MM-dd HH:mm:ss and yyyy-MM-dd * * @param key the property name * @param defaultValue the default value when name is not found or any error occurred * @return the property value */ Date getDateProperty(String key, Date defaultValue); /** * Return the Date property value with the given name, or {@code defaultValue} if the name doesn't exist. * Will parse the date with the format specified and Locale.US * * @param key the property name * @param format the date format, see {@link java.text.SimpleDateFormat} for more * information * @param defaultValue the default value when name is not found or any error occurred * @return the property value */ Date getDateProperty(String key, String format, Date defaultValue); /** * Return the Date property value with the given name, or {@code defaultValue} if the name doesn't exist. * * @param key the property name * @param format the date format, see {@link java.text.SimpleDateFormat} for more * information * @param locale the locale to use * @param defaultValue the default value when name is not found or any error occurred * @return the property value */ Date getDateProperty(String key, String format, Locale locale, Date defaultValue); /** * Return the Enum property value with the given key, or {@code defaultValue} if the key doesn't exist. * * @param key the property name * @param enumType the enum class * @param defaultValue the default value when key is not found or any error occurred * @param <T> the enum * @return the property value */ <T extends Enum<T>> T getEnumProperty(String key, Class<T> enumType, T defaultValue); /** * Return the duration property value(in milliseconds) with the given name, or {@code * defaultValue} if the name doesn't exist. Please note the format should comply with the follow * example (case insensitive). Examples: * <pre> * "123MS" -- parses as "123 milliseconds" * "20S" -- parses as "20 seconds" * "15M" -- parses as "15 minutes" (where a minute is 60 seconds) * "10H" -- parses as "10 hours" (where an hour is 3600 seconds) * "2D" -- parses as "2 days" (where a day is 24 hours or 86400 seconds) * "2D3H4M5S123MS" -- parses as "2 days, 3 hours, 4 minutes, 5 seconds and 123 milliseconds" * </pre> * * @param key the property name * @param defaultValue the default value when name is not found or any error occurred * @return the parsed property value(in milliseconds) */ long getDurationProperty(String key, long defaultValue); /** * Add change listener to this config instance, will be notified when any key is changed in this namespace. * * @param listener the config change listener */ void addChangeListener(ConfigChangeListener listener); /** * Add change listener to this config instance, will only be notified when any of the interested keys is changed in this namespace. * * @param listener the config change listener * @param interestedKeys the keys interested by the listener * * @since 1.0.0 */ void addChangeListener(ConfigChangeListener listener, Set<String> interestedKeys); /** * Add change listener to this config instance, will only be notified when any of the interested keys is changed in this namespace. * * @param listener the config change listener * @param interestedKeys the keys that the listener is interested in * @param interestedKeyPrefixes the key prefixes that the listener is interested in, * e.g. "spring." means that {@code listener} is interested in keys that starts with "spring.", such as "spring.banner", "spring.jpa", etc. * and "application" means that {@code listener} is interested in keys that starts with "application", such as "applicationName", "application.port", etc. * For more details, see {@link com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener#interestedKeyPrefixes()} * and {@link java.lang.String#startsWith(String)} * * @since 1.3.0 */ void addChangeListener(ConfigChangeListener listener, Set<String> interestedKeys, Set<String> interestedKeyPrefixes); /** * Remove the change listener * * @param listener the specific config change listener to remove * @return true if the specific config change listener is found and removed * * @since 1.1.0 */ boolean removeChangeListener(ConfigChangeListener listener); /** * Return a set of the property names * * @return the property names */ Set<String> getPropertyNames(); /** * Return the user-defined property value with the given key, or {@code defaultValue} if the key doesn't exist. * * @param key the property name * @param function the transform {@link Function}. from String to user-defined type * @param defaultValue the default value when key is not found or any error occurred * @param <T> user-defined type * @return the property value * * @since 1.1.0 */ <T> T getProperty(String key, Function<String, T> function, T defaultValue); /** * Return the config's source type, i.e. where is the config loaded from * * @return the config's source type * * @since 1.1.0 */ ConfigSourceType getSourceType(); }
package com.ctrip.framework.apollo; import com.ctrip.framework.apollo.enums.ConfigSourceType; import com.google.common.base.Function; import java.util.Date; import java.util.Locale; import java.util.Set; /** * @author Jason Song(song_s@ctrip.com) */ public interface Config { /** * Return the property value with the given key, or {@code defaultValue} if the key doesn't exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value */ String getProperty(String key, String defaultValue); /** * Return the integer property value with the given key, or {@code defaultValue} if the key * doesn't exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as integer */ Integer getIntProperty(String key, Integer defaultValue); /** * Return the long property value with the given key, or {@code defaultValue} if the key doesn't * exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as long */ Long getLongProperty(String key, Long defaultValue); /** * Return the short property value with the given key, or {@code defaultValue} if the key doesn't * exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as short */ Short getShortProperty(String key, Short defaultValue); /** * Return the float property value with the given key, or {@code defaultValue} if the key doesn't * exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as float */ Float getFloatProperty(String key, Float defaultValue); /** * Return the double property value with the given key, or {@code defaultValue} if the key doesn't * exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as double */ Double getDoubleProperty(String key, Double defaultValue); /** * Return the byte property value with the given key, or {@code defaultValue} if the key doesn't * exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as byte */ Byte getByteProperty(String key, Byte defaultValue); /** * Return the boolean property value with the given key, or {@code defaultValue} if the key * doesn't exist. * * @param key the property name * @param defaultValue the default value when key is not found or any error occurred * @return the property value as boolean */ Boolean getBooleanProperty(String key, Boolean defaultValue); /** * Return the array property value with the given key, or {@code defaultValue} if the key doesn't exist. * * @param key the property name * @param delimiter the delimiter regex * @param defaultValue the default value when key is not found or any error occurred */ String[] getArrayProperty(String key, String delimiter, String[] defaultValue); /** * Return the Date property value with the given name, or {@code defaultValue} if the name doesn't exist. * Will try to parse the date with Locale.US and formats as follows: yyyy-MM-dd HH:mm:ss.SSS, * yyyy-MM-dd HH:mm:ss and yyyy-MM-dd * * @param key the property name * @param defaultValue the default value when name is not found or any error occurred * @return the property value */ Date getDateProperty(String key, Date defaultValue); /** * Return the Date property value with the given name, or {@code defaultValue} if the name doesn't exist. * Will parse the date with the format specified and Locale.US * * @param key the property name * @param format the date format, see {@link java.text.SimpleDateFormat} for more * information * @param defaultValue the default value when name is not found or any error occurred * @return the property value */ Date getDateProperty(String key, String format, Date defaultValue); /** * Return the Date property value with the given name, or {@code defaultValue} if the name doesn't exist. * * @param key the property name * @param format the date format, see {@link java.text.SimpleDateFormat} for more * information * @param locale the locale to use * @param defaultValue the default value when name is not found or any error occurred * @return the property value */ Date getDateProperty(String key, String format, Locale locale, Date defaultValue); /** * Return the Enum property value with the given key, or {@code defaultValue} if the key doesn't exist. * * @param key the property name * @param enumType the enum class * @param defaultValue the default value when key is not found or any error occurred * @param <T> the enum * @return the property value */ <T extends Enum<T>> T getEnumProperty(String key, Class<T> enumType, T defaultValue); /** * Return the duration property value(in milliseconds) with the given name, or {@code * defaultValue} if the name doesn't exist. Please note the format should comply with the follow * example (case insensitive). Examples: * <pre> * "123MS" -- parses as "123 milliseconds" * "20S" -- parses as "20 seconds" * "15M" -- parses as "15 minutes" (where a minute is 60 seconds) * "10H" -- parses as "10 hours" (where an hour is 3600 seconds) * "2D" -- parses as "2 days" (where a day is 24 hours or 86400 seconds) * "2D3H4M5S123MS" -- parses as "2 days, 3 hours, 4 minutes, 5 seconds and 123 milliseconds" * </pre> * * @param key the property name * @param defaultValue the default value when name is not found or any error occurred * @return the parsed property value(in milliseconds) */ long getDurationProperty(String key, long defaultValue); /** * Add change listener to this config instance, will be notified when any key is changed in this namespace. * * @param listener the config change listener */ void addChangeListener(ConfigChangeListener listener); /** * Add change listener to this config instance, will only be notified when any of the interested keys is changed in this namespace. * * @param listener the config change listener * @param interestedKeys the keys interested by the listener * * @since 1.0.0 */ void addChangeListener(ConfigChangeListener listener, Set<String> interestedKeys); /** * Add change listener to this config instance, will only be notified when any of the interested keys is changed in this namespace. * * @param listener the config change listener * @param interestedKeys the keys that the listener is interested in * @param interestedKeyPrefixes the key prefixes that the listener is interested in, * e.g. "spring." means that {@code listener} is interested in keys that starts with "spring.", such as "spring.banner", "spring.jpa", etc. * and "application" means that {@code listener} is interested in keys that starts with "application", such as "applicationName", "application.port", etc. * For more details, see {@link com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener#interestedKeyPrefixes()} * and {@link java.lang.String#startsWith(String)} * * @since 1.3.0 */ void addChangeListener(ConfigChangeListener listener, Set<String> interestedKeys, Set<String> interestedKeyPrefixes); /** * Remove the change listener * * @param listener the specific config change listener to remove * @return true if the specific config change listener is found and removed * * @since 1.1.0 */ boolean removeChangeListener(ConfigChangeListener listener); /** * Return a set of the property names * * @return the property names */ Set<String> getPropertyNames(); /** * Return the user-defined property value with the given key, or {@code defaultValue} if the key doesn't exist. * * @param key the property name * @param function the transform {@link Function}. from String to user-defined type * @param defaultValue the default value when key is not found or any error occurred * @param <T> user-defined type * @return the property value * * @since 1.1.0 */ <T> T getProperty(String key, Function<String, T> function, T defaultValue); /** * Return the config's source type, i.e. where is the config loaded from * * @return the config's source type * * @since 1.1.0 */ ConfigSourceType getSourceType(); }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-common/src/main/java/com/ctrip/framework/apollo/common/dto/PageDTO.java
package com.ctrip.framework.apollo.common.dto; import org.springframework.data.domain.Pageable; import java.util.Collections; import java.util.List; /** * @author Jason Song(song_s@ctrip.com) */ public class PageDTO<T> { private final long total; private final List<T> content; private final int page; private final int size; public PageDTO(List<T> content, Pageable pageable, long total) { this.total = total; this.content = content; this.page = pageable.getPageNumber(); this.size = pageable.getPageSize(); } public long getTotal() { return total; } public List<T> getContent() { return Collections.unmodifiableList(content); } public int getPage() { return page; } public int getSize() { return size; } public boolean hasContent(){ return content != null && content.size() > 0; } }
package com.ctrip.framework.apollo.common.dto; import org.springframework.data.domain.Pageable; import java.util.Collections; import java.util.List; /** * @author Jason Song(song_s@ctrip.com) */ public class PageDTO<T> { private final long total; private final List<T> content; private final int page; private final int size; public PageDTO(List<T> content, Pageable pageable, long total) { this.total = total; this.content = content; this.page = pageable.getPageNumber(); this.size = pageable.getPageSize(); } public long getTotal() { return total; } public List<T> getContent() { return Collections.unmodifiableList(content); } public int getPage() { return page; } public int getSize() { return size; } public boolean hasContent(){ return content != null && content.size() > 0; } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/component/PortalSettings.java
package com.ctrip.framework.apollo.portal.component; import com.ctrip.framework.apollo.portal.environment.PortalMetaDomainService; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.actuate.health.Health; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @Component public class PortalSettings { private static final Logger logger = LoggerFactory.getLogger(PortalSettings.class); private static final int HEALTH_CHECK_INTERVAL = 10 * 1000; private final ApplicationContext applicationContext; private final PortalConfig portalConfig; private final PortalMetaDomainService portalMetaDomainService; private List<Env> allEnvs = new ArrayList<>(); //mark env up or down private Map<Env, Boolean> envStatusMark = new ConcurrentHashMap<>(); public PortalSettings( final ApplicationContext applicationContext, final PortalConfig portalConfig, final PortalMetaDomainService portalMetaDomainService ) { this.applicationContext = applicationContext; this.portalConfig = portalConfig; this.portalMetaDomainService = portalMetaDomainService; } @PostConstruct private void postConstruct() { allEnvs = portalConfig.portalSupportedEnvs(); for (Env env : allEnvs) { envStatusMark.put(env, true); } ScheduledExecutorService healthCheckService = Executors.newScheduledThreadPool(1, ApolloThreadFactory.create("EnvHealthChecker", true)); healthCheckService .scheduleWithFixedDelay(new HealthCheckTask(applicationContext), 1000, HEALTH_CHECK_INTERVAL, TimeUnit.MILLISECONDS); } public List<Env> getAllEnvs() { return allEnvs; } public List<Env> getActiveEnvs() { List<Env> activeEnvs = new LinkedList<>(); for (Env env : allEnvs) { if (envStatusMark.get(env)) { activeEnvs.add(env); } } return activeEnvs; } public boolean isEnvActive(Env env) { Boolean mark = envStatusMark.get(env); return mark != null && mark; } private class HealthCheckTask implements Runnable { private static final int ENV_DOWN_THRESHOLD = 2; private Map<Env, Integer> healthCheckFailedCounter = new HashMap<>(); private AdminServiceAPI.HealthAPI healthAPI; public HealthCheckTask(ApplicationContext context) { healthAPI = context.getBean(AdminServiceAPI.HealthAPI.class); for (Env env : allEnvs) { healthCheckFailedCounter.put(env, 0); } } public void run() { for (Env env : allEnvs) { try { if (isUp(env)) { //revive if (!envStatusMark.get(env)) { envStatusMark.put(env, true); healthCheckFailedCounter.put(env, 0); logger.info("Env revived because env health check success. env: {}", env); } } else { logger.error("Env health check failed, maybe because of admin server down. env: {}, meta server address: {}", env, portalMetaDomainService.getDomain(env)); handleEnvDown(env); } } catch (Exception e) { logger.error("Env health check failed, maybe because of meta server down " + "or configure wrong meta server address. env: {}, meta server address: {}", env, portalMetaDomainService.getDomain(env), e); handleEnvDown(env); } } } private boolean isUp(Env env) { Health health = healthAPI.health(env); return "UP".equals(health.getStatus().getCode()); } private void handleEnvDown(Env env) { int failedTimes = healthCheckFailedCounter.get(env); healthCheckFailedCounter.put(env, ++failedTimes); if (!envStatusMark.get(env)) { logger.error("Env is down. env: {}, failed times: {}, meta server address: {}", env, failedTimes, portalMetaDomainService.getDomain(env)); } else { if (failedTimes >= ENV_DOWN_THRESHOLD) { envStatusMark.put(env, false); logger.error("Env is down because health check failed for {} times, " + "which equals to down threshold. env: {}, meta server address: {}", ENV_DOWN_THRESHOLD, env, portalMetaDomainService.getDomain(env)); } else { logger.error( "Env health check failed for {} times which less than down threshold. down threshold:{}, env: {}, meta server address: {}", failedTimes, ENV_DOWN_THRESHOLD, env, portalMetaDomainService.getDomain(env)); } } } } }
package com.ctrip.framework.apollo.portal.component; import com.ctrip.framework.apollo.portal.environment.PortalMetaDomainService; import com.ctrip.framework.apollo.portal.environment.Env; import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory; import com.ctrip.framework.apollo.portal.api.AdminServiceAPI; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.actuate.health.Health; import org.springframework.context.ApplicationContext; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; @Component public class PortalSettings { private static final Logger logger = LoggerFactory.getLogger(PortalSettings.class); private static final int HEALTH_CHECK_INTERVAL = 10 * 1000; private final ApplicationContext applicationContext; private final PortalConfig portalConfig; private final PortalMetaDomainService portalMetaDomainService; private List<Env> allEnvs = new ArrayList<>(); //mark env up or down private Map<Env, Boolean> envStatusMark = new ConcurrentHashMap<>(); public PortalSettings( final ApplicationContext applicationContext, final PortalConfig portalConfig, final PortalMetaDomainService portalMetaDomainService ) { this.applicationContext = applicationContext; this.portalConfig = portalConfig; this.portalMetaDomainService = portalMetaDomainService; } @PostConstruct private void postConstruct() { allEnvs = portalConfig.portalSupportedEnvs(); for (Env env : allEnvs) { envStatusMark.put(env, true); } ScheduledExecutorService healthCheckService = Executors.newScheduledThreadPool(1, ApolloThreadFactory.create("EnvHealthChecker", true)); healthCheckService .scheduleWithFixedDelay(new HealthCheckTask(applicationContext), 1000, HEALTH_CHECK_INTERVAL, TimeUnit.MILLISECONDS); } public List<Env> getAllEnvs() { return allEnvs; } public List<Env> getActiveEnvs() { List<Env> activeEnvs = new LinkedList<>(); for (Env env : allEnvs) { if (envStatusMark.get(env)) { activeEnvs.add(env); } } return activeEnvs; } public boolean isEnvActive(Env env) { Boolean mark = envStatusMark.get(env); return mark != null && mark; } private class HealthCheckTask implements Runnable { private static final int ENV_DOWN_THRESHOLD = 2; private Map<Env, Integer> healthCheckFailedCounter = new HashMap<>(); private AdminServiceAPI.HealthAPI healthAPI; public HealthCheckTask(ApplicationContext context) { healthAPI = context.getBean(AdminServiceAPI.HealthAPI.class); for (Env env : allEnvs) { healthCheckFailedCounter.put(env, 0); } } public void run() { for (Env env : allEnvs) { try { if (isUp(env)) { //revive if (!envStatusMark.get(env)) { envStatusMark.put(env, true); healthCheckFailedCounter.put(env, 0); logger.info("Env revived because env health check success. env: {}", env); } } else { logger.error("Env health check failed, maybe because of admin server down. env: {}, meta server address: {}", env, portalMetaDomainService.getDomain(env)); handleEnvDown(env); } } catch (Exception e) { logger.error("Env health check failed, maybe because of meta server down " + "or configure wrong meta server address. env: {}, meta server address: {}", env, portalMetaDomainService.getDomain(env), e); handleEnvDown(env); } } } private boolean isUp(Env env) { Health health = healthAPI.health(env); return "UP".equals(health.getStatus().getCode()); } private void handleEnvDown(Env env) { int failedTimes = healthCheckFailedCounter.get(env); healthCheckFailedCounter.put(env, ++failedTimes); if (!envStatusMark.get(env)) { logger.error("Env is down. env: {}, failed times: {}, meta server address: {}", env, failedTimes, portalMetaDomainService.getDomain(env)); } else { if (failedTimes >= ENV_DOWN_THRESHOLD) { envStatusMark.put(env, false); logger.error("Env is down because health check failed for {} times, " + "which equals to down threshold. env: {}, meta server address: {}", ENV_DOWN_THRESHOLD, env, portalMetaDomainService.getDomain(env)); } else { logger.error( "Env health check failed for {} times which less than down threshold. down threshold:{}, env: {}, meta server address: {}", failedTimes, ENV_DOWN_THRESHOLD, env, portalMetaDomainService.getDomain(env)); } } } } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-configservice/src/test/java/com/ctrip/framework/apollo/configservice/service/config/ConfigServiceWithCacheTest.java
package com.ctrip.framework.apollo.configservice.service.config; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.google.common.collect.Lists; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.service.ReleaseMessageService; import com.ctrip.framework.apollo.biz.service.ReleaseService; import com.ctrip.framework.apollo.biz.utils.ReleaseMessageKeyGenerator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** * @author Jason Song(song_s@ctrip.com) */ @RunWith(MockitoJUnitRunner.class) public class ConfigServiceWithCacheTest { private ConfigServiceWithCache configServiceWithCache; @Mock private ReleaseService releaseService; @Mock private ReleaseMessageService releaseMessageService; @Mock private Release someRelease; @Mock private ReleaseMessage someReleaseMessage; private String someAppId; private String someClusterName; private String someNamespaceName; private String someKey; private long someNotificationId; private ApolloNotificationMessages someNotificationMessages; @Before public void setUp() throws Exception { configServiceWithCache = new ConfigServiceWithCache(); ReflectionTestUtils.setField(configServiceWithCache, "releaseService", releaseService); ReflectionTestUtils.setField(configServiceWithCache, "releaseMessageService", releaseMessageService); configServiceWithCache.initialize(); someAppId = "someAppId"; someClusterName = "someClusterName"; someNamespaceName = "someNamespaceName"; someNotificationId = 1; someKey = ReleaseMessageKeyGenerator.generate(someAppId, someClusterName, someNamespaceName); someNotificationMessages = new ApolloNotificationMessages(); } @Test public void testFindActiveOne() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithSameIdMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithMultipleIdMultipleTimes() throws Exception { long someId = 1; long anotherId = 2; Release anotherRelease = mock(Release.class); when(releaseService.findActiveOne(someId)).thenReturn(someRelease); when(releaseService.findActiveOne(anotherId)).thenReturn(anotherRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); verify(releaseService, times(1)).findActiveOne(anotherId); } @Test public void testFindActiveOneWithReleaseNotFoundMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(null); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindLatestActiveRelease() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertEquals(someRelease, release); assertEquals(someRelease, anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseNotFound() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn(null); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn(null); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertNull(release); assertNull(anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithDirtyRelease() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someKey, someNewNotificationId); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseMessageNotification() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getMessage()).thenReturn(someKey); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); configServiceWithCache.handleMessage(anotherReleaseMessage, Topics.APOLLO_RELEASE_TOPIC); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithIrrelevantMessages() throws Exception { long someNewNotificationId = someNotificationId + 1; String someIrrelevantKey = "someIrrelevantKey"; when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someIrrelevantKey, someNewNotificationId); Release shouldStillBeOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(someRelease, shouldStillBeOldRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } }
package com.ctrip.framework.apollo.configservice.service.config; import com.ctrip.framework.apollo.core.dto.ApolloNotificationMessages; import com.google.common.collect.Lists; import com.ctrip.framework.apollo.biz.entity.Release; import com.ctrip.framework.apollo.biz.entity.ReleaseMessage; import com.ctrip.framework.apollo.biz.message.Topics; import com.ctrip.framework.apollo.biz.service.ReleaseMessageService; import com.ctrip.framework.apollo.biz.service.ReleaseService; import com.ctrip.framework.apollo.biz.utils.ReleaseMessageKeyGenerator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.test.util.ReflectionTestUtils; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; /** * @author Jason Song(song_s@ctrip.com) */ @RunWith(MockitoJUnitRunner.class) public class ConfigServiceWithCacheTest { private ConfigServiceWithCache configServiceWithCache; @Mock private ReleaseService releaseService; @Mock private ReleaseMessageService releaseMessageService; @Mock private Release someRelease; @Mock private ReleaseMessage someReleaseMessage; private String someAppId; private String someClusterName; private String someNamespaceName; private String someKey; private long someNotificationId; private ApolloNotificationMessages someNotificationMessages; @Before public void setUp() throws Exception { configServiceWithCache = new ConfigServiceWithCache(); ReflectionTestUtils.setField(configServiceWithCache, "releaseService", releaseService); ReflectionTestUtils.setField(configServiceWithCache, "releaseMessageService", releaseMessageService); configServiceWithCache.initialize(); someAppId = "someAppId"; someClusterName = "someClusterName"; someNamespaceName = "someNamespaceName"; someNotificationId = 1; someKey = ReleaseMessageKeyGenerator.generate(someAppId, someClusterName, someNamespaceName); someNotificationMessages = new ApolloNotificationMessages(); } @Test public void testFindActiveOne() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithSameIdMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(someRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindActiveOneWithMultipleIdMultipleTimes() throws Exception { long someId = 1; long anotherId = 2; Release anotherRelease = mock(Release.class); when(releaseService.findActiveOne(someId)).thenReturn(someRelease); when(releaseService.findActiveOne(anotherId)).thenReturn(anotherRelease); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(someRelease, configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); assertEquals(anotherRelease, configServiceWithCache.findActiveOne(anotherId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); verify(releaseService, times(1)).findActiveOne(anotherId); } @Test public void testFindActiveOneWithReleaseNotFoundMultipleTimes() throws Exception { long someId = 1; when(releaseService.findActiveOne(someId)).thenReturn(null); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); assertNull(configServiceWithCache.findActiveOne(someId, someNotificationMessages)); verify(releaseService, times(1)).findActiveOne(someId); } @Test public void testFindLatestActiveRelease() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertEquals(someRelease, release); assertEquals(someRelease, anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseNotFound() throws Exception { when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn(null); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn(null); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release anotherRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); int retryTimes = 100; for (int i = 0; i < retryTimes; i++) { configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); } assertNull(release); assertNull(anotherRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithDirtyRelease() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someKey, someNewNotificationId); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithReleaseMessageNotification() throws Exception { long someNewNotificationId = someNotificationId + 1; ReleaseMessage anotherReleaseMessage = mock(ReleaseMessage.class); Release anotherRelease = mock(Release.class); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (anotherReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (anotherRelease); when(anotherReleaseMessage.getMessage()).thenReturn(someKey); when(anotherReleaseMessage.getId()).thenReturn(someNewNotificationId); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); configServiceWithCache.handleMessage(anotherReleaseMessage, Topics.APOLLO_RELEASE_TOPIC); Release shouldBeNewRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(anotherRelease, shouldBeNewRelease); verify(releaseMessageService, times(2)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(2)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } @Test public void testFindLatestActiveReleaseWithIrrelevantMessages() throws Exception { long someNewNotificationId = someNotificationId + 1; String someIrrelevantKey = "someIrrelevantKey"; when(releaseMessageService.findLatestReleaseMessageForMessages(Lists.newArrayList(someKey))).thenReturn (someReleaseMessage); when(releaseService.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName)).thenReturn (someRelease); when(someReleaseMessage.getId()).thenReturn(someNotificationId); Release release = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); Release stillOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); someNotificationMessages.put(someIrrelevantKey, someNewNotificationId); Release shouldStillBeOldRelease = configServiceWithCache.findLatestActiveRelease(someAppId, someClusterName, someNamespaceName, someNotificationMessages); assertEquals(someRelease, release); assertEquals(someRelease, stillOldRelease); assertEquals(someRelease, shouldStillBeOldRelease); verify(releaseMessageService, times(1)).findLatestReleaseMessageForMessages(Lists.newArrayList(someKey)); verify(releaseService, times(1)).findLatestActiveRelease(someAppId, someClusterName, someNamespaceName); } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-core/src/main/java/com/ctrip/framework/apollo/core/utils/StringUtils.java
package com.ctrip.framework.apollo.core.utils; import java.util.Collection; import java.util.Iterator; public class StringUtils { public static final String EMPTY = ""; /** * <p> * Checks if a String is empty ("") or null. * </p> * * <pre> * StringUtils.isEmpty(null) = true * StringUtils.isEmpty("") = true * StringUtils.isEmpty(" ") = false * StringUtils.isEmpty("bob") = false * StringUtils.isEmpty(" bob ") = false * </pre> * * <p> * NOTE: This method changed in Lang version 2.0. It no longer trims the String. That functionality is available in isBlank(). * </p> * * @param str the String to check, may be null * @return <code>true</code> if the String is empty or null */ public static boolean isEmpty(String str) { return str == null || str.length() == 0; } public static boolean isContainEmpty(String... args){ if (args == null){ return false; } for (String arg: args){ if (arg == null || "".equals(arg)){ return true; } } return false; } /** * <p> * Checks if a String is whitespace, empty ("") or null. * </p> * * <pre> * StringUtils.isBlank(null) = true * StringUtils.isBlank("") = true * StringUtils.isBlank(" ") = true * StringUtils.isBlank("bob") = false * StringUtils.isBlank(" bob ") = false * </pre> * * @param str the String to check, may be null * @return <code>true</code> if the String is null, empty or whitespace */ public static boolean isBlank(String str) { int strLen; if (str == null || (strLen = str.length()) == 0) { return true; } for (int i = 0; i < strLen; i++) { if (!Character.isWhitespace(str.charAt(i))) { return false; } } return true; } /** * <p> * Removes control characters (char &lt;= 32) from both ends of this String returning <code>null</code> if the String is empty * ("") after the trim or if it is <code>null</code>. * * <p> * The String is trimmed using {@link String#trim()}. Trim removes start and end characters &lt;= 32. To strip whitespace use * {@link #stripToNull(String)}. * </p> * * <pre> * StringUtils.trimToNull(null) = null * StringUtils.trimToNull("") = null * StringUtils.trimToNull(" ") = null * StringUtils.trimToNull("abc") = "abc" * StringUtils.trimToNull(" abc ") = "abc" * </pre> * * @param str the String to be trimmed, may be null * @return the trimmed String, <code>null</code> if only chars &lt;= 32, empty or null String input * @since 2.0 */ public static String trimToNull(String str) { String ts = trim(str); return isEmpty(ts) ? null : ts; } /** * <p> * Removes control characters (char &lt;= 32) from both ends of this String returning an empty String ("") if the String is empty * ("") after the trim or if it is <code>null</code>. * * <p> * The String is trimmed using {@link String#trim()}. Trim removes start and end characters &lt;= 32. To strip whitespace use * {@link #stripToEmpty(String)}. * </p> * * <pre> * StringUtils.trimToEmpty(null) = "" * StringUtils.trimToEmpty("") = "" * StringUtils.trimToEmpty(" ") = "" * StringUtils.trimToEmpty("abc") = "abc" * StringUtils.trimToEmpty(" abc ") = "abc" * </pre> * * @param str the String to be trimmed, may be null * @return the trimmed String, or an empty String if <code>null</code> input * @since 2.0 */ public static String trimToEmpty(String str) { return str == null ? EMPTY : str.trim(); } /** * <p> * Removes control characters (char &lt;= 32) from both ends of this String, handling <code>null</code> by returning * <code>null</code>. * </p> * * <p> * The String is trimmed using {@link String#trim()}. Trim removes start and end characters &lt;= 32. To strip whitespace use * {@link #strip(String)}. * </p> * * <p> * To trim your choice of characters, use the {@link #strip(String, String)} methods. * </p> * * <pre> * StringUtils.trim(null) = null * StringUtils.trim("") = "" * StringUtils.trim(" ") = "" * StringUtils.trim("abc") = "abc" * StringUtils.trim(" abc ") = "abc" * </pre> * * @param str the String to be trimmed, may be null * @return the trimmed string, <code>null</code> if null String input */ public static String trim(String str) { return str == null ? null : str.trim(); } /** * <p> * Compares two Strings, returning <code>true</code> if they are equal. * </p> * * <p> * <code>null</code>s are handled without exceptions. Two <code>null</code> references are considered to be equal. The comparison * is case sensitive. * </p> * * <pre> * StringUtils.equals(null, null) = true * StringUtils.equals(null, "abc") = false * StringUtils.equals("abc", null) = false * StringUtils.equals("abc", "abc") = true * StringUtils.equals("abc", "ABC") = false * </pre> * * @param str1 the first String, may be null * @param str2 the second String, may be null * @return <code>true</code> if the Strings are equal, case sensitive, or both <code>null</code> * @see java.lang.String#equals(Object) */ public static boolean equals(String str1, String str2) { return str1 == null ? str2 == null : str1.equals(str2); } /** * <p> * Compares two Strings, returning <code>true</code> if they are equal ignoring the case. * </p> * * <p> * <code>null</code>s are handled without exceptions. Two <code>null</code> references are considered equal. Comparison is case * insensitive. * </p> * * <pre> * StringUtils.equalsIgnoreCase(null, null) = true * StringUtils.equalsIgnoreCase(null, "abc") = false * StringUtils.equalsIgnoreCase("abc", null) = false * StringUtils.equalsIgnoreCase("abc", "abc") = true * StringUtils.equalsIgnoreCase("abc", "ABC") = true * </pre> * * @param str1 the first String, may be null * @param str2 the second String, may be null * @return <code>true</code> if the Strings are equal, case insensitive, or both <code>null</code> * @see java.lang.String#equalsIgnoreCase(String) */ public static boolean equalsIgnoreCase(String str1, String str2) { return str1 == null ? str2 == null : str1.equalsIgnoreCase(str2); } /** * <p> * Check if a String starts with a specified prefix. * </p> * * <p> * <code>null</code>s are handled without exceptions. Two <code>null</code> references are considered to be equal. The comparison * is case sensitive. * </p> * * <pre> * StringUtils.startsWith(null, null) = true * StringUtils.startsWith(null, "abc") = false * StringUtils.startsWith("abcdef", null) = false * StringUtils.startsWith("abcdef", "abc") = true * StringUtils.startsWith("ABCDEF", "abc") = false * </pre> * * @param str the String to check, may be null * @param prefix the prefix to find, may be null * @return <code>true</code> if the String starts with the prefix, case sensitive, or both <code>null</code> * @see java.lang.String#startsWith(String) * @since 2.4 */ public static boolean startsWith(String str, String prefix) { return startsWith(str, prefix, false); } /** * <p> * Check if a String starts with a specified prefix (optionally case insensitive). * </p> * * @param str the String to check, may be null * @param prefix the prefix to find, may be null * @param ignoreCase inidicates whether the compare should ignore case (case insensitive) or not. * @return <code>true</code> if the String starts with the prefix or both <code>null</code> * @see java.lang.String#startsWith(String) */ private static boolean startsWith(String str, String prefix, boolean ignoreCase) { if (str == null || prefix == null) { return str == null && prefix == null; } if (prefix.length() > str.length()) { return false; } return str.regionMatches(ignoreCase, 0, prefix, 0, prefix.length()); } /** * <p> * Case insensitive check if a String starts with a specified prefix. * </p> * * <p> * <code>null</code>s are handled without exceptions. Two <code>null</code> references are considered to be equal. The comparison * is case insensitive. * </p> * * <pre> * StringUtils.startsWithIgnoreCase(null, null) = true * StringUtils.startsWithIgnoreCase(null, "abc") = false * StringUtils.startsWithIgnoreCase("abcdef", null) = false * StringUtils.startsWithIgnoreCase("abcdef", "abc") = true * StringUtils.startsWithIgnoreCase("ABCDEF", "abc") = true * </pre> * * @param str the String to check, may be null * @param prefix the prefix to find, may be null * @return <code>true</code> if the String starts with the prefix, case insensitive, or both <code>null</code> * @see java.lang.String#startsWith(String) * @since 2.4 */ public static boolean startsWithIgnoreCase(String str, String prefix) { return startsWith(str, prefix, true); } /** * <p> * Checks if the String contains only unicode digits. A decimal point is not a unicode digit and returns false. * </p> * * <p> * <code>null</code> will return <code>false</code>. An empty String (length()=0) will return <code>true</code>. * </p> * * <pre> * StringUtils.isNumeric(null) = false * StringUtils.isNumeric("") = true * StringUtils.isNumeric(" ") = false * StringUtils.isNumeric("123") = true * StringUtils.isNumeric("12 3") = false * StringUtils.isNumeric("ab2c") = false * StringUtils.isNumeric("12-3") = false * StringUtils.isNumeric("12.3") = false * </pre> * * @param str the String to check, may be null * @return <code>true</code> if only contains digits, and is non-null */ public static boolean isNumeric(String str) { if (str == null) { return false; } int sz = str.length(); for (int i = 0; i < sz; i++) { if (!Character.isDigit(str.charAt(i))) { return false; } } return true; } public interface StringFormatter<T> { String format(T obj); } public static <T> String join(Collection<T> collection, String separator) { return join(collection, separator, new StringFormatter<T>() { @Override public String format(T obj) { return obj.toString(); } }); } public static <T> String join(Collection<T> collection, String separator, StringFormatter<T> formatter) { Iterator<T> iterator = collection.iterator(); // handle null, zero and one elements before building a buffer if (iterator == null) { return null; } if (!iterator.hasNext()) { return EMPTY; } T first = iterator.next(); if (!iterator.hasNext()) { return first == null ? "" : formatter.format(first); } // two or more elements StringBuilder buf = new StringBuilder(256); // Java default is 16, probably too small if (first != null) { buf.append(formatter.format(first)); } while (iterator.hasNext()) { buf.append(separator); T obj = iterator.next(); if (obj != null) { buf.append(formatter.format(obj)); } } return buf.toString(); } }
package com.ctrip.framework.apollo.core.utils; import java.util.Collection; import java.util.Iterator; public class StringUtils { public static final String EMPTY = ""; /** * <p> * Checks if a String is empty ("") or null. * </p> * * <pre> * StringUtils.isEmpty(null) = true * StringUtils.isEmpty("") = true * StringUtils.isEmpty(" ") = false * StringUtils.isEmpty("bob") = false * StringUtils.isEmpty(" bob ") = false * </pre> * * <p> * NOTE: This method changed in Lang version 2.0. It no longer trims the String. That functionality is available in isBlank(). * </p> * * @param str the String to check, may be null * @return <code>true</code> if the String is empty or null */ public static boolean isEmpty(String str) { return str == null || str.length() == 0; } public static boolean isContainEmpty(String... args){ if (args == null){ return false; } for (String arg: args){ if (arg == null || "".equals(arg)){ return true; } } return false; } /** * <p> * Checks if a String is whitespace, empty ("") or null. * </p> * * <pre> * StringUtils.isBlank(null) = true * StringUtils.isBlank("") = true * StringUtils.isBlank(" ") = true * StringUtils.isBlank("bob") = false * StringUtils.isBlank(" bob ") = false * </pre> * * @param str the String to check, may be null * @return <code>true</code> if the String is null, empty or whitespace */ public static boolean isBlank(String str) { int strLen; if (str == null || (strLen = str.length()) == 0) { return true; } for (int i = 0; i < strLen; i++) { if (!Character.isWhitespace(str.charAt(i))) { return false; } } return true; } /** * <p> * Removes control characters (char &lt;= 32) from both ends of this String returning <code>null</code> if the String is empty * ("") after the trim or if it is <code>null</code>. * * <p> * The String is trimmed using {@link String#trim()}. Trim removes start and end characters &lt;= 32. To strip whitespace use * {@link #stripToNull(String)}. * </p> * * <pre> * StringUtils.trimToNull(null) = null * StringUtils.trimToNull("") = null * StringUtils.trimToNull(" ") = null * StringUtils.trimToNull("abc") = "abc" * StringUtils.trimToNull(" abc ") = "abc" * </pre> * * @param str the String to be trimmed, may be null * @return the trimmed String, <code>null</code> if only chars &lt;= 32, empty or null String input * @since 2.0 */ public static String trimToNull(String str) { String ts = trim(str); return isEmpty(ts) ? null : ts; } /** * <p> * Removes control characters (char &lt;= 32) from both ends of this String returning an empty String ("") if the String is empty * ("") after the trim or if it is <code>null</code>. * * <p> * The String is trimmed using {@link String#trim()}. Trim removes start and end characters &lt;= 32. To strip whitespace use * {@link #stripToEmpty(String)}. * </p> * * <pre> * StringUtils.trimToEmpty(null) = "" * StringUtils.trimToEmpty("") = "" * StringUtils.trimToEmpty(" ") = "" * StringUtils.trimToEmpty("abc") = "abc" * StringUtils.trimToEmpty(" abc ") = "abc" * </pre> * * @param str the String to be trimmed, may be null * @return the trimmed String, or an empty String if <code>null</code> input * @since 2.0 */ public static String trimToEmpty(String str) { return str == null ? EMPTY : str.trim(); } /** * <p> * Removes control characters (char &lt;= 32) from both ends of this String, handling <code>null</code> by returning * <code>null</code>. * </p> * * <p> * The String is trimmed using {@link String#trim()}. Trim removes start and end characters &lt;= 32. To strip whitespace use * {@link #strip(String)}. * </p> * * <p> * To trim your choice of characters, use the {@link #strip(String, String)} methods. * </p> * * <pre> * StringUtils.trim(null) = null * StringUtils.trim("") = "" * StringUtils.trim(" ") = "" * StringUtils.trim("abc") = "abc" * StringUtils.trim(" abc ") = "abc" * </pre> * * @param str the String to be trimmed, may be null * @return the trimmed string, <code>null</code> if null String input */ public static String trim(String str) { return str == null ? null : str.trim(); } /** * <p> * Compares two Strings, returning <code>true</code> if they are equal. * </p> * * <p> * <code>null</code>s are handled without exceptions. Two <code>null</code> references are considered to be equal. The comparison * is case sensitive. * </p> * * <pre> * StringUtils.equals(null, null) = true * StringUtils.equals(null, "abc") = false * StringUtils.equals("abc", null) = false * StringUtils.equals("abc", "abc") = true * StringUtils.equals("abc", "ABC") = false * </pre> * * @param str1 the first String, may be null * @param str2 the second String, may be null * @return <code>true</code> if the Strings are equal, case sensitive, or both <code>null</code> * @see java.lang.String#equals(Object) */ public static boolean equals(String str1, String str2) { return str1 == null ? str2 == null : str1.equals(str2); } /** * <p> * Compares two Strings, returning <code>true</code> if they are equal ignoring the case. * </p> * * <p> * <code>null</code>s are handled without exceptions. Two <code>null</code> references are considered equal. Comparison is case * insensitive. * </p> * * <pre> * StringUtils.equalsIgnoreCase(null, null) = true * StringUtils.equalsIgnoreCase(null, "abc") = false * StringUtils.equalsIgnoreCase("abc", null) = false * StringUtils.equalsIgnoreCase("abc", "abc") = true * StringUtils.equalsIgnoreCase("abc", "ABC") = true * </pre> * * @param str1 the first String, may be null * @param str2 the second String, may be null * @return <code>true</code> if the Strings are equal, case insensitive, or both <code>null</code> * @see java.lang.String#equalsIgnoreCase(String) */ public static boolean equalsIgnoreCase(String str1, String str2) { return str1 == null ? str2 == null : str1.equalsIgnoreCase(str2); } /** * <p> * Check if a String starts with a specified prefix. * </p> * * <p> * <code>null</code>s are handled without exceptions. Two <code>null</code> references are considered to be equal. The comparison * is case sensitive. * </p> * * <pre> * StringUtils.startsWith(null, null) = true * StringUtils.startsWith(null, "abc") = false * StringUtils.startsWith("abcdef", null) = false * StringUtils.startsWith("abcdef", "abc") = true * StringUtils.startsWith("ABCDEF", "abc") = false * </pre> * * @param str the String to check, may be null * @param prefix the prefix to find, may be null * @return <code>true</code> if the String starts with the prefix, case sensitive, or both <code>null</code> * @see java.lang.String#startsWith(String) * @since 2.4 */ public static boolean startsWith(String str, String prefix) { return startsWith(str, prefix, false); } /** * <p> * Check if a String starts with a specified prefix (optionally case insensitive). * </p> * * @param str the String to check, may be null * @param prefix the prefix to find, may be null * @param ignoreCase inidicates whether the compare should ignore case (case insensitive) or not. * @return <code>true</code> if the String starts with the prefix or both <code>null</code> * @see java.lang.String#startsWith(String) */ private static boolean startsWith(String str, String prefix, boolean ignoreCase) { if (str == null || prefix == null) { return str == null && prefix == null; } if (prefix.length() > str.length()) { return false; } return str.regionMatches(ignoreCase, 0, prefix, 0, prefix.length()); } /** * <p> * Case insensitive check if a String starts with a specified prefix. * </p> * * <p> * <code>null</code>s are handled without exceptions. Two <code>null</code> references are considered to be equal. The comparison * is case insensitive. * </p> * * <pre> * StringUtils.startsWithIgnoreCase(null, null) = true * StringUtils.startsWithIgnoreCase(null, "abc") = false * StringUtils.startsWithIgnoreCase("abcdef", null) = false * StringUtils.startsWithIgnoreCase("abcdef", "abc") = true * StringUtils.startsWithIgnoreCase("ABCDEF", "abc") = true * </pre> * * @param str the String to check, may be null * @param prefix the prefix to find, may be null * @return <code>true</code> if the String starts with the prefix, case insensitive, or both <code>null</code> * @see java.lang.String#startsWith(String) * @since 2.4 */ public static boolean startsWithIgnoreCase(String str, String prefix) { return startsWith(str, prefix, true); } /** * <p> * Checks if the String contains only unicode digits. A decimal point is not a unicode digit and returns false. * </p> * * <p> * <code>null</code> will return <code>false</code>. An empty String (length()=0) will return <code>true</code>. * </p> * * <pre> * StringUtils.isNumeric(null) = false * StringUtils.isNumeric("") = true * StringUtils.isNumeric(" ") = false * StringUtils.isNumeric("123") = true * StringUtils.isNumeric("12 3") = false * StringUtils.isNumeric("ab2c") = false * StringUtils.isNumeric("12-3") = false * StringUtils.isNumeric("12.3") = false * </pre> * * @param str the String to check, may be null * @return <code>true</code> if only contains digits, and is non-null */ public static boolean isNumeric(String str) { if (str == null) { return false; } int sz = str.length(); for (int i = 0; i < sz; i++) { if (!Character.isDigit(str.charAt(i))) { return false; } } return true; } public interface StringFormatter<T> { String format(T obj); } public static <T> String join(Collection<T> collection, String separator) { return join(collection, separator, new StringFormatter<T>() { @Override public String format(T obj) { return obj.toString(); } }); } public static <T> String join(Collection<T> collection, String separator, StringFormatter<T> formatter) { Iterator<T> iterator = collection.iterator(); // handle null, zero and one elements before building a buffer if (iterator == null) { return null; } if (!iterator.hasNext()) { return EMPTY; } T first = iterator.next(); if (!iterator.hasNext()) { return first == null ? "" : formatter.format(first); } // two or more elements StringBuilder buf = new StringBuilder(256); // Java default is 16, probably too small if (first != null) { buf.append(formatter.format(first)); } while (iterator.hasNext()) { buf.append(separator); T obj = iterator.next(); if (obj != null) { buf.append(formatter.format(obj)); } } return buf.toString(); } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/environment/DatabasePortalMetaServerProviderTest.java
package com.ctrip.framework.apollo.portal.environment; import static org.junit.Assert.*; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import java.util.HashMap; import java.util.Map; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class DatabasePortalMetaServerProviderTest { private DatabasePortalMetaServerProvider databasePortalMetaServerProvider; @Mock private PortalConfig portalConfig; private Map<String, String> metaServiceMap; @Before public void setUp() { MockitoAnnotations.initMocks(this); metaServiceMap = new HashMap<>(); metaServiceMap.put("nothing", "http://unknown.com"); metaServiceMap.put("dev", "http://server.com:8080"); Mockito.when(portalConfig.getMetaServers()).thenReturn(metaServiceMap); // use mocked object to construct databasePortalMetaServerProvider = new DatabasePortalMetaServerProvider(portalConfig); } @Test public void testGetMetaServerAddress() { String address = databasePortalMetaServerProvider.getMetaServerAddress(Env.DEV); assertEquals("http://server.com:8080", address); String newMetaServerAddress = "http://another-server.com:8080"; metaServiceMap.put("dev", newMetaServerAddress); databasePortalMetaServerProvider.reload(); assertEquals(newMetaServerAddress, databasePortalMetaServerProvider.getMetaServerAddress(Env.DEV)); } @Test public void testExists() { assertTrue(databasePortalMetaServerProvider.exists(Env.DEV)); assertFalse(databasePortalMetaServerProvider.exists(Env.PRO)); assertTrue(databasePortalMetaServerProvider.exists(Env.addEnvironment("nothing"))); } }
package com.ctrip.framework.apollo.portal.environment; import static org.junit.Assert.*; import com.ctrip.framework.apollo.portal.component.config.PortalConfig; import java.util.HashMap; import java.util.Map; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnitRunner; @RunWith(MockitoJUnitRunner.class) public class DatabasePortalMetaServerProviderTest { private DatabasePortalMetaServerProvider databasePortalMetaServerProvider; @Mock private PortalConfig portalConfig; private Map<String, String> metaServiceMap; @Before public void setUp() { MockitoAnnotations.initMocks(this); metaServiceMap = new HashMap<>(); metaServiceMap.put("nothing", "http://unknown.com"); metaServiceMap.put("dev", "http://server.com:8080"); Mockito.when(portalConfig.getMetaServers()).thenReturn(metaServiceMap); // use mocked object to construct databasePortalMetaServerProvider = new DatabasePortalMetaServerProvider(portalConfig); } @Test public void testGetMetaServerAddress() { String address = databasePortalMetaServerProvider.getMetaServerAddress(Env.DEV); assertEquals("http://server.com:8080", address); String newMetaServerAddress = "http://another-server.com:8080"; metaServiceMap.put("dev", newMetaServerAddress); databasePortalMetaServerProvider.reload(); assertEquals(newMetaServerAddress, databasePortalMetaServerProvider.getMetaServerAddress(Env.DEV)); } @Test public void testExists() { assertTrue(databasePortalMetaServerProvider.exists(Env.DEV)); assertFalse(databasePortalMetaServerProvider.exists(Env.PRO)); assertTrue(databasePortalMetaServerProvider.exists(Env.addEnvironment("nothing"))); } }
-1
apolloconfig/apollo
3,679
fix[apollo-configService]: Solve configService startup exception
## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
klboke
2021-05-12T10:46:18Z
2021-05-18T00:03:38Z
d60bf888c57dcea93568fdfa4ae3c5836f632d3d
1cc8f5501fa037a449f560788b8deedb70bc6f62
fix[apollo-configService]: Solve configService startup exception. ## What's the purpose of this PR fix[apollo-configService]: Solve configService startup exception
./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/model/NamespaceGrayDelReleaseModel.java
package com.ctrip.framework.apollo.portal.entity.model; import java.util.Set; public class NamespaceGrayDelReleaseModel extends NamespaceReleaseModel implements Verifiable { private Set<String> grayDelKeys; public Set<String> getGrayDelKeys() { return grayDelKeys; } public void setGrayDelKeys(Set<String> grayDelKeys) { this.grayDelKeys = grayDelKeys; } }
package com.ctrip.framework.apollo.portal.entity.model; import java.util.Set; public class NamespaceGrayDelReleaseModel extends NamespaceReleaseModel implements Verifiable { private Set<String> grayDelKeys; public Set<String> getGrayDelKeys() { return grayDelKeys; } public void setGrayDelKeys(Set<String> grayDelKeys) { this.grayDelKeys = grayDelKeys; } }
-1