diff --git a/modules/core/jvm/src/test/resources/sample-jackson-databind-ivy.xml b/modules/core/jvm/src/test/resources/sample-jackson-databind-ivy.xml new file mode 100644 index 0000000000..20e64d3ed2 --- /dev/null +++ b/modules/core/jvm/src/test/resources/sample-jackson-databind-ivy.xml @@ -0,0 +1,96 @@ + + + + + + General data-binding functionality for Jackson: works on core streaming API + + com.fasterxml.jackson.databind.cfg + ${basedir}/src/main/java/${packageVersion.dir}/PackageVersion.java.in + +com.fasterxml.jackson.databind, +com.fasterxml.jackson.databind.annotation, +com.fasterxml.jackson.databind.cfg, +com.fasterxml.jackson.databind.deser, +com.fasterxml.jackson.databind.deser.impl, +com.fasterxml.jackson.databind.deser.std, +com.fasterxml.jackson.databind.exc, +com.fasterxml.jackson.databind.ext, +com.fasterxml.jackson.databind.introspect, +com.fasterxml.jackson.databind.jsonschema, +com.fasterxml.jackson.databind.jsonFormatVisitors, +com.fasterxml.jackson.databind.jsontype, +com.fasterxml.jackson.databind.jsontype.impl, +com.fasterxml.jackson.databind.module, +com.fasterxml.jackson.databind.node, +com.fasterxml.jackson.databind.ser, +com.fasterxml.jackson.databind.ser.impl, +com.fasterxml.jackson.databind.ser.std, +com.fasterxml.jackson.databind.type, +com.fasterxml.jackson.databind.util + + yyyy-MM-dd HH:mm:ssZ + lines,source,vars + 2.5.3 + 1.6 + 1g + com/fasterxml/jackson/databind/cfg + ${project.build.directory}/generated-sources + 4.11 + 1.6 + ${generatedSourcesDir}/${packageVersion.dir}/PackageVersion.java + 12bd2520ece5c53158e35c31779da1bc750a867f + +com.fasterxml.jackson.annotation, +com.fasterxml.jackson.core, +com.fasterxml.jackson.core.base, +com.fasterxml.jackson.core.format, +com.fasterxml.jackson.core.json, +com.fasterxml.jackson.core.io, +com.fasterxml.jackson.core.util, +com.fasterxml.jackson.core.type, +org.xml.sax,org.w3c.dom, org.w3c.dom.bootstrap, org.w3c.dom.ls, +javax.xml.datatype, javax.xml.namespace, javax.xml.parsers + + org.apache.maven.plugins__maven-enforcer-plugin__1.3.1|org.apache.maven.plugins__maven-compiler-plugin__3.2|org.codehaus.mojo__build-helper-maven-plugin__null|org.apache.maven.plugins__maven-surefire-plugin__2.17|org.apache.felix__maven-bundle-plugin__2.5.3|org.apache.maven.plugins__maven-jar-plugin__2.5|null__maven-site-plugin__null|org.apache.maven.plugins__maven-scm-plugin__1.9.1|org.apache.maven.plugins__maven-enforcer-plugin__1.3.1|org.apache.maven.plugins__maven-compiler-plugin__3.2|org.codehaus.mojo__build-helper-maven-plugin__null|org.apache.maven.plugins__maven-surefire-plugin__2.17|org.apache.felix__maven-bundle-plugin__2.5.3|org.apache.maven.plugins__maven-jar-plugin__2.5|null__maven-site-plugin__null|org.apache.maven.plugins__maven-scm-plugin__1.9.1|org.apache.maven.plugins__maven-enforcer-plugin__1.3.1|org.apache.maven.plugins__maven-compiler-plugin__3.2|org.codehaus.mojo__build-helper-maven-plugin__null|org.apache.maven.plugins__maven-surefire-plugin__2.17|org.apache.felix__maven-bundle-plugin__2.5.3|org.apache.maven.plugins__maven-jar-plugin__2.5|null__maven-site-plugin__null|org.apache.maven.plugins__maven-scm-plugin__1.9.1|org.apache.maven.plugins__maven-enforcer-plugin__1.3.1|org.apache.maven.plugins__maven-compiler-plugin__3.2|org.codehaus.mojo__build-helper-maven-plugin__null|org.apache.maven.plugins__maven-surefire-plugin__2.17|org.apache.felix__maven-bundle-plugin__2.5.3|org.apache.maven.plugins__maven-jar-plugin__2.5|null__maven-site-plugin__null|org.apache.maven.plugins__maven-scm-plugin__1.9.1|org.apache.maven.plugins__maven-surefire-plugin__2.17|org.apache.maven.plugins__maven-javadoc-plugin__2.8.1|com.google.code.maven-replacer-plugin__replacer__null + 2.5 + 2.17 + UTF-8 + 1.5.2 + UTF-8 + ${range;[===,=+);${@}} + 2.5.1 + UTF-8 + 2.5.0 + 2.8.1 + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/core/jvm/src/test/scala/coursier/ivy/IvyParserTests.scala b/modules/core/jvm/src/test/scala/coursier/ivy/IvyParserTests.scala new file mode 100644 index 0000000000..165be115f3 --- /dev/null +++ b/modules/core/jvm/src/test/scala/coursier/ivy/IvyParserTests.scala @@ -0,0 +1,49 @@ +package coursier.ivy + +import java.io.File + +import coursier.core._ +import utest._ +import java.nio.file.Files +import scala.util.Using +import scala.io.Source +import scala.util._ + +object IvyParserTests extends TestSuite { + val ivyXmlPath = Option(getClass.getResource("/sample-jackson-databind-ivy.xml")) + .map(u => new File(u.toURI).getAbsolutePath) + .getOrElse { + throw new Exception("sample-jackson-databind-ivy.xml resource not found") + } + + val ivyXmlFile = new File(ivyXmlPath) + + val result = Using(Source.fromFile(ivyXmlFile)) { bufferedSource => + val contents = bufferedSource.getLines() + .map(line => s"$line\n") + .mkString + + compatibility.xmlParse(contents) + } match { + case Failure(exception) => throw exception + case Success(Left(parseError)) => throw new IllegalArgumentException(parseError) + case Success(Right(xmlNode)) => xmlNode + } + + val tests: Tests = Tests { + test("project can be parsed") { + val success = IvyXml.project(result) + assert(success.isRight) + } + + test("licenses are available") { + val success = IvyXml.project(result) + assert(success.isRight) + val project = success.toOption.get + assert(project.info.licenseInfo.exists(license => + license.name == "The Apache Software License, Version 2.0" && + license.url == Some("http://www.apache.org/licenses/LICENSE-2.0.txt") + )) + } + } +}