Skip to content

Commit 52e87dc

Browse files
committed
Basic application manifesting tests
1 parent 765e1b2 commit 52e87dc

File tree

11 files changed

+578
-25
lines changed

11 files changed

+578
-25
lines changed
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
package io.quarkus.deployment.runnerjar;
2+
3+
import java.util.Properties;
4+
5+
import org.junit.jupiter.api.BeforeEach;
6+
7+
import io.quarkus.bootstrap.resolver.TsArtifact;
8+
import io.quarkus.bootstrap.resolver.TsQuarkusExt;
9+
import io.quarkus.sbom.ApplicationComponent;
10+
11+
public class ApplicationManifestFastJarTest extends ApplicationManifestTestBase {
12+
13+
@Override
14+
protected TsArtifact composeApplication() {
15+
16+
var acmeTransitive = TsArtifact.jar("acme-transitive");
17+
18+
var acmeCommon = TsArtifact.jar("acme-common")
19+
.addDependency(acmeTransitive);
20+
21+
var acmeLib = TsArtifact.jar("acme-lib")
22+
.addDependency(acmeCommon);
23+
24+
var otherLib = TsArtifact.jar("other-lib");
25+
otherLib.addDependency(acmeCommon);
26+
27+
var myLib = TsArtifact.jar("my-lib");
28+
myLib.addDependency(acmeCommon);
29+
30+
var myExt = new TsQuarkusExt("my-ext");
31+
myExt.getRuntime().addDependency(myLib);
32+
myExt.getDeployment().addDependency(otherLib);
33+
34+
return TsArtifact.jar("app")
35+
.addManagedDependency(platformDescriptor())
36+
.addManagedDependency(platformProperties())
37+
.addDependency(acmeLib)
38+
.addDependency(otherLib)
39+
.addDependency(myExt);
40+
}
41+
42+
@Override
43+
protected Properties buildSystemProperties() {
44+
var props = new Properties();
45+
props.setProperty("quarkus.package.jar.type", "fast-jar");
46+
return props;
47+
}
48+
49+
@BeforeEach
50+
public void initExpectedComponents() {
51+
52+
expectMavenComponent(artifactCoords("app"), comp -> {
53+
assertDistributionPath(comp, "app/quarkus-application.jar");
54+
assertDependencies(comp,
55+
artifactCoords("acme-lib"),
56+
artifactCoords("other-lib"),
57+
artifactCoords("my-ext"),
58+
artifactCoords("my-ext-deployment"));
59+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
60+
});
61+
62+
expectMavenComponent(artifactCoords("acme-lib"), comp -> {
63+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.acme-lib-1.jar");
64+
assertDependencies(comp, artifactCoords("acme-common"));
65+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
66+
});
67+
68+
expectMavenComponent(artifactCoords("acme-common"), comp -> {
69+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.acme-common-1.jar");
70+
assertDependencies(comp, artifactCoords("acme-transitive"));
71+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
72+
});
73+
74+
expectMavenComponent(artifactCoords("acme-transitive"), comp -> {
75+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.acme-transitive-1.jar");
76+
assertDependencies(comp);
77+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
78+
});
79+
80+
expectMavenComponent(artifactCoords("other-lib"), comp -> {
81+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.other-lib-1.jar");
82+
assertDependencies(comp, artifactCoords("acme-common"));
83+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
84+
});
85+
86+
expectMavenComponent(artifactCoords("my-lib"), comp -> {
87+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.my-lib-1.jar");
88+
assertDependencies(comp, artifactCoords("acme-common"));
89+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
90+
});
91+
92+
expectMavenComponent(artifactCoords("my-ext"), comp -> {
93+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.my-ext-1.jar");
94+
assertDependencies(comp, artifactCoords("my-lib"));
95+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
96+
});
97+
98+
expectFileComponent("quarkus-run.jar", comp -> {
99+
assertDependencies(comp, artifactCoords("app"));
100+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
101+
});
102+
103+
expectFileComponent("quarkus/generated-bytecode.jar", comp -> {
104+
assertDependencies(comp);
105+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
106+
});
107+
108+
expectFileComponent("quarkus/quarkus-application.dat", comp -> {
109+
assertDependencies(comp);
110+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
111+
});
112+
113+
expectFileComponent("quarkus-app-dependencies.txt", comp -> {
114+
assertDependencies(comp);
115+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
116+
});
117+
118+
expectMavenComponent(artifactCoords("my-ext-deployment"), comp -> {
119+
assertNoDistributionPath(comp);
120+
assertDependencies(comp,
121+
artifactCoords("my-ext"),
122+
artifactCoords("other-lib"));
123+
assertDependencyScope(comp, ApplicationComponent.SCOPE_DEVELOPMENT);
124+
});
125+
}
126+
}
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
package io.quarkus.deployment.runnerjar;
2+
3+
import java.util.Properties;
4+
5+
import org.junit.jupiter.api.BeforeEach;
6+
7+
import io.quarkus.bootstrap.resolver.TsArtifact;
8+
import io.quarkus.bootstrap.resolver.TsQuarkusExt;
9+
import io.quarkus.sbom.ApplicationComponent;
10+
11+
public class ApplicationManifestMutableJarTest extends ApplicationManifestTestBase {
12+
13+
@Override
14+
protected TsArtifact composeApplication() {
15+
16+
var acmeTransitive = TsArtifact.jar("acme-transitive");
17+
18+
var acmeCommon = TsArtifact.jar("acme-common")
19+
.addDependency(acmeTransitive);
20+
21+
var acmeLib = TsArtifact.jar("acme-lib")
22+
.addDependency(acmeCommon);
23+
24+
var otherLib = TsArtifact.jar("other-lib");
25+
otherLib.addDependency(acmeCommon);
26+
27+
var myLib = TsArtifact.jar("my-lib");
28+
myLib.addDependency(acmeCommon);
29+
30+
var myExt = new TsQuarkusExt("my-ext");
31+
myExt.getRuntime().addDependency(myLib);
32+
myExt.getDeployment().addDependency(otherLib);
33+
34+
return TsArtifact.jar("app")
35+
.addManagedDependency(platformDescriptor())
36+
.addManagedDependency(platformProperties())
37+
.addDependency(acmeLib)
38+
.addDependency(otherLib)
39+
.addDependency(myExt);
40+
}
41+
42+
@Override
43+
protected Properties buildSystemProperties() {
44+
var props = new Properties();
45+
props.setProperty("quarkus.package.jar.type", "mutable-jar");
46+
return props;
47+
}
48+
49+
@BeforeEach
50+
public void initExpectedComponents() {
51+
expectMavenComponent(artifactCoords("app"), comp -> {
52+
assertDistributionPath(comp, "app/quarkus-application.jar");
53+
assertDependencies(comp,
54+
artifactCoords("acme-lib"),
55+
artifactCoords("other-lib"),
56+
artifactCoords("my-ext"),
57+
artifactCoords("my-ext-deployment"));
58+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
59+
});
60+
61+
expectMavenComponent(artifactCoords("acme-lib"), comp -> {
62+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.acme-lib-1.jar");
63+
assertDependencies(comp, artifactCoords("acme-common"));
64+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
65+
});
66+
67+
expectMavenComponent(artifactCoords("acme-common"), comp -> {
68+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.acme-common-1.jar");
69+
assertDependencies(comp, artifactCoords("acme-transitive"));
70+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
71+
});
72+
73+
expectMavenComponent(artifactCoords("acme-transitive"), comp -> {
74+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.acme-transitive-1.jar");
75+
assertDependencies(comp);
76+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
77+
});
78+
79+
expectMavenComponent(artifactCoords("other-lib"), comp -> {
80+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.other-lib-1.jar");
81+
assertDependencies(comp, artifactCoords("acme-common"));
82+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
83+
});
84+
85+
expectMavenComponent(artifactCoords("my-lib"), comp -> {
86+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.my-lib-1.jar");
87+
assertDependencies(comp, artifactCoords("acme-common"));
88+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
89+
});
90+
91+
expectMavenComponent(artifactCoords("my-ext"), comp -> {
92+
assertDistributionPath(comp, "lib/main/io.quarkus.bootstrap.test.my-ext-1.jar");
93+
assertDependencies(comp, artifactCoords("my-lib"));
94+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
95+
});
96+
97+
expectFileComponent("quarkus-run.jar", comp -> {
98+
assertDependencies(comp, artifactCoords("app"));
99+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
100+
});
101+
102+
expectFileComponent("quarkus/generated-bytecode.jar", comp -> {
103+
assertDependencies(comp);
104+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
105+
});
106+
107+
expectFileComponent("quarkus/quarkus-application.dat", comp -> {
108+
assertDependencies(comp);
109+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
110+
});
111+
112+
expectFileComponent("quarkus-app-dependencies.txt", comp -> {
113+
assertDependencies(comp);
114+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
115+
});
116+
117+
expectFileComponent("quarkus/build-system.properties", comp -> {
118+
assertDependencies(comp);
119+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
120+
});
121+
122+
expectMavenComponent(artifactCoords("my-ext-deployment"), comp -> {
123+
assertDistributionPath(comp, "lib/deployment/io.quarkus.bootstrap.test.my-ext-deployment-1.jar");
124+
assertDependencyScope(comp, ApplicationComponent.SCOPE_DEVELOPMENT);
125+
assertDependencies(comp,
126+
artifactCoords("my-ext"),
127+
artifactCoords("other-lib"));
128+
});
129+
130+
expectFileComponent("lib/deployment/appmodel.dat", comp -> {
131+
assertDependencies(comp);
132+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
133+
});
134+
135+
expectFileComponent("lib/deployment/deployment-class-path.dat", comp -> {
136+
assertDependencies(comp);
137+
assertDependencyScope(comp, ApplicationComponent.SCOPE_RUNTIME);
138+
});
139+
}
140+
}

0 commit comments

Comments
 (0)