aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2016-09-09 14:09:51 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-09-09 14:18:10 +0000
commitd07177d0e628bd86a212eb6b68da2de2b02572fa (patch)
treea2a4a34c2de7ff3639896649180a9f09b96e5896 /src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java
parent8d2dd4b0e4d73af878eeba80fc8db7fb292bfc35 (diff)
Add repository parameter to source artifact resolver
Needed for #1262. Doesn't do anything, yet, other than make the CL smaller. -- MOS_MIGRATED_REVID=132671036
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java b/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java
index cfdeef4797..c0bec56609 100644
--- a/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java
+++ b/src/test/java/com/google/devtools/build/lib/actions/ArtifactFactoryTest.java
@@ -28,6 +28,7 @@ import com.google.common.collect.Maps;
import com.google.devtools.build.lib.actions.MutableActionGraph.ActionConflictException;
import com.google.devtools.build.lib.actions.util.ActionsTestUtil;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
+import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.testutil.Scratch;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -50,6 +51,8 @@ import javax.annotation.Nullable;
@RunWith(JUnit4.class)
public class ArtifactFactoryTest {
+ private static final RepositoryName MAIN = RepositoryName.MAIN;
+
private Scratch scratch = new Scratch();
private Path execRoot;
@@ -120,31 +123,31 @@ public class ArtifactFactoryTest {
@Test
public void testResolveArtifact_noDerived_simpleSource() throws Exception {
assertSame(artifactFactory.getSourceArtifact(fooRelative, clientRoot),
- artifactFactory.resolveSourceArtifact(fooRelative));
+ artifactFactory.resolveSourceArtifact(fooRelative, MAIN));
assertSame(artifactFactory.getSourceArtifact(barRelative, clientRoRoot),
- artifactFactory.resolveSourceArtifact(barRelative));
+ artifactFactory.resolveSourceArtifact(barRelative, MAIN));
}
@Test
public void testResolveArtifact_inExternalRepo() throws Exception {
assertSame(
artifactFactory.getSourceArtifact(alienRelative, alienRoot),
- artifactFactory.resolveSourceArtifact(alienRelative));
+ artifactFactory.resolveSourceArtifact(alienRelative, MAIN));
}
@Test
public void testResolveArtifact_noDerived_derivedRoot() throws Exception {
assertNull(artifactFactory.resolveSourceArtifact(
- outRoot.getPath().getRelative(fooRelative).relativeTo(execRoot)));
+ outRoot.getPath().getRelative(fooRelative).relativeTo(execRoot), MAIN));
assertNull(artifactFactory.resolveSourceArtifact(
- outRoot.getPath().getRelative(barRelative).relativeTo(execRoot)));
+ outRoot.getPath().getRelative(barRelative).relativeTo(execRoot), MAIN));
}
@Test
public void testResolveArtifact_noDerived_simpleSource_other() throws Exception {
- Artifact actual = artifactFactory.resolveSourceArtifact(fooRelative);
+ Artifact actual = artifactFactory.resolveSourceArtifact(fooRelative, MAIN);
assertSame(artifactFactory.getSourceArtifact(fooRelative, clientRoot), actual);
- actual = artifactFactory.resolveSourceArtifact(barRelative);
+ actual = artifactFactory.resolveSourceArtifact(barRelative, MAIN);
assertSame(artifactFactory.getSourceArtifact(barRelative, clientRoRoot), actual);
}
@@ -158,9 +161,9 @@ public class ArtifactFactoryTest {
PathFragment outsideWorkspace = new PathFragment("../foo");
PathFragment insideWorkspace =
new PathFragment("../" + clientRoot.getPath().getBaseName() + "/foo");
- assertNull(artifactFactory.resolveSourceArtifact(outsideWorkspace));
+ assertNull(artifactFactory.resolveSourceArtifact(outsideWorkspace, MAIN));
assertNull("Up-level-containing paths that descend into the right workspace aren't allowed",
- artifactFactory.resolveSourceArtifact(insideWorkspace));
+ artifactFactory.resolveSourceArtifact(insideWorkspace, MAIN));
MockPackageRootResolver packageRootResolver = new MockPackageRootResolver();
packageRootResolver.setPackageRoots(packageRoots);
Map<PathFragment, Artifact> result = new HashMap<>();