Skip to content

Commit

Permalink
Added tests for Xml2MetaData snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
gbevin committed Oct 19, 2023
1 parent 85f2c8f commit 6230db6
Show file tree
Hide file tree
Showing 3 changed files with 177 additions and 0 deletions.
41 changes: 41 additions & 0 deletions src/test/java/rife/bld/dependencies/TestXml2MavenMetadata.java
Original file line number Diff line number Diff line change
@@ -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"));
}
}
68 changes: 68 additions & 0 deletions src/test/resources/maven-metadata1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
<groupId>net.thauvin.erik</groupId>
<artifactId>pinboard-poster</artifactId>
<version>1.1.1-SNAPSHOT</version>
<versioning>
<lastUpdated>20231019093409</lastUpdated>
<snapshot>
<localCopy>true</localCopy>
</snapshot>
<snapshotVersions>
<snapshotVersion>
<classifier>javadoc</classifier>
<extension>jar.asc</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>module</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>module.asc</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>jar</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<classifier>javadoc</classifier>
<extension>jar</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom.asc</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<classifier>sources</classifier>
<extension>jar.asc</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<classifier>sources</classifier>
<extension>jar</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>jar.asc</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>
68 changes: 68 additions & 0 deletions src/test/resources/maven-metadata2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata modelVersion="1.1.0">
<groupId>net.thauvin.erik</groupId>
<artifactId>pinboard-poster</artifactId>
<versioning>
<lastUpdated>20231019093409</lastUpdated>
<snapshot>
<localCopy>true</localCopy>
</snapshot>
<snapshotVersions>
<snapshotVersion>
<classifier>javadoc</classifier>
<extension>jar.asc</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>module</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>module.asc</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>jar</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<classifier>javadoc</classifier>
<extension>jar</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>pom.asc</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<classifier>sources</classifier>
<extension>jar.asc</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<classifier>sources</classifier>
<extension>jar</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
<snapshotVersion>
<extension>jar.asc</extension>
<value>1.1.1-SNAPSHOT</value>
<updated>20231019093409</updated>
</snapshotVersion>
</snapshotVersions>
</versioning>
<version>1.1.1-SNAPSHOT</version>
</metadata>

0 comments on commit 6230db6

Please sign in to comment.