SitePaths: Convert site_path itself to Path
Also convert all remaining references that expect to resolve site_path to a File, notably LocalDiskRepositoryManager. Change-Id: I5ef6f6e3d7b3fe0418a470b079b4cc04bc9be4f6
This commit is contained in:
committed by
David Pursehouse
parent
f0c38d028b
commit
62e67bede7
@@ -25,12 +25,11 @@ import com.google.inject.Provider;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class LibrariesTest {
|
||||
@Test
|
||||
public void testCreate() throws FileNotFoundException {
|
||||
public void testCreate() throws Exception {
|
||||
final SitePaths site = new SitePaths(Paths.get("."));
|
||||
final ConsoleUI ui = createStrictMock(ConsoleUI.class);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.gerrit.common.FileUtil;
|
||||
import com.google.gerrit.pgm.init.api.ConsoleUI;
|
||||
import com.google.gerrit.pgm.init.api.InitFlags;
|
||||
import com.google.gerrit.pgm.init.api.Section;
|
||||
@@ -53,8 +54,7 @@ public class UpgradeFrom2_0_xTest extends InitTestCase {
|
||||
final Path p = newSitePath();
|
||||
final SitePaths site = new SitePaths(p);
|
||||
assertTrue(site.isNew);
|
||||
assertTrue(site.site_path.mkdir());
|
||||
Files.createDirectory(site.etc_dir);
|
||||
FileUtil.mkdirsOrDie(site.etc_dir, "Failed to create");
|
||||
|
||||
for (String n : UpgradeFrom2_0_x.etcFiles) {
|
||||
Files.write(p.resolve(n), ("# " + n + "\n").getBytes(UTF_8));
|
||||
@@ -84,7 +84,7 @@ public class UpgradeFrom2_0_xTest extends InitTestCase {
|
||||
expect(ui.yesno(
|
||||
eq(true),
|
||||
eq("Upgrade '%s'"),
|
||||
eq(p.toRealPath().normalize().toString())))
|
||||
eq(p.toAbsolutePath().normalize())))
|
||||
.andReturn(true);
|
||||
replay(ui);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user