forked from bndtools/bnd
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ProviderType: inheritance + package level
--- Signed-off-by: Peter Kriens <[email protected]> Signed-off-by: Peter Kriens <[email protected]>
- Loading branch information
Showing
6 changed files
with
110 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package aQute.bnd.osgi; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import aQute.bnd.osgi.providertype.TestProviderInheritance; | ||
import aQute.bnd.osgi.providertype.packg.TestProviderInheritancePackage; | ||
import aQute.lib.io.IO; | ||
|
||
class AnalyzerTest { | ||
|
||
/** | ||
* Test provider type inheritance and package | ||
*/ | ||
|
||
@Test | ||
public void testProviderInheritance() throws Exception { | ||
try (Builder outer = new Builder()) { | ||
try (Builder builder = new Builder()) { | ||
builder.addClasspath(IO.getFile("bin_test")); | ||
builder.setProperty("-includepackage", "aQute.bnd.osgi.providertype.*"); | ||
builder.build(); | ||
assertThat(builder.check()).isTrue(); | ||
|
||
assertThat(isProvider(builder, TestProviderInheritance.Top.class)).isTrue(); | ||
assertThat(isProvider(builder, TestProviderInheritance.Middle.class)).isTrue(); | ||
assertThat(isProvider(builder, TestProviderInheritance.Bottom.class)).isTrue(); | ||
assertThat(isProvider(builder, TestProviderInheritance.None.class)).isFalse(); | ||
|
||
assertThat(isProvider(builder, TestProviderInheritancePackage.Top.class)).isTrue(); | ||
assertThat(isProvider(builder, TestProviderInheritancePackage.Middle.class)).isTrue(); | ||
assertThat(isProvider(builder, TestProviderInheritancePackage.Bottom.class)).isTrue(); | ||
assertThat(isProvider(builder, TestProviderInheritancePackage.None.class)).isTrue(); | ||
} | ||
} | ||
} | ||
|
||
private boolean isProvider(Builder builder, Class<?> type) { | ||
return builder.isProvider(builder.getTypeRefFromFQN(type.getName())); | ||
} | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
biz.aQute.bndlib/test/aQute/bnd/osgi/providertype/TestProviderInheritance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package aQute.bnd.osgi.providertype; | ||
|
||
import org.osgi.annotation.versioning.ProviderType; | ||
|
||
public class TestProviderInheritance { | ||
@ProviderType | ||
public static class Top {} | ||
|
||
public static class Middle extends Top {} | ||
|
||
public static class Bottom extends Middle {} | ||
|
||
public static class None {} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
biz.aQute.bndlib/test/aQute/bnd/osgi/providertype/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@Version("1.0.0") | ||
@Export | ||
package aQute.bnd.osgi.providertype; | ||
|
||
import org.osgi.annotation.bundle.Export; | ||
import org.osgi.annotation.versioning.Version; |
12 changes: 12 additions & 0 deletions
12
biz.aQute.bndlib/test/aQute/bnd/osgi/providertype/packg/TestProviderInheritancePackage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package aQute.bnd.osgi.providertype.packg; | ||
|
||
public class TestProviderInheritancePackage { | ||
public static class Top {} | ||
|
||
public static class Middle extends Top {} | ||
|
||
public static class Bottom extends Middle {} | ||
|
||
public static class None {} | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
biz.aQute.bndlib/test/aQute/bnd/osgi/providertype/packg/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@Version("1.0.0") | ||
@Export | ||
@ProviderType | ||
package aQute.bnd.osgi.providertype.packg; | ||
|
||
import org.osgi.annotation.bundle.Export; | ||
import org.osgi.annotation.versioning.ProviderType; | ||
import org.osgi.annotation.versioning.Version; |