Skip to content

Commit ce57e9d

Browse files
committed
revert
1 parent 399ff96 commit ce57e9d

File tree

6 files changed

+33
-13
lines changed

6 files changed

+33
-13
lines changed

.gitignore

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
1212
hs_err_pid*
13-
/.*
14-
/build/
15-
/bin/
16-
13+
/.gradle/
14+
/.settings
15+
/.classpath
16+
/.project
17+
/build/
18+
/bin/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Features:
6868

6969
# Functional testing
7070
- New local file-based Test Repository is created before each test and deletes automatically after each test
71-
- To execute tests just run GitVCSTest class as JUnit test. Tests from VCSAbstractTest class will be executed. See [pk-vcs-test](https://github.com/ProjectKaiser/pk-vcs-test) for details
71+
- To execute tests just run GitVCSTest class as JUnit test. Tests from VCSAbstractTest class will be executed. See [pk-vcs-test](https://github.com/ProjectKaiser/pk-vcs-test) for details
7272
- Run `gradle test` to execute tests
7373

7474
# Limitations

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ repositories {
1616

1717
dependencies {
1818
compile 'com.github.ProjectKaiser:pk-vcs-api:1.1'
19+
compile 'commons-logging:commons-logging:1.2'
1920
compile 'org.eclipse.jgit:org.eclipse.jgit:4.3.0.201604071810-r'
2021

2122
testCompile 'org.mockito:mockito-core:2.0.62-beta'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Mar 28 23:38:07 MSK 2017
1+
#Fri Apr 22 10:26:49 GMT+03:00 2016
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-bin.zip

src/main/java/com/projectkaiser/scm/vcs/GitVCS.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
import java.net.SocketAddress;
1212
import java.net.URI;
1313
import java.nio.charset.StandardCharsets;
14-
import java.util.*;
14+
import java.util.ArrayList;
15+
import java.util.Arrays;
16+
import java.util.HashSet;
17+
import java.util.List;
18+
import java.util.Set;
1519

1620
import org.apache.commons.io.FileUtils;
1721
import org.apache.commons.io.IOUtils;
@@ -55,7 +59,7 @@ public class GitVCS implements IVCS {
5559
private static final String REFS_REMOTES_ORIGIN = Constants.R_REMOTES + Constants.DEFAULT_REMOTE_NAME + "/";
5660

5761
private CredentialsProvider credentials;
58-
private final IVCSRepositoryWorkspace repo;
62+
private IVCSRepositoryWorkspace repo;
5963

6064
public CredentialsProvider getCredentials() {
6165
return credentials;
@@ -265,10 +269,10 @@ public void setProxy(final String host, final int port, String proxyUser, String
265269
@Override
266270
public List<Proxy> select(URI uri) {
267271
if (uri.toString().toLowerCase().contains(repo.getRepoUrl().toLowerCase())) {
268-
return Collections.singletonList(new Proxy(Type.HTTP, InetSocketAddress
269-
.createUnresolved(host, port)));
272+
return Arrays.asList(new Proxy(Type.HTTP, InetSocketAddress
273+
.createUnresolved(host, port)));
270274
} else {
271-
return delegate == null ? Collections.singletonList(Proxy.NO_PROXY)
275+
return delegate == null ? Arrays.asList(Proxy.NO_PROXY)
272276
: delegate.select(uri);
273277
}
274278
}

src/test/java/com/projectkaiser/scm/vcs/GitVCSTest.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,24 @@
1818
import com.projectkaiser.scm.vcs.api.workingcopy.IVCSRepositoryWorkspace;
1919

2020
public class GitVCSTest extends VCSAbstractTest {
21+
22+
private static final String GITHUB_USER = System.getProperty("PK_VCS_TEST_GITHUB_USER") == null ?
23+
System.getenv("PK_VCS_TEST_GITHUB_USER") : System.getProperty("PK_VCS_TEST_GITHUB_USER");
24+
private static final String GITHUB_PASS = System.getProperty("PK_VCS_TEST_GITHUB_PASS") == null ?
25+
System.getenv("PK_VCS_TEST_GITHUB_PASS") : System.getProperty("PK_VCS_TEST_GITHUB_PASS");
2126

27+
private Git mockedGit;
2228
private Repository localGitRepo;
2329
private RuntimeException testGitResetException = new RuntimeException("test exeption on git.reset()");
2430

31+
@BeforeClass
32+
public static void setUpClass() {
33+
assertTrue("Set PK_VCS_TEST_GITHUB_USER enviroment variable as user name of a valid github account to execute tests.",
34+
GITHUB_USER != null);
35+
assertTrue("Set PK_VCS_TEST_GITHUB_PASS enviroment variable as user password of a valid github account to execute tests.",
36+
GITHUB_PASS != null);
37+
}
38+
2539
@Override
2640
public void setUp() throws Exception {
2741
super.setUp();
@@ -56,7 +70,6 @@ protected IVCS getVCS(IVCSRepositoryWorkspace mockedVCSRepo) {
5670

5771
@Override
5872
protected void setMakeFailureOnVCSReset(Boolean doMakeFailure) {
59-
Git mockedGit;
6073
if (doMakeFailure) {
6174
mockedGit = Mockito.spy(((GitVCS) vcs).getLocalGit(mockedLWC));
6275
Mockito.doReturn(mockedGit).when((GitVCS) vcs).getLocalGit(mockedLWC);

0 commit comments

Comments
 (0)