Skip to content

Commit

Permalink
#56 Improve documentation
Browse files Browse the repository at this point in the history
move examples from unit tests to AsciiDoc
  • Loading branch information
oliverlietz committed Aug 26, 2023
1 parent ee61f45 commit 58e6c4b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 72 deletions.
36 changes: 36 additions & 0 deletions documentation/modules/ROOT/pages/examples.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
= Examples

'''

[,java]
----
InputStream inputStream = bundle()
.activator(HelloWorldActivator.class)
.add(HelloWorld.class)
.add(HelloWorldImpl.class)
.add(DsService.class)
.symbolicName("Hello World Bundle")
.set(Constants.EXPORT_PACKAGE, "")
.set(Constants.IMPORT_PACKAGE, "*")
.build(bndBuilder());
----
- Setting `Bundle-Activator` and `Bundle-SymbolicName` via dedicated methods
- Adding a service with Declarative Services component annotations
- Building with bnd builder
'''
[,java]
----
InputStream inputStream = bundle()
.add(HelloWorldActivator.class)
.add(HelloWorld.class)
.add(HelloWorldImpl.class)
.set(Constants.BUNDLE_SYMBOLICNAME, "Hello World Bundle")
.set(Constants.EXPORT_PACKAGE, "demo")
.set(Constants.IMPORT_PACKAGE, "demo")
.set(Constants.BUNDLE_ACTIVATOR, HelloWorldActivator.class.getName())
.build(rawBuilder());
----
- Setting `Bundle-Activator` and `Bundle-SymbolicName` manually
- Building with raw builder
2 changes: 2 additions & 0 deletions documentation/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ import static org.ops4j.pax.tinybundles.TinyBundles.bundle;
----
InputStream inputStream = bundle.build();
----

See xref:examples.adoc[] for more detailed examples showing usage of fluent API.
72 changes: 0 additions & 72 deletions src/test/java/org/ops4j/pax/tinybundles/Examples.java

This file was deleted.

0 comments on commit 58e6c4b

Please sign in to comment.