Home / Function/ whenJarIsLayeredThenLayersIndexIsPresentAndCorrect() — spring-boot Function Reference

whenJarIsLayeredThenLayersIndexIsPresentAndCorrect() — spring-boot Function Reference

Architecture documentation for the whenJarIsLayeredThenLayersIndexIsPresentAndCorrect() function in AbstractBootArchiveTests.java from the spring-boot codebase.

Entity Profile

Dependency Diagram

graph TD
  f1401408_a756_dace_a255_79bc239f6fe4["whenJarIsLayeredThenLayersIndexIsPresentAndCorrect()"]
  96c4b496_9f3d_2ce6_2029_4842dfa4cf12["createLayeredJar()"]
  f1401408_a756_dace_a255_79bc239f6fe4 -->|calls| 96c4b496_9f3d_2ce6_2029_4842dfa4cf12
  5645c4d4_f43b_2768_d537_d5683623dc04["getEntryNames()"]
  f1401408_a756_dace_a255_79bc239f6fe4 -->|calls| 5645c4d4_f43b_2768_d537_d5683623dc04
  14a9479e_f689_cb74_2d3b_06e566c5caa6["entryLines()"]
  f1401408_a756_dace_a255_79bc239f6fe4 -->|calls| 14a9479e_f689_cb74_2d3b_06e566c5caa6
  b82502c5_6ffe_1f68_515e_cde48522c0a9["getLayerNames()"]
  f1401408_a756_dace_a255_79bc239f6fe4 -->|calls| b82502c5_6ffe_1f68_515e_cde48522c0a9
  style f1401408_a756_dace_a255_79bc239f6fe4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

build-plugin/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/bundling/AbstractBootArchiveTests.java lines 479–518

	@Test
	void whenJarIsLayeredThenLayersIndexIsPresentAndCorrect() throws IOException {
		try (JarFile jarFile = new JarFile(createLayeredJar())) {
			List<String> entryNames = getEntryNames(jarFile);
			assertThat(entryNames).contains(this.libPath + "first-library.jar", this.libPath + "second-library.jar",
					this.libPath + "third-library-SNAPSHOT.jar", this.libPath + "first-project-library.jar",
					this.libPath + "second-project-library-SNAPSHOT.jar",
					this.classesPath + "com/example/Application.class", this.classesPath + "application.properties",
					this.classesPath + "static/test.css");
			List<String> index = entryLines(jarFile, this.indexPath + "layers.idx");
			assertThat(getLayerNames(index)).containsExactly("dependencies", "spring-boot-loader",
					"snapshot-dependencies", "application");
			String toolsJar = this.libPath + JarModeLibrary.TOOLS.getName();
			List<String> expected = new ArrayList<>();
			expected.add("- \"dependencies\":");
			expected.add("  - \"" + this.libPath + "first-library.jar\"");
			expected.add("  - \"" + this.libPath + "first-project-library.jar\"");
			expected.add("  - \"" + this.libPath + "fourth-library.jar\"");
			expected.add("  - \"" + this.libPath + "second-library.jar\"");
			if (!toolsJar.contains("SNAPSHOT")) {
				expected.add("  - \"" + toolsJar + "\"");
			}
			expected.add("- \"spring-boot-loader\":");
			expected.add("  - \"org/\"");
			expected.add("- \"snapshot-dependencies\":");
			expected.add("  - \"" + this.libPath + "second-project-library-SNAPSHOT.jar\"");
			if (toolsJar.contains("SNAPSHOT")) {
				expected.add("  - \"" + toolsJar + "\"");
			}
			expected.add("  - \"" + this.libPath + "third-library-SNAPSHOT.jar\"");
			expected.add("- \"application\":");
			Set<String> applicationContents = new TreeSet<>();
			applicationContents.add("  - \"" + this.classesPath + "\"");
			applicationContents.add("  - \"" + this.indexPath + "classpath.idx\"");
			applicationContents.add("  - \"" + this.indexPath + "layers.idx\"");
			applicationContents.add("  - \"META-INF/\"");
			expected.addAll(applicationContents);
			assertThat(index).containsExactlyElementsOf(expected);
		}
	}

Domain

Subdomains

Frequently Asked Questions

What does whenJarIsLayeredThenLayersIndexIsPresentAndCorrect() do?
whenJarIsLayeredThenLayersIndexIsPresentAndCorrect() is a function in the spring-boot codebase.
What does whenJarIsLayeredThenLayersIndexIsPresentAndCorrect() call?
whenJarIsLayeredThenLayersIndexIsPresentAndCorrect() calls 4 function(s): createLayeredJar, entryLines, getEntryNames, getLayerNames.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free