use of com.facebook.buck.rules.DefaultBuildTargetSourcePath in project buck by facebook.
the class PrebuiltJarSymbolsFinderTest method createFinderForGeneratedJar.
private PrebuiltJarSymbolsFinder createFinderForGeneratedJar(String target) {
BuildTarget buildTarget = BuildTargetFactory.newInstance(target);
SourcePath sourcePath = new DefaultBuildTargetSourcePath(buildTarget);
return new PrebuiltJarSymbolsFinder(sourcePath);
}
use of com.facebook.buck.rules.DefaultBuildTargetSourcePath in project buck by facebook.
the class PythonBinaryDescriptionTest method thatComponentSourcePathDepsPropagateProperly.
@Test
public void thatComponentSourcePathDepsPropagateProperly() throws Exception {
GenruleBuilder genruleBuilder = GenruleBuilder.newGenruleBuilder(BuildTargetFactory.newInstance("//:gen")).setOut("blah.py");
PythonLibraryBuilder libBuilder = new PythonLibraryBuilder(BuildTargetFactory.newInstance("//:lib")).setSrcs(SourceList.ofUnnamedSources(ImmutableSortedSet.of(new DefaultBuildTargetSourcePath(genruleBuilder.getTarget()))));
PythonBinaryBuilder binaryBuilder = PythonBinaryBuilder.create(BuildTargetFactory.newInstance("//:bin")).setMainModule("main").setDeps(ImmutableSortedSet.of(libBuilder.getTarget()));
TargetGraph targetGraph = TargetGraphFactory.newInstance(genruleBuilder.build(), libBuilder.build(), binaryBuilder.build());
ProjectFilesystem filesystem = new FakeProjectFilesystem();
BuildRuleResolver resolver = new BuildRuleResolver(targetGraph, new DefaultTargetNodeToBuildRuleTransformer());
Genrule genrule = genruleBuilder.build(resolver, filesystem, targetGraph);
libBuilder.build(resolver, filesystem, targetGraph);
PythonBinary binary = binaryBuilder.build(resolver, filesystem, targetGraph);
assertThat(binary.getDeps(), Matchers.hasItem(genrule));
}
use of com.facebook.buck.rules.DefaultBuildTargetSourcePath in project buck by facebook.
the class AbstractRuleKeyHasherTest method testUniqueness.
@Test
public void testUniqueness() {
List<HASH> hashes = new ArrayList<>();
hashes.add(newHasher().hash());
hashes.add(newHasher().putKey("").hash());
hashes.add(newHasher().putKey("42").hash());
hashes.add(newHasher().putKey("4").putKey("2").hash());
hashes.add(newHasher().putNull().hash());
hashes.add(newHasher().putBoolean(true).hash());
hashes.add(newHasher().putBoolean(false).hash());
for (Number number : getNumbersForUniquenessTest()) {
hashes.add(newHasher().putNumber(number).hash());
}
hashes.add(newHasher().putString("").hash());
hashes.add(newHasher().putString("42").hash());
hashes.add(newHasher().putString("4").putString("2").hash());
hashes.add(newHasher().putBytes(new byte[0]).hash());
hashes.add(newHasher().putBytes(new byte[] { 42 }).hash());
hashes.add(newHasher().putBytes(new byte[] { 42, 42 }).hash());
hashes.add(newHasher().putPattern(Pattern.compile("")).hash());
hashes.add(newHasher().putPattern(Pattern.compile("42")).hash());
hashes.add(newHasher().putPattern(Pattern.compile("4")).putPattern(Pattern.compile("2")).hash());
hashes.add(newHasher().putSha1(Sha1HashCode.of("a002b39af204cdfaa5fdb67816b13867c32ac52c")).hash());
hashes.add(newHasher().putSha1(Sha1HashCode.of("b67816b13867c32ac52ca002b39af204cdfaa5fd")).hash());
hashes.add(newHasher().putPath(Paths.get(""), HashCode.fromInt(0)).hash());
hashes.add(newHasher().putPath(Paths.get(""), HashCode.fromInt(42)).hash());
hashes.add(newHasher().putPath(Paths.get("42"), HashCode.fromInt(0)).hash());
hashes.add(newHasher().putPath(Paths.get("42"), HashCode.fromInt(42)).hash());
hashes.add(newHasher().putPath(Paths.get("42/42"), HashCode.fromInt(42)).hash());
hashes.add(newHasher().putArchiveMemberPath(newArchiveMember("", ""), HashCode.fromInt(0)).hash());
hashes.add(newHasher().putArchiveMemberPath(newArchiveMember("", ""), HashCode.fromInt(42)).hash());
hashes.add(newHasher().putArchiveMemberPath(newArchiveMember("42", "42"), HashCode.fromInt(0)).hash());
hashes.add(newHasher().putArchiveMemberPath(newArchiveMember("42", "42"), HashCode.fromInt(42)).hash());
hashes.add(newHasher().putArchiveMemberPath(newArchiveMember("42/42", "42/42"), HashCode.fromInt(42)).hash());
hashes.add(newHasher().putNonHashingPath("").hash());
hashes.add(newHasher().putNonHashingPath("42").hash());
hashes.add(newHasher().putNonHashingPath("4").putNonHashingPath("2").hash());
hashes.add(newHasher().putSourceRoot(new SourceRoot("")).hash());
hashes.add(newHasher().putSourceRoot(new SourceRoot("42")).hash());
hashes.add(newHasher().putSourceRoot(new SourceRoot("4")).putSourceRoot(new SourceRoot("2")).hash());
hashes.add(newHasher().putRuleKey(RULE_KEY_1).hash());
hashes.add(newHasher().putRuleKey(RULE_KEY_2).hash());
hashes.add(newHasher().putBuildRuleType(BuildRuleType.of("")).hash());
hashes.add(newHasher().putBuildRuleType(BuildRuleType.of("42")).hash());
hashes.add(newHasher().putBuildRuleType(BuildRuleType.of("4")).putBuildRuleType(BuildRuleType.of("2")).hash());
hashes.add(newHasher().putBuildTarget(TARGET_1).hash());
hashes.add(newHasher().putBuildTarget(TARGET_2).hash());
hashes.add(newHasher().putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_1)).hash());
hashes.add(newHasher().putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_2)).hash());
hashes.add(newHasher().putContainer(RuleKeyHasher.Container.LIST, 0).hash());
hashes.add(newHasher().putContainer(RuleKeyHasher.Container.LIST, 42).hash());
hashes.add(newHasher().putContainer(RuleKeyHasher.Container.MAP, 0).hash());
hashes.add(newHasher().putContainer(RuleKeyHasher.Container.MAP, 42).hash());
hashes.add(newHasher().putWrapper(RuleKeyHasher.Wrapper.SUPPLIER).hash());
hashes.add(newHasher().putWrapper(RuleKeyHasher.Wrapper.OPTIONAL).hash());
hashes.add(newHasher().putWrapper(RuleKeyHasher.Wrapper.EITHER_LEFT).hash());
hashes.add(newHasher().putWrapper(RuleKeyHasher.Wrapper.EITHER_RIGHT).hash());
hashes.add(newHasher().putWrapper(RuleKeyHasher.Wrapper.BUILD_RULE).hash());
hashes.add(newHasher().putWrapper(RuleKeyHasher.Wrapper.APPENDABLE).hash());
// all of the hashes should be different
for (int i = 0; i < hashes.size(); i++) {
for (int j = 0; j < i; j++) {
assertNotEquals(String.format("Collision [%d] = [%d]", i, j), hashes.get(i), hashes.get(j));
}
}
}
use of com.facebook.buck.rules.DefaultBuildTargetSourcePath in project buck by facebook.
the class CountingRuleKeyHasherTest method testForwarding.
@Test
public void testForwarding() {
assertEquals(newGuavaHasher().hash(), newCountHasher().hash());
assertEquals(newGuavaHasher().putKey("").hash(), newCountHasher().putKey("").hash());
assertEquals(newGuavaHasher().putKey("42").hash(), newCountHasher().putKey("42").hash());
assertEquals(newGuavaHasher().putKey("4").putKey("2").hash(), newCountHasher().putKey("4").putKey("2").hash());
assertEquals(newGuavaHasher().putNull().hash(), newCountHasher().putNull().hash());
assertEquals(newGuavaHasher().putBoolean(true).hash(), newCountHasher().putBoolean(true).hash());
assertEquals(newGuavaHasher().putBoolean(false).hash(), newCountHasher().putBoolean(false).hash());
assertEquals(newGuavaHasher().putNumber(0).hash(), newCountHasher().putNumber(0).hash());
assertEquals(newGuavaHasher().putNumber(42).hash(), newCountHasher().putNumber(42).hash());
assertEquals(newGuavaHasher().putNumber((long) 0).hash(), newCountHasher().putNumber((long) 0).hash());
assertEquals(newGuavaHasher().putNumber((long) 42).hash(), newCountHasher().putNumber((long) 42).hash());
assertEquals(newGuavaHasher().putNumber((short) 0).hash(), newCountHasher().putNumber((short) 0).hash());
assertEquals(newGuavaHasher().putNumber((short) 42).hash(), newCountHasher().putNumber((short) 42).hash());
assertEquals(newGuavaHasher().putNumber((byte) 0).hash(), newCountHasher().putNumber((byte) 0).hash());
assertEquals(newGuavaHasher().putNumber((byte) 42).hash(), newCountHasher().putNumber((byte) 42).hash());
assertEquals(newGuavaHasher().putNumber((float) 0).hash(), newCountHasher().putNumber((float) 0).hash());
assertEquals(newGuavaHasher().putNumber((float) 42).hash(), newCountHasher().putNumber((float) 42).hash());
assertEquals(newGuavaHasher().putNumber((double) 0).hash(), newCountHasher().putNumber((double) 0).hash());
assertEquals(newGuavaHasher().putNumber((double) 42).hash(), newCountHasher().putNumber((double) 42).hash());
assertEquals(newGuavaHasher().putString("").hash(), newCountHasher().putString("").hash());
assertEquals(newGuavaHasher().putString("42").hash(), newCountHasher().putString("42").hash());
assertEquals(newGuavaHasher().putString("4").putString("2").hash(), newCountHasher().putString("4").putString("2").hash());
assertEquals(newGuavaHasher().putBytes(new byte[0]).hash(), newCountHasher().putBytes(new byte[0]).hash());
assertEquals(newGuavaHasher().putBytes(new byte[] { 42 }).hash(), newCountHasher().putBytes(new byte[] { 42 }).hash());
assertEquals(newGuavaHasher().putBytes(new byte[] { 42, 42 }).hash(), newCountHasher().putBytes(new byte[] { 42, 42 }).hash());
assertEquals(newGuavaHasher().putPattern(Pattern.compile("")).hash(), newCountHasher().putPattern(Pattern.compile("")).hash());
assertEquals(newGuavaHasher().putPattern(Pattern.compile("42")).hash(), newCountHasher().putPattern(Pattern.compile("42")).hash());
assertEquals(newGuavaHasher().putPattern(Pattern.compile("4")).putPattern(Pattern.compile("2")).hash(), newCountHasher().putPattern(Pattern.compile("4")).putPattern(Pattern.compile("2")).hash());
assertEquals(newGuavaHasher().putSha1(Sha1HashCode.of("a002b39af204cdfaa5fdb67816b13867c32ac52c")).hash(), newCountHasher().putSha1(Sha1HashCode.of("a002b39af204cdfaa5fdb67816b13867c32ac52c")).hash());
assertEquals(newGuavaHasher().putSha1(Sha1HashCode.of("b67816b13867c32ac52ca002b39af204cdfaa5fd")).hash(), newCountHasher().putSha1(Sha1HashCode.of("b67816b13867c32ac52ca002b39af204cdfaa5fd")).hash());
assertEquals(newGuavaHasher().putPath(Paths.get(""), HashCode.fromInt(0)).hash(), newCountHasher().putPath(Paths.get(""), HashCode.fromInt(0)).hash());
assertEquals(newGuavaHasher().putPath(Paths.get(""), HashCode.fromInt(42)).hash(), newCountHasher().putPath(Paths.get(""), HashCode.fromInt(42)).hash());
assertEquals(newGuavaHasher().putPath(Paths.get("42"), HashCode.fromInt(0)).hash(), newCountHasher().putPath(Paths.get("42"), HashCode.fromInt(0)).hash());
assertEquals(newGuavaHasher().putPath(Paths.get("42"), HashCode.fromInt(42)).hash(), newCountHasher().putPath(Paths.get("42"), HashCode.fromInt(42)).hash());
assertEquals(newGuavaHasher().putPath(Paths.get("42/42"), HashCode.fromInt(42)).hash(), newCountHasher().putPath(Paths.get("42/42"), HashCode.fromInt(42)).hash());
assertEquals(newGuavaHasher().putArchiveMemberPath(newArchiveMember("", ""), HashCode.fromInt(0)).hash(), newCountHasher().putArchiveMemberPath(newArchiveMember("", ""), HashCode.fromInt(0)).hash());
assertEquals(newGuavaHasher().putArchiveMemberPath(newArchiveMember("", ""), HashCode.fromInt(42)).hash(), newCountHasher().putArchiveMemberPath(newArchiveMember("", ""), HashCode.fromInt(42)).hash());
assertEquals(newGuavaHasher().putArchiveMemberPath(newArchiveMember("42", "42"), HashCode.fromInt(0)).hash(), newCountHasher().putArchiveMemberPath(newArchiveMember("42", "42"), HashCode.fromInt(0)).hash());
assertEquals(newGuavaHasher().putArchiveMemberPath(newArchiveMember("42", "42"), HashCode.fromInt(42)).hash(), newCountHasher().putArchiveMemberPath(newArchiveMember("42", "42"), HashCode.fromInt(42)).hash());
assertEquals(newGuavaHasher().putArchiveMemberPath(newArchiveMember("42/42", "42/42"), HashCode.fromInt(42)).hash(), newCountHasher().putArchiveMemberPath(newArchiveMember("42/42", "42/42"), HashCode.fromInt(42)).hash());
assertEquals(newGuavaHasher().putNonHashingPath("").hash(), newCountHasher().putNonHashingPath("").hash());
assertEquals(newGuavaHasher().putNonHashingPath("42").hash(), newCountHasher().putNonHashingPath("42").hash());
assertEquals(newGuavaHasher().putNonHashingPath("4").putNonHashingPath("2").hash(), newCountHasher().putNonHashingPath("4").putNonHashingPath("2").hash());
assertEquals(newGuavaHasher().putSourceRoot(new SourceRoot("")).hash(), newCountHasher().putSourceRoot(new SourceRoot("")).hash());
assertEquals(newGuavaHasher().putSourceRoot(new SourceRoot("42")).hash(), newCountHasher().putSourceRoot(new SourceRoot("42")).hash());
assertEquals(newGuavaHasher().putSourceRoot(new SourceRoot("4")).putSourceRoot(new SourceRoot("2")).hash(), newCountHasher().putSourceRoot(new SourceRoot("4")).putSourceRoot(new SourceRoot("2")).hash());
assertEquals(newGuavaHasher().putRuleKey(RULE_KEY_1).hash(), newCountHasher().putRuleKey(RULE_KEY_1).hash());
assertEquals(newGuavaHasher().putRuleKey(RULE_KEY_2).hash(), newCountHasher().putRuleKey(RULE_KEY_2).hash());
assertEquals(newGuavaHasher().putBuildRuleType(BuildRuleType.of("")).hash(), newCountHasher().putBuildRuleType(BuildRuleType.of("")).hash());
assertEquals(newGuavaHasher().putBuildRuleType(BuildRuleType.of("42")).hash(), newCountHasher().putBuildRuleType(BuildRuleType.of("42")).hash());
assertEquals(newGuavaHasher().putBuildRuleType(BuildRuleType.of("4")).putBuildRuleType(BuildRuleType.of("2")).hash(), newCountHasher().putBuildRuleType(BuildRuleType.of("4")).putBuildRuleType(BuildRuleType.of("2")).hash());
assertEquals(newGuavaHasher().putBuildTarget(TARGET_1).hash(), newCountHasher().putBuildTarget(TARGET_1).hash());
assertEquals(newGuavaHasher().putBuildTarget(TARGET_2).hash(), newCountHasher().putBuildTarget(TARGET_2).hash());
assertEquals(newGuavaHasher().putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_1)).hash(), newCountHasher().putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_1)).hash());
assertEquals(newGuavaHasher().putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_2)).hash(), newCountHasher().putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_2)).hash());
assertEquals(newGuavaHasher().putContainer(RuleKeyHasher.Container.LIST, 0).hash(), newCountHasher().putContainer(RuleKeyHasher.Container.LIST, 0).hash());
assertEquals(newGuavaHasher().putContainer(RuleKeyHasher.Container.LIST, 42).hash(), newCountHasher().putContainer(RuleKeyHasher.Container.LIST, 42).hash());
assertEquals(newGuavaHasher().putContainer(RuleKeyHasher.Container.MAP, 0).hash(), newCountHasher().putContainer(RuleKeyHasher.Container.MAP, 0).hash());
assertEquals(newGuavaHasher().putContainer(RuleKeyHasher.Container.MAP, 42).hash(), newCountHasher().putContainer(RuleKeyHasher.Container.MAP, 42).hash());
assertEquals(newGuavaHasher().putWrapper(RuleKeyHasher.Wrapper.SUPPLIER).hash(), newCountHasher().putWrapper(RuleKeyHasher.Wrapper.SUPPLIER).hash());
assertEquals(newGuavaHasher().putWrapper(RuleKeyHasher.Wrapper.OPTIONAL).hash(), newCountHasher().putWrapper(RuleKeyHasher.Wrapper.OPTIONAL).hash());
assertEquals(newGuavaHasher().putWrapper(RuleKeyHasher.Wrapper.EITHER_LEFT).hash(), newCountHasher().putWrapper(RuleKeyHasher.Wrapper.EITHER_LEFT).hash());
assertEquals(newGuavaHasher().putWrapper(RuleKeyHasher.Wrapper.EITHER_RIGHT).hash(), newCountHasher().putWrapper(RuleKeyHasher.Wrapper.EITHER_RIGHT).hash());
assertEquals(newGuavaHasher().putWrapper(RuleKeyHasher.Wrapper.BUILD_RULE).hash(), newCountHasher().putWrapper(RuleKeyHasher.Wrapper.BUILD_RULE).hash());
assertEquals(newGuavaHasher().putWrapper(RuleKeyHasher.Wrapper.APPENDABLE).hash(), newCountHasher().putWrapper(RuleKeyHasher.Wrapper.APPENDABLE).hash());
}
use of com.facebook.buck.rules.DefaultBuildTargetSourcePath in project buck by facebook.
the class ForwardingRuleKeyHasherTest method testForwarding.
@Test
public void testForwarding() {
String string = "hash";
HashCode hash = createMock(HashCode.class);
@SuppressWarnings("unchecked") RuleKeyHasher<String> stringHasher = createStrictMock(RuleKeyHasher.class);
@SuppressWarnings("unchecked") RuleKeyHasher<HashCode> guavaHasher = createStrictMock(RuleKeyHasher.class);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putKey("42")).andReturn(guavaHasher);
expect(stringHasher.putKey("42")).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putNull()).andReturn(guavaHasher);
expect(stringHasher.putNull()).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putBoolean(true)).andReturn(guavaHasher);
expect(stringHasher.putBoolean(true)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putBoolean(false)).andReturn(guavaHasher);
expect(stringHasher.putBoolean(false)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putNumber(42)).andReturn(guavaHasher);
expect(stringHasher.putNumber(42)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putNumber((long) 42)).andReturn(guavaHasher);
expect(stringHasher.putNumber((long) 42)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putNumber((short) 42)).andReturn(guavaHasher);
expect(stringHasher.putNumber((short) 42)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putNumber((byte) 42)).andReturn(guavaHasher);
expect(stringHasher.putNumber((byte) 42)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putNumber((float) 42)).andReturn(guavaHasher);
expect(stringHasher.putNumber((float) 42)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putNumber((double) 42)).andReturn(guavaHasher);
expect(stringHasher.putNumber((double) 42)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putString("42")).andReturn(guavaHasher);
expect(stringHasher.putString("42")).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putBytes(BYTE_ARRAY)).andReturn(guavaHasher);
expect(stringHasher.putBytes(BYTE_ARRAY)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putPattern(PATTERN)).andReturn(guavaHasher);
expect(stringHasher.putPattern(PATTERN)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putSha1(Sha1HashCode.of("a002b39af204cdfaa5fdb67816b13867c32ac52c"))).andReturn(guavaHasher);
expect(stringHasher.putSha1(Sha1HashCode.of("a002b39af204cdfaa5fdb67816b13867c32ac52c"))).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putPath(Paths.get("42/42"), HashCode.fromInt(42))).andReturn(guavaHasher);
expect(stringHasher.putPath(Paths.get("42/42"), HashCode.fromInt(42))).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putArchiveMemberPath(newArchiveMember("42/42", "42/42"), HashCode.fromInt(42))).andReturn(guavaHasher);
expect(stringHasher.putArchiveMemberPath(newArchiveMember("42/42", "42/42"), HashCode.fromInt(42))).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putNonHashingPath("42")).andReturn(guavaHasher);
expect(stringHasher.putNonHashingPath("42")).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putSourceRoot(SOURCE_ROOT)).andReturn(guavaHasher);
expect(stringHasher.putSourceRoot(SOURCE_ROOT)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putRuleKey(RULE_KEY_1)).andReturn(guavaHasher);
expect(stringHasher.putRuleKey(RULE_KEY_1)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putBuildRuleType(BuildRuleType.of("42"))).andReturn(guavaHasher);
expect(stringHasher.putBuildRuleType(BuildRuleType.of("42"))).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putBuildTarget(TARGET_1)).andReturn(guavaHasher);
expect(stringHasher.putBuildTarget(TARGET_1)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_1))).andReturn(guavaHasher);
expect(stringHasher.putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_1))).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putContainer(RuleKeyHasher.Container.LIST, 42)).andReturn(guavaHasher);
expect(stringHasher.putContainer(RuleKeyHasher.Container.LIST, 42)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putContainer(RuleKeyHasher.Container.MAP, 42)).andReturn(guavaHasher);
expect(stringHasher.putContainer(RuleKeyHasher.Container.MAP, 42)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putWrapper(RuleKeyHasher.Wrapper.SUPPLIER)).andReturn(guavaHasher);
expect(stringHasher.putWrapper(RuleKeyHasher.Wrapper.SUPPLIER)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putWrapper(RuleKeyHasher.Wrapper.OPTIONAL)).andReturn(guavaHasher);
expect(stringHasher.putWrapper(RuleKeyHasher.Wrapper.OPTIONAL)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putWrapper(RuleKeyHasher.Wrapper.EITHER_LEFT)).andReturn(guavaHasher);
expect(stringHasher.putWrapper(RuleKeyHasher.Wrapper.EITHER_LEFT)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putWrapper(RuleKeyHasher.Wrapper.EITHER_RIGHT)).andReturn(guavaHasher);
expect(stringHasher.putWrapper(RuleKeyHasher.Wrapper.EITHER_RIGHT)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putWrapper(RuleKeyHasher.Wrapper.BUILD_RULE)).andReturn(guavaHasher);
expect(stringHasher.putWrapper(RuleKeyHasher.Wrapper.BUILD_RULE)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putWrapper(RuleKeyHasher.Wrapper.APPENDABLE)).andReturn(guavaHasher);
expect(stringHasher.putWrapper(RuleKeyHasher.Wrapper.APPENDABLE)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
expect(guavaHasher.putKey("45")).andReturn(guavaHasher);
expect(stringHasher.putKey("45")).andReturn(stringHasher);
expect(guavaHasher.putNull()).andReturn(guavaHasher);
expect(stringHasher.putNull()).andReturn(stringHasher);
expect(guavaHasher.putBoolean(true)).andReturn(guavaHasher);
expect(stringHasher.putBoolean(true)).andReturn(stringHasher);
expect(guavaHasher.putNumber(45)).andReturn(guavaHasher);
expect(stringHasher.putNumber(45)).andReturn(stringHasher);
expect(guavaHasher.putString("45")).andReturn(guavaHasher);
expect(stringHasher.putString("45")).andReturn(stringHasher);
expect(guavaHasher.putBytes(BYTE_ARRAY)).andReturn(guavaHasher);
expect(stringHasher.putBytes(BYTE_ARRAY)).andReturn(stringHasher);
expect(guavaHasher.putPattern(PATTERN)).andReturn(guavaHasher);
expect(stringHasher.putPattern(PATTERN)).andReturn(stringHasher);
expect(guavaHasher.putSha1(Sha1HashCode.of("a002b39af204cdfaa5fdb67816b13867c32ac52c"))).andReturn(guavaHasher);
expect(stringHasher.putSha1(Sha1HashCode.of("a002b39af204cdfaa5fdb67816b13867c32ac52c"))).andReturn(stringHasher);
expect(guavaHasher.putPath(Paths.get("45"), HashCode.fromInt(45))).andReturn(guavaHasher);
expect(stringHasher.putPath(Paths.get("45"), HashCode.fromInt(45))).andReturn(stringHasher);
expect(guavaHasher.putArchiveMemberPath(newArchiveMember("45", "45"), HashCode.fromInt(45))).andReturn(guavaHasher);
expect(stringHasher.putArchiveMemberPath(newArchiveMember("45", "45"), HashCode.fromInt(45))).andReturn(stringHasher);
expect(guavaHasher.putNonHashingPath("45")).andReturn(guavaHasher);
expect(stringHasher.putNonHashingPath("45")).andReturn(stringHasher);
expect(guavaHasher.putSourceRoot(SOURCE_ROOT)).andReturn(guavaHasher);
expect(stringHasher.putSourceRoot(SOURCE_ROOT)).andReturn(stringHasher);
expect(guavaHasher.putRuleKey(RULE_KEY_1)).andReturn(guavaHasher);
expect(stringHasher.putRuleKey(RULE_KEY_1)).andReturn(stringHasher);
expect(guavaHasher.putBuildRuleType(BuildRuleType.of("45"))).andReturn(guavaHasher);
expect(stringHasher.putBuildRuleType(BuildRuleType.of("45"))).andReturn(stringHasher);
expect(guavaHasher.putBuildTarget(TARGET_1)).andReturn(guavaHasher);
expect(stringHasher.putBuildTarget(TARGET_1)).andReturn(stringHasher);
expect(guavaHasher.putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_1))).andReturn(guavaHasher);
expect(stringHasher.putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_1))).andReturn(stringHasher);
expect(guavaHasher.putContainer(RuleKeyHasher.Container.LIST, 45)).andReturn(guavaHasher);
expect(stringHasher.putContainer(RuleKeyHasher.Container.LIST, 45)).andReturn(stringHasher);
expect(guavaHasher.putContainer(RuleKeyHasher.Container.MAP, 45)).andReturn(guavaHasher);
expect(stringHasher.putContainer(RuleKeyHasher.Container.MAP, 45)).andReturn(stringHasher);
expect(guavaHasher.putWrapper(RuleKeyHasher.Wrapper.OPTIONAL)).andReturn(guavaHasher);
expect(stringHasher.putWrapper(RuleKeyHasher.Wrapper.OPTIONAL)).andReturn(stringHasher);
expect(guavaHasher.hash()).andReturn(hash);
expect(stringHasher.hash()).andReturn(string);
replay(stringHasher, guavaHasher);
newHasher(guavaHasher, stringHasher).hash();
newHasher(guavaHasher, stringHasher).putKey("42").hash();
newHasher(guavaHasher, stringHasher).putNull().hash();
newHasher(guavaHasher, stringHasher).putBoolean(true).hash();
newHasher(guavaHasher, stringHasher).putBoolean(false).hash();
newHasher(guavaHasher, stringHasher).putNumber(42).hash();
newHasher(guavaHasher, stringHasher).putNumber((long) 42).hash();
newHasher(guavaHasher, stringHasher).putNumber((short) 42).hash();
newHasher(guavaHasher, stringHasher).putNumber((byte) 42).hash();
newHasher(guavaHasher, stringHasher).putNumber((float) 42).hash();
newHasher(guavaHasher, stringHasher).putNumber((double) 42).hash();
newHasher(guavaHasher, stringHasher).putString("42").hash();
newHasher(guavaHasher, stringHasher).putBytes(BYTE_ARRAY).hash();
newHasher(guavaHasher, stringHasher).putPattern(PATTERN).hash();
newHasher(guavaHasher, stringHasher).putSha1(Sha1HashCode.of("a002b39af204cdfaa5fdb67816b13867c32ac52c")).hash();
newHasher(guavaHasher, stringHasher).putPath(Paths.get("42/42"), HashCode.fromInt(42)).hash();
newHasher(guavaHasher, stringHasher).putArchiveMemberPath(newArchiveMember("42/42", "42/42"), HashCode.fromInt(42)).hash();
newHasher(guavaHasher, stringHasher).putNonHashingPath("42").hash();
newHasher(guavaHasher, stringHasher).putSourceRoot(SOURCE_ROOT).hash();
newHasher(guavaHasher, stringHasher).putRuleKey(RULE_KEY_1).hash();
newHasher(guavaHasher, stringHasher).putBuildRuleType(BuildRuleType.of("42")).hash();
newHasher(guavaHasher, stringHasher).putBuildTarget(TARGET_1).hash();
newHasher(guavaHasher, stringHasher).putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_1)).hash();
newHasher(guavaHasher, stringHasher).putContainer(RuleKeyHasher.Container.LIST, 42).hash();
newHasher(guavaHasher, stringHasher).putContainer(RuleKeyHasher.Container.MAP, 42).hash();
newHasher(guavaHasher, stringHasher).putWrapper(RuleKeyHasher.Wrapper.SUPPLIER).hash();
newHasher(guavaHasher, stringHasher).putWrapper(RuleKeyHasher.Wrapper.OPTIONAL).hash();
newHasher(guavaHasher, stringHasher).putWrapper(RuleKeyHasher.Wrapper.EITHER_LEFT).hash();
newHasher(guavaHasher, stringHasher).putWrapper(RuleKeyHasher.Wrapper.EITHER_RIGHT).hash();
newHasher(guavaHasher, stringHasher).putWrapper(RuleKeyHasher.Wrapper.BUILD_RULE).hash();
newHasher(guavaHasher, stringHasher).putWrapper(RuleKeyHasher.Wrapper.APPENDABLE).hash();
newHasher(guavaHasher, stringHasher).putKey("45").putNull().putBoolean(true).putNumber(45).putString("45").putBytes(BYTE_ARRAY).putPattern(PATTERN).putSha1(Sha1HashCode.of("a002b39af204cdfaa5fdb67816b13867c32ac52c")).putPath(Paths.get("45"), HashCode.fromInt(45)).putArchiveMemberPath(newArchiveMember("45", "45"), HashCode.fromInt(45)).putNonHashingPath("45").putSourceRoot(SOURCE_ROOT).putRuleKey(RULE_KEY_1).putBuildRuleType(BuildRuleType.of("45")).putBuildTarget(TARGET_1).putBuildTargetSourcePath(new DefaultBuildTargetSourcePath(TARGET_1)).putContainer(RuleKeyHasher.Container.LIST, 45).putContainer(RuleKeyHasher.Container.MAP, 45).putWrapper(RuleKeyHasher.Wrapper.OPTIONAL).hash();
}
Aggregations