Using order of locations when serving resources (#1858)

This commit is contained in:
Ryan Baxter
2021-04-09 13:16:48 -04:00
committed by GitHub
parent 0e361a3d87
commit 4e1c3bb45e
10 changed files with 11 additions and 12 deletions

View File

@@ -58,8 +58,7 @@ public class GenericResourceRepository
String[] locations = this.service.getLocations(application, profile, label)
.getLocations();
ArrayList<Resource> locationResources = new ArrayList<>();
for (int i = locations.length; i-- > 0;) {
String location = locations[i];
for (String location : locations) {
if (!PathUtils.isInvalidEncodedLocation(location)) {
locationResources.add(this.resourceLoader.getResource(location));
}

View File

@@ -85,19 +85,15 @@ public class CompositeIntegrationTests {
@Test
public void resourceEndpointsWork() {
// This request will get the file from the Git Repo
// This request will get the file from the Git Repo because its order is first
// The SVN repo should have the content foo: bar
String text = new TestRestTemplate()
.getForObject(
"http://localhost:" + this.port
+ "/foo/development/composite/bar.properties",
String.class);
String expected = "foo: bar";
assertThat(expected).isEqualTo(text).as("invalid content");
// This request will get the file from the SVN Repo
text = new TestRestTemplate().getForObject("http://localhost:" + this.port
+ "/foo/development/composite/bar.properties", String.class);
String expected = "foo: barconfig\n";
assertThat(expected).isEqualTo(text).as("invalid content");
}
@@ -154,7 +150,7 @@ public class CompositeIntegrationTests {
+ "/foo/development/composite/bar.properties",
String.class);
String expected = "foo: bar";
String expected = "foo: barconfig\n";
assertThat(expected).isEqualTo(text).as("invalid content");
// This request will get the file from the SVN Repo

View File

@@ -4,3 +4,6 @@
7df4a26d5437d9d4090cd5809967f870444cde8f 7df4a26d5437d9d4090cd5809967f870444cde8f Ryan Baxter <rbaxter@pivotal.io> 1481905544 -0500 checkout: moving from raw to composite
7df4a26d5437d9d4090cd5809967f870444cde8f 7df4a26d5437d9d4090cd5809967f870444cde8f Ryan Baxter <rbaxter@pivotal.io> 1481905552 -0500 checkout: moving from composite to raw
7df4a26d5437d9d4090cd5809967f870444cde8f 2921d46f948329996d3eb4a3d11aaaff6ccda84f Marcin Grzejszczak <marcin@grzejszczak.pl> 1549357696 +0100 commit: Updated
2921d46f948329996d3eb4a3d11aaaff6ccda84f 7df4a26d5437d9d4090cd5809967f870444cde8f Ryan Baxter <rbaxter@vmware.com> 1617653453 -0400 checkout: moving from raw to composite
7df4a26d5437d9d4090cd5809967f870444cde8f e488193e654487b7f43e38f0865860529cb2ec79 Ryan Baxter <rbaxter@vmware.com> 1617653500 -0400 commit: updating bar
e488193e654487b7f43e38f0865860529cb2ec79 2921d46f948329996d3eb4a3d11aaaff6ccda84f Ryan Baxter <rbaxter@vmware.com> 1617653549 -0400 checkout: moving from composite to raw

View File

@@ -1 +1,2 @@
0000000000000000000000000000000000000000 7df4a26d5437d9d4090cd5809967f870444cde8f Ryan Baxter <rbaxter@pivotal.io> 1481905474 -0500 branch: Created from raw
7df4a26d5437d9d4090cd5809967f870444cde8f e488193e654487b7f43e38f0865860529cb2ec79 Ryan Baxter <rbaxter@vmware.com> 1617653500 -0400 commit: updating bar

View File

@@ -1 +1 @@
7df4a26d5437d9d4090cd5809967f870444cde8f
e488193e654487b7f43e38f0865860529cb2ec79