diff --git a/src/test/java/rife/bld/dependencies/TestXml2MavenMetadata.java b/src/test/java/rife/bld/dependencies/TestXml2MavenMetadata.java new file mode 100644 index 0000000..d3b5d83 --- /dev/null +++ b/src/test/java/rife/bld/dependencies/TestXml2MavenMetadata.java @@ -0,0 +1,41 @@ +/* + * Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com) + * Licensed under the Apache License, Version 2.0 (the "License") + */ +package rife.bld.dependencies; + +import org.junit.jupiter.api.Test; +import rife.resources.ResourceFinderClasspath; +import rife.resources.exceptions.ResourceFinderErrorException; + +import static org.junit.jupiter.api.Assertions.*; + +public class TestXml2MavenMetadata { + @Test + void testInstantiation() { + var metadata = new Xml2MavenMetadata(); + assertNotNull(metadata); + } + + @Test + void testParse1() + throws ResourceFinderErrorException { + var resource_finder = ResourceFinderClasspath.instance(); + var metadata = new Xml2MavenMetadata(); + assertTrue(metadata.processXml(resource_finder.getContent("maven-metadata1.txt"))); + assertEquals(metadata.getLatest(), new VersionNumber(1, 1, 1, "SNAPSHOT")); + assertEquals(metadata.getRelease(), VersionNumber.UNKNOWN); + assertEquals(metadata.getSnapshot(), new VersionNumber(1, 1, 1, "SNAPSHOT")); + } + + @Test + void testParse2() + throws ResourceFinderErrorException { + var resource_finder = ResourceFinderClasspath.instance(); + var metadata = new Xml2MavenMetadata(); + assertTrue(metadata.processXml(resource_finder.getContent("maven-metadata2.txt"))); + assertEquals(metadata.getLatest(), new VersionNumber(1, 1, 1, "SNAPSHOT")); + assertEquals(metadata.getRelease(), VersionNumber.UNKNOWN); + assertEquals(metadata.getSnapshot(), new VersionNumber(1, 1, 1, "SNAPSHOT")); + } +} diff --git a/src/test/resources/maven-metadata1.txt b/src/test/resources/maven-metadata1.txt new file mode 100644 index 0000000..103847c --- /dev/null +++ b/src/test/resources/maven-metadata1.txt @@ -0,0 +1,68 @@ + + + net.thauvin.erik + pinboard-poster + 1.1.1-SNAPSHOT + + 20231019093409 + + true + + + + javadoc + jar.asc + 1.1.1-SNAPSHOT + 20231019093409 + + + module + 1.1.1-SNAPSHOT + 20231019093409 + + + module.asc + 1.1.1-SNAPSHOT + 20231019093409 + + + jar + 1.1.1-SNAPSHOT + 20231019093409 + + + javadoc + jar + 1.1.1-SNAPSHOT + 20231019093409 + + + pom + 1.1.1-SNAPSHOT + 20231019093409 + + + pom.asc + 1.1.1-SNAPSHOT + 20231019093409 + + + sources + jar.asc + 1.1.1-SNAPSHOT + 20231019093409 + + + sources + jar + 1.1.1-SNAPSHOT + 20231019093409 + + + jar.asc + 1.1.1-SNAPSHOT + 20231019093409 + + + + diff --git a/src/test/resources/maven-metadata2.txt b/src/test/resources/maven-metadata2.txt new file mode 100644 index 0000000..de092f1 --- /dev/null +++ b/src/test/resources/maven-metadata2.txt @@ -0,0 +1,68 @@ + + + net.thauvin.erik + pinboard-poster + + 20231019093409 + + true + + + + javadoc + jar.asc + 1.1.1-SNAPSHOT + 20231019093409 + + + module + 1.1.1-SNAPSHOT + 20231019093409 + + + module.asc + 1.1.1-SNAPSHOT + 20231019093409 + + + jar + 1.1.1-SNAPSHOT + 20231019093409 + + + javadoc + jar + 1.1.1-SNAPSHOT + 20231019093409 + + + pom + 1.1.1-SNAPSHOT + 20231019093409 + + + pom.asc + 1.1.1-SNAPSHOT + 20231019093409 + + + sources + jar.asc + 1.1.1-SNAPSHOT + 20231019093409 + + + sources + jar + 1.1.1-SNAPSHOT + 20231019093409 + + + jar.asc + 1.1.1-SNAPSHOT + 20231019093409 + + + + 1.1.1-SNAPSHOT +