Skip to content

Commit

Permalink
fix method rename and new client version
Browse files Browse the repository at this point in the history
  • Loading branch information
katerina20 committed Jan 17, 2024
1 parent 3b61f20 commit 169007c
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void act(Outputter out, ProjectProperties properties, ProjectClient clien
out.println(SKIPPED.withIcon(RESOURCE_BUNDLE.getString("message.no_file_string_project")));
return;

Check warning on line 33 in src/main/java/com/crowdin/cli/commands/actions/FileDeleteAction.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/crowdin/cli/commands/actions/FileDeleteAction.java#L32-L33

Added lines #L32 - L33 were not covered by tests
}
String filePath = Utils.unixPath(Utils.sepAtStart(file));
String filePath = Utils.toUnixPath(Utils.sepAtStart(file));
List<FileInfo> projectFiles = project.getFileInfos();
FileInfo foundFile = projectFiles.stream()
.filter(f -> Objects.equals(filePath, f.getPath()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ public void act(Outputter out, ProjectProperties properties, ProjectClient clien
return;

Check warning on line 43 in src/main/java/com/crowdin/cli/commands/actions/FileDownloadAction.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/crowdin/cli/commands/actions/FileDownloadAction.java#L42-L43

Added lines #L42 - L43 were not covered by tests
}

String filePath = Utils.unixPath(Utils.sepAtStart(file));
String filePath = Utils.toUnixPath(Utils.sepAtStart(file));
FileInfo foundFile = project.getFileInfos().stream()
.filter(f -> Objects.equals(filePath, f.getPath()))
.findFirst()
.orElseThrow(() -> new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.file_not_found"), filePath)));
URL url = client.downloadFile(foundFile.getId());
String destPath = nonNull(dest) ? Utils.normalizePath(Utils.sepAtEnd(dest)) + foundFile.getName() : filePath;
saveToFile(destPath, url);
String destPath = nonNull(dest) ? Utils.sepAtEnd(dest) + foundFile.getName() : file;
saveToFile(Utils.normalizePath(destPath), url);
out.println(OK.withIcon(String.format(RESOURCE_BUNDLE.getString("message.downloaded_file"), filePath)));
out.println(WARNING.withIcon(RESOURCE_BUNDLE.getString("message.experimental_command")));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void act(Outputter out, ProjectProperties properties, ProjectClient clien

Language language = project.findLanguageById(languageId, true)
.orElseThrow(() -> new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.language_not_exist"), languageId)));
String sourcePath = Utils.unixPath(Utils.sepAtStart(file));
String sourcePath = Utils.toUnixPath(Utils.sepAtStart(file));
FileInfo sourceFileInfo = project.getFileInfos().stream()
.filter(fi -> Objects.equals(sourcePath, fi.getPath()))
.findFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void act(Outputter out, ProjectProperties properties, ProjectClient clien
if (Objects.equals(Type.FILES_BASED, project.getType())) {
if (Objects.isNull(dest))
throw new RuntimeException(String.format(RESOURCE_BUNDLE.getString("error.file.dest_required"), languageId));

Check warning on line 48 in src/main/java/com/crowdin/cli/commands/actions/FileUploadTranslationAction.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/com/crowdin/cli/commands/actions/FileUploadTranslationAction.java#L48

Added line #L48 was not covered by tests
String sourcePath = Utils.unixPath(Utils.sepAtStart(dest));
String sourcePath = Utils.toUnixPath(Utils.sepAtStart(dest));
FileInfo sourceFileInfo = project.getFileInfos().stream()
.filter(fi -> Objects.equals(sourcePath, fi.getPath()))
.findFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void testDownload() {
when(client.downloadFile(eq(101L)))
.thenReturn(urlMock);

NewAction<ProjectProperties, ProjectClient> action = new FileDownloadAction("first.po", null);
NewAction<ProjectProperties, ProjectClient> action = new FileDownloadAction("first.po", "dest");
action.act(Outputter.getDefault(), pb, client);

verify(client).downloadFullProject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testDownloadTranslation() {
when(client.buildProjectFileTranslation(eq(101L), eq(request)))
.thenReturn(urlMock);

NewAction<ProjectProperties, ProjectClient> action = new FileDownloadTranslationAction("first.po", "ua", "first.po");
NewAction<ProjectProperties, ProjectClient> action = new FileDownloadTranslationAction("first.po", "ua", null);
action.act(Outputter.getDefault(), pb, client);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void testUploadTranslation_FileBasedProject() throws ResponseException {
when(client.uploadStorage(eq("first_uk.po"), any()))
.thenReturn(1L);

NewAction<ProjectProperties, ProjectClient> action = new FileUploadTranslationAction(fileToUpload, null, "first.po", "ua", false);
NewAction<ProjectProperties, ProjectClient> action = new FileUploadTranslationAction(fileToUpload, null, "/first.po", "ua", false);
action.act(Outputter.getDefault(), pb, client);

verify(client).downloadFullProject(any());
Expand Down
2 changes: 1 addition & 1 deletion versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ version.commons-cli..commons-cli=1.5.0

version.com.h3xstream.findsecbugs..findsecbugs-plugin=1.12.0

version.com.github.crowdin..crowdin-api-client-java=1.13.0
version.com.github.crowdin..crowdin-api-client-java=1.14.0

plugin.org.asciidoctor.jvm.convert=3.3.2

Expand Down

0 comments on commit 169007c

Please sign in to comment.