-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
CustomManifestArgumentsTest.java
46 lines (34 loc) · 1.66 KB
/
CustomManifestArgumentsTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package io.quarkus.gradle;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.nio.file.Path;
import java.util.jar.Attributes;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
import org.junit.jupiter.api.Test;
public class CustomManifestArgumentsTest extends QuarkusGradleWrapperTestBase {
@Test
public void shouldContainsSpecificManifestProperty() throws Exception {
File projectDir = getProjectDir("custom-config-java-module");
runGradleWrapper(projectDir, "clean", "quarkusBuild");
Path buildDir = new File(projectDir, "build").toPath();
Path jar = buildDir.resolve("code-with-quarkus-1.0.0-SNAPSHOT-runner.jar");
assertThat(jar).exists();
try (InputStream fileInputStream = new FileInputStream(jar.toFile())) {
try (JarInputStream jarStream = new JarInputStream(fileInputStream)) {
Manifest manifest = jarStream.getManifest();
assertThat(manifest).isNotNull();
String customAttribute = manifest.getMainAttributes().getValue("Built-By");
assertThat(customAttribute).isNotNull();
assertThat(customAttribute).isEqualTo("quarkus-gradle-plugin");
Attributes customSection = manifest.getAttributes("org.acme");
assertThat(customSection).isNotNull();
String sectionAttribute = customSection.getValue("framework");
assertThat(sectionAttribute).isNotNull();
assertThat(sectionAttribute).isEqualTo("quarkus");
}
}
}
}