com.google.devtools.build.lib.events.Location.BUILTIN - java examples

Here are the examples of the java api com.google.devtools.build.lib.events.Location.BUILTIN taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

98 Examples 7

19 View Complete Implementation : SkylarkInfoTest.java
Copyright Apache License 2.0
Author : bazelbuild
@Test
public void concatWithOverlappingFieldsFails() throws Exception {
    SkylarkProvider provider1 = makeProvider();
    SkylarkInfo info1 = makeInfoWithF1F2Values(provider1, 4, 5);
    SkylarkInfo info2 = makeInfoWithF1F2Values(provider1, 4, null);
    EvalException expected = replacedertThrows(EvalException.clreplaced, () -> info1.getConcatter().concat(info1, info2, Location.BUILTIN));
    replacedertThat(expected).hasMessageThat().contains("cannot add struct instances with common field 'f1'");
}

19 View Complete Implementation : SkylarkInfoTest.java
Copyright Apache License 2.0
Author : bazelbuild
/**
 * Creates an unexported schemaless provider type with builtin location.
 */
private static SkylarkProvider makeProvider() {
    return SkylarkProvider.createUnexportedSchemaless(Location.BUILTIN);
}

19 View Complete Implementation : BuiltinProvider.java
Copyright Apache License 2.0
Author : bazelbuild
@Override
public Location getLocation() {
    return Location.BUILTIN;
}

19 View Complete Implementation : SkylarkInfoTest.java
Copyright Apache License 2.0
Author : bazelbuild
@Test
public void nullLocationDefaultsToBuiltin() throws Exception {
    SkylarkInfo info = SkylarkInfo.create(makeProvider(), ImmutableMap.of(), null);
    replacedertThat(info.getCreationLoc()).isEqualTo(Location.BUILTIN);
}

19 View Complete Implementation : PyRuntimeInfoTest.java
Copyright Apache License 2.0
Author : bazelbuild
@Test
public void factoryMethod_PlatformRuntime() {
    PathFragment path = PathFragment.create("/system/interpreter");
    PyRuntimeInfo platformRuntime = PyRuntimeInfo.createForPlatformRuntime(path, PythonVersion.PY2);
    replacedertThat(platformRuntime.getCreationLoc()).isEqualTo(Location.BUILTIN);
    replacedertThat(platformRuntime.getInterpreterPath()).isEqualTo(path);
    replacedertThat(platformRuntime.getInterpreterPathString()).isEqualTo("/system/interpreter");
    replacedertThat(platformRuntime.getInterpreter()).isNull();
    replacedertThat(platformRuntime.getFiles()).isNull();
    replacedertThat(platformRuntime.getFilesForStarlark()).isNull();
    replacedertThat(platformRuntime.getPythonVersion()).isEqualTo(PythonVersion.PY2);
    replacedertThat(platformRuntime.getPythonVersionForStarlark()).isEqualTo("PY2");
}

19 View Complete Implementation : ToolchainTypeInfo.java
Copyright Apache License 2.0
Author : bazelbuild
public static ToolchainTypeInfo create(Label typeLabel) {
    return create(typeLabel, Location.BUILTIN);
}

19 View Complete Implementation : SkylarkInfoTest.java
Copyright Apache License 2.0
Author : bazelbuild
/**
 * Creates an exported schemaless provider type with builtin location.
 */
private static SkylarkProvider makeExportedProvider() {
    SkylarkProvider.SkylarkKey key = new SkylarkProvider.SkylarkKey(Label.parseAbsoluteUnchecked("//package:target"), "provider");
    return SkylarkProvider.createExportedSchemaless(key, Location.BUILTIN);
}

19 View Complete Implementation : ConstraintSettingInfo.java
Copyright Apache License 2.0
Author : bazelbuild
/**
 * Returns a new {@link ConstraintSettingInfo} with the given data.
 */
public static ConstraintSettingInfo create(Label constraintSetting, Label defaultConstraintValue) {
    return create(constraintSetting, defaultConstraintValue, Location.BUILTIN);
}

