-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial test for Felix OSGi implementation
- Loading branch information
Showing
5 changed files
with
47 additions
and
1 deletion.
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
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
36 changes: 36 additions & 0 deletions
36
semconv/src/test/java/io/opentelemetry/semconv/OSGiBundleTest.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,36 @@ | ||
package io.opentelemetry.semconv; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import java.io.File; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.apache.felix.framework.Felix; | ||
import org.junit.jupiter.api.Test; | ||
import org.osgi.framework.Bundle; | ||
import org.osgi.framework.BundleContext; | ||
import org.osgi.framework.BundleException; | ||
import org.osgi.framework.Constants; | ||
import org.osgi.framework.launch.Framework; | ||
|
||
class OSGiBundleTest { | ||
@Test | ||
void bundleIsActive() throws BundleException { | ||
Map<String,String> params = new HashMap<String, String>(); | ||
// FIXME: do not use hardcoded build path | ||
params.put(Constants.FRAMEWORK_STORAGE, "build"); | ||
|
||
Framework framework = new Felix(params); | ||
framework.init(); | ||
framework.start(); | ||
|
||
BundleContext context = framework.getBundleContext(); | ||
// FIXME: do not use hardcoded bundle path | ||
File bundleFile = new File("build/libs/opentelemetry-semconv-1.27.0-alpha-SNAPSHOT.jar"); | ||
|
||
Bundle bundle = context.installBundle(bundleFile.toURI().toString()); | ||
bundle.start(); | ||
|
||
assertEquals(Bundle.ACTIVE, bundle.getState()); | ||
} | ||
} |