|
34 | 34 | import aQute.bnd.build.model.clauses.HeaderClause; |
35 | 35 | import aQute.bnd.build.model.clauses.VersionedClause; |
36 | 36 | import aQute.bnd.build.model.conversions.NoopConverter; |
| 37 | +import aQute.bnd.header.Parameters; |
37 | 38 | import aQute.bnd.help.instructions.ResolutionInstructions.Runorder; |
38 | 39 | import aQute.bnd.osgi.Constants; |
39 | 40 | import aQute.bnd.result.Result; |
@@ -517,24 +518,40 @@ public void testPrintHumanReadableDifference() throws Exception { |
517 | 518 | } |
518 | 519 |
|
519 | 520 | @Test |
520 | | - public void testStartLevelDecoration() throws Exception { |
521 | | - Bndrun bndrun = Bndrun.createBndrun(workspace, IO.getFile(ws.toFile(), "test.simple/resolve.bndrun")); |
| 521 | + public void testStartLevelDecoration(SoftAssertions softly) throws Exception { |
| 522 | + Bndrun bndrun = Bndrun.createBndrun(workspace, IO.getFile(ws.toFile(), "test.simple/resolveduplicates.bndrun")); |
522 | 523 | bndrun.setProperty("-runstartlevel", "order=leastdependenciesfirst,begin=100,step=10"); |
523 | 524 |
|
524 | 525 | // Decorate test.simple to get startlevel 90 (which would otherwise be 110 within the assigned runstartlevel). |
525 | 526 | bndrun.setProperty("-runbundles+", "test.simple;startlevel=90"); |
526 | 527 |
|
527 | 528 | List<? extends HeaderClause> runBundles = List.copyOf(bndrun.resolve(false, false, new NoopConverter<>())); |
528 | 529 |
|
529 | | - assertThat(runBundles).hasSize(2); |
530 | | - assertThat(runBundles.get(0) |
531 | | - .getName()).isEqualTo("osgi.enroute.junit.wrapper"); |
532 | | - assertThat(runBundles.get(0) |
533 | | - .getAttribs()).containsEntry(Constants.RUNBUNDLES_STARTLEVEL_ATTRIBUTE, "100"); |
534 | | - assertThat(runBundles.get(1) |
| 530 | + softly.assertThat(runBundles).hasSize(4); |
| 531 | + softly.assertThat(runBundles.get(0) |
| 532 | + .toString()).isEqualTo("org.apache.felix.gogo.runtime;version='[0.12.0,0.12.1)';startlevel=100"); |
| 533 | + softly.assertThat(runBundles.get(1) |
| 534 | + .toString()).isEqualTo("org.apache.felix.gogo.runtime;version='[0.10.0,0.10.1)';startlevel=110"); |
| 535 | + softly.assertThat(runBundles.get(2) |
| 536 | + .toString()).isEqualTo("osgi.enroute.junit.wrapper;version='[4.12.0,4.12.1)';startlevel=120"); |
| 537 | + |
| 538 | + softly.assertThat(runBundles.get(3) |
535 | 539 | .getName()).isEqualTo("test.simple"); |
536 | | - assertThat(runBundles.get(1) |
| 540 | + softly.assertThat(runBundles.get(3) |
537 | 541 | .getAttribs()).containsEntry(Constants.RUNBUNDLES_STARTLEVEL_ATTRIBUTE, "90"); |
| 542 | + softly.assertThat(runBundles.get(3) |
| 543 | + .toString()).isEqualTo("test.simple;version=snapshot;startlevel=90"); |
| 544 | + |
| 545 | + // check that HeaderClause.toParameters does not remove duplicates |
| 546 | + // this kind of happens inside bndrun.resolve() let's test explicitly |
| 547 | + // again |
| 548 | + Parameters params = HeaderClause.toParameters(runBundles); |
| 549 | + softly.assertThat(params) |
| 550 | + .hasSize(4); |
| 551 | + softly.assertThat(params.toString()) |
| 552 | + .isEqualTo( |
| 553 | + "org.apache.felix.gogo.runtime;version=\"[0.12.0,0.12.1)\";startlevel=100,org.apache.felix.gogo.runtime;version=\"[0.10.0,0.10.1)\";startlevel=110,osgi.enroute.junit.wrapper;version=\"[4.12.0,4.12.1)\";startlevel=120,test.simple;version=snapshot;startlevel=90"); |
| 554 | + |
538 | 555 | } |
539 | 556 |
|
540 | 557 | @SuppressWarnings("resource") |
|
0 commit comments