repo_name stringclasses 5 values | pr_number int64 1.52k 15.5k | pr_title stringlengths 8 143 | pr_description stringlengths 0 10.2k | author stringlengths 3 18 | date_created timestamp[ns, tz=UTC] | date_merged timestamp[ns, tz=UTC] | previous_commit stringlengths 40 40 | pr_commit stringlengths 40 40 | query stringlengths 11 10.2k | filepath stringlengths 6 220 | before_content stringlengths 0 597M | after_content stringlengths 0 597M | label int64 -1 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-client/src/test/java/com/ctrip/framework/apollo/spi/DefaultConfigFactoryTest.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.spi;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import com.ctrip.framework.apollo.internals.PropertiesCompatibleFileConfigRepository;
import java.util.Properties;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.test.util.ReflectionTestUtils;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigFile;
import com.ctrip.framework.apollo.build.MockInjector;
import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import com.ctrip.framework.apollo.core.enums.Env;
import com.ctrip.framework.apollo.internals.DefaultConfig;
import com.ctrip.framework.apollo.internals.JsonConfigFile;
import com.ctrip.framework.apollo.internals.LocalFileConfigRepository;
import com.ctrip.framework.apollo.internals.PropertiesConfigFile;
import com.ctrip.framework.apollo.internals.XmlConfigFile;
import com.ctrip.framework.apollo.internals.YamlConfigFile;
import com.ctrip.framework.apollo.internals.YmlConfigFile;
import com.ctrip.framework.apollo.util.ConfigUtil;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class DefaultConfigFactoryTest {
private DefaultConfigFactory defaultConfigFactory;
private static String someAppId;
private static Env someEnv;
@Before
public void setUp() throws Exception {
someAppId = "someId";
someEnv = Env.DEV;
MockInjector.setInstance(ConfigUtil.class, new MockConfigUtil());
defaultConfigFactory = spy(new DefaultConfigFactory());
}
@After
public void tearDown() throws Exception {
MockInjector.reset();
}
@Test
public void testCreate() throws Exception {
String someNamespace = "someName";
Properties someProperties = new Properties();
String someKey = "someKey";
String someValue = "someValue";
someProperties.setProperty(someKey, someValue);
LocalFileConfigRepository someLocalConfigRepo = mock(LocalFileConfigRepository.class);
when(someLocalConfigRepo.getConfig()).thenReturn(someProperties);
doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(someNamespace);
Config result = defaultConfigFactory.create(someNamespace);
assertThat("DefaultConfigFactory should create DefaultConfig", result,
is(instanceOf(DefaultConfig.class)));
assertEquals(someValue, result.getProperty(someKey, null));
}
@Test
public void testCreateLocalConfigRepositoryInLocalDev() throws Exception {
String someNamespace = "someName";
someEnv = Env.LOCAL;
LocalFileConfigRepository localFileConfigRepository =
defaultConfigFactory.createLocalConfigRepository(someNamespace);
assertNull(ReflectionTestUtils.getField(localFileConfigRepository, "m_upstream"));
}
@Test
public void testCreatePropertiesCompatibleFileConfigRepository() throws Exception {
ConfigFileFormat somePropertiesCompatibleFormat = ConfigFileFormat.YML;
String someNamespace = "someName" + "." + somePropertiesCompatibleFormat;
Properties someProperties = new Properties();
String someKey = "someKey";
String someValue = "someValue";
someProperties.setProperty(someKey, someValue);
PropertiesCompatibleFileConfigRepository someRepository = mock(PropertiesCompatibleFileConfigRepository.class);
when(someRepository.getConfig()).thenReturn(someProperties);
doReturn(someRepository).when(defaultConfigFactory)
.createPropertiesCompatibleFileConfigRepository(someNamespace, somePropertiesCompatibleFormat);
Config result = defaultConfigFactory.create(someNamespace);
assertThat("DefaultConfigFactory should create DefaultConfig", result,
is(instanceOf(DefaultConfig.class)));
assertEquals(someValue, result.getProperty(someKey, null));
}
@Test
public void testCreateConfigFile() throws Exception {
String someNamespace = "someName";
String anotherNamespace = "anotherName";
String yetAnotherNamespace = "yetAnotherNamespace";
Properties someProperties = new Properties();
LocalFileConfigRepository someLocalConfigRepo = mock(LocalFileConfigRepository.class);
when(someLocalConfigRepo.getConfig()).thenReturn(someProperties);
doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(someNamespace);
doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(anotherNamespace);
doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(yetAnotherNamespace);
ConfigFile propertyConfigFile =
defaultConfigFactory.createConfigFile(someNamespace, ConfigFileFormat.Properties);
ConfigFile xmlConfigFile =
defaultConfigFactory.createConfigFile(anotherNamespace, ConfigFileFormat.XML);
ConfigFile jsonConfigFile =
defaultConfigFactory.createConfigFile(yetAnotherNamespace, ConfigFileFormat.JSON);
ConfigFile ymlConfigFile = defaultConfigFactory.createConfigFile(someNamespace,
ConfigFileFormat.YML);
ConfigFile yamlConfigFile = defaultConfigFactory.createConfigFile(someNamespace,
ConfigFileFormat.YAML);
assertThat("Should create PropertiesConfigFile for properties format", propertyConfigFile, is(instanceOf(
PropertiesConfigFile.class)));
assertEquals(someNamespace, propertyConfigFile.getNamespace());
assertThat("Should create XmlConfigFile for xml format", xmlConfigFile, is(instanceOf(
XmlConfigFile.class)));
assertEquals(anotherNamespace, xmlConfigFile.getNamespace());
assertThat("Should create JsonConfigFile for json format", jsonConfigFile, is(instanceOf(
JsonConfigFile.class)));
assertEquals(yetAnotherNamespace, jsonConfigFile.getNamespace());
assertThat("Should create YmlConfigFile for yml format", ymlConfigFile, is(instanceOf(
YmlConfigFile.class)));
assertEquals(someNamespace, ymlConfigFile.getNamespace());
assertThat("Should create YamlConfigFile for yaml format", yamlConfigFile, is(instanceOf(
YamlConfigFile.class)));
assertEquals(someNamespace, yamlConfigFile.getNamespace());
}
@Test
public void testDetermineFileFormat() throws Exception {
checkFileFormat("abc", ConfigFileFormat.Properties);
checkFileFormat("abc.properties", ConfigFileFormat.Properties);
checkFileFormat("abc.pRopErties", ConfigFileFormat.Properties);
checkFileFormat("abc.xml", ConfigFileFormat.XML);
checkFileFormat("abc.xmL", ConfigFileFormat.XML);
checkFileFormat("abc.json", ConfigFileFormat.JSON);
checkFileFormat("abc.jsOn", ConfigFileFormat.JSON);
checkFileFormat("abc.yaml", ConfigFileFormat.YAML);
checkFileFormat("abc.yAml", ConfigFileFormat.YAML);
checkFileFormat("abc.yml", ConfigFileFormat.YML);
checkFileFormat("abc.yMl", ConfigFileFormat.YML);
checkFileFormat("abc.properties.yml", ConfigFileFormat.YML);
}
@Test
public void testTrimNamespaceFormat() throws Exception {
checkNamespaceName("abc", ConfigFileFormat.Properties, "abc");
checkNamespaceName("abc.properties", ConfigFileFormat.Properties, "abc");
checkNamespaceName("abcproperties", ConfigFileFormat.Properties, "abcproperties");
checkNamespaceName("abc.pRopErties", ConfigFileFormat.Properties, "abc");
checkNamespaceName("abc.xml", ConfigFileFormat.XML, "abc");
checkNamespaceName("abc.xmL", ConfigFileFormat.XML, "abc");
checkNamespaceName("abc.json", ConfigFileFormat.JSON, "abc");
checkNamespaceName("abc.jsOn", ConfigFileFormat.JSON, "abc");
checkNamespaceName("abc.yaml", ConfigFileFormat.YAML, "abc");
checkNamespaceName("abc.yAml", ConfigFileFormat.YAML, "abc");
checkNamespaceName("abc.yml", ConfigFileFormat.YML, "abc");
checkNamespaceName("abc.yMl", ConfigFileFormat.YML, "abc");
checkNamespaceName("abc.proPerties.yml", ConfigFileFormat.YML, "abc.proPerties");
}
private void checkFileFormat(String namespaceName, ConfigFileFormat expectedFormat) {
assertEquals(expectedFormat, defaultConfigFactory.determineFileFormat(namespaceName));
}
private void checkNamespaceName(String namespaceName, ConfigFileFormat format, String expectedNamespaceName) {
assertEquals(expectedNamespaceName, defaultConfigFactory.trimNamespaceFormat(namespaceName, format));
}
public static class MockConfigUtil extends ConfigUtil {
@Override
public String getAppId() {
return someAppId;
}
@Override
public Env getApolloEnv() {
return someEnv;
}
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.spi;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsInstanceOf.instanceOf;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import com.ctrip.framework.apollo.internals.PropertiesCompatibleFileConfigRepository;
import java.util.Properties;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.test.util.ReflectionTestUtils;
import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigFile;
import com.ctrip.framework.apollo.build.MockInjector;
import com.ctrip.framework.apollo.core.enums.ConfigFileFormat;
import com.ctrip.framework.apollo.core.enums.Env;
import com.ctrip.framework.apollo.internals.DefaultConfig;
import com.ctrip.framework.apollo.internals.JsonConfigFile;
import com.ctrip.framework.apollo.internals.LocalFileConfigRepository;
import com.ctrip.framework.apollo.internals.PropertiesConfigFile;
import com.ctrip.framework.apollo.internals.XmlConfigFile;
import com.ctrip.framework.apollo.internals.YamlConfigFile;
import com.ctrip.framework.apollo.internals.YmlConfigFile;
import com.ctrip.framework.apollo.util.ConfigUtil;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public class DefaultConfigFactoryTest {
private DefaultConfigFactory defaultConfigFactory;
private static String someAppId;
private static Env someEnv;
@Before
public void setUp() throws Exception {
someAppId = "someId";
someEnv = Env.DEV;
MockInjector.setInstance(ConfigUtil.class, new MockConfigUtil());
defaultConfigFactory = spy(new DefaultConfigFactory());
}
@After
public void tearDown() throws Exception {
MockInjector.reset();
}
@Test
public void testCreate() throws Exception {
String someNamespace = "someName";
Properties someProperties = new Properties();
String someKey = "someKey";
String someValue = "someValue";
someProperties.setProperty(someKey, someValue);
LocalFileConfigRepository someLocalConfigRepo = mock(LocalFileConfigRepository.class);
when(someLocalConfigRepo.getConfig()).thenReturn(someProperties);
doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(someNamespace);
Config result = defaultConfigFactory.create(someNamespace);
assertThat("DefaultConfigFactory should create DefaultConfig", result,
is(instanceOf(DefaultConfig.class)));
assertEquals(someValue, result.getProperty(someKey, null));
}
@Test
public void testCreateLocalConfigRepositoryInLocalDev() throws Exception {
String someNamespace = "someName";
someEnv = Env.LOCAL;
LocalFileConfigRepository localFileConfigRepository =
defaultConfigFactory.createLocalConfigRepository(someNamespace);
assertNull(ReflectionTestUtils.getField(localFileConfigRepository, "m_upstream"));
}
@Test
public void testCreatePropertiesCompatibleFileConfigRepository() throws Exception {
ConfigFileFormat somePropertiesCompatibleFormat = ConfigFileFormat.YML;
String someNamespace = "someName" + "." + somePropertiesCompatibleFormat;
Properties someProperties = new Properties();
String someKey = "someKey";
String someValue = "someValue";
someProperties.setProperty(someKey, someValue);
PropertiesCompatibleFileConfigRepository someRepository = mock(PropertiesCompatibleFileConfigRepository.class);
when(someRepository.getConfig()).thenReturn(someProperties);
doReturn(someRepository).when(defaultConfigFactory)
.createPropertiesCompatibleFileConfigRepository(someNamespace, somePropertiesCompatibleFormat);
Config result = defaultConfigFactory.create(someNamespace);
assertThat("DefaultConfigFactory should create DefaultConfig", result,
is(instanceOf(DefaultConfig.class)));
assertEquals(someValue, result.getProperty(someKey, null));
}
@Test
public void testCreateConfigFile() throws Exception {
String someNamespace = "someName";
String anotherNamespace = "anotherName";
String yetAnotherNamespace = "yetAnotherNamespace";
Properties someProperties = new Properties();
LocalFileConfigRepository someLocalConfigRepo = mock(LocalFileConfigRepository.class);
when(someLocalConfigRepo.getConfig()).thenReturn(someProperties);
doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(someNamespace);
doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(anotherNamespace);
doReturn(someLocalConfigRepo).when(defaultConfigFactory).createLocalConfigRepository(yetAnotherNamespace);
ConfigFile propertyConfigFile =
defaultConfigFactory.createConfigFile(someNamespace, ConfigFileFormat.Properties);
ConfigFile xmlConfigFile =
defaultConfigFactory.createConfigFile(anotherNamespace, ConfigFileFormat.XML);
ConfigFile jsonConfigFile =
defaultConfigFactory.createConfigFile(yetAnotherNamespace, ConfigFileFormat.JSON);
ConfigFile ymlConfigFile = defaultConfigFactory.createConfigFile(someNamespace,
ConfigFileFormat.YML);
ConfigFile yamlConfigFile = defaultConfigFactory.createConfigFile(someNamespace,
ConfigFileFormat.YAML);
assertThat("Should create PropertiesConfigFile for properties format", propertyConfigFile, is(instanceOf(
PropertiesConfigFile.class)));
assertEquals(someNamespace, propertyConfigFile.getNamespace());
assertThat("Should create XmlConfigFile for xml format", xmlConfigFile, is(instanceOf(
XmlConfigFile.class)));
assertEquals(anotherNamespace, xmlConfigFile.getNamespace());
assertThat("Should create JsonConfigFile for json format", jsonConfigFile, is(instanceOf(
JsonConfigFile.class)));
assertEquals(yetAnotherNamespace, jsonConfigFile.getNamespace());
assertThat("Should create YmlConfigFile for yml format", ymlConfigFile, is(instanceOf(
YmlConfigFile.class)));
assertEquals(someNamespace, ymlConfigFile.getNamespace());
assertThat("Should create YamlConfigFile for yaml format", yamlConfigFile, is(instanceOf(
YamlConfigFile.class)));
assertEquals(someNamespace, yamlConfigFile.getNamespace());
}
@Test
public void testDetermineFileFormat() throws Exception {
checkFileFormat("abc", ConfigFileFormat.Properties);
checkFileFormat("abc.properties", ConfigFileFormat.Properties);
checkFileFormat("abc.pRopErties", ConfigFileFormat.Properties);
checkFileFormat("abc.xml", ConfigFileFormat.XML);
checkFileFormat("abc.xmL", ConfigFileFormat.XML);
checkFileFormat("abc.json", ConfigFileFormat.JSON);
checkFileFormat("abc.jsOn", ConfigFileFormat.JSON);
checkFileFormat("abc.yaml", ConfigFileFormat.YAML);
checkFileFormat("abc.yAml", ConfigFileFormat.YAML);
checkFileFormat("abc.yml", ConfigFileFormat.YML);
checkFileFormat("abc.yMl", ConfigFileFormat.YML);
checkFileFormat("abc.properties.yml", ConfigFileFormat.YML);
}
@Test
public void testTrimNamespaceFormat() throws Exception {
checkNamespaceName("abc", ConfigFileFormat.Properties, "abc");
checkNamespaceName("abc.properties", ConfigFileFormat.Properties, "abc");
checkNamespaceName("abcproperties", ConfigFileFormat.Properties, "abcproperties");
checkNamespaceName("abc.pRopErties", ConfigFileFormat.Properties, "abc");
checkNamespaceName("abc.xml", ConfigFileFormat.XML, "abc");
checkNamespaceName("abc.xmL", ConfigFileFormat.XML, "abc");
checkNamespaceName("abc.json", ConfigFileFormat.JSON, "abc");
checkNamespaceName("abc.jsOn", ConfigFileFormat.JSON, "abc");
checkNamespaceName("abc.yaml", ConfigFileFormat.YAML, "abc");
checkNamespaceName("abc.yAml", ConfigFileFormat.YAML, "abc");
checkNamespaceName("abc.yml", ConfigFileFormat.YML, "abc");
checkNamespaceName("abc.yMl", ConfigFileFormat.YML, "abc");
checkNamespaceName("abc.proPerties.yml", ConfigFileFormat.YML, "abc.proPerties");
}
private void checkFileFormat(String namespaceName, ConfigFileFormat expectedFormat) {
assertEquals(expectedFormat, defaultConfigFactory.determineFileFormat(namespaceName));
}
private void checkNamespaceName(String namespaceName, ConfigFileFormat format, String expectedNamespaceName) {
assertEquals(expectedNamespaceName, defaultConfigFactory.trimNamespaceFormat(namespaceName, format));
}
public static class MockConfigUtil extends ConfigUtil {
@Override
public String getAppId() {
return someAppId;
}
@Override
public Env getApolloEnv() {
return someEnv;
}
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/InstanceService.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.service;
import com.ctrip.framework.apollo.common.dto.InstanceDTO;
import com.ctrip.framework.apollo.common.dto.PageDTO;
import com.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.portal.api.AdminServiceAPI;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
@Service
public class InstanceService {
private final AdminServiceAPI.InstanceAPI instanceAPI;
public InstanceService(final AdminServiceAPI.InstanceAPI instanceAPI) {
this.instanceAPI = instanceAPI;
}
public PageDTO<InstanceDTO> getByRelease(Env env, long releaseId, int page, int size){
return instanceAPI.getByRelease(env, releaseId, page, size);
}
public PageDTO<InstanceDTO> getByNamespace(Env env, String appId, String clusterName, String namespaceName,
String instanceAppId, int page, int size){
return instanceAPI.getByNamespace(appId, env, clusterName, namespaceName, instanceAppId, page, size);
}
public int getInstanceCountByNamepsace(String appId, Env env, String clusterName, String namespaceName){
return instanceAPI.getInstanceCountByNamespace(appId, env, clusterName, namespaceName);
}
public List<InstanceDTO> getByReleasesNotIn(Env env, String appId, String clusterName, String namespaceName, Set<Long> releaseIds){
return instanceAPI.getByReleasesNotIn(appId, env, clusterName, namespaceName, releaseIds);
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.service;
import com.ctrip.framework.apollo.common.dto.InstanceDTO;
import com.ctrip.framework.apollo.common.dto.PageDTO;
import com.ctrip.framework.apollo.portal.environment.Env;
import com.ctrip.framework.apollo.portal.api.AdminServiceAPI;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
@Service
public class InstanceService {
private final AdminServiceAPI.InstanceAPI instanceAPI;
public InstanceService(final AdminServiceAPI.InstanceAPI instanceAPI) {
this.instanceAPI = instanceAPI;
}
public PageDTO<InstanceDTO> getByRelease(Env env, long releaseId, int page, int size){
return instanceAPI.getByRelease(env, releaseId, page, size);
}
public PageDTO<InstanceDTO> getByNamespace(Env env, String appId, String clusterName, String namespaceName,
String instanceAppId, int page, int size){
return instanceAPI.getByNamespace(appId, env, clusterName, namespaceName, instanceAppId, page, size);
}
public int getInstanceCountByNamepsace(String appId, Env env, String clusterName, String namespaceName){
return instanceAPI.getInstanceCountByNamespace(appId, env, clusterName, namespaceName);
}
public List<InstanceDTO> getByReleasesNotIn(Env env, String appId, String clusterName, String namespaceName, Set<Long> releaseIds){
return instanceAPI.getByReleasesNotIn(appId, env, clusterName, namespaceName, releaseIds);
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/test/java/com/ctrip/framework/apollo/openapi/v1/controller/AppControllerTest.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.openapi.v1.controller;
import static org.junit.Assert.assertEquals;
import com.ctrip.framework.apollo.openapi.entity.ConsumerRole;
import com.ctrip.framework.apollo.openapi.repository.ConsumerAuditRepository;
import com.ctrip.framework.apollo.openapi.repository.ConsumerRepository;
import com.ctrip.framework.apollo.openapi.repository.ConsumerRoleRepository;
import com.ctrip.framework.apollo.openapi.repository.ConsumerTokenRepository;
import com.ctrip.framework.apollo.openapi.service.ConsumerService;
import com.ctrip.framework.apollo.openapi.util.ConsumerAuthUtil;
import com.ctrip.framework.apollo.portal.component.PortalSettings;
import com.ctrip.framework.apollo.portal.component.config.PortalConfig;
import com.ctrip.framework.apollo.portal.entity.po.Role;
import com.ctrip.framework.apollo.portal.repository.PermissionRepository;
import com.ctrip.framework.apollo.portal.repository.RolePermissionRepository;
import com.ctrip.framework.apollo.portal.repository.RoleRepository;
import com.ctrip.framework.apollo.portal.service.AppService;
import com.ctrip.framework.apollo.portal.service.ClusterService;
import com.ctrip.framework.apollo.portal.service.RolePermissionService;
import com.ctrip.framework.apollo.portal.spi.UserInfoHolder;
import com.ctrip.framework.apollo.portal.spi.UserService;
import com.google.common.collect.Sets;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
/**
* @author wxq
*/
@RunWith(SpringRunner.class)
@WebMvcTest(controllers = AppController.class)
@Import(ConsumerService.class)
public class AppControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private PortalSettings portalSettings;
@MockBean
private AppService appService;
@MockBean
private ClusterService clusterService;
@MockBean
private ConsumerAuthUtil consumerAuthUtil;
@MockBean
private PermissionRepository permissionRepository;
@MockBean
private RolePermissionRepository rolePermissionRepository;
@MockBean
private UserInfoHolder userInfoHolder;
@MockBean
private ConsumerTokenRepository consumerTokenRepository;
@MockBean
private ConsumerRepository consumerRepository;
@MockBean
private ConsumerAuditRepository consumerAuditRepository;
@MockBean
private ConsumerRoleRepository consumerRoleRepository;
@MockBean
private PortalConfig portalConfig;
@MockBean
private RolePermissionService rolePermissionService;
@MockBean
private UserService userService;
@MockBean
private RoleRepository roleRepository;
@Test
public void testFindAppsAuthorized() throws Exception {
final long consumerId = 123456;
Mockito.when(this.consumerAuthUtil.retrieveConsumerId(Mockito.any())).thenReturn(consumerId);
final List<ConsumerRole> consumerRoles = Arrays.asList(
generateConsumerRoleByRoleId(6),
generateConsumerRoleByRoleId(7),
generateConsumerRoleByRoleId(8)
);
Mockito.when(this.consumerRoleRepository.findByConsumerId(consumerId))
.thenReturn(consumerRoles);
Mockito.when(this.roleRepository.findAllById(Mockito.any())).thenAnswer(invocation -> {
Set<Role> roles = new HashSet<>();
Iterable<Long> roleIds = invocation.getArgument(0);
for (Long roleId : roleIds) {
if (roleId == 6) {
roles.add(generateRoleByIdAndRoleName(6, "ModifyNamespace+app1+application+DEV"));
}
if (roleId == 7) {
roles.add(generateRoleByIdAndRoleName(7, "ReleaseNamespace+app1+application+DEV"));
}
if (roleId == 8) {
roles.add(generateRoleByIdAndRoleName(8, "Master+app2"));
}
}
assertEquals(3, roles.size());
return roles;
});
this.mockMvc.perform(MockMvcRequestBuilders.get("/openapi/v1/apps/authorized"))
.andDo(MockMvcResultHandlers.print())
.andExpect(MockMvcResultMatchers.status().is2xxSuccessful());
Mockito.verify(this.consumerRoleRepository, Mockito.times(1)).findByConsumerId(consumerId);
Mockito.verify(this.roleRepository, Mockito.times(1)).findAllById(Mockito.any());
ArgumentCaptor<Set<String>> appIdsCaptor = ArgumentCaptor.forClass(Set.class);
Mockito.verify(this.appService).findByAppIds(appIdsCaptor.capture());
Set<String> appIds = appIdsCaptor.getValue();
assertEquals(Sets.newHashSet("app1", "app2"), appIds);
}
private static ConsumerRole generateConsumerRoleByRoleId(long roleId) {
ConsumerRole consumerRole = new ConsumerRole();
consumerRole.setRoleId(roleId);
return consumerRole;
}
private static Role generateRoleByIdAndRoleName(long id, String roleName) {
Role role = new Role();
role.setId(id);
role.setRoleName(roleName);
return role;
}
} | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.openapi.v1.controller;
import static org.junit.Assert.assertEquals;
import com.ctrip.framework.apollo.openapi.entity.ConsumerRole;
import com.ctrip.framework.apollo.openapi.repository.ConsumerAuditRepository;
import com.ctrip.framework.apollo.openapi.repository.ConsumerRepository;
import com.ctrip.framework.apollo.openapi.repository.ConsumerRoleRepository;
import com.ctrip.framework.apollo.openapi.repository.ConsumerTokenRepository;
import com.ctrip.framework.apollo.openapi.service.ConsumerService;
import com.ctrip.framework.apollo.openapi.util.ConsumerAuthUtil;
import com.ctrip.framework.apollo.portal.component.PortalSettings;
import com.ctrip.framework.apollo.portal.component.config.PortalConfig;
import com.ctrip.framework.apollo.portal.entity.po.Role;
import com.ctrip.framework.apollo.portal.repository.PermissionRepository;
import com.ctrip.framework.apollo.portal.repository.RolePermissionRepository;
import com.ctrip.framework.apollo.portal.repository.RoleRepository;
import com.ctrip.framework.apollo.portal.service.AppService;
import com.ctrip.framework.apollo.portal.service.ClusterService;
import com.ctrip.framework.apollo.portal.service.RolePermissionService;
import com.ctrip.framework.apollo.portal.spi.UserInfoHolder;
import com.ctrip.framework.apollo.portal.spi.UserService;
import com.google.common.collect.Sets;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultHandlers;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
/**
* @author wxq
*/
@RunWith(SpringRunner.class)
@WebMvcTest(controllers = AppController.class)
@Import(ConsumerService.class)
public class AppControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private PortalSettings portalSettings;
@MockBean
private AppService appService;
@MockBean
private ClusterService clusterService;
@MockBean
private ConsumerAuthUtil consumerAuthUtil;
@MockBean
private PermissionRepository permissionRepository;
@MockBean
private RolePermissionRepository rolePermissionRepository;
@MockBean
private UserInfoHolder userInfoHolder;
@MockBean
private ConsumerTokenRepository consumerTokenRepository;
@MockBean
private ConsumerRepository consumerRepository;
@MockBean
private ConsumerAuditRepository consumerAuditRepository;
@MockBean
private ConsumerRoleRepository consumerRoleRepository;
@MockBean
private PortalConfig portalConfig;
@MockBean
private RolePermissionService rolePermissionService;
@MockBean
private UserService userService;
@MockBean
private RoleRepository roleRepository;
@Test
public void testFindAppsAuthorized() throws Exception {
final long consumerId = 123456;
Mockito.when(this.consumerAuthUtil.retrieveConsumerId(Mockito.any())).thenReturn(consumerId);
final List<ConsumerRole> consumerRoles = Arrays.asList(
generateConsumerRoleByRoleId(6),
generateConsumerRoleByRoleId(7),
generateConsumerRoleByRoleId(8)
);
Mockito.when(this.consumerRoleRepository.findByConsumerId(consumerId))
.thenReturn(consumerRoles);
Mockito.when(this.roleRepository.findAllById(Mockito.any())).thenAnswer(invocation -> {
Set<Role> roles = new HashSet<>();
Iterable<Long> roleIds = invocation.getArgument(0);
for (Long roleId : roleIds) {
if (roleId == 6) {
roles.add(generateRoleByIdAndRoleName(6, "ModifyNamespace+app1+application+DEV"));
}
if (roleId == 7) {
roles.add(generateRoleByIdAndRoleName(7, "ReleaseNamespace+app1+application+DEV"));
}
if (roleId == 8) {
roles.add(generateRoleByIdAndRoleName(8, "Master+app2"));
}
}
assertEquals(3, roles.size());
return roles;
});
this.mockMvc.perform(MockMvcRequestBuilders.get("/openapi/v1/apps/authorized"))
.andDo(MockMvcResultHandlers.print())
.andExpect(MockMvcResultMatchers.status().is2xxSuccessful());
Mockito.verify(this.consumerRoleRepository, Mockito.times(1)).findByConsumerId(consumerId);
Mockito.verify(this.roleRepository, Mockito.times(1)).findAllById(Mockito.any());
ArgumentCaptor<Set<String>> appIdsCaptor = ArgumentCaptor.forClass(Set.class);
Mockito.verify(this.appService).findByAppIds(appIdsCaptor.capture());
Set<String> appIds = appIdsCaptor.getValue();
assertEquals(Sets.newHashSet("app1", "app2"), appIds);
}
private static ConsumerRole generateConsumerRoleByRoleId(long roleId) {
ConsumerRole consumerRole = new ConsumerRole();
consumerRole.setRoleId(roleId);
return consumerRole;
}
private static Role generateRoleByIdAndRoleName(long id, String roleName) {
Role role = new Role();
role.setId(id);
role.setRoleName(roleName);
return role;
}
} | -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ldap/FilterLdapByGroupUserSearch.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.spi.ldap;
import static org.springframework.ldap.query.LdapQueryBuilder.query;
import javax.naming.Name;
import javax.naming.directory.SearchControls;
import javax.naming.ldap.LdapName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ldap.core.DirContextAdapter;
import org.springframework.ldap.core.DirContextOperations;
import org.springframework.ldap.core.support.BaseLdapPathContextSource;
import org.springframework.ldap.support.LdapUtils;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.ldap.SpringSecurityLdapTemplate;
import org.springframework.security.ldap.search.FilterBasedLdapUserSearch;
/**
* the FilterLdapByGroupUserSearch description.
*
* @author wuzishu
*/
public class FilterLdapByGroupUserSearch extends FilterBasedLdapUserSearch {
private static final Logger logger = LoggerFactory.getLogger(FilterLdapByGroupUserSearch.class);
private static final String MEMBER_UID_ATTR_NAME = "memberUid";
private String searchBase;
private String groupBase;
private String groupSearch;
private String rdnKey;
private String groupMembershipAttrName;
private String loginIdAttrName;
private final SearchControls searchControls = new SearchControls();
private BaseLdapPathContextSource contextSource;
public FilterLdapByGroupUserSearch(String searchBase, String searchFilter,
String groupBase, BaseLdapPathContextSource contextSource, String groupSearch,
String rdnKey, String groupMembershipAttrName, String loginIdAttrName) {
super(searchBase, searchFilter, contextSource);
this.searchBase = searchBase;
this.groupBase = groupBase;
this.groupSearch = groupSearch;
this.contextSource = contextSource;
this.rdnKey = rdnKey;
this.groupMembershipAttrName = groupMembershipAttrName;
this.loginIdAttrName = loginIdAttrName;
}
private Name searchUserById(String userId) {
SpringSecurityLdapTemplate template = new SpringSecurityLdapTemplate(this.contextSource);
template.setSearchControls(searchControls);
return template.searchForObject(query().where(this.loginIdAttrName).is(userId),
ctx -> ((DirContextAdapter) ctx).getDn());
}
@Override
public DirContextOperations searchForUser(String username) {
if (logger.isDebugEnabled()) {
logger.debug("Searching for user '" + username + "', with user search " + this);
}
SpringSecurityLdapTemplate template = new SpringSecurityLdapTemplate(this.contextSource);
template.setSearchControls(searchControls);
return template
.searchForObject(groupBase, groupSearch, ctx -> {
if (!MEMBER_UID_ATTR_NAME.equals(groupMembershipAttrName)) {
String[] members = ((DirContextAdapter) ctx)
.getStringAttributes(groupMembershipAttrName);
for (String item : members) {
LdapName memberDn = LdapUtils.newLdapName(item);
LdapName memberRdn = LdapUtils
.removeFirst(memberDn, LdapUtils.newLdapName(searchBase));
String rdnValue = LdapUtils.getValue(memberRdn, rdnKey).toString();
if (rdnValue.equalsIgnoreCase(username)) {
return new DirContextAdapter(memberRdn.toString());
}
}
throw new UsernameNotFoundException("User " + username + " not found in directory.");
}
String[] memberUids = ((DirContextAdapter) ctx)
.getStringAttributes(groupMembershipAttrName);
for (String memberUid : memberUids) {
if (memberUid.equalsIgnoreCase(username)) {
Name name = searchUserById(memberUid);
LdapName ldapName = LdapUtils.newLdapName(name);
LdapName ldapRdn = LdapUtils
.removeFirst(ldapName, LdapUtils.newLdapName(searchBase));
return new DirContextAdapter(ldapRdn);
}
}
throw new UsernameNotFoundException("User " + username + " not found in directory.");
});
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.spi.ldap;
import static org.springframework.ldap.query.LdapQueryBuilder.query;
import javax.naming.Name;
import javax.naming.directory.SearchControls;
import javax.naming.ldap.LdapName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ldap.core.DirContextAdapter;
import org.springframework.ldap.core.DirContextOperations;
import org.springframework.ldap.core.support.BaseLdapPathContextSource;
import org.springframework.ldap.support.LdapUtils;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.ldap.SpringSecurityLdapTemplate;
import org.springframework.security.ldap.search.FilterBasedLdapUserSearch;
/**
* the FilterLdapByGroupUserSearch description.
*
* @author wuzishu
*/
public class FilterLdapByGroupUserSearch extends FilterBasedLdapUserSearch {
private static final Logger logger = LoggerFactory.getLogger(FilterLdapByGroupUserSearch.class);
private static final String MEMBER_UID_ATTR_NAME = "memberUid";
private String searchBase;
private String groupBase;
private String groupSearch;
private String rdnKey;
private String groupMembershipAttrName;
private String loginIdAttrName;
private final SearchControls searchControls = new SearchControls();
private BaseLdapPathContextSource contextSource;
public FilterLdapByGroupUserSearch(String searchBase, String searchFilter,
String groupBase, BaseLdapPathContextSource contextSource, String groupSearch,
String rdnKey, String groupMembershipAttrName, String loginIdAttrName) {
super(searchBase, searchFilter, contextSource);
this.searchBase = searchBase;
this.groupBase = groupBase;
this.groupSearch = groupSearch;
this.contextSource = contextSource;
this.rdnKey = rdnKey;
this.groupMembershipAttrName = groupMembershipAttrName;
this.loginIdAttrName = loginIdAttrName;
}
private Name searchUserById(String userId) {
SpringSecurityLdapTemplate template = new SpringSecurityLdapTemplate(this.contextSource);
template.setSearchControls(searchControls);
return template.searchForObject(query().where(this.loginIdAttrName).is(userId),
ctx -> ((DirContextAdapter) ctx).getDn());
}
@Override
public DirContextOperations searchForUser(String username) {
if (logger.isDebugEnabled()) {
logger.debug("Searching for user '" + username + "', with user search " + this);
}
SpringSecurityLdapTemplate template = new SpringSecurityLdapTemplate(this.contextSource);
template.setSearchControls(searchControls);
return template
.searchForObject(groupBase, groupSearch, ctx -> {
if (!MEMBER_UID_ATTR_NAME.equals(groupMembershipAttrName)) {
String[] members = ((DirContextAdapter) ctx)
.getStringAttributes(groupMembershipAttrName);
for (String item : members) {
LdapName memberDn = LdapUtils.newLdapName(item);
LdapName memberRdn = LdapUtils
.removeFirst(memberDn, LdapUtils.newLdapName(searchBase));
String rdnValue = LdapUtils.getValue(memberRdn, rdnKey).toString();
if (rdnValue.equalsIgnoreCase(username)) {
return new DirContextAdapter(memberRdn.toString());
}
}
throw new UsernameNotFoundException("User " + username + " not found in directory.");
}
String[] memberUids = ((DirContextAdapter) ctx)
.getStringAttributes(groupMembershipAttrName);
for (String memberUid : memberUids) {
if (memberUid.equalsIgnoreCase(username)) {
Name name = searchUserById(memberUid);
LdapName ldapName = LdapUtils.newLdapName(name);
LdapName ldapRdn = LdapUtils
.removeFirst(ldapName, LdapUtils.newLdapName(searchBase));
return new DirContextAdapter(ldapRdn);
}
}
throw new UsernameNotFoundException("User " + username + " not found in directory.");
});
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/test/java/com/ctrip/framework/apollo/LocalPortalApplication.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@SpringBootApplication
public class LocalPortalApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(LocalPortalApplication.class).run(args);
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@SpringBootApplication
public class LocalPortalApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(LocalPortalApplication.class).run(args);
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/test/java/com/ctrip/framework/apollo/portal/controller/CommitControllerTest.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.controller;
import com.ctrip.framework.apollo.portal.AbstractIntegrationTest;
import java.util.List;
import org.junit.Test;
import org.springframework.web.client.HttpClientErrorException;
import static org.hamcrest.core.StringContains.containsString;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
/**
* Created by kezhenxu at 2019/1/14 12:49.
*
* @author kezhenxu (kezhenxu at lizhi dot fm)
*/
public class CommitControllerTest extends AbstractIntegrationTest {
@Test
public void shouldFailWhenPageOrSiseIsNegative() {
try {
restTemplate.getForEntity(
url("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/commits?page=-1"),
List.class, "1", "env", "cl", "ns"
);
fail("should throw");
} catch (final HttpClientErrorException e) {
assertThat(
new String(e.getResponseBodyAsByteArray()), containsString("page should be positive or 0")
);
}
try {
restTemplate.getForEntity(
url("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/commits?size=0"),
List.class, "1", "env", "cl", "ns"
);
fail("should throw");
} catch (final HttpClientErrorException e) {
assertThat(
new String(e.getResponseBodyAsByteArray()), containsString("size should be positive number")
);
}
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.controller;
import com.ctrip.framework.apollo.portal.AbstractIntegrationTest;
import java.util.List;
import org.junit.Test;
import org.springframework.web.client.HttpClientErrorException;
import static org.hamcrest.core.StringContains.containsString;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
/**
* Created by kezhenxu at 2019/1/14 12:49.
*
* @author kezhenxu (kezhenxu at lizhi dot fm)
*/
public class CommitControllerTest extends AbstractIntegrationTest {
@Test
public void shouldFailWhenPageOrSiseIsNegative() {
try {
restTemplate.getForEntity(
url("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/commits?page=-1"),
List.class, "1", "env", "cl", "ns"
);
fail("should throw");
} catch (final HttpClientErrorException e) {
assertThat(
new String(e.getResponseBodyAsByteArray()), containsString("page should be positive or 0")
);
}
try {
restTemplate.getForEntity(
url("/apps/{appId}/envs/{env}/clusters/{clusterName}/namespaces/{namespaceName}/commits?size=0"),
List.class, "1", "env", "cl", "ns"
);
fail("should throw");
} catch (final HttpClientErrorException e) {
assertThat(
new String(e.getResponseBodyAsByteArray()), containsString("size should be positive number")
);
}
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/ctrip/CtripUserInfoHolder.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.spi.ctrip;
import com.ctrip.framework.apollo.portal.spi.UserInfoHolder;
import com.ctrip.framework.apollo.portal.entity.bo.UserInfo;
import java.lang.reflect.Method;
/**
* ctrip内部实现的获取用户信息
*/
public class CtripUserInfoHolder implements UserInfoHolder {
private Object assertionHolder;
private Method getAssertion;
public CtripUserInfoHolder() {
Class clazz = null;
try {
clazz = Class.forName("org.jasig.cas.client.util.AssertionHolder");
assertionHolder = clazz.newInstance();
getAssertion = assertionHolder.getClass().getMethod("getAssertion");
} catch (Exception e) {
throw new RuntimeException("init AssertionHolder fail", e);
}
}
@Override
public UserInfo getUser() {
try {
Object assertion = getAssertion.invoke(assertionHolder);
Method getPrincipal = assertion.getClass().getMethod("getPrincipal");
Object principal = getPrincipal.invoke(assertion);
Method getName = principal.getClass().getMethod("getName");
String name = (String) getName.invoke(principal);
UserInfo userInfo = new UserInfo();
userInfo.setUserId(name);
return userInfo;
} catch (Exception e) {
throw new RuntimeException("get user info from assertion holder error", e);
}
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.spi.ctrip;
import com.ctrip.framework.apollo.portal.spi.UserInfoHolder;
import com.ctrip.framework.apollo.portal.entity.bo.UserInfo;
import java.lang.reflect.Method;
/**
* ctrip内部实现的获取用户信息
*/
public class CtripUserInfoHolder implements UserInfoHolder {
private Object assertionHolder;
private Method getAssertion;
public CtripUserInfoHolder() {
Class clazz = null;
try {
clazz = Class.forName("org.jasig.cas.client.util.AssertionHolder");
assertionHolder = clazz.newInstance();
getAssertion = assertionHolder.getClass().getMethod("getAssertion");
} catch (Exception e) {
throw new RuntimeException("init AssertionHolder fail", e);
}
}
@Override
public UserInfo getUser() {
try {
Object assertion = getAssertion.invoke(assertionHolder);
Method getPrincipal = assertion.getClass().getMethod("getPrincipal");
Object principal = getPrincipal.invoke(assertion);
Method getName = principal.getClass().getMethod("getName");
String name = (String) getName.invoke(principal);
UserInfo userInfo = new UserInfo();
userInfo.setUserId(name);
return userInfo;
} catch (Exception e) {
throw new RuntimeException("get user info from assertion holder error", e);
}
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./docs/en/_sidebar.md | - [**Home**](en/README.md)
- Design Document
- [Apollo Config Center Design](en/design/apollo-design.md)
- [Apollo Config Center Introduction](en/design/apollo-introduction.md)
- [Apollo Core Concept Namespace](en/design/apollo-core-concept-namespace.md)
- [Apollo Source Code Analysis](http://www.iocoder.cn/categories/Apollo/)
- Deployment Document
- [Quick Start](en/deployment/quick-start.md)
- [Deployment Quick Start By Docker](en/deployment/quick-start-docker.md)
- [Distributed Deployment Guide](en/deployment/distributed-deployment-guide.md)
- Development Document
- [Apollo Development Guide](en/development/apollo-development-guide.md)
- Code Styles
- [Eclipse Code Style](https://github.com/ctripcorp/apollo/blob/master/apollo-buildtools/style/eclipse-java-google-style.xml)
- [Intellij Code Style](https://github.com/ctripcorp/apollo/blob/master/apollo-buildtools/style/intellij-java-google-style.xml)
- [Portal Implement User Login Function](en/development/portal-how-to-implement-user-login-function.md)
- [Portal Enable Email Service](en/development/portal-how-to-enable-email-service.md)
- [Portal Enable Session Store](en/development/portal-how-to-enable-session-store.md)
- [Portal Enable Webhook Notification](en/development/portal-how-to-enable-webhook-notification.md)
- Usage Document
- [Apollo Usage Guide](en/usage/apollo-user-guide.md)
- [Java Client Usage Guide](en/usage/java-sdk-user-guide.md)
- [.Net Client Usage Guide](en/usage/dotnet-sdk-user-guide.md)
- [Go、Python、NodeJS、PHP etc. Client Usage Guide](en/usage/third-party-sdks-user-guide.md)
- [Other Language Client User Guide](en/usage/other-language-client-user-guide.md)
- [Apollo Openapi Guide](en/usage/apollo-open-api-platform.md)
- [Apollo Use Cases](https://github.com/ctripcorp/apollo-use-cases)
- [Apollo User Practices](en/usage/apollo-user-practices.md)
- [Apollo Security Best Practices](en/usage/apollo-user-guide?id=_71-%e5%ae%89%e5%85%a8%e7%9b%b8%e5%85%b3)
- FAQ
- [Frequently Asked Question](en/faq/faq.md)
- [Common Issues In Deployment & Development Phase](en/faq/common-issues-in-deployment-and-development-phase.md)
- Other
- [Release History](https://github.com/ctripcorp/apollo/releases)
- [Apollo Benchmark](en/misc/apollo-benchmark.md)
- Community
- [Team](en/community/team.md)
- [Community Governance](https://github.com/ctripcorp/apollo/blob/master/GOVERNANCE.md)
- [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md)
- [Acknowledgements](en/community/thank-you.md)
| - [**Home**](en/README.md)
- Design Document
- [Apollo Config Center Design](en/design/apollo-design.md)
- [Apollo Config Center Introduction](en/design/apollo-introduction.md)
- [Apollo Core Concept Namespace](en/design/apollo-core-concept-namespace.md)
- [Apollo Source Code Analysis](http://www.iocoder.cn/categories/Apollo/)
- Deployment Document
- [Quick Start](en/deployment/quick-start.md)
- [Deployment Quick Start By Docker](en/deployment/quick-start-docker.md)
- [Distributed Deployment Guide](en/deployment/distributed-deployment-guide.md)
- Development Document
- [Apollo Development Guide](en/development/apollo-development-guide.md)
- Code Styles
- [Eclipse Code Style](https://github.com/ctripcorp/apollo/blob/master/apollo-buildtools/style/eclipse-java-google-style.xml)
- [Intellij Code Style](https://github.com/ctripcorp/apollo/blob/master/apollo-buildtools/style/intellij-java-google-style.xml)
- [Portal Implement User Login Function](en/development/portal-how-to-implement-user-login-function.md)
- [Portal Enable Email Service](en/development/portal-how-to-enable-email-service.md)
- [Portal Enable Session Store](en/development/portal-how-to-enable-session-store.md)
- [Portal Enable Webhook Notification](en/development/portal-how-to-enable-webhook-notification.md)
- Usage Document
- [Apollo Usage Guide](en/usage/apollo-user-guide.md)
- [Java Client Usage Guide](en/usage/java-sdk-user-guide.md)
- [.Net Client Usage Guide](en/usage/dotnet-sdk-user-guide.md)
- [Go、Python、NodeJS、PHP etc. Client Usage Guide](en/usage/third-party-sdks-user-guide.md)
- [Other Language Client User Guide](en/usage/other-language-client-user-guide.md)
- [Apollo Openapi Guide](en/usage/apollo-open-api-platform.md)
- [Apollo Use Cases](https://github.com/ctripcorp/apollo-use-cases)
- [Apollo User Practices](en/usage/apollo-user-practices.md)
- [Apollo Security Best Practices](en/usage/apollo-user-guide?id=_71-%e5%ae%89%e5%85%a8%e7%9b%b8%e5%85%b3)
- FAQ
- [Frequently Asked Question](en/faq/faq.md)
- [Common Issues In Deployment & Development Phase](en/faq/common-issues-in-deployment-and-development-phase.md)
- Other
- [Release History](https://github.com/ctripcorp/apollo/releases)
- [Apollo Benchmark](en/misc/apollo-benchmark.md)
- Community
- [Team](en/community/team.md)
- [Community Governance](https://github.com/ctripcorp/apollo/blob/master/GOVERNANCE.md)
- [Contributing Guide](https://github.com/ctripcorp/apollo/blob/master/CONTRIBUTING.md)
- [Acknowledgements](en/community/thank-you.md)
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/util/ConsumerAuthUtil.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.openapi.util;
import com.ctrip.framework.apollo.openapi.service.ConsumerService;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
/**
* @author Jason Song(song_s@ctrip.com)
*/
@Service
public class ConsumerAuthUtil {
static final String CONSUMER_ID = "ApolloConsumerId";
private final ConsumerService consumerService;
public ConsumerAuthUtil(final ConsumerService consumerService) {
this.consumerService = consumerService;
}
public Long getConsumerId(String token) {
return consumerService.getConsumerIdByToken(token);
}
public void storeConsumerId(HttpServletRequest request, Long consumerId) {
request.setAttribute(CONSUMER_ID, consumerId);
}
public long retrieveConsumerId(HttpServletRequest request) {
Object value = request.getAttribute(CONSUMER_ID);
try {
return Long.parseLong(value.toString());
} catch (Throwable ex) {
throw new IllegalStateException("No consumer id!", ex);
}
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.openapi.util;
import com.ctrip.framework.apollo.openapi.service.ConsumerService;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
/**
* @author Jason Song(song_s@ctrip.com)
*/
@Service
public class ConsumerAuthUtil {
static final String CONSUMER_ID = "ApolloConsumerId";
private final ConsumerService consumerService;
public ConsumerAuthUtil(final ConsumerService consumerService) {
this.consumerService = consumerService;
}
public Long getConsumerId(String token) {
return consumerService.getConsumerIdByToken(token);
}
public void storeConsumerId(HttpServletRequest request, Long consumerId) {
request.setAttribute(CONSUMER_ID, consumerId);
}
public long retrieveConsumerId(HttpServletRequest request) {
Object value = request.getAttribute(CONSUMER_ID);
try {
return Long.parseLong(value.toString());
} catch (Throwable ex) {
throw new IllegalStateException("No consumer id!", ex);
}
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-client-config-data/src/main/java/com/ctrip/framework/apollo/config/data/extension/initialize/ApolloClientPropertiesFactory.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.config.data.extension.initialize;
import com.ctrip.framework.apollo.config.data.extension.properties.ApolloClientProperties;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties;
import org.springframework.boot.context.properties.bind.BindHandler;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
/**
* @author vdisk <vdisk@foxmail.com>
*/
public class ApolloClientPropertiesFactory {
public static final String PROPERTIES_PREFIX = "apollo.client";
public ApolloClientProperties createApolloClientProperties(
Binder binder,
BindHandler bindHandler) {
return binder.bind(PROPERTIES_PREFIX,
Bindable.of(ApolloClientProperties.class), bindHandler).orElse(null);
}
public OAuth2ClientProperties createOauth2ClientProperties(Binder binder,
BindHandler bindHandler) {
return binder.bind("spring.security.oauth2.client", Bindable.of(OAuth2ClientProperties.class),
bindHandler).orElse(null);
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.config.data.extension.initialize;
import com.ctrip.framework.apollo.config.data.extension.properties.ApolloClientProperties;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties;
import org.springframework.boot.context.properties.bind.BindHandler;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
/**
* @author vdisk <vdisk@foxmail.com>
*/
public class ApolloClientPropertiesFactory {
public static final String PROPERTIES_PREFIX = "apollo.client";
public ApolloClientProperties createApolloClientProperties(
Binder binder,
BindHandler bindHandler) {
return binder.bind(PROPERTIES_PREFIX,
Bindable.of(ApolloClientProperties.class), bindHandler).orElse(null);
}
public OAuth2ClientProperties createOauth2ClientProperties(Binder binder,
BindHandler bindHandler) {
return binder.bind("spring.security.oauth2.client", Bindable.of(OAuth2ClientProperties.class),
bindHandler).orElse(null);
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/repository/ConsumerTokenRepository.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.openapi.repository;
import com.ctrip.framework.apollo.openapi.entity.ConsumerToken;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public interface ConsumerTokenRepository extends PagingAndSortingRepository<ConsumerToken, Long> {
/**
* find consumer token by token
*
* @param token the token
* @param validDate the date when the token is valid
*/
ConsumerToken findTopByTokenAndExpiresAfter(String token, Date validDate);
ConsumerToken findByConsumerId(Long consumerId);
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.openapi.repository;
import com.ctrip.framework.apollo.openapi.entity.ConsumerToken;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public interface ConsumerTokenRepository extends PagingAndSortingRepository<ConsumerToken, Long> {
/**
* find consumer token by token
*
* @param token the token
* @param validDate the date when the token is valid
*/
ConsumerToken findTopByTokenAndExpiresAfter(String token, Date validDate);
ConsumerToken findByConsumerId(Long consumerId);
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-configservice/src/main/java/com/ctrip/framework/apollo/metaservice/service/DefaultDiscoveryService.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.metaservice.service;
import com.ctrip.framework.apollo.common.condition.ConditionalOnMissingProfile;
import com.ctrip.framework.apollo.core.dto.ServiceDTO;
import com.ctrip.framework.apollo.tracer.Tracer;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.EurekaClient;
import com.netflix.discovery.shared.Application;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
/**
* Default discovery service for Eureka
*/
@Service
@ConditionalOnMissingProfile({"kubernetes", "nacos-discovery", "consul-discovery"})
public class DefaultDiscoveryService implements DiscoveryService {
private final EurekaClient eurekaClient;
public DefaultDiscoveryService(final EurekaClient eurekaClient) {
this.eurekaClient = eurekaClient;
}
@Override
public List<ServiceDTO> getServiceInstances(String serviceId) {
Application application = eurekaClient.getApplication(serviceId);
if (application == null || CollectionUtils.isEmpty(application.getInstances())) {
Tracer.logEvent("Apollo.Discovery.NotFound", serviceId);
return Collections.emptyList();
}
return application.getInstances().stream().map(instanceInfoToServiceDTOFunc)
.collect(Collectors.toList());
}
private static final Function<InstanceInfo, ServiceDTO> instanceInfoToServiceDTOFunc = instance -> {
ServiceDTO service = new ServiceDTO();
service.setAppName(instance.getAppName());
service.setInstanceId(instance.getInstanceId());
service.setHomepageUrl(instance.getHomePageUrl());
return service;
};
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.metaservice.service;
import com.ctrip.framework.apollo.common.condition.ConditionalOnMissingProfile;
import com.ctrip.framework.apollo.core.dto.ServiceDTO;
import com.ctrip.framework.apollo.tracer.Tracer;
import com.netflix.appinfo.InstanceInfo;
import com.netflix.discovery.EurekaClient;
import com.netflix.discovery.shared.Application;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
/**
* Default discovery service for Eureka
*/
@Service
@ConditionalOnMissingProfile({"kubernetes", "nacos-discovery", "consul-discovery"})
public class DefaultDiscoveryService implements DiscoveryService {
private final EurekaClient eurekaClient;
public DefaultDiscoveryService(final EurekaClient eurekaClient) {
this.eurekaClient = eurekaClient;
}
@Override
public List<ServiceDTO> getServiceInstances(String serviceId) {
Application application = eurekaClient.getApplication(serviceId);
if (application == null || CollectionUtils.isEmpty(application.getInstances())) {
Tracer.logEvent("Apollo.Discovery.NotFound", serviceId);
return Collections.emptyList();
}
return application.getInstances().stream().map(instanceInfoToServiceDTOFunc)
.collect(Collectors.toList());
}
private static final Function<InstanceInfo, ServiceDTO> instanceInfoToServiceDTOFunc = instance -> {
ServiceDTO service = new ServiceDTO();
service.setAppName(instance.getAppName());
service.setInstanceId(instance.getInstanceId());
service.setHomepageUrl(instance.getHomePageUrl());
return service;
};
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/service/CommitService.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.service;
import com.ctrip.framework.apollo.biz.entity.Commit;
import com.ctrip.framework.apollo.biz.repository.CommitRepository;
import java.util.Date;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class CommitService {
private final CommitRepository commitRepository;
public CommitService(final CommitRepository commitRepository) {
this.commitRepository = commitRepository;
}
@Transactional
public Commit save(Commit commit){
commit.setId(0);//protection
return commitRepository.save(commit);
}
public List<Commit> find(String appId, String clusterName, String namespaceName, Pageable page){
return commitRepository.findByAppIdAndClusterNameAndNamespaceNameOrderByIdDesc(appId, clusterName, namespaceName, page);
}
public List<Commit> find(String appId, String clusterName, String namespaceName,
Date lastModifiedTime, Pageable page) {
return commitRepository
.findByAppIdAndClusterNameAndNamespaceNameAndDataChangeLastModifiedTimeGreaterThanEqualOrderByIdDesc(
appId, clusterName, namespaceName, lastModifiedTime, page);
}
@Transactional
public int batchDelete(String appId, String clusterName, String namespaceName, String operator){
return commitRepository.batchDelete(appId, clusterName, namespaceName, operator);
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.service;
import com.ctrip.framework.apollo.biz.entity.Commit;
import com.ctrip.framework.apollo.biz.repository.CommitRepository;
import java.util.Date;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class CommitService {
private final CommitRepository commitRepository;
public CommitService(final CommitRepository commitRepository) {
this.commitRepository = commitRepository;
}
@Transactional
public Commit save(Commit commit){
commit.setId(0);//protection
return commitRepository.save(commit);
}
public List<Commit> find(String appId, String clusterName, String namespaceName, Pageable page){
return commitRepository.findByAppIdAndClusterNameAndNamespaceNameOrderByIdDesc(appId, clusterName, namespaceName, page);
}
public List<Commit> find(String appId, String clusterName, String namespaceName,
Date lastModifiedTime, Pageable page) {
return commitRepository
.findByAppIdAndClusterNameAndNamespaceNameAndDataChangeLastModifiedTimeGreaterThanEqualOrderByIdDesc(
appId, clusterName, namespaceName, lastModifiedTime, page);
}
@Transactional
public int batchDelete(String appId, String clusterName, String namespaceName, String operator){
return commitRepository.batchDelete(appId, clusterName, namespaceName, operator);
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/spi/configuration/LdapGroupProperties.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.spi.configuration;
/**
* the LdapGroupProperties description.
*
* @author wuzishu
*/
public class LdapGroupProperties {
/**
* group search base
*/
private String groupBase;
/**
* group search filter
*/
private String groupSearch;
/**
* group membership prop
*/
private String groupMembership;
public String getGroupBase() {
return groupBase;
}
public void setGroupBase(String groupBase) {
this.groupBase = groupBase;
}
public String getGroupSearch() {
return groupSearch;
}
public void setGroupSearch(String groupSearch) {
this.groupSearch = groupSearch;
}
public String getGroupMembership() {
return groupMembership;
}
public void setGroupMembership(String groupMembership) {
this.groupMembership = groupMembership;
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.spi.configuration;
/**
* the LdapGroupProperties description.
*
* @author wuzishu
*/
public class LdapGroupProperties {
/**
* group search base
*/
private String groupBase;
/**
* group search filter
*/
private String groupSearch;
/**
* group membership prop
*/
private String groupMembership;
public String getGroupBase() {
return groupBase;
}
public void setGroupBase(String groupBase) {
this.groupBase = groupBase;
}
public String getGroupSearch() {
return groupSearch;
}
public void setGroupSearch(String groupSearch) {
this.groupSearch = groupSearch;
}
public String getGroupMembership() {
return groupMembership;
}
public void setGroupMembership(String groupMembership) {
this.groupMembership = groupMembership;
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/resources/static/views/component/merge-and-publish-modal.html | <div class="modal fade" id="mergeAndPublishModal" tabindex="-1" role="dialog">
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<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">{{'Component.MergePublish.Title' | translate }}</h4>
</div>
<div class="modal-body">
{{'Component.MergePublish.Tips' | translate }}
<br>
<h5>{{'Component.MergePublish.NextStep' | translate }}</h5>
<div class="radio">
<label ng-click="toReleaseNamespace.mergeAfterDeleteBranch = 'true'">
<input type="radio" name="deleteBranch" ng-checked="!toReleaseNamespace.mergeAfterDeleteBranch ||
toReleaseNamespace.mergeAfterDeleteBranch == 'true'">
{{'Component.MergePublish.DeleteGrayscale' | translate }}
</label>
</div>
<div class="radio">
<label ng-click="toReleaseNamespace.mergeAfterDeleteBranch = 'false'">
<input type="radio" name="deleteBranch"
ng-checked="toReleaseNamespace.mergeAfterDeleteBranch == 'false'">
{{'Component.MergePublish.ReservedGrayscale' | translate }}
</label>
</div>
</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="showReleaseModal()">
{{'Common.Ok' | translate }}
</button>
</div>
</div>
</div>
</div>
| <div class="modal fade" id="mergeAndPublishModal" tabindex="-1" role="dialog">
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<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">{{'Component.MergePublish.Title' | translate }}</h4>
</div>
<div class="modal-body">
{{'Component.MergePublish.Tips' | translate }}
<br>
<h5>{{'Component.MergePublish.NextStep' | translate }}</h5>
<div class="radio">
<label ng-click="toReleaseNamespace.mergeAfterDeleteBranch = 'true'">
<input type="radio" name="deleteBranch" ng-checked="!toReleaseNamespace.mergeAfterDeleteBranch ||
toReleaseNamespace.mergeAfterDeleteBranch == 'true'">
{{'Component.MergePublish.DeleteGrayscale' | translate }}
</label>
</div>
<div class="radio">
<label ng-click="toReleaseNamespace.mergeAfterDeleteBranch = 'false'">
<input type="radio" name="deleteBranch"
ng-checked="toReleaseNamespace.mergeAfterDeleteBranch == 'false'">
{{'Component.MergePublish.ReservedGrayscale' | translate }}
</label>
</div>
</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="showReleaseModal()">
{{'Common.Ok' | translate }}
</button>
</div>
</div>
</div>
</div>
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-common/src/main/java/com/ctrip/framework/apollo/common/controller/HttpMessageConverterConfiguration.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.common.controller;
import com.google.common.collect.Lists;
import com.google.gson.GsonBuilder;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
import java.util.List;
/**
* Created by Jason on 5/11/16.
*/
@Configuration
public class HttpMessageConverterConfiguration {
@Bean
public HttpMessageConverters messageConverters() {
GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter();
gsonHttpMessageConverter.setGson(
new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").create());
final List<HttpMessageConverter<?>> converters = Lists.newArrayList(
new ByteArrayHttpMessageConverter(), new StringHttpMessageConverter(),
new AllEncompassingFormHttpMessageConverter(), gsonHttpMessageConverter);
return new HttpMessageConverters() {
@Override
public List<HttpMessageConverter<?>> getConverters() {
return converters;
}
};
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.common.controller;
import com.google.common.collect.Lists;
import com.google.gson.GsonBuilder;
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.ByteArrayHttpMessageConverter;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import org.springframework.http.converter.support.AllEncompassingFormHttpMessageConverter;
import java.util.List;
/**
* Created by Jason on 5/11/16.
*/
@Configuration
public class HttpMessageConverterConfiguration {
@Bean
public HttpMessageConverters messageConverters() {
GsonHttpMessageConverter gsonHttpMessageConverter = new GsonHttpMessageConverter();
gsonHttpMessageConverter.setGson(
new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ").create());
final List<HttpMessageConverter<?>> converters = Lists.newArrayList(
new ByteArrayHttpMessageConverter(), new StringHttpMessageConverter(),
new AllEncompassingFormHttpMessageConverter(), gsonHttpMessageConverter);
return new HttpMessageConverters() {
@Override
public List<HttpMessageConverter<?>> getConverters() {
return converters;
}
};
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-client/src/test/resources/yaml/case3.yaml | #
# Copyright 2021 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
root:
key1: "someValue"
key2: 100
| #
# Copyright 2021 Apollo Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
root:
key1: "someValue"
key2: 100
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseMessageRepository.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.repository;
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.util.Collection;
import java.util.List;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public interface ReleaseMessageRepository extends PagingAndSortingRepository<ReleaseMessage, Long> {
List<ReleaseMessage> findFirst500ByIdGreaterThanOrderByIdAsc(Long id);
ReleaseMessage findTopByOrderByIdDesc();
ReleaseMessage findTopByMessageInOrderByIdDesc(Collection<String> messages);
List<ReleaseMessage> findFirst100ByMessageAndIdLessThanOrderByIdAsc(String message, Long id);
@Query("select message, max(id) as id from ReleaseMessage where message in :messages group by message")
List<Object[]> findLatestReleaseMessagesGroupByMessages(@Param("messages") Collection<String> messages);
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.biz.repository;
import com.ctrip.framework.apollo.biz.entity.ReleaseMessage;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;
import java.util.Collection;
import java.util.List;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public interface ReleaseMessageRepository extends PagingAndSortingRepository<ReleaseMessage, Long> {
List<ReleaseMessage> findFirst500ByIdGreaterThanOrderByIdAsc(Long id);
ReleaseMessage findTopByOrderByIdDesc();
ReleaseMessage findTopByMessageInOrderByIdDesc(Collection<String> messages);
List<ReleaseMessage> findFirst100ByMessageAndIdLessThanOrderByIdAsc(String message, Long id);
@Query("select message, max(id) as id from ReleaseMessage where message in :messages group by message")
List<Object[]> findLatestReleaseMessagesGroupByMessages(@Param("messages") Collection<String> messages);
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/enricher/impl/UserDisplayNameEnricher.java | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.enricher.impl;
import com.ctrip.framework.apollo.portal.enricher.AdditionalUserInfoEnricher;
import com.ctrip.framework.apollo.portal.enricher.adapter.UserInfoEnrichedAdapter;
import com.ctrip.framework.apollo.portal.entity.bo.UserInfo;
import java.util.Map;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
/**
* @author vdisk <vdisk@foxmail.com>
*/
@Component
public class UserDisplayNameEnricher implements AdditionalUserInfoEnricher {
@Override
public void enrichAdditionalUserInfo(UserInfoEnrichedAdapter adapter,
Map<String, UserInfo> userInfoMap) {
if (StringUtils.hasText(adapter.getFirstUserId())) {
UserInfo userInfo = userInfoMap.get(adapter.getFirstUserId());
if (userInfo != null && StringUtils.hasText(userInfo.getName())) {
adapter.setFirstUserDisplayName(userInfo.getName());
}
}
if (StringUtils.hasText(adapter.getSecondUserId())) {
UserInfo userInfo = userInfoMap.get(adapter.getSecondUserId());
if (userInfo != null && StringUtils.hasText(userInfo.getName())) {
adapter.setSecondUserDisplayName(userInfo.getName());
}
}
if (StringUtils.hasText(adapter.getThirdUserId())) {
UserInfo userInfo = userInfoMap.get(adapter.getThirdUserId());
if (userInfo != null && StringUtils.hasText(userInfo.getName())) {
adapter.setThirdUserDisplayName(userInfo.getName());
}
}
}
}
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.ctrip.framework.apollo.portal.enricher.impl;
import com.ctrip.framework.apollo.portal.enricher.AdditionalUserInfoEnricher;
import com.ctrip.framework.apollo.portal.enricher.adapter.UserInfoEnrichedAdapter;
import com.ctrip.framework.apollo.portal.entity.bo.UserInfo;
import java.util.Map;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
/**
* @author vdisk <vdisk@foxmail.com>
*/
@Component
public class UserDisplayNameEnricher implements AdditionalUserInfoEnricher {
@Override
public void enrichAdditionalUserInfo(UserInfoEnrichedAdapter adapter,
Map<String, UserInfo> userInfoMap) {
if (StringUtils.hasText(adapter.getFirstUserId())) {
UserInfo userInfo = userInfoMap.get(adapter.getFirstUserId());
if (userInfo != null && StringUtils.hasText(userInfo.getName())) {
adapter.setFirstUserDisplayName(userInfo.getName());
}
}
if (StringUtils.hasText(adapter.getSecondUserId())) {
UserInfo userInfo = userInfoMap.get(adapter.getSecondUserId());
if (userInfo != null && StringUtils.hasText(userInfo.getName())) {
adapter.setSecondUserDisplayName(userInfo.getName());
}
}
if (StringUtils.hasText(adapter.getThirdUserId())) {
UserInfo userInfo = userInfoMap.get(adapter.getThirdUserId());
if (userInfo != null && StringUtils.hasText(userInfo.getName())) {
adapter.setThirdUserDisplayName(userInfo.getName());
}
}
}
}
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/resources/static/views/component/entrance.html | <a class="list-group-item hover" href="{{href}}">
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<div class="row icon-text icon-{{imgSrc}}">
<p class="btn-title">{{title}}</p>
</div>
</a>
| <a class="list-group-item hover" href="{{href}}">
<!--
~ Copyright 2021 Apollo Authors
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<div class="row icon-text icon-{{imgSrc}}">
<p class="btn-title">{{title}}</p>
</div>
</a>
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./apollo-portal/src/main/resources/static/scripts/services/SystemInfoService.js | /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
appService.service('SystemInfoService', ['$resource', '$q', 'AppUtil', function ($resource, $q, AppUtil) {
var system_info_resource = $resource('', {}, {
load_system_info: {
method: 'GET',
url: AppUtil.prefixPath() + '/system-info'
},
check_health: {
method: 'GET',
url: AppUtil.prefixPath() + '/system-info/health'
}
});
return {
load_system_info: function () {
var d = $q.defer();
system_info_resource.load_system_info({},
function (result) {
d.resolve(result);
}, function (result) {
d.reject(result);
});
return d.promise;
},
check_health: function (instanceId, host) {
var d = $q.defer();
system_info_resource.check_health({
instanceId: instanceId
},
function (result) {
d.resolve(result);
}, function (result) {
d.reject(result);
});
return d.promise;
}
}
}]);
| /*
* Copyright 2021 Apollo Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
appService.service('SystemInfoService', ['$resource', '$q', 'AppUtil', function ($resource, $q, AppUtil) {
var system_info_resource = $resource('', {}, {
load_system_info: {
method: 'GET',
url: AppUtil.prefixPath() + '/system-info'
},
check_health: {
method: 'GET',
url: AppUtil.prefixPath() + '/system-info/health'
}
});
return {
load_system_info: function () {
var d = $q.defer();
system_info_resource.load_system_info({},
function (result) {
d.resolve(result);
}, function (result) {
d.reject(result);
});
return d.promise;
},
check_health: function (instanceId, host) {
var d = $q.defer();
system_info_resource.check_health({
instanceId: instanceId
},
function (result) {
d.resolve(result);
}, function (result) {
d.reject(result);
});
return d.promise;
}
}
}]);
| -1 |
apolloconfig/apollo | 3,819 | fix the issue that release messages might be missed in certain scenarios | ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| nobodyiam | 2021-07-11T08:32:34Z | 2021-07-22T00:09:32Z | 9bd47037886468040dacb693db370e6417b31aad | f9c69dbb181e9cb6c5cb0ee08ae915a52430c23a | fix the issue that release messages might be missed in certain scenarios. ## What's the purpose of this PR
fix the issue that release messages might be missed in certain scenarios
## Which issue(s) this PR fixes:
Fixes #3806
## Brief changelog
1. record the missing release messages when scanning
2. try to reload and notify the missing release messages for certain amount of times
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.
- [x] Update the [`CHANGES` log](https://github.com/ctripcorp/apollo/blob/master/CHANGES.md).
| ./doc/images/local-development/PortalApplication-Home.png | PNG
IHDR * n G
iCCPICC Profile HT[̤ZB{5A:JHc Pೠ"6!ERDEĂPPׇ*;=o|͝g ,Q'3&6 2z,@LGhh@53Uhrm:Y߯Ws29 @('r39(B#es\2]6ININ;Ss"¼P@aE) ?yf6'Cl!({ᱹ(ltlOuRR3QZNL.y?դ-
q~S'aNWsށ3,Nah^~+bEKäXRN d/kx3͏?Ùiၳsy8LsWqسE#퇛#"YҚpY6é:+`,@JʝRr?@wM%0,, ܃ӟ1 C9^7 g:3H@$ pĢf$toӁ2P gv B@@l@9p -, (!CT)C.dYA+AaP, @HCP Tj_=F`
L`=v=@8^< |