Skip to content

Commit

Permalink
Add testcase for a signed artifact and remove entries from manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed Feb 9, 2025
1 parent 82f9917 commit 5633b56
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,28 @@ public void testSourceWithSignature() throws Exception {
assertTrue("No source bundle generated!", sourcesFound);
}

@Test
public void testArtifactWithSignature() throws Exception {
ITargetLocation target = resolveMavenTarget(
"""
<location includeDependencyDepth="none" includeDependencyScopes="compile" label="verapdf" includeSource="true" missingManifest="generate" type="Maven">
<dependencies>
<dependency>
<groupId>org.verapdf</groupId>
<artifactId>core</artifactId>
<version>1.26.5</version>
</dependency>
</dependencies>
</location>
""");
assertStatusOk(getTargetStatus(target));
TargetBundle[] allBundles = target.getBundles();
for (TargetBundle targetBundle : allBundles) {
assertValidSignature(targetBundle);
}
assertTrue("No bundle generated!", allBundles.length > 0);
}

@Test
public void testBadDependencyDirect() throws Exception {
ITargetLocation target = resolveMavenTarget("""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,12 @@ private static WrappedBundle getWrappedNode(DependencyNode node,
analyzer.addClasspath(depJar);
analyzer.removeClose(depJar);
}
analyzerJar.setManifest(analyzer.calcManifest());
Manifest manifest = analyzer.calcManifest();
Map<String, Attributes> entries = manifest.getEntries();
if (entries != null) {
entries.clear();
}
analyzerJar.setManifest(manifest);
analyzerJar.write(wrapArtifactFile);
for (String err : analyzer.getErrors()) {
if (err.contains("Classes found in the wrong directory")) {
Expand Down

0 comments on commit 5633b56

Please sign in to comment.