def test_identical_jar_libraries_with_differing_managed_deps_differ(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) managed_jar_deps = self.make_target( ":managed", target_type=ManagedJarDependencies, artifacts=[JarDependency("org.some", "name")], ) self.set_artifact_set_for(managed_jar_deps, PinnedJarArtifactSet()) jar_lib_with_managed_deps = self.make_target( ":jar-lib-1", target_type=JarLibrary, jars=[JarDependency("org.some", "name")], managed_dependencies=":managed", ) jar_lib_without_managed_deps = self.make_target( ":jar-lib-no-managed-dep", target_type=JarLibrary, jars=[JarDependency("org.some", "name")], ) self.assertNotEqual( strategy.compute_fingerprint(jar_lib_with_managed_deps), strategy.compute_fingerprint(jar_lib_without_managed_deps), )
def test_jvm_target_without_excludes_is_none(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) target_without_excludes = self.make_target(':jvm-target', target_type=JvmTarget) self.assertIsNone(strategy.compute_fingerprint(target_without_excludes))
def test_target_target_is_none(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) target = self.make_target(':just-target') self.assertIsNone(strategy.compute_fingerprint(target))
def test_jvm_target_without_excludes_is_none(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) target_without_excludes = self.make_target(':jvm-target', target_type=JvmTarget) self.assertIsNone(strategy.compute_fingerprint(target_without_excludes))
def test_target_target_is_none(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) target = self.make_target(':just-target') self.assertIsNone(strategy.compute_fingerprint(target))
def test_jar_library_with_one_jar_is_hashed(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) jar_library = self.make_target(':jar-library', target_type=JarLibrary, jars=[JarDependency('org.some', 'name')]) self.assertIsNotNone(strategy.compute_fingerprint(jar_library))
def test_jvm_target_with_excludes_is_hashed(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) target_with_excludes = self.make_target(':jvm-target', target_type=JvmTarget, excludes=[Exclude('org.some')]) self.assertIsNotNone(strategy.compute_fingerprint(target_with_excludes))
def test_jar_library_with_one_jar_is_hashed(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) jar_library = self.make_target(':jar-library', target_type=JarLibrary, jars=[JarDependency('org.some', 'name')]) self.assertIsNotNone(strategy.compute_fingerprint(jar_library))
def test_jvm_target_with_excludes_is_hashed(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) target_with_excludes = self.make_target(':jvm-target', target_type=JvmTarget, excludes=[Exclude('org.some')]) self.assertIsNotNone(strategy.compute_fingerprint(target_with_excludes))
def test_identical_jar_libraries_with_differing_managed_deps_differ(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) managed_jar_deps = self.make_target(':managed', target_type=ManagedJarDependencies, artifacts=[JarDependency('org.some', 'name')]) self.set_artifact_set_for(managed_jar_deps, PinnedJarArtifactSet()) jar_lib_with_managed_deps = self.make_target(':jar-lib-1', target_type=JarLibrary, jars=[JarDependency('org.some', 'name')], managed_dependencies=':managed') jar_lib_without_managed_deps = self.make_target(':jar-lib-no-managed-dep', target_type=JarLibrary, jars=[JarDependency('org.some', 'name')]) self.assertNotEqual(strategy.compute_fingerprint(jar_lib_with_managed_deps), strategy.compute_fingerprint(jar_lib_without_managed_deps))
def test_identical_jar_libraries_with_same_jar_dep_management_artifacts_match(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) managed_jar_deps = self.make_target(':managed', target_type=ManagedJarDependencies, artifacts=[JarDependency('org.some', 'name')]) self.set_artifact_set_for(managed_jar_deps, PinnedJarArtifactSet()) jar_lib_1 = self.make_target(':jar-lib-1', target_type=JarLibrary, jars=[JarDependency('org.some', 'name')], managed_dependencies=':managed') jar_lib_2 = self.make_target(':jar-lib-2', target_type=JarLibrary, jars=[JarDependency('org.some', 'name')], managed_dependencies=':managed') self.assertEqual(strategy.compute_fingerprint(jar_lib_1), strategy.compute_fingerprint(jar_lib_2))
def test_identical_jar_libraries_with_same_jar_dep_management_artifacts_match(self): confs = () strategy = CoursierResolveFingerprintStrategy(confs) managed_jar_deps = self.make_target(':managed', target_type=ManagedJarDependencies, artifacts=[JarDependency('org.some', 'name')]) self.set_artifact_set_for(managed_jar_deps, PinnedJarArtifactSet()) jar_lib_1 = self.make_target(':jar-lib-1', target_type=JarLibrary, jars=[JarDependency('org.some', 'name')], managed_dependencies=':managed') jar_lib_2 = self.make_target(':jar-lib-2', target_type=JarLibrary, jars=[JarDependency('org.some', 'name')], managed_dependencies=':managed') self.assertEqual(strategy.compute_fingerprint(jar_lib_1), strategy.compute_fingerprint(jar_lib_2))