-
Notifications
You must be signed in to change notification settings - Fork 325
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable bootdelegation for atlassian products (#345)
- Loading branch information
1 parent
93779a8
commit e6de679
Showing
2 changed files
with
49 additions
and
6 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
38 changes: 38 additions & 0 deletions
38
apm-agent-core/src/test/java/co/elastic/apm/bci/OsgiBootDelegationEnablerTest.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,38 @@ | ||
package co.elastic.apm.bci; | ||
|
||
import co.elastic.apm.impl.ElasticApmTracer; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.Mockito.mock; | ||
|
||
class OsgiBootDelegationEnablerTest { | ||
|
||
private final OsgiBootDelegationEnabler osgiBootDelegationEnabler = new OsgiBootDelegationEnabler(); | ||
|
||
@BeforeEach | ||
@AfterEach | ||
void clearState() { | ||
System.clearProperty("org.osgi.framework.bootdelegation"); | ||
System.clearProperty("atlassian.org.osgi.framework.bootdelegation"); | ||
} | ||
|
||
@Test | ||
void testBootdelegation() { | ||
osgiBootDelegationEnabler.start(mock(ElasticApmTracer.class)); | ||
assertThat(System.getProperties()) | ||
.containsEntry("org.osgi.framework.bootdelegation", "co.elastic.apm.*") | ||
.containsEntry("atlassian.org.osgi.framework.bootdelegation", "co.elastic.apm.*"); | ||
} | ||
|
||
@Test | ||
void testBootdelegationWithExistingProperty() { | ||
System.setProperty("org.osgi.framework.bootdelegation", "foo.bar"); | ||
osgiBootDelegationEnabler.start(mock(ElasticApmTracer.class)); | ||
assertThat(System.getProperties()) | ||
.containsEntry("org.osgi.framework.bootdelegation", "foo.bar,co.elastic.apm.*") | ||
.containsEntry("atlassian.org.osgi.framework.bootdelegation", "co.elastic.apm.*"); | ||
} | ||
} |