19 View Complete Implementation : SkylarkInfoTest.java
Copyright Apache License 2.0
Author : bazelbuild
@Test
public void concatWithDifferentProvidersFails() throws Exception {
    SkylarkProvider provider1 = makeProvider();
    SkylarkProvider provider2 = makeProvider();
    SkylarkInfo info1 = makeInfoWithF1F2Values(provider1, 4, 5);
    SkylarkInfo info2 = makeInfoWithF1F2Values(provider2, 4, 5);
    EvalException expected = replacedertThrows(EvalException.clreplaced, () -> info1.getConcatter().concat(info1, info2, Location.BUILTIN));
    replacedertThat(expected).hasMessageThat().contains("Cannot use '+' operator on instances of different providers");
}

19 View Complete Implementation : ConstraintSettingInfo.java
Copyright Apache License 2.0
Author : bazelbuild
/**
 * Returns a new {@link ConstraintSettingInfo} with the given data.
 */
public static ConstraintSettingInfo create(Label constraintSetting) {
    return create(constraintSetting, null, Location.BUILTIN);
}

19 View Complete Implementation : RuleAnalysisLegacyBuildRuleViewTest.java
Copyright Apache License 2.0
Author : facebook
private static ProviderInfoCollection createProviderInfoCollection(ImmutableMap<String, ImmutableSet<Artifact>> namedOutputs, ImmutableSet<Artifact> defaultOutputs) throws EvalException {
    Mutability mutability = Mutability.create("test");
    Environment env = Environment.builder(mutability).setGlobals(BazelLibrary.GLOBALS).setSemantics(BuckStarlark.BUCK_STARLARK_SEMANTICS).build();
    SkylarkDict<String, Set<Artifact>> dict = SkylarkDict.of(env);
    for (Map.Entry<String, ImmutableSet<Artifact>> entry : namedOutputs.entrySet()) {
        dict.put(entry.getKey(), entry.getValue(), Location.BUILTIN, mutability);
    }
    return TestProviderInfoCollectionImpl.builder().put(new FakeInfo(new FakeBuiltInProvider("foo"))).build(new ImmutableDefaultInfo(dict, defaultOutputs));
}

19 View Complete Implementation : BuildArtifactFactory.java
Copyright Apache License 2.0
Author : facebook
/**
 * Validates that all {@link DeclaredArtifact}s have been bound to an {@link
 * ActionreplacedysisDataKey}
 */
protected void verifyAllArtifactsBound() {
    for (ArtifactImpl artifact : declaredArtifacts) {
        if (!artifact.isBound()) {
            if (artifact.getDeclaredLocation().equals(Location.BUILTIN)) {
                throw new HumanReadableException("Artifact %s declared by %s is not bound to an action", artifact.getOutputPath(), artifact.getBuildTarget().getFullyQualifiedName());
            } else {
                throw new HumanReadableException("Artifact %s declared by %s is not bound to an action. Originally declared at %s", artifact.getOutputPath(), artifact.getBuildTarget().getFullyQualifiedName(), artifact.getDeclaredLocation().print());
            }
        }
    }
}

19 View Complete Implementation : StructProvider.java
Copyright Apache License 2.0
Author : bazelbuild
// Called from SkylarkRepositoryContext. TODO(adonovan): eliminate.
public StructImpl createWithBuiltinLocation(Dict<String, Object> kwargs) throws EvalException {
    return create(kwargs, Location.BUILTIN);
}

19 View Complete Implementation : ConstraintValueInfo.java
Copyright Apache License 2.0
Author : bazelbuild
/**
 * Returns a new {@link ConstraintValueInfo} with the given data.
 */
public static ConstraintValueInfo create(ConstraintSettingInfo constraint, Label value) {
    return create(constraint, value, Location.BUILTIN);
}

19 View Complete Implementation : SkylarkInfoTest.java
Copyright Apache License 2.0
Author : bazelbuild
/**
 * Creates an instance of a provider with the given values for fields f1 and f2. Either field
 * value may be null, in which case it is omitted.
 */
