mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-02-22 06:26:56 +01:00
Merge branch 'develop' into feature/hg_hooks_over_tcp
# Conflicts: # CHANGELOG.md
This commit is contained in:
@@ -59,8 +59,13 @@ class PendingPluginInstallationTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldThrowExceptionIfCancelFailed(@TempDir Path directory) {
|
||||
void shouldThrowExceptionIfCancelFailed(@TempDir Path directory) throws IOException {
|
||||
Path file = directory.resolve("file");
|
||||
Files.createDirectory(file);
|
||||
|
||||
Path makeFileNotDeletable = file.resolve("not_deletable");
|
||||
Files.write(makeFileNotDeletable, "42".getBytes());
|
||||
|
||||
when(plugin.getDescriptor().getInformation().getName()).thenReturn("scm-awesome-plugin");
|
||||
|
||||
PendingPluginInstallation installation = new PendingPluginInstallation(plugin, file);
|
||||
|
||||
@@ -48,12 +48,15 @@ import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
@@ -239,6 +242,30 @@ class I18nServletTest {
|
||||
assertJson(json);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldNotHaveInvalidPluginsJsonFiles() throws IOException {
|
||||
String path = getClass().getClassLoader().getResource("locales/en/plugins.json").getPath();
|
||||
assertThat(path).isNotNull();
|
||||
|
||||
Path filePath = Paths.get(path);
|
||||
Path translationRootPath = filePath.getParent().getParent();
|
||||
assertThat(translationRootPath).isDirectoryContaining("glob:**/en");
|
||||
|
||||
Files
|
||||
.list(translationRootPath)
|
||||
.filter(Files::isDirectory)
|
||||
.map(localePath -> localePath.resolve("plugins.json"))
|
||||
.forEach(this::validatePluginsJson);
|
||||
}
|
||||
|
||||
private void validatePluginsJson(Path path) {
|
||||
try {
|
||||
new ObjectMapper().readTree(path.toFile());
|
||||
} catch (IOException e) {
|
||||
fail("error while parsing translation file " + path, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void verifyHeaders(HttpServletResponse response) {
|
||||
verify(response).setCharacterEncoding("UTF-8");
|
||||
verify(response).setContentType("application/json");
|
||||
|
||||
Reference in New Issue
Block a user