Skip to content

Commit

Permalink
Correct property name
Browse files Browse the repository at this point in the history
Signed-off-by: jansupol <jan.supol@oracle.com>
  • Loading branch information
jansupol committed Feb 15, 2024
1 parent d6fc6e3 commit ad9dee8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class JerseySystemPropertiesConfigurationModel extends SystemPropertiesConfigura
"org.glassfish.jersey.servlet.ServletProperties",
"org.glassfish.jersey.message.MessageProperties",
"org.glassfish.jersey.apache.connector.ApacheClientProperties",
"org.glassfish.jersey.apache5.connector.ApacheClientProperties",
"org.glassfish.jersey.apache5.connector.Apache5ClientProperties",
"org.glassfish.jersey.helidon.connector.HelidonClientProperties",
"org.glassfish.jersey.jdk.connector.JdkConnectorProperties",
"org.glassfish.jersey.jetty.connector.JettyClientProperties",
Expand Down
24 changes: 0 additions & 24 deletions tests/integration/property-check/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,28 +113,4 @@
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>jdk19+</id>
<activation>
<jdk>[19,)</jdk>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/SystemPropertiesConfigurationModelTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,13 @@ public void allPropertyClassLoaded() throws IOException {
@Test
public void propertyLoadedWhenSecurityException() {
final String TEST_STRING = "test";
SecurityManager sm = System.getSecurityManager();
String policy = System.getProperty("java.security.policy");
final boolean isSm = JdkVersion.getJdkVersion().getMajor() < 19;
SecurityManager sm = null;
String policy = null;
if (isSm) {
sm = System.getSecurityManager();
policy = System.getProperty("java.security.policy");
}
try {
System.setProperty(CommonProperties.ALLOW_SYSTEM_PROPERTIES_PROVIDER, Boolean.TRUE.toString());
System.setProperty(ServerProperties.APPLICATION_NAME, TEST_STRING);
Expand All @@ -95,10 +100,14 @@ public void propertyLoadedWhenSecurityException() {
System.setProperty(OAuth1ServerProperties.REALM, TEST_STRING);
JerseySystemPropertiesConfigurationModel model = new JerseySystemPropertiesConfigurationModel();
assertTrue(model.as(CommonProperties.ALLOW_SYSTEM_PROPERTIES_PROVIDER, Boolean.class));
String securityPolicy = SystemPropertiesConfigurationModelTest.class.getResource("/server.policy").getFile();
System.setProperty("java.security.policy", securityPolicy);
SecurityManager manager = new SecurityManager();
System.setSecurityManager(manager);

if (isSm) {
String securityPolicy = SystemPropertiesConfigurationModelTest.class.getResource("/server.policy").getFile();
System.setProperty("java.security.policy", securityPolicy);
SecurityManager manager = new SecurityManager();
System.setSecurityManager(manager);
}

Map<String, Object> properties = model.getProperties();
assertEquals(TEST_STRING, properties.get(ServerProperties.APPLICATION_NAME));
assertEquals(Boolean.TRUE.toString(), properties.get(CommonProperties.ALLOW_SYSTEM_PROPERTIES_PROVIDER));
Expand All @@ -124,7 +133,9 @@ public void propertyLoadedWhenSecurityException() {
if (policy != null) {
System.setProperty("java.security.policy", policy);
}
System.setSecurityManager(sm);
if (isSm) {
System.setSecurityManager(sm);
}
}
}

Expand Down

0 comments on commit ad9dee8

Please sign in to comment.