summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-14 13:34:44 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-15 10:28:14 +0900
commit15120354517f8dd5de0c6d7f54b51dcbebbd86bd (patch)
treec3fa8deeb4433c984eb5f4ae41e11c0c329373a8 /org.eclipse.jgit.test
parent2de9b6c0bbfc6536805a5325ff786951fcd539af (diff)
downloadjgit-15120354517f8dd5de0c6d7f54b51dcbebbd86bd.tar.gz
jgit-15120354517f8dd5de0c6d7f54b51dcbebbd86bd.zip
RepoCommandTest: Refactor to use try-with-resource
Change-Id: If37ce4447feb431169a75594194a7ef02e362d4e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java768
1 files changed, 373 insertions, 395 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
index 6f6dd5f46f..fa45214f0c 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/gitrepo/RepoCommandTest.java
@@ -185,108 +185,93 @@ public class RepoCommandTest extends RepositoryTestCase {
}
}
+ private Repository cloneRepository(Repository repo, boolean bare)
+ throws Exception {
+ Repository r = Git.cloneRepository()
+ .setURI(repo.getDirectory().toURI().toString())
+ .setDirectory(createUniqueTestGitDir(true)).setBare(bare).call()
+ .getRepository();
+ if (bare) {
+ assertTrue(r.isBare());
+ } else {
+ assertFalse(r.isBare());
+ }
+ return r;
+ }
+
@Test
public void runTwiceIsNOP() throws Exception {
- Repository child = Git.cloneRepository()
- .setURI(groupADb.getDirectory().toURI().toString())
- .setDirectory(createUniqueTestGitDir(true)).setBare(true).call()
- .getRepository();
-
- Repository dest = Git.cloneRepository()
- .setURI(db.getDirectory().toURI().toString())
- .setDirectory(createUniqueTestGitDir(true)).setBare(true).call()
- .getRepository();
+ try (Repository child = cloneRepository(groupADb, true);
+ Repository dest = cloneRepository(db, true)) {
+ StringBuilder xmlContent = new StringBuilder();
+ xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+ .append("<manifest>")
+ .append("<remote name=\"remote1\" fetch=\"..\" />")
+ .append("<default revision=\"master\" remote=\"remote1\" />")
+ .append("<project path=\"base\" name=\"platform/base\" />")
+ .append("</manifest>");
+ RepoCommand cmd = new RepoCommand(dest);
- assertTrue(dest.isBare());
- assertTrue(child.isBare());
+ IndexedRepos repos = new IndexedRepos();
+ repos.put("platform/base", child);
- StringBuilder xmlContent = new StringBuilder();
- xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
- .append("<manifest>")
- .append("<remote name=\"remote1\" fetch=\"..\" />")
- .append("<default revision=\"master\" remote=\"remote1\" />")
- .append("<project path=\"base\" name=\"platform/base\" />")
- .append("</manifest>");
- RepoCommand cmd = new RepoCommand(dest);
-
- IndexedRepos repos = new IndexedRepos();
- repos.put("platform/base", child);
-
- RevCommit commit = cmd
- .setInputStream(new ByteArrayInputStream(
- xmlContent.toString().getBytes(CHARSET)))
- .setRemoteReader(repos)
- .setURI("platform/")
- .setTargetURI("platform/superproject")
- .setRecordRemoteBranch(true)
- .setRecordSubmoduleLabels(true)
- .call();
+ RevCommit commit = cmd
+ .setInputStream(new ByteArrayInputStream(
+ xmlContent.toString().getBytes(CHARSET)))
+ .setRemoteReader(repos).setURI("platform/")
+ .setTargetURI("platform/superproject")
+ .setRecordRemoteBranch(true).setRecordSubmoduleLabels(true)
+ .call();
- String firstIdStr = commit.getId().name() + ":" + ".gitmodules";
- commit = new RepoCommand(dest)
- .setInputStream(new ByteArrayInputStream(
- xmlContent.toString().getBytes(CHARSET)))
- .setRemoteReader(repos)
- .setURI("platform/")
- .setTargetURI("platform/superproject")
- .setRecordRemoteBranch(true)
- .setRecordSubmoduleLabels(true)
- .call();
- String idStr = commit.getId().name() + ":" + ".gitmodules";
- assertEquals(firstIdStr, idStr);
- child.close();
- dest.close();
+ String firstIdStr = commit.getId().name() + ":" + ".gitmodules";
+ commit = new RepoCommand(dest)
+ .setInputStream(new ByteArrayInputStream(
+ xmlContent.toString().getBytes(CHARSET)))
+ .setRemoteReader(repos).setURI("platform/")
+ .setTargetURI("platform/superproject")
+ .setRecordRemoteBranch(true).setRecordSubmoduleLabels(true)
+ .call();
+ String idStr = commit.getId().name() + ":" + ".gitmodules";
+ assertEquals(firstIdStr, idStr);
+ }
}
@Test
public void androidSetup() throws Exception {
- Repository child = Git.cloneRepository()
- .setURI(groupADb.getDirectory().toURI().toString())
- .setDirectory(createUniqueTestGitDir(true)).setBare(true).call()
- .getRepository();
-
- Repository dest = Git.cloneRepository()
- .setURI(db.getDirectory().toURI().toString())
- .setDirectory(createUniqueTestGitDir(true)).setBare(true).call()
- .getRepository();
+ try (Repository child = cloneRepository(groupADb, true);
+ Repository dest = cloneRepository(db, true)) {
+ StringBuilder xmlContent = new StringBuilder();
+ xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+ .append("<manifest>")
+ .append("<remote name=\"remote1\" fetch=\"..\" />")
+ .append("<default revision=\"master\" remote=\"remote1\" />")
+ .append("<project path=\"base\" name=\"platform/base\" />")
+ .append("</manifest>");
+ RepoCommand cmd = new RepoCommand(dest);
- assertTrue(dest.isBare());
- assertTrue(child.isBare());
+ IndexedRepos repos = new IndexedRepos();
+ repos.put("platform/base", child);
- StringBuilder xmlContent = new StringBuilder();
- xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
- .append("<manifest>")
- .append("<remote name=\"remote1\" fetch=\"..\" />")
- .append("<default revision=\"master\" remote=\"remote1\" />")
- .append("<project path=\"base\" name=\"platform/base\" />")
- .append("</manifest>");
- RepoCommand cmd = new RepoCommand(dest);
-
- IndexedRepos repos = new IndexedRepos();
- repos.put("platform/base", child);
-
- RevCommit commit = cmd
- .setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(CHARSET)))
- .setRemoteReader(repos)
- .setURI("platform/")
- .setTargetURI("platform/superproject")
- .setRecordRemoteBranch(true)
- .setRecordSubmoduleLabels(true)
- .call();
+ RevCommit commit = cmd
+ .setInputStream(new ByteArrayInputStream(
+ xmlContent.toString().getBytes(CHARSET)))
+ .setRemoteReader(repos).setURI("platform/")
+ .setTargetURI("platform/superproject")
+ .setRecordRemoteBranch(true).setRecordSubmoduleLabels(true)
+ .call();
- String idStr = commit.getId().name() + ":" + ".gitmodules";
- ObjectId modId = dest.resolve(idStr);
+ String idStr = commit.getId().name() + ":" + ".gitmodules";
+ ObjectId modId = dest.resolve(idStr);
- try (ObjectReader reader = dest.newObjectReader()) {
- byte[] bytes = reader.open(modId).getCachedBytes(Integer.MAX_VALUE);
- Config base = new Config();
- BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
- String subUrl = cfg.getString("submodule", "base", "url");
- assertEquals(subUrl, "../base");
+ try (ObjectReader reader = dest.newObjectReader()) {
+ byte[] bytes = reader.open(modId)
+ .getCachedBytes(Integer.MAX_VALUE);
+ Config base = new Config();
+ BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
+ String subUrl = cfg.getString("submodule", "base", "url");
+ assertEquals(subUrl, "../base");
+ }
}
-
- child.close();
- dest.close();
}
@Test
@@ -299,200 +284,174 @@ public class RepoCommandTest extends RepositoryTestCase {
.append("<project path=\"base\" name=\"platform/base\" />")
.append("</manifest>");
- Repository dest = Git.cloneRepository()
- .setURI(db.getDirectory().toURI().toString())
- .setDirectory(createUniqueTestGitDir(true)).setBare(true).call()
- .getRepository();
-
- assertTrue(dest.isBare());
-
- RevCommit commit = new RepoCommand(dest)
- .setInputStream(new ByteArrayInputStream(
- xmlContent.toString().getBytes(CHARSET)))
- .setRemoteReader(new IndexedRepos())
- .setURI("platform/")
- .setTargetURI("platform/superproject")
- .setRecordRemoteBranch(true)
- .setIgnoreRemoteFailures(true)
- .setRecordSubmoduleLabels(true)
- .call();
-
- String idStr = commit.getId().name() + ":" + ".gitmodules";
- ObjectId modId = dest.resolve(idStr);
-
- try (ObjectReader reader = dest.newObjectReader()) {
- byte[] bytes = reader.open(modId).getCachedBytes(Integer.MAX_VALUE);
- Config base = new Config();
- BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
- String subUrl = cfg.getString("submodule", "base", "url");
- assertEquals(subUrl, "https://host.com/platform/base");
+ try (Repository dest = cloneRepository(db, true)) {
+ RevCommit commit = new RepoCommand(dest)
+ .setInputStream(new ByteArrayInputStream(
+ xmlContent.toString().getBytes(CHARSET)))
+ .setRemoteReader(new IndexedRepos()).setURI("platform/")
+ .setTargetURI("platform/superproject")
+ .setRecordRemoteBranch(true).setIgnoreRemoteFailures(true)
+ .setRecordSubmoduleLabels(true).call();
+
+ String idStr = commit.getId().name() + ":" + ".gitmodules";
+ ObjectId modId = dest.resolve(idStr);
+
+ try (ObjectReader reader = dest.newObjectReader()) {
+ byte[] bytes = reader.open(modId)
+ .getCachedBytes(Integer.MAX_VALUE);
+ Config base = new Config();
+ BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
+ String subUrl = cfg.getString("submodule", "base", "url");
+ assertEquals(subUrl, "https://host.com/platform/base");
+ }
}
-
- dest.close();
}
@Test
public void gerritSetup() throws Exception {
- Repository child =
- Git.cloneRepository().setURI(groupADb.getDirectory().toURI().toString())
- .setDirectory(createUniqueTestGitDir(true))
- .setBare(true).call().getRepository();
-
- Repository dest = Git.cloneRepository()
- .setURI(db.getDirectory().toURI().toString()).setDirectory(createUniqueTestGitDir(true))
- .setBare(true).call().getRepository();
+ try (Repository child = cloneRepository(groupADb, true);
+ Repository dest = cloneRepository(db, true)) {
+ StringBuilder xmlContent = new StringBuilder();
+ xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+ .append("<manifest>")
+ .append("<remote name=\"remote1\" fetch=\".\" />")
+ .append("<default revision=\"master\" remote=\"remote1\" />")
+ .append("<project path=\"plugins/cookbook\" name=\"plugins/cookbook\" />")
+ .append("</manifest>");
+ RepoCommand cmd = new RepoCommand(dest);
- assertTrue(dest.isBare());
- assertTrue(child.isBare());
+ IndexedRepos repos = new IndexedRepos();
+ repos.put("plugins/cookbook", child);
- StringBuilder xmlContent = new StringBuilder();
- xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
- .append("<manifest>")
- .append("<remote name=\"remote1\" fetch=\".\" />")
- .append("<default revision=\"master\" remote=\"remote1\" />")
- .append("<project path=\"plugins/cookbook\" name=\"plugins/cookbook\" />")
- .append("</manifest>");
- RepoCommand cmd = new RepoCommand(dest);
-
- IndexedRepos repos = new IndexedRepos();
- repos.put("plugins/cookbook", child);
-
- RevCommit commit = cmd
- .setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(CHARSET)))
- .setRemoteReader(repos)
- .setURI("")
- .setTargetURI("gerrit")
- .setRecordRemoteBranch(true)
- .setRecordSubmoduleLabels(true)
- .call();
-
- String idStr = commit.getId().name() + ":" + ".gitmodules";
- ObjectId modId = dest.resolve(idStr);
+ RevCommit commit = cmd
+ .setInputStream(new ByteArrayInputStream(
+ xmlContent.toString().getBytes(CHARSET)))
+ .setRemoteReader(repos).setURI("").setTargetURI("gerrit")
+ .setRecordRemoteBranch(true).setRecordSubmoduleLabels(true)
+ .call();
- try (ObjectReader reader = dest.newObjectReader()) {
- byte[] bytes = reader.open(modId).getCachedBytes(Integer.MAX_VALUE);
- Config base = new Config();
- BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
- String subUrl = cfg.getString("submodule", "plugins/cookbook", "url");
- assertEquals(subUrl, "../plugins/cookbook");
+ String idStr = commit.getId().name() + ":" + ".gitmodules";
+ ObjectId modId = dest.resolve(idStr);
+
+ try (ObjectReader reader = dest.newObjectReader()) {
+ byte[] bytes = reader.open(modId)
+ .getCachedBytes(Integer.MAX_VALUE);
+ Config base = new Config();
+ BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
+ String subUrl = cfg.getString("submodule", "plugins/cookbook",
+ "url");
+ assertEquals(subUrl, "../plugins/cookbook");
+ }
}
-
- child.close();
- dest.close();
}
@Test
public void absoluteRemoteURL() throws Exception {
- Repository child =
- Git.cloneRepository().setURI(groupADb.getDirectory().toURI().toString())
- .setDirectory(createUniqueTestGitDir(true))
- .setBare(true).call().getRepository();
- Repository dest = Git.cloneRepository()
- .setURI(db.getDirectory().toURI().toString()).setDirectory(createUniqueTestGitDir(true))
- .setBare(true).call().getRepository();
- String abs = "https://chromium.googlesource.com";
- String repoUrl = "https://chromium.googlesource.com/chromium/src";
- boolean fetchSlash = false;
- boolean baseSlash = false;
- do {
+ try (Repository child = cloneRepository(groupADb, true);
+ Repository dest = cloneRepository(db, true)) {
+ String abs = "https://chromium.googlesource.com";
+ String repoUrl = "https://chromium.googlesource.com/chromium/src";
+ boolean fetchSlash = false;
+ boolean baseSlash = false;
do {
- String fetchUrl = fetchSlash ? abs + "/" : abs;
- String baseUrl = baseSlash ? abs + "/" : abs;
-
- StringBuilder xmlContent = new StringBuilder();
- xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
- .append("<manifest>")
- .append("<remote name=\"origin\" fetch=\"" + fetchUrl + "\" />")
- .append("<default revision=\"master\" remote=\"origin\" />")
- .append("<project path=\"src\" name=\"chromium/src\" />")
- .append("</manifest>");
- RepoCommand cmd = new RepoCommand(dest);
-
- IndexedRepos repos = new IndexedRepos();
- repos.put(repoUrl, child);
-
- RevCommit commit = cmd
- .setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(CHARSET)))
- .setRemoteReader(repos)
- .setURI(baseUrl)
- .setTargetURI("gerrit")
- .setRecordRemoteBranch(true)
- .setRecordSubmoduleLabels(true)
- .call();
-
- String idStr = commit.getId().name() + ":" + ".gitmodules";
- ObjectId modId = dest.resolve(idStr);
-
- try (ObjectReader reader = dest.newObjectReader()) {
- byte[] bytes = reader.open(modId).getCachedBytes(Integer.MAX_VALUE);
- Config base = new Config();
- BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
- String subUrl = cfg.getString("submodule", "src", "url");
- assertEquals("https://chromium.googlesource.com/chromium/src", subUrl);
- }
- fetchSlash = !fetchSlash;
- } while (fetchSlash);
- baseSlash = !baseSlash;
- } while (baseSlash);
- child.close();
- dest.close();
+ do {
+ String fetchUrl = fetchSlash ? abs + "/" : abs;
+ String baseUrl = baseSlash ? abs + "/" : abs;
+
+ StringBuilder xmlContent = new StringBuilder();
+ xmlContent.append(
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+ .append("<manifest>")
+ .append("<remote name=\"origin\" fetch=\""
+ + fetchUrl + "\" />")
+ .append("<default revision=\"master\" remote=\"origin\" />")
+ .append("<project path=\"src\" name=\"chromium/src\" />")
+ .append("</manifest>");
+ RepoCommand cmd = new RepoCommand(dest);
+
+ IndexedRepos repos = new IndexedRepos();
+ repos.put(repoUrl, child);
+
+ RevCommit commit = cmd
+ .setInputStream(new ByteArrayInputStream(
+ xmlContent.toString().getBytes(CHARSET)))
+ .setRemoteReader(repos).setURI(baseUrl)
+ .setTargetURI("gerrit").setRecordRemoteBranch(true)
+ .setRecordSubmoduleLabels(true).call();
+
+ String idStr = commit.getId().name() + ":" + ".gitmodules";
+ ObjectId modId = dest.resolve(idStr);
+
+ try (ObjectReader reader = dest.newObjectReader()) {
+ byte[] bytes = reader.open(modId)
+ .getCachedBytes(Integer.MAX_VALUE);
+ Config base = new Config();
+ BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
+ String subUrl = cfg.getString("submodule", "src",
+ "url");
+ assertEquals(
+ "https://chromium.googlesource.com/chromium/src",
+ subUrl);
+ }
+ fetchSlash = !fetchSlash;
+ } while (fetchSlash);
+ baseSlash = !baseSlash;
+ } while (baseSlash);
+ }
}
@Test
public void absoluteRemoteURLAbsoluteTargetURL() throws Exception {
- Repository child =
- Git.cloneRepository().setURI(groupADb.getDirectory().toURI().toString())
- .setDirectory(createUniqueTestGitDir(true))
- .setBare(true).call().getRepository();
- Repository dest = Git.cloneRepository()
- .setURI(db.getDirectory().toURI().toString()).setDirectory(createUniqueTestGitDir(true))
- .setBare(true).call().getRepository();
- String abs = "https://chromium.googlesource.com";
- String repoUrl = "https://chromium.googlesource.com/chromium/src";
- boolean fetchSlash = false;
- boolean baseSlash = false;
- do {
+ try (Repository child = cloneRepository(groupADb, true);
+ Repository dest = cloneRepository(db, true)) {
+ String abs = "https://chromium.googlesource.com";
+ String repoUrl = "https://chromium.googlesource.com/chromium/src";
+ boolean fetchSlash = false;
+ boolean baseSlash = false;
do {
- String fetchUrl = fetchSlash ? abs + "/" : abs;
- String baseUrl = baseSlash ? abs + "/" : abs;
-
- StringBuilder xmlContent = new StringBuilder();
- xmlContent.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
- .append("<manifest>")
- .append("<remote name=\"origin\" fetch=\"" + fetchUrl + "\" />")
- .append("<default revision=\"master\" remote=\"origin\" />")
- .append("<project path=\"src\" name=\"chromium/src\" />")
- .append("</manifest>");
- RepoCommand cmd = new RepoCommand(dest);
-
- IndexedRepos repos = new IndexedRepos();
- repos.put(repoUrl, child);
-
- RevCommit commit = cmd
- .setInputStream(new ByteArrayInputStream(xmlContent.toString().getBytes(CHARSET)))
- .setRemoteReader(repos)
- .setURI(baseUrl)
- .setTargetURI(abs + "/superproject")
- .setRecordRemoteBranch(true)
- .setRecordSubmoduleLabels(true)
- .call();
-
- String idStr = commit.getId().name() + ":" + ".gitmodules";
- ObjectId modId = dest.resolve(idStr);
-
- try (ObjectReader reader = dest.newObjectReader()) {
- byte[] bytes = reader.open(modId).getCachedBytes(Integer.MAX_VALUE);
- Config base = new Config();
- BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
- String subUrl = cfg.getString("submodule", "src", "url");
- assertEquals("../chromium/src", subUrl);
- }
- fetchSlash = !fetchSlash;
- } while (fetchSlash);
- baseSlash = !baseSlash;
- } while (baseSlash);
- child.close();
- dest.close();
+ do {
+ String fetchUrl = fetchSlash ? abs + "/" : abs;
+ String baseUrl = baseSlash ? abs + "/" : abs;
+
+ StringBuilder xmlContent = new StringBuilder();
+ xmlContent.append(
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n")
+ .append("<manifest>")
+ .append("<remote name=\"origin\" fetch=\""
+ + fetchUrl + "\" />")
+ .append("<default revision=\"master\" remote=\"origin\" />")
+ .append("<project path=\"src\" name=\"chromium/src\" />")
+ .append("</manifest>");
+ RepoCommand cmd = new RepoCommand(dest);
+
+ IndexedRepos repos = new IndexedRepos();
+ repos.put(repoUrl, child);
+
+ RevCommit commit = cmd
+ .setInputStream(new ByteArrayInputStream(
+ xmlContent.toString().getBytes(CHARSET)))
+ .setRemoteReader(repos).setURI(baseUrl)
+ .setTargetURI(abs + "/superproject")
+ .setRecordRemoteBranch(true)
+ .setRecordSubmoduleLabels(true).call();
+
+ String idStr = commit.getId().name() + ":" + ".gitmodules";
+ ObjectId modId = dest.resolve(idStr);
+
+ try (ObjectReader reader = dest.newObjectReader()) {
+ byte[] bytes = reader.open(modId)
+ .getCachedBytes(Integer.MAX_VALUE);
+ Config base = new Config();
+ BlobBasedConfig cfg = new BlobBasedConfig(base, bytes);
+ String subUrl = cfg.getString("submodule", "src",
+ "url");
+ assertEquals("../chromium/src", subUrl);
+ }
+ fetchSlash = !fetchSlash;
+ } while (fetchSlash);
+ baseSlash = !baseSlash;
+ } while (baseSlash);
+ }
}
@Test
@@ -513,11 +472,12 @@ public class RepoCommandTest extends RepositoryTestCase {
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
assertTrue("submodule should be checked out", hello.exists());
- BufferedReader reader = new BufferedReader(new FileReader(hello));
- String content = reader.readLine();
- reader.close();
- assertEquals("submodule content should be as expected",
- "master world", content);
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(hello))) {
+ String content = reader.readLine();
+ assertEquals("submodule content should be as expected",
+ "master world", content);
+ }
}
@Test
@@ -603,19 +563,21 @@ public class RepoCommandTest extends RepositoryTestCase {
// The original file should exist
File hello = new File(localDb.getWorkTree(), "foo/hello.txt");
assertTrue("The original file should exist", hello.exists());
- BufferedReader reader = new BufferedReader(new FileReader(hello));
- String content = reader.readLine();
- reader.close();
- assertEquals("The original file should have expected content",
- "master world", content);
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(hello))) {
+ String content = reader.readLine();
+ assertEquals("The original file should have expected content",
+ "master world", content);
+ }
// The dest file should also exist
hello = new File(localDb.getWorkTree(), "Hello");
assertTrue("The destination file should exist", hello.exists());
- reader = new BufferedReader(new FileReader(hello));
- content = reader.readLine();
- reader.close();
- assertEquals("The destination file should have expected content",
- "master world", content);
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(hello))) {
+ String content = reader.readLine();
+ assertEquals("The destination file should have expected content",
+ "master world", content);
+ }
}
@Test
@@ -638,24 +600,27 @@ public class RepoCommandTest extends RepositoryTestCase {
.setURI(rootUri).call();
// Clone it
File directory = createTempDirectory("testBareRepo");
- Repository localDb = Git.cloneRepository().setDirectory(directory)
+ try (Repository localDb = Git.cloneRepository().setDirectory(directory)
.setURI(remoteDb.getDirectory().toURI().toString()).call()
- .getRepository();
- // The .gitmodules file should exist
- File gitmodules = new File(localDb.getWorkTree(), ".gitmodules");
- assertTrue("The .gitmodules file should exist", gitmodules.exists());
- // The first line of .gitmodules file should be expected
- BufferedReader reader = new BufferedReader(new FileReader(gitmodules));
- String content = reader.readLine();
- reader.close();
- assertEquals("The first line of .gitmodules file should be as expected",
- "[submodule \"foo\"]", content);
- // The gitlink should be the same as remote head sha1
- String gitlink = localDb.resolve(Constants.HEAD + ":foo").name();
- localDb.close();
- String remote = defaultDb.resolve(Constants.HEAD).name();
- assertEquals("The gitlink should be the same as remote head", remote,
- gitlink);
+ .getRepository()) {
+ // The .gitmodules file should exist
+ File gitmodules = new File(localDb.getWorkTree(), ".gitmodules");
+ assertTrue("The .gitmodules file should exist",
+ gitmodules.exists());
+ // The first line of .gitmodules file should be expected
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(gitmodules))) {
+ String content = reader.readLine();
+ assertEquals(
+ "The first line of .gitmodules file should be as expected",
+ "[submodule \"foo\"]", content);
+ }
+ // The gitlink should be the same as remote head sha1
+ String gitlink = localDb.resolve(Constants.HEAD + ":foo").name();
+ String remote = defaultDb.resolve(Constants.HEAD).name();
+ assertEquals("The gitlink should be the same as remote head",
+ remote, gitlink);
+ }
}
@Test
@@ -677,11 +642,12 @@ public class RepoCommandTest extends RepositoryTestCase {
.setURI(rootUri)
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
- BufferedReader reader = new BufferedReader(new FileReader(hello));
- String content = reader.readLine();
- reader.close();
- assertEquals("submodule content should be as expected",
- "branch world", content);
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(hello))) {
+ String content = reader.readLine();
+ assertEquals("submodule content should be as expected",
+ "branch world", content);
+ }
}
@Test
@@ -703,11 +669,12 @@ public class RepoCommandTest extends RepositoryTestCase {
.setURI(rootUri)
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
- BufferedReader reader = new BufferedReader(new FileReader(hello));
- String content = reader.readLine();
- reader.close();
- assertEquals("submodule content should be as expected",
- "branch world", content);
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(hello))) {
+ String content = reader.readLine();
+ assertEquals("submodule content should be as expected",
+ "branch world", content);
+ }
}
@Test
@@ -729,11 +696,12 @@ public class RepoCommandTest extends RepositoryTestCase {
.setURI(rootUri)
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
- BufferedReader reader = new BufferedReader(new FileReader(hello));
- String content = reader.readLine();
- reader.close();
- assertEquals("submodule content should be as expected",
- "branch world", content);
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(hello))) {
+ String content = reader.readLine();
+ assertEquals("submodule content should be as expected",
+ "branch world", content);
+ }
}
@Test
@@ -757,14 +725,14 @@ public class RepoCommandTest extends RepositoryTestCase {
.setURI(rootUri).call();
// Clone it
File directory = createTempDirectory("testRevisionBare");
- Repository localDb = Git.cloneRepository().setDirectory(directory)
+ try (Repository localDb = Git.cloneRepository().setDirectory(directory)
.setURI(remoteDb.getDirectory().toURI().toString()).call()
- .getRepository();
- // The gitlink should be the same as oldCommitId
- String gitlink = localDb.resolve(Constants.HEAD + ":foo").name();
- localDb.close();
- assertEquals("The gitlink is same as remote head", oldCommitId.name(),
- gitlink);
+ .getRepository()) {
+ // The gitlink should be the same as oldCommitId
+ String gitlink = localDb.resolve(Constants.HEAD + ":foo").name();
+ assertEquals("The gitlink is same as remote head",
+ oldCommitId.name(), gitlink);
+ }
}
@Test
@@ -790,22 +758,24 @@ public class RepoCommandTest extends RepositoryTestCase {
.setURI(rootUri).call();
// Clone it
File directory = createTempDirectory("testCopyFileBare");
- Repository localDb = Git.cloneRepository().setDirectory(directory)
+ try (Repository localDb = Git.cloneRepository().setDirectory(directory)
.setURI(remoteDb.getDirectory().toURI().toString()).call()
- .getRepository();
- // The Hello file should exist
- File hello = new File(localDb.getWorkTree(), "Hello");
- assertTrue("The Hello file should exist", hello.exists());
- // The foo/Hello file should be skipped.
- File foohello = new File(localDb.getWorkTree(), "foo/Hello");
- assertFalse("The foo/Hello file should be skipped", foohello.exists());
- localDb.close();
- // The content of Hello file should be expected
- BufferedReader reader = new BufferedReader(new FileReader(hello));
- String content = reader.readLine();
- reader.close();
- assertEquals("The Hello file should have expected content",
- "branch world", content);
+ .getRepository()) {
+ // The Hello file should exist
+ File hello = new File(localDb.getWorkTree(), "Hello");
+ assertTrue("The Hello file should exist", hello.exists());
+ // The foo/Hello file should be skipped.
+ File foohello = new File(localDb.getWorkTree(), "foo/Hello");
+ assertFalse("The foo/Hello file should be skipped",
+ foohello.exists());
+ // The content of Hello file should be expected
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(hello))) {
+ String content = reader.readLine();
+ assertEquals("The Hello file should have expected content",
+ "branch world", content);
+ }
+ }
}
@Test
@@ -841,36 +811,38 @@ public class RepoCommandTest extends RepositoryTestCase {
.setURI(rootUri).call();
// Clone it
File directory = createTempDirectory("testReplaceManifestBare");
- Repository localDb = Git.cloneRepository().setDirectory(directory)
+ File dotmodules;
+ try (Repository localDb = Git.cloneRepository().setDirectory(directory)
.setURI(remoteDb.getDirectory().toURI().toString()).call()
- .getRepository();
- // The Hello file should not exist
- File hello = new File(localDb.getWorkTree(), "Hello");
- assertFalse("The Hello file shouldn't exist", hello.exists());
- // The Hello.txt file should exist
- File hellotxt = new File(localDb.getWorkTree(), "Hello.txt");
- assertTrue("The Hello.txt file should exist", hellotxt.exists());
+ .getRepository()) {
+ // The Hello file should not exist
+ File hello = new File(localDb.getWorkTree(), "Hello");
+ assertFalse("The Hello file shouldn't exist", hello.exists());
+ // The Hello.txt file should exist
+ File hellotxt = new File(localDb.getWorkTree(), "Hello.txt");
+ assertTrue("The Hello.txt file should exist", hellotxt.exists());
+ dotmodules = new File(localDb.getWorkTree(),
+ Constants.DOT_GIT_MODULES);
+ }
// The .gitmodules file should have 'submodule "bar"' and shouldn't
// have
// 'submodule "foo"' lines.
- File dotmodules = new File(localDb.getWorkTree(),
- Constants.DOT_GIT_MODULES);
- localDb.close();
- BufferedReader reader = new BufferedReader(new FileReader(dotmodules));
- boolean foo = false;
- boolean bar = false;
- while (true) {
- String line = reader.readLine();
- if (line == null)
- break;
- if (line.contains("submodule \"foo\""))
- foo = true;
- if (line.contains("submodule \"bar\""))
- bar = true;
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(dotmodules))) {
+ boolean foo = false;
+ boolean bar = false;
+ while (true) {
+ String line = reader.readLine();
+ if (line == null)
+ break;
+ if (line.contains("submodule \"foo\""))
+ foo = true;
+ if (line.contains("submodule \"bar\""))
+ bar = true;
+ }
+ assertTrue("The bar submodule should exist", bar);
+ assertFalse("The foo submodule shouldn't exist", foo);
}
- reader.close();
- assertTrue("The bar submodule should exist", bar);
- assertFalse("The foo submodule shouldn't exist", foo);
}
@Test
@@ -896,34 +868,37 @@ public class RepoCommandTest extends RepositoryTestCase {
.setURI(rootUri).call();
// Clone it
File directory = createTempDirectory("testRemoveOverlappingBare");
- Repository localDb = Git.cloneRepository().setDirectory(directory)
+ File dotmodules;
+ try (Repository localDb = Git.cloneRepository().setDirectory(directory)
.setURI(remoteDb.getDirectory().toURI().toString()).call()
- .getRepository();
+ .getRepository()) {
+ dotmodules = new File(localDb.getWorkTree(),
+ Constants.DOT_GIT_MODULES);
+ }
+
// The .gitmodules file should have 'submodule "foo"' and shouldn't
// have
// 'submodule "foo/bar"' lines.
- File dotmodules = new File(localDb.getWorkTree(),
- Constants.DOT_GIT_MODULES);
- localDb.close();
- BufferedReader reader = new BufferedReader(new FileReader(dotmodules));
- boolean foo = false;
- boolean foobar = false;
- boolean a = false;
- while (true) {
- String line = reader.readLine();
- if (line == null)
- break;
- if (line.contains("submodule \"foo\""))
- foo = true;
- if (line.contains("submodule \"foo/bar\""))
- foobar = true;
- if (line.contains("submodule \"a\""))
- a = true;
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(dotmodules))) {
+ boolean foo = false;
+ boolean foobar = false;
+ boolean a = false;
+ while (true) {
+ String line = reader.readLine();
+ if (line == null)
+ break;
+ if (line.contains("submodule \"foo\""))
+ foo = true;
+ if (line.contains("submodule \"foo/bar\""))
+ foobar = true;
+ if (line.contains("submodule \"a\""))
+ a = true;
+ }
+ assertTrue("The foo submodule should exist", foo);
+ assertFalse("The foo/bar submodule shouldn't exist", foobar);
+ assertTrue("The a submodule should exist", a);
}
- reader.close();
- assertTrue("The foo submodule should exist", foo);
- assertFalse("The foo/bar submodule shouldn't exist", foobar);
- assertTrue("The a submodule should exist", a);
}
@Test
@@ -959,11 +934,12 @@ public class RepoCommandTest extends RepositoryTestCase {
.call();
File hello = new File(localDb.getWorkTree(), "foo/hello.txt");
assertTrue("submodule should be checked out", hello.exists());
- BufferedReader reader = new BufferedReader(new FileReader(hello));
- String content = reader.readLine();
- reader.close();
- assertEquals("submodule content should be as expected",
- "master world", content);
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(hello))) {
+ String content = reader.readLine();
+ assertEquals("submodule content should be as expected",
+ "master world", content);
+ }
}
@Test
public void testRemoteAlias() throws Exception {
@@ -1165,11 +1141,12 @@ public class RepoCommandTest extends RepositoryTestCase {
.setURI(rootUri)
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
- BufferedReader reader = new BufferedReader(new FileReader(hello));
- String content = reader.readLine();
- reader.close();
- assertEquals("submodule content should be as expected",
- "branch world", content);
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(hello))) {
+ String content = reader.readLine();
+ assertEquals("submodule content should be as expected",
+ "branch world", content);
+ }
}
@Test
@@ -1191,11 +1168,12 @@ public class RepoCommandTest extends RepositoryTestCase {
.setURI(rootUri)
.call();
File hello = new File(db.getWorkTree(), "foo/hello.txt");
- BufferedReader reader = new BufferedReader(new FileReader(hello));
- String content = reader.readLine();
- reader.close();
- assertEquals("submodule content should be as expected",
- "branch world", content);
+ try (BufferedReader reader = new BufferedReader(
+ new FileReader(hello))) {
+ String content = reader.readLine();
+ assertEquals("submodule content should be as expected",
+ "branch world", content);
+ }
}
private void resolveRelativeUris() {
imaginary Nextcloud server, a safe home for all your data: https://github.com/nextcloud/serverwww-data
summaryrefslogtreecommitdiffstats
path: root/apps/sharebymail/l10n/it.json
blob: 3ff1e12c24d30815b6312060e3cc006bbd6db2f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{ "translations": {
    "Shared with %1$s" : "Condivisa con %1$s",
    "Shared with {email}" : "Condivisa con {email}",
    "Shared with %1$s by %2$s" : "Condivisa con %1$s da %2$s",
    "Shared with {email} by {actor}" : "Condivisa con {email} da {actor}",
    "Unshared from %1$s" : "Condivisione rimossa da %1$s",
    "Unshared from {email}" : "Condivisione rimossa da {email}",
    "Unshared from %1$s by %2$s" : "Condivisione rimossa da %1$s da %2$s",
    "Unshared from {email} by {actor}" : "Condivisione rimossa da {email} da {actor}",
    "Password for mail share sent to %1$s" : "Password per la condivisione tramite posta inviata a %1$s",
    "Password for mail share sent to {email}" : "Password per la condivisione tramite posta inviata a {email}",
    "Password for mail share sent to you" : "Password per la condivisione tramite posta inviata a te",
    "You shared %1$s with %2$s by mail" : "Hai condiviso %1$s con %2$s tramite posta",
    "You shared {file} with {email} by mail" : "Hai condiviso {file} con {email} tramite posta",
    "%3$s shared %1$s with %2$s by mail" : "%3$s ha condiviso %1$s con %2$s tramite email",
    "{actor} shared {file} with {email} by mail" : "{actor} ha condiviso {file} con {email} tramite email",
    "You unshared %1$s from %2$s by mail" : "Hai rimosso la condivisione %1$s da %2$s tramite posta",
    "You unshared {file} from {email} by mail" : "Hai rimosso la condivisione di {file} con {email} tramite posta",
    "%3$s unshared %1$s from %2$s by mail" : "%3$s ha rimosso la condivisione %1$s da %2$s tramite posta",
    "{actor} unshared {file} from {email} by mail" : "{actor} ha rimosso la condivisione di {file} da {email} tramite posta",
    "Password to access %1$s was sent to %2s" : "La password per accedere a %1$s è stata inviata a %2s",
    "Password to access {file} was sent to {email}" : "La password per accedere a {file} ti è stata inviata a {email}",
    "Password to access %1$s was sent to you" : "La password per accedere a %1$s ti è stata inviata",
    "Password to access {file} was sent to you" : "La password per accedere a {file} ti è stata inviata",
    "Sharing %1$s failed, this item is already shared with %2$s" : "Condivisione %1$s non riuscita, questo elemento è già condiviso con %2$s",
    "We can't send you the auto-generated password. Please set a valid email address in your personal settings and try again." : "Non possiamo inviarti la password generata automaticamente. Imposta un indirizzo di posta valido nelle impostazioni personali e prova ancora.",
    "Failed to send share by email" : "Invio non riuscito della condivisione tramite email",
    "%1$s shared »%2$s« with you" : "%1$s ha condiviso «%2$s» con te",
    "%1$s shared »%2$s« with you." : "%1$s ha condiviso «%2$s» con te.",
    "Click the button below to open it." : "Fai clic sul pulsante sotto per aprirlo.",
    "Open »%s«" : "Apri «%s»",
    "%1$s via %2$s" : "%1$s tramite %2$s",
    "%1$s shared »%2$s« with you.\nYou should have already received a separate mail with a link to access it.\n" : "%1$s ha condiviso «%2$s» con te.\nDovresti aver ricevuto un messaggio separato con un collegamento per accedervi.\n",
    "%1$s shared »%2$s« with you. You should have already received a separate mail with a link to access it." : "%1$s ha condiviso «%2$s» con te. Dovresti aver ricevuto un messaggio separato con un collegamento per accedervi.",
    "Password to access »%1$s« shared to you by %2$s" : "Password per accedere a «%1$s» condivisa con te da %2$s",
    "Password to access »%s«" : "Password per accedere a «%s»",
    "It is protected with the following password:" : "È protetta con la password seguente:",
    "%1$s shared »%2$s« with you and wants to add:" : "%1$s ha condiviso «%2$s» con te e vuole aggiungere:",
    "%1$s shared »%2$s« with you and wants to add" : "%1$s ha condiviso «%2$s» con te e vuole aggiungere",
    "»%s« added a note to a file shared with you" : "«%s» ha aggiunto una nota a un file condiviso con te",
    "You just shared »%1$s« with %2$s. The share was already sent to the recipient. Due to the security policies defined by the administrator of %3$s each share needs to be protected by password and it is not allowed to send the password directly to the recipient. Therefore you need to forward the password manually to the recipient." : "Hai appena condiviso «%1$s» con %2$s. La condivisione è già stata inviata al destinatario. A causa dei criteri di sicurezza definiti dall'amministratore di %3$s, ogni condivisione deve essere protetta con password e non è consentito inviare la password direttamente al destinatario. Per questo motivo, devi inoltrare la password manualmente al destinatario.",
    "Password to access »%1$s« shared by you with %2$s" : "Password per accedere a «%1$s» condivisa da te con %2$s",
    "This is the password:" : "Questa è la password:",
    "You can choose a different password at any time in the share dialog." : "Puoi scegliere una password diversa in qualsiasi momento nella finestra di condivisione.",
    "Could not find share" : "Non è stato possibile trovare la condivisione",
    "Share by mail" : "Condividi tramite email",
    "Share provider which allows you to share files by mail" : "Fornitore di condivisione che ti consente di condividere file tramite posta",
    "Allows users to share a personalized link to a file or folder by putting in an email address." : "Consente agli utenti di condividere un collegamento personalizzato a un file o a una cartella inserendo un indirizzo di posta elettronica.",
    "Send password by mail" : "Invia password tramite posta",
    "Enforce password protection" : "Imponi la protezione con password",
    "Sharing %s failed, this item is already shared with %s" : "Condivisione %s non riuscita, questo elemento è già condiviso con %s",
    "%s shared »%s« with you" : "%s ha condiviso »%s« con te",
    "%s shared »%s« with you." : "%s ha condiviso «%s» con te.",
    "%s via %s" : "%s tramite %s",
    "%s shared »%s« with you.\nYou should have already received a separate mail with a link to access it.\n" : "%s ha condiviso «%s» con te.\nDovresti aver ricevuto un messaggio separato con un collegamento per accedervi.\n",
    "%s shared »%s« with you. You should have already received a separate mail with a link to access it." : "%s ha condiviso «%s» con te. Dovresti aver ricevuto un messaggio separato con un collegamento per accedervi.",
    "Password to access »%s« shared to you by %s" : "Password per accedere a «%s» condivisa con te da %s",
    "It is protected with the following password: %s" : "È protetta con la password seguente: %s",
    "You just shared »%s« with %s. The share was already send to the recipient. Due to the security policies defined by the administrator of %s each share needs to be protected by password and it is not allowed to send the password directly to the recipient. Therefore you need to forward the password manually to the recipient." : "Hai appena condiviso «%s» con %s. La condivisione è stata già inviata al destinatario. A causa dei criteri di sicurezza definiti dall'amministratore di %s, ogni condivisione deve essere protetta da password e non è consentito l'invio diretto della password al destinatario. Perciò, devi inoltrare manualmente la password al destinatario.",
    "Password to access »%s« shared with %s" : "Password per accedere a «%s» condivisa con %s",
    "This is the password: %s" : "Questa è la password: %s",
    "You just shared »%1$s« with %2$s. The share was already send to the recipient. Due to the security policies defined by the administrator of %3$s each share needs to be protected by password and it is not allowed to send the password directly to the recipient. Therefore you need to forward the password manually to the recipient." : "Hai appena condiviso «%1$s» con %2$s. La condivisione è stata già inviata al destinatario. A causa dei criteri di sicurezza definiti dall'amministratore di %3$s, ogni condivisione deve essere protetta da password e non è consentito l'invio diretto della password al destinatario. Perciò, devi inoltrare manualmente la password al destinatario.",
    "Password to access »%1$s« shared with %2$s" : "Password per accedere a «%1$s» condivisa con %2$s"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}