spring-cloud-config-dependencies
diff --git a/spring-cloud-config-monitor/src/test/resources/gitea.json b/spring-cloud-config-monitor/src/test/resources/gitea.json
new file mode 100755
index 00000000..c60e4d2c
--- /dev/null
+++ b/spring-cloud-config-monitor/src/test/resources/gitea.json
@@ -0,0 +1,81 @@
+{
+ "secret": "gitea_push",
+ "ref": "refs/heads/master",
+ "before": "70767b558d8f850eac3fead13dfc232d043646a0",
+ "after": "78b77379c448caf024c73fa280ca571449224590",
+ "compare_url": "https://gitea.lawyers.corp/internal/lawsuits/compare/70767b558d8f850eac3fead13dfc232d043646a0...78b77379c448caf024c73fa280ca571449224590",
+ "commits": [
+ {
+ "id": "78b77379c448caf024c73fa280ca571449224590",
+ "message": "SUPPORT-4765: urlencode\n",
+ "url": "https://gitea.lawyers.corp/internal/lawsuits/commit/78b77379c448caf024c73fa280ca571449224590",
+ "author": {
+ "name": "Perry Mason",
+ "email": "perrym@lawyers.corp",
+ "username": "git"
+ },
+ "committer": {
+ "name": "Perry Mason",
+ "email": "perrym@lawyers.corp",
+ "username": "git"
+ },
+ "verification": null,
+ "timestamp": "2018-08-27T11:18:34Z"
+ }
+ ],
+ "repository": {
+ "id": 480,
+ "owner": {
+ "id": 3,
+ "login": "internal",
+ "full_name": "",
+ "email": "",
+ "avatar_url": "https://gitea.lawyers.corp/avatars/dbc87f99ecd29cb0eb4447807ad73f9f",
+ "language": "",
+ "username": "internal"
+ },
+ "name": "lawsuits",
+ "full_name": "internal/lawsuits",
+ "description": "",
+ "empty": false,
+ "private": false,
+ "fork": false,
+ "parent": null,
+ "mirror": false,
+ "size": 5516,
+ "html_url": "https://gitea.lawyers.corp/internal/lawsuits",
+ "ssh_url": "git@localhost:internal/lawsuits.git",
+ "clone_url": "https://gitea.lawyers.corp/internal/lawsuits.git",
+ "website": "",
+ "stars_count": 1,
+ "forks_count": 20,
+ "watchers_count": 6,
+ "open_issues_count": 0,
+ "default_branch": "master",
+ "created_at": "2018-01-18T15:11:51Z",
+ "updated_at": "2018-08-27T11:18:34Z",
+ "permissions": {
+ "admin": false,
+ "push": false,
+ "pull": false
+ }
+ },
+ "pusher": {
+ "id": 2,
+ "login": "perrym",
+ "full_name": "Perry Mason",
+ "email": "perrym@lawyers.corp",
+ "avatar_url": "https://gitea.lawyers.corp/avatars/5868737ae078a4441031bf550d16e967",
+ "language": "en-US",
+ "username": "perrym"
+ },
+ "sender": {
+ "id": 2,
+ "login": "perrym",
+ "full_name": "Perry Mason",
+ "email": "perrym@lawyers.corp",
+ "avatar_url": "https://gitea.lawyers.corp/avatars/5868737ae078a4441031bf550d16e967",
+ "language": "en-US",
+ "username": "perrym"
+ }
+}
\ No newline at end of file
diff --git a/spring-cloud-config-monitor/src/test/resources/gitee.json b/spring-cloud-config-monitor/src/test/resources/gitee.json
new file mode 100644
index 00000000..4be60313
--- /dev/null
+++ b/spring-cloud-config-monitor/src/test/resources/gitee.json
@@ -0,0 +1,54 @@
+{
+ "before": "fb32ef5812dc132ece716a05c50c7531c6dc1b4d",
+ "after": "ac63b9ba95191a1bf79d60bc262851a66c12cda1",
+ "ref": "refs/heads/master",
+ "user_id": 13,
+ "user_name": "123",
+ "user": {
+ "name": "123",
+ "username": "test123",
+ "url": "https://gitee.com/oschina"
+ },
+ "repository": {
+ "name": "webhook",
+ "url": "https://git.oschina.net/oschina/webhook",
+ "description": "",
+ "homepage": "https://gitee.com/oschina/webhook"
+ },
+ "commits": [{
+ "id": "ac63b9ba95191a1bf79d60bc262851a66c12cda1",
+ "message": "1234 bug fix",
+ "timestamp": "2016-12-09T17:28:02 08:00",
+ "url": "https://gitee.com/oschina/webhook/commit/ac63b9ba95191a1bf79d60bc262851a66c12cda1",
+ "author": {
+ "name": "123",
+ "email": "123@123.com",
+ "time": "2016-12-09T17:28:02 08:00"
+ },
+ "added": [
+ "d.txt"
+ ],
+ "modified": [
+ "c.txt"
+ ],
+ "removed": [
+ "b.txt"
+ ]
+ }],
+ "total_commits_count": 1,
+ "commits_more_than_ten": false,
+ "project": {
+ "name": "webhook",
+ "path": "webhook",
+ "url": "https://gitee.com/oschina/webhook",
+ "git_ssh_url": "git@gitee.com:oschina/webhook.git",
+ "git_http_url": "https://gitee.com/oschina/webhook.git",
+ "git_svn_url": "svn://gitee.com/oschina/webhook",
+ "namespace": "oschina",
+ "name_with_namespace": "oschina/webhook",
+ "path_with_namespace": "oschina/webhook",
+ "default_branch": "master"
+ },
+ "hook_name": "push_hooks",
+ "password": "pwd"
+}
diff --git a/spring-cloud-config-monitor/src/test/resources/gitlab.json b/spring-cloud-config-monitor/src/test/resources/gitlab.json
new file mode 100644
index 00000000..6599a109
--- /dev/null
+++ b/spring-cloud-config-monitor/src/test/resources/gitlab.json
@@ -0,0 +1,65 @@
+{
+ "object_kind": "push",
+ "before": "95790bf891e76fee5e1747ab589903a6a1f80f22",
+ "after": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
+ "ref": "refs/heads/master",
+ "user_id": 4,
+ "user_name": "John Smith",
+ "user_email": "john@example.com",
+ "user_avatar": "https://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=8://s.gravatar.com/avatar/d4c74594d841139328695756648b6bd6?s=80",
+ "project_id": 15,
+ "project":{
+ "name":"Diaspora",
+ "description":"",
+ "web_url":"https://example.com/mike/diaspora",
+ "avatar_url":null,
+ "git_ssh_url":"git@example.com:mike/diaspora.git",
+ "git_http_url":"https://example.com/mike/diaspora.git",
+ "namespace":"Mike",
+ "visibility_level":0,
+ "path_with_namespace":"mike/diaspora",
+ "default_branch":"master",
+ "homepage":"https://example.com/mike/diaspora",
+ "url":"git@example.com:mike/diasporadiaspora.git",
+ "ssh_url":"git@example.com:mike/diaspora.git",
+ "http_url":"https://example.com/mike/diaspora.git"
+ },
+ "repository":{
+ "name": "Diaspora",
+ "url": "git@example.com:mike/diasporadiaspora.git",
+ "description": "",
+ "homepage": "https://example.com/mike/diaspora",
+ "git_http_url":"https://example.com/mike/diaspora.git",
+ "git_ssh_url":"git@example.com:mike/diaspora.git",
+ "visibility_level":0
+ },
+ "commits": [
+ {
+ "id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
+ "message": "Update Catalan translation to e38cb41.",
+ "timestamp": "2011-12-12T14:27:31+02:00",
+ "url": "https://example.com/mike/diaspora/commit/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
+ "author": {
+ "name": "Jordi Mallach",
+ "email": "jordi@softcatala.org"
+ },
+ "added": ["newapp.properties"],
+ "modified": ["application.yml"],
+ "removed": []
+ },
+ {
+ "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
+ "message": "fixed readme",
+ "timestamp": "2012-01-03T23:36:29+02:00",
+ "url": "https://example.com/mike/diaspora/commit/da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
+ "author": {
+ "name": "GitLab dev user",
+ "email": "gitlabdev@dv6700.(none)"
+ },
+ "added": [],
+ "modified": ["oldapp.yml"],
+ "removed": []
+ }
+ ],
+ "total_commits_count": 4
+}
\ No newline at end of file
diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/ResourceController.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/ResourceController.java
index 0ad1b68b..1a28d860 100644
--- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/ResourceController.java
+++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/ResourceController.java
@@ -136,6 +136,13 @@ public class ResourceController {
return binary(request, name, profile, label, path);
}
+ @RequestMapping(value = "/{name}/{profile}/**", params = "useDefaultLabel", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
+ public byte[] binary(@PathVariable String name, @PathVariable String profile,
+ ServletWebRequest request) throws IOException {
+ String path = getFilePath(request, name, profile, null);
+ return binary(request, name, profile, null, path);
+ }
+
/*
* Used only for unit tests.
*/
diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/AwsCodeCommitCredentialProvider.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/AwsCodeCommitCredentialProvider.java
index 69502293..935b6661 100644
--- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/AwsCodeCommitCredentialProvider.java
+++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/support/AwsCodeCommitCredentialProvider.java
@@ -48,7 +48,12 @@ import static org.springframework.util.StringUtils.hasText;
*
* From the command line, you can configure git to use AWS code commit with a credential
* helper. However, jgit does not support credential helper commands, but it does provider
- * a CredentialsProvider abstract class we can extend.
+ * a CredentialsProvider abstract class we can extend. Connecting to an AWS CodeCommit
+ * (codecommit) repository requires an AWS access key and secret key. These are used to
+ * calculate a signature for the git request. The AWS access key is used as the codecommit
+ * username, and the calculated signature is used as the password. The process for
+ * calculating this signature is documented very well at
+ * https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html.
*
* Connecting to an AWS CodeCommit (codecommit) repository requires an AWS access key and
* secret key. These are used to calculate a signature for the git request. The AWS access
diff --git a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/config/HttpClientVaultRestTemplateFactoryTest.java b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/config/HttpClientVaultRestTemplateFactoryTest.java
index aa5d896e..3724a720 100644
--- a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/config/HttpClientVaultRestTemplateFactoryTest.java
+++ b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/config/HttpClientVaultRestTemplateFactoryTest.java
@@ -49,26 +49,26 @@ public class HttpClientVaultRestTemplateFactoryTest {
private static final ProxyHostProperties HTTPS_PROXY = new ProxyHostProperties();
static {
- AUTHENTICATED_HTTP_PROXY.setHost("http://authenticated.http.proxy");
+ AUTHENTICATED_HTTP_PROXY.setHost("https://authenticated.http.proxy");
AUTHENTICATED_HTTP_PROXY.setPort(8080);
AUTHENTICATED_HTTP_PROXY.setUsername("username");
AUTHENTICATED_HTTP_PROXY.setPassword("password");
}
static {
- AUTHENTICATED_HTTPS_PROXY.setHost("http://authenticated.https.proxy");
+ AUTHENTICATED_HTTPS_PROXY.setHost("https://authenticated.https.proxy");
AUTHENTICATED_HTTPS_PROXY.setPort(8081);
AUTHENTICATED_HTTPS_PROXY.setUsername("username2");
AUTHENTICATED_HTTPS_PROXY.setPassword("password2");
}
static {
- HTTP_PROXY.setHost("http://http.proxy");
+ HTTP_PROXY.setHost("https://http.proxy");
HTTP_PROXY.setPort(8080);
}
static {
- HTTPS_PROXY.setHost("http://https.proxy");
+ HTTPS_PROXY.setHost("https://https.proxy");
HTTPS_PROXY.setPort(8081);
}
diff --git a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/environment/ConfigurableHttpConnectionFactoryIntegrationTests.java b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/environment/ConfigurableHttpConnectionFactoryIntegrationTests.java
index bafdc489..9b0b3167 100644
--- a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/environment/ConfigurableHttpConnectionFactoryIntegrationTests.java
+++ b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/environment/ConfigurableHttpConnectionFactoryIntegrationTests.java
@@ -71,26 +71,26 @@ public class ConfigurableHttpConnectionFactoryIntegrationTests {
private static final ProxyHostProperties HTTPS_PROXY = new ProxyHostProperties();
static {
- AUTHENTICATED_HTTP_PROXY.setHost("http://authenticated.http.proxy");
+ AUTHENTICATED_HTTP_PROXY.setHost("https://authenticated.http.proxy");
AUTHENTICATED_HTTP_PROXY.setPort(8080);
AUTHENTICATED_HTTP_PROXY.setUsername("username");
AUTHENTICATED_HTTP_PROXY.setPassword("password");
}
static {
- AUTHENTICATED_HTTPS_PROXY.setHost("http://authenticated.https.proxy");
+ AUTHENTICATED_HTTPS_PROXY.setHost("https://authenticated.https.proxy");
AUTHENTICATED_HTTPS_PROXY.setPort(8081);
AUTHENTICATED_HTTPS_PROXY.setUsername("username2");
AUTHENTICATED_HTTPS_PROXY.setPassword("password2");
}
static {
- HTTP_PROXY.setHost("http://http.proxy");
+ HTTP_PROXY.setHost("https://http.proxy");
HTTP_PROXY.setPort(8080);
}
static {
- HTTPS_PROXY.setHost("http://https.proxy");
+ HTTPS_PROXY.setHost("https://https.proxy");
HTTPS_PROXY.setPort(8081);
}
diff --git a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/ResourceControllerIntegrationTests.java b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/ResourceControllerIntegrationTests.java
index 5e2fd983..19d8355b 100644
--- a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/ResourceControllerIntegrationTests.java
+++ b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/ResourceControllerIntegrationTests.java
@@ -32,12 +32,14 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.io.ByteArrayResource;
+import org.springframework.http.HttpHeaders;
import org.springframework.test.annotation.DirtiesContext;
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.MockMvcResultMatchers;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.util.MimeTypeUtils;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@@ -64,7 +66,7 @@ public class ResourceControllerIntegrationTests {
@Before
public void init() {
- Mockito.reset(this.repository);
+ Mockito.reset(this.repository, this.resources);
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}
@@ -93,6 +95,20 @@ public class ResourceControllerIntegrationTests {
Mockito.verify(this.resources).findOne("foo", "default", null, "foo.txt");
}
+ @Test
+ public void binaryResourceNoLabel() throws Exception {
+ Mockito.when(this.repository.findOne("foo", "default", null))
+ .thenReturn(new Environment("foo", "default", "master"));
+ Mockito.when(this.resources.findOne("foo", "default", null, "foo.txt"))
+ .thenReturn(new ByteArrayResource("hello".getBytes()));
+ this.mvc.perform(MockMvcRequestBuilders.get("/foo/default/foo.txt")
+ .param("useDefaultLabel", "")
+ .header(HttpHeaders.ACCEPT, MimeTypeUtils.APPLICATION_OCTET_STREAM_VALUE))
+ .andExpect(MockMvcResultMatchers.status().isOk());
+ Mockito.verify(this.repository).findOne("foo", "default", null);
+ Mockito.verify(this.resources).findOne("foo", "default", null, "foo.txt");
+ }
+
@Configuration
@EnableWebMvc
@Import(PropertyPlaceholderAutoConfiguration.class)
diff --git a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/ResourceControllerTests.java b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/ResourceControllerTests.java
index a2061a5e..cff89fd0 100644
--- a/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/ResourceControllerTests.java
+++ b/spring-cloud-config-server/src/test/java/org/springframework/cloud/config/server/resource/ResourceControllerTests.java
@@ -299,4 +299,15 @@ public class ResourceControllerTests {
return text.replace("\n", "").replace("\t", "");
}
+ @Test
+ public void defaultLabelForBinary() throws Exception {
+ this.environmentRepository.setSearchLocations("classpath:/test/{application}");
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ ServletWebRequest webRequest = new ServletWebRequest(request,
+ new MockHttpServletResponse());
+ request.setRequestURI("/dev/spam/bar/" + "foo.txt");
+ byte[] resource = this.controller.binary("dev/spam", "bar", webRequest);
+ assertThat(new String(resource)).isEqualToIgnoringNewLines("foo: dev_bar/spam");
+ }
+
}