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

whenJarIsLayeredWithCustomStrategiesThenLayersIndexIsPresentAndCorrect() — spring-boot Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  4b7ce582_88c3_a92b_fe9a_eddfdc546fdb["whenJarIsLayeredWithCustomStrategiesThenLayersIndexIsPresentAndCorrect()"]
  96c4b496_9f3d_2ce6_2029_4842dfa4cf12["createLayeredJar()"]
  4b7ce582_88c3_a92b_fe9a_eddfdc546fdb -->|calls| 96c4b496_9f3d_2ce6_2029_4842dfa4cf12
  5645c4d4_f43b_2768_d537_d5683623dc04["getEntryNames()"]
  4b7ce582_88c3_a92b_fe9a_eddfdc546fdb -->|calls| 5645c4d4_f43b_2768_d537_d5683623dc04
  14a9479e_f689_cb74_2d3b_06e566c5caa6["entryLines()"]
  4b7ce582_88c3_a92b_fe9a_eddfdc546fdb -->|calls| 14a9479e_f689_cb74_2d3b_06e566c5caa6
  b82502c5_6ffe_1f68_515e_cde48522c0a9["getLayerNames()"]
  4b7ce582_88c3_a92b_fe9a_eddfdc546fdb -->|calls| b82502c5_6ffe_1f68_515e_cde48522c0a9
  style 4b7ce582_88c3_a92b_fe9a_eddfdc546fdb 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 520–570

	@Test
	void whenJarIsLayeredWithCustomStrategiesThenLayersIndexIsPresentAndCorrect() throws IOException {
		File jar = createLayeredJar((layered) -> {
			layered.application((application) -> {
				application.intoLayer("resources", (spec) -> spec.include("static/**"));
				application.intoLayer("application");
			});
			layered.dependencies((dependencies) -> {
				dependencies.intoLayer("my-snapshot-deps", (spec) -> spec.include("com.example:*:*.SNAPSHOT"));
				dependencies.intoLayer("my-internal-deps", (spec) -> spec.include("com.example:*:*"));
				dependencies.intoLayer("my-deps");
			});
			layered.getLayerOrder()
				.set(List.of("my-deps", "my-internal-deps", "my-snapshot-deps", "resources", "application"));
		});
		try (JarFile jarFile = new JarFile(jar)) {
			List<String> entryNames = getEntryNames(jar);
			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("my-deps", "my-internal-deps", "my-snapshot-deps",
					"resources", "application");
			String toolsJar = this.libPath + JarModeLibrary.TOOLS.getName();
			List<String> expected = new ArrayList<>();
			expected.add("- \"my-deps\":");
			expected.add("  - \"" + toolsJar + "\"");
			expected.add("- \"my-internal-deps\":");
			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\"");
			expected.add("- \"my-snapshot-deps\":");
			expected.add("  - \"" + this.libPath + "second-project-library-SNAPSHOT.jar\"");
			expected.add("  - \"" + this.libPath + "third-library-SNAPSHOT.jar\"");
			expected.add("- \"resources\":");
			expected.add("  - \"" + this.classesPath + "static/\"");
			expected.add("- \"application\":");
			Set<String> applicationContents = new TreeSet<>();
			applicationContents.add("  - \"" + this.classesPath + "application.properties\"");
			applicationContents.add("  - \"" + this.classesPath + "com/\"");
			applicationContents.add("  - \"" + this.indexPath + "classpath.idx\"");
			applicationContents.add("  - \"" + this.indexPath + "layers.idx\"");
			applicationContents.add("  - \"META-INF/\"");
			applicationContents.add("  - \"org/\"");
			expected.addAll(applicationContents);
			assertThat(index).containsExactlyElementsOf(expected);
		}
	}

Domain

Subdomains

Frequently Asked Questions

What does whenJarIsLayeredWithCustomStrategiesThenLayersIndexIsPresentAndCorrect() do?
whenJarIsLayeredWithCustomStrategiesThenLayersIndexIsPresentAndCorrect() is a function in the spring-boot codebase.
What does whenJarIsLayeredWithCustomStrategiesThenLayersIndexIsPresentAndCorrect() call?
whenJarIsLayeredWithCustomStrategiesThenLayersIndexIsPresentAndCorrect() 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