Merge branch '3.2.x' into 3.3.x
This commit is contained in:
		
						commit
						7b4f57c23f
					
				| 
						 | 
				
			
			@ -21,6 +21,7 @@ import java.util.Collections;
 | 
			
		|||
import java.util.LinkedHashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.function.Function;
 | 
			
		||||
 | 
			
		||||
import org.junit.jupiter.api.Test;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -193,11 +194,11 @@ class AntoraAsciidocAttributesTests {
 | 
			
		|||
 | 
			
		||||
	@Test
 | 
			
		||||
	void urlLinksFromLibrary() {
 | 
			
		||||
		Map<String, Link> links = new LinkedHashMap<>();
 | 
			
		||||
		links.put("site", new Link((version) -> "https://example.com/site/" + version, null));
 | 
			
		||||
		links.put("docs", new Link((version) -> "https://example.com/docs/" + version, null));
 | 
			
		||||
		links.put("javadoc", new Link((version) -> "https://example.com/api/" + version,
 | 
			
		||||
				List.of("org.springframework.[core|util]")));
 | 
			
		||||
		Map<String, List<Link>> links = new LinkedHashMap<>();
 | 
			
		||||
		links.put("site", singleLink((version) -> "https://example.com/site/" + version));
 | 
			
		||||
		links.put("docs", singleLink((version) -> "https://example.com/docs/" + version));
 | 
			
		||||
		links.put("javadoc",
 | 
			
		||||
				singleLink((version) -> "https://example.com/api/" + version, "org.springframework.[core|util]"));
 | 
			
		||||
		Library library = mockLibrary(links);
 | 
			
		||||
		AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes("1.2.3.1-SNAPSHOT", false,
 | 
			
		||||
				BuildType.OPEN_SOURCE, List.of(library), mockDependencyVersions(), null);
 | 
			
		||||
| 
						 | 
				
			
			@ -209,6 +210,11 @@ class AntoraAsciidocAttributesTests {
 | 
			
		|||
			.containsEntry("javadoc-location-org-springframework-util", "{url-spring-framework-javadoc}");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private List<Link> singleLink(Function<LibraryVersion, String> factory, String... packages) {
 | 
			
		||||
		Link link = new Link(null, factory, List.of(packages));
 | 
			
		||||
		return List.of(link);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
	void linksFromProperties() {
 | 
			
		||||
		Map<String, String> attributes = new AntoraAsciidocAttributes("1.2.3-SNAPSHOT", true, BuildType.OPEN_SOURCE,
 | 
			
		||||
| 
						 | 
				
			
			@ -221,7 +227,7 @@ class AntoraAsciidocAttributesTests {
 | 
			
		|||
		assertThat(keys.indexOf("include-java")).isLessThan(keys.indexOf("code-spring-boot-latest"));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private Library mockLibrary(Map<String, Link> links) {
 | 
			
		||||
	private Library mockLibrary(Map<String, List<Link>> links) {
 | 
			
		||||
		String name = "Spring Framework";
 | 
			
		||||
		String calendarName = null;
 | 
			
		||||
		LibraryVersion version = new LibraryVersion(DependencyVersion.parse("1.2.3"));
 | 
			
		||||
| 
						 | 
				
			
			@ -254,9 +260,10 @@ class AntoraAsciidocAttributesTests {
 | 
			
		|||
		addMockSpringDataVersion(versions, "spring-data-redis", version);
 | 
			
		||||
		addMockSpringDataVersion(versions, "spring-data-rest-core", version);
 | 
			
		||||
		addMockSpringDataVersion(versions, "spring-data-ldap", version);
 | 
			
		||||
		addMockJacksonVersion(versions, "jackson-annotations", version);
 | 
			
		||||
		addMockJacksonVersion(versions, "jackson-core", version);
 | 
			
		||||
		addMockJacksonVersion(versions, "jackson-databind", version);
 | 
			
		||||
		addMockJacksonCoreVersion(versions, "jackson-annotations", version);
 | 
			
		||||
		addMockJacksonCoreVersion(versions, "jackson-core", version);
 | 
			
		||||
		addMockJacksonCoreVersion(versions, "jackson-databind", version);
 | 
			
		||||
		versions.put("com.fasterxml.jackson.dataformat:jackson-dataformat-xml", version);
 | 
			
		||||
		return versions;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -264,7 +271,7 @@ class AntoraAsciidocAttributesTests {
 | 
			
		|||
		versions.put("org.springframework.data:" + artifactId, version);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private void addMockJacksonVersion(Map<String, String> versions, String artifactId, String version) {
 | 
			
		||||
	private void addMockJacksonCoreVersion(Map<String, String> versions, String artifactId, String version) {
 | 
			
		||||
		versions.put("com.fasterxml.jackson.core:" + artifactId, version);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,7 +49,7 @@ class LibraryTests {
 | 
			
		|||
		VersionAlignment versionAlignment = null;
 | 
			
		||||
		String alignsWithBom = null;
 | 
			
		||||
		String linkRootName = null;
 | 
			
		||||
		Map<String, Link> links = Collections.emptyMap();
 | 
			
		||||
		Map<String, List<Link>> links = Collections.emptyMap();
 | 
			
		||||
		Library library = new Library(name, calendarName, version, groups, prohibitedVersion, considerSnapshots,
 | 
			
		||||
				versionAlignment, alignsWithBom, linkRootName, links);
 | 
			
		||||
		assertThat(library.getLinkRootName()).isEqualTo("spring-framework");
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +66,7 @@ class LibraryTests {
 | 
			
		|||
		VersionAlignment versionAlignment = null;
 | 
			
		||||
		String alignsWithBom = null;
 | 
			
		||||
		String linkRootName = "spring-data";
 | 
			
		||||
		Map<String, Link> links = Collections.emptyMap();
 | 
			
		||||
		Map<String, List<Link>> links = Collections.emptyMap();
 | 
			
		||||
		Library library = new Library(name, calendarName, version, groups, prohibitedVersion, considerSnapshots,
 | 
			
		||||
				versionAlignment, alignsWithBom, linkRootName, links);
 | 
			
		||||
		assertThat(library.getLinkRootName()).isEqualTo("spring-data");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,7 +58,7 @@ class TestFailuresPluginIntegrationTests {
 | 
			
		|||
			.buildAndFail();
 | 
			
		||||
		assertThat(readLines(result.getOutput())).containsSequence("Found test failures in 1 test task:", "", ":test",
 | 
			
		||||
				"    example.ExampleTests > bad()", "    example.ExampleTests > fail()",
 | 
			
		||||
				"    example.MoreTests > bad()", "    example.MoreTests > fail()", "");
 | 
			
		||||
				"    example.MoreTests > bad()", "    example.MoreTests > fail()");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
| 
						 | 
				
			
			@ -72,7 +72,7 @@ class TestFailuresPluginIntegrationTests {
 | 
			
		|||
			.buildAndFail();
 | 
			
		||||
		assertThat(readLines(result.getOutput())).containsSequence("Found test failures in 1 test task:", "",
 | 
			
		||||
				":project-one:test", "    example.ExampleTests > bad()", "    example.ExampleTests > fail()",
 | 
			
		||||
				"    example.MoreTests > bad()", "    example.MoreTests > fail()", "");
 | 
			
		||||
				"    example.MoreTests > bad()", "    example.MoreTests > fail()");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
| 
						 | 
				
			
			@ -88,7 +88,7 @@ class TestFailuresPluginIntegrationTests {
 | 
			
		|||
				":project-one:test", "    example.ExampleTests > bad()", "    example.ExampleTests > fail()",
 | 
			
		||||
				"    example.MoreTests > bad()", "    example.MoreTests > fail()", "", ":project-two:test",
 | 
			
		||||
				"    example.ExampleTests > bad()", "    example.ExampleTests > fail()",
 | 
			
		||||
				"    example.MoreTests > bad()", "    example.MoreTests > fail()", "");
 | 
			
		||||
				"    example.MoreTests > bad()", "    example.MoreTests > fail()");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Test
 | 
			
		||||
| 
						 | 
				
			
			@ -104,7 +104,7 @@ class TestFailuresPluginIntegrationTests {
 | 
			
		|||
				":project-one:test", "    example.ExampleTests > bad()", "    example.ExampleTests > fail()",
 | 
			
		||||
				"    example.MoreTests > bad()", "    example.MoreTests > fail()", "", ":project-two:test",
 | 
			
		||||
				"    example.ExampleTests > bad()", "    example.ExampleTests > fail()",
 | 
			
		||||
				"    example.MoreTests > bad()", "    example.MoreTests > fail()", "");
 | 
			
		||||
				"    example.MoreTests > bad()", "    example.MoreTests > fail()");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private void createProject(File dir) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue