Stop relying on non-optional artifacts in tests

Once we don't rely on directory listings anymore, most JARs will be
marked as optional. Also, attributes have to be set beforehand to get
artifacts with specific types, as available artifacts cannot be listed
beforehand.
This commit is contained in:
Alexandre Archambault 2018-09-19 15:04:52 +02:00
parent 2a5804caec
commit 2775ef396b
4 changed files with 91 additions and 200 deletions

View File

@ -9,62 +9,35 @@ object DirectoryListingTests extends TestSuite {
val user = "user" val user = "user"
val password = "pass" val password = "pass"
val withListingRepo = MavenRepository( val repo = MavenRepository(
"http://localhost:8080", "http://localhost:8080",
authentication = Some(Authentication(user, password)) authentication = Some(Authentication(user, password))
) )
val withoutListingRepo = MavenRepository(
"http://localhost:8081",
authentication = Some(Authentication(user, password))
)
val module = Module("com.abc", "test") val module = Module("com.abc", "test")
val version = "0.1" val version = "0.1"
val tests = Tests { val tests = Tests {
'withListing - { 'jar - CentralTests.withArtifacts(
'jar - CentralTests.withArtifacts( module,
module, version,
version, attributes = Attributes("jar"),
"jar", extraRepos = Seq(repo)
extraRepos = Seq(withListingRepo) ) {
) { artifacts =>
artifacts => assert(artifacts.length == 1)
assert(artifacts.length == 1) assert(artifacts.headOption.exists(_.url.endsWith(".jar")))
}
'jarFoo - CentralTests.withArtifacts(
module,
version,
"jar-foo",
extraRepos = Seq(withListingRepo)
) {
artifacts =>
assert(artifacts.length == 1)
}
} }
'withoutListing - { 'jarFoo - CentralTests.withArtifacts(
'jar - CentralTests.withArtifacts( module,
module, version,
version, attributes = Attributes("jar-foo"),
"jar", extraRepos = Seq(repo)
extraRepos = Seq(withoutListingRepo) ) {
) { artifacts =>
artifacts => assert(artifacts.length == 1)
assert(artifacts.length == 1) assert(artifacts.headOption.exists(_.url.endsWith(".jar-foo")))
}
'jarFoo - CentralTests.withArtifacts(
module,
version,
"jar-foo",
extraRepos = Seq(withoutListingRepo)
) {
artifacts =>
assert(artifacts.length == 0)
}
} }
} }

View File