private static SkylarkInfo makeInfoWithF1F2Values(SkylarkProvider provider, @Nullable Object v1, @Nullable Object v2) {
    ImmutableMap.Builder<String, Object> values = ImmutableMap.builder();
    if (v1 != null) {
        values.put("f1", v1);
    }
    if (v2 != null) {
        values.put("f2", v2);
    }
    return SkylarkInfo.create(provider, values.build(), Location.BUILTIN);
}

19 View Complete Implementation : OutputAttributeValidator.java
Copyright Apache License 2.0
Author : facebook
/**
 * Validates that a coerced value is a string, and registers it with {@code registry}
 *
 * @param coercedValue the value that came from {@link OutputAttribute#getValue(CellPathResolver,
 *     ProjectFilesystem, ForwardRelativePath, TargetConfiguration, TargetConfiguration, Object)}
 *     or {@link OutputListAttribute#getValue(CellPathResolver, ProjectFilesystem,
 *     ForwardRelativePath, TargetConfiguration, TargetConfiguration, Object)}
 * @param registry the registry to declare artifacts against
 * @return the declared artifact
 * @throws IllegalArgumentException if {@code coercedValue} is not a {@link String}
 */
static Artifact validateAndRegisterArtifact(Object coercedValue, ActionRegistry registry) {
    if (!(coercedValue instanceof String)) {
        throw new IllegalArgumentException(String.format("Value %s must be a String", coercedValue));
    }
    // TODO(pjameson): preplaced the location of the UDR invocation all the way down to the coercer
    return registry.declareArtifact((String) coercedValue, Location.BUILTIN);
}

18 View Complete Implementation : PyInfoTest.java
Copyright Apache License 2.0
Author : bazelbuild
/**
 * Checks the defaults set by the builder.
 */
@Test
public void builderDefaults() throws Exception {
    // transitive_sources is mandatory, so create a dummy value but no need to replacedert on it.
    NestedSet<Artifact> sources = NestedSetBuilder.create(Order.COMPILE_ORDER, dummyArtifact);
    PyInfo info = PyInfo.builder().setTransitiveSources(sources).build();
    replacedertThat(info.getCreationLoc()).isEqualTo(Location.BUILTIN);
    replacedertThat(info.getUsesSharedLibraries()).isFalse();
    replacedertHasOrderAndContainsExactly(info.getImports().getSet(String.clreplaced), Order.COMPILE_ORDER);
    replacedertThat(info.getHasPy2OnlySources()).isFalse();
    replacedertThat(info.getHasPy3OnlySources()).isFalse();
}

18 View Complete Implementation : PyRuntimeInfoTest.java
Copyright Apache License 2.0
Author : bazelbuild
@Test
public void factoryMethod_InBuildRuntime() throws Exception {
    NestedSet<Artifact> files = NestedSetBuilder.create(Order.STABLE_ORDER, dummyFile);
    PyRuntimeInfo inBuildRuntime = PyRuntimeInfo.createForInBuildRuntime(dummyInterpreter, files, PythonVersion.PY2);
    replacedertThat(inBuildRuntime.getCreationLoc()).isEqualTo(Location.BUILTIN);
    replacedertThat(inBuildRuntime.getInterpreterPath()).isNull();
    replacedertThat(inBuildRuntime.getInterpreterPathString()).isNull();
    replacedertThat(inBuildRuntime.getInterpreter()).isEqualTo(dummyInterpreter);
    replacedertThat(inBuildRuntime.getFiles()).isEqualTo(files);
    replacedertThat(inBuildRuntime.getFilesForStarlark().getSet(Artifact.clreplaced)).isEqualTo(files);
    replacedertThat(inBuildRuntime.getPythonVersion()).isEqualTo(PythonVersion.PY2);
    replacedertThat(inBuildRuntime.getPythonVersionForStarlark()).isEqualTo("PY2");
}

18 View Complete Implementation : SourceArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void cannotBeUsedreplacedkylarkOutputArtifact() throws EvalException {
    FakeProjectFilesystem filesystem = new FakeProjectFilesystem();
    SourceArtifactImpl artifact = ImmutableSourceArtifactImpl.of(PathSourcePath.of(filesystem, Paths.get("foo", "bar.cpp")));
    thrown.expect(EvalException.clreplaced);
    artifact.replacedkylarkOutputArtifact(Location.BUILTIN);
}

