Skip to content

Java 11 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ '8']
java: [ '8', '11' ]
os: [ 'ubuntu-latest', 'macos-10.15', 'windows-latest' ]
steps:
- uses: actions/checkout@v2
Expand All @@ -37,4 +37,4 @@ jobs:
- name: Build with Maven
env:
MAVEN_OPTS: -Dhttps.protocols=TLSv1.2 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true -Dmaven.wagon.http.retryHandler.count=10
run: mvn --batch-mode --update-snapshots package ${{ steps.maven-profile-flag.outputs.MAVEN_VERIFY_STAGE }} --file pom.xml ${{ steps.maven-profile-flag.outputs.MAVEN_PROFILE_FLAG }}
run: mvn --batch-mode --update-snapshots package ${{ steps.maven-profile-flag.outputs.MAVEN_VERIFY_STAGE }} --file pom.xml ${{ steps.maven-profile-flag.outputs.MAVEN_PROFILE_FLAG }}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
import org.forgerock.openam.authentication.modules.oauth2.service.esia.Signer;
import org.mockito.Matchers;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.testng.PowerMockTestCase;
import org.testng.annotations.Test;

@PrepareForTest(HttpRequestContent.class)
@PowerMockIgnore("jdk.internal.reflect.*")
public class ESIATest extends PowerMockTestCase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/



import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import javax.inject.Inject;
import java.util.Calendar;
import java.util.List;

import org.forgerock.openam.cts.CoreTokenConfig;
import org.forgerock.openam.sm.datalayer.api.ConnectionFactory;
Expand All @@ -28,8 +29,10 @@
import org.forgerock.openam.sm.datalayer.api.query.QueryBuilder;
import org.forgerock.openam.sm.datalayer.api.query.QueryFactory;
import org.forgerock.openam.tokens.CoreTokenField;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.util.Reject;
import org.forgerock.util.query.QueryFilter;
import org.forgerock.util.query.QueryFilterVisitor;

/**
* A query that selects all CTS tokens whose expiry date field is prior to the current timestamp (e.g. who have
Expand All @@ -39,7 +42,7 @@
*/
public class CTSWorkerPastExpiryDateQuery<C> extends CTSWorkerBaseQuery {

private final QueryFactory<C, CoreTokenField> queryFactory;
private final QueryFactory<C, Filter> queryFactory;
private final int pageSize;

@Inject
Expand All @@ -58,8 +61,11 @@ public QueryBuilder getQuery() {

QueryFilter<CoreTokenField> filter = QueryFilter.lessThan(CoreTokenField.EXPIRY_DATE, now);

QueryFilterVisitor<Filter, Void, CoreTokenField> fc = queryFactory.createFilterConverter();

Filter accepted = filter.accept(fc, null);
return queryFactory.createInstance()
.withFilter(filter.accept(queryFactory.createFilterConverter(), null))
.withFilter(accepted)
.pageResultsBy(pageSize)
.returnTheseAttributes(CoreTokenField.TOKEN_ID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.sun.identity.shared.debug.Debug;
import org.forgerock.openam.session.SessionServiceURLService;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.testng.PowerMockTestCase;
import org.testng.annotations.Test;
Expand All @@ -16,6 +17,7 @@
import static org.mockito.Mockito.mock;

@PrepareForTest({ SystemProperties.class, WebtopNaming.class })
@PowerMockIgnore("jdk.internal.reflect.*")
public class SessionServerConfigTest extends PowerMockTestCase {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import com.iplanet.am.util.SystemProperties;
import org.forgerock.opendj.ldap.DN;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.testng.PowerMockTestCase;
import org.testng.annotations.BeforeMethod;
Expand All @@ -33,6 +34,7 @@
* @author [email protected]
*/
@PrepareForTest(SystemProperties.class)
@PowerMockIgnore("jdk.internal.reflect.*")
public class LDAPConfigTest extends PowerMockTestCase {

private LDAPConfig config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.forgerock.openam.cts.impl.CTSDataLayerConfiguration;
import org.forgerock.openam.ldap.LDAPURL;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.testng.PowerMockTestCase;
import org.testng.annotations.BeforeMethod;
Expand All @@ -41,6 +42,7 @@
import com.sun.identity.shared.debug.Debug;

@PrepareForTest({ SystemProperties.class, WebtopNaming.class })
@PowerMockIgnore("jdk.internal.reflect.*")
public class ExternalLdapConfigTest extends PowerMockTestCase {

private Debug debug;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@

import java.util.Collection;
import java.util.Enumeration;
import java.util.NoSuchElementException;
import java.util.Vector;
import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
import sun.misc.CompoundEnumeration;

/**
* {@link ClassLoader} that masks a specified set of classes
Expand Down Expand Up @@ -252,4 +252,37 @@ public synchronized String toString() {
return "com.sun.identity.classloader.MaskingClassLoader : Super is : "
+ super.toString();
}

static class CompoundEnumeration<E> implements Enumeration<E> {
private final Enumeration<E>[] enums;
private int index;

public CompoundEnumeration(Enumeration<E>[] enums) {
this.enums = enums;
}

private boolean next() {
while(this.index < this.enums.length) {
if (this.enums[this.index] != null && this.enums[this.index].hasMoreElements()) {
return true;
}

++this.index;
}

return false;
}

public boolean hasMoreElements() {
return this.next();
}

public E nextElement() {
if (!this.next()) {
throw new NoSuchElementException();
} else {
return this.enums[this.index].nextElement();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import sun.misc.CharacterEncoder;
import com.sun.identity.shared.encode.Base64;
import com.sun.identity.security.DataEncryptor;
import java.security.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ public void onConfigurationChange(final ScriptEngineConfiguration newConfigurati
newConfiguration.getThreadPoolIdleTimeoutSeconds());
}

delegateConfigurator.setCorePoolSize(newConfiguration.getThreadPoolCoreSize());
delegateConfigurator.setMaximumPoolSize(newConfiguration.getThreadPoolMaxSize());
delegateConfigurator.setCorePoolSize(newConfiguration.getThreadPoolCoreSize());
delegateConfigurator.setKeepAliveTime(newConfiguration.getThreadPoolIdleTimeoutSeconds(), TimeUnit.SECONDS);
}

Expand Down
18 changes: 17 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<source>8</source>
<charset>utf-8</charset>
<encoding>utf-8</encoding>
<source>${maven.compiler.source}</source>
Expand Down Expand Up @@ -271,7 +272,7 @@
<profile>
<id>jdk8.options</id>
<activation>
<jdk>[1.8,)</jdk>
<jdk>1.8</jdk>
</activation>
<properties>
<!-- Disable Doclint on JDK8+ -->
Expand All @@ -281,6 +282,20 @@
<!-- JavaDoc Setting Properties -->
<javadoc.options>-J-Xms2g -J-Xmx2g</javadoc.options>
</properties>
</profile>
<profile>
<id>jdk11.options</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<properties>
<!-- Disable Doclint on JDK8+ -->
<javadoc.opts>-Xdoclint:none</javadoc.opts>
<!-- Surefire Argument Line -->
<java.surefire.options>-Xmx1g --add-exports java.base/jdk.internal.ref=ALL-UNNAMED</java.surefire.options>
<!-- JavaDoc Setting Properties -->
<javadoc.options>-J-Xms2g -J-Xmx2g</javadoc.options>
</properties>
</profile>
<profile>
<id>release-sign-artifacts</id>
Expand Down Expand Up @@ -2037,6 +2052,7 @@
</execution>
</executions>
<configuration>
<source>8</source>
<doclint>none</doclint>
</configuration>
</plugin>
Expand Down