@ -46,8 +46,8 @@ object IvyTests extends TestSuite {
extraRepos = Seq(sbtRepo) extraRepos = Seq(sbtRepo)
) )
* - CentralTests.withArtifact(mod, ver, "jar", extraRepos = Seq(sbtRepo)) { artifact => * - CentralTests.withArtifacts(mod, ver, Attributes("jar"), extraRepos = Seq(sbtRepo)) { artifacts =>
assert(artifact.url == expectedArtifactUrl) assert(artifacts.exists(_.url == expectedArtifactUrl))
} }
} }
@ -71,11 +71,9 @@ object IvyTests extends TestSuite {
val testJarUrl = repoBase + "com.example/a_2.11/0.1.0-SNAPSHOT/jars/a_2.11-tests.jar" val testJarUrl = repoBase + "com.example/a_2.11/0.1.0-SNAPSHOT/jars/a_2.11-tests.jar"
"no conf or classifier" - CentralTests.withArtifacts( "no conf or classifier" - CentralTests.withArtifacts(
dep = dep, dep = dep.copy(attributes = Attributes("jar")),
artifactType = "jar",
extraRepos = Seq(repo), extraRepos = Seq(repo),
classifierOpt = None, classifierOpt = None
optional = true
) { ) {
case Seq(artifact) => case Seq(artifact) =>
assert(artifact.url == mainJarUrl) assert(artifact.url == mainJarUrl)
@ -85,19 +83,12 @@ object IvyTests extends TestSuite {
"test conf" - CentralTests.withArtifacts( "test conf" - CentralTests.withArtifacts(
dep = dep.copy(configuration = "test"), dep = dep.copy(configuration = "test"),
artifactType = "jar",
extraRepos = Seq(repo), extraRepos = Seq(repo),
classifierOpt = None, classifierOpt = None
optional = true ) { artifacts =>
) { val urls = artifacts.map(_.url).toSet
case Seq(artifact1, artifact2) => assert(urls(mainJarUrl))
val urls = Set( assert(urls(testJarUrl))
artifact1.url,
artifact2.url
)
assert(urls == Set(mainJarUrl, testJarUrl))
case other =>
throw new Exception(s"Unexpected number of artifacts\n${other.mkString("\n")}")
} }
"tests classifier" - { "tests classifier" - {
@ -105,27 +96,18 @@ object IvyTests extends TestSuite {
* - CentralTests.withArtifacts( * - CentralTests.withArtifacts(
deps = Set(dep, testsDep), deps = Set(dep, testsDep),
artifactType = "jar",
extraRepos = Seq(repo), extraRepos = Seq(repo),
classifierOpt = None, classifierOpt = None
optional = true ) { artifacts =>
) { val urls = artifacts.map(_.url).toSet
case Seq(artifact1, artifact2) => assert(urls(mainJarUrl))
val urls = Set( assert(urls(testJarUrl))
artifact1.url,
artifact2.url
)
assert(urls == Set(mainJarUrl, testJarUrl))
case other =>
throw new Exception(s"Unexpected number of artifacts\n${other.mkString("\n")}")
} }
* - CentralTests.withArtifacts( * - CentralTests.withArtifacts(
dep = testsDep, dep = testsDep,
artifactType = "jar",
extraRepos = Seq(repo), extraRepos = Seq(repo),
classifierOpt = None, classifierOpt = None
optional = true
) { ) {
case Seq(artifact) => case Seq(artifact) =>
assert(artifact.url == testJarUrl) assert(artifact.url == testJarUrl)

View File

@ -26,11 +26,9 @@ object MavenTests extends TestSuite {
val sourcesJarUrl = repoBase + "com/abc/test-snapshot-special/0.1.0-SNAPSHOT/test-snapshot-special-0.1.0-20170421.034426-82-sources.jar" val sourcesJarUrl = repoBase + "com/abc/test-snapshot-special/0.1.0-SNAPSHOT/test-snapshot-special-0.1.0-20170421.034426-82-sources.jar"
* - CentralTests.withArtifacts( * - CentralTests.withArtifacts(
dep = dep, dep = dep.copy(attributes = Attributes("jar")),
artifactType = "jar",
extraRepos = Seq(repo), extraRepos = Seq(repo),
classifierOpt = None, classifierOpt = None
optional = true
) { ) {
case Seq(artifact) => case Seq(artifact) =>
assert(artifact.url == mainJarUrl) assert(artifact.url == mainJarUrl)
@ -39,11 +37,9 @@ object MavenTests extends TestSuite {
} }
* - CentralTests.withArtifacts( * - CentralTests.withArtifacts(
dep = dep, dep = dep.copy(attributes = Attributes("src")),
artifactType = "src",
extraRepos = Seq(repo), extraRepos = Seq(repo),
classifierOpt = Some("sources"), classifierOpt = Some("sources")
optional = true
) { ) {
case Seq(artifact) => case Seq(artifact) =>
assert(artifact.url == sourcesJarUrl) assert(artifact.url == sourcesJarUrl)

View File

@ -126,58 +126,33 @@ abstract class CentralTests extends TestSuite {
assert(result == expected) assert(result == expected)
} }
def withArtifact[T](
module: Module,
version: String,
artifactType: String,
attributes: Attributes = Attributes(),
extraRepos: Seq[Repository] = Nil
)(
f: Artifact => T
): Future[T] =
withArtifacts(module, version, artifactType, attributes, extraRepos) {
case Seq(artifact) =>
f(artifact)
case other =>
throw new Exception(
s"Unexpected artifact list size: ${other.size}\n" +
"Artifacts:\n" + other.map(" " + _).mkString("\n")
)
}
def withArtifacts[T]( def withArtifacts[T](
module: Module, module: Module,
version: String, version: String,
artifactType: String,
attributes: Attributes = Attributes(), attributes: Attributes = Attributes(),
extraRepos: Seq[Repository] = Nil, extraRepos: Seq[Repository] = Nil,
classifierOpt: Option[String] = None, classifierOpt: Option[String] = None,
transitive: Boolean = false, transitive: Boolean = false
optional: Boolean = true
)( )(
f: Seq[Artifact] => T f: Seq[Artifact] => T
): Future[T] = { ): Future[T] = {
val dep = Dependency(module, version, transitive = transitive, attributes = attributes) val dep = Dependency(module, version, transitive = transitive, attributes = attributes)
withArtifacts(dep, artifactType, extraRepos, classifierOpt, optional)(f) withArtifacts(dep, extraRepos, classifierOpt)(f)
} }
def withArtifacts[T]( def withArtifacts[T](
dep: Dependency, dep: Dependency,
artifactType: String,
extraRepos: Seq[Repository], extraRepos: Seq[Repository],
classifierOpt: Option[String], classifierOpt: Option[String]
optional: Boolean
)( )(
f: Seq[Artifact] => T f: Seq[Artifact] => T
): Future[T] = ): Future[T] =
withArtifacts(Set(dep), artifactType, extraRepos, classifierOpt, optional)(f) withArtifacts(Set(dep), extraRepos, classifierOpt)(f)
def withArtifacts[T]( def withArtifacts[T](
deps: Set[Dependency], deps: Set[Dependency],
artifactType: String,
extraRepos: Seq[Repository], extraRepos: Seq[Repository],
classifierOpt: Option[String], classifierOpt: Option[String]
optional: Boolean
)( )(
f: Seq[Artifact] => T f: Seq[Artifact] => T
): Future[T] = async { ): Future[T] = async {
@ -191,13 +166,8 @@ abstract class CentralTests extends TestSuite {
assert(isDone) assert(isDone)
val artifacts = classifierOpt val artifacts = classifierOpt
.fold(res.dependencyArtifacts(withOptional = optional))(c => res.dependencyClassifiersArtifacts(Seq(c))) .fold(res.dependencyArtifacts(withOptional = true))(c => res.dependencyClassifiersArtifacts(Seq(c)))
.map(_._2) .map(_._2)
.filter {
if (artifactType == "*") _ => true
else
_.`type` == artifactType
}
f(artifacts) f(artifacts)
} }
@ -205,13 +175,12 @@ abstract class CentralTests extends TestSuite {
def ensureHasArtifactWithExtension( def ensureHasArtifactWithExtension(
module: Module, module: Module,
version: String, version: String,
artifactType: String,
extension: String, extension: String,
attributes: Attributes = Attributes(), attributes: Attributes = Attributes(),
extraRepos: Seq[Repository] = Nil extraRepos: Seq[Repository] = Nil
): Future[Unit] = ): Future[Unit] =
withArtifact(module, version, artifactType, attributes = attributes, extraRepos = extraRepos) { artifact => withArtifacts(module, version, attributes = attributes, extraRepos = extraRepos) { artifacts =>
assert(artifact.url.endsWith("." + extension)) assert(artifacts.exists(_.url.endsWith("." + extension)))
} }
val tests = Tests { val tests = Tests {
@ -305,7 +274,7 @@ abstract class CentralTests extends TestSuite {
mod, mod,
version, version,
"jar", "jar",
"jar", Attributes("jar"),
extraRepos = Seq(extraRepo) extraRepos = Seq(extraRepo)
) )
} }
@ -409,8 +378,8 @@ abstract class CentralTests extends TestSuite {
* - resolutionCheck(mod, version) * - resolutionCheck(mod, version)
* - withArtifact(mod, version, "jar") { artifact => * - withArtifacts(mod, version, Attributes("jar")) { artifacts =>
assert(artifact.url == expectedArtifactUrl) assert(artifacts.exists(_.url == expectedArtifactUrl))
} }
} }
@ -438,7 +407,8 @@ abstract class CentralTests extends TestSuite {
Dependency( Dependency(
Module("org.scala-lang", "scala-compiler"), "2.11.8", Module("org.scala-lang", "scala-compiler"), "2.11.8",
configuration = config, configuration = config,
transitive = false transitive = false,
attributes = Attributes("jar")
) )
withArtifacts( withArtifacts(
@ -446,10 +416,8 @@ abstract class CentralTests extends TestSuite {
intransitiveCompiler("default"), intransitiveCompiler("default"),
intransitiveCompiler("optional") intransitiveCompiler("optional")
), ),
"jar",
extraRepos = Nil, extraRepos = Nil,
classifierOpt = None, classifierOpt = None
optional = true
) { ) {
case Seq() => case Seq() =>
throw new Exception("Expected one JAR") throw new Exception("Expected one JAR")
@ -471,7 +439,6 @@ abstract class CentralTests extends TestSuite {
module, module,
version, version,
tpe, tpe,
tpe,
attributes = Attributes(tpe) attributes = Attributes(tpe)
) )
@ -480,7 +447,6 @@ abstract class CentralTests extends TestSuite {
ensureHasArtifactWithExtension( ensureHasArtifactWithExtension(
module, module,
version, version,
tpe,
tpe tpe
) )
} }
@ -491,7 +457,6 @@ abstract class CentralTests extends TestSuite {
* - ensureHasArtifactWithExtension( * - ensureHasArtifactWithExtension(
Module("com.google.guava", "guava"), Module("com.google.guava", "guava"),
"17.0", "17.0",
"bundle",
"jar" "jar"
) )
@ -500,7 +465,6 @@ abstract class CentralTests extends TestSuite {
* - ensureHasArtifactWithExtension( * - ensureHasArtifactWithExtension(
Module("com.google.guava", "guava"), Module("com.google.guava", "guava"),
"17.0", "17.0",
"bundle",
"jar", "jar",
attributes = Attributes("jar") attributes = Attributes("jar")
) )
@ -511,8 +475,8 @@ abstract class CentralTests extends TestSuite {
ensureHasArtifactWithExtension( ensureHasArtifactWithExtension(
Module("org.bytedeco", "javacpp"), Module("org.bytedeco", "javacpp"),
"1.1", "1.1",
"maven-plugin", "jar",
"jar" Attributes("maven-plugin")
) )
} }
} }
@ -530,7 +494,7 @@ abstract class CentralTests extends TestSuite {
) )
) )
val res = await(resolve(deps, extraRepos = Seq(extraRepo))) val res = await(resolve(deps, extraRepos = Seq(extraRepo)))
val filenames: Set[String] = res.artifacts.map(_.url.split("/").last).toSet val filenames: Set[String] = res.artifacts(withOptional = true).map(_.url.split("/").last).toSet
assert(filenames.contains("avro-1.8.1.jar")) assert(filenames.contains("avro-1.8.1.jar"))
assert(!filenames.contains("avro-1.8.1-tests.jar")) assert(!filenames.contains("avro-1.8.1-tests.jar"))
} }
@ -544,7 +508,7 @@ abstract class CentralTests extends TestSuite {
) )
) )
val res = await(resolve(deps, extraRepos = Seq(extraRepo))) val res = await(resolve(deps, extraRepos = Seq(extraRepo)))
val filenames: Set[String] = res.artifacts.map(_.url.split("/").last).toSet val filenames: Set[String] = res.artifacts(withOptional = true).map(_.url.split("/").last).toSet
assert(!filenames.contains("avro-1.8.1.jar")) assert(!filenames.contains("avro-1.8.1.jar"))
assert(filenames.contains("avro-1.8.1-tests.jar")) assert(filenames.contains("avro-1.8.1-tests.jar"))
} }
@ -561,7 +525,7 @@ abstract class CentralTests extends TestSuite {
) )
) )
val res = await(resolve(deps, extraRepos = Seq(extraRepo))) val res = await(resolve(deps, extraRepos = Seq(extraRepo)))
val filenames: Set[String] = res.artifacts.map(_.url.split("/").last).toSet val filenames: Set[String] = res.artifacts(withOptional = true).map(_.url.split("/").last).toSet
assert(filenames.contains("avro-1.8.1.jar")) assert(filenames.contains("avro-1.8.1.jar"))
assert(filenames.contains("avro-1.8.1-tests.jar")) assert(filenames.contains("avro-1.8.1-tests.jar"))
} }
@ -589,7 +553,7 @@ abstract class CentralTests extends TestSuite {
assert(conflicts.isEmpty) assert(conflicts.isEmpty)
assert(isDone) assert(isDone)
val artifacts = res.artifacts val artifacts = res.artifacts(withOptional = true)
val map = artifacts.groupBy(a => a) val map = artifacts.groupBy(a => a)
@ -640,7 +604,6 @@ abstract class CentralTests extends TestSuite {
val zookeeperTestArtifact = zookeeperTestArtifacts.head val zookeeperTestArtifact = zookeeperTestArtifacts.head
assert(!isActualCentral || !zookeeperTestArtifact.isOptional)
assert(zookeeperTestArtifact.attributes.`type` == "test-jar") assert(zookeeperTestArtifact.attributes.`type` == "test-jar")
assert(zookeeperTestArtifact.attributes.classifier == "tests") assert(zookeeperTestArtifact.attributes.classifier == "tests")
zookeeperTestArtifact.url.endsWith("-tests.jar") zookeeperTestArtifact.url.endsWith("-tests.jar")
@ -703,30 +666,21 @@ abstract class CentralTests extends TestSuite {
* - resolutionCheck(mod, version) * - resolutionCheck(mod, version)
val mainTarGzUrl = s"$centralBase/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.tar.gz" val mainTarGzUrl = s"$centralBase/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.tar.gz"
val expectedTarGzArtifactUrls = Set(
mainTarGzUrl,
s"$centralBase/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3-bin.tar.gz"
)
val mainZipUrl = s"$centralBase/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip" val mainZipUrl = s"$centralBase/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip"
val expectedZipArtifactUrls = Set(
mainZipUrl,
s"$centralBase/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3-bin.zip"
)
'tarGz - { 'tarGz - {
* - { * - {
if (isActualCentral) if (isActualCentral)
withArtifacts(mod, version, "tar.gz", classifierOpt = Some("bin"), transitive = true) { artifacts => withArtifacts(mod, version, attributes = Attributes("tar.gz", "bin"), transitive = true) { artifacts =>
assert(artifacts.length == 2) assert(artifacts.nonEmpty)
val urls = artifacts.map(_.url).toSet val urls = artifacts.map(_.url).toSet
assert(urls == expectedTarGzArtifactUrls) assert(urls.contains(mainTarGzUrl))
} }
else else
Future.successful(()) Future.successful(())
} }
* - { * - {
withArtifacts(mod, version, "tar.gz", attributes = Attributes("tar.gz", "bin"), classifierOpt = Some("bin"), transitive = true) { artifacts => withArtifacts(mod, version, attributes = Attributes("tar.gz", "bin"), classifierOpt = Some("bin"), transitive = true) { artifacts =>
assert(artifacts.nonEmpty) assert(artifacts.nonEmpty)
val urls = artifacts.map(_.url).toSet val urls = artifacts.map(_.url).toSet
assert(urls.contains(mainTarGzUrl)) assert(urls.contains(mainTarGzUrl))
@ -737,16 +691,16 @@ abstract class CentralTests extends TestSuite {
'zip - { 'zip - {
* - { * - {
if (isActualCentral) if (isActualCentral)
withArtifacts(mod, version, "zip", classifierOpt = Some("bin"), transitive = true) { artifacts => withArtifacts(mod, version, attributes = Attributes("zip", "bin"), transitive = true) { artifacts =>
assert(artifacts.length == 2) assert(artifacts.nonEmpty)
val urls = artifacts.map(_.url).toSet val urls = artifacts.map(_.url).toSet
assert(urls == expectedZipArtifactUrls) assert(urls.contains(mainZipUrl))
} }
else else
Future.successful(()) Future.successful(())
} }
* - { * - {
withArtifacts(mod, version, "zip", attributes = Attributes("zip", "bin"), classifierOpt = Some("bin"), transitive = true) { artifacts => withArtifacts(mod, version, attributes = Attributes("zip", "bin"), classifierOpt = Some("bin"), transitive = true) { artifacts =>
assert(artifacts.nonEmpty) assert(artifacts.nonEmpty)
val urls = artifacts.map(_.url).toSet val urls = artifacts.map(_.url).toSet
assert(urls.contains(mainZipUrl)) assert(urls.contains(mainZipUrl))
@ -776,9 +730,8 @@ abstract class CentralTests extends TestSuite {
* - resolutionCheck(mod, ver) * - resolutionCheck(mod, ver)
* - withArtifacts(mod, ver, "jar", transitive = true) { artifacts => * - withArtifacts(mod, ver, transitive = true) { artifacts =>
assert(artifacts.length == 1) assert(artifacts.exists(_.url == expectedUrl))
assert(artifacts.head.url == expectedUrl)
} }
} }
} }
@ -812,33 +765,32 @@ abstract class CentralTests extends TestSuite {
def hasSha1(a: Artifact) = a.checksumUrls.contains("SHA-1") def hasSha1(a: Artifact) = a.checksumUrls.contains("SHA-1")
def hasMd5(a: Artifact) = a.checksumUrls.contains("MD5") def hasMd5(a: Artifact) = a.checksumUrls.contains("MD5")
def hasSig(a: Artifact) = a.extra.contains("sig") def hasSig(a: Artifact) = a.extra.contains("sig")
def sigHasSig(a: Artifact) = a.extra.get("sig").exists(hasSig)
* - resolutionCheck(mod, ver) * - resolutionCheck(mod, ver)
* - withArtifacts(mod, ver, "*") { artifacts => * - withArtifacts(mod, ver, Attributes("bundle")) { artifacts =>
val jarOpt = artifacts.find(_.`type` == "bundle").orElse(artifacts.find(_.`type` == "jar")) val jarOpt = artifacts.find(_.`type` == "bundle").orElse(artifacts.find(_.`type` == "jar"))
val pomOpt = artifacts.find(_.`type` == "pom")
assert(jarOpt.nonEmpty) assert(jarOpt.nonEmpty)
assert(jarOpt.forall(hasSha1)) assert(jarOpt.forall(hasSha1))
assert(jarOpt.forall(hasMd5)) assert(jarOpt.forall(hasMd5))
assert(jarOpt.forall(hasSig)) assert(jarOpt.forall(hasSig))
}
if (isActualCentral) { * - {
if (artifacts.length != 2 || jarOpt.isEmpty || pomOpt.isEmpty) if (isActualCentral)
artifacts.foreach(println) withArtifacts(mod, ver, Attributes("pom")) { artifacts =>
assert(jarOpt.forall(_.`type` == "bundle")) val pomOpt = artifacts.find(_.`type` == "pom")
assert(artifacts.length == 2)
assert(pomOpt.nonEmpty) assert(pomOpt.nonEmpty)
assert(pomOpt.forall(hasSha1)) assert(pomOpt.forall(hasSha1))
assert(pomOpt.forall(hasMd5)) assert(pomOpt.forall(hasMd5))
assert(pomOpt.forall(hasSig)) assert(pomOpt.forall(hasSig))
assert(jarOpt.forall(sigHasSig)) }
assert(pomOpt.forall(sigHasSig)) else
} Future.successful(())
} }
} }
@ -877,40 +829,28 @@ abstract class CentralTests extends TestSuite {
val mod = Module("io.monix", "monix_2.12") val mod = Module("io.monix", "monix_2.12")
val ver = "2.3.0" val ver = "2.3.0"
val mainUrl = "https://repo1.maven.org/maven2/io/monix/monix_2.12/2.3.0/monix_2.12-2.3.0.jar" val mainUrl = s"$centralBase/io/monix/monix_2.12/2.3.0/monix_2.12-2.3.0.jar"
* - resolutionCheck(mod, ver) * - resolutionCheck(mod, ver)
* - { * - withArtifacts(mod, ver, Attributes("jar")) { artifacts =>
if (isActualCentral)
withArtifacts(mod, ver, "jar") { artifacts =>
val mainArtifactOpt = artifacts.find(_.url == mainUrl)
assert(mainArtifactOpt.nonEmpty)
assert(mainArtifactOpt.forall(_.isOptional))
}
else
Future.successful(())
}
* - withArtifacts(mod, ver, "jar", optional = false) { artifacts =>
val mainArtifactOpt = artifacts.find(_.url == mainUrl) val mainArtifactOpt = artifacts.find(_.url == mainUrl)
assert(mainArtifactOpt.isEmpty) assert(mainArtifactOpt.nonEmpty)
assert(mainArtifactOpt.forall(_.isOptional))
} }
* - { * - {
if (isActualCentral) if (isActualCentral)
withArtifacts(Module("com.lihaoyi", "scalatags_2.12"), "0.6.2", "jar", transitive = true, optional = false) { artifacts => withArtifacts(Module("com.lihaoyi", "scalatags_2.12"), "0.6.2", Attributes("jar"), transitive = true) { artifacts =>
assert(artifacts.forall(!_.isOptional))
val urls = artifacts.map(_.url).toSet val urls = artifacts.map(_.url).toSet
val expectedUrls = Set( val expectedUrls = Seq(
"https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.0/scala-library-2.12.0.jar", "https://repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.0/scala-library-2.12.0.jar",
"https://repo1.maven.org/maven2/com/lihaoyi/sourcecode_2.12/0.1.3/sourcecode_2.12-0.1.3.jar", "https://repo1.maven.org/maven2/com/lihaoyi/sourcecode_2.12/0.1.3/sourcecode_2.12-0.1.3.jar",
"https://repo1.maven.org/maven2/com/lihaoyi/scalatags_2.12/0.6.2/scalatags_2.12-0.6.2.jar" "https://repo1.maven.org/maven2/com/lihaoyi/scalatags_2.12/0.6.2/scalatags_2.12-0.6.2.jar"
) )
assert(urls == expectedUrls) assert(expectedUrls.forall(urls))
} }
else else
Future.successful(()) Future.successful(())
@ -925,7 +865,7 @@ abstract class CentralTests extends TestSuite {
* - resolutionCheck(mod, ver, extraRepos = Seq(extraRepo)) * - resolutionCheck(mod, ver, extraRepos = Seq(extraRepo))
* - withArtifacts(mod, ver, "*", extraRepos = Seq(extraRepo), transitive = true) { artifacts => * - withArtifacts(mod, ver, Attributes("aar"), extraRepos = Seq(extraRepo), transitive = true) { artifacts =>
val urls = artifacts.map(_.url).toSet val urls = artifacts.map(_.url).toSet
val expectedUrls = Set( val expectedUrls = Set(
"https://maven.google.com/com/android/support/support-fragment/25.3.1/support-fragment-25.3.1.aar", "https://maven.google.com/com/android/support/support-fragment/25.3.1/support-fragment-25.3.1.aar",
@ -964,7 +904,7 @@ abstract class CentralTests extends TestSuite {
* - { * - {
if (isActualCentral) if (isActualCentral)
withArtifacts(mod, ver, "*", extraRepos = extraRepos, transitive = true) { artifacts => withArtifacts(mod, ver, Attributes("jar"), extraRepos = extraRepos, transitive = true) { artifacts =>
val urls = artifacts.map(_.url).toSet val urls = artifacts.map(_.url).toSet
val expectedUrls = Set( val expectedUrls = Set(
"https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceRelease/com/cedarsoftware/json-io/4.9.9-TALEND/json-io-4.9.9-TALEND.jar", "https://artifacts-oss.talend.com/nexus/content/repositories/TalendOpenSourceRelease/com/cedarsoftware/json-io/4.9.9-TALEND/json-io-4.9.9-TALEND.jar",