18 View Complete Implementation : LegacyProviderInfoCollectionImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void containsKeyThrowsWhenKeyNotProvider() throws EvalException {
    expectedException.expect(EvalException.clreplaced);
    ProviderInfoCollection providerInfoCollection = LegacyProviderInfoCollectionImpl.of();
    providerInfoCollection.containsKey(new Object(), Location.BUILTIN, ctx);
}

18 View Complete Implementation : LegacyProviderInfoCollectionImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void getIndexThrowsWhenKeyNotProvider() throws EvalException {
    expectedException.expect(EvalException.clreplaced);
    ProviderInfoCollection providerInfoCollection = LegacyProviderInfoCollectionImpl.of();
    providerInfoCollection.getIndex(new Object(), Location.BUILTIN, ctx);
}

18 View Complete Implementation : LegacyProviderInfoCollectionImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void getProviderReturnsNothing() throws EvalException {
    Provider<FakeInfo> provider = new FakeBuiltInProvider("fake");
    ProviderInfoCollection providerInfoCollection = LegacyProviderInfoCollectionImpl.of();
    replacedertEquals(Optional.empty(), providerInfoCollection.get(provider));
    replacedertEquals(Runtime.NONE, providerInfoCollection.getIndex(provider, Location.BUILTIN, ctx));
}

17 View Complete Implementation : ActionsProvider.java
Copyright Apache License 2.0
Author : bazelbuild
/**
 * Factory method for creating instances of the Actions provider.
 */
public static StructImpl create(Iterable<ActionreplacedysisMetadata> actions) {
    Map<Artifact, ActionreplacedysisMetadata> map = new HashMap<>();
    for (ActionreplacedysisMetadata action : actions) {
        for (Artifact artifact : action.getOutputs()) {
            // In the case that two actions generated the same artifact, the first wins. They
            // ought to be equal anyway.
            map.putIfAbsent(artifact, action);
        }
    }
    ImmutableMap<String, Object> fields = ImmutableMap.<String, Object>of("by_file", Starlark.fromJava(map, /*mutability=*/
    null));
    return SkylarkInfo.create(INSTANCE, fields, Location.BUILTIN);
}

17 View Complete Implementation : SkylarkRuleContextArgsTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void addAddsArg() throws EvalException, LabelSyntaxException {
    CommandLineArgs args = new CommandLineArgsBuilder().add(1, Runtime.UNBOUND, CommandLineArgs.DEFAULT_FORMAT_STRING, Location.BUILTIN).add("--foo", Label.parseAbsolute("//foo:bar", ImmutableMap.of()), CommandLineArgs.DEFAULT_FORMAT_STRING, Location.BUILTIN).build();
    ImmutableList<String> stringified = new ExecCompatibleCommandLineBuilder(new ArtifactFilesystem(new FakeProjectFilesystem())).build(args).getCommandLineArgs();
    replacedertEquals(ImmutableList.of("1", "--foo", "//foo:bar"), stringified);
}

17 View Complete Implementation : SkylarkUserDefinedRuleTest.java
Copyright Apache License 2.0
Author : facebook
/**
 * Create a dummy AST so that we can preplaced a non-null ast into call(). This is only really used in
 * logging during an error case that is not encountered in the wild, so just go with the easiest
 * ast to construct
 */
private FuncallExpression getJunkAst() {
    FuncallExpression ast = new FuncallExpression(Identifier.of("junk"), ImmutableList.of());
    ast.setLocation(Location.BUILTIN);
    return ast;
}

16 View Complete Implementation : ArtifactFilesystemTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void writeContents() throws IOException {
    ArtifactFilesystem artifactFilesystem = new ArtifactFilesystem(filesystem);
    BuildArtifact artifact = artifactFactory.createBuildArtifact(Paths.get("bar"), Location.BUILTIN);
    artifactFilesystem.writeContentsToPath("foobar", artifact);
    replacedertEquals("foobar", Iterables.getOnlyElement(filesystem.readLines(artifact.getSourcePath().getResolvedPath())));
}

