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
unknown | date_merged
unknown | 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,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/test/java/com/ctrip/framework/apollo/portal/component/txtresolver/FileTextResolverTest.java | 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.portal.AbstractUnitTest;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.InjectMocks;
import java.util.Arrays;
import java.util.Collections;
public class FileTextResolverTest extends AbstractUnitTest {
@InjectMocks
private FileTextResolver resolver;
private final String CONFIG_TEXT = "config_text";
private final long NAMESPACE = 1000;
@Test
public void testCreateItem(){
ItemChangeSets changeSets = resolver.resolve(NAMESPACE, CONFIG_TEXT, Collections.emptyList());
Assert.assertEquals(1, changeSets.getCreateItems().size());
Assert.assertEquals(0, changeSets.getUpdateItems().size());
Assert.assertEquals(0, changeSets.getDeleteItems().size());
ItemDTO createdItem = changeSets.getCreateItems().get(0);
Assert.assertEquals(CONFIG_TEXT, createdItem.getValue());
}
@Test
public void testUpdateItem(){
ItemDTO existedItem = new ItemDTO();
existedItem.setId(1000);
existedItem.setKey(ConfigConsts.CONFIG_FILE_CONTENT_KEY);
existedItem.setValue("before");
ItemChangeSets changeSets = resolver.resolve(NAMESPACE, CONFIG_TEXT,
Collections.singletonList(existedItem));
Assert.assertEquals(0, changeSets.getCreateItems().size());
Assert.assertEquals(1, changeSets.getUpdateItems().size());
Assert.assertEquals(0, changeSets.getDeleteItems().size());
ItemDTO updatedItem = changeSets.getUpdateItems().get(0);
Assert.assertEquals(CONFIG_TEXT, updatedItem.getValue());
}
}
| 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.portal.AbstractUnitTest;
import org.junit.Assert;
import org.junit.Test;
import org.mockito.InjectMocks;
import java.util.Arrays;
import java.util.Collections;
public class FileTextResolverTest extends AbstractUnitTest {
@InjectMocks
private FileTextResolver resolver;
private final String CONFIG_TEXT = "config_text";
private final long NAMESPACE = 1000;
@Test
public void testCreateItem(){
ItemChangeSets changeSets = resolver.resolve(NAMESPACE, CONFIG_TEXT, Collections.emptyList());
Assert.assertEquals(1, changeSets.getCreateItems().size());
Assert.assertEquals(0, changeSets.getUpdateItems().size());
Assert.assertEquals(0, changeSets.getDeleteItems().size());
ItemDTO createdItem = changeSets.getCreateItems().get(0);
Assert.assertEquals(CONFIG_TEXT, createdItem.getValue());
}
@Test
public void testUpdateItem(){
ItemDTO existedItem = new ItemDTO();
existedItem.setId(1000);
existedItem.setKey(ConfigConsts.CONFIG_FILE_CONTENT_KEY);
existedItem.setValue("before");
ItemChangeSets changeSets = resolver.resolve(NAMESPACE, CONFIG_TEXT,
Collections.singletonList(existedItem));
Assert.assertEquals(0, changeSets.getCreateItems().size());
Assert.assertEquals(1, changeSets.getUpdateItems().size());
Assert.assertEquals(0, changeSets.getDeleteItems().size());
ItemDTO updatedItem = changeSets.getUpdateItems().get(0);
Assert.assertEquals(CONFIG_TEXT, updatedItem.getValue());
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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 | 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("[email protected]");
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());
}
}
| 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("[email protected]");
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,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/spi/ctrip/CtripSsoHeartbeatHandler.java | package com.ctrip.framework.apollo.portal.spi.ctrip;
import com.ctrip.framework.apollo.portal.spi.SsoHeartbeatHandler;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author Jason Song([email protected])
*/
public class CtripSsoHeartbeatHandler implements SsoHeartbeatHandler {
@Override
public void doHeartbeat(HttpServletRequest request, HttpServletResponse response) {
try {
response.sendRedirect("ctrip_sso_heartbeat.html");
} catch (IOException e) {
}
}
}
| package com.ctrip.framework.apollo.portal.spi.ctrip;
import com.ctrip.framework.apollo.portal.spi.SsoHeartbeatHandler;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author Jason Song([email protected])
*/
public class CtripSsoHeartbeatHandler implements SsoHeartbeatHandler {
@Override
public void doHeartbeat(HttpServletRequest request, HttpServletResponse response) {
try {
response.sendRedirect("ctrip_sso_heartbeat.html");
} catch (IOException e) {
}
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/java/com/ctrip/framework/apollo/spring/spi/DefaultConfigPropertySourcesProcessorHelper.java | package com.ctrip.framework.apollo.spring.spi;
import com.ctrip.framework.apollo.core.spi.Ordered;
import com.ctrip.framework.apollo.spring.annotation.ApolloAnnotationProcessor;
import com.ctrip.framework.apollo.spring.annotation.SpringValueProcessor;
import com.ctrip.framework.apollo.spring.property.SpringValueDefinitionProcessor;
import com.ctrip.framework.apollo.spring.util.BeanRegistrationUtil;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
public class DefaultConfigPropertySourcesProcessorHelper implements ConfigPropertySourcesProcessorHelper {
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
Map<String, Object> propertySourcesPlaceholderPropertyValues = new HashMap<>();
// to make sure the default PropertySourcesPlaceholderConfigurer's priority is higher than PropertyPlaceholderConfigurer
propertySourcesPlaceholderPropertyValues.put("order", 0);
BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, PropertySourcesPlaceholderConfigurer.class.getName(),
PropertySourcesPlaceholderConfigurer.class, propertySourcesPlaceholderPropertyValues);
BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, ApolloAnnotationProcessor.class.getName(),
ApolloAnnotationProcessor.class);
BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, SpringValueProcessor.class.getName(),
SpringValueProcessor.class);
processSpringValueDefinition(registry);
}
/**
* For Spring 3.x versions, the BeanDefinitionRegistryPostProcessor would not be instantiated if
* it is added in postProcessBeanDefinitionRegistry phase, so we have to manually call the
* postProcessBeanDefinitionRegistry method of SpringValueDefinitionProcessor here...
*/
private void processSpringValueDefinition(BeanDefinitionRegistry registry) {
SpringValueDefinitionProcessor springValueDefinitionProcessor = new SpringValueDefinitionProcessor();
springValueDefinitionProcessor.postProcessBeanDefinitionRegistry(registry);
}
@Override
public int getOrder() {
return Ordered.LOWEST_PRECEDENCE;
}
}
| package com.ctrip.framework.apollo.spring.spi;
import com.ctrip.framework.apollo.core.spi.Ordered;
import com.ctrip.framework.apollo.spring.annotation.ApolloAnnotationProcessor;
import com.ctrip.framework.apollo.spring.annotation.SpringValueProcessor;
import com.ctrip.framework.apollo.spring.property.SpringValueDefinitionProcessor;
import com.ctrip.framework.apollo.spring.util.BeanRegistrationUtil;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
public class DefaultConfigPropertySourcesProcessorHelper implements ConfigPropertySourcesProcessorHelper {
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
Map<String, Object> propertySourcesPlaceholderPropertyValues = new HashMap<>();
// to make sure the default PropertySourcesPlaceholderConfigurer's priority is higher than PropertyPlaceholderConfigurer
propertySourcesPlaceholderPropertyValues.put("order", 0);
BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, PropertySourcesPlaceholderConfigurer.class.getName(),
PropertySourcesPlaceholderConfigurer.class, propertySourcesPlaceholderPropertyValues);
BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, ApolloAnnotationProcessor.class.getName(),
ApolloAnnotationProcessor.class);
BeanRegistrationUtil.registerBeanDefinitionIfNotExists(registry, SpringValueProcessor.class.getName(),
SpringValueProcessor.class);
processSpringValueDefinition(registry);
}
/**
* For Spring 3.x versions, the BeanDefinitionRegistryPostProcessor would not be instantiated if
* it is added in postProcessBeanDefinitionRegistry phase, so we have to manually call the
* postProcessBeanDefinitionRegistry method of SpringValueDefinitionProcessor here...
*/
private void processSpringValueDefinition(BeanDefinitionRegistry registry) {
SpringValueDefinitionProcessor springValueDefinitionProcessor = new SpringValueDefinitionProcessor();
springValueDefinitionProcessor.postProcessBeanDefinitionRegistry(registry);
}
@Override
public int getOrder() {
return Ordered.LOWEST_PRECEDENCE;
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/service/PortalDBPropertySource.java | package com.ctrip.framework.apollo.portal.service;
import com.google.common.collect.Maps;
import com.ctrip.framework.apollo.common.config.RefreshablePropertySource;
import com.ctrip.framework.apollo.portal.entity.po.ServerConfig;
import com.ctrip.framework.apollo.portal.repository.ServerConfigRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.Objects;
/**
* @author Jason Song([email protected])
*/
@Component
public class PortalDBPropertySource extends RefreshablePropertySource {
private static final Logger logger = LoggerFactory.getLogger(PortalDBPropertySource.class);
@Autowired
private ServerConfigRepository serverConfigRepository;
public PortalDBPropertySource(String name, Map<String, Object> source) {
super(name, source);
}
public PortalDBPropertySource() {
super("DBConfig", Maps.newConcurrentMap());
}
@Override
protected void refresh() {
Iterable<ServerConfig> dbConfigs = serverConfigRepository.findAll();
for (ServerConfig config: dbConfigs) {
String key = config.getKey();
Object value = config.getValue();
if (this.source.isEmpty()) {
logger.info("Load config from DB : {} = {}", key, value);
} else if (!Objects.equals(this.source.get(key), value)) {
logger.info("Load config from DB : {} = {}. Old value = {}", key,
value, this.source.get(key));
}
this.source.put(key, value);
}
}
}
| package com.ctrip.framework.apollo.portal.service;
import com.google.common.collect.Maps;
import com.ctrip.framework.apollo.common.config.RefreshablePropertySource;
import com.ctrip.framework.apollo.portal.entity.po.ServerConfig;
import com.ctrip.framework.apollo.portal.repository.ServerConfigRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.Objects;
/**
* @author Jason Song([email protected])
*/
@Component
public class PortalDBPropertySource extends RefreshablePropertySource {
private static final Logger logger = LoggerFactory.getLogger(PortalDBPropertySource.class);
@Autowired
private ServerConfigRepository serverConfigRepository;
public PortalDBPropertySource(String name, Map<String, Object> source) {
super(name, source);
}
public PortalDBPropertySource() {
super("DBConfig", Maps.newConcurrentMap());
}
@Override
protected void refresh() {
Iterable<ServerConfig> dbConfigs = serverConfigRepository.findAll();
for (ServerConfig config: dbConfigs) {
String key = config.getKey();
Object value = config.getValue();
if (this.source.isEmpty()) {
logger.info("Load config from DB : {} = {}", key, value);
} else if (!Objects.equals(this.source.get(key), value)) {
logger.info("Load config from DB : {} = {}. Old value = {}", key,
value, this.source.get(key));
}
this.source.put(key, value);
}
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/openapi/entity/Consumer.java | package com.ctrip.framework.apollo.openapi.entity;
import com.ctrip.framework.apollo.common.entity.BaseEntity;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "Consumer")
@SQLDelete(sql = "Update Consumer set isDeleted = 1 where id = ?")
@Where(clause = "isDeleted = 0")
public class Consumer extends BaseEntity {
@Column(name = "Name", nullable = false)
private String name;
@Column(name = "AppId", nullable = false)
private String appId;
@Column(name = "OrgId", nullable = false)
private String orgId;
@Column(name = "OrgName", nullable = false)
private String orgName;
@Column(name = "OwnerName", nullable = false)
private String ownerName;
@Column(name = "OwnerEmail", nullable = false)
private String ownerEmail;
public String getAppId() {
return appId;
}
public String getName() {
return name;
}
public String getOrgId() {
return orgId;
}
public String getOrgName() {
return orgName;
}
public String getOwnerEmail() {
return ownerEmail;
}
public String getOwnerName() {
return ownerName;
}
public void setAppId(String appId) {
this.appId = appId;
}
public void setName(String name) {
this.name = name;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public void setOwnerEmail(String ownerEmail) {
this.ownerEmail = ownerEmail;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
@Override
public String toString() {
return toStringHelper().add("name", name).add("appId", appId)
.add("orgId", orgId)
.add("orgName", orgName)
.add("ownerName", ownerName)
.add("ownerEmail", ownerEmail).toString();
}
}
| package com.ctrip.framework.apollo.openapi.entity;
import com.ctrip.framework.apollo.common.entity.BaseEntity;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "Consumer")
@SQLDelete(sql = "Update Consumer set isDeleted = 1 where id = ?")
@Where(clause = "isDeleted = 0")
public class Consumer extends BaseEntity {
@Column(name = "Name", nullable = false)
private String name;
@Column(name = "AppId", nullable = false)
private String appId;
@Column(name = "OrgId", nullable = false)
private String orgId;
@Column(name = "OrgName", nullable = false)
private String orgName;
@Column(name = "OwnerName", nullable = false)
private String ownerName;
@Column(name = "OwnerEmail", nullable = false)
private String ownerEmail;
public String getAppId() {
return appId;
}
public String getName() {
return name;
}
public String getOrgId() {
return orgId;
}
public String getOrgName() {
return orgName;
}
public String getOwnerEmail() {
return ownerEmail;
}
public String getOwnerName() {
return ownerName;
}
public void setAppId(String appId) {
this.appId = appId;
}
public void setName(String name) {
this.name = name;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public void setOwnerEmail(String ownerEmail) {
this.ownerEmail = ownerEmail;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
@Override
public String toString() {
return toStringHelper().add("name", name).add("appId", appId)
.add("orgId", orgId)
.add("orgName", orgName)
.add("ownerName", ownerName)
.add("ownerEmail", ownerEmail).toString();
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/ReleaseController.java | package com.ctrip.framework.apollo.portal.controller;
import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.common.exception.NotFoundException;
import com.ctrip.framework.apollo.portal.environment.Env;
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.ReleaseBO;
import com.ctrip.framework.apollo.portal.entity.model.NamespaceReleaseModel;
import com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult;
import com.ctrip.framework.apollo.portal.listener.ConfigPublishEvent;
import com.ctrip.framework.apollo.portal.service.ReleaseService;
import com.ctrip.framework.apollo.portal.spi.UserInfoHolder;
import javax.validation.Valid;
import javax.validation.constraints.Positive;
import javax.validation.constraints.PositiveOrZero;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.List;
@Validated
@RestController
public class ReleaseController {
private final ReleaseService releaseService;
private final ApplicationEventPublisher publisher;
private final PortalConfig portalConfig;
private final PermissionValidator permissionValidator;
private final UserInfoHolder userInfoHolder;
public ReleaseController(
final ReleaseService releaseService,
final ApplicationEventPublisher publisher,
final PortalConfig portalConfig,
final PermissionValidator permissionValidator,
final UserInfoHolder userInfoHolder) {
this.releaseService = releaseService;
this.publisher = publisher;
this.portalConfig = portalConfig;
this.permissionValidator = permissionValidator;
this.userInfoHolder = userInfoHolder;
}
@PreAuthorize(value = "@permissionValidator.hasReleaseNamespacePermission(#appId, #namespaceName, #env)")
@PostMapping(value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases")
public ReleaseDTO createRelease(@PathVariable String appId,
@PathVariable String env, @PathVariable String clusterName,
@PathVariable String namespaceName, @RequestBody NamespaceReleaseModel model) {
model.setAppId(appId);
model.setEnv(env);
model.setClusterName(clusterName);
model.setNamespaceName(namespaceName);
if (model.isEmergencyPublish() && !portalConfig.isEmergencyPublishAllowed(Env.valueOf(env))) {
throw new BadRequestException(String.format("Env: %s is not supported emergency publish now", env));
}
ReleaseDTO createdRelease = releaseService.publish(model);
ConfigPublishEvent event = ConfigPublishEvent.instance();
event.withAppId(appId)
.withCluster(clusterName)
.withNamespace(namespaceName)
.withReleaseId(createdRelease.getId())
.setNormalPublishEvent(true)
.setEnv(Env.valueOf(env));
publisher.publishEvent(event);
return createdRelease;
}
@PreAuthorize(value = "@permissionValidator.hasReleaseNamespacePermission(#appId, #namespaceName, #env)")
@PostMapping(value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/releases")
public ReleaseDTO createGrayRelease(@PathVariable String appId,
@PathVariable String env, @PathVariable String clusterName,
@PathVariable String namespaceName, @PathVariable String branchName,
@RequestBody NamespaceReleaseModel model) {
model.setAppId(appId);
model.setEnv(env);
model.setClusterName(branchName);
model.setNamespaceName(namespaceName);
if (model.isEmergencyPublish() && !portalConfig.isEmergencyPublishAllowed(Env.valueOf(env))) {
throw new BadRequestException(String.format("Env: %s is not supported emergency publish now", env));
}
ReleaseDTO createdRelease = releaseService.publish(model);
ConfigPublishEvent event = ConfigPublishEvent.instance();
event.withAppId(appId)
.withCluster(clusterName)
.withNamespace(namespaceName)
.withReleaseId(createdRelease.getId())
.setGrayPublishEvent(true)
.setEnv(Env.valueOf(env));
publisher.publishEvent(event);
return createdRelease;
}
@GetMapping("/envs/{env}/releases/{releaseId}")
public ReleaseDTO get(@PathVariable String env,
@PathVariable long releaseId) {
ReleaseDTO release = releaseService.findReleaseById(Env.valueOf(env), releaseId);
if (release == null) {
throw new NotFoundException("release not found");
}
return release;
}
@GetMapping(value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases/all")
public List<ReleaseBO> findAllReleases(@PathVariable String appId,
@PathVariable String env,
@PathVariable String clusterName,
@PathVariable String namespaceName,
@Valid @PositiveOrZero(message = "page should be positive or 0") @RequestParam(defaultValue = "0") int page,
@Valid @Positive(message = "size should be positive number") @RequestParam(defaultValue = "5") int size) {
if (permissionValidator.shouldHideConfigToCurrentUser(appId, env, namespaceName)) {
return Collections.emptyList();
}
return releaseService.findAllReleases(appId, Env.valueOf(env), clusterName, namespaceName, page, size);
}
@GetMapping(value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases/active")
public List<ReleaseDTO> findActiveReleases(@PathVariable String appId,
@PathVariable String env,
@PathVariable String clusterName,
@PathVariable String namespaceName,
@Valid @PositiveOrZero(message = "page should be positive or 0") @RequestParam(defaultValue = "0") int page,
@Valid @Positive(message = "size should be positive number") @RequestParam(defaultValue = "5") int size) {
if (permissionValidator.shouldHideConfigToCurrentUser(appId, env, namespaceName)) {
return Collections.emptyList();
}
return releaseService.findActiveReleases(appId, Env.valueOf(env), clusterName, namespaceName, page, size);
}
@GetMapping(value = "/envs/{env}/releases/compare")
public ReleaseCompareResult compareRelease(@PathVariable String env,
@RequestParam long baseReleaseId,
@RequestParam long toCompareReleaseId) {
return releaseService.compare(Env.valueOf(env), baseReleaseId, toCompareReleaseId);
}
@PutMapping(path = "/envs/{env}/releases/{releaseId}/rollback")
public void rollback(@PathVariable String env,
@PathVariable long releaseId,
@RequestParam(defaultValue = "-1") long toReleaseId) {
ReleaseDTO release = releaseService.findReleaseById(Env.valueOf(env), releaseId);
if (release == null) {
throw new NotFoundException("release not found");
}
if (!permissionValidator.hasReleaseNamespacePermission(release.getAppId(), release.getNamespaceName(), env)) {
throw new AccessDeniedException("Access is denied");
}
if (toReleaseId > -1) {
releaseService.rollbackTo(Env.valueOf(env), releaseId, toReleaseId, userInfoHolder.getUser().getUserId());
} else {
releaseService.rollback(Env.valueOf(env), releaseId, userInfoHolder.getUser().getUserId());
}
ConfigPublishEvent event = ConfigPublishEvent.instance();
event.withAppId(release.getAppId())
.withCluster(release.getClusterName())
.withNamespace(release.getNamespaceName())
.withPreviousReleaseId(releaseId)
.setRollbackEvent(true)
.setEnv(Env.valueOf(env));
publisher.publishEvent(event);
}
}
| package com.ctrip.framework.apollo.portal.controller;
import com.ctrip.framework.apollo.common.dto.ReleaseDTO;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.common.exception.NotFoundException;
import com.ctrip.framework.apollo.portal.environment.Env;
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.ReleaseBO;
import com.ctrip.framework.apollo.portal.entity.model.NamespaceReleaseModel;
import com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult;
import com.ctrip.framework.apollo.portal.listener.ConfigPublishEvent;
import com.ctrip.framework.apollo.portal.service.ReleaseService;
import com.ctrip.framework.apollo.portal.spi.UserInfoHolder;
import javax.validation.Valid;
import javax.validation.constraints.Positive;
import javax.validation.constraints.PositiveOrZero;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Collections;
import java.util.List;
@Validated
@RestController
public class ReleaseController {
private final ReleaseService releaseService;
private final ApplicationEventPublisher publisher;
private final PortalConfig portalConfig;
private final PermissionValidator permissionValidator;
private final UserInfoHolder userInfoHolder;
public ReleaseController(
final ReleaseService releaseService,
final ApplicationEventPublisher publisher,
final PortalConfig portalConfig,
final PermissionValidator permissionValidator,
final UserInfoHolder userInfoHolder) {
this.releaseService = releaseService;
this.publisher = publisher;
this.portalConfig = portalConfig;
this.permissionValidator = permissionValidator;
this.userInfoHolder = userInfoHolder;
}
@PreAuthorize(value = "@permissionValidator.hasReleaseNamespacePermission(#appId, #namespaceName, #env)")
@PostMapping(value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases")
public ReleaseDTO createRelease(@PathVariable String appId,
@PathVariable String env, @PathVariable String clusterName,
@PathVariable String namespaceName, @RequestBody NamespaceReleaseModel model) {
model.setAppId(appId);
model.setEnv(env);
model.setClusterName(clusterName);
model.setNamespaceName(namespaceName);
if (model.isEmergencyPublish() && !portalConfig.isEmergencyPublishAllowed(Env.valueOf(env))) {
throw new BadRequestException(String.format("Env: %s is not supported emergency publish now", env));
}
ReleaseDTO createdRelease = releaseService.publish(model);
ConfigPublishEvent event = ConfigPublishEvent.instance();
event.withAppId(appId)
.withCluster(clusterName)
.withNamespace(namespaceName)
.withReleaseId(createdRelease.getId())
.setNormalPublishEvent(true)
.setEnv(Env.valueOf(env));
publisher.publishEvent(event);
return createdRelease;
}
@PreAuthorize(value = "@permissionValidator.hasReleaseNamespacePermission(#appId, #namespaceName, #env)")
@PostMapping(value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/branches/{branchName}/releases")
public ReleaseDTO createGrayRelease(@PathVariable String appId,
@PathVariable String env, @PathVariable String clusterName,
@PathVariable String namespaceName, @PathVariable String branchName,
@RequestBody NamespaceReleaseModel model) {
model.setAppId(appId);
model.setEnv(env);
model.setClusterName(branchName);
model.setNamespaceName(namespaceName);
if (model.isEmergencyPublish() && !portalConfig.isEmergencyPublishAllowed(Env.valueOf(env))) {
throw new BadRequestException(String.format("Env: %s is not supported emergency publish now", env));
}
ReleaseDTO createdRelease = releaseService.publish(model);
ConfigPublishEvent event = ConfigPublishEvent.instance();
event.withAppId(appId)
.withCluster(clusterName)
.withNamespace(namespaceName)
.withReleaseId(createdRelease.getId())
.setGrayPublishEvent(true)
.setEnv(Env.valueOf(env));
publisher.publishEvent(event);
return createdRelease;
}
@GetMapping("/envs/{env}/releases/{releaseId}")
public ReleaseDTO get(@PathVariable String env,
@PathVariable long releaseId) {
ReleaseDTO release = releaseService.findReleaseById(Env.valueOf(env), releaseId);
if (release == null) {
throw new NotFoundException("release not found");
}
return release;
}
@GetMapping(value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases/all")
public List<ReleaseBO> findAllReleases(@PathVariable String appId,
@PathVariable String env,
@PathVariable String clusterName,
@PathVariable String namespaceName,
@Valid @PositiveOrZero(message = "page should be positive or 0") @RequestParam(defaultValue = "0") int page,
@Valid @Positive(message = "size should be positive number") @RequestParam(defaultValue = "5") int size) {
if (permissionValidator.shouldHideConfigToCurrentUser(appId, env, namespaceName)) {
return Collections.emptyList();
}
return releaseService.findAllReleases(appId, Env.valueOf(env), clusterName, namespaceName, page, size);
}
@GetMapping(value = "/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/releases/active")
public List<ReleaseDTO> findActiveReleases(@PathVariable String appId,
@PathVariable String env,
@PathVariable String clusterName,
@PathVariable String namespaceName,
@Valid @PositiveOrZero(message = "page should be positive or 0") @RequestParam(defaultValue = "0") int page,
@Valid @Positive(message = "size should be positive number") @RequestParam(defaultValue = "5") int size) {
if (permissionValidator.shouldHideConfigToCurrentUser(appId, env, namespaceName)) {
return Collections.emptyList();
}
return releaseService.findActiveReleases(appId, Env.valueOf(env), clusterName, namespaceName, page, size);
}
@GetMapping(value = "/envs/{env}/releases/compare")
public ReleaseCompareResult compareRelease(@PathVariable String env,
@RequestParam long baseReleaseId,
@RequestParam long toCompareReleaseId) {
return releaseService.compare(Env.valueOf(env), baseReleaseId, toCompareReleaseId);
}
@PutMapping(path = "/envs/{env}/releases/{releaseId}/rollback")
public void rollback(@PathVariable String env,
@PathVariable long releaseId,
@RequestParam(defaultValue = "-1") long toReleaseId) {
ReleaseDTO release = releaseService.findReleaseById(Env.valueOf(env), releaseId);
if (release == null) {
throw new NotFoundException("release not found");
}
if (!permissionValidator.hasReleaseNamespacePermission(release.getAppId(), release.getNamespaceName(), env)) {
throw new AccessDeniedException("Access is denied");
}
if (toReleaseId > -1) {
releaseService.rollbackTo(Env.valueOf(env), releaseId, toReleaseId, userInfoHolder.getUser().getUserId());
} else {
releaseService.rollback(Env.valueOf(env), releaseId, userInfoHolder.getUser().getUserId());
}
ConfigPublishEvent event = ConfigPublishEvent.instance();
event.withAppId(release.getAppId())
.withCluster(release.getClusterName())
.withNamespace(release.getNamespaceName())
.withPreviousReleaseId(releaseId)
.setRollbackEvent(true)
.setEnv(Env.valueOf(env));
publisher.publishEvent(event);
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/openapi/repository/ConsumerAuditRepository.java | package com.ctrip.framework.apollo.openapi.repository;
import com.ctrip.framework.apollo.openapi.entity.ConsumerAudit;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
* @author Jason Song([email protected])
*/
public interface ConsumerAuditRepository extends PagingAndSortingRepository<ConsumerAudit, Long> {
}
| package com.ctrip.framework.apollo.openapi.repository;
import com.ctrip.framework.apollo.openapi.entity.ConsumerAudit;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
* @author Jason Song([email protected])
*/
public interface ConsumerAuditRepository extends PagingAndSortingRepository<ConsumerAudit, Long> {
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/java/com/ctrip/framework/apollo/demo/spring/common/bean/AnnotatedBean.java | package com.ctrip.framework.apollo.demo.spring.common.bean;
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* @author Jason Song([email protected])
*/
@Component("annotatedBean")
public class AnnotatedBean {
private static final Logger logger = LoggerFactory.getLogger(AnnotatedBean.class);
private int timeout;
private int batch;
private List<JsonBean> jsonBeans;
/**
* ApolloJsonValue annotated on fields example, the default value is specified as empty list - []
* <br />
* jsonBeanProperty=[{"someString":"hello","someInt":100},{"someString":"world!","someInt":200}]
*/
@ApolloJsonValue("${jsonBeanProperty:[]}")
private List<JsonBean> anotherJsonBeans;
@Value("${batch:100}")
public void setBatch(int batch) {
logger.info("updating batch, old value: {}, new value: {}", this.batch, batch);
this.batch = batch;
}
@Value("${timeout:200}")
public void setTimeout(int timeout) {
logger.info("updating timeout, old value: {}, new value: {}", this.timeout, timeout);
this.timeout = timeout;
}
/**
* ApolloJsonValue annotated on methods example, the default value is specified as empty list - []
* <br />
* jsonBeanProperty=[{"someString":"hello","someInt":100},{"someString":"world!","someInt":200}]
*/
@ApolloJsonValue("${jsonBeanProperty:[]}")
public void setJsonBeans(List<JsonBean> jsonBeans) {
logger.info("updating json beans, old value: {}, new value: {}", this.jsonBeans, jsonBeans);
this.jsonBeans = jsonBeans;
}
@Override
public String toString() {
return String.format("[AnnotatedBean] timeout: %d, batch: %d, jsonBeans: %s", timeout, batch, jsonBeans);
}
private static class JsonBean{
private String someString;
private int someInt;
@Override
public String toString() {
return "JsonBean{" +
"someString='" + someString + '\'' +
", someInt=" + someInt +
'}';
}
}
}
| package com.ctrip.framework.apollo.demo.spring.common.bean;
import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* @author Jason Song([email protected])
*/
@Component("annotatedBean")
public class AnnotatedBean {
private static final Logger logger = LoggerFactory.getLogger(AnnotatedBean.class);
private int timeout;
private int batch;
private List<JsonBean> jsonBeans;
/**
* ApolloJsonValue annotated on fields example, the default value is specified as empty list - []
* <br />
* jsonBeanProperty=[{"someString":"hello","someInt":100},{"someString":"world!","someInt":200}]
*/
@ApolloJsonValue("${jsonBeanProperty:[]}")
private List<JsonBean> anotherJsonBeans;
@Value("${batch:100}")
public void setBatch(int batch) {
logger.info("updating batch, old value: {}, new value: {}", this.batch, batch);
this.batch = batch;
}
@Value("${timeout:200}")
public void setTimeout(int timeout) {
logger.info("updating timeout, old value: {}, new value: {}", this.timeout, timeout);
this.timeout = timeout;
}
/**
* ApolloJsonValue annotated on methods example, the default value is specified as empty list - []
* <br />
* jsonBeanProperty=[{"someString":"hello","someInt":100},{"someString":"world!","someInt":200}]
*/
@ApolloJsonValue("${jsonBeanProperty:[]}")
public void setJsonBeans(List<JsonBean> jsonBeans) {
logger.info("updating json beans, old value: {}, new value: {}", this.jsonBeans, jsonBeans);
this.jsonBeans = jsonBeans;
}
@Override
public String toString() {
return String.format("[AnnotatedBean] timeout: %d, batch: %d, jsonBeans: %s", timeout, batch, jsonBeans);
}
private static class JsonBean{
private String someString;
private int someInt;
@Override
public String toString() {
return "JsonBean{" +
"someString='" + someString + '\'' +
", someInt=" + someInt +
'}';
}
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/java/com/ctrip/framework/apollo/spi/DefaultConfigFactoryManager.java | package com.ctrip.framework.apollo.spi;
import java.util.Map;
import com.ctrip.framework.apollo.build.ApolloInjector;
import com.google.common.collect.Maps;
/**
* @author Jason Song([email protected])
*/
public class DefaultConfigFactoryManager implements ConfigFactoryManager {
private ConfigRegistry m_registry;
private Map<String, ConfigFactory> m_factories = Maps.newConcurrentMap();
public DefaultConfigFactoryManager() {
m_registry = ApolloInjector.getInstance(ConfigRegistry.class);
}
@Override
public ConfigFactory getFactory(String namespace) {
// step 1: check hacked factory
ConfigFactory factory = m_registry.getFactory(namespace);
if (factory != null) {
return factory;
}
// step 2: check cache
factory = m_factories.get(namespace);
if (factory != null) {
return factory;
}
// step 3: check declared config factory
factory = ApolloInjector.getInstance(ConfigFactory.class, namespace);
if (factory != null) {
return factory;
}
// step 4: check default config factory
factory = ApolloInjector.getInstance(ConfigFactory.class);
m_factories.put(namespace, factory);
// factory should not be null
return factory;
}
}
| package com.ctrip.framework.apollo.spi;
import java.util.Map;
import com.ctrip.framework.apollo.build.ApolloInjector;
import com.google.common.collect.Maps;
/**
* @author Jason Song([email protected])
*/
public class DefaultConfigFactoryManager implements ConfigFactoryManager {
private ConfigRegistry m_registry;
private Map<String, ConfigFactory> m_factories = Maps.newConcurrentMap();
public DefaultConfigFactoryManager() {
m_registry = ApolloInjector.getInstance(ConfigRegistry.class);
}
@Override
public ConfigFactory getFactory(String namespace) {
// step 1: check hacked factory
ConfigFactory factory = m_registry.getFactory(namespace);
if (factory != null) {
return factory;
}
// step 2: check cache
factory = m_factories.get(namespace);
if (factory != null) {
return factory;
}
// step 3: check declared config factory
factory = ApolloInjector.getInstance(ConfigFactory.class, namespace);
if (factory != null) {
return factory;
}
// step 4: check default config factory
factory = ApolloInjector.getInstance(ConfigFactory.class);
m_factories.put(namespace, factory);
// factory should not be null
return factory;
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/entity/vo/LockInfo.java | package com.ctrip.framework.apollo.portal.entity.vo;
public class LockInfo {
private String lockOwner;
private boolean isEmergencyPublishAllowed;
public String getLockOwner() {
return lockOwner;
}
public void setLockOwner(String lockOwner) {
this.lockOwner = lockOwner;
}
public boolean isEmergencyPublishAllowed() {
return isEmergencyPublishAllowed;
}
public void setEmergencyPublishAllowed(boolean emergencyPublishAllowed) {
isEmergencyPublishAllowed = emergencyPublishAllowed;
}
}
| package com.ctrip.framework.apollo.portal.entity.vo;
public class LockInfo {
private String lockOwner;
private boolean isEmergencyPublishAllowed;
public String getLockOwner() {
return lockOwner;
}
public void setLockOwner(String lockOwner) {
this.lockOwner = lockOwner;
}
public boolean isEmergencyPublishAllowed() {
return isEmergencyPublishAllowed;
}
public void setEmergencyPublishAllowed(boolean emergencyPublishAllowed) {
isEmergencyPublishAllowed = emergencyPublishAllowed;
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/test/java/com/ctrip/framework/apollo/portal/environment/PortalMetaDomainServiceTest.java | package com.ctrip.framework.apollo.portal.environment;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.ctrip.framework.apollo.portal.component.config.PortalConfig;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class PortalMetaDomainServiceTest extends BaseIntegrationTest {
private PortalMetaDomainService portalMetaDomainService;
@Mock
private PortalConfig portalConfig;
@Before
public void init() {
final Map<String, String> map = new HashMap<>();
map.put("nothing", "http://unknown.com");
Mockito.when(portalConfig.getMetaServers()).thenReturn(map);
portalMetaDomainService = new PortalMetaDomainService(portalConfig);
}
@Test
public void testGetMetaDomain() {
// local
String localMetaServerAddress = "http://localhost:8080";
mockMetaServerAddress(Env.LOCAL, localMetaServerAddress);
assertEquals(localMetaServerAddress, portalMetaDomainService.getDomain(Env.LOCAL));
// add this environment without meta server address
String randomEnvironment = "randomEnvironment";
Env.addEnvironment(randomEnvironment);
assertEquals(PortalMetaDomainService.DEFAULT_META_URL, portalMetaDomainService.getDomain(Env.valueOf(randomEnvironment)));
}
@Test
public void testGetValidAddress() throws Exception {
String someResponse = "some response";
startServerWithHandlers(mockServerHandler(HttpServletResponse.SC_OK, someResponse));
String validServer = " http://localhost:" + PORT + " ";
String invalidServer = "http://localhost:" + findFreePort();
mockMetaServerAddress(Env.FAT, validServer + "," + invalidServer);
mockMetaServerAddress(Env.UAT, invalidServer + "," + validServer);
portalMetaDomainService.reload();
assertEquals(validServer.trim(), portalMetaDomainService.getDomain(Env.FAT));
assertEquals(validServer.trim(), portalMetaDomainService.getDomain(Env.UAT));
}
@Test
public void testInvalidAddress() {
String invalidServer = "http://localhost:" + findFreePort() + " ";
String anotherInvalidServer = "http://localhost:" + findFreePort() + " ";
mockMetaServerAddress(Env.LPT, invalidServer + "," + anotherInvalidServer);
portalMetaDomainService.reload();
String metaServer = portalMetaDomainService.getDomain(Env.LPT);
assertTrue(metaServer.equals(invalidServer.trim()) || metaServer.equals(anotherInvalidServer.trim()));
}
private void mockMetaServerAddress(Env env, String metaServerAddress) {
// add it to system's property
System.setProperty(env.getName() + "_meta", metaServerAddress);
}
} | package com.ctrip.framework.apollo.portal.environment;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.ctrip.framework.apollo.portal.component.config.PortalConfig;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class PortalMetaDomainServiceTest extends BaseIntegrationTest {
private PortalMetaDomainService portalMetaDomainService;
@Mock
private PortalConfig portalConfig;
@Before
public void init() {
final Map<String, String> map = new HashMap<>();
map.put("nothing", "http://unknown.com");
Mockito.when(portalConfig.getMetaServers()).thenReturn(map);
portalMetaDomainService = new PortalMetaDomainService(portalConfig);
}
@Test
public void testGetMetaDomain() {
// local
String localMetaServerAddress = "http://localhost:8080";
mockMetaServerAddress(Env.LOCAL, localMetaServerAddress);
assertEquals(localMetaServerAddress, portalMetaDomainService.getDomain(Env.LOCAL));
// add this environment without meta server address
String randomEnvironment = "randomEnvironment";
Env.addEnvironment(randomEnvironment);
assertEquals(PortalMetaDomainService.DEFAULT_META_URL, portalMetaDomainService.getDomain(Env.valueOf(randomEnvironment)));
}
@Test
public void testGetValidAddress() throws Exception {
String someResponse = "some response";
startServerWithHandlers(mockServerHandler(HttpServletResponse.SC_OK, someResponse));
String validServer = " http://localhost:" + PORT + " ";
String invalidServer = "http://localhost:" + findFreePort();
mockMetaServerAddress(Env.FAT, validServer + "," + invalidServer);
mockMetaServerAddress(Env.UAT, invalidServer + "," + validServer);
portalMetaDomainService.reload();
assertEquals(validServer.trim(), portalMetaDomainService.getDomain(Env.FAT));
assertEquals(validServer.trim(), portalMetaDomainService.getDomain(Env.UAT));
}
@Test
public void testInvalidAddress() {
String invalidServer = "http://localhost:" + findFreePort() + " ";
String anotherInvalidServer = "http://localhost:" + findFreePort() + " ";
mockMetaServerAddress(Env.LPT, invalidServer + "," + anotherInvalidServer);
portalMetaDomainService.reload();
String metaServer = portalMetaDomainService.getDomain(Env.LPT);
assertTrue(metaServer.equals(invalidServer.trim()) || metaServer.equals(anotherInvalidServer.trim()));
}
private void mockMetaServerAddress(Env env, String metaServerAddress) {
// add it to system's property
System.setProperty(env.getName() + "_meta", metaServerAddress);
}
} | -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/test/java/com/ctrip/framework/apollo/portal/service/AppNamespaceServiceTest.java | package com.ctrip.framework.apollo.portal.service;
import com.ctrip.framework.apollo.common.entity.AppNamespace;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import com.ctrip.framework.apollo.portal.AbstractIntegrationTest;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.jdbc.Sql;
import java.util.List;
public class AppNamespaceServiceTest extends AbstractIntegrationTest {
@Autowired
private AppNamespaceService appNamespaceService;
private final String APP = "app-test";
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testFindPublicAppNamespace() {
List<AppNamespace> appNamespaceList = appNamespaceService.findPublicAppNamespaces();
Assert.assertNotNull(appNamespaceList);
Assert.assertEquals(5, appNamespaceList.size());
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testFindPublicAppNamespaceByName() {
Assert.assertNotNull(appNamespaceService.findPublicAppNamespace("datasourcexml"));
Assert.assertNull(appNamespaceService.findPublicAppNamespace("TFF.song0711-02"));
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testFindPublicAppNamespaceByAppAndName() {
Assert.assertNotNull(appNamespaceService.findByAppIdAndName("100003173", "datasourcexml"));
Assert.assertNull(appNamespaceService.findByAppIdAndName("100003173", "TFF.song0711-02"));
}
@Test
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreateDefaultAppNamespace() {
appNamespaceService.createDefaultAppNamespace(APP);
AppNamespace appNamespace = appNamespaceService.findByAppIdAndName(APP, ConfigConsts.NAMESPACE_APPLICATION);
Assert.assertNotNull(appNamespace);
Assert.assertEquals(ConfigFileFormat.Properties.getValue(), appNamespace.getFormat());
}
@Test(expected = BadRequestException.class)
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceExisted() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespace.setName("old");
appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
appNamespaceService.createAppNamespaceInLocal(appNamespace);
}
@Test(expected = BadRequestException.class)
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceExistedAsPrivateAppNamespace() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespace.setName("private-01");
appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
appNamespaceService.createAppNamespaceInLocal(appNamespace);
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceNotExistedWithNoAppendnamespacePrefix() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespace.setName("old");
appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
AppNamespace createdAppNamespace = appNamespaceService.createAppNamespaceInLocal(appNamespace, false);
Assert.assertNotNull(createdAppNamespace);
Assert.assertEquals(appNamespace.getName(), createdAppNamespace.getName());
}
@Test(expected = BadRequestException.class)
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceExistedWithNoAppendnamespacePrefix() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespace.setName("datasource");
appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
appNamespaceService.createAppNamespaceInLocal(appNamespace, false);
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceNotExisted() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespaceService.createAppNamespaceInLocal(appNamespace);
AppNamespace createdAppNamespace = appNamespaceService.findPublicAppNamespace(appNamespace.getName());
Assert.assertNotNull(createdAppNamespace);
Assert.assertEquals(appNamespace.getName(), createdAppNamespace.getName());
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceWithWrongFormatNotExisted() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespace.setFormat(ConfigFileFormat.YAML.getValue());
appNamespaceService.createAppNamespaceInLocal(appNamespace);
AppNamespace createdAppNamespace = appNamespaceService.findPublicAppNamespace(appNamespace.getName());
Assert.assertNotNull(createdAppNamespace);
Assert.assertEquals(appNamespace.getName(), createdAppNamespace.getName());
Assert.assertEquals(ConfigFileFormat.Properties.getValue(), createdAppNamespace.getFormat());
}
@Test(expected = BadRequestException.class)
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePrivateAppNamespaceExisted() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(false);
appNamespace.setName("datasource");
appNamespace.setAppId("100003173");
appNamespaceService.createAppNamespaceInLocal(appNamespace);
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePrivateAppNamespaceExistedInAnotherAppId() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(false);
appNamespace.setName("datasource");
appNamespace.setAppId("song0711-01");
appNamespaceService.createAppNamespaceInLocal(appNamespace);
AppNamespace createdAppNamespace =
appNamespaceService.findByAppIdAndName(appNamespace.getAppId(), appNamespace.getName());
Assert.assertNotNull(createdAppNamespace);
Assert.assertEquals(appNamespace.getName(), createdAppNamespace.getName());
}
@Test(expected = BadRequestException.class)
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePrivateAppNamespaceExistedInAnotherAppIdAsPublic() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(false);
appNamespace.setName("SCC.song0711-03");
appNamespace.setAppId("100003173");
appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
appNamespaceService.createAppNamespaceInLocal(appNamespace);
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePrivateAppNamespaceNotExisted() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(false);
appNamespaceService.createAppNamespaceInLocal(appNamespace);
AppNamespace createdAppNamespace =
appNamespaceService.findByAppIdAndName(appNamespace.getAppId(), appNamespace.getName());
Assert.assertNotNull(createdAppNamespace);
Assert.assertEquals(appNamespace.getName(), createdAppNamespace.getName());
}
private AppNamespace assembleBaseAppNamespace() {
AppNamespace appNamespace = new AppNamespace();
appNamespace.setName("appNamespace");
appNamespace.setAppId("1000");
appNamespace.setFormat(ConfigFileFormat.XML.getValue());
return appNamespace;
}
}
| package com.ctrip.framework.apollo.portal.service;
import com.ctrip.framework.apollo.common.entity.AppNamespace;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import com.ctrip.framework.apollo.portal.AbstractIntegrationTest;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.jdbc.Sql;
import java.util.List;
public class AppNamespaceServiceTest extends AbstractIntegrationTest {
@Autowired
private AppNamespaceService appNamespaceService;
private final String APP = "app-test";
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testFindPublicAppNamespace() {
List<AppNamespace> appNamespaceList = appNamespaceService.findPublicAppNamespaces();
Assert.assertNotNull(appNamespaceList);
Assert.assertEquals(5, appNamespaceList.size());
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testFindPublicAppNamespaceByName() {
Assert.assertNotNull(appNamespaceService.findPublicAppNamespace("datasourcexml"));
Assert.assertNull(appNamespaceService.findPublicAppNamespace("TFF.song0711-02"));
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testFindPublicAppNamespaceByAppAndName() {
Assert.assertNotNull(appNamespaceService.findByAppIdAndName("100003173", "datasourcexml"));
Assert.assertNull(appNamespaceService.findByAppIdAndName("100003173", "TFF.song0711-02"));
}
@Test
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreateDefaultAppNamespace() {
appNamespaceService.createDefaultAppNamespace(APP);
AppNamespace appNamespace = appNamespaceService.findByAppIdAndName(APP, ConfigConsts.NAMESPACE_APPLICATION);
Assert.assertNotNull(appNamespace);
Assert.assertEquals(ConfigFileFormat.Properties.getValue(), appNamespace.getFormat());
}
@Test(expected = BadRequestException.class)
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceExisted() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespace.setName("old");
appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
appNamespaceService.createAppNamespaceInLocal(appNamespace);
}
@Test(expected = BadRequestException.class)
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceExistedAsPrivateAppNamespace() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespace.setName("private-01");
appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
appNamespaceService.createAppNamespaceInLocal(appNamespace);
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceNotExistedWithNoAppendnamespacePrefix() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespace.setName("old");
appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
AppNamespace createdAppNamespace = appNamespaceService.createAppNamespaceInLocal(appNamespace, false);
Assert.assertNotNull(createdAppNamespace);
Assert.assertEquals(appNamespace.getName(), createdAppNamespace.getName());
}
@Test(expected = BadRequestException.class)
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceExistedWithNoAppendnamespacePrefix() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespace.setName("datasource");
appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
appNamespaceService.createAppNamespaceInLocal(appNamespace, false);
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceNotExisted() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespaceService.createAppNamespaceInLocal(appNamespace);
AppNamespace createdAppNamespace = appNamespaceService.findPublicAppNamespace(appNamespace.getName());
Assert.assertNotNull(createdAppNamespace);
Assert.assertEquals(appNamespace.getName(), createdAppNamespace.getName());
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePublicAppNamespaceWithWrongFormatNotExisted() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(true);
appNamespace.setFormat(ConfigFileFormat.YAML.getValue());
appNamespaceService.createAppNamespaceInLocal(appNamespace);
AppNamespace createdAppNamespace = appNamespaceService.findPublicAppNamespace(appNamespace.getName());
Assert.assertNotNull(createdAppNamespace);
Assert.assertEquals(appNamespace.getName(), createdAppNamespace.getName());
Assert.assertEquals(ConfigFileFormat.Properties.getValue(), createdAppNamespace.getFormat());
}
@Test(expected = BadRequestException.class)
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePrivateAppNamespaceExisted() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(false);
appNamespace.setName("datasource");
appNamespace.setAppId("100003173");
appNamespaceService.createAppNamespaceInLocal(appNamespace);
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePrivateAppNamespaceExistedInAnotherAppId() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(false);
appNamespace.setName("datasource");
appNamespace.setAppId("song0711-01");
appNamespaceService.createAppNamespaceInLocal(appNamespace);
AppNamespace createdAppNamespace =
appNamespaceService.findByAppIdAndName(appNamespace.getAppId(), appNamespace.getName());
Assert.assertNotNull(createdAppNamespace);
Assert.assertEquals(appNamespace.getName(), createdAppNamespace.getName());
}
@Test(expected = BadRequestException.class)
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePrivateAppNamespaceExistedInAnotherAppIdAsPublic() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(false);
appNamespace.setName("SCC.song0711-03");
appNamespace.setAppId("100003173");
appNamespace.setFormat(ConfigFileFormat.Properties.getValue());
appNamespaceService.createAppNamespaceInLocal(appNamespace);
}
@Test
@Sql(scripts = "/sql/appnamespaceservice/init-appnamespace.sql", executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD)
@Sql(scripts = "/sql/cleanup.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD)
public void testCreatePrivateAppNamespaceNotExisted() {
AppNamespace appNamespace = assembleBaseAppNamespace();
appNamespace.setPublic(false);
appNamespaceService.createAppNamespaceInLocal(appNamespace);
AppNamespace createdAppNamespace =
appNamespaceService.findByAppIdAndName(appNamespace.getAppId(), appNamespace.getName());
Assert.assertNotNull(createdAppNamespace);
Assert.assertEquals(appNamespace.getName(), createdAppNamespace.getName());
}
private AppNamespace assembleBaseAppNamespace() {
AppNamespace appNamespace = new AppNamespace();
appNamespace.setName("appNamespace");
appNamespace.setAppId("1000");
appNamespace.setFormat(ConfigFileFormat.XML.getValue());
return appNamespace;
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/ReleaseOpenApiServiceTest.java | 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.NamespaceReleaseDTO;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
public class ReleaseOpenApiServiceTest extends AbstractOpenApiServiceTest {
private ReleaseOpenApiService releaseOpenApiService;
private String someAppId;
private String someEnv;
private String someCluster;
private String someNamespace;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
someAppId = "someAppId";
someEnv = "someEnv";
someCluster = "someCluster";
someNamespace = "someNamespace";
StringEntity responseEntity = new StringEntity("{}");
when(someHttpResponse.getEntity()).thenReturn(responseEntity);
releaseOpenApiService = new ReleaseOpenApiService(httpClient, someBaseUrl, gson);
}
@Test
public void testPublishNamespace() throws Exception {
String someReleaseTitle = "someReleaseTitle";
String someReleasedBy = "someReleasedBy";
NamespaceReleaseDTO namespaceReleaseDTO = new NamespaceReleaseDTO();
namespaceReleaseDTO.setReleaseTitle(someReleaseTitle);
namespaceReleaseDTO.setReleasedBy(someReleasedBy);
final ArgumentCaptor<HttpPost> request = ArgumentCaptor.forClass(HttpPost.class);
releaseOpenApiService.publishNamespace(someAppId, someEnv, someCluster, someNamespace, namespaceReleaseDTO);
verify(httpClient, times(1)).execute(request.capture());
HttpPost post = request.getValue();
assertEquals(String
.format("%s/envs/%s/apps/%s/clusters/%s/namespaces/%s/releases", someBaseUrl, someEnv, someAppId, someCluster,
someNamespace), post.getURI().toString());
}
@Test(expected = RuntimeException.class)
public void testPublishNamespaceWithError() throws Exception {
String someReleaseTitle = "someReleaseTitle";
String someReleasedBy = "someReleasedBy";
NamespaceReleaseDTO namespaceReleaseDTO = new NamespaceReleaseDTO();
namespaceReleaseDTO.setReleaseTitle(someReleaseTitle);
namespaceReleaseDTO.setReleasedBy(someReleasedBy);
when(statusLine.getStatusCode()).thenReturn(400);
releaseOpenApiService.publishNamespace(someAppId, someEnv, someCluster, someNamespace, namespaceReleaseDTO);
}
@Test
public void testGetLatestActiveRelease() throws Exception {
final ArgumentCaptor<HttpGet> request = ArgumentCaptor.forClass(HttpGet.class);
releaseOpenApiService.getLatestActiveRelease(someAppId, someEnv, someCluster, someNamespace);
verify(httpClient, times(1)).execute(request.capture());
HttpGet get = request.getValue();
assertEquals(String
.format("%s/envs/%s/apps/%s/clusters/%s/namespaces/%s/releases/latest", someBaseUrl, someEnv, someAppId, someCluster,
someNamespace), get.getURI().toString());
}
@Test(expected = RuntimeException.class)
public void testGetLatestActiveReleaseWithError() throws Exception {
when(statusLine.getStatusCode()).thenReturn(400);
releaseOpenApiService.getLatestActiveRelease(someAppId, someEnv, someCluster, someNamespace);
}
@Test
public void testRollbackRelease() throws Exception {
long someReleaseId = 1L;
String someOperator = "someOperator";
final ArgumentCaptor<HttpPut> request = ArgumentCaptor.forClass(HttpPut.class);
releaseOpenApiService.rollbackRelease(someEnv, someReleaseId, someOperator);
verify(httpClient, times(1)).execute(request.capture());
HttpPut put = request.getValue();
assertEquals(
String.format("%s/envs/%s/releases/%s/rollback?operator=%s", someBaseUrl, someEnv, someReleaseId, someOperator),
put.getURI().toString());
}
@Test(expected = RuntimeException.class)
public void testRollbackReleaseWithError() throws Exception {
long someReleaseId = 1L;
String someOperator = "someOperator";
when(statusLine.getStatusCode()).thenReturn(400);
releaseOpenApiService.rollbackRelease(someEnv, someReleaseId, someOperator);
}
}
| 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.NamespaceReleaseDTO;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.entity.StringEntity;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
public class ReleaseOpenApiServiceTest extends AbstractOpenApiServiceTest {
private ReleaseOpenApiService releaseOpenApiService;
private String someAppId;
private String someEnv;
private String someCluster;
private String someNamespace;
@Override
@Before
public void setUp() throws Exception {
super.setUp();
someAppId = "someAppId";
someEnv = "someEnv";
someCluster = "someCluster";
someNamespace = "someNamespace";
StringEntity responseEntity = new StringEntity("{}");
when(someHttpResponse.getEntity()).thenReturn(responseEntity);
releaseOpenApiService = new ReleaseOpenApiService(httpClient, someBaseUrl, gson);
}
@Test
public void testPublishNamespace() throws Exception {
String someReleaseTitle = "someReleaseTitle";
String someReleasedBy = "someReleasedBy";
NamespaceReleaseDTO namespaceReleaseDTO = new NamespaceReleaseDTO();
namespaceReleaseDTO.setReleaseTitle(someReleaseTitle);
namespaceReleaseDTO.setReleasedBy(someReleasedBy);
final ArgumentCaptor<HttpPost> request = ArgumentCaptor.forClass(HttpPost.class);
releaseOpenApiService.publishNamespace(someAppId, someEnv, someCluster, someNamespace, namespaceReleaseDTO);
verify(httpClient, times(1)).execute(request.capture());
HttpPost post = request.getValue();
assertEquals(String
.format("%s/envs/%s/apps/%s/clusters/%s/namespaces/%s/releases", someBaseUrl, someEnv, someAppId, someCluster,
someNamespace), post.getURI().toString());
}
@Test(expected = RuntimeException.class)
public void testPublishNamespaceWithError() throws Exception {
String someReleaseTitle = "someReleaseTitle";
String someReleasedBy = "someReleasedBy";
NamespaceReleaseDTO namespaceReleaseDTO = new NamespaceReleaseDTO();
namespaceReleaseDTO.setReleaseTitle(someReleaseTitle);
namespaceReleaseDTO.setReleasedBy(someReleasedBy);
when(statusLine.getStatusCode()).thenReturn(400);
releaseOpenApiService.publishNamespace(someAppId, someEnv, someCluster, someNamespace, namespaceReleaseDTO);
}
@Test
public void testGetLatestActiveRelease() throws Exception {
final ArgumentCaptor<HttpGet> request = ArgumentCaptor.forClass(HttpGet.class);
releaseOpenApiService.getLatestActiveRelease(someAppId, someEnv, someCluster, someNamespace);
verify(httpClient, times(1)).execute(request.capture());
HttpGet get = request.getValue();
assertEquals(String
.format("%s/envs/%s/apps/%s/clusters/%s/namespaces/%s/releases/latest", someBaseUrl, someEnv, someAppId, someCluster,
someNamespace), get.getURI().toString());
}
@Test(expected = RuntimeException.class)
public void testGetLatestActiveReleaseWithError() throws Exception {
when(statusLine.getStatusCode()).thenReturn(400);
releaseOpenApiService.getLatestActiveRelease(someAppId, someEnv, someCluster, someNamespace);
}
@Test
public void testRollbackRelease() throws Exception {
long someReleaseId = 1L;
String someOperator = "someOperator";
final ArgumentCaptor<HttpPut> request = ArgumentCaptor.forClass(HttpPut.class);
releaseOpenApiService.rollbackRelease(someEnv, someReleaseId, someOperator);
verify(httpClient, times(1)).execute(request.capture());
HttpPut put = request.getValue();
assertEquals(
String.format("%s/envs/%s/releases/%s/rollback?operator=%s", someBaseUrl, someEnv, someReleaseId, someOperator),
put.getURI().toString());
}
@Test(expected = RuntimeException.class)
public void testRollbackReleaseWithError() throws Exception {
long someReleaseId = 1L;
String someOperator = "someOperator";
when(statusLine.getStatusCode()).thenReturn(400);
releaseOpenApiService.rollbackRelease(someEnv, someReleaseId, someOperator);
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/openapi/entity/ConsumerRole.java | package com.ctrip.framework.apollo.openapi.entity;
import com.ctrip.framework.apollo.common.entity.BaseEntity;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* @author Jason Song([email protected])
*/
@Entity
@Table(name = "ConsumerRole")
@SQLDelete(sql = "Update ConsumerRole set isDeleted = 1 where id = ?")
@Where(clause = "isDeleted = 0")
public class ConsumerRole extends BaseEntity {
@Column(name = "ConsumerId", nullable = false)
private long consumerId;
@Column(name = "RoleId", nullable = false)
private long roleId;
public long getConsumerId() {
return consumerId;
}
public void setConsumerId(long consumerId) {
this.consumerId = consumerId;
}
public long getRoleId() {
return roleId;
}
public void setRoleId(long roleId) {
this.roleId = roleId;
}
@Override
public String toString() {
return toStringHelper().add("consumerId", consumerId).add("roleId", roleId).toString();
}
}
| package com.ctrip.framework.apollo.openapi.entity;
import com.ctrip.framework.apollo.common.entity.BaseEntity;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* @author Jason Song([email protected])
*/
@Entity
@Table(name = "ConsumerRole")
@SQLDelete(sql = "Update ConsumerRole set isDeleted = 1 where id = ?")
@Where(clause = "isDeleted = 0")
public class ConsumerRole extends BaseEntity {
@Column(name = "ConsumerId", nullable = false)
private long consumerId;
@Column(name = "RoleId", nullable = false)
private long roleId;
public long getConsumerId() {
return consumerId;
}
public void setConsumerId(long consumerId) {
this.consumerId = consumerId;
}
public long getRoleId() {
return roleId;
}
public void setRoleId(long roleId) {
this.roleId = roleId;
}
@Override
public String toString() {
return toStringHelper().add("consumerId", consumerId).add("roleId", roleId).toString();
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/spi/configuration/LdapMappingProperties.java |
package com.ctrip.framework.apollo.portal.spi.configuration;
/**
* the LdapMappingProperties description.
*
* @author wuzishu
*/
public class LdapMappingProperties {
/**
* user ldap objectClass
*/
private String objectClass;
/**
* user login Id
*/
private String loginId;
/**
* user rdn key
*/
private String rdnKey;
/**
* user display name
*/
private String userDisplayName;
/**
* email
*/
private String email;
public String getObjectClass() {
return objectClass;
}
public void setObjectClass(String objectClass) {
this.objectClass = objectClass;
}
public String getLoginId() {
return loginId;
}
public void setLoginId(String loginId) {
this.loginId = loginId;
}
public String getRdnKey() {
return rdnKey;
}
public void setRdnKey(String rdnKey) {
this.rdnKey = rdnKey;
}
public String getUserDisplayName() {
return userDisplayName;
}
public void setUserDisplayName(String userDisplayName) {
this.userDisplayName = userDisplayName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
|
package com.ctrip.framework.apollo.portal.spi.configuration;
/**
* the LdapMappingProperties description.
*
* @author wuzishu
*/
public class LdapMappingProperties {
/**
* user ldap objectClass
*/
private String objectClass;
/**
* user login Id
*/
private String loginId;
/**
* user rdn key
*/
private String rdnKey;
/**
* user display name
*/
private String userDisplayName;
/**
* email
*/
private String email;
public String getObjectClass() {
return objectClass;
}
public void setObjectClass(String objectClass) {
this.objectClass = objectClass;
}
public String getLoginId() {
return loginId;
}
public void setLoginId(String loginId) {
this.loginId = loginId;
}
public String getRdnKey() {
return rdnKey;
}
public void setRdnKey(String rdnKey) {
this.rdnKey = rdnKey;
}
public String getUserDisplayName() {
return userDisplayName;
}
public void setUserDisplayName(String userDisplayName) {
this.userDisplayName = userDisplayName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/dto/CommitDTO.java | package com.ctrip.framework.apollo.common.dto;
public class CommitDTO extends BaseDTO{
private String changeSets;
private String appId;
private String clusterName;
private String namespaceName;
private String comment;
public String getChangeSets() {
return changeSets;
}
public void setChangeSets(String changeSets) {
this.changeSets = changeSets;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public String getNamespaceName() {
return namespaceName;
}
public void setNamespaceName(String namespaceName) {
this.namespaceName = namespaceName;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
}
| package com.ctrip.framework.apollo.common.dto;
public class CommitDTO extends BaseDTO{
private String changeSets;
private String appId;
private String clusterName;
private String namespaceName;
private String comment;
public String getChangeSets() {
return changeSets;
}
public void setChangeSets(String changeSets) {
this.changeSets = changeSets;
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public String getNamespaceName() {
return namespaceName;
}
public void setNamespaceName(String namespaceName) {
this.namespaceName = namespaceName;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/message/DatabaseMessageSenderTest.java | package com.ctrip.framework.apollo.biz.message;
import com.ctrip.framework.apollo.biz.AbstractUnitTest;
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;
/**
* @author Jason Song([email protected])
*/
public class DatabaseMessageSenderTest extends AbstractUnitTest{
private DatabaseMessageSender messageSender;
@Mock
private ReleaseMessageRepository releaseMessageRepository;
@Before
public void setUp() throws Exception {
messageSender = new DatabaseMessageSender(releaseMessageRepository);
}
@Test
public void testSendMessage() throws Exception {
String someMessage = "some-message";
long someId = 1;
ReleaseMessage someReleaseMessage = mock(ReleaseMessage.class);
when(someReleaseMessage.getId()).thenReturn(someId);
when(releaseMessageRepository.save(any(ReleaseMessage.class))).thenReturn(someReleaseMessage);
ArgumentCaptor<ReleaseMessage> captor = ArgumentCaptor.forClass(ReleaseMessage.class);
messageSender.sendMessage(someMessage, Topics.APOLLO_RELEASE_TOPIC);
verify(releaseMessageRepository, times(1)).save(captor.capture());
assertEquals(someMessage, captor.getValue().getMessage());
}
@Test
public void testSendUnsupportedMessage() throws Exception {
String someMessage = "some-message";
String someUnsupportedTopic = "some-invalid-topic";
messageSender.sendMessage(someMessage, someUnsupportedTopic);
verify(releaseMessageRepository, never()).save(any(ReleaseMessage.class));
}
@Test(expected = RuntimeException.class)
public void testSendMessageFailed() throws Exception {
String someMessage = "some-message";
when(releaseMessageRepository.save(any(ReleaseMessage.class))).thenThrow(new RuntimeException());
messageSender.sendMessage(someMessage, Topics.APOLLO_RELEASE_TOPIC);
}
}
| package com.ctrip.framework.apollo.biz.message;
import com.ctrip.framework.apollo.biz.AbstractUnitTest;
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;
/**
* @author Jason Song([email protected])
*/
public class DatabaseMessageSenderTest extends AbstractUnitTest{
private DatabaseMessageSender messageSender;
@Mock
private ReleaseMessageRepository releaseMessageRepository;
@Before
public void setUp() throws Exception {
messageSender = new DatabaseMessageSender(releaseMessageRepository);
}
@Test
public void testSendMessage() throws Exception {
String someMessage = "some-message";
long someId = 1;
ReleaseMessage someReleaseMessage = mock(ReleaseMessage.class);
when(someReleaseMessage.getId()).thenReturn(someId);
when(releaseMessageRepository.save(any(ReleaseMessage.class))).thenReturn(someReleaseMessage);
ArgumentCaptor<ReleaseMessage> captor = ArgumentCaptor.forClass(ReleaseMessage.class);
messageSender.sendMessage(someMessage, Topics.APOLLO_RELEASE_TOPIC);
verify(releaseMessageRepository, times(1)).save(captor.capture());
assertEquals(someMessage, captor.getValue().getMessage());
}
@Test
public void testSendUnsupportedMessage() throws Exception {
String someMessage = "some-message";
String someUnsupportedTopic = "some-invalid-topic";
messageSender.sendMessage(someMessage, someUnsupportedTopic);
verify(releaseMessageRepository, never()).save(any(ReleaseMessage.class));
}
@Test(expected = RuntimeException.class)
public void testSendMessageFailed() throws Exception {
String someMessage = "some-message";
when(releaseMessageRepository.save(any(ReleaseMessage.class))).thenThrow(new RuntimeException());
messageSender.sendMessage(someMessage, Topics.APOLLO_RELEASE_TOPIC);
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/spi/ctrip/WebContextConfiguration.java | package com.ctrip.framework.apollo.portal.spi.ctrip;
import com.ctrip.framework.apollo.portal.component.config.PortalConfig;
import com.ctrip.framework.apollo.portal.spi.UserInfoHolder;
import com.ctrip.framework.apollo.portal.spi.ctrip.filters.UserAccessFilter;
import com.google.common.base.Strings;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
@Profile("ctrip")
public class WebContextConfiguration {
private final PortalConfig portalConfig;
private final UserInfoHolder userInfoHolder;
public WebContextConfiguration(final PortalConfig portalConfig, final UserInfoHolder userInfoHolder) {
this.portalConfig = portalConfig;
this.userInfoHolder = userInfoHolder;
}
@Bean
public ServletContextInitializer servletContextInitializer() {
return servletContext -> {
String loggingServerIP = portalConfig.cloggingUrl();
String loggingServerPort = portalConfig.cloggingPort();
String credisServiceUrl = portalConfig.credisServiceUrl();
servletContext.setInitParameter("loggingServerIP",
Strings.isNullOrEmpty(loggingServerIP) ? "" : loggingServerIP);
servletContext.setInitParameter("loggingServerPort",
Strings.isNullOrEmpty(loggingServerPort) ? "" : loggingServerPort);
servletContext.setInitParameter("credisServiceUrl",
Strings.isNullOrEmpty(credisServiceUrl) ? "" : credisServiceUrl);
};
}
@Bean
public FilterRegistrationBean userAccessFilter() {
FilterRegistrationBean filter = new FilterRegistrationBean();
filter.setFilter(new UserAccessFilter(userInfoHolder));
filter.addUrlPatterns("/*");
return filter;
}
}
| package com.ctrip.framework.apollo.portal.spi.ctrip;
import com.ctrip.framework.apollo.portal.component.config.PortalConfig;
import com.ctrip.framework.apollo.portal.spi.UserInfoHolder;
import com.ctrip.framework.apollo.portal.spi.ctrip.filters.UserAccessFilter;
import com.google.common.base.Strings;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
@Profile("ctrip")
public class WebContextConfiguration {
private final PortalConfig portalConfig;
private final UserInfoHolder userInfoHolder;
public WebContextConfiguration(final PortalConfig portalConfig, final UserInfoHolder userInfoHolder) {
this.portalConfig = portalConfig;
this.userInfoHolder = userInfoHolder;
}
@Bean
public ServletContextInitializer servletContextInitializer() {
return servletContext -> {
String loggingServerIP = portalConfig.cloggingUrl();
String loggingServerPort = portalConfig.cloggingPort();
String credisServiceUrl = portalConfig.credisServiceUrl();
servletContext.setInitParameter("loggingServerIP",
Strings.isNullOrEmpty(loggingServerIP) ? "" : loggingServerIP);
servletContext.setInitParameter("loggingServerPort",
Strings.isNullOrEmpty(loggingServerPort) ? "" : loggingServerPort);
servletContext.setInitParameter("credisServiceUrl",
Strings.isNullOrEmpty(credisServiceUrl) ? "" : credisServiceUrl);
};
}
@Bean
public FilterRegistrationBean userAccessFilter() {
FilterRegistrationBean filter = new FilterRegistrationBean();
filter.setFilter(new UserAccessFilter(userInfoHolder));
filter.addUrlPatterns("/*");
return filter;
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/main/java/com/ctrip/framework/apollo/biz/service/NamespaceService.java | package com.ctrip.framework.apollo.biz.service;
import com.ctrip.framework.apollo.biz.entity.Audit;
import com.ctrip.framework.apollo.biz.entity.Cluster;
import com.ctrip.framework.apollo.biz.entity.Item;
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.biz.entity.Release;
import com.ctrip.framework.apollo.biz.message.MessageSender;
import com.ctrip.framework.apollo.biz.message.Topics;
import com.ctrip.framework.apollo.biz.repository.NamespaceRepository;
import com.ctrip.framework.apollo.biz.utils.ReleaseMessageKeyGenerator;
import com.ctrip.framework.apollo.common.constants.GsonType;
import com.ctrip.framework.apollo.common.constants.NamespaceBranchStatus;
import com.ctrip.framework.apollo.common.entity.AppNamespace;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.common.exception.ServiceException;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@Service
public class NamespaceService {
private static final Gson GSON = new Gson();
private final NamespaceRepository namespaceRepository;
private final AuditService auditService;
private final AppNamespaceService appNamespaceService;
private final ItemService itemService;
private final CommitService commitService;
private final ReleaseService releaseService;
private final ClusterService clusterService;
private final NamespaceBranchService namespaceBranchService;
private final ReleaseHistoryService releaseHistoryService;
private final NamespaceLockService namespaceLockService;
private final InstanceService instanceService;
private final MessageSender messageSender;
public NamespaceService(
final ReleaseHistoryService releaseHistoryService,
final NamespaceRepository namespaceRepository,
final AuditService auditService,
final @Lazy AppNamespaceService appNamespaceService,
final MessageSender messageSender,
final @Lazy ItemService itemService,
final CommitService commitService,
final @Lazy ReleaseService releaseService,
final @Lazy ClusterService clusterService,
final @Lazy NamespaceBranchService namespaceBranchService,
final NamespaceLockService namespaceLockService,
final InstanceService instanceService) {
this.releaseHistoryService = releaseHistoryService;
this.namespaceRepository = namespaceRepository;
this.auditService = auditService;
this.appNamespaceService = appNamespaceService;
this.messageSender = messageSender;
this.itemService = itemService;
this.commitService = commitService;
this.releaseService = releaseService;
this.clusterService = clusterService;
this.namespaceBranchService = namespaceBranchService;
this.namespaceLockService = namespaceLockService;
this.instanceService = instanceService;
}
public Namespace findOne(Long namespaceId) {
return namespaceRepository.findById(namespaceId).orElse(null);
}
public Namespace findOne(String appId, String clusterName, String namespaceName) {
return namespaceRepository.findByAppIdAndClusterNameAndNamespaceName(appId, clusterName,
namespaceName);
}
public Namespace findPublicNamespaceForAssociatedNamespace(String clusterName, String namespaceName) {
AppNamespace appNamespace = appNamespaceService.findPublicNamespaceByName(namespaceName);
if (appNamespace == null) {
throw new BadRequestException("namespace not exist");
}
String appId = appNamespace.getAppId();
Namespace namespace = findOne(appId, clusterName, namespaceName);
//default cluster's namespace
if (Objects.equals(clusterName, ConfigConsts.CLUSTER_NAME_DEFAULT)) {
return namespace;
}
//custom cluster's namespace not exist.
//return default cluster's namespace
if (namespace == null) {
return findOne(appId, ConfigConsts.CLUSTER_NAME_DEFAULT, namespaceName);
}
//custom cluster's namespace exist and has published.
//return custom cluster's namespace
Release latestActiveRelease = releaseService.findLatestActiveRelease(namespace);
if (latestActiveRelease != null) {
return namespace;
}
Namespace defaultNamespace = findOne(appId, ConfigConsts.CLUSTER_NAME_DEFAULT, namespaceName);
//custom cluster's namespace exist but never published.
//and default cluster's namespace not exist.
//return custom cluster's namespace
if (defaultNamespace == null) {
return namespace;
}
//custom cluster's namespace exist but never published.
//and default cluster's namespace exist and has published.
//return default cluster's namespace
Release defaultNamespaceLatestActiveRelease = releaseService.findLatestActiveRelease(defaultNamespace);
if (defaultNamespaceLatestActiveRelease != null) {
return defaultNamespace;
}
//custom cluster's namespace exist but never published.
//and default cluster's namespace exist but never published.
//return custom cluster's namespace
return namespace;
}
public List<Namespace> findPublicAppNamespaceAllNamespaces(String namespaceName, Pageable page) {
AppNamespace publicAppNamespace = appNamespaceService.findPublicNamespaceByName(namespaceName);
if (publicAppNamespace == null) {
throw new BadRequestException(
String.format("Public appNamespace not exists. NamespaceName = %s", namespaceName));
}
List<Namespace> namespaces = namespaceRepository.findByNamespaceName(namespaceName, page);
return filterChildNamespace(namespaces);
}
private List<Namespace> filterChildNamespace(List<Namespace> namespaces) {
List<Namespace> result = new LinkedList<>();
if (CollectionUtils.isEmpty(namespaces)) {
return result;
}
for (Namespace namespace : namespaces) {
if (!isChildNamespace(namespace)) {
result.add(namespace);
}
}
return result;
}
public int countPublicAppNamespaceAssociatedNamespaces(String publicNamespaceName) {
AppNamespace publicAppNamespace = appNamespaceService.findPublicNamespaceByName(publicNamespaceName);
if (publicAppNamespace == null) {
throw new BadRequestException(
String.format("Public appNamespace not exists. NamespaceName = %s", publicNamespaceName));
}
return namespaceRepository.countByNamespaceNameAndAppIdNot(publicNamespaceName, publicAppNamespace.getAppId());
}
public List<Namespace> findNamespaces(String appId, String clusterName) {
List<Namespace> namespaces = namespaceRepository.findByAppIdAndClusterNameOrderByIdAsc(appId, clusterName);
if (namespaces == null) {
return Collections.emptyList();
}
return namespaces;
}
public List<Namespace> findByAppIdAndNamespaceName(String appId, String namespaceName) {
return namespaceRepository.findByAppIdAndNamespaceNameOrderByIdAsc(appId, namespaceName);
}
public Namespace findChildNamespace(String appId, String parentClusterName, String namespaceName) {
List<Namespace> namespaces = findByAppIdAndNamespaceName(appId, namespaceName);
if (CollectionUtils.isEmpty(namespaces) || namespaces.size() == 1) {
return null;
}
List<Cluster> childClusters = clusterService.findChildClusters(appId, parentClusterName);
if (CollectionUtils.isEmpty(childClusters)) {
return null;
}
Set<String> childClusterNames = childClusters.stream().map(Cluster::getName).collect(Collectors.toSet());
//the child namespace is the intersection of the child clusters and child namespaces
for (Namespace namespace : namespaces) {
if (childClusterNames.contains(namespace.getClusterName())) {
return namespace;
}
}
return null;
}
public Namespace findChildNamespace(Namespace parentNamespace) {
String appId = parentNamespace.getAppId();
String parentClusterName = parentNamespace.getClusterName();
String namespaceName = parentNamespace.getNamespaceName();
return findChildNamespace(appId, parentClusterName, namespaceName);
}
public Namespace findParentNamespace(String appId, String clusterName, String namespaceName) {
return findParentNamespace(new Namespace(appId, clusterName, namespaceName));
}
public Namespace findParentNamespace(Namespace namespace) {
String appId = namespace.getAppId();
String namespaceName = namespace.getNamespaceName();
Cluster cluster = clusterService.findOne(appId, namespace.getClusterName());
if (cluster != null && cluster.getParentClusterId() > 0) {
Cluster parentCluster = clusterService.findOne(cluster.getParentClusterId());
return findOne(appId, parentCluster.getName(), namespaceName);
}
return null;
}
public boolean isChildNamespace(String appId, String clusterName, String namespaceName) {
return isChildNamespace(new Namespace(appId, clusterName, namespaceName));
}
public boolean isChildNamespace(Namespace namespace) {
return findParentNamespace(namespace) != null;
}
public boolean isNamespaceUnique(String appId, String cluster, String namespace) {
Objects.requireNonNull(appId, "AppId must not be null");
Objects.requireNonNull(cluster, "Cluster must not be null");
Objects.requireNonNull(namespace, "Namespace must not be null");
return Objects.isNull(
namespaceRepository.findByAppIdAndClusterNameAndNamespaceName(appId, cluster, namespace));
}
@Transactional
public void deleteByAppIdAndClusterName(String appId, String clusterName, String operator) {
List<Namespace> toDeleteNamespaces = findNamespaces(appId, clusterName);
for (Namespace namespace : toDeleteNamespaces) {
deleteNamespace(namespace, operator);
}
}
@Transactional
public Namespace deleteNamespace(Namespace namespace, String operator) {
String appId = namespace.getAppId();
String clusterName = namespace.getClusterName();
String namespaceName = namespace.getNamespaceName();
itemService.batchDelete(namespace.getId(), operator);
commitService.batchDelete(appId, clusterName, namespace.getNamespaceName(), operator);
// Child namespace releases should retain as long as the parent namespace exists, because parent namespaces' release
// histories need them
if (!isChildNamespace(namespace)) {
releaseService.batchDelete(appId, clusterName, namespace.getNamespaceName(), operator);
}
//delete child namespace
Namespace childNamespace = findChildNamespace(namespace);
if (childNamespace != null) {
namespaceBranchService.deleteBranch(appId, clusterName, namespaceName,
childNamespace.getClusterName(), NamespaceBranchStatus.DELETED, operator);
//delete child namespace's releases. Notice: delete child namespace will not delete child namespace's releases
releaseService.batchDelete(appId, childNamespace.getClusterName(), namespaceName, operator);
}
releaseHistoryService.batchDelete(appId, clusterName, namespaceName, operator);
instanceService.batchDeleteInstanceConfig(appId, clusterName, namespaceName);
namespaceLockService.unlock(namespace.getId());
namespace.setDeleted(true);
namespace.setDataChangeLastModifiedBy(operator);
auditService.audit(Namespace.class.getSimpleName(), namespace.getId(), Audit.OP.DELETE, operator);
Namespace deleted = namespaceRepository.save(namespace);
//Publish release message to do some clean up in config service, such as updating the cache
messageSender.sendMessage(ReleaseMessageKeyGenerator.generate(appId, clusterName, namespaceName),
Topics.APOLLO_RELEASE_TOPIC);
return deleted;
}
@Transactional
public Namespace save(Namespace entity) {
if (!isNamespaceUnique(entity.getAppId(), entity.getClusterName(), entity.getNamespaceName())) {
throw new ServiceException("namespace not unique");
}
entity.setId(0);//protection
Namespace namespace = namespaceRepository.save(entity);
auditService.audit(Namespace.class.getSimpleName(), namespace.getId(), Audit.OP.INSERT,
namespace.getDataChangeCreatedBy());
return namespace;
}
@Transactional
public Namespace update(Namespace namespace) {
Namespace managedNamespace = namespaceRepository.findByAppIdAndClusterNameAndNamespaceName(
namespace.getAppId(), namespace.getClusterName(), namespace.getNamespaceName());
BeanUtils.copyEntityProperties(namespace, managedNamespace);
managedNamespace = namespaceRepository.save(managedNamespace);
auditService.audit(Namespace.class.getSimpleName(), managedNamespace.getId(), Audit.OP.UPDATE,
managedNamespace.getDataChangeLastModifiedBy());
return managedNamespace;
}
@Transactional
public void instanceOfAppNamespaces(String appId, String clusterName, String createBy) {
List<AppNamespace> appNamespaces = appNamespaceService.findByAppId(appId);
for (AppNamespace appNamespace : appNamespaces) {
Namespace ns = new Namespace();
ns.setAppId(appId);
ns.setClusterName(clusterName);
ns.setNamespaceName(appNamespace.getName());
ns.setDataChangeCreatedBy(createBy);
ns.setDataChangeLastModifiedBy(createBy);
namespaceRepository.save(ns);
auditService.audit(Namespace.class.getSimpleName(), ns.getId(), Audit.OP.INSERT, createBy);
}
}
public Map<String, Boolean> namespacePublishInfo(String appId) {
List<Cluster> clusters = clusterService.findParentClusters(appId);
if (CollectionUtils.isEmpty(clusters)) {
throw new BadRequestException("app not exist");
}
Map<String, Boolean> clusterHasNotPublishedItems = Maps.newHashMap();
for (Cluster cluster : clusters) {
String clusterName = cluster.getName();
List<Namespace> namespaces = findNamespaces(appId, clusterName);
for (Namespace namespace : namespaces) {
boolean isNamespaceNotPublished = isNamespaceNotPublished(namespace);
if (isNamespaceNotPublished) {
clusterHasNotPublishedItems.put(clusterName, true);
break;
}
}
clusterHasNotPublishedItems.putIfAbsent(clusterName, false);
}
return clusterHasNotPublishedItems;
}
private boolean isNamespaceNotPublished(Namespace namespace) {
Release latestRelease = releaseService.findLatestActiveRelease(namespace);
long namespaceId = namespace.getId();
if (latestRelease == null) {
Item lastItem = itemService.findLastOne(namespaceId);
return lastItem != null;
}
Date lastPublishTime = latestRelease.getDataChangeLastModifiedTime();
List<Item> itemsModifiedAfterLastPublish = itemService.findItemsModifiedAfterDate(namespaceId, lastPublishTime);
if (CollectionUtils.isEmpty(itemsModifiedAfterLastPublish)) {
return false;
}
Map<String, String> publishedConfiguration = GSON.fromJson(latestRelease.getConfigurations(), GsonType.CONFIG);
for (Item item : itemsModifiedAfterLastPublish) {
if (!Objects.equals(item.getValue(), publishedConfiguration.get(item.getKey()))) {
return true;
}
}
return false;
}
}
| package com.ctrip.framework.apollo.biz.service;
import com.ctrip.framework.apollo.biz.entity.Audit;
import com.ctrip.framework.apollo.biz.entity.Cluster;
import com.ctrip.framework.apollo.biz.entity.Item;
import com.ctrip.framework.apollo.biz.entity.Namespace;
import com.ctrip.framework.apollo.biz.entity.Release;
import com.ctrip.framework.apollo.biz.message.MessageSender;
import com.ctrip.framework.apollo.biz.message.Topics;
import com.ctrip.framework.apollo.biz.repository.NamespaceRepository;
import com.ctrip.framework.apollo.biz.utils.ReleaseMessageKeyGenerator;
import com.ctrip.framework.apollo.common.constants.GsonType;
import com.ctrip.framework.apollo.common.constants.NamespaceBranchStatus;
import com.ctrip.framework.apollo.common.entity.AppNamespace;
import com.ctrip.framework.apollo.common.exception.BadRequestException;
import com.ctrip.framework.apollo.common.exception.ServiceException;
import com.ctrip.framework.apollo.common.utils.BeanUtils;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.google.common.collect.Maps;
import com.google.gson.Gson;
import org.springframework.context.annotation.Lazy;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
@Service
public class NamespaceService {
private static final Gson GSON = new Gson();
private final NamespaceRepository namespaceRepository;
private final AuditService auditService;
private final AppNamespaceService appNamespaceService;
private final ItemService itemService;
private final CommitService commitService;
private final ReleaseService releaseService;
private final ClusterService clusterService;
private final NamespaceBranchService namespaceBranchService;
private final ReleaseHistoryService releaseHistoryService;
private final NamespaceLockService namespaceLockService;
private final InstanceService instanceService;
private final MessageSender messageSender;
public NamespaceService(
final ReleaseHistoryService releaseHistoryService,
final NamespaceRepository namespaceRepository,
final AuditService auditService,
final @Lazy AppNamespaceService appNamespaceService,
final MessageSender messageSender,
final @Lazy ItemService itemService,
final CommitService commitService,
final @Lazy ReleaseService releaseService,
final @Lazy ClusterService clusterService,
final @Lazy NamespaceBranchService namespaceBranchService,
final NamespaceLockService namespaceLockService,
final InstanceService instanceService) {
this.releaseHistoryService = releaseHistoryService;
this.namespaceRepository = namespaceRepository;
this.auditService = auditService;
this.appNamespaceService = appNamespaceService;
this.messageSender = messageSender;
this.itemService = itemService;
this.commitService = commitService;
this.releaseService = releaseService;
this.clusterService = clusterService;
this.namespaceBranchService = namespaceBranchService;
this.namespaceLockService = namespaceLockService;
this.instanceService = instanceService;
}
public Namespace findOne(Long namespaceId) {
return namespaceRepository.findById(namespaceId).orElse(null);
}
public Namespace findOne(String appId, String clusterName, String namespaceName) {
return namespaceRepository.findByAppIdAndClusterNameAndNamespaceName(appId, clusterName,
namespaceName);
}
public Namespace findPublicNamespaceForAssociatedNamespace(String clusterName, String namespaceName) {
AppNamespace appNamespace = appNamespaceService.findPublicNamespaceByName(namespaceName);
if (appNamespace == null) {
throw new BadRequestException("namespace not exist");
}
String appId = appNamespace.getAppId();
Namespace namespace = findOne(appId, clusterName, namespaceName);
//default cluster's namespace
if (Objects.equals(clusterName, ConfigConsts.CLUSTER_NAME_DEFAULT)) {
return namespace;
}
//custom cluster's namespace not exist.
//return default cluster's namespace
if (namespace == null) {
return findOne(appId, ConfigConsts.CLUSTER_NAME_DEFAULT, namespaceName);
}
//custom cluster's namespace exist and has published.
//return custom cluster's namespace
Release latestActiveRelease = releaseService.findLatestActiveRelease(namespace);
if (latestActiveRelease != null) {
return namespace;
}
Namespace defaultNamespace = findOne(appId, ConfigConsts.CLUSTER_NAME_DEFAULT, namespaceName);
//custom cluster's namespace exist but never published.
//and default cluster's namespace not exist.
//return custom cluster's namespace
if (defaultNamespace == null) {
return namespace;
}
//custom cluster's namespace exist but never published.
//and default cluster's namespace exist and has published.
//return default cluster's namespace
Release defaultNamespaceLatestActiveRelease = releaseService.findLatestActiveRelease(defaultNamespace);
if (defaultNamespaceLatestActiveRelease != null) {
return defaultNamespace;
}
//custom cluster's namespace exist but never published.
//and default cluster's namespace exist but never published.
//return custom cluster's namespace
return namespace;
}
public List<Namespace> findPublicAppNamespaceAllNamespaces(String namespaceName, Pageable page) {
AppNamespace publicAppNamespace = appNamespaceService.findPublicNamespaceByName(namespaceName);
if (publicAppNamespace == null) {
throw new BadRequestException(
String.format("Public appNamespace not exists. NamespaceName = %s", namespaceName));
}
List<Namespace> namespaces = namespaceRepository.findByNamespaceName(namespaceName, page);
return filterChildNamespace(namespaces);
}
private List<Namespace> filterChildNamespace(List<Namespace> namespaces) {
List<Namespace> result = new LinkedList<>();
if (CollectionUtils.isEmpty(namespaces)) {
return result;
}
for (Namespace namespace : namespaces) {
if (!isChildNamespace(namespace)) {
result.add(namespace);
}
}
return result;
}
public int countPublicAppNamespaceAssociatedNamespaces(String publicNamespaceName) {
AppNamespace publicAppNamespace = appNamespaceService.findPublicNamespaceByName(publicNamespaceName);
if (publicAppNamespace == null) {
throw new BadRequestException(
String.format("Public appNamespace not exists. NamespaceName = %s", publicNamespaceName));
}
return namespaceRepository.countByNamespaceNameAndAppIdNot(publicNamespaceName, publicAppNamespace.getAppId());
}
public List<Namespace> findNamespaces(String appId, String clusterName) {
List<Namespace> namespaces = namespaceRepository.findByAppIdAndClusterNameOrderByIdAsc(appId, clusterName);
if (namespaces == null) {
return Collections.emptyList();
}
return namespaces;
}
public List<Namespace> findByAppIdAndNamespaceName(String appId, String namespaceName) {
return namespaceRepository.findByAppIdAndNamespaceNameOrderByIdAsc(appId, namespaceName);
}
public Namespace findChildNamespace(String appId, String parentClusterName, String namespaceName) {
List<Namespace> namespaces = findByAppIdAndNamespaceName(appId, namespaceName);
if (CollectionUtils.isEmpty(namespaces) || namespaces.size() == 1) {
return null;
}
List<Cluster> childClusters = clusterService.findChildClusters(appId, parentClusterName);
if (CollectionUtils.isEmpty(childClusters)) {
return null;
}
Set<String> childClusterNames = childClusters.stream().map(Cluster::getName).collect(Collectors.toSet());
//the child namespace is the intersection of the child clusters and child namespaces
for (Namespace namespace : namespaces) {
if (childClusterNames.contains(namespace.getClusterName())) {
return namespace;
}
}
return null;
}
public Namespace findChildNamespace(Namespace parentNamespace) {
String appId = parentNamespace.getAppId();
String parentClusterName = parentNamespace.getClusterName();
String namespaceName = parentNamespace.getNamespaceName();
return findChildNamespace(appId, parentClusterName, namespaceName);
}
public Namespace findParentNamespace(String appId, String clusterName, String namespaceName) {
return findParentNamespace(new Namespace(appId, clusterName, namespaceName));
}
public Namespace findParentNamespace(Namespace namespace) {
String appId = namespace.getAppId();
String namespaceName = namespace.getNamespaceName();
Cluster cluster = clusterService.findOne(appId, namespace.getClusterName());
if (cluster != null && cluster.getParentClusterId() > 0) {
Cluster parentCluster = clusterService.findOne(cluster.getParentClusterId());
return findOne(appId, parentCluster.getName(), namespaceName);
}
return null;
}
public boolean isChildNamespace(String appId, String clusterName, String namespaceName) {
return isChildNamespace(new Namespace(appId, clusterName, namespaceName));
}
public boolean isChildNamespace(Namespace namespace) {
return findParentNamespace(namespace) != null;
}
public boolean isNamespaceUnique(String appId, String cluster, String namespace) {
Objects.requireNonNull(appId, "AppId must not be null");
Objects.requireNonNull(cluster, "Cluster must not be null");
Objects.requireNonNull(namespace, "Namespace must not be null");
return Objects.isNull(
namespaceRepository.findByAppIdAndClusterNameAndNamespaceName(appId, cluster, namespace));
}
@Transactional
public void deleteByAppIdAndClusterName(String appId, String clusterName, String operator) {
List<Namespace> toDeleteNamespaces = findNamespaces(appId, clusterName);
for (Namespace namespace : toDeleteNamespaces) {
deleteNamespace(namespace, operator);
}
}
@Transactional
public Namespace deleteNamespace(Namespace namespace, String operator) {
String appId = namespace.getAppId();
String clusterName = namespace.getClusterName();
String namespaceName = namespace.getNamespaceName();
itemService.batchDelete(namespace.getId(), operator);
commitService.batchDelete(appId, clusterName, namespace.getNamespaceName(), operator);
// Child namespace releases should retain as long as the parent namespace exists, because parent namespaces' release
// histories need them
if (!isChildNamespace(namespace)) {
releaseService.batchDelete(appId, clusterName, namespace.getNamespaceName(), operator);
}
//delete child namespace
Namespace childNamespace = findChildNamespace(namespace);
if (childNamespace != null) {
namespaceBranchService.deleteBranch(appId, clusterName, namespaceName,
childNamespace.getClusterName(), NamespaceBranchStatus.DELETED, operator);
//delete child namespace's releases. Notice: delete child namespace will not delete child namespace's releases
releaseService.batchDelete(appId, childNamespace.getClusterName(), namespaceName, operator);
}
releaseHistoryService.batchDelete(appId, clusterName, namespaceName, operator);
instanceService.batchDeleteInstanceConfig(appId, clusterName, namespaceName);
namespaceLockService.unlock(namespace.getId());
namespace.setDeleted(true);
namespace.setDataChangeLastModifiedBy(operator);
auditService.audit(Namespace.class.getSimpleName(), namespace.getId(), Audit.OP.DELETE, operator);
Namespace deleted = namespaceRepository.save(namespace);
//Publish release message to do some clean up in config service, such as updating the cache
messageSender.sendMessage(ReleaseMessageKeyGenerator.generate(appId, clusterName, namespaceName),
Topics.APOLLO_RELEASE_TOPIC);
return deleted;
}
@Transactional
public Namespace save(Namespace entity) {
if (!isNamespaceUnique(entity.getAppId(), entity.getClusterName(), entity.getNamespaceName())) {
throw new ServiceException("namespace not unique");
}
entity.setId(0);//protection
Namespace namespace = namespaceRepository.save(entity);
auditService.audit(Namespace.class.getSimpleName(), namespace.getId(), Audit.OP.INSERT,
namespace.getDataChangeCreatedBy());
return namespace;
}
@Transactional
public Namespace update(Namespace namespace) {
Namespace managedNamespace = namespaceRepository.findByAppIdAndClusterNameAndNamespaceName(
namespace.getAppId(), namespace.getClusterName(), namespace.getNamespaceName());
BeanUtils.copyEntityProperties(namespace, managedNamespace);
managedNamespace = namespaceRepository.save(managedNamespace);
auditService.audit(Namespace.class.getSimpleName(), managedNamespace.getId(), Audit.OP.UPDATE,
managedNamespace.getDataChangeLastModifiedBy());
return managedNamespace;
}
@Transactional
public void instanceOfAppNamespaces(String appId, String clusterName, String createBy) {
List<AppNamespace> appNamespaces = appNamespaceService.findByAppId(appId);
for (AppNamespace appNamespace : appNamespaces) {
Namespace ns = new Namespace();
ns.setAppId(appId);
ns.setClusterName(clusterName);
ns.setNamespaceName(appNamespace.getName());
ns.setDataChangeCreatedBy(createBy);
ns.setDataChangeLastModifiedBy(createBy);
namespaceRepository.save(ns);
auditService.audit(Namespace.class.getSimpleName(), ns.getId(), Audit.OP.INSERT, createBy);
}
}
public Map<String, Boolean> namespacePublishInfo(String appId) {
List<Cluster> clusters = clusterService.findParentClusters(appId);
if (CollectionUtils.isEmpty(clusters)) {
throw new BadRequestException("app not exist");
}
Map<String, Boolean> clusterHasNotPublishedItems = Maps.newHashMap();
for (Cluster cluster : clusters) {
String clusterName = cluster.getName();
List<Namespace> namespaces = findNamespaces(appId, clusterName);
for (Namespace namespace : namespaces) {
boolean isNamespaceNotPublished = isNamespaceNotPublished(namespace);
if (isNamespaceNotPublished) {
clusterHasNotPublishedItems.put(clusterName, true);
break;
}
}
clusterHasNotPublishedItems.putIfAbsent(clusterName, false);
}
return clusterHasNotPublishedItems;
}
private boolean isNamespaceNotPublished(Namespace namespace) {
Release latestRelease = releaseService.findLatestActiveRelease(namespace);
long namespaceId = namespace.getId();
if (latestRelease == null) {
Item lastItem = itemService.findLastOne(namespaceId);
return lastItem != null;
}
Date lastPublishTime = latestRelease.getDataChangeLastModifiedTime();
List<Item> itemsModifiedAfterLastPublish = itemService.findItemsModifiedAfterDate(namespaceId, lastPublishTime);
if (CollectionUtils.isEmpty(itemsModifiedAfterLastPublish)) {
return false;
}
Map<String, String> publishedConfiguration = GSON.fromJson(latestRelease.getConfigurations(), GsonType.CONFIG);
for (Item item : itemsModifiedAfterLastPublish) {
if (!Objects.equals(item.getValue(), publishedConfiguration.get(item.getKey()))) {
return true;
}
}
return false;
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/main/java/com/ctrip/framework/apollo/core/signature/Signature.java | package com.ctrip.framework.apollo.core.signature;
import com.google.common.collect.Maps;
import com.google.common.net.HttpHeaders;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
/**
* @author nisiyong
*/
public class Signature {
/**
* Authorization=Apollo {appId}:{sign}
*/
private static final String AUTHORIZATION_FORMAT = "Apollo %s:%s";
private static final String DELIMITER = "\n";
public static final String HTTP_HEADER_TIMESTAMP = "Timestamp";
public static String signature(String timestamp, String pathWithQuery, String secret) {
String stringToSign = timestamp + DELIMITER + pathWithQuery;
return HmacSha1Utils.signString(stringToSign, secret);
}
public static Map<String, String> buildHttpHeaders(String url, String appId, String secret) {
long currentTimeMillis = System.currentTimeMillis();
String timestamp = String.valueOf(currentTimeMillis);
String pathWithQuery = url2PathWithQuery(url);
String signature = signature(timestamp, pathWithQuery, secret);
Map<String, String> headers = Maps.newHashMap();
headers.put(HttpHeaders.AUTHORIZATION, String.format(AUTHORIZATION_FORMAT, appId, signature));
headers.put(HTTP_HEADER_TIMESTAMP, timestamp);
return headers;
}
private static String url2PathWithQuery(String urlString) {
try {
URL url = new URL(urlString);
String path = url.getPath();
String query = url.getQuery();
String pathWithQuery = path;
if (query != null && query.length() > 0) {
pathWithQuery += "?" + query;
}
return pathWithQuery;
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Invalid url pattern: " + urlString, e);
}
}
}
| package com.ctrip.framework.apollo.core.signature;
import com.google.common.collect.Maps;
import com.google.common.net.HttpHeaders;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
/**
* @author nisiyong
*/
public class Signature {
/**
* Authorization=Apollo {appId}:{sign}
*/
private static final String AUTHORIZATION_FORMAT = "Apollo %s:%s";
private static final String DELIMITER = "\n";
public static final String HTTP_HEADER_TIMESTAMP = "Timestamp";
public static String signature(String timestamp, String pathWithQuery, String secret) {
String stringToSign = timestamp + DELIMITER + pathWithQuery;
return HmacSha1Utils.signString(stringToSign, secret);
}
public static Map<String, String> buildHttpHeaders(String url, String appId, String secret) {
long currentTimeMillis = System.currentTimeMillis();
String timestamp = String.valueOf(currentTimeMillis);
String pathWithQuery = url2PathWithQuery(url);
String signature = signature(timestamp, pathWithQuery, secret);
Map<String, String> headers = Maps.newHashMap();
headers.put(HttpHeaders.AUTHORIZATION, String.format(AUTHORIZATION_FORMAT, appId, signature));
headers.put(HTTP_HEADER_TIMESTAMP, timestamp);
return headers;
}
private static String url2PathWithQuery(String urlString) {
try {
URL url = new URL(urlString);
String path = url.getPath();
String query = url.getQuery();
String pathWithQuery = path;
if (query != null && query.length() > 0) {
pathWithQuery += "?" + query;
}
return pathWithQuery;
} catch (MalformedURLException e) {
throw new IllegalArgumentException("Invalid url pattern: " + urlString, e);
}
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/test/resources/yaml/case1.yaml | root:
key1: "someValue"
key2: 100
key3:
key4:
key5: '(%sender%) %message%'
key6: '* %sender% %message%'
# commented: "xxx"
list:
- 'item 1'
- 'item 2'
intList:
- 100
- 200
listOfMap:
- key: '#mychannel'
value: ''
- key: '#myprivatechannel'
value: 'mypassword'
listOfList:
- - 'a1'
- 'a2'
- - 'b1'
- 'b2'
listOfList2: [ ['a1', 'a2'], ['b1', 'b2'] ]
| root:
key1: "someValue"
key2: 100
key3:
key4:
key5: '(%sender%) %message%'
key6: '* %sender% %message%'
# commented: "xxx"
list:
- 'item 1'
- 'item 2'
intList:
- 100
- 200
listOfMap:
- key: '#mychannel'
value: ''
- key: '#myprivatechannel'
value: 'mypassword'
listOfList:
- - 'a1'
- 'a2'
- - 'b1'
- 'b2'
listOfList2: [ ['a1', 'a2'], ['b1', 'b2'] ]
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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-config-server/Dockerfile | # Dockerfile for apollo-config-server
# Build with:
# docker build -t apollo-config-server:v1.0.0 .
FROM openjdk:8-jre-alpine3.8
RUN \
echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories && \
echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories && \
apk update upgrade && \
apk add --no-cache procps curl bash tzdata && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone && \
mkdir -p /apollo-config-server
ADD . /apollo-config-server/
ENV APOLLO_CONFIG_SERVICE_NAME="service-apollo-config-server.sre"
EXPOSE 8080
CMD ["/apollo-config-server/scripts/startup-kubernetes.sh"]
| # Dockerfile for apollo-config-server
# Build with:
# docker build -t apollo-config-server:v1.0.0 .
FROM openjdk:8-jre-alpine3.8
RUN \
echo "http://mirrors.aliyun.com/alpine/v3.8/main" > /etc/apk/repositories && \
echo "http://mirrors.aliyun.com/alpine/v3.8/community" >> /etc/apk/repositories && \
apk update upgrade && \
apk add --no-cache procps curl bash tzdata && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" > /etc/timezone && \
mkdir -p /apollo-config-server
ADD . /apollo-config-server/
ENV APOLLO_CONFIG_SERVICE_NAME="service-apollo-config-server.sre"
EXPOSE 8080
CMD ["/apollo-config-server/scripts/startup-kubernetes.sh"]
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/pom.xml | <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apollo-common</artifactId>
<name>Apollo Common</name>
<properties>
<github.path>${project.artifactId}</github.path>
</properties>
<dependencies>
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- logback dependencies-->
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<!-- Micrometer core dependecy -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
</dependencies>
</project>
| <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo</artifactId>
<version>${revision}</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>apollo-common</artifactId>
<name>Apollo Common</name>
<properties>
<github.path>${project.artifactId}</github.path>
</properties>
<dependencies>
<dependency>
<groupId>com.ctrip.framework.apollo</groupId>
<artifactId>apollo-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- logback dependencies-->
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<!-- Micrometer core dependecy -->
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
</dependencies>
</project>
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/entity/App.java | package com.ctrip.framework.apollo.common.entity;
import com.ctrip.framework.apollo.common.utils.InputValidator;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "App")
@SQLDelete(sql = "Update App set isDeleted = 1 where id = ?")
@Where(clause = "isDeleted = 0")
public class App extends BaseEntity {
@NotBlank(message = "Name cannot be blank")
@Column(name = "Name", nullable = false)
private String name;
@NotBlank(message = "AppId cannot be blank")
@Pattern(
regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR,
message = InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE
)
@Column(name = "AppId", nullable = false)
private String appId;
@Column(name = "OrgId", nullable = false)
private String orgId;
@Column(name = "OrgName", nullable = false)
private String orgName;
@NotBlank(message = "OwnerName cannot be blank")
@Column(name = "OwnerName", nullable = false)
private String ownerName;
@NotBlank(message = "OwnerEmail cannot be blank")
@Column(name = "OwnerEmail", nullable = false)
private String ownerEmail;
public String getAppId() {
return appId;
}
public String getName() {
return name;
}
public String getOrgId() {
return orgId;
}
public String getOrgName() {
return orgName;
}
public String getOwnerEmail() {
return ownerEmail;
}
public String getOwnerName() {
return ownerName;
}
public void setAppId(String appId) {
this.appId = appId;
}
public void setName(String name) {
this.name = name;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public void setOwnerEmail(String ownerEmail) {
this.ownerEmail = ownerEmail;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public String toString() {
return toStringHelper().add("name", name).add("appId", appId)
.add("orgId", orgId)
.add("orgName", orgName)
.add("ownerName", ownerName)
.add("ownerEmail", ownerEmail).toString();
}
public static class Builder {
public Builder() {
}
private App app = new App();
public Builder name(String name) {
app.setName(name);
return this;
}
public Builder appId(String appId) {
app.setAppId(appId);
return this;
}
public Builder orgId(String orgId) {
app.setOrgId(orgId);
return this;
}
public Builder orgName(String orgName) {
app.setOrgName(orgName);
return this;
}
public Builder ownerName(String ownerName) {
app.setOwnerName(ownerName);
return this;
}
public Builder ownerEmail(String ownerEmail) {
app.setOwnerEmail(ownerEmail);
return this;
}
public App build() {
return app;
}
}
public static Builder builder() {
return new Builder();
}
}
| package com.ctrip.framework.apollo.common.entity;
import com.ctrip.framework.apollo.common.utils.InputValidator;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "App")
@SQLDelete(sql = "Update App set isDeleted = 1 where id = ?")
@Where(clause = "isDeleted = 0")
public class App extends BaseEntity {
@NotBlank(message = "Name cannot be blank")
@Column(name = "Name", nullable = false)
private String name;
@NotBlank(message = "AppId cannot be blank")
@Pattern(
regexp = InputValidator.CLUSTER_NAMESPACE_VALIDATOR,
message = InputValidator.INVALID_CLUSTER_NAMESPACE_MESSAGE
)
@Column(name = "AppId", nullable = false)
private String appId;
@Column(name = "OrgId", nullable = false)
private String orgId;
@Column(name = "OrgName", nullable = false)
private String orgName;
@NotBlank(message = "OwnerName cannot be blank")
@Column(name = "OwnerName", nullable = false)
private String ownerName;
@NotBlank(message = "OwnerEmail cannot be blank")
@Column(name = "OwnerEmail", nullable = false)
private String ownerEmail;
public String getAppId() {
return appId;
}
public String getName() {
return name;
}
public String getOrgId() {
return orgId;
}
public String getOrgName() {
return orgName;
}
public String getOwnerEmail() {
return ownerEmail;
}
public String getOwnerName() {
return ownerName;
}
public void setAppId(String appId) {
this.appId = appId;
}
public void setName(String name) {
this.name = name;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public void setOrgName(String orgName) {
this.orgName = orgName;
}
public void setOwnerEmail(String ownerEmail) {
this.ownerEmail = ownerEmail;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public String toString() {
return toStringHelper().add("name", name).add("appId", appId)
.add("orgId", orgId)
.add("orgName", orgName)
.add("ownerName", ownerName)
.add("ownerEmail", ownerEmail).toString();
}
public static class Builder {
public Builder() {
}
private App app = new App();
public Builder name(String name) {
app.setName(name);
return this;
}
public Builder appId(String appId) {
app.setAppId(appId);
return this;
}
public Builder orgId(String orgId) {
app.setOrgId(orgId);
return this;
}
public Builder orgName(String orgName) {
app.setOrgName(orgName);
return this;
}
public Builder ownerName(String ownerName) {
app.setOwnerName(ownerName);
return this;
}
public Builder ownerEmail(String ownerEmail) {
app.setOwnerEmail(ownerEmail);
return this;
}
public App build() {
return app;
}
}
public static Builder builder() {
return new Builder();
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/signature/HmacSha1UtilsTest.java | 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);
}
} | 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,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/java/com/ctrip/framework/apollo/internals/LocalFileConfigRepository.java | 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([email protected])
*/
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);
}
}
| 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([email protected])
*/
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);
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/application-ctrip.yml | ctrip:
appid: 100003173
email:
send:
code: 37030033
template:
id: 37030033
survival:
duration: 5
| ctrip:
appid: 100003173
email:
send:
code: 37030033
template:
id: 37030033
survival:
duration: 5
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/directive/item-modal-directive.js | directive_module.directive('itemmodal', itemModalDirective);
function itemModalDirective($translate, toastr, $sce, AppUtil, EventManager, ConfigService) {
return {
restrict: 'E',
templateUrl: AppUtil.prefixPath() + '/views/component/item-modal.html',
transclude: true,
replace: true,
scope: {
appId: '=',
env: '=',
cluster: '=',
toOperationNamespace: '=',
item: '='
},
link: function (scope) {
var TABLE_VIEW_OPER_TYPE = {
CREATE: 'create',
UPDATE: 'update'
};
scope.doItem = doItem;
scope.collectSelectedClusters = collectSelectedClusters;
scope.showHiddenChars = showHiddenChars;
$('#itemModal').on('show.bs.modal', function (e) {
scope.showHiddenCharsContext = false;
scope.hiddenCharCounter = 0;
scope.valueWithHiddenChars = $sce.trustAsHtml('');
});
$("#valueEditor").textareafullscreen();
function doItem() {
if (!scope.item.value) {
scope.item.value = "";
}
if (scope.item.tableViewOperType == TABLE_VIEW_OPER_TYPE.CREATE) {
//check key unique
var hasRepeatKey = false;
scope.toOperationNamespace.items.forEach(function (item) {
if (!item.isDeleted && scope.item.key == item.item.key) {
toastr.error($translate.instant('ItemModal.KeyExists', { key: scope.item.key }));
hasRepeatKey = true;
}
});
if (hasRepeatKey) {
return;
}
scope.item.addItemBtnDisabled = true;
if (scope.toOperationNamespace.isBranch) {
ConfigService.create_item(scope.appId,
scope.env,
scope.toOperationNamespace.baseInfo.clusterName,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
toastr.success($translate.instant('ItemModal.AddedTips'));
scope.item.addItemBtnDisabled = false;
AppUtil.hideModal('#itemModal');
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.AddFailed'));
scope.item.addItemBtnDisabled = false;
});
} else {
if (selectedClusters.length == 0) {
toastr.error($translate.instant('ItemModal.PleaseChooseCluster'));
scope.item.addItemBtnDisabled = false;
return;
}
selectedClusters.forEach(function (cluster) {
ConfigService.create_item(scope.appId,
cluster.env,
cluster.name,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
scope.item.addItemBtnDisabled = false;
AppUtil.hideModal('#itemModal');
toastr.success(cluster.env + " , " + scope.item.key, $translate.instant('ItemModal.AddedTips'));
if (cluster.env == scope.env &&
cluster.name == scope.cluster) {
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
}
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.AddFailed'));
scope.item.addItemBtnDisabled = false;
});
});
}
} else {
if (!scope.item.comment) {
scope.item.comment = "";
}
ConfigService.update_item(scope.appId,
scope.env,
scope.toOperationNamespace.baseInfo.clusterName,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
AppUtil.hideModal('#itemModal');
toastr.success($translate.instant('ItemModal.ModifiedTips'));
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.ModifyFailed'));
});
}
}
var selectedClusters = [];
function collectSelectedClusters(data) {
selectedClusters = data;
}
function showHiddenChars() {
var value = scope.item.value;
if (!value) {
return;
}
var hiddenCharCounter = 0, valueWithHiddenChars = _.escape(value);
for (var i = 0; i < value.length; i++) {
var c = value[i];
if (isHiddenChar(c)) {
valueWithHiddenChars = valueWithHiddenChars.replace(c, viewHiddenChar);
hiddenCharCounter++;
}
}
scope.showHiddenCharsContext = true;
scope.hiddenCharCounter = hiddenCharCounter;
scope.valueWithHiddenChars = $sce.trustAsHtml(valueWithHiddenChars);
}
function isHiddenChar(c) {
return c == '\t' || c == '\n' || c == ' ';
}
function viewHiddenChar(c) {
if (c == '\t') {
return '<mark>#' + $translate.instant('ItemModal.Tabs') + '#</mark>';
} else if (c == '\n') {
return '<mark>#' + $translate.instant('ItemModal.NewLine') + '#</mark>';
} else if (c == ' ') {
return '<mark>#' + $translate.instant('ItemModal.Space') + '#</mark>';
}
}
}
}
}
| directive_module.directive('itemmodal', itemModalDirective);
function itemModalDirective($translate, toastr, $sce, AppUtil, EventManager, ConfigService) {
return {
restrict: 'E',
templateUrl: AppUtil.prefixPath() + '/views/component/item-modal.html',
transclude: true,
replace: true,
scope: {
appId: '=',
env: '=',
cluster: '=',
toOperationNamespace: '=',
item: '='
},
link: function (scope) {
var TABLE_VIEW_OPER_TYPE = {
CREATE: 'create',
UPDATE: 'update'
};
scope.doItem = doItem;
scope.collectSelectedClusters = collectSelectedClusters;
scope.showHiddenChars = showHiddenChars;
$('#itemModal').on('show.bs.modal', function (e) {
scope.showHiddenCharsContext = false;
scope.hiddenCharCounter = 0;
scope.valueWithHiddenChars = $sce.trustAsHtml('');
});
$("#valueEditor").textareafullscreen();
function doItem() {
if (!scope.item.value) {
scope.item.value = "";
}
if (scope.item.tableViewOperType == TABLE_VIEW_OPER_TYPE.CREATE) {
//check key unique
var hasRepeatKey = false;
scope.toOperationNamespace.items.forEach(function (item) {
if (!item.isDeleted && scope.item.key == item.item.key) {
toastr.error($translate.instant('ItemModal.KeyExists', { key: scope.item.key }));
hasRepeatKey = true;
}
});
if (hasRepeatKey) {
return;
}
scope.item.addItemBtnDisabled = true;
if (scope.toOperationNamespace.isBranch) {
ConfigService.create_item(scope.appId,
scope.env,
scope.toOperationNamespace.baseInfo.clusterName,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
toastr.success($translate.instant('ItemModal.AddedTips'));
scope.item.addItemBtnDisabled = false;
AppUtil.hideModal('#itemModal');
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.AddFailed'));
scope.item.addItemBtnDisabled = false;
});
} else {
if (selectedClusters.length == 0) {
toastr.error($translate.instant('ItemModal.PleaseChooseCluster'));
scope.item.addItemBtnDisabled = false;
return;
}
selectedClusters.forEach(function (cluster) {
ConfigService.create_item(scope.appId,
cluster.env,
cluster.name,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
scope.item.addItemBtnDisabled = false;
AppUtil.hideModal('#itemModal');
toastr.success(cluster.env + " , " + scope.item.key, $translate.instant('ItemModal.AddedTips'));
if (cluster.env == scope.env &&
cluster.name == scope.cluster) {
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
}
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.AddFailed'));
scope.item.addItemBtnDisabled = false;
});
});
}
} else {
if (!scope.item.comment) {
scope.item.comment = "";
}
ConfigService.update_item(scope.appId,
scope.env,
scope.toOperationNamespace.baseInfo.clusterName,
scope.toOperationNamespace.baseInfo.namespaceName,
scope.item).then(
function (result) {
EventManager.emit(EventManager.EventType.REFRESH_NAMESPACE,
{
namespace: scope.toOperationNamespace
});
AppUtil.hideModal('#itemModal');
toastr.success($translate.instant('ItemModal.ModifiedTips'));
}, function (result) {
toastr.error(AppUtil.errorMsg(result), $translate.instant('ItemModal.ModifyFailed'));
});
}
}
var selectedClusters = [];
function collectSelectedClusters(data) {
selectedClusters = data;
}
function showHiddenChars() {
var value = scope.item.value;
if (!value) {
return;
}
var hiddenCharCounter = 0, valueWithHiddenChars = _.escape(value);
for (var i = 0; i < value.length; i++) {
var c = value[i];
if (isHiddenChar(c)) {
valueWithHiddenChars = valueWithHiddenChars.replace(c, viewHiddenChar);
hiddenCharCounter++;
}
}
scope.showHiddenCharsContext = true;
scope.hiddenCharCounter = hiddenCharCounter;
scope.valueWithHiddenChars = $sce.trustAsHtml(valueWithHiddenChars);
}
function isHiddenChar(c) {
return c == '\t' || c == '\n' || c == ' ';
}
function viewHiddenChar(c) {
if (c == '\t') {
return '<mark>#' + $translate.instant('ItemModal.Tabs') + '#</mark>';
} else if (c == '\n') {
return '<mark>#' + $translate.instant('ItemModal.NewLine') + '#</mark>';
} else if (c == ' ') {
return '<mark>#' + $translate.instant('ItemModal.Space') + '#</mark>';
}
}
}
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/test/java/com/ctrip/framework/apollo/portal/ServiceExceptionTest.java | 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;
}
}
| 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,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/main/java/com/ctrip/framework/apollo/core/utils/DNSUtil.java | package com.ctrip.framework.apollo.core.utils;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
public class DNSUtil {
public static List<String> resolve(String domainName) throws UnknownHostException {
List<String> result = new ArrayList<>();
InetAddress[] addresses = InetAddress.getAllByName(domainName);
if (addresses != null) {
for (InetAddress addr : addresses) {
result.add(addr.getHostAddress());
}
}
return result;
}
}
| package com.ctrip.framework.apollo.core.utils;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
public class DNSUtil {
public static List<String> resolve(String domainName) throws UnknownHostException {
List<String> result = new ArrayList<>();
InetAddress[] addresses = InetAddress.getAllByName(domainName);
if (addresses != null) {
for (InetAddress addr : addresses) {
result.add(addr.getHostAddress());
}
}
return result;
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/java/com/ctrip/framework/apollo/spi/ConfigFactoryManager.java | package com.ctrip.framework.apollo.spi;
/**
* @author Jason Song([email protected])
*/
public interface ConfigFactoryManager {
/**
* Get the config factory for the namespace.
*
* @param namespace the namespace
* @return the config factory for this namespace
*/
ConfigFactory getFactory(String namespace);
}
| package com.ctrip.framework.apollo.spi;
/**
* @author Jason Song([email protected])
*/
public interface ConfigFactoryManager {
/**
* Get the config factory for the namespace.
*
* @param namespace the namespace
* @return the config factory for this namespace
*/
ConfigFactory getFactory(String namespace);
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/db/config-db-test-alpha/apolloconfigdb.sql | /*!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 TestAlphaApolloConfigDB DEFAULT CHARACTER SET = utf8mb4;
Use TestAlphaApolloConfigDB;
# 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(64) 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(64) 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(64) 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(64) 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(64) 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(64) 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='配置服务自身配置';
# Dump of table accesskey
# ------------------------------------------------------------
DROP TABLE IF EXISTS `AccessKey`;
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='访问密钥';
# Config
# ------------------------------------------------------------
INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`, `Comment`)
VALUES
('eureka.service.url', 'default', 'http://statefulset-apollo-config-server-test-alpha-0.service-apollo-meta-server-test-alpha:8080/eureka/,http://statefulset-apollo-config-server-test-alpha-1.service-apollo-meta-server-test-alpha:8080/eureka/,http://statefulset-apollo-config-server-test-alpha-2.service-apollo-meta-server-test-alpha: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 */;
| /*!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 TestAlphaApolloConfigDB DEFAULT CHARACTER SET = utf8mb4;
Use TestAlphaApolloConfigDB;
# 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(64) 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(64) 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(64) 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(64) 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(64) 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(64) 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='配置服务自身配置';
# Dump of table accesskey
# ------------------------------------------------------------
DROP TABLE IF EXISTS `AccessKey`;
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='访问密钥';
# Config
# ------------------------------------------------------------
INSERT INTO `ServerConfig` (`Key`, `Cluster`, `Value`, `Comment`)
VALUES
('eureka.service.url', 'default', 'http://statefulset-apollo-config-server-test-alpha-0.service-apollo-meta-server-test-alpha:8080/eureka/,http://statefulset-apollo-config-server-test-alpha-1.service-apollo-meta-server-test-alpha:8080/eureka/,http://statefulset-apollo-config-server-test-alpha-2.service-apollo-meta-server-test-alpha: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,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/main/java/com/ctrip/framework/apollo/core/utils/ResourceUtils.java | package com.ctrip.framework.apollo.core.utils;
import java.net.URL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.FileNotFoundException;
import java.nio.file.Paths;
import java.util.Properties;
public class ResourceUtils {
private static final Logger logger = LoggerFactory.getLogger(ResourceUtils.class);
private static final String[] DEFAULT_FILE_SEARCH_LOCATIONS = new String[]{"./config/", "./"};
@SuppressWarnings("unchecked")
public static Properties readConfigFile(String configPath, Properties defaults) {
Properties props = new Properties();
if (defaults != null) {
props.putAll(defaults);
}
InputStream in = loadConfigFileFromDefaultSearchLocations(configPath);
try {
if (in != null) {
props.load(in);
}
} catch (IOException ex) {
logger.warn("Reading config failed: {}", ex.getMessage());
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ex) {
logger.warn("Close config failed: {}", ex.getMessage());
}
}
}
if (logger.isDebugEnabled()) {
StringBuilder sb = new StringBuilder();
for (String propertyName : props.stringPropertyNames()) {
sb.append(propertyName).append('=').append(props.getProperty(propertyName)).append('\n');
}
if (sb.length() > 0) {
logger.debug("Reading properties: \n" + sb.toString());
} else {
logger.warn("No available properties: {}", configPath);
}
}
return props;
}
private static InputStream loadConfigFileFromDefaultSearchLocations(String configPath) {
try {
// load from default search locations
for (String searchLocation : DEFAULT_FILE_SEARCH_LOCATIONS) {
File candidate = Paths.get(searchLocation, configPath).toFile();
if (candidate.exists() && candidate.isFile() && candidate.canRead()) {
logger.debug("Reading config from resource {}", candidate.getAbsolutePath());
return new FileInputStream(candidate);
}
}
// load from classpath
URL url = ClassLoaderUtil.getLoader().getResource(configPath);
if (url != null) {
InputStream in = getResourceAsStream(url);
if (in != null) {
logger.debug("Reading config from resource {}", url.getPath());
return in;
}
}
// load outside resource under current user path
File candidate = new File(System.getProperty("user.dir"), configPath);
if (candidate.exists() && candidate.isFile() && candidate.canRead()) {
logger.debug("Reading config from resource {}", candidate.getAbsolutePath());
return new FileInputStream(candidate);
}
} catch (FileNotFoundException e) {
//ignore
}
return null;
}
private static InputStream getResourceAsStream(URL url) {
try {
return url != null ? url.openStream() : null;
} catch (IOException e) {
return null;
}
}
}
| package com.ctrip.framework.apollo.core.utils;
import java.net.URL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.FileNotFoundException;
import java.nio.file.Paths;
import java.util.Properties;
public class ResourceUtils {
private static final Logger logger = LoggerFactory.getLogger(ResourceUtils.class);
private static final String[] DEFAULT_FILE_SEARCH_LOCATIONS = new String[]{"./config/", "./"};
@SuppressWarnings("unchecked")
public static Properties readConfigFile(String configPath, Properties defaults) {
Properties props = new Properties();
if (defaults != null) {
props.putAll(defaults);
}
InputStream in = loadConfigFileFromDefaultSearchLocations(configPath);
try {
if (in != null) {
props.load(in);
}
} catch (IOException ex) {
logger.warn("Reading config failed: {}", ex.getMessage());
} finally {
if (in != null) {
try {
in.close();
} catch (IOException ex) {
logger.warn("Close config failed: {}", ex.getMessage());
}
}
}
if (logger.isDebugEnabled()) {
StringBuilder sb = new StringBuilder();
for (String propertyName : props.stringPropertyNames()) {
sb.append(propertyName).append('=').append(props.getProperty(propertyName)).append('\n');
}
if (sb.length() > 0) {
logger.debug("Reading properties: \n" + sb.toString());
} else {
logger.warn("No available properties: {}", configPath);
}
}
return props;
}
private static InputStream loadConfigFileFromDefaultSearchLocations(String configPath) {
try {
// load from default search locations
for (String searchLocation : DEFAULT_FILE_SEARCH_LOCATIONS) {
File candidate = Paths.get(searchLocation, configPath).toFile();
if (candidate.exists() && candidate.isFile() && candidate.canRead()) {
logger.debug("Reading config from resource {}", candidate.getAbsolutePath());
return new FileInputStream(candidate);
}
}
// load from classpath
URL url = ClassLoaderUtil.getLoader().getResource(configPath);
if (url != null) {
InputStream in = getResourceAsStream(url);
if (in != null) {
logger.debug("Reading config from resource {}", url.getPath());
return in;
}
}
// load outside resource under current user path
File candidate = new File(System.getProperty("user.dir"), configPath);
if (candidate.exists() && candidate.isFile() && candidate.canRead()) {
logger.debug("Reading config from resource {}", candidate.getAbsolutePath());
return new FileInputStream(candidate);
}
} catch (FileNotFoundException e) {
//ignore
}
return null;
}
private static InputStream getResourceAsStream(URL url) {
try {
return url != null ? url.openStream() : null;
} catch (IOException e) {
return null;
}
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/openapi/entity/ConsumerAudit.java | package com.ctrip.framework.apollo.openapi.entity;
import com.google.common.base.MoreObjects;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PrePersist;
import javax.persistence.Table;
/**
* @author Jason Song([email protected])
*/
@Entity
@Table(name = "ConsumerAudit")
public class ConsumerAudit {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "Id")
private long id;
@Column(name = "ConsumerId", nullable = false)
private long consumerId;
@Column(name = "Uri", nullable = false)
private String uri;
@Column(name = "Method", nullable = false)
private String method;
@Column(name = "DataChange_CreatedTime")
private Date dataChangeCreatedTime;
@Column(name = "DataChange_LastTime")
private Date dataChangeLastModifiedTime;
@PrePersist
protected void prePersist() {
if (this.dataChangeCreatedTime == null) {
this.dataChangeCreatedTime = new Date();
}
if (this.dataChangeLastModifiedTime == null) {
dataChangeLastModifiedTime = this.dataChangeCreatedTime;
}
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getConsumerId() {
return consumerId;
}
public void setConsumerId(long consumerId) {
this.consumerId = consumerId;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public Date getDataChangeCreatedTime() {
return dataChangeCreatedTime;
}
public void setDataChangeCreatedTime(Date dataChangeCreatedTime) {
this.dataChangeCreatedTime = dataChangeCreatedTime;
}
public Date getDataChangeLastModifiedTime() {
return dataChangeLastModifiedTime;
}
public void setDataChangeLastModifiedTime(Date dataChangeLastModifiedTime) {
this.dataChangeLastModifiedTime = dataChangeLastModifiedTime;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("id", id)
.add("consumerId", consumerId)
.add("uri", uri)
.add("method", method)
.add("dataChangeCreatedTime", dataChangeCreatedTime)
.add("dataChangeLastModifiedTime", dataChangeLastModifiedTime)
.toString();
}
}
| package com.ctrip.framework.apollo.openapi.entity;
import com.google.common.base.MoreObjects;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.PrePersist;
import javax.persistence.Table;
/**
* @author Jason Song([email protected])
*/
@Entity
@Table(name = "ConsumerAudit")
public class ConsumerAudit {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "Id")
private long id;
@Column(name = "ConsumerId", nullable = false)
private long consumerId;
@Column(name = "Uri", nullable = false)
private String uri;
@Column(name = "Method", nullable = false)
private String method;
@Column(name = "DataChange_CreatedTime")
private Date dataChangeCreatedTime;
@Column(name = "DataChange_LastTime")
private Date dataChangeLastModifiedTime;
@PrePersist
protected void prePersist() {
if (this.dataChangeCreatedTime == null) {
this.dataChangeCreatedTime = new Date();
}
if (this.dataChangeLastModifiedTime == null) {
dataChangeLastModifiedTime = this.dataChangeCreatedTime;
}
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public long getConsumerId() {
return consumerId;
}
public void setConsumerId(long consumerId) {
this.consumerId = consumerId;
}
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public Date getDataChangeCreatedTime() {
return dataChangeCreatedTime;
}
public void setDataChangeCreatedTime(Date dataChangeCreatedTime) {
this.dataChangeCreatedTime = dataChangeCreatedTime;
}
public Date getDataChangeLastModifiedTime() {
return dataChangeLastModifiedTime;
}
public void setDataChangeLastModifiedTime(Date dataChangeLastModifiedTime) {
this.dataChangeLastModifiedTime = dataChangeLastModifiedTime;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.omitNullValues()
.add("id", id)
.add("consumerId", consumerId)
.add("uri", uri)
.add("method", method)
.add("dataChangeCreatedTime", dataChangeCreatedTime)
.add("dataChangeLastModifiedTime", dataChangeLastModifiedTime)
.toString();
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/XmlConfigPlaceholderTest3.xml | <?xml version="1.0" encoding="UTF-8"?>
<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,FX.apollo"/>
<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"?>
<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,FX.apollo"/>
<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,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/java/com/ctrip/framework/apollo/spring/config/NamespaceHandler.java | package com.ctrip.framework.apollo.spring.config;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
import org.springframework.core.Ordered;
import org.springframework.util.SystemPropertyUtils;
import org.w3c.dom.Element;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
/**
* @author Jason Song([email protected])
*/
public class NamespaceHandler extends NamespaceHandlerSupport {
private static final Splitter NAMESPACE_SPLITTER = Splitter.on(",").omitEmptyStrings()
.trimResults();
@Override
public void init() {
registerBeanDefinitionParser("config", new BeanParser());
}
static class BeanParser extends AbstractSingleBeanDefinitionParser {
@Override
protected Class<?> getBeanClass(Element element) {
return ConfigPropertySourcesProcessor.class;
}
@Override
protected boolean shouldGenerateId() {
return true;
}
private String resolveNamespaces(Element element) {
String namespaces = element.getAttribute("namespaces");
if (Strings.isNullOrEmpty(namespaces)) {
//default to application
return ConfigConsts.NAMESPACE_APPLICATION;
}
return SystemPropertyUtils.resolvePlaceholders(namespaces);
}
@Override
protected void doParse(Element element, BeanDefinitionBuilder builder) {
String namespaces = this.resolveNamespaces(element);
int order = Ordered.LOWEST_PRECEDENCE;
String orderAttribute = element.getAttribute("order");
if (!Strings.isNullOrEmpty(orderAttribute)) {
try {
order = Integer.parseInt(orderAttribute);
} catch (Throwable ex) {
throw new IllegalArgumentException(
String.format("Invalid order: %s for namespaces: %s", orderAttribute, namespaces));
}
}
PropertySourcesProcessor.addNamespaces(NAMESPACE_SPLITTER.splitToList(namespaces), order);
}
}
}
| package com.ctrip.framework.apollo.spring.config;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
import org.springframework.core.Ordered;
import org.springframework.util.SystemPropertyUtils;
import org.w3c.dom.Element;
import com.ctrip.framework.apollo.core.ConfigConsts;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
/**
* @author Jason Song([email protected])
*/
public class NamespaceHandler extends NamespaceHandlerSupport {
private static final Splitter NAMESPACE_SPLITTER = Splitter.on(",").omitEmptyStrings()
.trimResults();
@Override
public void init() {
registerBeanDefinitionParser("config", new BeanParser());
}
static class BeanParser extends AbstractSingleBeanDefinitionParser {
@Override
protected Class<?> getBeanClass(Element element) {
return ConfigPropertySourcesProcessor.class;
}
@Override
protected boolean shouldGenerateId() {
return true;
}
private String resolveNamespaces(Element element) {
String namespaces = element.getAttribute("namespaces");
if (Strings.isNullOrEmpty(namespaces)) {
//default to application
return ConfigConsts.NAMESPACE_APPLICATION;
}
return SystemPropertyUtils.resolvePlaceholders(namespaces);
}
@Override
protected void doParse(Element element, BeanDefinitionBuilder builder) {
String namespaces = this.resolveNamespaces(element);
int order = Ordered.LOWEST_PRECEDENCE;
String orderAttribute = element.getAttribute("order");
if (!Strings.isNullOrEmpty(orderAttribute)) {
try {
order = Integer.parseInt(orderAttribute);
} catch (Throwable ex) {
throw new IllegalArgumentException(
String.format("Invalid order: %s for namespaces: %s", orderAttribute, namespaces));
}
}
PropertySourcesProcessor.addNamespaces(NAMESPACE_SPLITTER.splitToList(namespaces), order);
}
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/delete_app_cluster_namespace.html | <!doctype html>
<html ng-app="delete_app_cluster_namespace">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" href="img/config.png">
<!-- styles -->
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css">
<link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css">
<link rel="stylesheet" type="text/css" href="styles/common-style.css">
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<title>{{'Delete.Title' | translate }}</title>
</head>
<body>
<apollonav></apollonav>
<div class="container-fluid" ng-controller="DeleteAppClusterNamespaceController">
<div class="col-md-10 col-md-offset-1 panel">
<section class="panel-body" ng-show="isRootUser">
<!-- delete app -->
<section class="row">
<h5>{{'Delete.DeleteApp' | translate }}
<small>
{{'Delete.DeleteAppTips' | translate }}
</small>
</h5>
<hr>
<form class="form-horizontal">
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Common.AppId' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="app.appId">
<small> {{'Delete.AppIdTips' | translate }}</small>
</div>
<div class="col-sm-1">
<button class="btn btn-info" ng-click="getAppInfo()">{{'Common.Search' | translate }}</button>
</div>
</div>
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
{{'Delete.AppInfo' | translate }}</label>
<div class="col-sm-5">
<h5 ng-show="app.info" ng-bind="app.info"></h5>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-9">
<button type="submit" class="btn btn-primary" ng-disabled="deleteAppBtnDisabled"
ng-click="deleteApp()">
{{'Delete.DeleteApp' | translate }}
</button>
</div>
</div>
</form>
</section>
<!-- delete cluster -->
<section class="row">
<h5>{{'Delete.DeleteCluster' | translate }}
<small>
{{'Delete.DeleteClusterTips' | translate }}
</small>
</h5>
<hr>
<form class="form-horizontal">
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Common.AppId' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="cluster.appId">
</div>
</div>
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Delete.EnvName' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="cluster.env">
</div>
</div>
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Common.ClusterName' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="cluster.name">
<small>{{'Delete.ClusterNameTips' | translate }}</small>
</div>
<div class="col-sm-1">
<button class="btn btn-info"
ng-click="getClusterInfo()">{{'Common.Search' | translate }}</button>
</div>
</div>
<div class="form-group" viv clform-group>
<label class="col-sm-2 control-label">
{{'Delete.ClusterInfo' | translate }}</label>
<div class="col-sm-5">
<h5 ng-show="cluster.info" ng-bind="cluster.info"></h5>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-9">
<button type="submit" class="btn btn-primary" ng-disabled="deleteClusterBtnDisabled"
ng-click="deleteCluster()">
{{'Delete.DeleteCluster' | translate }}
</button>
</div>
</div>
</form>
</section>
<!-- delete app namespace -->
<section class="row">
<h5>{{'Delete.DeleteNamespace' | translate }}
<small>{{'Delete.DeleteNamespaceTips' | translate }}</small>
</h5>
<small>
{{'Delete.DeleteNamespaceTips2' | translate }}
</small>
<hr>
<form class="form-horizontal">
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Common.AppId' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="appNamespace.appId">
</div>
</div>
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Delete.AppNamespaceName' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="appNamespace.name">
<small>{{'Delete.AppNamespaceNameTips' | translate }}</small>
</div>
<div class="col-sm-1">
<button class="btn btn-info" ng-click="getAppNamespaceInfo()">{{'Common.Search' | translate }}</button>
</div>
</div>
<div class="form-group" viv clform-group>
<label class="col-sm-2 control-label">
{{'Delete.AppNamespaceInfo' | translate }}</label>
<div class="col-sm-5">
<h5 ng-show="appNamespace.info" ng-bind="appNamespace.info"></h5>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-9">
<button type="submit" class="btn btn-primary"
ng-disabled="deleteAppNamespaceBtnDisabled" ng-click="deleteAppNamespace()">
{{'Delete.DeleteNamespace' | translate }}
</button>
</div>
</div>
</form>
</section>
</section>
<section class="panel-body text-center" ng-if="!isRootUser">
<h4>{{'Common.IsRootUser' | translate }}</h4>
</section>
</div>
</div>
<div ng-include="'views/common/footer.html'"></div>
<!-- jquery.js -->
<script src="vendor/jquery.min.js" type="text/javascript"></script>
<!--angular-->
<script src="vendor/angular/angular.min.js"></script>
<script src="vendor/angular/angular-route.min.js"></script>
<script src="vendor/angular/angular-resource.min.js"></script>
<script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="vendor/angular/loading-bar.min.js"></script>
<script src="vendor/angular/angular-cookies.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
<!--valdr-->
<script src="vendor/valdr/valdr.min.js" type="text/javascript"></script>
<script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script>
<!-- bootstrap.js -->
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="vendor/lodash.min.js"></script>
<script src="vendor/select2/select2.min.js" type="text/javascript"></script>
<!--biz-->
<!--must import-->
<script type="application/javascript" src="scripts/app.js"></script>
<script type="application/javascript" src="scripts/services/AppService.js"></script>
<script type="application/javascript" src="scripts/services/EnvService.js"></script>
<script type="application/javascript" src="scripts/services/UserService.js"></script>
<script type="application/javascript" src="scripts/services/CommonService.js"></script>
<script type="application/javascript" src="scripts/services/PermissionService.js"></script>
<script type="application/javascript" src="scripts/services/ClusterService.js"></script>
<script type="application/javascript" src="scripts/services/NamespaceService.js"></script>
<script type="application/javascript" src="scripts/AppUtils.js"></script>
<script type="application/javascript" src="scripts/PageCommon.js"></script>
<script type="application/javascript" src="scripts/directive/directive.js"></script>
<script type="application/javascript" src="scripts/valdr.js"></script>
<script type="application/javascript" src="scripts/controller/DeleteAppClusterNamespaceController.js"></script>
</body>
</html> | <!doctype html>
<html ng-app="delete_app_cluster_namespace">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" href="img/config.png">
<!-- styles -->
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css">
<link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css">
<link rel="stylesheet" type="text/css" href="styles/common-style.css">
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<title>{{'Delete.Title' | translate }}</title>
</head>
<body>
<apollonav></apollonav>
<div class="container-fluid" ng-controller="DeleteAppClusterNamespaceController">
<div class="col-md-10 col-md-offset-1 panel">
<section class="panel-body" ng-show="isRootUser">
<!-- delete app -->
<section class="row">
<h5>{{'Delete.DeleteApp' | translate }}
<small>
{{'Delete.DeleteAppTips' | translate }}
</small>
</h5>
<hr>
<form class="form-horizontal">
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Common.AppId' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="app.appId">
<small> {{'Delete.AppIdTips' | translate }}</small>
</div>
<div class="col-sm-1">
<button class="btn btn-info" ng-click="getAppInfo()">{{'Common.Search' | translate }}</button>
</div>
</div>
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
{{'Delete.AppInfo' | translate }}</label>
<div class="col-sm-5">
<h5 ng-show="app.info" ng-bind="app.info"></h5>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-9">
<button type="submit" class="btn btn-primary" ng-disabled="deleteAppBtnDisabled"
ng-click="deleteApp()">
{{'Delete.DeleteApp' | translate }}
</button>
</div>
</div>
</form>
</section>
<!-- delete cluster -->
<section class="row">
<h5>{{'Delete.DeleteCluster' | translate }}
<small>
{{'Delete.DeleteClusterTips' | translate }}
</small>
</h5>
<hr>
<form class="form-horizontal">
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Common.AppId' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="cluster.appId">
</div>
</div>
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Delete.EnvName' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="cluster.env">
</div>
</div>
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Common.ClusterName' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="cluster.name">
<small>{{'Delete.ClusterNameTips' | translate }}</small>
</div>
<div class="col-sm-1">
<button class="btn btn-info"
ng-click="getClusterInfo()">{{'Common.Search' | translate }}</button>
</div>
</div>
<div class="form-group" viv clform-group>
<label class="col-sm-2 control-label">
{{'Delete.ClusterInfo' | translate }}</label>
<div class="col-sm-5">
<h5 ng-show="cluster.info" ng-bind="cluster.info"></h5>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-9">
<button type="submit" class="btn btn-primary" ng-disabled="deleteClusterBtnDisabled"
ng-click="deleteCluster()">
{{'Delete.DeleteCluster' | translate }}
</button>
</div>
</div>
</form>
</section>
<!-- delete app namespace -->
<section class="row">
<h5>{{'Delete.DeleteNamespace' | translate }}
<small>{{'Delete.DeleteNamespaceTips' | translate }}</small>
</h5>
<small>
{{'Delete.DeleteNamespaceTips2' | translate }}
</small>
<hr>
<form class="form-horizontal">
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Common.AppId' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="appNamespace.appId">
</div>
</div>
<div class="form-group" valdr-form-group>
<label class="col-sm-2 control-label">
<apollorequiredfield></apollorequiredfield>
{{'Delete.AppNamespaceName' | translate }}
</label>
<div class="col-sm-5">
<input type="text" class="form-control" ng-model="appNamespace.name">
<small>{{'Delete.AppNamespaceNameTips' | translate }}</small>
</div>
<div class="col-sm-1">
<button class="btn btn-info" ng-click="getAppNamespaceInfo()">{{'Common.Search' | translate }}</button>
</div>
</div>
<div class="form-group" viv clform-group>
<label class="col-sm-2 control-label">
{{'Delete.AppNamespaceInfo' | translate }}</label>
<div class="col-sm-5">
<h5 ng-show="appNamespace.info" ng-bind="appNamespace.info"></h5>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-9">
<button type="submit" class="btn btn-primary"
ng-disabled="deleteAppNamespaceBtnDisabled" ng-click="deleteAppNamespace()">
{{'Delete.DeleteNamespace' | translate }}
</button>
</div>
</div>
</form>
</section>
</section>
<section class="panel-body text-center" ng-if="!isRootUser">
<h4>{{'Common.IsRootUser' | translate }}</h4>
</section>
</div>
</div>
<div ng-include="'views/common/footer.html'"></div>
<!-- jquery.js -->
<script src="vendor/jquery.min.js" type="text/javascript"></script>
<!--angular-->
<script src="vendor/angular/angular.min.js"></script>
<script src="vendor/angular/angular-route.min.js"></script>
<script src="vendor/angular/angular-resource.min.js"></script>
<script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="vendor/angular/loading-bar.min.js"></script>
<script src="vendor/angular/angular-cookies.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
<!--valdr-->
<script src="vendor/valdr/valdr.min.js" type="text/javascript"></script>
<script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script>
<!-- bootstrap.js -->
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="vendor/lodash.min.js"></script>
<script src="vendor/select2/select2.min.js" type="text/javascript"></script>
<!--biz-->
<!--must import-->
<script type="application/javascript" src="scripts/app.js"></script>
<script type="application/javascript" src="scripts/services/AppService.js"></script>
<script type="application/javascript" src="scripts/services/EnvService.js"></script>
<script type="application/javascript" src="scripts/services/UserService.js"></script>
<script type="application/javascript" src="scripts/services/CommonService.js"></script>
<script type="application/javascript" src="scripts/services/PermissionService.js"></script>
<script type="application/javascript" src="scripts/services/ClusterService.js"></script>
<script type="application/javascript" src="scripts/services/NamespaceService.js"></script>
<script type="application/javascript" src="scripts/AppUtils.js"></script>
<script type="application/javascript" src="scripts/PageCommon.js"></script>
<script type="application/javascript" src="scripts/directive/directive.js"></script>
<script type="application/javascript" src="scripts/valdr.js"></script>
<script type="application/javascript" src="scripts/controller/DeleteAppClusterNamespaceController.js"></script>
</body>
</html> | -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/listener/ConfigPublishEvent.java | package com.ctrip.framework.apollo.portal.listener;
import com.ctrip.framework.apollo.portal.environment.Env;
import org.springframework.context.ApplicationEvent;
public class ConfigPublishEvent extends ApplicationEvent {
private ConfigPublishInfo configPublishInfo;
public ConfigPublishEvent(Object source) {
super(source);
configPublishInfo = (ConfigPublishInfo) source;
}
public static ConfigPublishEvent instance() {
ConfigPublishInfo info = new ConfigPublishInfo();
return new ConfigPublishEvent(info);
}
public ConfigPublishInfo getConfigPublishInfo(){
return configPublishInfo;
}
public ConfigPublishEvent withAppId(String appId) {
configPublishInfo.setAppId(appId);
return this;
}
public ConfigPublishEvent withCluster(String clusterName) {
configPublishInfo.setClusterName(clusterName);
return this;
}
public ConfigPublishEvent withNamespace(String namespaceName) {
configPublishInfo.setNamespaceName(namespaceName);
return this;
}
public ConfigPublishEvent withReleaseId(long releaseId){
configPublishInfo.setReleaseId(releaseId);
return this;
}
public ConfigPublishEvent withPreviousReleaseId(long previousReleaseId){
configPublishInfo.setPreviousReleaseId(previousReleaseId);
return this;
}
public ConfigPublishEvent setNormalPublishEvent(boolean isNormalPublishEvent) {
configPublishInfo.setNormalPublishEvent(isNormalPublishEvent);
return this;
}
public ConfigPublishEvent setGrayPublishEvent(boolean isGrayPublishEvent) {
configPublishInfo.setGrayPublishEvent(isGrayPublishEvent);
return this;
}
public ConfigPublishEvent setRollbackEvent(boolean isRollbackEvent) {
configPublishInfo.setRollbackEvent(isRollbackEvent);
return this;
}
public ConfigPublishEvent setMergeEvent(boolean isMergeEvent) {
configPublishInfo.setMergeEvent(isMergeEvent);
return this;
}
public ConfigPublishEvent setEnv(Env env) {
configPublishInfo.setEnv(env);
return this;
}
public static class ConfigPublishInfo {
private String env;
private String appId;
private String clusterName;
private String namespaceName;
private long releaseId;
private long previousReleaseId;
private boolean isRollbackEvent;
private boolean isMergeEvent;
private boolean isNormalPublishEvent;
private boolean isGrayPublishEvent;
public Env getEnv() {
return Env.valueOf(env);
}
public void setEnv(Env env) {
this.env = env.toString();
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public String getNamespaceName() {
return namespaceName;
}
public void setNamespaceName(String namespaceName) {
this.namespaceName = namespaceName;
}
public long getReleaseId() {
return releaseId;
}
public void setReleaseId(long releaseId) {
this.releaseId = releaseId;
}
public long getPreviousReleaseId() {
return previousReleaseId;
}
public void setPreviousReleaseId(long previousReleaseId) {
this.previousReleaseId = previousReleaseId;
}
public boolean isRollbackEvent() {
return isRollbackEvent;
}
public void setRollbackEvent(boolean rollbackEvent) {
isRollbackEvent = rollbackEvent;
}
public boolean isMergeEvent() {
return isMergeEvent;
}
public void setMergeEvent(boolean mergeEvent) {
isMergeEvent = mergeEvent;
}
public boolean isNormalPublishEvent() {
return isNormalPublishEvent;
}
public void setNormalPublishEvent(boolean normalPublishEvent) {
isNormalPublishEvent = normalPublishEvent;
}
public boolean isGrayPublishEvent() {
return isGrayPublishEvent;
}
public void setGrayPublishEvent(boolean grayPublishEvent) {
isGrayPublishEvent = grayPublishEvent;
}
}
}
| package com.ctrip.framework.apollo.portal.listener;
import com.ctrip.framework.apollo.portal.environment.Env;
import org.springframework.context.ApplicationEvent;
public class ConfigPublishEvent extends ApplicationEvent {
private ConfigPublishInfo configPublishInfo;
public ConfigPublishEvent(Object source) {
super(source);
configPublishInfo = (ConfigPublishInfo) source;
}
public static ConfigPublishEvent instance() {
ConfigPublishInfo info = new ConfigPublishInfo();
return new ConfigPublishEvent(info);
}
public ConfigPublishInfo getConfigPublishInfo(){
return configPublishInfo;
}
public ConfigPublishEvent withAppId(String appId) {
configPublishInfo.setAppId(appId);
return this;
}
public ConfigPublishEvent withCluster(String clusterName) {
configPublishInfo.setClusterName(clusterName);
return this;
}
public ConfigPublishEvent withNamespace(String namespaceName) {
configPublishInfo.setNamespaceName(namespaceName);
return this;
}
public ConfigPublishEvent withReleaseId(long releaseId){
configPublishInfo.setReleaseId(releaseId);
return this;
}
public ConfigPublishEvent withPreviousReleaseId(long previousReleaseId){
configPublishInfo.setPreviousReleaseId(previousReleaseId);
return this;
}
public ConfigPublishEvent setNormalPublishEvent(boolean isNormalPublishEvent) {
configPublishInfo.setNormalPublishEvent(isNormalPublishEvent);
return this;
}
public ConfigPublishEvent setGrayPublishEvent(boolean isGrayPublishEvent) {
configPublishInfo.setGrayPublishEvent(isGrayPublishEvent);
return this;
}
public ConfigPublishEvent setRollbackEvent(boolean isRollbackEvent) {
configPublishInfo.setRollbackEvent(isRollbackEvent);
return this;
}
public ConfigPublishEvent setMergeEvent(boolean isMergeEvent) {
configPublishInfo.setMergeEvent(isMergeEvent);
return this;
}
public ConfigPublishEvent setEnv(Env env) {
configPublishInfo.setEnv(env);
return this;
}
public static class ConfigPublishInfo {
private String env;
private String appId;
private String clusterName;
private String namespaceName;
private long releaseId;
private long previousReleaseId;
private boolean isRollbackEvent;
private boolean isMergeEvent;
private boolean isNormalPublishEvent;
private boolean isGrayPublishEvent;
public Env getEnv() {
return Env.valueOf(env);
}
public void setEnv(Env env) {
this.env = env.toString();
}
public String getAppId() {
return appId;
}
public void setAppId(String appId) {
this.appId = appId;
}
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public String getNamespaceName() {
return namespaceName;
}
public void setNamespaceName(String namespaceName) {
this.namespaceName = namespaceName;
}
public long getReleaseId() {
return releaseId;
}
public void setReleaseId(long releaseId) {
this.releaseId = releaseId;
}
public long getPreviousReleaseId() {
return previousReleaseId;
}
public void setPreviousReleaseId(long previousReleaseId) {
this.previousReleaseId = previousReleaseId;
}
public boolean isRollbackEvent() {
return isRollbackEvent;
}
public void setRollbackEvent(boolean rollbackEvent) {
isRollbackEvent = rollbackEvent;
}
public boolean isMergeEvent() {
return isMergeEvent;
}
public void setMergeEvent(boolean mergeEvent) {
isMergeEvent = mergeEvent;
}
public boolean isNormalPublishEvent() {
return isNormalPublishEvent;
}
public void setNormalPublishEvent(boolean normalPublishEvent) {
isNormalPublishEvent = normalPublishEvent;
}
public boolean isGrayPublishEvent() {
return isGrayPublishEvent;
}
public void setGrayPublishEvent(boolean grayPublishEvent) {
isGrayPublishEvent = grayPublishEvent;
}
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/ApolloCommonConfig.java | package com.ctrip.framework.apollo.common;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@EnableAutoConfiguration
@Configuration
@ComponentScan(basePackageClasses = ApolloCommonConfig.class)
public class ApolloCommonConfig {
}
| package com.ctrip.framework.apollo.common;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@EnableAutoConfiguration
@Configuration
@ComponentScan(basePackageClasses = ApolloCommonConfig.class)
public class ApolloCommonConfig {
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/config.html | <!DOCTYPE html>
<html data-ng-app="application">
<head>
<meta charset="UTF-8">
<title>{{'Config.Title' | translate }}</title>
<link rel="icon" href="./img/config.png">
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css">
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<link rel="stylesheet" type="text/css" href="vendor/jquery-plugin/textareafullscreen.css">
<link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css">
<link rel="stylesheet" type="text/css" href="styles/common-style.css">
</head>
<body>
<apollonav></apollonav>
<div id="config-info" class="apollo-container app">
<div ng-controller="ConfigBaseInfoController">
<div class="J_appNotFound hidden row text-center app-not-found" ng-show="notFoundApp">
<img src="img/404.png">
<br>
<p>
<span ng-bind="pageContext.appId"></span> {{'Config.AppIdNotFound' | translate }}<a
href="app.html">{{'Config.ClickByCreate' | translate }}</a>
</p>
</div>
<div class="side-bar" ng-class="{'position-absolute': viewMode == 1, 'position-fixed': viewMode == 2}">
<div class="J_appFound hidden"
ng-show="!notFoundApp && (viewMode == 1 || (viewMode == 2 && showSideBar))">
<!--env list-->
<section class="panel">
<header class="panel-heading">
{{'Config.EnvList' | translate }}
<span class="pull-right" data-tooltip="tooltip" data-placement="bottom"
title="{{'Config.EnvListTips' | translate }}">
<img src="img/question.png" class="i-20" />
</span>
</header>
<div id="treeview" class="no-radius"></div>
</section>
<!--app info-->
<section class="panel">
<header class="panel-heading">
{{'Config.ProjectInfo' | translate }}
<span class="pull-right">
<a href="app/setting.html?#/appid={{pageContext.appId}}"
style="margin-right: 5px;text-decoration:none;">
<img src="img/edit.png" class="i-20 cursor-pointer" data-tooltip="tooltip"
data-placement="bottom"
title="{{'Config.ModifyBasicProjectInfo' | translate }}" />
</a>
<img src="img/unlike.png" class="i-20 cursor-pointer" ng-if="!favoriteId"
ng-click="addFavorite()" data-tooltip="tooltip" data-placement="bottom"
title="{{'Config.Favorite' | translate }}" />
<img src="img/like.png" class="i-20 cursor-pointer" ng-if="favoriteId"
ng-click="deleteFavorite()" data-tooltip="tooltip" data-placement="bottom"
title="{{'Config.CancelFavorite' | translate }}" />
</span>
</header>
<div class="panel-body">
<table class="project-info">
<tbody class="text-left">
<tr>
<th>{{'Common.AppId' | translate }}:</th>
<td ng-bind="appBaseInfo.appId"></td>
</tr>
<tr>
<th>{{'Common.AppName' | translate }}:</th>
<td>
<small ng-bind="appBaseInfo.name"></small>
</td>
</tr>
<tr>
<th>{{'Common.Department' | translate }}:</th>
<td ng-bind="appBaseInfo.orgInfo"></td>
</tr>
<tr>
<th>{{'Common.AppOwner' | translate }}:</th>
<td ng-bind="appBaseInfo.ownerName"></td>
</tr>
<tr>
<th>{{'Common.Email' | translate }}:</th>
<td>
<small ng-bind="appBaseInfo.ownerEmail"></small>
</td>
</tr>
<tr ng-show="missEnvs.length > 0">
<th>{{'Config.MissEnv' | translate }}:</th>
<td>
<span ng-repeat="env in missEnvs" ng-bind="env">
</span>
</td>
</tr>
<tr ng-show="missingNamespaces.length > 0">
<th>{{'Config.MissNamespace' | translate }}:</th>
<td>
<span ng-repeat="namespace in missingNamespaces" ng-bind="namespace">
</span>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<!--operation entrance-->
<section>
<apolloentrance apollo-title="'Config.ProjectManage' | translate"
apollo-img-src="'project-manage'"
apollo-href="'app/setting.html?#/appid=' + pageContext.appId"></apolloentrance>
<apolloentrance apollo-title="'Config.AccessKeyManage' | translate"
apollo-img-src="'accesskey-manage'"
apollo-href="'app/access_key.html?#/appid=' + pageContext.appId"></apolloentrance>
<a class="list-group-item" ng-show="missEnvs.length > 0" ng-click="createAppInMissEnv()">
<div class="row icon-text icon-plus-orange">
<p class="btn-title ng-binding">{{'Config.CreateAppMissEnv' | translate }}</p>
</div>
</a>
<a class="list-group-item" ng-show="missingNamespaces.length > 0"
ng-click="createMissingNamespaces()">
<div class="row icon-text icon-plus-orange">
<p class="btn-title ng-binding">{{'Config.CreateAppMissNamespace' | translate }}</p>
</div>
</a>
<apolloentrance apollo-title="'Config.AddCluster' | translate" apollo-img-src="'plus-orange'"
apollo-href="'cluster.html?#/appid=' + pageContext.appId"
ng-show="hasCreateClusterPermission"></apolloentrance>
<div class="list-group-item cursor-pointer hover" ng-click="showMasterPermissionTips()"
ng-show="!hasCreateClusterPermission">
<div class="row icon-text icon-plus-orange">
<p class="btn-title">{{'Config.AddCluster' | translate }}</p>
</div>
</div>
<apolloentrance apollo-title="'Config.AddNamespace' | translate" apollo-img-src="'plus-orange'"
apollo-href="'namespace.html?#/appid=' + pageContext.appId"
ng-show="hasCreateNamespacePermission"></apolloentrance>
<div class="list-group-item cursor-pointer hover" ng-click="showMasterPermissionTips()"
ng-show="!hasCreateNamespacePermission">
<div class="row icon-text icon-plus-orange">
<p class="btn-title">{{'Config.AddNamespace' | translate }}</p>
</div>
</div>
</section>
</div>
</div>
</div>
<!--具体配置信息-->
<!--namespaces-->
<div class="config-item-container hide" ng-class="{'view-mode-1': viewMode == 1, 'view-mode-2': viewMode == 2}"
ng-controller="ConfigNamespaceController">
<h4 class="text-center" ng-show="viewMode == 2">
{{'Config.CurrentlyOperatorEnv' | translate }}:{{pageContext.env}},
{{'Common.Cluster' | translate }}:{{pageContext.clusterName}}
</h4>
<div class="alert alert-info alert-dismissible" role="alert"
ng-show="(!hideTip || !hideTip[pageContext.appId][pageContext.clusterName]) && envMapClusters[pageContext.env]">
<button class="btn btn-sm btn-default pull-right" style="margin-top: -7px;margin-right:-15px;"
ng-click="closeTip(pageContext.clusterName)">{{'Config.DoNotRemindAgain' | translate }}
</button>
<!--default cluster tip -->
<div ng-show="pageContext.clusterName == 'default'">
<strong>{{'Config.Note' | translate }}:</strong>
<span translate="Config.ClusterIsDefaultTipContent"
translate-value-name="{{envMapClusters[pageContext.env]}}"></span>
</div>
<!--custom cluster tip-->
<div ng-show="pageContext.clusterName != 'default'">
<strong>{{'Config.Note' | translate }}:</strong>
<span translate="Config.ClusterIsCustomTipContent"
translate-value-name="{{pageContext.clusterName}}"></span>
</div>
</div>
<div class="alert alert-info" ng-if="hasNotPublishNamespace">
<p><b>{{'Config.Note' | translate }}:</b> {{'Config.HasNotPublishNamespace' | translate }}</p>
<p>
<mark ng-bind="namespacePublishInfo.join(',')"></mark>
</p>
</div>
<apollonspanel ng-repeat="namespace in namespaces" namespace="namespace" app-id="pageContext.appId"
env="pageContext.env" lock-check="lockCheck" cluster="pageContext.clusterName" user="currentUser"
pre-release-ns="prepareReleaseNamespace" create-item="createItem" edit-item="editItem"
pre-delete-item="preDeleteItem" pre-revoke-item="preRevokeItem"
show-text="showText"
show-no-modify-permission-dialog="showNoModifyPermissionDialog" show-body="namespaces.length < 3"
lazy-load="namespaces.length > 10" pre-create-branch="preCreateBranch"
pre-delete-branch="preDeleteBranch">
</apollonspanel>
<releasemodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
</releasemodal>
<itemmodal to-operation-namespace="toOperationNamespace" app-id="pageContext.appId" env="pageContext.env"
cluster="pageContext.clusterName" item="item">
</itemmodal>
<showtextmodal text="text"></showtextmodal>
<rollbackmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
</rollbackmodal>
<rulesmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
</rulesmodal>
<mergeandpublishmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
</mergeandpublishmodal>
<publishdenymodal env="pageContext.env"></publishdenymodal>
<deletenamespacemodal env="pageContext.env"></deletenamespacemodal>
<apolloconfirmdialog apollo-dialog-id="'deleteConfirmDialog'"
apollo-title="'Config.DeleteItem.DialogTitle' | translate"
apollo-detail="'Config.DeleteItem.DialogContent' | translate:this" apollo-show-cancel-btn="true"
apollo-confirm="deleteItem"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'releaseNoPermissionDialog'"
apollo-title="'Config.PublishNoPermission.DialogTitle' | translate"
apollo-detail="'Config.PublishNoPermission.DialogContent' | translate:this"
apollo-show-cancel-btn="false">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'modifyNoPermissionDialog'"
apollo-title="'Config.ModifyNoPermission.DialogTitle' | translate"
apollo-detail="'Config.ModifyNoPermission.DialogContent' | translate:this"
apollo-show-cancel-btn="false">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'masterNoPermissionDialog'"
apollo-title="'Config.MasterNoPermission.DialogTitle' | translate"
apollo-detail="'Config.MasterNoPermission.DialogContent' | translate:this"
apollo-show-cancel-btn="false">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'namespaceLockedDialog'"
apollo-title="'Config.NamespaceLocked.DialogTitle' | translate"
apollo-detail="'Config.NamespaceLocked.DialogContent' | translate:this" apollo-show-cancel-btn="false">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'rollbackAlertDialog'"
apollo-title="'Config.RollbackAlert.DialogTitle' | translate"
apollo-detail="'Config.RollbackAlert.DialogContent' | translate" apollo-show-cancel-btn="true"
apollo-confirm="rollback"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'emergencyPublishAlertDialog'"
apollo-title="'Config.EmergencyPublishAlert.DialogTitle' | translate"
apollo-detail="'Config.EmergencyPublishAlert.DialogContent' | translate" apollo-show-cancel-btn="true"
apollo-confirm="emergencyPublish">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'deleteBranchDialog'"
apollo-title="'Config.DeleteBranch.DialogTitle' | translate"
apollo-detail="'Config.DeleteBranch.DialogContent' | translate" apollo-show-cancel-btn="true"
apollo-confirm="deleteBranch">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'updateRuleTips'"
apollo-title="'Config.UpdateRuleTips.DialogTitle' | translate"
apollo-detail="'Config.UpdateRuleTips.DialogContent' | translate"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'mergeAndReleaseDenyDialog'"
apollo-title="'Config.MergeAndReleaseDeny.DialogTitle' | translate"
apollo-detail="'Config.MergeAndReleaseDeny.DialogContent' | translate"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'grayReleaseWithoutRulesTips'"
apollo-title="'Config.GrayReleaseWithoutRulesTips.DialogTitle' | translate"
apollo-detail="'Config.GrayReleaseWithoutRulesTips.DialogContent' | translate">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'deleteNamespaceDenyForMasterInstanceDialog'"
apollo-title="'Config.DeleteNamespaceDenyForMasterInstance.DialogTitle' | translate"
apollo-detail="'Config.DeleteNamespaceDenyForMasterInstance.DialogContent' | translate:this"
apollo-confirm="continueDeleteNamespace">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'deleteNamespaceDenyForBranchInstanceDialog'"
apollo-title="'Config.DeleteNamespaceDenyForBranchInstance.DialogTitle' | translate"
apollo-detail="'Config.DeleteNamespaceDenyForBranchInstance.DialogContent' | translate:this"
apollo-confirm="continueDeleteNamespace">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'deleteNamespaceDenyForPublicNamespaceDialog'"
apollo-title="'Config.DeleteNamespaceDenyForPublicNamespace.DialogTitle' | translate"
apollo-detail="deleteNamespaceContext.detailReason">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'syntaxCheckFailedDialog'"
apollo-title="'Config.SyntaxCheckFailed.DialogTitle' | translate"
apollo-detail="syntaxCheckContext.syntaxCheckMessage" apollo-extra-class="'pre'">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'revokeItemConfirmDialog'"
apollo-title="'Config.RevokeItem.DialogTitle' | translate"
apollo-detail="'Config.RevokeItem.DialogContent' | translate:this" apollo-show-cancel-btn="true"
apollo-confirm="revokeItem">
</apolloconfirmdialog>
<div class="modal fade" id="createBranchTips" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header panel-primary">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">{{'Config.CreateBranchTips.DialogTitle' | translate}}</h4>
</div>
<div class="modal-body" ng-bind-html="'Config.CreateBranchTips.DialogContent' | translate">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{{'Common.Cancel' | translate}}</button>
<button type="button" class="btn btn-primary" data-dismiss="modal"
ng-click="createBranch()">{{'Common.Ok' | translate}}</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div ng-include="'views/common/footer.html'"></div>
<!-- jquery.js -->
<script src="vendor/jquery.min.js" type="text/javascript"></script>
<script src="vendor/select2/select2.min.js" type="text/javascript"></script>
<script src="vendor/jquery-plugin/jquery.textareafullscreen.js" type="text/javascript"></script>
<!--lodash.js-->
<script src="vendor/lodash.min.js" type="text/javascript"></script>
<!--angular-->
<script src="vendor/angular/angular.min.js"></script>
<script src="vendor/angular/angular-resource.min.js"></script>
<script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="vendor/angular/loading-bar.min.js"></script>
<script src="vendor/angular/angular-cookies.min.js"></script>
<script src="vendor/angular/angular-sanitize.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
<!-- bootstrap.js -->
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="vendor/bootstrap/js/bootstrap-treeview.min.js" type="text/javascript"></script>
<script src="vendor/diff.min.js" type="text/javascript"></script>
<script src="vendor/clipboard.min.js" type="text/javascript"></script>
<script src="vendor/ui-ace/ace.js" type="text/javascript"></script>
<script src="vendor/ui-ace/ui-ace.min.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-properties.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-xml.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-yaml.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-json.js" type="text/javascript"></script>
<script src="vendor/ui-ace/worker-json.js" type="text/javascript"></script>
<script src="vendor/ui-ace/worker-xml.js" type="text/javascript"></script>
<!--valdr-->
<script src="vendor/valdr/valdr.min.js" type="text/javascript"></script>
<script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script>
<!--biz script-->
<script type="application/javascript" src="scripts/app.js"></script>
<!--service-->
<script type="application/javascript" src="scripts/services/AppService.js"></script>
<script type="application/javascript" src="scripts/services/EnvService.js"></script>
<script type="application/javascript" src="scripts/services/UserService.js"></script>
<script type="application/javascript" src="scripts/services/ConfigService.js"></script>
<script type="application/javascript" src="scripts/services/ReleaseService.js"></script>
<script type="application/javascript" src="scripts/services/PermissionService.js"></script>
<script type="application/javascript" src="scripts/services/NamespaceService.js"></script>
<script type="application/javascript" src="scripts/services/CommitService.js"></script>
<script type="application/javascript" src="scripts/services/CommonService.js"></script>
<script type="application/javascript" src="scripts/services/NamespaceLockService.js"></script>
<script type="application/javascript" src="scripts/services/InstanceService.js"></script>
<script type="application/javascript" src="scripts/services/FavoriteService.js"></script>
<script type="application/javascript" src="scripts/services/NamespaceBranchService.js"></script>
<script type="application/javascript" src="scripts/services/EventManager.js"></script>
<script type="application/javascript" src="scripts/AppUtils.js"></script>
<!--directive-->
<script type="application/javascript" src="scripts/directive/directive.js"></script>
<script type="application/javascript" src="scripts/directive/namespace-panel-directive.js"></script>
<script type="application/javascript" src="scripts/directive/diff-directive.js"></script>
<script type="application/javascript" src="scripts/directive/release-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/item-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/show-text-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/rollback-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/gray-release-rules-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/merge-and-publish-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/publish-deny-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/delete-namespace-modal-directive.js"></script>
<!--controller-->
<script type="application/javascript" src="scripts/controller/config/ConfigNamespaceController.js"></script>
<script type="application/javascript" src="scripts/controller/config/ConfigBaseInfoController.js"></script>
<script type="application/javascript" src="scripts/PageCommon.js"></script>
<script src="scripts/valdr.js" type="text/javascript"></script>
</body>
</html>
| <!DOCTYPE html>
<html data-ng-app="application">
<head>
<meta charset="UTF-8">
<title>{{'Config.Title' | translate }}</title>
<link rel="icon" href="./img/config.png">
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="vendor/angular/angular-toastr-1.4.1.min.css">
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<link rel="stylesheet" type="text/css" href="vendor/jquery-plugin/textareafullscreen.css">
<link rel="stylesheet" type="text/css" media='all' href="vendor/angular/loading-bar.min.css">
<link rel="stylesheet" type="text/css" href="styles/common-style.css">
</head>
<body>
<apollonav></apollonav>
<div id="config-info" class="apollo-container app">
<div ng-controller="ConfigBaseInfoController">
<div class="J_appNotFound hidden row text-center app-not-found" ng-show="notFoundApp">
<img src="img/404.png">
<br>
<p>
<span ng-bind="pageContext.appId"></span> {{'Config.AppIdNotFound' | translate }}<a
href="app.html">{{'Config.ClickByCreate' | translate }}</a>
</p>
</div>
<div class="side-bar" ng-class="{'position-absolute': viewMode == 1, 'position-fixed': viewMode == 2}">
<div class="J_appFound hidden"
ng-show="!notFoundApp && (viewMode == 1 || (viewMode == 2 && showSideBar))">
<!--env list-->
<section class="panel">
<header class="panel-heading">
{{'Config.EnvList' | translate }}
<span class="pull-right" data-tooltip="tooltip" data-placement="bottom"
title="{{'Config.EnvListTips' | translate }}">
<img src="img/question.png" class="i-20" />
</span>
</header>
<div id="treeview" class="no-radius"></div>
</section>
<!--app info-->
<section class="panel">
<header class="panel-heading">
{{'Config.ProjectInfo' | translate }}
<span class="pull-right">
<a href="app/setting.html?#/appid={{pageContext.appId}}"
style="margin-right: 5px;text-decoration:none;">
<img src="img/edit.png" class="i-20 cursor-pointer" data-tooltip="tooltip"
data-placement="bottom"
title="{{'Config.ModifyBasicProjectInfo' | translate }}" />
</a>
<img src="img/unlike.png" class="i-20 cursor-pointer" ng-if="!favoriteId"
ng-click="addFavorite()" data-tooltip="tooltip" data-placement="bottom"
title="{{'Config.Favorite' | translate }}" />
<img src="img/like.png" class="i-20 cursor-pointer" ng-if="favoriteId"
ng-click="deleteFavorite()" data-tooltip="tooltip" data-placement="bottom"
title="{{'Config.CancelFavorite' | translate }}" />
</span>
</header>
<div class="panel-body">
<table class="project-info">
<tbody class="text-left">
<tr>
<th>{{'Common.AppId' | translate }}:</th>
<td ng-bind="appBaseInfo.appId"></td>
</tr>
<tr>
<th>{{'Common.AppName' | translate }}:</th>
<td>
<small ng-bind="appBaseInfo.name"></small>
</td>
</tr>
<tr>
<th>{{'Common.Department' | translate }}:</th>
<td ng-bind="appBaseInfo.orgInfo"></td>
</tr>
<tr>
<th>{{'Common.AppOwner' | translate }}:</th>
<td ng-bind="appBaseInfo.ownerName"></td>
</tr>
<tr>
<th>{{'Common.Email' | translate }}:</th>
<td>
<small ng-bind="appBaseInfo.ownerEmail"></small>
</td>
</tr>
<tr ng-show="missEnvs.length > 0">
<th>{{'Config.MissEnv' | translate }}:</th>
<td>
<span ng-repeat="env in missEnvs" ng-bind="env">
</span>
</td>
</tr>
<tr ng-show="missingNamespaces.length > 0">
<th>{{'Config.MissNamespace' | translate }}:</th>
<td>
<span ng-repeat="namespace in missingNamespaces" ng-bind="namespace">
</span>
</td>
</tr>
</tbody>
</table>
</div>
</section>
<!--operation entrance-->
<section>
<apolloentrance apollo-title="'Config.ProjectManage' | translate"
apollo-img-src="'project-manage'"
apollo-href="'app/setting.html?#/appid=' + pageContext.appId"></apolloentrance>
<apolloentrance apollo-title="'Config.AccessKeyManage' | translate"
apollo-img-src="'accesskey-manage'"
apollo-href="'app/access_key.html?#/appid=' + pageContext.appId"></apolloentrance>
<a class="list-group-item" ng-show="missEnvs.length > 0" ng-click="createAppInMissEnv()">
<div class="row icon-text icon-plus-orange">
<p class="btn-title ng-binding">{{'Config.CreateAppMissEnv' | translate }}</p>
</div>
</a>
<a class="list-group-item" ng-show="missingNamespaces.length > 0"
ng-click="createMissingNamespaces()">
<div class="row icon-text icon-plus-orange">
<p class="btn-title ng-binding">{{'Config.CreateAppMissNamespace' | translate }}</p>
</div>
</a>
<apolloentrance apollo-title="'Config.AddCluster' | translate" apollo-img-src="'plus-orange'"
apollo-href="'cluster.html?#/appid=' + pageContext.appId"
ng-show="hasCreateClusterPermission"></apolloentrance>
<div class="list-group-item cursor-pointer hover" ng-click="showMasterPermissionTips()"
ng-show="!hasCreateClusterPermission">
<div class="row icon-text icon-plus-orange">
<p class="btn-title">{{'Config.AddCluster' | translate }}</p>
</div>
</div>
<apolloentrance apollo-title="'Config.AddNamespace' | translate" apollo-img-src="'plus-orange'"
apollo-href="'namespace.html?#/appid=' + pageContext.appId"
ng-show="hasCreateNamespacePermission"></apolloentrance>
<div class="list-group-item cursor-pointer hover" ng-click="showMasterPermissionTips()"
ng-show="!hasCreateNamespacePermission">
<div class="row icon-text icon-plus-orange">
<p class="btn-title">{{'Config.AddNamespace' | translate }}</p>
</div>
</div>
</section>
</div>
</div>
</div>
<!--具体配置信息-->
<!--namespaces-->
<div class="config-item-container hide" ng-class="{'view-mode-1': viewMode == 1, 'view-mode-2': viewMode == 2}"
ng-controller="ConfigNamespaceController">
<h4 class="text-center" ng-show="viewMode == 2">
{{'Config.CurrentlyOperatorEnv' | translate }}:{{pageContext.env}},
{{'Common.Cluster' | translate }}:{{pageContext.clusterName}}
</h4>
<div class="alert alert-info alert-dismissible" role="alert"
ng-show="(!hideTip || !hideTip[pageContext.appId][pageContext.clusterName]) && envMapClusters[pageContext.env]">
<button class="btn btn-sm btn-default pull-right" style="margin-top: -7px;margin-right:-15px;"
ng-click="closeTip(pageContext.clusterName)">{{'Config.DoNotRemindAgain' | translate }}
</button>
<!--default cluster tip -->
<div ng-show="pageContext.clusterName == 'default'">
<strong>{{'Config.Note' | translate }}:</strong>
<span translate="Config.ClusterIsDefaultTipContent"
translate-value-name="{{envMapClusters[pageContext.env]}}"></span>
</div>
<!--custom cluster tip-->
<div ng-show="pageContext.clusterName != 'default'">
<strong>{{'Config.Note' | translate }}:</strong>
<span translate="Config.ClusterIsCustomTipContent"
translate-value-name="{{pageContext.clusterName}}"></span>
</div>
</div>
<div class="alert alert-info" ng-if="hasNotPublishNamespace">
<p><b>{{'Config.Note' | translate }}:</b> {{'Config.HasNotPublishNamespace' | translate }}</p>
<p>
<mark ng-bind="namespacePublishInfo.join(',')"></mark>
</p>
</div>
<apollonspanel ng-repeat="namespace in namespaces" namespace="namespace" app-id="pageContext.appId"
env="pageContext.env" lock-check="lockCheck" cluster="pageContext.clusterName" user="currentUser"
pre-release-ns="prepareReleaseNamespace" create-item="createItem" edit-item="editItem"
pre-delete-item="preDeleteItem" pre-revoke-item="preRevokeItem"
show-text="showText"
show-no-modify-permission-dialog="showNoModifyPermissionDialog" show-body="namespaces.length < 3"
lazy-load="namespaces.length > 10" pre-create-branch="preCreateBranch"
pre-delete-branch="preDeleteBranch">
</apollonspanel>
<releasemodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
</releasemodal>
<itemmodal to-operation-namespace="toOperationNamespace" app-id="pageContext.appId" env="pageContext.env"
cluster="pageContext.clusterName" item="item">
</itemmodal>
<showtextmodal text="text"></showtextmodal>
<rollbackmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
</rollbackmodal>
<rulesmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
</rulesmodal>
<mergeandpublishmodal app-id="pageContext.appId" env="pageContext.env" cluster="pageContext.clusterName">
</mergeandpublishmodal>
<publishdenymodal env="pageContext.env"></publishdenymodal>
<deletenamespacemodal env="pageContext.env"></deletenamespacemodal>
<apolloconfirmdialog apollo-dialog-id="'deleteConfirmDialog'"
apollo-title="'Config.DeleteItem.DialogTitle' | translate"
apollo-detail="'Config.DeleteItem.DialogContent' | translate:this" apollo-show-cancel-btn="true"
apollo-confirm="deleteItem"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'releaseNoPermissionDialog'"
apollo-title="'Config.PublishNoPermission.DialogTitle' | translate"
apollo-detail="'Config.PublishNoPermission.DialogContent' | translate:this"
apollo-show-cancel-btn="false">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'modifyNoPermissionDialog'"
apollo-title="'Config.ModifyNoPermission.DialogTitle' | translate"
apollo-detail="'Config.ModifyNoPermission.DialogContent' | translate:this"
apollo-show-cancel-btn="false">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'masterNoPermissionDialog'"
apollo-title="'Config.MasterNoPermission.DialogTitle' | translate"
apollo-detail="'Config.MasterNoPermission.DialogContent' | translate:this"
apollo-show-cancel-btn="false">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'namespaceLockedDialog'"
apollo-title="'Config.NamespaceLocked.DialogTitle' | translate"
apollo-detail="'Config.NamespaceLocked.DialogContent' | translate:this" apollo-show-cancel-btn="false">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'rollbackAlertDialog'"
apollo-title="'Config.RollbackAlert.DialogTitle' | translate"
apollo-detail="'Config.RollbackAlert.DialogContent' | translate" apollo-show-cancel-btn="true"
apollo-confirm="rollback"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'emergencyPublishAlertDialog'"
apollo-title="'Config.EmergencyPublishAlert.DialogTitle' | translate"
apollo-detail="'Config.EmergencyPublishAlert.DialogContent' | translate" apollo-show-cancel-btn="true"
apollo-confirm="emergencyPublish">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'deleteBranchDialog'"
apollo-title="'Config.DeleteBranch.DialogTitle' | translate"
apollo-detail="'Config.DeleteBranch.DialogContent' | translate" apollo-show-cancel-btn="true"
apollo-confirm="deleteBranch">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'updateRuleTips'"
apollo-title="'Config.UpdateRuleTips.DialogTitle' | translate"
apollo-detail="'Config.UpdateRuleTips.DialogContent' | translate"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'mergeAndReleaseDenyDialog'"
apollo-title="'Config.MergeAndReleaseDeny.DialogTitle' | translate"
apollo-detail="'Config.MergeAndReleaseDeny.DialogContent' | translate"></apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'grayReleaseWithoutRulesTips'"
apollo-title="'Config.GrayReleaseWithoutRulesTips.DialogTitle' | translate"
apollo-detail="'Config.GrayReleaseWithoutRulesTips.DialogContent' | translate">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'deleteNamespaceDenyForMasterInstanceDialog'"
apollo-title="'Config.DeleteNamespaceDenyForMasterInstance.DialogTitle' | translate"
apollo-detail="'Config.DeleteNamespaceDenyForMasterInstance.DialogContent' | translate:this"
apollo-confirm="continueDeleteNamespace">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'deleteNamespaceDenyForBranchInstanceDialog'"
apollo-title="'Config.DeleteNamespaceDenyForBranchInstance.DialogTitle' | translate"
apollo-detail="'Config.DeleteNamespaceDenyForBranchInstance.DialogContent' | translate:this"
apollo-confirm="continueDeleteNamespace">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'deleteNamespaceDenyForPublicNamespaceDialog'"
apollo-title="'Config.DeleteNamespaceDenyForPublicNamespace.DialogTitle' | translate"
apollo-detail="deleteNamespaceContext.detailReason">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'syntaxCheckFailedDialog'"
apollo-title="'Config.SyntaxCheckFailed.DialogTitle' | translate"
apollo-detail="syntaxCheckContext.syntaxCheckMessage" apollo-extra-class="'pre'">
</apolloconfirmdialog>
<apolloconfirmdialog apollo-dialog-id="'revokeItemConfirmDialog'"
apollo-title="'Config.RevokeItem.DialogTitle' | translate"
apollo-detail="'Config.RevokeItem.DialogContent' | translate:this" apollo-show-cancel-btn="true"
apollo-confirm="revokeItem">
</apolloconfirmdialog>
<div class="modal fade" id="createBranchTips" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header panel-primary">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">{{'Config.CreateBranchTips.DialogTitle' | translate}}</h4>
</div>
<div class="modal-body" ng-bind-html="'Config.CreateBranchTips.DialogContent' | translate">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">{{'Common.Cancel' | translate}}</button>
<button type="button" class="btn btn-primary" data-dismiss="modal"
ng-click="createBranch()">{{'Common.Ok' | translate}}</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div ng-include="'views/common/footer.html'"></div>
<!-- jquery.js -->
<script src="vendor/jquery.min.js" type="text/javascript"></script>
<script src="vendor/select2/select2.min.js" type="text/javascript"></script>
<script src="vendor/jquery-plugin/jquery.textareafullscreen.js" type="text/javascript"></script>
<!--lodash.js-->
<script src="vendor/lodash.min.js" type="text/javascript"></script>
<!--angular-->
<script src="vendor/angular/angular.min.js"></script>
<script src="vendor/angular/angular-resource.min.js"></script>
<script src="vendor/angular/angular-toastr-1.4.1.tpls.min.js"></script>
<script src="vendor/angular/loading-bar.min.js"></script>
<script src="vendor/angular/angular-cookies.min.js"></script>
<script src="vendor/angular/angular-sanitize.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-loader-static-files.min.js"></script>
<script src="vendor/angular/angular-translate.2.18.1/angular-translate-storage-cookie.min.js"></script>
<!-- bootstrap.js -->
<script src="vendor/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<script src="vendor/bootstrap/js/bootstrap-treeview.min.js" type="text/javascript"></script>
<script src="vendor/diff.min.js" type="text/javascript"></script>
<script src="vendor/clipboard.min.js" type="text/javascript"></script>
<script src="vendor/ui-ace/ace.js" type="text/javascript"></script>
<script src="vendor/ui-ace/ui-ace.min.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-properties.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-xml.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-yaml.js" type="text/javascript"></script>
<script src="vendor/ui-ace/mode-json.js" type="text/javascript"></script>
<script src="vendor/ui-ace/worker-json.js" type="text/javascript"></script>
<script src="vendor/ui-ace/worker-xml.js" type="text/javascript"></script>
<!--valdr-->
<script src="vendor/valdr/valdr.min.js" type="text/javascript"></script>
<script src="vendor/valdr/valdr-message.min.js" type="text/javascript"></script>
<!--biz script-->
<script type="application/javascript" src="scripts/app.js"></script>
<!--service-->
<script type="application/javascript" src="scripts/services/AppService.js"></script>
<script type="application/javascript" src="scripts/services/EnvService.js"></script>
<script type="application/javascript" src="scripts/services/UserService.js"></script>
<script type="application/javascript" src="scripts/services/ConfigService.js"></script>
<script type="application/javascript" src="scripts/services/ReleaseService.js"></script>
<script type="application/javascript" src="scripts/services/PermissionService.js"></script>
<script type="application/javascript" src="scripts/services/NamespaceService.js"></script>
<script type="application/javascript" src="scripts/services/CommitService.js"></script>
<script type="application/javascript" src="scripts/services/CommonService.js"></script>
<script type="application/javascript" src="scripts/services/NamespaceLockService.js"></script>
<script type="application/javascript" src="scripts/services/InstanceService.js"></script>
<script type="application/javascript" src="scripts/services/FavoriteService.js"></script>
<script type="application/javascript" src="scripts/services/NamespaceBranchService.js"></script>
<script type="application/javascript" src="scripts/services/EventManager.js"></script>
<script type="application/javascript" src="scripts/AppUtils.js"></script>
<!--directive-->
<script type="application/javascript" src="scripts/directive/directive.js"></script>
<script type="application/javascript" src="scripts/directive/namespace-panel-directive.js"></script>
<script type="application/javascript" src="scripts/directive/diff-directive.js"></script>
<script type="application/javascript" src="scripts/directive/release-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/item-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/show-text-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/rollback-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/gray-release-rules-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/merge-and-publish-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/publish-deny-modal-directive.js"></script>
<script type="application/javascript" src="scripts/directive/delete-namespace-modal-directive.js"></script>
<!--controller-->
<script type="application/javascript" src="scripts/controller/config/ConfigNamespaceController.js"></script>
<script type="application/javascript" src="scripts/controller/config/ConfigBaseInfoController.js"></script>
<script type="application/javascript" src="scripts/PageCommon.js"></script>
<script src="scripts/valdr.js" type="text/javascript"></script>
</body>
</html>
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/main/java/com/ctrip/framework/apollo/biz/message/DatabaseMessageSender.java | package com.ctrip.framework.apollo.biz.message;
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository;
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory;
import com.ctrip.framework.apollo.tracer.Tracer;
import com.ctrip.framework.apollo.tracer.spi.Transaction;
import com.google.common.collect.Queues;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* @author Jason Song([email protected])
*/
@Component
public class DatabaseMessageSender implements MessageSender {
private static final Logger logger = LoggerFactory.getLogger(DatabaseMessageSender.class);
private static final int CLEAN_QUEUE_MAX_SIZE = 100;
private BlockingQueue<Long> toClean = Queues.newLinkedBlockingQueue(CLEAN_QUEUE_MAX_SIZE);
private final ExecutorService cleanExecutorService;
private final AtomicBoolean cleanStopped;
private final ReleaseMessageRepository releaseMessageRepository;
public DatabaseMessageSender(final ReleaseMessageRepository releaseMessageRepository) {
cleanExecutorService = Executors.newSingleThreadExecutor(ApolloThreadFactory.create("DatabaseMessageSender", true));
cleanStopped = new AtomicBoolean(false);
this.releaseMessageRepository = releaseMessageRepository;
}
@Override
@Transactional
public void sendMessage(String message, String channel) {
logger.info("Sending message {} to channel {}", message, channel);
if (!Objects.equals(channel, Topics.APOLLO_RELEASE_TOPIC)) {
logger.warn("Channel {} not supported by DatabaseMessageSender!", channel);
return;
}
Tracer.logEvent("Apollo.AdminService.ReleaseMessage", message);
Transaction transaction = Tracer.newTransaction("Apollo.AdminService", "sendMessage");
try {
ReleaseMessage newMessage = releaseMessageRepository.save(new ReleaseMessage(message));
toClean.offer(newMessage.getId());
transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
logger.error("Sending message to database failed", ex);
transaction.setStatus(ex);
throw ex;
} finally {
transaction.complete();
}
}
@PostConstruct
private void initialize() {
cleanExecutorService.submit(() -> {
while (!cleanStopped.get() && !Thread.currentThread().isInterrupted()) {
try {
Long rm = toClean.poll(1, TimeUnit.SECONDS);
if (rm != null) {
cleanMessage(rm);
} else {
TimeUnit.SECONDS.sleep(5);
}
} catch (Throwable ex) {
Tracer.logError(ex);
}
}
});
}
private void cleanMessage(Long id) {
//double check in case the release message is rolled back
ReleaseMessage releaseMessage = releaseMessageRepository.findById(id).orElse(null);
if (releaseMessage == null) {
return;
}
boolean hasMore = true;
while (hasMore && !Thread.currentThread().isInterrupted()) {
List<ReleaseMessage> messages = releaseMessageRepository.findFirst100ByMessageAndIdLessThanOrderByIdAsc(
releaseMessage.getMessage(), releaseMessage.getId());
releaseMessageRepository.deleteAll(messages);
hasMore = messages.size() == 100;
messages.forEach(toRemove -> Tracer.logEvent(
String.format("ReleaseMessage.Clean.%s", toRemove.getMessage()), String.valueOf(toRemove.getId())));
}
}
void stopClean() {
cleanStopped.set(true);
}
}
| package com.ctrip.framework.apollo.biz.message;
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import com.ctrip.framework.apollo.biz.repository.ReleaseMessageRepository;
import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory;
import com.ctrip.framework.apollo.tracer.Tracer;
import com.ctrip.framework.apollo.tracer.spi.Transaction;
import com.google.common.collect.Queues;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* @author Jason Song([email protected])
*/
@Component
public class DatabaseMessageSender implements MessageSender {
private static final Logger logger = LoggerFactory.getLogger(DatabaseMessageSender.class);
private static final int CLEAN_QUEUE_MAX_SIZE = 100;
private BlockingQueue<Long> toClean = Queues.newLinkedBlockingQueue(CLEAN_QUEUE_MAX_SIZE);
private final ExecutorService cleanExecutorService;
private final AtomicBoolean cleanStopped;
private final ReleaseMessageRepository releaseMessageRepository;
public DatabaseMessageSender(final ReleaseMessageRepository releaseMessageRepository) {
cleanExecutorService = Executors.newSingleThreadExecutor(ApolloThreadFactory.create("DatabaseMessageSender", true));
cleanStopped = new AtomicBoolean(false);
this.releaseMessageRepository = releaseMessageRepository;
}
@Override
@Transactional
public void sendMessage(String message, String channel) {
logger.info("Sending message {} to channel {}", message, channel);
if (!Objects.equals(channel, Topics.APOLLO_RELEASE_TOPIC)) {
logger.warn("Channel {} not supported by DatabaseMessageSender!", channel);
return;
}
Tracer.logEvent("Apollo.AdminService.ReleaseMessage", message);
Transaction transaction = Tracer.newTransaction("Apollo.AdminService", "sendMessage");
try {
ReleaseMessage newMessage = releaseMessageRepository.save(new ReleaseMessage(message));
toClean.offer(newMessage.getId());
transaction.setStatus(Transaction.SUCCESS);
} catch (Throwable ex) {
logger.error("Sending message to database failed", ex);
transaction.setStatus(ex);
throw ex;
} finally {
transaction.complete();
}
}
@PostConstruct
private void initialize() {
cleanExecutorService.submit(() -> {
while (!cleanStopped.get() && !Thread.currentThread().isInterrupted()) {
try {
Long rm = toClean.poll(1, TimeUnit.SECONDS);
if (rm != null) {
cleanMessage(rm);
} else {
TimeUnit.SECONDS.sleep(5);
}
} catch (Throwable ex) {
Tracer.logError(ex);
}
}
});
}
private void cleanMessage(Long id) {
//double check in case the release message is rolled back
ReleaseMessage releaseMessage = releaseMessageRepository.findById(id).orElse(null);
if (releaseMessage == null) {
return;
}
boolean hasMore = true;
while (hasMore && !Thread.currentThread().isInterrupted()) {
List<ReleaseMessage> messages = releaseMessageRepository.findFirst100ByMessageAndIdLessThanOrderByIdAsc(
releaseMessage.getMessage(), releaseMessage.getId());
releaseMessageRepository.deleteAll(messages);
hasMore = messages.size() == 100;
messages.forEach(toRemove -> Tracer.logEvent(
String.format("ReleaseMessage.Clean.%s", toRemove.getMessage()), String.valueOf(toRemove.getId())));
}
}
void stopClean() {
cleanStopped.set(true);
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/SystemInfoController.java | package com.ctrip.framework.apollo.portal.controller;
import com.ctrip.framework.apollo.Apollo;
import com.ctrip.framework.apollo.portal.environment.PortalMetaDomainService;
import com.ctrip.framework.apollo.core.dto.ServiceDTO;
import com.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.portal.component.PortalSettings;
import com.ctrip.framework.apollo.portal.component.RestTemplateFactory;
import com.ctrip.framework.apollo.portal.entity.vo.EnvironmentInfo;
import com.ctrip.framework.apollo.portal.entity.vo.SystemInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.actuate.health.Health;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
import java.util.List;
@RestController
@RequestMapping("/system-info")
public class SystemInfoController {
private static final Logger logger = LoggerFactory.getLogger(SystemInfoController.class);
private static final String CONFIG_SERVICE_URL_PATH = "/services/config";
private static final String ADMIN_SERVICE_URL_PATH = "/services/admin";
private RestTemplate restTemplate;
private final PortalSettings portalSettings;
private final RestTemplateFactory restTemplateFactory;
private final PortalMetaDomainService portalMetaDomainService;
public SystemInfoController(
final PortalSettings portalSettings,
final RestTemplateFactory restTemplateFactory,
final PortalMetaDomainService portalMetaDomainService
) {
this.portalSettings = portalSettings;
this.restTemplateFactory = restTemplateFactory;
this.portalMetaDomainService = portalMetaDomainService;
}
@PostConstruct
private void init() {
restTemplate = restTemplateFactory.getObject();
}
@PreAuthorize(value = "@permissionValidator.isSuperAdmin()")
@GetMapping
public SystemInfo getSystemInfo() {
SystemInfo systemInfo = new SystemInfo();
String version = Apollo.VERSION;
if (isValidVersion(version)) {
systemInfo.setVersion(version);
}
List<Env> allEnvList = portalSettings.getAllEnvs();
for (Env env : allEnvList) {
EnvironmentInfo environmentInfo = adaptEnv2EnvironmentInfo(env);
systemInfo.addEnvironment(environmentInfo);
}
return systemInfo;
}
@PreAuthorize(value = "@permissionValidator.isSuperAdmin()")
@GetMapping(value = "/health")
public Health checkHealth(@RequestParam String instanceId) {
List<Env> allEnvs = portalSettings.getAllEnvs();
ServiceDTO service = null;
for (final Env env : allEnvs) {
EnvironmentInfo envInfo = adaptEnv2EnvironmentInfo(env);
if (envInfo.getAdminServices() != null) {
for (final ServiceDTO s : envInfo.getAdminServices()) {
if (instanceId.equals(s.getInstanceId())) {
service = s;
break;
}
}
}
if (envInfo.getConfigServices() != null) {
for (final ServiceDTO s : envInfo.getConfigServices()) {
if (instanceId.equals(s.getInstanceId())) {
service = s;
break;
}
}
}
}
if (service == null) {
throw new IllegalArgumentException("No such instance of instanceId: " + instanceId);
}
return restTemplate.getForObject(service.getHomepageUrl() + "/health", Health.class);
}
private EnvironmentInfo adaptEnv2EnvironmentInfo(final Env env) {
EnvironmentInfo environmentInfo = new EnvironmentInfo();
String metaServerAddresses = portalMetaDomainService.getMetaServerAddress(env);
environmentInfo.setEnv(env);
environmentInfo.setActive(portalSettings.isEnvActive(env));
environmentInfo.setMetaServerAddress(metaServerAddresses);
String selectedMetaServerAddress = portalMetaDomainService.getDomain(env);
try {
environmentInfo.setConfigServices(getServerAddress(selectedMetaServerAddress, CONFIG_SERVICE_URL_PATH));
environmentInfo.setAdminServices(getServerAddress(selectedMetaServerAddress, ADMIN_SERVICE_URL_PATH));
} catch (Throwable ex) {
String errorMessage = "Loading config/admin services from meta server: " + selectedMetaServerAddress + " failed!";
logger.error(errorMessage, ex);
environmentInfo.setErrorMessage(errorMessage + " Exception: " + ex.getMessage());
}
return environmentInfo;
}
private ServiceDTO[] getServerAddress(String metaServerAddress, String path) {
String url = metaServerAddress + path;
return restTemplate.getForObject(url, ServiceDTO[].class);
}
private boolean isValidVersion(String version) {
return !version.equals("java-null");
}
}
| package com.ctrip.framework.apollo.portal.controller;
import com.ctrip.framework.apollo.Apollo;
import com.ctrip.framework.apollo.portal.environment.PortalMetaDomainService;
import com.ctrip.framework.apollo.core.dto.ServiceDTO;
import com.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.portal.component.PortalSettings;
import com.ctrip.framework.apollo.portal.component.RestTemplateFactory;
import com.ctrip.framework.apollo.portal.entity.vo.EnvironmentInfo;
import com.ctrip.framework.apollo.portal.entity.vo.SystemInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.actuate.health.Health;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
import java.util.List;
@RestController
@RequestMapping("/system-info")
public class SystemInfoController {
private static final Logger logger = LoggerFactory.getLogger(SystemInfoController.class);
private static final String CONFIG_SERVICE_URL_PATH = "/services/config";
private static final String ADMIN_SERVICE_URL_PATH = "/services/admin";
private RestTemplate restTemplate;
private final PortalSettings portalSettings;
private final RestTemplateFactory restTemplateFactory;
private final PortalMetaDomainService portalMetaDomainService;
public SystemInfoController(
final PortalSettings portalSettings,
final RestTemplateFactory restTemplateFactory,
final PortalMetaDomainService portalMetaDomainService
) {
this.portalSettings = portalSettings;
this.restTemplateFactory = restTemplateFactory;
this.portalMetaDomainService = portalMetaDomainService;
}
@PostConstruct
private void init() {
restTemplate = restTemplateFactory.getObject();
}
@PreAuthorize(value = "@permissionValidator.isSuperAdmin()")
@GetMapping
public SystemInfo getSystemInfo() {
SystemInfo systemInfo = new SystemInfo();
String version = Apollo.VERSION;
if (isValidVersion(version)) {
systemInfo.setVersion(version);
}
List<Env> allEnvList = portalSettings.getAllEnvs();
for (Env env : allEnvList) {
EnvironmentInfo environmentInfo = adaptEnv2EnvironmentInfo(env);
systemInfo.addEnvironment(environmentInfo);
}
return systemInfo;
}
@PreAuthorize(value = "@permissionValidator.isSuperAdmin()")
@GetMapping(value = "/health")
public Health checkHealth(@RequestParam String instanceId) {
List<Env> allEnvs = portalSettings.getAllEnvs();
ServiceDTO service = null;
for (final Env env : allEnvs) {
EnvironmentInfo envInfo = adaptEnv2EnvironmentInfo(env);
if (envInfo.getAdminServices() != null) {
for (final ServiceDTO s : envInfo.getAdminServices()) {
if (instanceId.equals(s.getInstanceId())) {
service = s;
break;
}
}
}
if (envInfo.getConfigServices() != null) {
for (final ServiceDTO s : envInfo.getConfigServices()) {
if (instanceId.equals(s.getInstanceId())) {
service = s;
break;
}
}
}
}
if (service == null) {
throw new IllegalArgumentException("No such instance of instanceId: " + instanceId);
}
return restTemplate.getForObject(service.getHomepageUrl() + "/health", Health.class);
}
private EnvironmentInfo adaptEnv2EnvironmentInfo(final Env env) {
EnvironmentInfo environmentInfo = new EnvironmentInfo();
String metaServerAddresses = portalMetaDomainService.getMetaServerAddress(env);
environmentInfo.setEnv(env);
environmentInfo.setActive(portalSettings.isEnvActive(env));
environmentInfo.setMetaServerAddress(metaServerAddresses);
String selectedMetaServerAddress = portalMetaDomainService.getDomain(env);
try {
environmentInfo.setConfigServices(getServerAddress(selectedMetaServerAddress, CONFIG_SERVICE_URL_PATH));
environmentInfo.setAdminServices(getServerAddress(selectedMetaServerAddress, ADMIN_SERVICE_URL_PATH));
} catch (Throwable ex) {
String errorMessage = "Loading config/admin services from meta server: " + selectedMetaServerAddress + " failed!";
logger.error(errorMessage, ex);
environmentInfo.setErrorMessage(errorMessage + " Exception: " + ex.getMessage());
}
return environmentInfo;
}
private ServiceDTO[] getServerAddress(String metaServerAddress, String path) {
String url = metaServerAddress + path;
return restTemplate.getForObject(url, ServiceDTO[].class);
}
private boolean isValidVersion(String version) {
return !version.equals("java-null");
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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-net-server-url-config.png | PNG
IHDR F )!}
iCCPICC Profile HT[Lz$! ҫ@z *6D',"CbCA/CA]DEeX¾ݳgs͝o3? ~P
&3cb8 @es2n W}xdֿ_&dr fr>EP
"K8eEHn?='<a d6[ #gfs:d:f._'p>ҧT'/55$)ϼ˴La*{[igh!A|CYmJANϟf7b9e{ϲ8%m٢{YYJRXRN
D7ksxQ͏̔09ҼH*9Q-}Ǵ̹8ge}zM,wiMaj\>|fv,d_\` O H ]e%Gpb!&pL3-m ڃ3Cނ\a "IsvR$ w
?8bQL=u "tԁ60 &H6" b2<D`X6PݠTC'A38.6@k0
> pAJCyAP(AI CkPTCUP+t݄ 4(a5X^ n?/8·ep5|n/÷~
b4Q&(;*JDPPRT5Պ@CIPoP_X4
DѾ4^.FkM{(Qc0,L4& S)``a`0X,bcb~l#
ۍĎp8%1 cpcK3[x>_?OBKXEF8Lh%!&D}1L@,#6?H$-=)'H'H7H/d*وA^B(ŕKɢlQPQ>dLeX2\22M2=2oe ndsdKeOޑ}#Gӓc˭;+'7&O7O/?*S~Q\j>
ui<hFa5Kק"qz}T`RBႂb1XT6IF/<ynm0gbbbůJL%/JJOF!+(_S~BWqTTy
V=ک:&T۫vE:CU=Y}E
_c%WL3YƼTkViviNhkEhi5j=&ji'jnYF^.ANGCw\O_/Jo^ް>K?G^ à!0p]#ڈgTat617o?_0z~ $ۤda`glv;t,afmjv9<ϼǢ%re;+cV4E֛ۭڈllFlullnc۟`pOGǣ&,<pIˉT$qf:9th]]jr]k\_%s{n.r?>֣YE*z]=cڧ÷X~~kZ\$P7PXA;gT5]F[v4S{H%uQQ%Qko(cZbq5c^<zIޥKW.LyYeEbWYG9=\W.HSBIDĒ$I#<^)
߃_\<r$e25*1
vV@L"QM&4%Nxx 9"Vʯ\ej˪99Fn_fÚnkA^~('vqCʆJ>nؚ?gS}Loʟ?be[EfEEߊ9ŷ~6ɭ[l;]wˎv6b*q7KJ+HZݾ[9A{E>}[9zRA*jCCه^</u55E5ߏHjCkU=[rq-
&
UƢī_~=ݩӺ)lV56%-1-gζ:9gzy.lHqRΥ6aۛIۗ?}Ր]ݸ}J[ǥN7tyݭ6:;fۙ.;wZm^}ǥ={~7oI?0Gُ&><)|*
oH.xt>{x3?
忠(}nbW_
xS7{kvF|_AÑVǂǞ}J41^Ys/_X
?LMN
"@!'" (1 @ӂf|43>zZs ){ }ev 2--fjkR:98C MNN4ON~A}O3|Jr?Xacfֳ&At ;IDATx}],uU{D~PR"_ğCHb;BX)RD xJĀHQhdc{WouksSݵo}=<̀0f3`́0f3`
0f3`̀0f3`Ȁ?J#+<x13`x"+
f^Q}>/֫]DBf* >\J31瘯w|}8f3`.jco}ib1StJ+@Gc?3`̀0kdQov=*<<Xp2Qc0fKaZSTipG)3
we}O1>ӟ6SGG;c 뺐P&nw
{r
f3`j=1~p<ՊJ,68M @>L:F,:8#om®qͭj^:3`̀0#0FF
Z";ti<
ĺ3p0t
gW_̀0fE?X\,ݑϸ'`mͺZ]0f\#OOH1,r][2&D `é_Tڦ1̀0f1Bku#4ΰqY>E;6(4Y<mR\-O5&Z-).ߊg?3`̀0kdWO53`̀0ga,80f3`Ȁ3f3`pcp5f3`pctF3`̀Xnu3`̀8#nHS3`̀0b mJ]3Gtsp*u.{v0fkc-}h(HpM)1ν'3`̀0Rjs 9){f36}uŧ&DmSY ¸hW=c|)r2y18juh|v0f30dyG&u
'M\5bZǚJPLk#~v.ײ0f30'7-1(~h|m=ķ1Tu|3esQƎmf3`e1hRPii.ZI<hVì0f@?#Oic&f
lbN5)X40fak
7g}-!^ȫѦh8E;c58n<n٩טyWl̀0fHҞƂ
|̀0f2pe}3`̀00p470f3`(+3`̀0fl7F9k3`̀aQA63`̀0av;5f3`z=m6lF-uK7G5f3Vh:4CCPe6
ͥC-X>Ͼf3`*%.հrϥss45f-0p1ʚ"}&Fu<}O8+6}TG|51>jW1Θ˱Wx6f3`8kcݼq 6n0KvbjX毭KX5a}-3`̀0]w>`"Ok͑+Ssg~jCĺHY3`@gmPb6mUk2ơODbʏ)R66f3*~͑]j:w6@uiE7Ed³0fgbM }K̀61|8榽FcFE]3xȑ?x6f3`XUcV84,RqQ}N3`̀05F$6@riܻ^3`̀.ms3`̀0f`nVsof3`̀haQK1f3`6M7ì0f0ƨ%3`̀0`|}NKSUypuaqxK8ԛd>w'<nu\2fs8t} o~SZ\#/:O!^`-w&})j,}k0f`l1ZKS7]Izf`ls7ECO$bD=h51TO8?1zF[ă\j6U48!d`ЇxO%L?I=fTWZ+n)F9tl0{3`NbцwDȥ? *c|)ay!OmAZ/bX5}͏:|W[m
,)v\G?u]vbGʺ.at.X[)OElأ.c3kW:3` #2C!62[-U_8b<Ѿ9ߘ=%pA|yl=_:l1vl̀ ja^(nCo͘R{)̑oSt쥿̀3fsTeȿPK-:mRϦrm`ͧg\KZK)Zt{ /-ubfXCe8jSvSr}f"[zC-:RѲat%Rm">W{ѧ636QhaQXQV,2e3qԧ'1ӧfF=k Nf)AF;ƒשj60f`ӍѺfp7/f0]l0f`K1i7Eygg;4fpcT3`̀0f`cl7vޮ0f3ȀFf̀0f\?nC3`̀0f7FD]nnp^X9.Xk#kkf̀0'1oV|ʧ=
_g#g/mq?0siᣄvXJKyZŜ~esJkmZVZ>aNflQ|Co%16g?o[6P7#XRzro<qX#gs--T8-c6dc6f|J9Lqؙols{6sX5Q'tsɿ3^CX̀0lڛ+GaXǧ?j]GfSq]:wDhV#C oeR-&%KSGLFa}*9Cy3Q9a_ʁb`XSSam2({3Fs͐ʺePfkJPWr[TAI>R@yE,4ʱ($mQ2ܶ>Hn(D>̀0}l18iG$;~Ŏ,r$zxzS㭄l(Tc\oHn3p=l1±i_Q, 6;L!o(Q.[Ja=([.NQ,4Z0[|v0c`sozҦhˀG{aZŭM{DzDŽ?tMZ/qKỳ8?Odj)Q[xz7aGS?p-Zҟ~F{+cO
E`W[)'1Ҷ-J4+^´31(#fնY̶j\0kbʅa`ct,4ڼ6S1=-*q̀0ʀ)^3`̀0fO6}0f31R66f3`6̀M7ò0f(n+_?IiWφEn")✸ y\/IԘg`_Hf1^]G#balwͲɏ@ x\ι=tFjx-zŅ?}x6gϿ01?-ϪOs9"GεXGZf`l7RCċ'g?ԑzl6g G\Č %;p!YhYރ8lxϖO08B%avvU5φX 9t
eWm[g`s(p!0#_q8nPGȻʈr4+䑡AwSh;
\́Y*yXwC:A?!zQ;g2Q/gaQ`-B&U&5_ŦEe6"NC1:A?!zQ;Ĝ
oL
1kd`SdjohnRY8Dm2[Ӂޝb嶨|X
.ɇ90k?ڣ\È}17j& rLRRbq+
5bUρ8#7u#ԷZb!s1707l1iӳER{4tR\!*]H565>.`,1Q_AD95m*-뤊^Le^zH+Cj%=΅]g6@&P{3Ч?4HٻwTL#ʗp!U# X guPSk)*hX:7)-2ŷŧ%OK.kc`?|7&MbBJb|;gگa
tK~joY+F)G|5f2?$Gs
krK%8bYRkG1J9jqQ86l?oDGl-4ΧN}"P,>&%BaFsbcAhz/}zMF35bR&`RNb4
vڨ5gƨTy\O34VmGW"n.|g[07kb5kD6Q%ԾfB8/ì8i 5aO6sި0f3ǀ1d0f3m樽Q3`̀0f7F}ǹ0fl7F9jo3`̀c`s|෭opt3٣|Q̰5F_헴
Ne9[ߘY2[x;5%>{mگ9b,>11/D}1zn-&jV\{h?ԏowI{6~װDK:RЭ}\/}Wd
Zj={kkP?<}}qO@vÇѭ'nͻC:݇wr(D`{@gRjg*dجvr ƣDEs\I{Twk\4SW=/u>
9ݙ躯hcwf]}=u;AA}sOҮ݈>ԫ:Fyؔ9ǻevEP_]33)TO8Y`hܘ=%y5@>;:3P8QOd]#rhy c2sb,NmG}ȧxGmZq?}39ڈU^hי/}f]Wڨa¿_K=|c8 >鿗wO;ow?c~κwOB)&Xa'Nԕbh?(ma朧h.x{яt~ɵ̀0f,[[X
wv_v?x>fz6.pU9D#F3oHwfHy+Ԟf+)3`.绯]{|{駻'x9ucbg,fK>݉!M)M^tc|xR>c}/to?|u";W[9b{{5*zmj~q-զk+Г+1ߍZlԫ,w^[[ûFdsuQfl3hSY[#^1&OU9,K:e6'G%}r ;"FfW_]g1eE[M_3u۟|}:|?({go7V[oe<v._~vz^|/Qʺb&c|(ɌsRYs*֓a_ic*Q&Fʺ9e97Eߘf.ƩRhW|8UiKr_\3s~:bOV:ØV4o_ާs?=s'G{[lK?Ne]l~VsLnvݯ?_?SGCk{tkb,=>ve7o
Q}EJ㩃OMO>;q%ӕ|"&W}_K[XbRF\EY}f3}Ԯ6ӗ_3ٜŕlyՎZK=4~c*KqGcìC}WlG^EN8Ǹv5skb®6Gm-:4X@c?S7OٮVw{?yTB|f>Fя2p#ts"v.'{Wԟ~;߹_gO8cC(,q(/Qs)=
?}O}rk{_۽=vz'|Ԧmc.gWqA#~H
M;fOv/w?nk}=u/ݗ?r=|;㯏<0ܿtϰ{E7F\D}~Y1[<9p\뾖8*sαh>!ǭk4Dn̾(4،?xyv3`{ftrdS9ƨ9Ѝì0fbK5f3`eѼ
?yUŹ^xn{.́| Wk#b_/.9*טeщ<C~ݍelG|M~2LOs.EᣄuffСx|Fl$7c"yH(߸Q AgF=S=Z]5[Md^kl)Y\f+aEcl9ejKZ^>1{"of~39]-ֶy[zSumBh食m
XtK mƲY-S"DŽY12[
,.ei}ql9e2$־c`_8}mαrGߛ6xn/z/}RfˮV1.#Sqw);KΥ}7<.}Vxqd(GmlW\+FyJyAY^!R^O}4p1&K ։5u{\ڃZz
A#E`%],.LEhD}I&c(kʡ6aebG=k2[K3[ z2jXΥQ76.5X/F!u#F(5g}E.EMTRuI>
X́n7{g-Q \J@ڢ1ne2kbRV>[bu"Δr7jqcpkQØ16pWarl1.L6E,rWJ핫Ŏ,r$ܪ~ptƏ)6#qj].rҶtSjݵz3)9[cjf21/kZէ?4H(6jTL#ʕncͣtP}(@u$܁6_.ju[+]}m}8J~V]->k\cCRߔ)ZB`}h/lP~Do@5ry}r}ka$wf#v?lt&}q`euj`AI#Z7BŧDlڪ_ZYf|WD%P1\3bӖa¿4ǙXs)~=rAZY1) D2nkgq1`,*kʘ.1yt֜:їJq>2|x-dփYqJXY-sJ5-U^6F8xAJG5Vº8R*N&|Q+?6[Y遲j~5\s͙Qs^3n\g83T)J}6W96s,ݷ1xYM7FP<ajB&òt{{~Kjo֞kdO֫z-kgOH[Up:ݩf`@vSKckq0cG/|Ӂg^}hÇcm˽xà0 ]ݯد>sh|pb.1Cv ?K~~==3݃>NssA0f3FvM-oFC@싋no[ӿ s3`̀0s3=釛YϙpBy#wer3`̀033_gy'z{';~.g+9y[oսݗ>/7H'iW~_|߽vʫ7/^|is)>J8#r3dV<+-4QS<7S`Fu}qfmLjuljq-S2LlчAq3}kSx]rf8#eL>>Ó"~{=s=sn}_toM/u_%|b}Cbw/zdS
8j^nÜKQsafR}.bE6Y.ba5oV߭9Ym; B3ΰ-3[VW2LQzl7QZԚ/cʺFʺfx1bm7<)z;ޱowu<?N˹z?cW>Z$^v]^tW0MxvÜ#$963МϗLlCfͩ,!qn1q_#D_ =<r4fuk`EY.]lͬ3S#d6[m.9Z hYlwI}
~q)#_tcJYW\0q!)e?]OۢoqXc{н};3
J)d-qCHShc(\`*B|93sMO{i]:Qb:'n".(m1rnZâMe@P_ĤҢqKrVkfai=JX@3[~`к<6}3D?mQƽ5<5}?|}-EwŦ?Fk/YGʺʺXiJyṵLlx1\OG<gpV_kGq.a'RG9l>Gʺ.wH)|bNZTgoxy
\u-b-*G_usP\joD8*1gO9BjO?1"xp!3;kg=MnD쓻5?5|TuAN>z~\/1$Fd*FfrfS9Ɨt%
ZJ11C[i\OM^hkk[x$:6\#KFAeeŗxf-{f&Ofo)?c2[l)١DŠL8coQv3YNH).(ޮ5OqFSau
{SJ@Aq
T> VJ284arMWªJՙ~ءW]x}38WaLAXk~1*YuXO-:G͢>Uuu#Q)lo3[62bxh<c2֥7TGT5*zy5Az>?W^h>xԨ/~2;{D{a:Ux|7wȑ%XF2q/ecLUwFuVG_\loC=h;ebS2cj~hضoˏXb|CWe}PGC"rLɀ!G0Tl1V1NuF؈Si,à?XsQ?)c>jk^BTzʵ8vb%(6݂Ceҿf]?kW{QV56lGŦtѯd.VW=sh-IgP>}vy^nuYն`:lU53s_錯͍xī#g
}NNwbF^zSw/}n(1'KZ뮙7F|ޛ0f30_cg3`̀0f\%nX)3`̀0f`nư3`̀0f*pctZ|sڵ2s:}qdB̛٢3sb{oy<rψoD,̙M_>240/fW)Kc(@oq#^}V#~7s<%vkMIb3M,LjuljqeO|luPZ3}YIF8g1Sx]rPF^[yl3}r#`mf10OmÌqя8Qe}ӎLf,6c~CZvPhlї2kL=f8-[_f5>1964a`_8<YrU}>,7.QV9<7e9rL멄YeUf+F%X7-Q[k^Kqq/~a6QZő0#_q ꣯Ȼ}43H(!"O.X=( .KD
&"4a$15P02sJ_/T:M1JkFLl5=0`ӹ3ԟgYoiTch3A6BJX(+r-j$K!hb*?cDGYsc((G[n嚘cXqf6>9X#rZ2[V:戶}>%;L9Zw-~Seql1.L6Et`TR{&jK{-%>/1x;lJ8X}Z:Aq֗6n-gckD(/kzZէ?4H(6jTL#ʕiὔWkXu$6_.UJW,0ESek 'U!)-l5wsoMb^5^ @R{*_<]~H os,uf#1;VCkcCFY7v̅;vcⰇ)Sc1D6^DGl-q#^1C}"P,>&KDU=u^fz[X'bEzbAA}:9hS}ּf1^7kqKP)tIK-Gm#ʌF?9lGbbѯd."vOF}XG[sh-j_~uŀj|-j v510b2i:z|:ksc4#*BӝXï?<^K[{eJɒֺkf5f̀0fb`|=!;3`̀0af5f3`pcǐf3`fpcƯ6
m*s|Mp_ŴڥB,2E_g%Z>3<xp.~ÈX3ch#a^9QN63[
/+3ї>6vDw%6%p_ibgø%fVk[Q=l_[k<1裳SOFڬģ6^'ȫD9[^'}b4-5D<F#bmmC\|cl@cj fkULf,6cU謞V1qV?8-[ZLf0kMtu ^æcmCb{>6s>ڗόEcD`ϵ371g|-3y[l=:qOٲ#e{N%R-}5z>f`s.^°O̦~5
w>D}PFY!
#D!hR0m:#g;ڲ|E[2J"ح,.LEhD}I&c(kʡ6aebG=Cgհ2[_ Zq#&[r!7l:`?[NѼb9~~6e/47k6BJX(+r-j$K!hLrv}Z15wm)ڙ;LYDPc((G[n嚘cXqf3}+lYnumfC1cl\-WK8Zc`SQva)ҦgcRj\D-vdᵔ#A)RWO%;ΰ:j#:jx&2۹p}Dޢ\.E7~\SԻeM5F8hj>YAB!Q{GנZ`"Q:aRr_;R\U3@u$6_.UJW,fDș䯺Z>d6tZn9#L#7#}S֦h*r{qX@߫& Tov
U5p#S+BW1gR osrflg:?[lxƍ/ֱ<u8M'-=%>bkvb(4\*%32|իNX؈O(ED_a9h69y
P-aMτ]mhKP)tIG:(t:K-Q ;mQf,g5Ƙ%1Qf9KVچu`ƈ93̛㿳=~fi-l1Z!cWۂ 301u3s_ЍW!GrC]/x;̗>tx%ùk>]3`̀&zCv6f3`6À7j̀0f1ƨ!̀0f0p1 fN5f3`e`U_Xǚ~j{ΣxK}R6f3piѹolP
mbCAf\=df3`@U4FYS:ݲTrznڹ0flQ_S61qxSY:૱Q=tQ`vXm8ݳ0f2pƨ]cm Xd'Vf5hںZ5ne3`̀0[b?|͏vlZ@Ly`5ȕխ3?!ub]pSym̀0f6F(ݼimM5gcY>}f3`*~Q+~k|oHs5ķH.m㦈Lx6f3Pf?cK⍛sM f@jjsj?1#VĢ.CQf<N3`VXUcC8&@bbluC\k3f3vV%
MGl2c.e\
3`U5F823`̀U\30f3`0h[5f3`7FW}ޜ0f30э~s3`̀0@՚S~~(y
,YѶ&y:kg3`̀0@1Zv5=K}ϔu8p3`̀0@1ʚ6'!S6sֹ%Xv3`̀"ǨSmdF=uuC¸hW=c|)r2y18juh|,k3`̀0f` dF3{(Le]Ie@jS=%t9Ʊ<_;g3`̀g
S~`m;էTu|sjx|(c63`̀08j^k.&
LKsJ0G9.<ػ1̀0f@MzƁ
{8bk7Ed߹̀0fYހ9-MIɖvRhS{iQxku77kLAn90f3@nh,P(sÒ0f3hjbS̀0f3piuf3`%2OMd IENDB` | PNG
IHDR F )!}
iCCPICC Profile HT[Lz$! ҫ@z *6D',"CbCA/CA]DEeX¾ݳgs͝o3? ~P
&3cb8 @es2n W}xdֿ_&dr fr>EP
"K8eEHn?='<a d6[ #gfs:d:f._'p>ҧT'/55$)ϼ˴La*{[igh!A|CYmJANϟf7b9e{ϲ8%m٢{YYJRXRN
D7ksxQ͏̔09ҼH*9Q-}Ǵ̹8ge}zM,wiMaj\>|fv,d_\` O H ]e%Gpb!&pL3-m ڃ3Cނ\a "IsvR$ w
?8bQL=u "tԁ60 &H6" b2<D`X6PݠTC'A38.6@k0
> pAJCyAP(AI CkPTCUP+t݄ 4(a5X^ n?/8·ep5|n/÷~
b4Q&(;*JDPPRT5Պ@CIPoP_X4
DѾ4^.FkM{(Qc0,L4& S)``a`0X,bcb~l#
ۍĎp8%1 cpcK3[x>_?OBKXEF8Lh%!&D}1L@,#6?H$-=)'H'H7H/d*وA^B(ŕKɢlQPQ>dLeX2\22M2=2oe ndsdKeOޑ}#Gӓc˭;+'7&O7O/?*S~Q\j>
ui<hFa5Kק"qz}T`RBႂb1XT6IF/<ynm0gbbbůJL%/JJOF!+(_S~BWqTTy
V=ک:&T۫vE:CU=Y}E
_c%WL3YƼTkViviNhkEhi5j=&ji'jnYF^.ANGCw\O_/Jo^ް>K?G^ à!0p]#ڈgTat617o?_0z~ $ۤda`glv;t,afmjv9<ϼǢ%re;+cV4E֛ۭڈllFlullnc۟`pOGǣ&,<pIˉT$qf:9th]]jr]k\_%s{n.r?>֣YE*z]=cڧ÷X~~kZ\$P7PXA;gT5]F[v4S{H%uQQ%Qko(cZbq5c^<zIޥKW.LyYeEbWYG9=\W.HSBIDĒ$I#<^)
߃_\<r$e25*1
vV@L"QM&4%Nxx 9"Vʯ\ej˪99Fn_fÚnkA^~('vqCʆJ>nؚ?gS}Loʟ?be[EfEEߊ9ŷ~6ɭ[l;]wˎv6b*q7KJ+HZݾ[9A{E>}[9zRA*jCCه^</u55E5ߏHjCkU=[rq-
&
UƢī_~=ݩӺ)lV56%-1-gζ:9gzy.lHqRΥ6aۛIۗ?}Ր]ݸ}J[ǥN7tyݭ6:;fۙ.;wZm^}ǥ={~7oI?0Gُ&><)|*
oH.xt>{x3?
忠(}nbW_
xS7{kvF|_AÑVǂǞ}J41^Ys/_X
?LMN
"@!'" (1 @ӂf|43>zZs ){ }ev 2--fjkR:98C MNN4ON~A}O3|Jr?Xacfֳ&At ;IDATx}],uU{D~PR"_ğCHb;BX)RD xJĀHQhdc{WouksSݵo}=<̀0f3`́0f3`
0f3`̀0f3`Ȁ?J#+<x13`x"+
f^Q}>/֫]DBf* >\J31瘯w|}8f3`.jco}ib1StJ+@Gc?3`̀0kdQov=*<<Xp2Qc0fKaZSTipG)3
we}O1>ӟ6SGG;c 뺐P&nw
{r
f3`j=1~p<ՊJ,68M @>L:F,:8#om®qͭj^:3`̀0#0FF
Z";ti<
ĺ3p0t
gW_̀0fE?X\,ݑϸ'`mͺZ]0f\#OOH1,r][2&D `é_Tڦ1̀0f1Bku#4ΰqY>E;6(4Y<mR\-O5&Z-).ߊg?3`̀0kdWO53`̀0ga,80f3`Ȁ3f3`pcp5f3`pctF3`̀Xnu3`̀8#nHS3`̀0b mJ]3Gtsp*u.{v0fkc-}h(HpM)1ν'3`̀0Rjs 9){f36}uŧ&DmSY ¸hW=c|)r2y18juh|v0f30dyG&u
'M\5bZǚJPLk#~v.ײ0f30'7-1(~h|m=ķ1Tu|3esQƎmf3`e1hRPii.ZI<hVì0f@?#Oic&f
lbN5)X40fak
7g}-!^ȫѦh8E;c58n<n٩טyWl̀0fHҞƂ
|̀0f2pe}3`̀00p470f3`(+3`̀0fl7F9k3`̀aQA63`̀0av;5f3`z=m6lF-uK7G5f3Vh:4CCPe6
ͥC-X>Ͼf3`*%.հrϥss45f-0p1ʚ"}&Fu<}O8+6}TG|51>jW1Θ˱Wx6f3`8kcݼq 6n0KvbjX毭KX5a}-3`̀0]w>`"Ok͑+Ssg~jCĺHY3`@gmPb6mUk2ơODbʏ)R66f3*~͑]j:w6@uiE7Ed³0fgbM }K̀61|8榽FcFE]3xȑ?x6f3`XUcV84,RqQ}N3`̀05F$6@riܻ^3`̀.ms3`̀0f`nVsof3`̀haQK1f3`6M7ì0f0ƨ%3`̀0`|}NKSUypuaqxK8ԛd>w'<nu\2fs8t} o~SZ\#/:O!^`-w&})j,}k0f`l1ZKS7]Izf`ls7ECO$bD=h51TO8?1zF[ă\j6U48!d`ЇxO%L?I=fTWZ+n)F9tl0{3`NbцwDȥ? *c|)ay!OmAZ/bX5}͏:|W[m
,)v\G?u]vbGʺ.at.X[)OElأ.c3kW:3` #2C!62[-U_8b<Ѿ9ߘ=%pA|yl=_:l1vl̀ ja^(nCo͘R{)̑oSt쥿̀3fsTeȿPK-:mRϦrm`ͧg\KZK)Zt{ /-ubfXCe8jSvSr}f"[zC-:RѲat%Rm">W{ѧ636QhaQXQV,2e3qԧ'1ӧfF=k Nf)AF;ƒשj60f`ӍѺfp7/f0]l0f`K1i7Eygg;4fpcT3`̀0f`cl7vޮ0f3ȀFf̀0f\?nC3`̀0f7FD]nnp^X9.Xk#kkf̀0'1oV|ʧ=
_g#g/mq?0siᣄvXJKyZŜ~esJkmZVZ>aNflQ|Co%16g?o[6P7#XRzro<qX#gs--T8-c6dc6f|J9Lqؙols{6sX5Q'tsɿ3^CX̀0lڛ+GaXǧ?j]GfSq]:wDhV#C oeR-&%KSGLFa}*9Cy3Q9a_ʁb`XSSam2({3Fs͐ʺePfkJPWr[TAI>R@yE,4ʱ($mQ2ܶ>Hn(D>̀0}l18iG$;~Ŏ,r$zxzS㭄l(Tc\oHn3p=l1±i_Q, 6;L!o(Q.[Ja=([.NQ,4Z0[|v0c`sozҦhˀG{aZŭM{DzDŽ?tMZ/qKỳ8?Odj)Q[xz7aGS?p-Zҟ~F{+cO
E`W[)'1Ҷ-J4+^´31(#fնY̶j\0kbʅa`ct,4ڼ6S1=-*q̀0ʀ)^3`̀0fO6}0f31R66f3`6̀M7ò0f(n+_?IiWφEn")✸ y\/IԘg`_Hf1^]G#balwͲɏ@ x\ι=tFjx-zŅ?}x6gϿ01?-ϪOs9"GεXGZf`l7RCċ'g?ԑzl6g G\Č %;p!YhYރ8lxϖO08B%avvU5φX 9t
eWm[g`s(p!0#_q8nPGȻʈr4+䑡AwSh;
\́Y*yXwC:A?!zQ;g2Q/gaQ`-B&U&5_ŦEe6"NC1:A?!zQ;Ĝ
oL
1kd`SdjohnRY8Dm2[Ӂޝb嶨|X
.ɇ90k?ڣ\È}17j& rLRRbq+
5bUρ8#7u#ԷZb!s1707l1iӳER{4tR\!*]H565>.`,1Q_AD95m*-뤊^Le^zH+Cj%=΅]g6@&P{3Ч?4HٻwTL#ʗp!U# X guPSk)*hX:7)-2ŷŧ%OK.kc`?|7&MbBJb|;gگa
tK~joY+F)G|5f2?$Gs
krK%8bYRkG1J9jqQ86l?oDGl-4ΧN}"P,>&%BaFsbcAhz/}zMF35bR&`RNb4
vڨ5gƨTy\O34VmGW"n.|g[07kb5kD6Q%ԾfB8/ì8i 5aO6sި0f3ǀ1d0f3m樽Q3`̀0f7F}ǹ0fl7F9jo3`̀c`s|෭opt3٣|Q̰5F_헴
Ne9[ߘY2[x;5%>{mگ9b,>11/D}1zn-&jV\{h?ԏowI{6~װDK:RЭ}\/}Wd
Zj={kkP?<}}qO@vÇѭ'nͻC:݇wr(D`{@gRjg*dجvr ƣDEs\I{Twk\4SW=/u>
9ݙ躯hcwf]}=u;AA}sOҮ݈>ԫ:Fyؔ9ǻevEP_]33)TO8Y`hܘ=%y5@>;:3P8QOd]#rhy c2sb,NmG}ȧxGmZq?}39ڈU^hי/}f]Wڨa¿_K=|c8 >鿗wO;ow?c~κwOB)&Xa'Nԕbh?(ma朧h.x{яt~ɵ̀0f,[[X
wv_v?x>fz6.pU9D#F3oHwfHy+Ԟf+)3`.绯]{|{駻'x9ucbg,fK>݉!M)M^tc|xR>c}/to?|u";W[9b{{5*zmj~q-զk+Г+1ߍZlԫ,w^[[ûFdsuQfl3hSY[#^1&OU9,K:e6'G%}r ;"FfW_]g1eE[M_3u۟|}:|?({go7V[oe<v._~vz^|/Qʺb&c|(ɌsRYs*֓a_ic*Q&Fʺ9e97Eߘf.ƩRhW|8UiKr_\3s~:bOV:ØV4o_ާs?=s'G{[lK?Ne]l~VsLnvݯ?_?SGCk{tkb,=>ve7o
Q}EJ㩃OMO>;q%ӕ|"&W}_K[XbRF\EY}f3}Ԯ6ӗ_3ٜŕlyՎZK=4~c*KqGcìC}WlG^EN8Ǹv5skb®6Gm-:4X@c?S7OٮVw{?yTB|f>Fя2p#ts"v.'{Wԟ~;߹_gO8cC(,q(/Qs)=
?}O}rk{_۽=vz'|Ԧmc.gWqA#~H
M;fOv/w?nk}=u/ݗ?r=|;㯏<0ܿtϰ{E7F\D}~Y1[<9p\뾖8*sαh>!ǭk4Dn̾(4،?xyv3`{ftrdS9ƨ9Ѝì0fbK5f3`eѼ
?yUŹ^xn{.́| Wk#b_/.9*טeщ<C~ݍelG|M~2LOs.EᣄuffСx|Fl$7c"yH(߸Q AgF=S=Z]5[Md^kl)Y\f+aEcl9ejKZ^>1{"of~39]-ֶy[zSumBh食m
XtK mƲY-S"DŽY12[
,.ei}ql9e2$־c`_8}mαrGߛ6xn/z/}RfˮV1.#Sqw);KΥ}7<.}Vxqd(GmlW\+FyJyAY^!R^O}4p1&K ։5u{\ڃZz
A#E`%],.LEhD}I&c(kʡ6aebG=k2[K3[ z2jXΥQ76.5X/F!u#F(5g}E.EMTRuI>
X́n7{g-Q \J@ڢ1ne2kbRV>[bu"Δr7jqcpkQØ16pWarl1.L6E,rWJ핫Ŏ,r$ܪ~ptƏ)6#qj].rҶtSjݵz3)9[cjf21/kZէ?4H(6jTL#ʕncͣtP}(@u$܁6_.ju[+]}m}8J~V]->k\cCRߔ)ZB`}h/lP~Do@5ry}r}ka$wf#v?lt&}q`euj`AI#Z7BŧDlڪ_ZYf|WD%P1\3bӖa¿4ǙXs)~=rAZY1) D2nkgq1`,*kʘ.1yt֜:їJq>2|x-dփYqJXY-sJ5-U^6F8xAJG5Vº8R*N&|Q+?6[Y遲j~5\s͙Qs^3n\g83T)J}6W96s,ݷ1xYM7FP<ajB&òt{{~Kjo֞kdO֫z-kgOH[Up:ݩf`@vSKckq0cG/|Ӂg^}hÇcm˽xà0 ]ݯد>sh|pb.1Cv ?K~~==3݃>NssA0f3FvM-oFC@싋no[ӿ s3`̀0s3=釛YϙpBy#wer3`̀033_gy'z{';~.g+9y[oսݗ>/7H'iW~_|߽vʫ7/^|is)>J8#r3dV<+-4QS<7S`Fu}qfmLjuljq-S2LlчAq3}kSx]rf8#eL>>Ó"~{=s=sn}_toM/u_%|b}Cbw/zdS
8j^nÜKQsafR}.bE6Y.ba5oV߭9Ym; B3ΰ-3[VW2LQzl7QZԚ/cʺFʺfx1bm7<)z;ޱowu<?N˹z?cW>Z$^v]^tW0MxvÜ#$963МϗLlCfͩ,!qn1q_#D_ =<r4fuk`EY.]lͬ3S#d6[m.9Z hYlwI}
~q)#_tcJYW\0q!)e?]OۢoqXc{н};3
J)d-qCHShc(\`*B|93sMO{i]:Qb:'n".(m1rnZâMe@P_ĤҢqKrVkfai=JX@3[~`к<6}3D?mQƽ5<5}?|}-EwŦ?Fk/YGʺʺXiJyṵLlx1\OG<gpV_kGq.a'RG9l>Gʺ.wH)|bNZTgoxy
\u-b-*G_usP\joD8*1gO9BjO?1"xp!3;kg=MnD쓻5?5|TuAN>z~\/1$Fd*FfrfS9Ɨt%
ZJ11C[i\OM^hkk[x$:6\#KFAeeŗxf-{f&Ofo)?c2[l)١DŠL8coQv3YNH).(ޮ5OqFSau
{SJ@Aq
T> VJ284arMWªJՙ~ءW]x}38WaLAXk~1*YuXO-:G͢>Uuu#Q)lo3[62bxh<c2֥7TGT5*zy5Az>?W^h>xԨ/~2;{D{a:Ux|7wȑ%XF2q/ecLUwFuVG_\loC=h;ebS2cj~hضoˏXb|CWe}PGC"rLɀ!G0Tl1V1NuF؈Si,à?XsQ?)c>jk^BTzʵ8vb%(6݂Ceҿf]?kW{QV56lGŦtѯd.VW=sh-IgP>}vy^nuYն`:lU53s_錯͍xī#g
}NNwbF^zSw/}n(1'KZ뮙7F|ޛ0f30_cg3`̀0f\%nX)3`̀0f`nư3`̀0f*pctZ|sڵ2s:}qdB̛٢3sb{oy<rψoD,̙M_>240/fW)Kc(@oq#^}V#~7s<%vkMIb3M,LjuljqeO|luPZ3}YIF8g1Sx]rPF^[yl3}r#`mf10OmÌqя8Qe}ӎLf,6c~CZvPhlї2kL=f8-[_f5>1964a`_8<YrU}>,7.QV9<7e9rL멄YeUf+F%X7-Q[k^Kqq/~a6QZő0#_q ꣯Ȼ}43H(!"O.X=( .KD
&"4a$15P02sJ_/T:M1JkFLl5=0`ӹ3ԟgYoiTch3A6BJX(+r-j$K!hb*?cDGYsc((G[n嚘cXqf6>9X#rZ2[V:戶}>%;L9Zw-~Seql1.L6Et`TR{&jK{-%>/1x;lJ8X}Z:Aq֗6n-gckD(/kzZէ?4H(6jTL#ʕiὔWkXu$6_.UJW,0ESek 'U!)-l5wsoMb^5^ @R{*_<]~H os,uf#1;VCkcCFY7v̅;vcⰇ)Sc1D6^DGl-q#^1C}"P,>&KDU=u^fz[X'bEzbAA}:9hS}ּf1^7kqKP)tIK-Gm#ʌF?9lGbbѯd."vOF}XG[sh-j_~uŀj|-j v510b2i:z|:ksc4#*BӝXï?<^K[{eJɒֺkf5f̀0fb`|=!;3`̀0af5f3`pcǐf3`fpcƯ6
m*s|Mp_ŴڥB,2E_g%Z>3<xp.~ÈX3ch#a^9QN63[
/+3ї>6vDw%6%p_ibgø%fVk[Q=l_[k<1裳SOFڬģ6^'ȫD9[^'}b4-5D<F#bmmC\|cl@cj fkULf,6cU謞V1qV?8-[ZLf0kMtu ^æcmCb{>6s>ڗόEcD`ϵ371g|-3y[l=:qOٲ#e{N%R-}5z>f`s.^°O̦~5
w>D}PFY!
#D!hR0m:#g;ڲ|E[2J"ح,.LEhD}I&c(kʡ6aebG=Cgհ2[_ Zq#&[r!7l:`?[NѼb9~~6e/47k6BJX(+r-j$K!hLrv}Z15wm)ڙ;LYDPc((G[n嚘cXqf3}+lYnumfC1cl\-WK8Zc`SQva)ҦgcRj\D-vdᵔ#A)RWO%;ΰ:j#:jx&2۹p}Dޢ\.E7~\SԻeM5F8hj>YAB!Q{GנZ`"Q:aRr_;R\U3@u$6_.UJW,fDș䯺Z>d6tZn9#L#7#}S֦h*r{qX@߫& Tov
U5p#S+BW1gR osrflg:?[lxƍ/ֱ<u8M'-=%>bkvb(4\*%32|իNX؈O(ED_a9h69y
P-aMτ]mhKP)tIG:(t:K-Q ;mQf,g5Ƙ%1Qf9KVچu`ƈ93̛㿳=~fi-l1Z!cWۂ 301u3s_ЍW!GrC]/x;̗>tx%ùk>]3`̀&zCv6f3`6À7j̀0f1ƨ!̀0f0p1 fN5f3`e`U_Xǚ~j{ΣxK}R6f3piѹolP
mbCAf\=df3`@U4FYS:ݲTrznڹ0flQ_S61qxSY:૱Q=tQ`vXm8ݳ0f2pƨ]cm Xd'Vf5hںZ5ne3`̀0[b?|͏vlZ@Ly`5ȕխ3?!ub]pSym̀0f6F(ݼimM5gcY>}f3`*~Q+~k|oHs5ķH.m㦈Lx6f3Pf?cK⍛sM f@jjsj?1#VĢ.CQf<N3`VXUcC8&@bbluC\k3f3vV%
MGl2c.e\
3`U5F823`̀U\30f3`0h[5f3`7FW}ޜ0f30э~s3`̀0@՚S~~(y
,YѶ&y:kg3`̀0@1Zv5=K}ϔu8p3`̀0@1ʚ6'!S6sֹ%Xv3`̀"ǨSmdF=uuC¸hW=c|)r2y18juh|,k3`̀0f` dF3{(Le]Ie@jS=%t9Ʊ<_;g3`̀g
S~`m;էTu|sjx|(c63`̀08j^k.&
LKsJ0G9.<ػ1̀0f@MzƁ
{8bk7Ed߹̀0fYހ9-MIɖvRhS{iQxku77kLAn90f3@nh,P(sÒ0f3hjbS̀0f3piuf3`%2OMd IENDB` | -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/service/ConfigsImportService.java | package com.ctrip.framework.apollo.portal.service;
import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
import com.ctrip.framework.apollo.common.exception.ServiceException;
import com.ctrip.framework.apollo.portal.component.PermissionValidator;
import com.ctrip.framework.apollo.portal.entity.model.NamespaceTextModel;
import com.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.portal.util.ConfigFileUtils;
import com.ctrip.framework.apollo.portal.util.ConfigToFileUtils;
import java.io.IOException;
import java.io.InputStream;
import java.security.AccessControlException;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
/**
* @author wxq
*/
@Service
public class ConfigsImportService {
private final ItemService itemService;
private final NamespaceService namespaceService;
private final PermissionValidator permissionValidator;
public ConfigsImportService(
final ItemService itemService,
final @Lazy NamespaceService namespaceService,
PermissionValidator permissionValidator) {
this.itemService = itemService;
this.namespaceService = namespaceService;
this.permissionValidator = permissionValidator;
}
/**
* move from {@link com.ctrip.framework.apollo.portal.controller.ConfigsImportController}
*/
private void importConfig(
final String appId,
final String env,
final String clusterName,
final String namespaceName,
final long namespaceId,
final String format,
final String configText
) {
final NamespaceTextModel model = new NamespaceTextModel();
model.setAppId(appId);
model.setEnv(env);
model.setClusterName(clusterName);
model.setNamespaceName(namespaceName);
model.setNamespaceId(namespaceId);
model.setFormat(format);
model.setConfigText(configText);
itemService.updateConfigItemByText(model);
}
/**
* import one config from file
*/
private void importOneConfigFromFile(
final String appId,
final String env,
final String clusterName,
final String namespaceName,
final String configText,
final String format
) {
final NamespaceDTO namespaceDTO = namespaceService
.loadNamespaceBaseInfo(appId, Env.valueOf(env), clusterName, namespaceName);
this.importConfig(appId, env, clusterName, namespaceName, namespaceDTO.getId(), format, configText);
}
/**
* import a config file.
* the name of config file must be special like
* appId+cluster+namespace.format
* Example:
* <pre>
* 123456+default+application.properties (appId is 123456, cluster is default, namespace is application, format is properties)
* 654321+north+password.yml (appId is 654321, cluster is north, namespace is password, format is yml)
* </pre>
* so we can get the information of appId, cluster, namespace, format from the file name.
* @param env environment
* @param standardFilename appId+cluster+namespace.format
* @param configText config content
*/
private void importOneConfigFromText(
final String env,
final String standardFilename,
final String configText
) {
final String appId = ConfigFileUtils.getAppId(standardFilename);
final String clusterName = ConfigFileUtils.getClusterName(standardFilename);
final String namespace = ConfigFileUtils.getNamespace(standardFilename);
final String format = ConfigFileUtils.getFormat(standardFilename);
this.importOneConfigFromFile(appId, env, clusterName, namespace, configText, format);
}
/**
* @see ConfigsImportService#importOneConfigFromText(java.lang.String, java.lang.String, java.lang.String)
* @throws AccessControlException if has no modify namespace permission
*/
public void importOneConfigFromFile(
final String env,
final String standardFilename,
final InputStream inputStream
) {
final String configText;
try(InputStream in = inputStream) {
configText = ConfigToFileUtils.fileToString(in);
} catch (IOException e) {
throw new ServiceException("Read config file errors:{}", e);
}
this.importOneConfigFromText(env, standardFilename, configText);
}
}
| package com.ctrip.framework.apollo.portal.service;
import com.ctrip.framework.apollo.common.dto.NamespaceDTO;
import com.ctrip.framework.apollo.common.exception.ServiceException;
import com.ctrip.framework.apollo.portal.component.PermissionValidator;
import com.ctrip.framework.apollo.portal.entity.model.NamespaceTextModel;
import com.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.portal.util.ConfigFileUtils;
import com.ctrip.framework.apollo.portal.util.ConfigToFileUtils;
import java.io.IOException;
import java.io.InputStream;
import java.security.AccessControlException;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
/**
* @author wxq
*/
@Service
public class ConfigsImportService {
private final ItemService itemService;
private final NamespaceService namespaceService;
private final PermissionValidator permissionValidator;
public ConfigsImportService(
final ItemService itemService,
final @Lazy NamespaceService namespaceService,
PermissionValidator permissionValidator) {
this.itemService = itemService;
this.namespaceService = namespaceService;
this.permissionValidator = permissionValidator;
}
/**
* move from {@link com.ctrip.framework.apollo.portal.controller.ConfigsImportController}
*/
private void importConfig(
final String appId,
final String env,
final String clusterName,
final String namespaceName,
final long namespaceId,
final String format,
final String configText
) {
final NamespaceTextModel model = new NamespaceTextModel();
model.setAppId(appId);
model.setEnv(env);
model.setClusterName(clusterName);
model.setNamespaceName(namespaceName);
model.setNamespaceId(namespaceId);
model.setFormat(format);
model.setConfigText(configText);
itemService.updateConfigItemByText(model);
}
/**
* import one config from file
*/
private void importOneConfigFromFile(
final String appId,
final String env,
final String clusterName,
final String namespaceName,
final String configText,
final String format
) {
final NamespaceDTO namespaceDTO = namespaceService
.loadNamespaceBaseInfo(appId, Env.valueOf(env), clusterName, namespaceName);
this.importConfig(appId, env, clusterName, namespaceName, namespaceDTO.getId(), format, configText);
}
/**
* import a config file.
* the name of config file must be special like
* appId+cluster+namespace.format
* Example:
* <pre>
* 123456+default+application.properties (appId is 123456, cluster is default, namespace is application, format is properties)
* 654321+north+password.yml (appId is 654321, cluster is north, namespace is password, format is yml)
* </pre>
* so we can get the information of appId, cluster, namespace, format from the file name.
* @param env environment
* @param standardFilename appId+cluster+namespace.format
* @param configText config content
*/
private void importOneConfigFromText(
final String env,
final String standardFilename,
final String configText
) {
final String appId = ConfigFileUtils.getAppId(standardFilename);
final String clusterName = ConfigFileUtils.getClusterName(standardFilename);
final String namespace = ConfigFileUtils.getNamespace(standardFilename);
final String format = ConfigFileUtils.getFormat(standardFilename);
this.importOneConfigFromFile(appId, env, clusterName, namespace, configText, format);
}
/**
* @see ConfigsImportService#importOneConfigFromText(java.lang.String, java.lang.String, java.lang.String)
* @throws AccessControlException if has no modify namespace permission
*/
public void importOneConfigFromFile(
final String env,
final String standardFilename,
final InputStream inputStream
) {
final String configText;
try(InputStream in = inputStream) {
configText = ConfigToFileUtils.fileToString(in);
} catch (IOException e) {
throw new ServiceException("Read config file errors:{}", e);
}
this.importOneConfigFromText(env, standardFilename, configText);
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/application.yml | spring:
application:
name: apollo-adminservice
profiles:
active: ${apollo_profile}
ctrip:
appid: 100003172
server:
port: 8090
logging:
file:
name: /opt/logs/100003172/apollo-adminservice.log
eureka:
instance:
hostname: ${hostname:localhost}
preferIpAddress: true
status-page-url-path: /info
health-check-url-path: /health
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-adminservice
profiles:
active: ${apollo_profile}
ctrip:
appid: 100003172
server:
port: 8090
logging:
file:
name: /opt/logs/100003172/apollo-adminservice.log
eureka:
instance:
hostname: ${hostname:localhost}
preferIpAddress: true
status-page-url-path: /info
health-check-url-path: /health
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
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/apollo-portal/templates/service-portaldb.yaml | {{- if .Values.portaldb.service.enabled -}}
---
# service definition for mysql
kind: Service
apiVersion: v1
metadata:
name: {{include "apollo.portaldb.serviceName" .}}
labels:
{{- include "apollo.portal.labels" . | nindent 4 }}
spec:
type: {{ .Values.portaldb.service.type }}
{{- if eq .Values.portaldb.service.type "ExternalName" }}
externalName: {{ required "portaldb.host is required!" .Values.portaldb.host }}
{{- else }}
ports:
- protocol: TCP
port: {{ .Values.portaldb.service.port }}
targetPort: {{ .Values.portaldb.port }}
---
kind: Endpoints
apiVersion: v1
metadata:
name: {{include "apollo.portaldb.serviceName" .}}
subsets:
- addresses:
- ip: {{ required "portaldb.host is required!" .Values.portaldb.host }}
ports:
- protocol: TCP
port: {{ .Values.portaldb.port }}
{{- end }}
{{- end }} | {{- if .Values.portaldb.service.enabled -}}
---
# service definition for mysql
kind: Service
apiVersion: v1
metadata:
name: {{include "apollo.portaldb.serviceName" .}}
labels:
{{- include "apollo.portal.labels" . | nindent 4 }}
spec:
type: {{ .Values.portaldb.service.type }}
{{- if eq .Values.portaldb.service.type "ExternalName" }}
externalName: {{ required "portaldb.host is required!" .Values.portaldb.host }}
{{- else }}
ports:
- protocol: TCP
port: {{ .Values.portaldb.service.port }}
targetPort: {{ .Values.portaldb.port }}
---
kind: Endpoints
apiVersion: v1
metadata:
name: {{include "apollo.portaldb.serviceName" .}}
subsets:
- addresses:
- ip: {{ required "portaldb.host is required!" .Values.portaldb.host }}
ports:
- protocol: TCP
port: {{ .Values.portaldb.port }}
{{- end }}
{{- end }} | -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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-mysql-for-apollo-dev-env.yaml | ---
# 为外部 mysql 服务设置 service
kind: Service
apiVersion: v1
metadata:
namespace: sre
name: service-mysql-for-apollo-dev-env
labels:
app: service-mysql-for-apollo-dev-env
spec:
ports:
- protocol: TCP
port: 3306
targetPort: 3306
type: ClusterIP
sessionAffinity: None
---
kind: Endpoints
apiVersion: v1
metadata:
namespace: sre
name: service-mysql-for-apollo-dev-env
subsets:
- addresses:
- ip: your-mysql-addresses
ports:
- protocol: TCP
port: 3306
| ---
# 为外部 mysql 服务设置 service
kind: Service
apiVersion: v1
metadata:
namespace: sre
name: service-mysql-for-apollo-dev-env
labels:
app: service-mysql-for-apollo-dev-env
spec:
ports:
- protocol: TCP
port: 3306
targetPort: 3306
type: ClusterIP
sessionAffinity: None
---
kind: Endpoints
apiVersion: v1
metadata:
namespace: sre
name: service-mysql-for-apollo-dev-env
subsets:
- addresses:
- ip: your-mysql-addresses
ports:
- protocol: TCP
port: 3306
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/apollo-1.0.0.xsd | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns="http://www.ctrip.com/schema/apollo"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ctrip.com/schema/apollo"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:annotation>
<xsd:documentation><![CDATA[ Namespace support for Ctrip Apollo Configuration Center. ]]></xsd:documentation>
</xsd:annotation>
<xsd:element name="config">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Apollo configuration section to integrate with Spring.]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="namespaces" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation>
<![CDATA[
The comma-separated list of namespace names to integrate with Spring property sources.
If not specified, then default to application namespace.
]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="order" type="xsd:int" use="optional">
<xsd:annotation>
<xsd:documentation>
<![CDATA[
The order of the config, default to Ordered.LOWEST_PRECEDENCE, which is Integer.MAX_VALUE.
If there are properties with the same name in different apollo configs, the config with smaller order wins.
]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:schema> | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema xmlns="http://www.ctrip.com/schema/apollo"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ctrip.com/schema/apollo"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xsd:annotation>
<xsd:documentation><![CDATA[ Namespace support for Ctrip Apollo Configuration Center. ]]></xsd:documentation>
</xsd:annotation>
<xsd:element name="config">
<xsd:annotation>
<xsd:documentation>
<![CDATA[ Apollo configuration section to integrate with Spring.]]>
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:attribute name="namespaces" type="xsd:string" use="optional">
<xsd:annotation>
<xsd:documentation>
<![CDATA[
The comma-separated list of namespace names to integrate with Spring property sources.
If not specified, then default to application namespace.
]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="order" type="xsd:int" use="optional">
<xsd:annotation>
<xsd:documentation>
<![CDATA[
The order of the config, default to Ordered.LOWEST_PRECEDENCE, which is Integer.MAX_VALUE.
If there are properties with the same name in different apollo configs, the config with smaller order wins.
]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:schema> | -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/main/java/com/ctrip/framework/apollo/biz/repository/AppRepository.java | package com.ctrip.framework.apollo.biz.repository;
import com.ctrip.framework.apollo.common.entity.App;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface AppRepository extends PagingAndSortingRepository<App, Long> {
@Query("SELECT a from App a WHERE a.name LIKE %:name%")
List<App> findByName(@Param("name") String name);
App findByAppId(String appId);
}
| package com.ctrip.framework.apollo.biz.repository;
import com.ctrip.framework.apollo.common.entity.App;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface AppRepository extends PagingAndSortingRepository<App, Long> {
@Query("SELECT a from App a WHERE a.name LIKE %:name%")
List<App> findByName(@Param("name") String name);
App findByAppId(String appId);
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/AbstractUnitTest.java | package com.ctrip.framework.apollo.biz;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public abstract class AbstractUnitTest {
}
| package com.ctrip.framework.apollo.biz;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public abstract class AbstractUnitTest {
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/main/java/com/ctrip/framework/apollo/biz/utils/EntityManagerUtil.java | package com.ctrip.framework.apollo.biz.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.orm.jpa.EntityManagerFactoryAccessor;
import org.springframework.orm.jpa.EntityManagerFactoryUtils;
import org.springframework.orm.jpa.EntityManagerHolder;
import org.springframework.stereotype.Component;
import org.springframework.transaction.support.TransactionSynchronizationManager;
/**
* @author Jason Song([email protected])
*/
@Component
public class EntityManagerUtil extends EntityManagerFactoryAccessor {
private static final Logger logger = LoggerFactory.getLogger(EntityManagerUtil.class);
/**
* close the entity manager.
* Use it with caution! This is only intended for use with async request, which Spring won't
* close the entity manager until the async request is finished.
*/
public void closeEntityManager() {
EntityManagerHolder emHolder = (EntityManagerHolder)
TransactionSynchronizationManager.getResource(getEntityManagerFactory());
if (emHolder == null) {
return;
}
logger.debug("Closing JPA EntityManager in EntityManagerUtil");
EntityManagerFactoryUtils.closeEntityManager(emHolder.getEntityManager());
}
}
| package com.ctrip.framework.apollo.biz.utils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.orm.jpa.EntityManagerFactoryAccessor;
import org.springframework.orm.jpa.EntityManagerFactoryUtils;
import org.springframework.orm.jpa.EntityManagerHolder;
import org.springframework.stereotype.Component;
import org.springframework.transaction.support.TransactionSynchronizationManager;
/**
* @author Jason Song([email protected])
*/
@Component
public class EntityManagerUtil extends EntityManagerFactoryAccessor {
private static final Logger logger = LoggerFactory.getLogger(EntityManagerUtil.class);
/**
* close the entity manager.
* Use it with caution! This is only intended for use with async request, which Spring won't
* close the entity manager until the async request is finished.
*/
public void closeEntityManager() {
EntityManagerHolder emHolder = (EntityManagerHolder)
TransactionSynchronizationManager.getResource(getEntityManagerFactory());
if (emHolder == null) {
return;
}
logger.debug("Closing JPA EntityManager in EntityManagerUtil");
EntityManagerFactoryUtils.closeEntityManager(emHolder.getEntityManager());
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/java/com/ctrip/framework/apollo/spi/ConfigRegistry.java | package com.ctrip.framework.apollo.spi;
/**
* The manually config registry, use with caution!
*
* @author Jason Song([email protected])
*/
public interface ConfigRegistry {
/**
* Register the config factory for the namespace specified.
*
* @param namespace the namespace
* @param factory the factory for this namespace
*/
void register(String namespace, ConfigFactory factory);
/**
* Get the registered config factory for the namespace.
*
* @param namespace the namespace
* @return the factory registered for this namespace
*/
ConfigFactory getFactory(String namespace);
}
| package com.ctrip.framework.apollo.spi;
/**
* The manually config registry, use with caution!
*
* @author Jason Song([email protected])
*/
public interface ConfigRegistry {
/**
* Register the config factory for the namespace specified.
*
* @param namespace the namespace
* @param factory the factory for this namespace
*/
void register(String namespace, ConfigFactory factory);
/**
* Get the registered config factory for the namespace.
*
* @param namespace the namespace
* @return the factory registered for this namespace
*/
ConfigFactory getFactory(String namespace);
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/main/java/com/ctrip/framework/apollo/biz/repository/InstanceConfigRepository.java | package com.ctrip.framework.apollo.biz.repository;
import com.ctrip.framework.apollo.biz.entity.InstanceConfig;
import org.springframework.data.domain.Page;
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 org.springframework.data.repository.query.Param;
import java.util.Date;
import java.util.List;
import java.util.Set;
public interface InstanceConfigRepository extends PagingAndSortingRepository<InstanceConfig, Long> {
InstanceConfig findByInstanceIdAndConfigAppIdAndConfigNamespaceName(long instanceId, String
configAppId, String configNamespaceName);
Page<InstanceConfig> findByReleaseKeyAndDataChangeLastModifiedTimeAfter(String releaseKey, Date
validDate, Pageable pageable);
Page<InstanceConfig> findByConfigAppIdAndConfigClusterNameAndConfigNamespaceNameAndDataChangeLastModifiedTimeAfter(
String appId, String clusterName, String namespaceName, Date validDate, Pageable pageable);
List<InstanceConfig> findByConfigAppIdAndConfigClusterNameAndConfigNamespaceNameAndDataChangeLastModifiedTimeAfterAndReleaseKeyNotIn(
String appId, String clusterName, String namespaceName, Date validDate, Set<String> releaseKey);
@Modifying
@Query("delete from InstanceConfig where ConfigAppId=?1 and ConfigClusterName=?2 and ConfigNamespaceName = ?3")
int batchDelete(String appId, String clusterName, String namespaceName);
@Query(
value = "select b.Id from `InstanceConfig` a inner join `Instance` b on b.Id =" +
" a.`InstanceId` where a.`ConfigAppId` = :configAppId and a.`ConfigClusterName` = " +
":clusterName and a.`ConfigNamespaceName` = :namespaceName and a.`DataChange_LastTime` " +
"> :validDate and b.`AppId` = :instanceAppId",
countQuery = "select count(1) from `InstanceConfig` a inner join `Instance` b on b.id =" +
" a.`InstanceId` where a.`ConfigAppId` = :configAppId and a.`ConfigClusterName` = " +
":clusterName and a.`ConfigNamespaceName` = :namespaceName and a.`DataChange_LastTime` " +
"> :validDate and b.`AppId` = :instanceAppId",
nativeQuery = true)
Page<Object> findInstanceIdsByNamespaceAndInstanceAppId(
@Param("instanceAppId") String instanceAppId, @Param("configAppId") String configAppId,
@Param("clusterName") String clusterName, @Param("namespaceName") String namespaceName,
@Param("validDate") Date validDate, Pageable pageable);
}
| package com.ctrip.framework.apollo.biz.repository;
import com.ctrip.framework.apollo.biz.entity.InstanceConfig;
import org.springframework.data.domain.Page;
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 org.springframework.data.repository.query.Param;
import java.util.Date;
import java.util.List;
import java.util.Set;
public interface InstanceConfigRepository extends PagingAndSortingRepository<InstanceConfig, Long> {
InstanceConfig findByInstanceIdAndConfigAppIdAndConfigNamespaceName(long instanceId, String
configAppId, String configNamespaceName);
Page<InstanceConfig> findByReleaseKeyAndDataChangeLastModifiedTimeAfter(String releaseKey, Date
validDate, Pageable pageable);
Page<InstanceConfig> findByConfigAppIdAndConfigClusterNameAndConfigNamespaceNameAndDataChangeLastModifiedTimeAfter(
String appId, String clusterName, String namespaceName, Date validDate, Pageable pageable);
List<InstanceConfig> findByConfigAppIdAndConfigClusterNameAndConfigNamespaceNameAndDataChangeLastModifiedTimeAfterAndReleaseKeyNotIn(
String appId, String clusterName, String namespaceName, Date validDate, Set<String> releaseKey);
@Modifying
@Query("delete from InstanceConfig where ConfigAppId=?1 and ConfigClusterName=?2 and ConfigNamespaceName = ?3")
int batchDelete(String appId, String clusterName, String namespaceName);
@Query(
value = "select b.Id from `InstanceConfig` a inner join `Instance` b on b.Id =" +
" a.`InstanceId` where a.`ConfigAppId` = :configAppId and a.`ConfigClusterName` = " +
":clusterName and a.`ConfigNamespaceName` = :namespaceName and a.`DataChange_LastTime` " +
"> :validDate and b.`AppId` = :instanceAppId",
countQuery = "select count(1) from `InstanceConfig` a inner join `Instance` b on b.id =" +
" a.`InstanceId` where a.`ConfigAppId` = :configAppId and a.`ConfigClusterName` = " +
":clusterName and a.`ConfigNamespaceName` = :namespaceName and a.`DataChange_LastTime` " +
"> :validDate and b.`AppId` = :instanceAppId",
nativeQuery = true)
Page<Object> findInstanceIdsByNamespaceAndInstanceAppId(
@Param("instanceAppId") String instanceAppId, @Param("configAppId") String configAppId,
@Param("clusterName") String clusterName, @Param("namespaceName") String namespaceName,
@Param("validDate") Date validDate, Pageable pageable);
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/java/com/ctrip/framework/apollo/spring/config/ConfigPropertySourcesProcessor.java | package com.ctrip.framework.apollo.spring.config;
import com.ctrip.framework.apollo.spring.spi.ConfigPropertySourcesProcessorHelper;
import com.ctrip.framework.foundation.internals.ServiceBootstrap;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
/**
* Apollo Property Sources processor for Spring XML Based Application
*
* @author Jason Song([email protected])
*/
public class ConfigPropertySourcesProcessor extends PropertySourcesProcessor
implements BeanDefinitionRegistryPostProcessor {
private ConfigPropertySourcesProcessorHelper helper = ServiceBootstrap.loadPrimary(ConfigPropertySourcesProcessorHelper.class);
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
helper.postProcessBeanDefinitionRegistry(registry);
}
}
| package com.ctrip.framework.apollo.spring.config;
import com.ctrip.framework.apollo.spring.spi.ConfigPropertySourcesProcessorHelper;
import com.ctrip.framework.foundation.internals.ServiceBootstrap;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
/**
* Apollo Property Sources processor for Spring XML Based Application
*
* @author Jason Song([email protected])
*/
public class ConfigPropertySourcesProcessor extends PropertySourcesProcessor
implements BeanDefinitionRegistryPostProcessor {
private ConfigPropertySourcesProcessorHelper helper = ServiceBootstrap.loadPrimary(ConfigPropertySourcesProcessorHelper.class);
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
helper.postProcessBeanDefinitionRegistry(registry);
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/java/com/ctrip/framework/apollo/adminservice/controller/IndexController.java | package com.ctrip.framework.apollo.adminservice.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(path = "/")
public class IndexController {
@GetMapping
public String index() {
return "apollo-adminservice";
}
}
| package com.ctrip.framework.apollo.adminservice.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(path = "/")
public class IndexController {
@GetMapping
public String index() {
return "apollo-adminservice";
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/main/java/com/ctrip/framework/apollo/biz/repository/AccessKeyRepository.java | package com.ctrip.framework.apollo.biz.repository;
import com.ctrip.framework.apollo.biz.entity.AccessKey;
import java.util.Date;
import java.util.List;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface AccessKeyRepository extends PagingAndSortingRepository<AccessKey, Long> {
long countByAppId(String appId);
AccessKey findOneByAppIdAndId(String appId, long id);
List<AccessKey> findByAppId(String appId);
List<AccessKey> findFirst500ByDataChangeLastModifiedTimeGreaterThanOrderByDataChangeLastModifiedTimeAsc(Date date);
List<AccessKey> findByDataChangeLastModifiedTime(Date date);
}
| package com.ctrip.framework.apollo.biz.repository;
import com.ctrip.framework.apollo.biz.entity.AccessKey;
import java.util.Date;
import java.util.List;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface AccessKeyRepository extends PagingAndSortingRepository<AccessKey, Long> {
long countByAppId(String appId);
AccessKey findOneByAppIdAndId(String appId, long id);
List<AccessKey> findByAppId(String appId);
List<AccessKey> findFirst500ByDataChangeLastModifiedTimeGreaterThanOrderByDataChangeLastModifiedTimeAsc(Date date);
List<AccessKey> findByDataChangeLastModifiedTime(Date date);
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/main/java/com/ctrip/framework/foundation/internals/io/ProxyInputStream.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
* file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to You 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.foundation.internals.io;
import static com.ctrip.framework.foundation.internals.io.IOUtils.EOF;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* A Proxy stream which acts as expected, that is it passes the method calls on to the proxied stream and doesn't change
* which methods are being called.
* <p>
* It is an alternative base class to FilterInputStream to increase reusability, because FilterInputStream changes the
* methods being called, such as read(byte[]) to read(byte[], int, int).
* <p>
* See the protected methods for ways in which a subclass can easily decorate a stream with custom pre-, post- or error
* processing functionality.
*
* @version $Id: ProxyInputStream.java 1603493 2014-06-18 15:46:07Z ggregory $
*/
public abstract class ProxyInputStream extends FilterInputStream {
/**
* Constructs a new ProxyInputStream.
*
* @param proxy the InputStream to delegate to
*/
public ProxyInputStream(final InputStream proxy) {
super(proxy);
// the proxy is stored in a protected superclass variable named 'in'
}
/**
* Invokes the delegate's <code>read()</code> method.
*
* @return the byte read or -1 if the end of stream
* @throws IOException if an I/O error occurs
*/
@Override
public int read() throws IOException {
try {
beforeRead(1);
final int b = in.read();
afterRead(b != EOF ? 1 : EOF);
return b;
} catch (final IOException e) {
handleIOException(e);
return EOF;
}
}
/**
* Invokes the delegate's <code>read(byte[])</code> method.
*
* @param bts the buffer to read the bytes into
* @return the number of bytes read or EOF if the end of stream
* @throws IOException if an I/O error occurs
*/
@Override
public int read(final byte[] bts) throws IOException {
try {
beforeRead(bts != null ? bts.length : 0);
final int n = in.read(bts);
afterRead(n);
return n;
} catch (final IOException e) {
handleIOException(e);
return EOF;
}
}
/**
* Invokes the delegate's <code>read(byte[], int, int)</code> method.
*
* @param bts the buffer to read the bytes into
* @param off The start offset
* @param len The number of bytes to read
* @return the number of bytes read or -1 if the end of stream
* @throws IOException if an I/O error occurs
*/
@Override
public int read(final byte[] bts, final int off, final int len) throws IOException {
try {
beforeRead(len);
final int n = in.read(bts, off, len);
afterRead(n);
return n;
} catch (final IOException e) {
handleIOException(e);
return EOF;
}
}
/**
* Invokes the delegate's <code>skip(long)</code> method.
*
* @param ln the number of bytes to skip
* @return the actual number of bytes skipped
* @throws IOException if an I/O error occurs
*/
@Override
public long skip(final long ln) throws IOException {
try {
return in.skip(ln);
} catch (final IOException e) {
handleIOException(e);
return 0;
}
}
/**
* Invokes the delegate's <code>available()</code> method.
*
* @return the number of available bytes
* @throws IOException if an I/O error occurs
*/
@Override
public int available() throws IOException {
try {
return super.available();
} catch (final IOException e) {
handleIOException(e);
return 0;
}
}
/**
* Invokes the delegate's <code>close()</code> method.
*
* @throws IOException if an I/O error occurs
*/
@Override
public void close() throws IOException {
try {
in.close();
} catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invokes the delegate's <code>mark(int)</code> method.
*
* @param readlimit read ahead limit
*/
@Override
public synchronized void mark(final int readlimit) {
in.mark(readlimit);
}
/**
* Invokes the delegate's <code>reset()</code> method.
*
* @throws IOException if an I/O error occurs
*/
@Override
public synchronized void reset() throws IOException {
try {
in.reset();
} catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invokes the delegate's <code>markSupported()</code> method.
*
* @return true if mark is supported, otherwise false
*/
@Override
public boolean markSupported() {
return in.markSupported();
}
/**
* Invoked by the read methods before the call is proxied. The number of bytes that the caller wanted to read (1 for
* the {@link #read()} method, buffer length for {@link #read(byte[])}, etc.) is given as an argument.
* <p>
* Subclasses can override this method to add common pre-processing functionality without having to override all the
* read methods. The default implementation does nothing.
* <p>
* Note this method is <em>not</em> called from {@link #skip(long)} or {@link #reset()}. You need to explicitly
* override those methods if you want to add pre-processing steps also to them.
*
* @since 2.0
* @param n number of bytes that the caller asked to be read
* @throws IOException if the pre-processing fails
*/
protected void beforeRead(final int n) throws IOException {
// no-op
}
/**
* Invoked by the read methods after the proxied call has returned successfully. The number of bytes returned to the
* caller (or -1 if the end of stream was reached) is given as an argument.
* <p>
* Subclasses can override this method to add common post-processing functionality without having to override all the
* read methods. The default implementation does nothing.
* <p>
* Note this method is <em>not</em> called from {@link #skip(long)} or {@link #reset()}. You need to explicitly
* override those methods if you want to add post-processing steps also to them.
*
* @since 2.0
* @param n number of bytes read, or -1 if the end of stream was reached
* @throws IOException if the post-processing fails
*/
protected void afterRead(final int n) throws IOException {
// no-op
}
/**
* Handle any IOExceptions thrown.
* <p>
* This method provides a point to implement custom exception handling. The default behaviour is to re-throw the
* exception.
*
* @param e The IOException thrown
* @throws IOException if an I/O error occurs
* @since 2.0
*/
protected void handleIOException(final IOException e) throws IOException {
throw e;
}
}
| /*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
* file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to You 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.foundation.internals.io;
import static com.ctrip.framework.foundation.internals.io.IOUtils.EOF;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
/**
* A Proxy stream which acts as expected, that is it passes the method calls on to the proxied stream and doesn't change
* which methods are being called.
* <p>
* It is an alternative base class to FilterInputStream to increase reusability, because FilterInputStream changes the
* methods being called, such as read(byte[]) to read(byte[], int, int).
* <p>
* See the protected methods for ways in which a subclass can easily decorate a stream with custom pre-, post- or error
* processing functionality.
*
* @version $Id: ProxyInputStream.java 1603493 2014-06-18 15:46:07Z ggregory $
*/
public abstract class ProxyInputStream extends FilterInputStream {
/**
* Constructs a new ProxyInputStream.
*
* @param proxy the InputStream to delegate to
*/
public ProxyInputStream(final InputStream proxy) {
super(proxy);
// the proxy is stored in a protected superclass variable named 'in'
}
/**
* Invokes the delegate's <code>read()</code> method.
*
* @return the byte read or -1 if the end of stream
* @throws IOException if an I/O error occurs
*/
@Override
public int read() throws IOException {
try {
beforeRead(1);
final int b = in.read();
afterRead(b != EOF ? 1 : EOF);
return b;
} catch (final IOException e) {
handleIOException(e);
return EOF;
}
}
/**
* Invokes the delegate's <code>read(byte[])</code> method.
*
* @param bts the buffer to read the bytes into
* @return the number of bytes read or EOF if the end of stream
* @throws IOException if an I/O error occurs
*/
@Override
public int read(final byte[] bts) throws IOException {
try {
beforeRead(bts != null ? bts.length : 0);
final int n = in.read(bts);
afterRead(n);
return n;
} catch (final IOException e) {
handleIOException(e);
return EOF;
}
}
/**
* Invokes the delegate's <code>read(byte[], int, int)</code> method.
*
* @param bts the buffer to read the bytes into
* @param off The start offset
* @param len The number of bytes to read
* @return the number of bytes read or -1 if the end of stream
* @throws IOException if an I/O error occurs
*/
@Override
public int read(final byte[] bts, final int off, final int len) throws IOException {
try {
beforeRead(len);
final int n = in.read(bts, off, len);
afterRead(n);
return n;
} catch (final IOException e) {
handleIOException(e);
return EOF;
}
}
/**
* Invokes the delegate's <code>skip(long)</code> method.
*
* @param ln the number of bytes to skip
* @return the actual number of bytes skipped
* @throws IOException if an I/O error occurs
*/
@Override
public long skip(final long ln) throws IOException {
try {
return in.skip(ln);
} catch (final IOException e) {
handleIOException(e);
return 0;
}
}
/**
* Invokes the delegate's <code>available()</code> method.
*
* @return the number of available bytes
* @throws IOException if an I/O error occurs
*/
@Override
public int available() throws IOException {
try {
return super.available();
} catch (final IOException e) {
handleIOException(e);
return 0;
}
}
/**
* Invokes the delegate's <code>close()</code> method.
*
* @throws IOException if an I/O error occurs
*/
@Override
public void close() throws IOException {
try {
in.close();
} catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invokes the delegate's <code>mark(int)</code> method.
*
* @param readlimit read ahead limit
*/
@Override
public synchronized void mark(final int readlimit) {
in.mark(readlimit);
}
/**
* Invokes the delegate's <code>reset()</code> method.
*
* @throws IOException if an I/O error occurs
*/
@Override
public synchronized void reset() throws IOException {
try {
in.reset();
} catch (final IOException e) {
handleIOException(e);
}
}
/**
* Invokes the delegate's <code>markSupported()</code> method.
*
* @return true if mark is supported, otherwise false
*/
@Override
public boolean markSupported() {
return in.markSupported();
}
/**
* Invoked by the read methods before the call is proxied. The number of bytes that the caller wanted to read (1 for
* the {@link #read()} method, buffer length for {@link #read(byte[])}, etc.) is given as an argument.
* <p>
* Subclasses can override this method to add common pre-processing functionality without having to override all the
* read methods. The default implementation does nothing.
* <p>
* Note this method is <em>not</em> called from {@link #skip(long)} or {@link #reset()}. You need to explicitly
* override those methods if you want to add pre-processing steps also to them.
*
* @since 2.0
* @param n number of bytes that the caller asked to be read
* @throws IOException if the pre-processing fails
*/
protected void beforeRead(final int n) throws IOException {
// no-op
}
/**
* Invoked by the read methods after the proxied call has returned successfully. The number of bytes returned to the
* caller (or -1 if the end of stream was reached) is given as an argument.
* <p>
* Subclasses can override this method to add common post-processing functionality without having to override all the
* read methods. The default implementation does nothing.
* <p>
* Note this method is <em>not</em> called from {@link #skip(long)} or {@link #reset()}. You need to explicitly
* override those methods if you want to add post-processing steps also to them.
*
* @since 2.0
* @param n number of bytes read, or -1 if the end of stream was reached
* @throws IOException if the post-processing fails
*/
protected void afterRead(final int n) throws IOException {
// no-op
}
/**
* Handle any IOExceptions thrown.
* <p>
* This method provides a point to implement custom exception handling. The default behaviour is to re-throw the
* exception.
*
* @param e The IOException thrown
* @throws IOException if an I/O error occurs
* @since 2.0
*/
protected void handleIOException(final IOException e) throws IOException {
throw e;
}
}
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/resources/properties/server.properties | idc=SHAJQ
env=DEV
subenv=Dev123
bigdata=true
tooling=true
pci=true
| idc=SHAJQ
env=DEV
subenv=Dev123
bigdata=true
tooling=true
pci=true
| -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/vendor/angular/angular-translate.2.18.1/angular-translate.min.js | /*!
* angular-translate - v2.18.1 - 2018-05-19
*
* Copyright (c) 2018 The angular-translate team, Pascal Precht; Licensed MIT
*/
!function(t,e){"function"==typeof define&&define.amd?define([],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():e()}(0,function(){function t(e){"use strict";var n=e.storageKey(),a=e.storage(),t=function(){var t=e.preferredLanguage();angular.isString(t)?e.use(t):a.put(n,e.use())};t.displayName="fallbackFromIncorrectStorageValue",a?a.get(n)?e.use(a.get(n)).catch(t):t():angular.isString(e.preferredLanguage())&&e.use(e.preferredLanguage())}function e(t,r,e,i){"use strict";var z,c,T,x,F,I,_,n,V,R,D,K,U,M,H,G,q={},Y=[],B=t,J=[],Q="translate-cloak",W=!1,X=!1,Z=".",tt=!1,et=!1,nt=0,at=!0,a="default",s={default:function(t){return(t||"").split("-").join("_")},java:function(t){var e=(t||"").split("-").join("_"),n=e.split("_");return 1<n.length?n[0].toLowerCase()+"_"+n[1].toUpperCase():e},bcp47:function(t){var e=(t||"").split("_").join("-"),n=e.split("-");switch(n.length){case 1:n[0]=n[0].toLowerCase();break;case 2:n[0]=n[0].toLowerCase(),4===n[1].length?n[1]=n[1].charAt(0).toUpperCase()+n[1].slice(1).toLowerCase():n[1]=n[1].toUpperCase();break;case 3:n[0]=n[0].toLowerCase(),n[1]=n[1].charAt(0).toUpperCase()+n[1].slice(1).toLowerCase(),n[2]=n[2].toUpperCase();break;default:return e}return n.join("-")},"iso639-1":function(t){return(t||"").split("_").join("-").split("-")[0].toLowerCase()}},o=function(){if(angular.isFunction(i.getLocale))return i.getLocale();var t,e,n=r.$get().navigator,a=["language","browserLanguage","systemLanguage","userLanguage"];if(angular.isArray(n.languages))for(t=0;t<n.languages.length;t++)if((e=n.languages[t])&&e.length)return e;for(t=0;t<a.length;t++)if((e=n[a[t]])&&e.length)return e;return null};o.displayName="angular-translate/service: getFirstBrowserLanguage";var rt=function(){var t=o()||"";return s[a]&&(t=s[a](t)),t};rt.displayName="angular-translate/service: getLocale";var it=function(t,e){for(var n=0,a=t.length;n<a;n++)if(t[n]===e)return n;return-1},st=function(){return this.toString().replace(/^\s+|\s+$/g,"")},f=function(t){return angular.isString(t)?t.toLowerCase():t},ot=function(t){if(t){for(var e,n=[],a=f(t),r=0,i=Y.length;r<i;r++)n.push(f(Y[r]));if(-1<(r=it(n,a)))return Y[r];if(c)for(var s in c)if(c.hasOwnProperty(s)){var o=!1,l=Object.prototype.hasOwnProperty.call(c,s)&&f(s)===f(t);if("*"===s.slice(-1)&&(o=f(s.slice(0,-1))===f(t.slice(0,s.length-1))),(l||o)&&(e=c[s],-1<it(n,f(e))))return e}var u=t.split("_");return 1<u.length&&-1<it(n,f(u[0]))?u[0]:void 0}},lt=function(t,e){if(!t&&!e)return q;if(t&&!e){if(angular.isString(t))return q[t]}else angular.isObject(q[t])||(q[t]={}),angular.extend(q[t],ut(e));return this};this.translations=lt,this.cloakClassName=function(t){return t?(Q=t,this):Q},this.nestedObjectDelimeter=function(t){return t?(Z=t,this):Z};var ut=function(t,e,n,a){var r,i,s;for(r in e||(e=[]),n||(n={}),t)Object.prototype.hasOwnProperty.call(t,r)&&(s=t[r],angular.isObject(s)?ut(s,e.concat(r),n,r):(i=e.length?""+e.join(Z)+Z+r:r,e.length&&r===a&&(n[""+e.join(Z)]="@:"+i),n[i]=s));return n};ut.displayName="flatObject",this.addInterpolation=function(t){return J.push(t),this},this.useMessageFormatInterpolation=function(){return this.useInterpolation("$translateMessageFormatInterpolation")},this.useInterpolation=function(t){return R=t,this},this.useSanitizeValueStrategy=function(t){return e.useStrategy(t),this},this.preferredLanguage=function(t){return t?(ct(t),this):z};var ct=function(t){return t&&(z=t),z};this.translationNotFoundIndicator=function(t){return this.translationNotFoundIndicatorLeft(t),this.translationNotFoundIndicatorRight(t),this},this.translationNotFoundIndicatorLeft=function(t){return t?(U=t,this):U},this.translationNotFoundIndicatorRight=function(t){return t?(M=t,this):M},this.fallbackLanguage=function(t){return ft(t),this};var ft=function(t){return t?(angular.isString(t)?(x=!0,T=[t]):angular.isArray(t)&&(x=!1,T=t),angular.isString(z)&&it(T,z)<0&&T.push(z),this):x?T[0]:T};this.use=function(t){if(t){if(!q[t]&&!D)throw new Error("$translateProvider couldn't find translationTable for langKey: '"+t+"'");return F=t,this}return F},this.resolveClientLocale=function(){return rt()};var gt=function(t){return t?(B=t,this):n?n+B:B};this.storageKey=gt,this.useUrlLoader=function(t,e){return this.useLoader("$translateUrlLoader",angular.extend({url:t},e))},this.useStaticFilesLoader=function(t){return this.useLoader("$translateStaticFilesLoader",t)},this.useLoader=function(t,e){return D=t,K=e||{},this},this.useLocalStorage=function(){return this.useStorage("$translateLocalStorage")},this.useCookieStorage=function(){return this.useStorage("$translateCookieStorage")},this.useStorage=function(t){return _=t,this},this.storagePrefix=function(t){return t?(n=t,this):t},this.useMissingTranslationHandlerLog=function(){return this.useMissingTranslationHandler("$translateMissingTranslationHandlerLog")},this.useMissingTranslationHandler=function(t){return V=t,this},this.usePostCompiling=function(t){return W=!!t,this},this.forceAsyncReload=function(t){return X=!!t,this},this.uniformLanguageTag=function(t){return t?angular.isString(t)&&(t={standard:t}):t={},a=t.standard,this},this.determinePreferredLanguage=function(t){var e=t&&angular.isFunction(t)?t():rt();return z=Y.length&&ot(e)||e,this},this.registerAvailableLanguageKeys=function(t,e){return t?(Y=t,e&&(c=e),this):Y},this.useLoaderCache=function(t){return!1===t?H=void 0:!0===t?H=!0:void 0===t?H="$translationCache":t&&(H=t),this},this.directivePriority=function(t){return void 0===t?nt:(nt=t,this)},this.statefulFilter=function(t){return void 0===t?at:(at=t,this)},this.postProcess=function(t){return G=t||void 0,this},this.keepContent=function(t){return et=!!t,this},this.$get=["$log","$injector","$rootScope","$q",function(t,o,s,m){var i,$,y,b=o.get(R||"$translateDefaultInterpolation"),S=!1,L={},f={},j=function(t,s,o,l,u,c){!F&&z&&(F=z);var a=u&&u!==F?ot(u)||u:F;if(u&&v(u),angular.isArray(t)){return function(t){for(var a={},e=[],n=function(e){var n=m.defer(),t=function(t){a[e]=t,n.resolve([e,t])};return j(e,s,o,l,u,c).then(t,t),n.promise},r=0,i=t.length;r<i;r++)e.push(n(t[r]));return m.all(e).then(function(){return a})}(t)}var e=m.defer();t&&(t=st.apply(t));var n=function(){var t=f[a]||f[z];if($=0,_&&!t){var e=i.get(B);if(t=f[e],T&&T.length){var n=it(T,e);$=0===n?1:0,it(T,z)<0&&T.push(z)}}return t}();if(n){var r=function(){u||(a=F),h(t,s,o,l,a,c).then(e.resolve,e.reject)};r.displayName="promiseResolved",n.finally(r).catch(angular.noop)}else h(t,s,o,l,a,c).then(e.resolve,e.reject);return e.promise},w=function(t){return U&&(t=[U,t].join(" ")),M&&(t=[t,M].join(" ")),t},l=function(t){F=t,_&&i.put(j.storageKey(),F),s.$emit("$translateChangeSuccess",{language:t}),b.setLocale(F);var e=function(t,e){L[e].setLocale(F)};e.displayName="eachInterpolatorLocaleSetter",angular.forEach(L,e),s.$emit("$translateChangeEnd",{language:t})},u=function(n){if(!n)throw"No language key specified for loading.";var a=m.defer();s.$emit("$translateLoadingStart",{language:n}),S=!0;var t=H;"string"==typeof t&&(t=o.get(t));var e=angular.extend({},K,{key:n,$http:angular.extend({},{cache:t},K.$http)}),r=function(t){var e={};s.$emit("$translateLoadingSuccess",{language:n}),angular.isArray(t)?angular.forEach(t,function(t){angular.extend(e,ut(t))}):angular.extend(e,ut(t)),S=!1,a.resolve({key:n,table:e}),s.$emit("$translateLoadingEnd",{language:n})};r.displayName="onLoaderSuccess";var i=function(t){s.$emit("$translateLoadingError",{language:t}),a.reject(t),s.$emit("$translateLoadingEnd",{language:t})};return i.displayName="onLoaderError",o.get(D)(e).then(r,i),a.promise};if(_&&(!(i=o.get(_)).get||!i.put))throw new Error("Couldn't use storage '"+_+"', missing get() or put() method!");if(J.length){var e=function(t){var e=o.get(t);e.setLocale(z||F),L[e.getInterpolationIdentifier()]=e};e.displayName="interpolationFactoryAdder",angular.forEach(J,e)}var c=function(a,r,i,s,o){var l=m.defer(),t=function(t){if(Object.prototype.hasOwnProperty.call(t,r)&&null!==t[r]){s.setLocale(a);var e=t[r];if("@:"===e.substr(0,2))c(a,e.substr(2),i,s,o).then(l.resolve,l.reject);else{var n=s.interpolate(t[r],i,"service",o,r);n=O(r,t[r],n,i,a),l.resolve(n)}s.setLocale(F)}else l.reject()};return t.displayName="fallbackTranslationResolver",function(t){var e=m.defer();if(Object.prototype.hasOwnProperty.call(q,t))e.resolve(q[t]);else if(f[t]){var n=function(t){lt(t.key,t.table),e.resolve(t.table)};n.displayName="translationTableResolver",f[t].then(n,e.reject)}else e.reject();return e.promise}(a).then(t,l.reject),l.promise},g=function(t,e,n,a,r){var i,s=q[t];if(s&&Object.prototype.hasOwnProperty.call(s,e)&&null!==s[e]){if(a.setLocale(t),i=a.interpolate(s[e],n,"filter",r,e),i=O(e,s[e],i,n,t,r),!angular.isString(i)&&angular.isFunction(i.$$unwrapTrustedValue)){var o=i.$$unwrapTrustedValue();if("@:"===o.substr(0,2))return g(t,o.substr(2),n,a,r)}else if("@:"===i.substr(0,2))return g(t,i.substr(2),n,a,r);a.setLocale(F)}return i},C=function(t,e,n,a){return V?o.get(V)(t,F,e,n,a):t},N=function(t,e,n,a,r,i){var s=m.defer();if(t<T.length){var o=T[t];c(o,e,n,a,i).then(function(t){s.resolve(t)},function(){return N(t+1,e,n,a,r,i).then(s.resolve,s.reject)})}else if(r)s.resolve(r);else{var l=C(e,n,r);V&&l?s.resolve(l):s.reject(w(e))}return s.promise},p=function(t,e,n,a,r){var i;if(t<T.length){var s=T[t];(i=g(s,e,n,a,r))||""===i||(i=p(t+1,e,n,a))}return i},h=function(t,e,n,a,r,i){var s,o,l,u,c,f=m.defer(),g=r?q[r]:q,p=n?L[n]:b;if(g&&Object.prototype.hasOwnProperty.call(g,t)&&null!==g[t]){var h=g[t];if("@:"===h.substr(0,2))j(h.substr(2),e,n,a,r,i).then(f.resolve,f.reject);else{var d=p.interpolate(h,e,"service",i,t);d=O(t,h,d,e,r),f.resolve(d)}}else{var v;V&&!S&&(v=C(t,e,a)),r&&T&&T.length?(s=t,o=e,l=p,u=a,c=i,N(0<y?y:$,s,o,l,u,c)).then(function(t){f.resolve(t)},function(t){f.reject(w(t))}):V&&!S&&v?a?f.resolve(a):f.resolve(v):a?f.resolve(a):f.reject(w(t))}return f.promise},d=function(t,e,n,a,r){var i,s=a?q[a]:q,o=b;if(L&&Object.prototype.hasOwnProperty.call(L,n)&&(o=L[n]),s&&Object.prototype.hasOwnProperty.call(s,t)&&null!==s[t]){var l=s[t];"@:"===l.substr(0,2)?i=d(l.substr(2),e,n,a,r):(i=o.interpolate(l,e,"filter",r,t),i=O(t,l,i,e,a,r))}else{var u;V&&!S&&(u=C(t,e,r)),i=a&&T&&T.length?p(($=0)<y?y:$,t,e,o,r):V&&!S&&u?u:w(t)}return i},O=function(t,e,n,a,r,i){var s=G;return s&&("string"==typeof s&&(s=o.get(s)),s)?s(t,e,n,a,r,i):n},v=function(t){q[t]||!D||f[t]||(f[t]=u(t).then(function(t){return lt(t.key,t.table),t}))};j.preferredLanguage=function(t){return t&&ct(t),z},j.cloakClassName=function(){return Q},j.nestedObjectDelimeter=function(){return Z},j.fallbackLanguage=function(t){if(null!=t){if(ft(t),D&&T&&T.length)for(var e=0,n=T.length;e<n;e++)f[T[e]]||(f[T[e]]=u(T[e]));j.use(j.use())}return x?T[0]:T},j.useFallbackLanguage=function(t){if(null!=t)if(t){var e=it(T,t);-1<e&&(y=e)}else y=0},j.proposedLanguage=function(){return I},j.storage=function(){return i},j.negotiateLocale=ot,j.use=function(e){if(!e)return F;var n=m.defer();n.promise.then(null,angular.noop),s.$emit("$translateChangeStart",{language:e});var t=ot(e);return 0<Y.length&&!t?m.reject(e):(t&&(e=t),I=e,!X&&q[e]||!D||f[e]?f[e]?f[e].then(function(t){return I===t.key&&l(t.key),n.resolve(t.key),t},function(t){return!F&&T&&0<T.length&&T[0]!==t?j.use(T[0]).then(n.resolve,n.reject):n.reject(t)}):(n.resolve(e),l(e)):(f[e]=u(e).then(function(t){return lt(t.key,t.table),n.resolve(t.key),I===e&&l(t.key),t},function(t){return s.$emit("$translateChangeError",{language:t}),n.reject(t),s.$emit("$translateChangeEnd",{language:t}),m.reject(t)}),f[e].finally(function(){var t;I===(t=e)&&(I=void 0),f[t]=void 0}).catch(angular.noop)),n.promise)},j.resolveClientLocale=function(){return rt()},j.storageKey=function(){return gt()},j.isPostCompilingEnabled=function(){return W},j.isForceAsyncReloadEnabled=function(){return X},j.isKeepContent=function(){return et},j.refresh=function(t){if(!D)throw new Error("Couldn't refresh translation table, no loader registered!");s.$emit("$translateRefreshStart",{language:t});var e=m.defer(),n={};function a(e){var t=u(e);return(f[e]=t).then(function(t){q[e]={},lt(e,t.table),n[e]=!0},angular.noop),t}if(e.promise.then(function(){for(var t in q)q.hasOwnProperty(t)&&(t in n||delete q[t]);F&&l(F)},angular.noop).finally(function(){s.$emit("$translateRefreshEnd",{language:t})}),t)q[t]?a(t).then(e.resolve,e.reject):e.reject();else{var r=T&&T.slice()||[];F&&-1===r.indexOf(F)&&r.push(F),m.all(r.map(a)).then(e.resolve,e.reject)}return e.promise},j.instant=function(t,e,n,a,r){var i=a&&a!==F?ot(a)||a:F;if(null===t||angular.isUndefined(t))return t;if(a&&v(a),angular.isArray(t)){for(var s={},o=0,l=t.length;o<l;o++)s[t[o]]=j.instant(t[o],e,n,a,r);return s}if(angular.isString(t)&&t.length<1)return t;t&&(t=st.apply(t));var u,c,f=[];z&&f.push(z),i&&f.push(i),T&&T.length&&(f=f.concat(T));for(var g=0,p=f.length;g<p;g++){var h=f[g];if(q[h]&&void 0!==q[h][t]&&(u=d(t,e,n,i,r)),void 0!==u)break}u||""===u||(U||M?u=w(t):(u=b.interpolate(t,e,"filter",r),V&&!S&&(c=C(t,e,r)),V&&!S&&c&&(u=c)));return u},j.versionInfo=function(){return"2.18.1"},j.loaderCache=function(){return H},j.directivePriority=function(){return nt},j.statefulFilter=function(){return at},j.isReady=function(){return tt};var n=m.defer();n.promise.then(function(){tt=!0}),j.onReady=function(t){var e=m.defer();return angular.isFunction(t)&&e.promise.then(t),tt?e.resolve():n.promise.then(e.resolve),e.promise},j.getAvailableLanguageKeys=function(){return 0<Y.length?Y:null},j.getTranslationTable=function(t){return(t=t||j.use())&&q[t]?angular.copy(q[t]):null};var a=s.$on("$translateReady",function(){n.resolve(),a(),a=null}),r=s.$on("$translateChangeEnd",function(){n.resolve(),r(),r=null});if(D){if(angular.equals(q,{})&&j.use()&&j.use(j.use()),T&&T.length)for(var E=function(t){return lt(t.key,t.table),s.$emit("$translateChangeEnd",{language:t.key}),t},k=0,P=T.length;k<P;k++){var A=T[k];!X&&q[A]||(f[A]=u(A).then(E))}}else s.$emit("$translateReady",{language:j.use()});return j}]}function n(s,o){"use strict";var t={};return t.setLocale=function(t){t},t.getInterpolationIdentifier=function(){return"default"},t.useSanitizeValueStrategy=function(t){return o.useStrategy(t),this},t.interpolate=function(t,e,n,a,r){var i;return e=e||{},e=o.sanitize(e,"params",a,n),angular.isNumber(t)?i=""+t:angular.isString(t)?(i=s(t)(e),i=o.sanitize(i,"text",a,n)):i="",i},t}function a(S,L,j,w,C){"use strict";var N=function(t){return angular.isString(t)?t.toLowerCase():t};return{restrict:"AE",scope:!0,priority:S.directivePriority(),compile:function(t,h){var d=h.translateValues?h.translateValues:void 0,v=h.translateInterpolation?h.translateInterpolation:void 0,m=h.translateSanitizeStrategy?h.translateSanitizeStrategy:void 0,$=t[0].outerHTML.match(/translate-value-+/i),y="^(.*)("+L.startSymbol()+".*"+L.endSymbol()+")(.*)",b="^(.*)"+L.startSymbol()+"(.*)"+L.endSymbol()+"(.*)";return function(r,l,u){r.interpolateParams={},r.preText="",r.postText="",r.translateNamespace=function t(e){if(e.translateNamespace)return e.translateNamespace;if(e.$parent)return t(e.$parent)}(r);var i={},s=function(t){if(angular.isFunction(s._unwatchOld)&&(s._unwatchOld(),s._unwatchOld=void 0),angular.equals(t,"")||!angular.isDefined(t)){var e=function(){return this.toString().replace(/^\s+|\s+$/g,"")}.apply(l.text()),n=e.match(y);if(angular.isArray(n)){r.preText=n[1],r.postText=n[3],i.translate=L(n[2])(r.$parent);var a=e.match(b);angular.isArray(a)&&a[2]&&a[2].length&&(s._unwatchOld=r.$watch(a[2],function(t){i.translate=t,c()}))}else i.translate=e||void 0}else i.translate=t;c()},t=function(e){u.$observe(e,function(t){i[e]=t,c()})};!function(t,e,n){if(e.translateValues&&angular.extend(t,w(e.translateValues)(r.$parent)),$)for(var a in n)Object.prototype.hasOwnProperty.call(e,a)&&"translateValue"===a.substr(0,14)&&"translateValues"!==a&&(t[N(a.substr(14,1))+a.substr(15)]=n[a])}(r.interpolateParams,u,h);var e=!0;for(var n in u.$observe("translate",function(t){void 0===t?s(""):""===t&&e||(i.translate=t,c()),e=!1}),u)u.hasOwnProperty(n)&&"translateAttr"===n.substr(0,13)&&13<n.length&&t(n);if(u.$observe("translateDefault",function(t){r.defaultText=t,c()}),m&&u.$observe("translateSanitizeStrategy",function(t){r.sanitizeStrategy=w(t)(r.$parent),c()}),d&&u.$observe("translateValues",function(t){t&&r.$parent.$watch(function(){angular.extend(r.interpolateParams,w(t)(r.$parent))})}),$){var a=function(n){u.$observe(n,function(t){var e=N(n.substr(14,1))+n.substr(15);r.interpolateParams[e]=t})};for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&"translateValue"===o.substr(0,14)&&"translateValues"!==o&&a(o)}var c=function(){for(var t in i)i.hasOwnProperty(t)&&void 0!==i[t]&&f(t,i[t],r,r.interpolateParams,r.defaultText,r.translateNamespace)},f=function(e,t,n,a,r,i){t?(i&&"."===t.charAt(0)&&(t=i+t),S(t,a,v,r,n.translateLanguage,n.sanitizeStrategy).then(function(t){g(t,n,!0,e)},function(t){g(t,n,!1,e)})):g(t,n,!1,e)},g=function(t,e,n,a){if(n||void 0!==e.defaultText&&(t=e.defaultText),"translate"===a){(n||!n&&!S.isKeepContent()&&void 0===u.translateKeepContent)&&l.empty().append(e.preText+t+e.postText);var r=S.isPostCompilingEnabled(),i=void 0!==h.translateCompile,s=i&&"false"!==h.translateCompile;(r&&!i||s)&&j(l.contents())(e)}else{var o=u.$attr[a];"data-"===o.substr(0,5)&&(o=o.substr(5)),o=o.substr(15),l.attr(o,t)}};(d||$||u.translateDefault)&&r.$watch("interpolateParams",c,!0),r.$on("translateLanguageChanged",c);var p=C.$on("$translateChangeSuccess",c);l.text().length?u.translate?s(u.translate):s(""):u.translate&&s(u.translate),c(),r.$on("$destroy",p)}}}}function r(u,c){"use strict";return{restrict:"A",priority:u.directivePriority(),link:function(n,a,r){var i,s,o,l={},t=function(){angular.forEach(i,function(t,e){t&&(l[e]=!0,n.translateNamespace&&"."===t.charAt(0)&&(t=n.translateNamespace+t),u(t,s,r.translateInterpolation,void 0,n.translateLanguage,o).then(function(t){a.attr(e,t)},function(t){a.attr(e,t)}))}),angular.forEach(l,function(t,e){i[e]||(a.removeAttr(e),delete l[e])})};f(n,r.translateAttr,function(t){i=t},t),f(n,r.translateValues,function(t){s=t},t),f(n,r.translateSanitizeStrategy,function(t){o=t},t),r.translateValues&&n.$watch(r.translateValues,t,!0),n.$on("translateLanguageChanged",t);var e=c.$on("$translateChangeSuccess",t);t(),n.$on("$destroy",e)}}}function f(t,e,n,a){"use strict";e&&("::"===e.substr(0,2)?e=e.substr(2):t.$watch(e,function(t){n(t),a()},!0),n(t.$eval(e)))}function i(s,o){"use strict";return{compile:function(t){var i=function(t){t.addClass(s.cloakClassName())};return i(t),function(t,e,n){var a=function(t){t.removeClass(s.cloakClassName())}.bind(this,e),r=i.bind(this,e);n.translateCloak&&n.translateCloak.length?(n.$observe("translateCloak",function(t){s(t).then(a,r)}),o.$on("$translateChangeSuccess",function(){s(n.translateCloak).then(a,r)})):s.onReady(a)}}}}function s(){"use strict";return{restrict:"A",scope:!0,compile:function(){return{pre:function(t,e,n){t.translateNamespace=function t(e){if(e.translateNamespace)return e.translateNamespace;if(e.$parent)return t(e.$parent)}(t),t.translateNamespace&&"."===n.translateNamespace.charAt(0)?t.translateNamespace+=n.translateNamespace:t.translateNamespace=n.translateNamespace}}}}}function o(){"use strict";return{restrict:"A",scope:!0,compile:function(){return function(e,t,n){n.$observe("translateLanguage",function(t){e.translateLanguage=t}),e.$watch("translateLanguage",function(){e.$broadcast("translateLanguageChanged")})}}}}function l(i,s){"use strict";var t=function(t,e,n,a){if(!angular.isObject(e)){var r=this||{__SCOPE_IS_NOT_AVAILABLE:"More info at https://github.com/angular/angular.js/commit/8863b9d04c722b278fa93c5d66ad1e578ad6eb1f"};e=i(e)(r)}return s.instant(t,e,n,a)};return s.statefulFilter()&&(t.$stateful=!0),t}function u(t){"use strict";return t("translations")}return t.$inject=["$translate"],e.$inject=["$STORAGE_KEY","$windowProvider","$translateSanitizationProvider","pascalprechtTranslateOverrider"],n.$inject=["$interpolate","$translateSanitization"],a.$inject=["$translate","$interpolate","$compile","$parse","$rootScope"],r.$inject=["$translate","$rootScope"],i.$inject=["$translate","$rootScope"],l.$inject=["$parse","$translate"],u.$inject=["$cacheFactory"],angular.module("pascalprecht.translate",["ng"]).run(t),t.displayName="runTranslate",angular.module("pascalprecht.translate").provider("$translateSanitization",function(){"use strict";var n,a,g,p=null,h=!1,d=!1;(g={sanitize:function(t,e){return"text"===e&&(t=i(t)),t},escape:function(t,e){return"text"===e&&(t=r(t)),t},sanitizeParameters:function(t,e){return"params"===e&&(t=o(t,i)),t},escapeParameters:function(t,e){return"params"===e&&(t=o(t,r)),t},sce:function(t,e,n){return"text"===e?t=s(t):"params"===e&&"filter"!==n&&(t=o(t,r)),t},sceParameters:function(t,e){return"params"===e&&(t=o(t,s)),t}}).escaped=g.escapeParameters,this.addStrategy=function(t,e){return g[t]=e,this},this.removeStrategy=function(t){return delete g[t],this},this.useStrategy=function(t){return h=!0,p=t,this},this.$get=["$injector","$log",function(u,c){var e,f={};return u.has("$sanitize")&&(n=u.get("$sanitize")),u.has("$sce")&&(a=u.get("$sce")),{useStrategy:(e=this,function(t){e.useStrategy(t)}),sanitize:function(t,e,n,a){if(p||h||d||(c.warn("pascalprecht.translate.$translateSanitization: No sanitization strategy has been configured. This can have serious security implications. See http://angular-translate.github.io/docs/#/guide/19_security for details."),d=!0),n||null===n||(n=p),!n)return t;a||(a="service");var r,i,s,o,l=angular.isArray(n)?n:[n];return r=t,i=e,s=a,o=l,angular.forEach(o,function(e){if(angular.isFunction(e))r=e(r,i,s);else if(angular.isFunction(g[e]))r=g[e](r,i,s);else{if(!angular.isString(g[e]))throw new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+e+"'");if(!f[g[e]])try{f[g[e]]=u.get(g[e])}catch(t){throw f[g[e]]=function(){},new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+e+"'")}r=f[g[e]](r,i,s)}}),r}}}];var r=function(t){var e=angular.element("<div></div>");return e.text(t),e.html()},i=function(t){if(!n)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot find $sanitize service. Either include the ngSanitize module (https://docs.angularjs.org/api/ngSanitize) or use a sanitization strategy which does not depend on $sanitize, such as 'escape'.");return n(t)},s=function(t){if(!a)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot find $sce service.");return a.trustAsHtml(t)},o=function(t,n,a){if(angular.isDate(t))return t;if(angular.isObject(t)){var r=angular.isArray(t)?[]:{};if(a){if(-1<a.indexOf(t))throw new Error("pascalprecht.translate.$translateSanitization: Error cannot interpolate parameter due recursive object")}else a=[];return a.push(t),angular.forEach(t,function(t,e){angular.isFunction(t)||(r[e]=o(t,n,a))}),a.splice(-1,1),r}return angular.isNumber(t)?t:!0===t||!1===t?t:angular.isUndefined(t)||null===t?t:n(t)}}),angular.module("pascalprecht.translate").constant("pascalprechtTranslateOverrider",{}).provider("$translate",e),e.displayName="displayName",angular.module("pascalprecht.translate").factory("$translateDefaultInterpolation",n),n.displayName="$translateDefaultInterpolation",angular.module("pascalprecht.translate").constant("$STORAGE_KEY","NG_TRANSLATE_LANG_KEY"),angular.module("pascalprecht.translate").directive("translate",a),a.displayName="translateDirective",angular.module("pascalprecht.translate").directive("translateAttr",r),r.displayName="translateAttrDirective",angular.module("pascalprecht.translate").directive("translateCloak",i),i.displayName="translateCloakDirective",angular.module("pascalprecht.translate").directive("translateNamespace",s),s.displayName="translateNamespaceDirective",angular.module("pascalprecht.translate").directive("translateLanguage",o),o.displayName="translateLanguageDirective",angular.module("pascalprecht.translate").filter("translate",l),l.displayName="translateFilterFactory",angular.module("pascalprecht.translate").factory("$translationCache",u),u.displayName="$translationCache","pascalprecht.translate"}); | /*!
* angular-translate - v2.18.1 - 2018-05-19
*
* Copyright (c) 2018 The angular-translate team, Pascal Precht; Licensed MIT
*/
!function(t,e){"function"==typeof define&&define.amd?define([],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():e()}(0,function(){function t(e){"use strict";var n=e.storageKey(),a=e.storage(),t=function(){var t=e.preferredLanguage();angular.isString(t)?e.use(t):a.put(n,e.use())};t.displayName="fallbackFromIncorrectStorageValue",a?a.get(n)?e.use(a.get(n)).catch(t):t():angular.isString(e.preferredLanguage())&&e.use(e.preferredLanguage())}function e(t,r,e,i){"use strict";var z,c,T,x,F,I,_,n,V,R,D,K,U,M,H,G,q={},Y=[],B=t,J=[],Q="translate-cloak",W=!1,X=!1,Z=".",tt=!1,et=!1,nt=0,at=!0,a="default",s={default:function(t){return(t||"").split("-").join("_")},java:function(t){var e=(t||"").split("-").join("_"),n=e.split("_");return 1<n.length?n[0].toLowerCase()+"_"+n[1].toUpperCase():e},bcp47:function(t){var e=(t||"").split("_").join("-"),n=e.split("-");switch(n.length){case 1:n[0]=n[0].toLowerCase();break;case 2:n[0]=n[0].toLowerCase(),4===n[1].length?n[1]=n[1].charAt(0).toUpperCase()+n[1].slice(1).toLowerCase():n[1]=n[1].toUpperCase();break;case 3:n[0]=n[0].toLowerCase(),n[1]=n[1].charAt(0).toUpperCase()+n[1].slice(1).toLowerCase(),n[2]=n[2].toUpperCase();break;default:return e}return n.join("-")},"iso639-1":function(t){return(t||"").split("_").join("-").split("-")[0].toLowerCase()}},o=function(){if(angular.isFunction(i.getLocale))return i.getLocale();var t,e,n=r.$get().navigator,a=["language","browserLanguage","systemLanguage","userLanguage"];if(angular.isArray(n.languages))for(t=0;t<n.languages.length;t++)if((e=n.languages[t])&&e.length)return e;for(t=0;t<a.length;t++)if((e=n[a[t]])&&e.length)return e;return null};o.displayName="angular-translate/service: getFirstBrowserLanguage";var rt=function(){var t=o()||"";return s[a]&&(t=s[a](t)),t};rt.displayName="angular-translate/service: getLocale";var it=function(t,e){for(var n=0,a=t.length;n<a;n++)if(t[n]===e)return n;return-1},st=function(){return this.toString().replace(/^\s+|\s+$/g,"")},f=function(t){return angular.isString(t)?t.toLowerCase():t},ot=function(t){if(t){for(var e,n=[],a=f(t),r=0,i=Y.length;r<i;r++)n.push(f(Y[r]));if(-1<(r=it(n,a)))return Y[r];if(c)for(var s in c)if(c.hasOwnProperty(s)){var o=!1,l=Object.prototype.hasOwnProperty.call(c,s)&&f(s)===f(t);if("*"===s.slice(-1)&&(o=f(s.slice(0,-1))===f(t.slice(0,s.length-1))),(l||o)&&(e=c[s],-1<it(n,f(e))))return e}var u=t.split("_");return 1<u.length&&-1<it(n,f(u[0]))?u[0]:void 0}},lt=function(t,e){if(!t&&!e)return q;if(t&&!e){if(angular.isString(t))return q[t]}else angular.isObject(q[t])||(q[t]={}),angular.extend(q[t],ut(e));return this};this.translations=lt,this.cloakClassName=function(t){return t?(Q=t,this):Q},this.nestedObjectDelimeter=function(t){return t?(Z=t,this):Z};var ut=function(t,e,n,a){var r,i,s;for(r in e||(e=[]),n||(n={}),t)Object.prototype.hasOwnProperty.call(t,r)&&(s=t[r],angular.isObject(s)?ut(s,e.concat(r),n,r):(i=e.length?""+e.join(Z)+Z+r:r,e.length&&r===a&&(n[""+e.join(Z)]="@:"+i),n[i]=s));return n};ut.displayName="flatObject",this.addInterpolation=function(t){return J.push(t),this},this.useMessageFormatInterpolation=function(){return this.useInterpolation("$translateMessageFormatInterpolation")},this.useInterpolation=function(t){return R=t,this},this.useSanitizeValueStrategy=function(t){return e.useStrategy(t),this},this.preferredLanguage=function(t){return t?(ct(t),this):z};var ct=function(t){return t&&(z=t),z};this.translationNotFoundIndicator=function(t){return this.translationNotFoundIndicatorLeft(t),this.translationNotFoundIndicatorRight(t),this},this.translationNotFoundIndicatorLeft=function(t){return t?(U=t,this):U},this.translationNotFoundIndicatorRight=function(t){return t?(M=t,this):M},this.fallbackLanguage=function(t){return ft(t),this};var ft=function(t){return t?(angular.isString(t)?(x=!0,T=[t]):angular.isArray(t)&&(x=!1,T=t),angular.isString(z)&&it(T,z)<0&&T.push(z),this):x?T[0]:T};this.use=function(t){if(t){if(!q[t]&&!D)throw new Error("$translateProvider couldn't find translationTable for langKey: '"+t+"'");return F=t,this}return F},this.resolveClientLocale=function(){return rt()};var gt=function(t){return t?(B=t,this):n?n+B:B};this.storageKey=gt,this.useUrlLoader=function(t,e){return this.useLoader("$translateUrlLoader",angular.extend({url:t},e))},this.useStaticFilesLoader=function(t){return this.useLoader("$translateStaticFilesLoader",t)},this.useLoader=function(t,e){return D=t,K=e||{},this},this.useLocalStorage=function(){return this.useStorage("$translateLocalStorage")},this.useCookieStorage=function(){return this.useStorage("$translateCookieStorage")},this.useStorage=function(t){return _=t,this},this.storagePrefix=function(t){return t?(n=t,this):t},this.useMissingTranslationHandlerLog=function(){return this.useMissingTranslationHandler("$translateMissingTranslationHandlerLog")},this.useMissingTranslationHandler=function(t){return V=t,this},this.usePostCompiling=function(t){return W=!!t,this},this.forceAsyncReload=function(t){return X=!!t,this},this.uniformLanguageTag=function(t){return t?angular.isString(t)&&(t={standard:t}):t={},a=t.standard,this},this.determinePreferredLanguage=function(t){var e=t&&angular.isFunction(t)?t():rt();return z=Y.length&&ot(e)||e,this},this.registerAvailableLanguageKeys=function(t,e){return t?(Y=t,e&&(c=e),this):Y},this.useLoaderCache=function(t){return!1===t?H=void 0:!0===t?H=!0:void 0===t?H="$translationCache":t&&(H=t),this},this.directivePriority=function(t){return void 0===t?nt:(nt=t,this)},this.statefulFilter=function(t){return void 0===t?at:(at=t,this)},this.postProcess=function(t){return G=t||void 0,this},this.keepContent=function(t){return et=!!t,this},this.$get=["$log","$injector","$rootScope","$q",function(t,o,s,m){var i,$,y,b=o.get(R||"$translateDefaultInterpolation"),S=!1,L={},f={},j=function(t,s,o,l,u,c){!F&&z&&(F=z);var a=u&&u!==F?ot(u)||u:F;if(u&&v(u),angular.isArray(t)){return function(t){for(var a={},e=[],n=function(e){var n=m.defer(),t=function(t){a[e]=t,n.resolve([e,t])};return j(e,s,o,l,u,c).then(t,t),n.promise},r=0,i=t.length;r<i;r++)e.push(n(t[r]));return m.all(e).then(function(){return a})}(t)}var e=m.defer();t&&(t=st.apply(t));var n=function(){var t=f[a]||f[z];if($=0,_&&!t){var e=i.get(B);if(t=f[e],T&&T.length){var n=it(T,e);$=0===n?1:0,it(T,z)<0&&T.push(z)}}return t}();if(n){var r=function(){u||(a=F),h(t,s,o,l,a,c).then(e.resolve,e.reject)};r.displayName="promiseResolved",n.finally(r).catch(angular.noop)}else h(t,s,o,l,a,c).then(e.resolve,e.reject);return e.promise},w=function(t){return U&&(t=[U,t].join(" ")),M&&(t=[t,M].join(" ")),t},l=function(t){F=t,_&&i.put(j.storageKey(),F),s.$emit("$translateChangeSuccess",{language:t}),b.setLocale(F);var e=function(t,e){L[e].setLocale(F)};e.displayName="eachInterpolatorLocaleSetter",angular.forEach(L,e),s.$emit("$translateChangeEnd",{language:t})},u=function(n){if(!n)throw"No language key specified for loading.";var a=m.defer();s.$emit("$translateLoadingStart",{language:n}),S=!0;var t=H;"string"==typeof t&&(t=o.get(t));var e=angular.extend({},K,{key:n,$http:angular.extend({},{cache:t},K.$http)}),r=function(t){var e={};s.$emit("$translateLoadingSuccess",{language:n}),angular.isArray(t)?angular.forEach(t,function(t){angular.extend(e,ut(t))}):angular.extend(e,ut(t)),S=!1,a.resolve({key:n,table:e}),s.$emit("$translateLoadingEnd",{language:n})};r.displayName="onLoaderSuccess";var i=function(t){s.$emit("$translateLoadingError",{language:t}),a.reject(t),s.$emit("$translateLoadingEnd",{language:t})};return i.displayName="onLoaderError",o.get(D)(e).then(r,i),a.promise};if(_&&(!(i=o.get(_)).get||!i.put))throw new Error("Couldn't use storage '"+_+"', missing get() or put() method!");if(J.length){var e=function(t){var e=o.get(t);e.setLocale(z||F),L[e.getInterpolationIdentifier()]=e};e.displayName="interpolationFactoryAdder",angular.forEach(J,e)}var c=function(a,r,i,s,o){var l=m.defer(),t=function(t){if(Object.prototype.hasOwnProperty.call(t,r)&&null!==t[r]){s.setLocale(a);var e=t[r];if("@:"===e.substr(0,2))c(a,e.substr(2),i,s,o).then(l.resolve,l.reject);else{var n=s.interpolate(t[r],i,"service",o,r);n=O(r,t[r],n,i,a),l.resolve(n)}s.setLocale(F)}else l.reject()};return t.displayName="fallbackTranslationResolver",function(t){var e=m.defer();if(Object.prototype.hasOwnProperty.call(q,t))e.resolve(q[t]);else if(f[t]){var n=function(t){lt(t.key,t.table),e.resolve(t.table)};n.displayName="translationTableResolver",f[t].then(n,e.reject)}else e.reject();return e.promise}(a).then(t,l.reject),l.promise},g=function(t,e,n,a,r){var i,s=q[t];if(s&&Object.prototype.hasOwnProperty.call(s,e)&&null!==s[e]){if(a.setLocale(t),i=a.interpolate(s[e],n,"filter",r,e),i=O(e,s[e],i,n,t,r),!angular.isString(i)&&angular.isFunction(i.$$unwrapTrustedValue)){var o=i.$$unwrapTrustedValue();if("@:"===o.substr(0,2))return g(t,o.substr(2),n,a,r)}else if("@:"===i.substr(0,2))return g(t,i.substr(2),n,a,r);a.setLocale(F)}return i},C=function(t,e,n,a){return V?o.get(V)(t,F,e,n,a):t},N=function(t,e,n,a,r,i){var s=m.defer();if(t<T.length){var o=T[t];c(o,e,n,a,i).then(function(t){s.resolve(t)},function(){return N(t+1,e,n,a,r,i).then(s.resolve,s.reject)})}else if(r)s.resolve(r);else{var l=C(e,n,r);V&&l?s.resolve(l):s.reject(w(e))}return s.promise},p=function(t,e,n,a,r){var i;if(t<T.length){var s=T[t];(i=g(s,e,n,a,r))||""===i||(i=p(t+1,e,n,a))}return i},h=function(t,e,n,a,r,i){var s,o,l,u,c,f=m.defer(),g=r?q[r]:q,p=n?L[n]:b;if(g&&Object.prototype.hasOwnProperty.call(g,t)&&null!==g[t]){var h=g[t];if("@:"===h.substr(0,2))j(h.substr(2),e,n,a,r,i).then(f.resolve,f.reject);else{var d=p.interpolate(h,e,"service",i,t);d=O(t,h,d,e,r),f.resolve(d)}}else{var v;V&&!S&&(v=C(t,e,a)),r&&T&&T.length?(s=t,o=e,l=p,u=a,c=i,N(0<y?y:$,s,o,l,u,c)).then(function(t){f.resolve(t)},function(t){f.reject(w(t))}):V&&!S&&v?a?f.resolve(a):f.resolve(v):a?f.resolve(a):f.reject(w(t))}return f.promise},d=function(t,e,n,a,r){var i,s=a?q[a]:q,o=b;if(L&&Object.prototype.hasOwnProperty.call(L,n)&&(o=L[n]),s&&Object.prototype.hasOwnProperty.call(s,t)&&null!==s[t]){var l=s[t];"@:"===l.substr(0,2)?i=d(l.substr(2),e,n,a,r):(i=o.interpolate(l,e,"filter",r,t),i=O(t,l,i,e,a,r))}else{var u;V&&!S&&(u=C(t,e,r)),i=a&&T&&T.length?p(($=0)<y?y:$,t,e,o,r):V&&!S&&u?u:w(t)}return i},O=function(t,e,n,a,r,i){var s=G;return s&&("string"==typeof s&&(s=o.get(s)),s)?s(t,e,n,a,r,i):n},v=function(t){q[t]||!D||f[t]||(f[t]=u(t).then(function(t){return lt(t.key,t.table),t}))};j.preferredLanguage=function(t){return t&&ct(t),z},j.cloakClassName=function(){return Q},j.nestedObjectDelimeter=function(){return Z},j.fallbackLanguage=function(t){if(null!=t){if(ft(t),D&&T&&T.length)for(var e=0,n=T.length;e<n;e++)f[T[e]]||(f[T[e]]=u(T[e]));j.use(j.use())}return x?T[0]:T},j.useFallbackLanguage=function(t){if(null!=t)if(t){var e=it(T,t);-1<e&&(y=e)}else y=0},j.proposedLanguage=function(){return I},j.storage=function(){return i},j.negotiateLocale=ot,j.use=function(e){if(!e)return F;var n=m.defer();n.promise.then(null,angular.noop),s.$emit("$translateChangeStart",{language:e});var t=ot(e);return 0<Y.length&&!t?m.reject(e):(t&&(e=t),I=e,!X&&q[e]||!D||f[e]?f[e]?f[e].then(function(t){return I===t.key&&l(t.key),n.resolve(t.key),t},function(t){return!F&&T&&0<T.length&&T[0]!==t?j.use(T[0]).then(n.resolve,n.reject):n.reject(t)}):(n.resolve(e),l(e)):(f[e]=u(e).then(function(t){return lt(t.key,t.table),n.resolve(t.key),I===e&&l(t.key),t},function(t){return s.$emit("$translateChangeError",{language:t}),n.reject(t),s.$emit("$translateChangeEnd",{language:t}),m.reject(t)}),f[e].finally(function(){var t;I===(t=e)&&(I=void 0),f[t]=void 0}).catch(angular.noop)),n.promise)},j.resolveClientLocale=function(){return rt()},j.storageKey=function(){return gt()},j.isPostCompilingEnabled=function(){return W},j.isForceAsyncReloadEnabled=function(){return X},j.isKeepContent=function(){return et},j.refresh=function(t){if(!D)throw new Error("Couldn't refresh translation table, no loader registered!");s.$emit("$translateRefreshStart",{language:t});var e=m.defer(),n={};function a(e){var t=u(e);return(f[e]=t).then(function(t){q[e]={},lt(e,t.table),n[e]=!0},angular.noop),t}if(e.promise.then(function(){for(var t in q)q.hasOwnProperty(t)&&(t in n||delete q[t]);F&&l(F)},angular.noop).finally(function(){s.$emit("$translateRefreshEnd",{language:t})}),t)q[t]?a(t).then(e.resolve,e.reject):e.reject();else{var r=T&&T.slice()||[];F&&-1===r.indexOf(F)&&r.push(F),m.all(r.map(a)).then(e.resolve,e.reject)}return e.promise},j.instant=function(t,e,n,a,r){var i=a&&a!==F?ot(a)||a:F;if(null===t||angular.isUndefined(t))return t;if(a&&v(a),angular.isArray(t)){for(var s={},o=0,l=t.length;o<l;o++)s[t[o]]=j.instant(t[o],e,n,a,r);return s}if(angular.isString(t)&&t.length<1)return t;t&&(t=st.apply(t));var u,c,f=[];z&&f.push(z),i&&f.push(i),T&&T.length&&(f=f.concat(T));for(var g=0,p=f.length;g<p;g++){var h=f[g];if(q[h]&&void 0!==q[h][t]&&(u=d(t,e,n,i,r)),void 0!==u)break}u||""===u||(U||M?u=w(t):(u=b.interpolate(t,e,"filter",r),V&&!S&&(c=C(t,e,r)),V&&!S&&c&&(u=c)));return u},j.versionInfo=function(){return"2.18.1"},j.loaderCache=function(){return H},j.directivePriority=function(){return nt},j.statefulFilter=function(){return at},j.isReady=function(){return tt};var n=m.defer();n.promise.then(function(){tt=!0}),j.onReady=function(t){var e=m.defer();return angular.isFunction(t)&&e.promise.then(t),tt?e.resolve():n.promise.then(e.resolve),e.promise},j.getAvailableLanguageKeys=function(){return 0<Y.length?Y:null},j.getTranslationTable=function(t){return(t=t||j.use())&&q[t]?angular.copy(q[t]):null};var a=s.$on("$translateReady",function(){n.resolve(),a(),a=null}),r=s.$on("$translateChangeEnd",function(){n.resolve(),r(),r=null});if(D){if(angular.equals(q,{})&&j.use()&&j.use(j.use()),T&&T.length)for(var E=function(t){return lt(t.key,t.table),s.$emit("$translateChangeEnd",{language:t.key}),t},k=0,P=T.length;k<P;k++){var A=T[k];!X&&q[A]||(f[A]=u(A).then(E))}}else s.$emit("$translateReady",{language:j.use()});return j}]}function n(s,o){"use strict";var t={};return t.setLocale=function(t){t},t.getInterpolationIdentifier=function(){return"default"},t.useSanitizeValueStrategy=function(t){return o.useStrategy(t),this},t.interpolate=function(t,e,n,a,r){var i;return e=e||{},e=o.sanitize(e,"params",a,n),angular.isNumber(t)?i=""+t:angular.isString(t)?(i=s(t)(e),i=o.sanitize(i,"text",a,n)):i="",i},t}function a(S,L,j,w,C){"use strict";var N=function(t){return angular.isString(t)?t.toLowerCase():t};return{restrict:"AE",scope:!0,priority:S.directivePriority(),compile:function(t,h){var d=h.translateValues?h.translateValues:void 0,v=h.translateInterpolation?h.translateInterpolation:void 0,m=h.translateSanitizeStrategy?h.translateSanitizeStrategy:void 0,$=t[0].outerHTML.match(/translate-value-+/i),y="^(.*)("+L.startSymbol()+".*"+L.endSymbol()+")(.*)",b="^(.*)"+L.startSymbol()+"(.*)"+L.endSymbol()+"(.*)";return function(r,l,u){r.interpolateParams={},r.preText="",r.postText="",r.translateNamespace=function t(e){if(e.translateNamespace)return e.translateNamespace;if(e.$parent)return t(e.$parent)}(r);var i={},s=function(t){if(angular.isFunction(s._unwatchOld)&&(s._unwatchOld(),s._unwatchOld=void 0),angular.equals(t,"")||!angular.isDefined(t)){var e=function(){return this.toString().replace(/^\s+|\s+$/g,"")}.apply(l.text()),n=e.match(y);if(angular.isArray(n)){r.preText=n[1],r.postText=n[3],i.translate=L(n[2])(r.$parent);var a=e.match(b);angular.isArray(a)&&a[2]&&a[2].length&&(s._unwatchOld=r.$watch(a[2],function(t){i.translate=t,c()}))}else i.translate=e||void 0}else i.translate=t;c()},t=function(e){u.$observe(e,function(t){i[e]=t,c()})};!function(t,e,n){if(e.translateValues&&angular.extend(t,w(e.translateValues)(r.$parent)),$)for(var a in n)Object.prototype.hasOwnProperty.call(e,a)&&"translateValue"===a.substr(0,14)&&"translateValues"!==a&&(t[N(a.substr(14,1))+a.substr(15)]=n[a])}(r.interpolateParams,u,h);var e=!0;for(var n in u.$observe("translate",function(t){void 0===t?s(""):""===t&&e||(i.translate=t,c()),e=!1}),u)u.hasOwnProperty(n)&&"translateAttr"===n.substr(0,13)&&13<n.length&&t(n);if(u.$observe("translateDefault",function(t){r.defaultText=t,c()}),m&&u.$observe("translateSanitizeStrategy",function(t){r.sanitizeStrategy=w(t)(r.$parent),c()}),d&&u.$observe("translateValues",function(t){t&&r.$parent.$watch(function(){angular.extend(r.interpolateParams,w(t)(r.$parent))})}),$){var a=function(n){u.$observe(n,function(t){var e=N(n.substr(14,1))+n.substr(15);r.interpolateParams[e]=t})};for(var o in u)Object.prototype.hasOwnProperty.call(u,o)&&"translateValue"===o.substr(0,14)&&"translateValues"!==o&&a(o)}var c=function(){for(var t in i)i.hasOwnProperty(t)&&void 0!==i[t]&&f(t,i[t],r,r.interpolateParams,r.defaultText,r.translateNamespace)},f=function(e,t,n,a,r,i){t?(i&&"."===t.charAt(0)&&(t=i+t),S(t,a,v,r,n.translateLanguage,n.sanitizeStrategy).then(function(t){g(t,n,!0,e)},function(t){g(t,n,!1,e)})):g(t,n,!1,e)},g=function(t,e,n,a){if(n||void 0!==e.defaultText&&(t=e.defaultText),"translate"===a){(n||!n&&!S.isKeepContent()&&void 0===u.translateKeepContent)&&l.empty().append(e.preText+t+e.postText);var r=S.isPostCompilingEnabled(),i=void 0!==h.translateCompile,s=i&&"false"!==h.translateCompile;(r&&!i||s)&&j(l.contents())(e)}else{var o=u.$attr[a];"data-"===o.substr(0,5)&&(o=o.substr(5)),o=o.substr(15),l.attr(o,t)}};(d||$||u.translateDefault)&&r.$watch("interpolateParams",c,!0),r.$on("translateLanguageChanged",c);var p=C.$on("$translateChangeSuccess",c);l.text().length?u.translate?s(u.translate):s(""):u.translate&&s(u.translate),c(),r.$on("$destroy",p)}}}}function r(u,c){"use strict";return{restrict:"A",priority:u.directivePriority(),link:function(n,a,r){var i,s,o,l={},t=function(){angular.forEach(i,function(t,e){t&&(l[e]=!0,n.translateNamespace&&"."===t.charAt(0)&&(t=n.translateNamespace+t),u(t,s,r.translateInterpolation,void 0,n.translateLanguage,o).then(function(t){a.attr(e,t)},function(t){a.attr(e,t)}))}),angular.forEach(l,function(t,e){i[e]||(a.removeAttr(e),delete l[e])})};f(n,r.translateAttr,function(t){i=t},t),f(n,r.translateValues,function(t){s=t},t),f(n,r.translateSanitizeStrategy,function(t){o=t},t),r.translateValues&&n.$watch(r.translateValues,t,!0),n.$on("translateLanguageChanged",t);var e=c.$on("$translateChangeSuccess",t);t(),n.$on("$destroy",e)}}}function f(t,e,n,a){"use strict";e&&("::"===e.substr(0,2)?e=e.substr(2):t.$watch(e,function(t){n(t),a()},!0),n(t.$eval(e)))}function i(s,o){"use strict";return{compile:function(t){var i=function(t){t.addClass(s.cloakClassName())};return i(t),function(t,e,n){var a=function(t){t.removeClass(s.cloakClassName())}.bind(this,e),r=i.bind(this,e);n.translateCloak&&n.translateCloak.length?(n.$observe("translateCloak",function(t){s(t).then(a,r)}),o.$on("$translateChangeSuccess",function(){s(n.translateCloak).then(a,r)})):s.onReady(a)}}}}function s(){"use strict";return{restrict:"A",scope:!0,compile:function(){return{pre:function(t,e,n){t.translateNamespace=function t(e){if(e.translateNamespace)return e.translateNamespace;if(e.$parent)return t(e.$parent)}(t),t.translateNamespace&&"."===n.translateNamespace.charAt(0)?t.translateNamespace+=n.translateNamespace:t.translateNamespace=n.translateNamespace}}}}}function o(){"use strict";return{restrict:"A",scope:!0,compile:function(){return function(e,t,n){n.$observe("translateLanguage",function(t){e.translateLanguage=t}),e.$watch("translateLanguage",function(){e.$broadcast("translateLanguageChanged")})}}}}function l(i,s){"use strict";var t=function(t,e,n,a){if(!angular.isObject(e)){var r=this||{__SCOPE_IS_NOT_AVAILABLE:"More info at https://github.com/angular/angular.js/commit/8863b9d04c722b278fa93c5d66ad1e578ad6eb1f"};e=i(e)(r)}return s.instant(t,e,n,a)};return s.statefulFilter()&&(t.$stateful=!0),t}function u(t){"use strict";return t("translations")}return t.$inject=["$translate"],e.$inject=["$STORAGE_KEY","$windowProvider","$translateSanitizationProvider","pascalprechtTranslateOverrider"],n.$inject=["$interpolate","$translateSanitization"],a.$inject=["$translate","$interpolate","$compile","$parse","$rootScope"],r.$inject=["$translate","$rootScope"],i.$inject=["$translate","$rootScope"],l.$inject=["$parse","$translate"],u.$inject=["$cacheFactory"],angular.module("pascalprecht.translate",["ng"]).run(t),t.displayName="runTranslate",angular.module("pascalprecht.translate").provider("$translateSanitization",function(){"use strict";var n,a,g,p=null,h=!1,d=!1;(g={sanitize:function(t,e){return"text"===e&&(t=i(t)),t},escape:function(t,e){return"text"===e&&(t=r(t)),t},sanitizeParameters:function(t,e){return"params"===e&&(t=o(t,i)),t},escapeParameters:function(t,e){return"params"===e&&(t=o(t,r)),t},sce:function(t,e,n){return"text"===e?t=s(t):"params"===e&&"filter"!==n&&(t=o(t,r)),t},sceParameters:function(t,e){return"params"===e&&(t=o(t,s)),t}}).escaped=g.escapeParameters,this.addStrategy=function(t,e){return g[t]=e,this},this.removeStrategy=function(t){return delete g[t],this},this.useStrategy=function(t){return h=!0,p=t,this},this.$get=["$injector","$log",function(u,c){var e,f={};return u.has("$sanitize")&&(n=u.get("$sanitize")),u.has("$sce")&&(a=u.get("$sce")),{useStrategy:(e=this,function(t){e.useStrategy(t)}),sanitize:function(t,e,n,a){if(p||h||d||(c.warn("pascalprecht.translate.$translateSanitization: No sanitization strategy has been configured. This can have serious security implications. See http://angular-translate.github.io/docs/#/guide/19_security for details."),d=!0),n||null===n||(n=p),!n)return t;a||(a="service");var r,i,s,o,l=angular.isArray(n)?n:[n];return r=t,i=e,s=a,o=l,angular.forEach(o,function(e){if(angular.isFunction(e))r=e(r,i,s);else if(angular.isFunction(g[e]))r=g[e](r,i,s);else{if(!angular.isString(g[e]))throw new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+e+"'");if(!f[g[e]])try{f[g[e]]=u.get(g[e])}catch(t){throw f[g[e]]=function(){},new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+e+"'")}r=f[g[e]](r,i,s)}}),r}}}];var r=function(t){var e=angular.element("<div></div>");return e.text(t),e.html()},i=function(t){if(!n)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot find $sanitize service. Either include the ngSanitize module (https://docs.angularjs.org/api/ngSanitize) or use a sanitization strategy which does not depend on $sanitize, such as 'escape'.");return n(t)},s=function(t){if(!a)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot find $sce service.");return a.trustAsHtml(t)},o=function(t,n,a){if(angular.isDate(t))return t;if(angular.isObject(t)){var r=angular.isArray(t)?[]:{};if(a){if(-1<a.indexOf(t))throw new Error("pascalprecht.translate.$translateSanitization: Error cannot interpolate parameter due recursive object")}else a=[];return a.push(t),angular.forEach(t,function(t,e){angular.isFunction(t)||(r[e]=o(t,n,a))}),a.splice(-1,1),r}return angular.isNumber(t)?t:!0===t||!1===t?t:angular.isUndefined(t)||null===t?t:n(t)}}),angular.module("pascalprecht.translate").constant("pascalprechtTranslateOverrider",{}).provider("$translate",e),e.displayName="displayName",angular.module("pascalprecht.translate").factory("$translateDefaultInterpolation",n),n.displayName="$translateDefaultInterpolation",angular.module("pascalprecht.translate").constant("$STORAGE_KEY","NG_TRANSLATE_LANG_KEY"),angular.module("pascalprecht.translate").directive("translate",a),a.displayName="translateDirective",angular.module("pascalprecht.translate").directive("translateAttr",r),r.displayName="translateAttrDirective",angular.module("pascalprecht.translate").directive("translateCloak",i),i.displayName="translateCloakDirective",angular.module("pascalprecht.translate").directive("translateNamespace",s),s.displayName="translateNamespaceDirective",angular.module("pascalprecht.translate").directive("translateLanguage",o),o.displayName="translateLanguageDirective",angular.module("pascalprecht.translate").filter("translate",l),l.displayName="translateFilterFactory",angular.module("pascalprecht.translate").factory("$translationCache",u),u.displayName="$translationCache","pascalprecht.translate"}); | -1 |
apolloconfig/apollo | 3,545 | misc change | ## What's the purpose of this PR
fix some bugs and update the docs
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-02-12T03:27:53Z" | "2021-02-12T11:26:18Z" | 3f3c4edcdf28794df1e0000409c458092dd6c7c3 | d82086b2be884c4aac536d4d099a7148daeadafa | misc change. ## What's the purpose of this PR
fix some bugs and update the docs
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/gray-release/master-branch-instance-list.png | PNG
IHDR e IDATx ř{S[/o7d7lvfoW0QO@< |