RebuildNoteDbIT: Replace to be deprecated Files.append with Files.asCharSink

Files.append is deprecated in Guava 22 [1] in favor of Files.asCharSink.

Replace it now before upgrading Guava.

[1] https://github.com/google/guava/wiki/Release22

Change-Id: Ib62859fe4bfe46d08ef9fa1bc459451ec6c8bc42
(cherry picked from commit 41a791a3d5)
This commit is contained in:
David Pursehouse 2017-05-31 08:33:06 +09:00
parent fe9e775fe5
commit 03908c942a
1 changed files with 4 additions and 4 deletions

View File

@ -17,6 +17,7 @@ package com.google.gerrit.acceptance.pgm;
import static com.google.common.truth.Truth.assertThat;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.io.FileWriteMode;
import com.google.common.io.Files;
import com.google.gerrit.launcher.GerritLauncher;
import com.google.gerrit.server.notedb.ConfigNotesMigration;
@ -44,10 +45,9 @@ public class RebuildNoteDbIT {
@Test
public void rebuildEmptySite() throws Exception {
initSite();
Files.append(
ConfigNotesMigration.allEnabledConfig().toText(),
new File(sitePath.toString(), "etc/gerrit.config"),
UTF_8);
Files.asCharSink(
new File(sitePath.toString(), "etc/gerrit.config"), UTF_8, FileWriteMode.APPEND)
.write(ConfigNotesMigration.allEnabledConfig().toText());
runGerrit("RebuildNoteDb", "-d", sitePath.toString(), "--show-stack-trace");
}