16 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void differentPathsAreNotEqual() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    ArtifactImpl artifact1 = ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path1"), Location.BUILTIN);
    ArtifactImpl artifact2 = ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path2"), Location.BUILTIN);
    replacedertNotEquals(artifact1, artifact2);
}

16 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void normalizesPaths() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path genDir = Paths.get("buck-out/gen");
    Path packagePath = Paths.get("my/foo__");
    DeclaredArtifact artifact = ArtifactImpl.of(target, genDir, packagePath, Paths.get("bar/baz/.././blargl.sh"), Location.BUILTIN);
    replacedertEquals(Paths.get("my", "foo__", "bar", "blargl.sh").toString(), artifact.getShortPath());
}

16 View Complete Implementation : ProviderInfoCollectionImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void getIndexThrowsWhenKeyNotProvider() throws EvalException {
    expectedException.expect(EvalException.clreplaced);
    ProviderInfoCollection providerInfoCollection = ProviderInfoCollectionImpl.builder().build(DEFAULT_INFO);
    providerInfoCollection.getIndex(new Object(), Location.BUILTIN, ctx);
}

16 View Complete Implementation : RunInfoTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void handlesCommandLineArgs() throws EvalException {
    CommandLineArgs args = new CommandLineArgsBuilder().add("foo", Runtime.UNBOUND, CommandLineArgs.DEFAULT_FORMAT_STRING, Location.BUILTIN).add("bar", Runtime.UNBOUND, CommandLineArgs.DEFAULT_FORMAT_STRING, Location.BUILTIN).build();
    RunInfo runInfo = RunInfo.instantiateFromSkylark(SkylarkDict.empty(), args);
    CommandLine cli = new ExecCompatibleCommandLineBuilder(new ArtifactFilesystem(new FakeProjectFilesystem())).build(runInfo.args());
    replacedertEquals(ImmutableList.of("foo", "bar"), cli.getCommandLineArgs());
}

16 View Complete Implementation : SkylarkRuleContextArgsTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void addAllAddsArgs() throws EvalException, LabelSyntaxException {
    CommandLineArgs args = new CommandLineArgsBuilder().addAll(SkylarkList.createImmutable(ImmutableList.of(1, "--foo", Label.parseAbsolute("//foo:bar", ImmutableMap.of()))), CommandLineArgs.DEFAULT_FORMAT_STRING, Location.BUILTIN).build();
    ImmutableList<String> stringified = new ExecCompatibleCommandLineBuilder(new ArtifactFilesystem(new FakeProjectFilesystem())).build(args).getCommandLineArgs();
    replacedertEquals(ImmutableList.of("1", "--foo", "//foo:bar"), stringified);
}

