Merge remote-tracking branch 'origin/2.0.x' into 2.1.x

This commit is contained in:
Ryan Baxter
2019-04-22 20:12:03 +02:00
17 changed files with 133 additions and 16 deletions

View File

@@ -18,6 +18,8 @@ package org.springframework.cloud.config.server;
import java.io.IOException;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.SystemReader;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -51,6 +53,9 @@ public class BootstrapConfigServerIntegrationTests {
@BeforeClass
public static void init() throws IOException {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
ConfigServerTestUtils.prepareLocalRepo("encrypt-repo");
}

View File

@@ -16,6 +16,8 @@
package org.springframework.cloud.config.server;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.SystemReader;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -52,6 +54,9 @@ public class CompositeIntegrationTests {
@BeforeClass
public static void init() throws Exception {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
ConfigServerTestUtils.prepareLocalRepo();
ConfigServerTestUtils.prepareLocalSvnRepo(
"src/test/resources/svn-config-repo", "target/repos/svn-config-repo");
@@ -110,6 +115,9 @@ public class CompositeIntegrationTests {
@BeforeClass
public static void init() throws Exception {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
ConfigServerTestUtils.prepareLocalRepo();
ConfigServerTestUtils.prepareLocalSvnRepo(
"src/test/resources/svn-config-repo", "target/repos/svn-config-repo");

View File

@@ -18,6 +18,8 @@ package org.springframework.cloud.config.server;
import java.io.IOException;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.SystemReader;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -60,6 +62,9 @@ public class ConfigClientOffIntegrationTests {
@BeforeClass
public static void init() throws IOException {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
ConfigServerTestUtils.prepareLocalRepo();
}

View File

@@ -18,6 +18,8 @@ package org.springframework.cloud.config.server;
import java.io.IOException;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.SystemReader;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -65,6 +67,9 @@ public class ConfigClientOnIntegrationTests {
@BeforeClass
public static void init() throws IOException {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
localRepo = ConfigServerTestUtils.prepareLocalRepo();
}

View File

@@ -18,6 +18,8 @@ package org.springframework.cloud.config.server;
import java.io.IOException;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.SystemReader;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -46,6 +48,9 @@ public class NativeConfigServerIntegrationTests {
@BeforeClass
public static void init() throws IOException {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
ConfigServerTestUtils.prepareLocalRepo();
}

View File

@@ -19,6 +19,8 @@ package org.springframework.cloud.config.server;
import java.io.IOException;
import java.util.Arrays;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.SystemReader;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -51,6 +53,9 @@ public class VanillaConfigServerIntegrationTests {
@BeforeClass
public static void init() throws IOException {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
ConfigServerTestUtils.prepareLocalRepo();
}

View File

@@ -19,6 +19,8 @@ package org.springframework.cloud.config.server.config;
import java.util.HashMap;
import java.util.List;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.SystemReader;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -64,6 +66,9 @@ public class CustomCompositeEnvironmentRepositoryTests {
@BeforeClass
public static void init() throws Exception {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
ConfigServerTestUtils.prepareLocalRepo();
}
@@ -115,6 +120,9 @@ public class CustomCompositeEnvironmentRepositoryTests {
@BeforeClass
public static void init() throws Exception {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
ConfigServerTestUtils.prepareLocalRepo();
}

View File

@@ -38,12 +38,15 @@ import org.eclipse.jgit.api.errors.InvalidRemoteException;
import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
import org.eclipse.jgit.api.errors.RefNotFoundException;
import org.eclipse.jgit.api.errors.TransportException;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.FetchResult;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.SystemReader;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.boot.WebApplicationType;
@@ -72,6 +75,12 @@ public class JGitEnvironmentRepositoryConcurrencyTests {
private File basedir = new File("target/config");
@BeforeClass
public static void initClass() {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
}
@Before
public void init() throws Exception {
if (this.basedir.exists()) {

View File

@@ -33,12 +33,15 @@ import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.ResetCommand.ResetType;
import org.eclipse.jgit.api.TransportConfigCallback;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.SystemReader;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mockito.Mockito;
@@ -72,6 +75,12 @@ public class JGitEnvironmentRepositoryIntegrationTests {
private File basedir = new File("target/config");
@BeforeClass
public static void initClass() {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
}
@Before
public void init() throws Exception {
if (this.basedir.exists()) {

View File

@@ -42,6 +42,7 @@ import org.eclipse.jgit.api.errors.InvalidRemoteException;
import org.eclipse.jgit.api.errors.NotMergedException;
import org.eclipse.jgit.api.errors.TransportException;
import org.eclipse.jgit.attributes.AttributesNodeProvider;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.lib.BaseRepositoryBuilder;
import org.eclipse.jgit.lib.ObjectDatabase;
import org.eclipse.jgit.lib.ObjectId;
@@ -58,7 +59,9 @@ import org.eclipse.jgit.transport.TrackingRefUpdate;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.SystemReader;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -100,6 +103,12 @@ public class JGitEnvironmentRepositoryTests {
private File basedir = new File("target/config");
@BeforeClass
public static void initClass() {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
}
@Before
public void init() throws Exception {
String uri = ConfigServerTestUtils.prepareLocalRepo();

View File

@@ -19,7 +19,10 @@ package org.springframework.cloud.config.server.environment;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.SystemReader;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
@@ -42,6 +45,12 @@ public class MultipleJGitEnvironmentApplicationPlaceholderRepositoryTests {
private MultipleJGitEnvironmentRepository repository = new MultipleJGitEnvironmentRepository(
this.environment, new MultipleJGitEnvironmentProperties());
@BeforeClass
public static void initClass() {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
}
@Before
public void init() throws Exception {
String defaultUri = ConfigServerTestUtils.prepareLocalRepo("config-repo");

View File

@@ -16,7 +16,10 @@
package org.springframework.cloud.config.server.environment;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.SystemReader;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.cloud.config.environment.Environment;
@@ -39,6 +42,12 @@ public class MultipleJGitEnvironmentLabelPlaceholderRepositoryTests {
private String defaultUri;
@BeforeClass
public static void initClass() {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
}
@Before
public void init() throws Exception {
this.defaultUri = ConfigServerTestUtils

View File

@@ -20,7 +20,10 @@ import java.io.File;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.SystemReader;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.cloud.config.environment.Environment;
@@ -44,6 +47,12 @@ public class MultipleJGitEnvironmentProfilePlaceholderRepositoryTests {
private MultipleJGitEnvironmentRepository repository = new MultipleJGitEnvironmentRepository(
this.environment, new MultipleJGitEnvironmentProperties());
@BeforeClass
public static void initClass() {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
}
@Before
public void init() throws Exception {
String defaultUri = ConfigServerTestUtils.prepareLocalRepo("config-repo");

View File

@@ -22,9 +22,12 @@ import java.util.LinkedHashMap;
import java.util.Map;
import org.assertj.core.api.Assertions;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.FileUtils;
import org.eclipse.jgit.util.SystemReader;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.internal.matchers.ThrowableMessageMatcher;
@@ -59,6 +62,12 @@ public class MultipleJGitEnvironmentRepositoryIntegrationTests {
private File basedir = new File("target/config");
@BeforeClass
public static void initClass() {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
}
@Before
public void init() throws Exception {
if (this.basedir.exists()) {

View File

@@ -24,7 +24,10 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.jgit.api.TransportConfigCallback;
import org.eclipse.jgit.junit.MockSystemReader;
import org.eclipse.jgit.util.SystemReader;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -54,6 +57,12 @@ public class MultipleJGitEnvironmentRepositoryTests {
private MultipleJGitEnvironmentRepository repository;
@BeforeClass
public static void initClass() {
// mock Git configuration to make tests independent of local Git configuration
SystemReader.setInstance(new MockSystemReader());
}
@Before
public void init() throws Exception {
String defaultUri = ConfigServerTestUtils.prepareLocalRepo("config-repo");

View File

@@ -98,9 +98,11 @@ public class GenericResourceRepositoryTests {
@Test
public void invalidPath() {
this.exception.expect(NoSuchResourceException.class);
this.nativeRepository.setSearchLocations("file:./src/test/resources/test/{profile}");
this.nativeRepository
.setSearchLocations("file:./src/test/resources/test/{profile}");
this.repository.findOne("blah", "local", "master", "..%2F..%2Fdata-jdbc.sql");
this.output.expect(containsString("Path contains \"../\" after call to StringUtils#cleanPath"));
this.output.expect(containsString(
"Path contains \"../\" after call to StringUtils#cleanPath"));
}
}