diff --git a/javatests/com/google/gerrit/acceptance/api/revision/BUILD b/javatests/com/google/gerrit/acceptance/api/revision/BUILD index 3bfe2f0aea..517b04111b 100644 --- a/javatests/com/google/gerrit/acceptance/api/revision/BUILD +++ b/javatests/com/google/gerrit/acceptance/api/revision/BUILD @@ -4,4 +4,12 @@ load("//javatests/com/google/gerrit/acceptance:tests.bzl", "acceptance_tests") srcs = [f], group = f[:f.index(".")], labels = ["api"], + deps = [":revision-diff-it"], ) for f in glob(["*IT.java"])] + +# This is needed because RevisionDiffIT has subclasses that depend on it +java_library( + name = "revision-diff-it", + srcs = ["RevisionDiffIT.java"], + deps = ["//java/com/google/gerrit/acceptance:lib"], +) diff --git a/javatests/com/google/gerrit/acceptance/api/revision/RevisionDiffIT.java b/javatests/com/google/gerrit/acceptance/api/revision/RevisionDiffIT.java index 5cba12ec89..68bb66c0e9 100644 --- a/javatests/com/google/gerrit/acceptance/api/revision/RevisionDiffIT.java +++ b/javatests/com/google/gerrit/acceptance/api/revision/RevisionDiffIT.java @@ -42,7 +42,6 @@ import com.google.gerrit.extensions.common.DiffInfo; import com.google.gerrit.extensions.common.FileInfo; import com.google.gerrit.extensions.restapi.BadRequestException; import com.google.gerrit.extensions.restapi.BinaryResult; -import com.google.gerrit.testing.ConfigSuite; import java.awt.image.BufferedImage; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -55,7 +54,6 @@ import java.util.Map; import java.util.function.Function; import java.util.stream.IntStream; import javax.imageio.ImageIO; -import org.eclipse.jgit.lib.Config; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.revwalk.RevCommit; @@ -66,7 +64,8 @@ import org.junit.Test; public class RevisionDiffIT extends AbstractDaemonTest { // @RunWith(Parameterized.class) can't be used as AbstractDaemonTest is annotated with another // runner. Using different configs is a workaround to achieve the same. - private static final String TEST_PARAMETER_MARKER = "test_only_parameter"; + protected static final String TEST_PARAMETER_MARKER = "test_only_parameter"; + private static final String CURRENT = "current"; private static final String FILE_NAME = "some_file.txt"; private static final String FILE_NAME2 = "another_file.txt"; @@ -83,20 +82,6 @@ public class RevisionDiffIT extends AbstractDaemonTest { private String changeId; private String initialPatchSetId; - @ConfigSuite.Config - public static Config intralineConfig() { - Config config = new Config(); - config.setBoolean(TEST_PARAMETER_MARKER, null, "intraline", true); - return config; - } - - @ConfigSuite.Config - public static Config newDiffCacheConfig() { - Config config = new Config(); - config.setBoolean("cache", "diff_cache", "useNewDiffCache", true); - return config; - } - @Before public void setUp() throws Exception { // Reduce flakiness of tests. (If tests aren't fast enough, we would use a fall-back diff --git a/javatests/com/google/gerrit/acceptance/api/revision/RevisionDiffIntralineIT.java b/javatests/com/google/gerrit/acceptance/api/revision/RevisionDiffIntralineIT.java new file mode 100644 index 0000000000..ff4ac8e839 --- /dev/null +++ b/javatests/com/google/gerrit/acceptance/api/revision/RevisionDiffIntralineIT.java @@ -0,0 +1,28 @@ +// Copyright (C) 2021 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.acceptance.api.revision; + +import com.google.gerrit.testing.ConfigSuite; +import org.eclipse.jgit.lib.Config; + +/** Runs the {@link RevisionDiffIT} tests with the intraline config enabled. */ +public class RevisionDiffIntralineIT extends RevisionDiffIT { + @ConfigSuite.Default + public static Config intralineConfig() { + Config config = new Config(); + config.setBoolean(TEST_PARAMETER_MARKER, null, "intraline", true); + return config; + } +} diff --git a/javatests/com/google/gerrit/acceptance/api/revision/RevisionNewDiffCacheIT.java b/javatests/com/google/gerrit/acceptance/api/revision/RevisionNewDiffCacheIT.java new file mode 100644 index 0000000000..4b85c30dde --- /dev/null +++ b/javatests/com/google/gerrit/acceptance/api/revision/RevisionNewDiffCacheIT.java @@ -0,0 +1,31 @@ +// Copyright (C) 2021 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.acceptance.api.revision; + +import com.google.gerrit.testing.ConfigSuite; +import org.eclipse.jgit.lib.Config; + +/** + * Runs the {@link RevisionDiffIT} tests with the new diff cache. This is temporary until the new + * diff cache is fully deployed. The new diff cache will become the default in the future. + */ +public class RevisionNewDiffCacheIT extends RevisionDiffIT { + @ConfigSuite.Default + public static Config newDiffCacheConfig() { + Config config = new Config(); + config.setBoolean("cache", "diff_cache", "useNewDiffCache", true); + return config; + } +}