15 View Complete Implementation : BuildTypeTest.java
Copyright Apache License 2.0
Author : bazelbuild
@Test
public void testSelectorList_concatenate_invalidType() throws Exception {
    List<String> list = ImmutableList.of("//a:a", "//b:b");
    // Creating a SelectorList from a list and a non-list should fail.
    replacedertThrows(EvalException.clreplaced, () -> SelectorList.of(Location.BUILTIN, list, "A string"));
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void skylarkFunctionsWork() throws LabelSyntaxException {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    ArtifactImpl artifact = ArtifactImpl.of(target, genDir, packagePath, Paths.get("bar/baz.cpp"), Location.BUILTIN);
    String expectedShortPath = Paths.get("my", "foo__", "bar", "baz.cpp").toString();
    replacedertEquals("baz.cpp", artifact.getBasename());
    replacedertEquals("cpp", artifact.getExtension());
    replacedertEquals(Label.parseAbsolute("//my:foo", ImmutableMap.of()), artifact.getOwner());
    replacedertEquals(expectedShortPath, artifact.getShortPath());
    replacedertFalse(artifact.isSource());
    replacedertEquals(String.format("<generated file '%s'>", expectedShortPath), Printer.repr(artifact));
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void rejectsEmptyPathAfterPathTraversal() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    expectedException.expect(ArtifactDeclarationException.clreplaced);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("foo/.."), Location.BUILTIN);
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void rejectsPrefixedDotPath() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    expectedException.expect(ArtifactDeclarationException.clreplaced);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("./foo/.."), Location.BUILTIN);
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void rejectsAbsolutePath() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    expectedException.expect(ArtifactDeclarationException.clreplaced);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("").toAbsolutePath(), Location.BUILTIN);
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void isImmutable() throws EvalException {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    Path path = Paths.get("bar");
    ArtifactImpl artifact = ArtifactImpl.of(target, genDir, packagePath, path, Location.BUILTIN);
    replacedertFalse(artifact.isBound());
    replacedertTrue(artifact.isImmutable());
    replacedertTrue(artifact.replacedkylarkOutputArtifact(Location.BUILTIN).isImmutable());
    ImmutableActionreplacedysisDataKey key = ImmutableActionreplacedysisDataKey.of(target, new ActionreplacedysisData.ID("a"));
    BuildArtifact materialized = artifact.materialize(key);
    replacedertTrue(materialized.isBound());
    replacedertTrue(artifact.isImmutable());
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void rejectsUpwardPathTraversal() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    expectedException.expect(ArtifactDeclarationException.clreplaced);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("foo/../../bar"), Location.BUILTIN);
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void differentActionKeysAreNotEqual() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    ArtifactImpl artifact1 = ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), Location.BUILTIN);
    ArtifactImpl artifact2 = ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), Location.BUILTIN);
    ImmutableActionreplacedysisDataKey key1 = ImmutableActionreplacedysisDataKey.of(target, new ActionreplacedysisData.ID("a"));
    ImmutableActionreplacedysisDataKey key2 = ImmutableActionreplacedysisDataKey.of(target, new ActionreplacedysisData.ID("a"));
    artifact1 = (ArtifactImpl) artifact1.materialize(key1);
    artifact2 = (ArtifactImpl) artifact2.materialize(key2);
    replacedertNotEquals(artifact1, artifact2);
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void rejectsDotPath() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    expectedException.expect(ArtifactDeclarationException.clreplaced);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("."), Location.BUILTIN);
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void rejectsSuffixedUpwardPathTraversal() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path genDir = Paths.get("buck-out/gen");
    Path packagePath = Paths.get("my/foo__");
    expectedException.expect(ArtifactDeclarationException.clreplaced);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("foo/../.."), Location.BUILTIN);
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void rejectsEmptyPath() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    expectedException.expect(ArtifactDeclarationException.clreplaced);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get(""), Location.BUILTIN);
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void rejectsPrefixedUpwardPathTraversal() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path genDir = Paths.get("buck-out/gen");
    Path packagePath = Paths.get("my/foo__");
    expectedException.expect(ArtifactDeclarationException.clreplaced);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("../bar"), Location.BUILTIN);
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void rejectsSuffixedDotPath() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    expectedException.expect(ArtifactDeclarationException.clreplaced);
    ArtifactImpl.of(target, genDir, packagePath, Paths.get("foo/../."), Location.BUILTIN);
}

15 View Complete Implementation : ArtifactImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void equalsArtifactHasEqualsTrueAndSameHashCode() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    Path packagePath = Paths.get("my/foo__");
    ArtifactImpl artifact1 = ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), Location.BUILTIN);
    ArtifactImpl artifact2 = ArtifactImpl.of(target, genDir, packagePath, Paths.get("some/path"), Location.BUILTIN);
    replacedertEquals(artifact1, artifact2);
    replacedertEquals(artifact1.hashCode(), artifact2.hashCode());
    ImmutableActionreplacedysisDataKey key = ImmutableActionreplacedysisDataKey.of(target, new ActionreplacedysisData.ID("a"));
    artifact1 = (ArtifactImpl) artifact1.materialize(key);
    artifact2 = (ArtifactImpl) artifact2.materialize(key);
    replacedertEquals(artifact1, artifact2);
    replacedertEquals(artifact1.hashCode(), artifact2.hashCode());
}

