Skip to content

Commit

Permalink
CHE-260 Rename some factory parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihail Kuznyetsov committed Apr 11, 2016
1 parent cac8c1d commit 56da67f
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ public void keepDirectorySelected(boolean keepDirectory) {
view.enableDirectoryNameField(keepDirectory);

if (keepDirectory) {
projectParameters().put("keepDirectory", view.getDirectoryName());
projectParameters().put("keepDir", view.getDirectoryName());
dataObject.withType("blank");
view.highlightDirectoryNameField(!NameUtils.checkProjectName(view.getDirectoryName()));
view.focusDirectoryNameFiend();
} else {
projectParameters().remove("keepDirectory");
projectParameters().remove("keepDir");
dataObject.withType(null);
view.highlightDirectoryNameField(false);
}
Expand All @@ -141,11 +141,11 @@ public void keepDirectorySelected(boolean keepDirectory) {
@Override
public void keepDirectoryNameChanged(@NotNull String directoryName) {
if (view.keepDirectory()) {
projectParameters().put("keepDirectory", directoryName);
projectParameters().put("keepDir", directoryName);
dataObject.withType("blank");
view.highlightDirectoryNameField(!NameUtils.checkProjectName(view.getDirectoryName()));
} else {
projectParameters().remove("keepDirectory");
projectParameters().remove("keepDir");
dataObject.withType(null);
view.highlightDirectoryNameField(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public void keepDirectorySelectedTest() {
@Test
public void keepDirectoryUnSelectedTest() {
Map<String, String> parameters = new HashMap<>();
parameters.put("keepDirectory", "directory");
parameters.put("keepDir", "directory");
when(source.getParameters()).thenReturn(parameters);

presenter.keepDirectorySelected(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ public void keepDirectorySelected(boolean keepDirectory) {
view.enableDirectoryNameField(keepDirectory);

if (keepDirectory) {
projectParameters().put("keepDirectory", view.getDirectoryName());
projectParameters().put("keepDir", view.getDirectoryName());
dataObject.withType("blank");
view.highlightDirectoryNameField(!NameUtils.checkProjectName(view.getDirectoryName()));
view.focusDirectoryNameFiend();
} else {
projectParameters().remove("keepDirectory");
projectParameters().remove("keepDir");
dataObject.withType(null);
view.highlightDirectoryNameField(false);
}
Expand All @@ -184,11 +184,11 @@ public void keepDirectorySelected(boolean keepDirectory) {
@Override
public void keepDirectoryNameChanged(@NotNull String directoryName) {
if (view.keepDirectory()) {
projectParameters().put("keepDirectory", directoryName);
projectParameters().put("keepDir", directoryName);
dataObject.withType("blank");
view.highlightDirectoryNameField(!NameUtils.checkProjectName(view.getDirectoryName()));
} else {
projectParameters().remove("keepDirectory");
projectParameters().remove("keepDir");
dataObject.withType(null);
view.highlightDirectoryNameField(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public void keepDirectorySelectedTest() {

presenter.keepDirectorySelected(true);

assertEquals("directory", parameters.get("keepDirectory"));
assertEquals("directory", parameters.get("keepDir"));
verify(dataObject).withType("blank");
verify(view).highlightDirectoryNameField(eq(false));
verify(view).focusDirectoryNameFiend();
Expand All @@ -413,7 +413,7 @@ public void keepDirectorySelectedTest() {
@Test
public void keepDirectoryUnSelectedTest() {
Map<String, String> parameters = new HashMap<>();
parameters.put("keepDirectory", "directory");
parameters.put("keepDir", "directory");
when(source.getParameters()).thenReturn(parameters);

presenter.keepDirectorySelected(false);
Expand All @@ -432,7 +432,7 @@ public void keepDirectoryNameChangedAndKeepDirectorySelectedTest() {

presenter.keepDirectoryNameChanged("directory");

assertEquals("directory", parameters.get("keepDirectory"));
assertEquals("directory", parameters.get("keepDir"));
verify(dataObject, never()).setPath(any());
verify(dataObject).withType(eq("blank"));
verify(view).highlightDirectoryNameField(eq(false));
Expand All @@ -441,7 +441,7 @@ public void keepDirectoryNameChangedAndKeepDirectorySelectedTest() {
@Test
public void keepDirectoryNameChangedAndKeepDirectoryUnSelectedTest() {
Map<String, String> parameters = new HashMap<>();
parameters.put("keepDirectory", "directory");
parameters.put("keepDir", "directory");
when(source.getParameters()).thenReturn(parameters);
when(view.keepDirectory()).thenReturn(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ public void importSources(FolderEntry baseFolder,
// For factory: checkout particular commit after clone
String commitId = null;
// For factory: github pull request feature
String remoteOriginFetch = null;
String fetch = null;
String branch = null;
String startPoint = null;
// For factory or probably for our projects templates:
// If git repository contains more than one project need clone all repository but after cloning keep just
// sub-project that is specified in parameter "keepDirectory".
String keepDirectory = null;
// sub-project that is specified in parameter "keepDir".
String keepDir = null;
// For factory and for our projects templates:
// Keep all info related to the vcs. In case of Git: ".git" directory and ".gitignore" file.
// Delete vcs info if false.
Expand All @@ -129,8 +129,8 @@ public void importSources(FolderEntry baseFolder,
commitId = parameters.get("commitId");
branch = parameters.get("branch");
startPoint = parameters.get("startPoint");
remoteOriginFetch = parameters.get("remoteOriginFetch");
keepDirectory = parameters.get("keepDirectory");
fetch = parameters.get("fetch");
keepDir = parameters.get("keepDir");
if (parameters.containsKey("keepVcs")) {
keepVcs = Boolean.parseBoolean(parameters.get("keepVcs"));
}
Expand All @@ -141,11 +141,11 @@ public void importSources(FolderEntry baseFolder,
final DtoFactory dtoFactory = DtoFactory.getInstance();
final String location = storage.getLocation();
final String projectName = baseFolder.getName();
if (keepDirectory != null) {
if (keepDir != null) {
final File temp = Files.createTempDirectory(null).toFile();
try {
git = gitConnectionFactory.getConnection(temp, consumerFactory);
sparsecheckout(git, projectName, location, branch == null ? "master" : branch, startPoint, keepDirectory, dtoFactory);
sparsecheckout(git, projectName, location, branch == null ? "master" : branch, startPoint, keepDir, dtoFactory);
// Copy content of directory to the project folder.
final File projectDir = new File(localPath);
IoUtil.copy(temp, projectDir, IoUtil.ANY_FILTER);
Expand All @@ -159,8 +159,8 @@ public void importSources(FolderEntry baseFolder,
cloneRepository(git, "origin", location, dtoFactory);
if (commitId != null) {
checkoutCommit(git, commitId, dtoFactory);
} else if (remoteOriginFetch != null) {
git.getConfig().add("remote.origin.fetch", remoteOriginFetch);
} else if (fetch != null) {
git.getConfig().add("remote.origin.fetch", fetch);
fetch(git, "origin", dtoFactory);
if (branch != null) {
checkoutBranch(git, projectName, branch, startPoint, dtoFactory);
Expand All @@ -174,8 +174,8 @@ public void importSources(FolderEntry baseFolder,
if (commitId != null) {
fetchBranch(git, "origin", branch == null ? "*" : branch, dtoFactory);
checkoutCommit(git, commitId, dtoFactory);
} else if (remoteOriginFetch != null) {
git.getConfig().add("remote.origin.fetch", remoteOriginFetch);
} else if (fetch != null) {
git.getConfig().add("remote.origin.fetch", fetch);
fetch(git, "origin", dtoFactory);
if (branch != null) {
checkoutBranch(git, projectName, branch, startPoint, dtoFactory);
Expand Down Expand Up @@ -312,7 +312,7 @@ private void sparsecheckout(GitConnection git,
$ git init
$ git remote add origin <URL>
$ git config core.sparsecheckout true
$ echo keepDirectory >> .git/info/sparse-checkout
$ echo keepDir >> .git/info/sparse-checkout
$ git pull origin master
*/
initRepository(git, dtoFactory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public void validate(SourceStorage source, FactoryParameter.Version version) thr
break;
case "branch":
case "commitId":
case "keepDirectory":
case "remoteOriginFetch":
case "keepDir":
case "fetch":
case "branchMerge":
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public void setUp() throws Exception {
put("branch", "master");
put("commitId", "123456");
put("keepVcs", "true");
put("remoteOriginFetch", "12345");
put("keepDirectory", "/src");
put("fetch", "12345");
put("keepDir", "/src");
}
});
}
Expand Down

0 comments on commit 56da67f

Please sign in to comment.