-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
52 additions
and
2 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
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
34 changes: 34 additions & 0 deletions
34
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,34 @@ | ||
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>(); | ||
params.put(Constants.FRAMEWORK_STORAGE, System.getProperty("felix.cache.dir")); | ||
|
||
Framework framework = new Felix(params); | ||
framework.init(); | ||
framework.start(); | ||
|
||
BundleContext context = framework.getBundleContext(); | ||
File bundleFile = new File(System.getProperty("felix.bundle.path")); | ||
|
||
Bundle bundle = context.installBundle(bundleFile.toURI().toString()); | ||
bundle.start(); | ||
|
||
assertEquals(Bundle.ACTIVE, bundle.getState()); | ||
} | ||
} |