15 View Complete Implementation : ArtifactTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void sortStable() {
    BuildTarget target = BuildTargetFactory.newInstance("//test:foo");
    FakeProjectFilesystem filesystem = new FakeProjectFilesystem();
    BuildArtifactFactoryForTests artifactFactory = new BuildArtifactFactoryForTests(target, filesystem);
    Artifact artifact1 = artifactFactory.createDeclaredArtifact(Paths.get("path1"), Location.BUILTIN);
    Artifact artifact2 = artifactFactory.createDeclaredArtifact(Paths.get("path2"), Location.BUILTIN);
    Artifact artifact3 = artifactFactory.createBuildArtifact(Paths.get("path3"), Location.BUILTIN);
    Artifact artifact4 = artifactFactory.createBuildArtifact(Paths.get("path4"), Location.BUILTIN);
    Artifact artifact5 = ImmutableSourceArtifactImpl.of(PathSourcePath.of(filesystem, Paths.get("path5")));
    ImmutableSortedSet.Builder<Artifact> artifacts1 = ImmutableSortedSet.naturalOrder();
    artifacts1.add(artifact1);
    artifacts1.add(artifact2);
    artifacts1.add(artifact3);
    artifacts1.add(artifact4);
    artifacts1.add(artifact5);
    ImmutableSortedSet.Builder<Artifact> artifacts2 = ImmutableSortedSet.naturalOrder();
    artifacts2.add(artifact4);
    artifacts2.add(artifact1);
    artifacts2.add(artifact3);
    artifacts2.add(artifact5);
    artifacts2.add(artifact2);
    ImmutableSortedSet<Artifact> artifactsResult1 = artifacts1.build();
    ImmutableSortedSet<Artifact> artifactsResult2 = artifacts2.build();
    replacedertEquals(artifactsResult1, artifactsResult2);
    replacedertEquals(5, artifactsResult1.size());
}

15 View Complete Implementation : BuildArtifactFactoryTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void multipleOfDifferentDeclaredArtifactDoesNotThrows() {
    BuildTarget target = BuildTargetFactory.newInstance("//my:foo");
    ProjectFilesystem filesystem = new FakeProjectFilesystem();
    BuildArtifactFactory factory = new BuildArtifactFactory(target, filesystem);
    factory.createDeclaredArtifact(Paths.get("path1"), Location.BUILTIN);
    factory.createDeclaredArtifact(Paths.get("path2"), Location.BUILTIN);
}

15 View Complete Implementation : ProviderInfoCollectionImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void getProviderWhenPresentReturnsInfo() throws EvalException {
    ProviderInfoCollection providerInfoCollection = ProviderInfoCollectionImpl.builder().build(DEFAULT_INFO);
    replacedertTrue(providerInfoCollection.containsKey(DEFAULT_INFO.getProvider(), Location.BUILTIN, ctx));
    replacedertEquals(Optional.of(DEFAULT_INFO), providerInfoCollection.get(DEFAULT_INFO.getProvider()));
    replacedertSame(DEFAULT_INFO, providerInfoCollection.getIndex(DEFAULT_INFO.getProvider(), Location.BUILTIN, ctx));
}

15 View Complete Implementation : ProviderInfoCollectionImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void containsKeyThrowsWhenKeyNotProvider() throws EvalException {
    expectedException.expect(EvalException.clreplaced);
    ProviderInfoCollection providerInfoCollection = ProviderInfoCollectionImpl.builder().build(DEFAULT_INFO);
    providerInfoCollection.containsKey(new Object(), Location.BUILTIN, ctx);
}

15 View Complete Implementation : ProviderInfoCollectionImplTest.java
Copyright Apache License 2.0
Author : facebook
@Test
public void getProviderWhenNotPresentReturnsEmpty() throws EvalException {
    Provider<?> provider = new FakeBuiltInProvider("fake");
    ProviderInfoCollection providerInfoCollection = ProviderInfoCollectionImpl.builder().build(DEFAULT_INFO);
    replacedertFalse(providerInfoCollection.containsKey(provider, Location.BUILTIN, ctx));
    replacedertEquals(Optional.empty(), providerInfoCollection.get(provider));
}