Skip to content

Commit

Permalink
Java 17 and Camel Update (#6797)
Browse files Browse the repository at this point in the history
  • Loading branch information
clockard authored Aug 26, 2024
1 parent 8c803e4 commit d65e6eb
Show file tree
Hide file tree
Showing 30 changed files with 424 additions and 312 deletions.
14 changes: 7 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pipeline {
DOCS = 'distribution/docs'
ITESTS = 'distribution/test/itests'
ITCORE = 'distribution/test/itests/test-itests-ddf-core'
LARGE_MVN_OPTS = '-Xmx4G -Xms1G -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC '
LARGE_MVN_OPTS = '-Xmx4G -Xms1G -XX:+ClassUnloadingWithConcurrentMark '
DISABLE_DOWNLOAD_PROGRESS_OPTS = '-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn '
LINUX_MVN_RANDOM = '-Djava.security.egd=file:/dev/./urandom'
COVERAGE_EXCLUSIONS = '**/test/**/*,**/itests/**/*,**/*Test*,**/sdk/**/*,**/*.js,**/node_modules/**/*,**/jaxb/**/*,**/wsdl/**/*,**/nces/sws/**/*,**/*.adoc,**/*.txt,**/*.xml'
Expand Down Expand Up @@ -66,7 +66,7 @@ pipeline {
timeout(time: 3, unit: 'HOURS')
}
steps {
withMaven(maven: 'maven-latest', jdk: 'jdk11', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LARGE_MVN_OPTS} ${LINUX_MVN_RANDOM}') {
withMaven(maven: 'maven-latest', jdk: 'jdk17', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LARGE_MVN_OPTS} ${LINUX_MVN_RANDOM}') {
sh 'mvn install -B -DskipStatic=true -DskipTests=true $DISABLE_DOWNLOAD_PROGRESS_OPTS'
sh 'mvn clean install -B -P !itests -Dgib.enabled=true -Dgib.referenceBranch=/refs/remotes/origin/$CHANGE_TARGET $DISABLE_DOWNLOAD_PROGRESS_OPTS'
}
Expand All @@ -82,7 +82,7 @@ pipeline {
timeout(time: 3, unit: 'HOURS')
}
steps {
withMaven(maven: 'maven-latest', jdk: 'jdk11', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LARGE_MVN_OPTS} ${LINUX_MVN_RANDOM}') {
withMaven(maven: 'maven-latest', jdk: 'jdk17', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LARGE_MVN_OPTS} ${LINUX_MVN_RANDOM}') {
sh 'mvn clean install -B -P !itests $DISABLE_DOWNLOAD_PROGRESS_OPTS'
}
}
Expand All @@ -93,7 +93,7 @@ pipeline {
timeout(time: 1, unit: 'HOURS')
}
steps {
withMaven(maven: 'maven-latest', jdk: 'jdk11', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LARGE_MVN_OPTS} ${LINUX_MVN_RANDOM}') {
withMaven(maven: 'maven-latest', jdk: 'jdk17', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LARGE_MVN_OPTS} ${LINUX_MVN_RANDOM}') {
sh '''
unset JAVA_TOOL_OPTIONS
mvn install -B -pl $ITCORE -nsu $DISABLE_DOWNLOAD_PROGRESS_OPTS
Expand All @@ -104,7 +104,7 @@ pipeline {

stage('Dependency Check') {
steps {
withMaven(maven: 'maven-latest', jdk: 'jdk11', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LARGE_MVN_OPTS} ${LINUX_MVN_RANDOM}') {
withMaven(maven: 'maven-latest', jdk: 'jdk17', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LARGE_MVN_OPTS} ${LINUX_MVN_RANDOM}') {
script {
// If this build is not a pull request, run owasp scan on the distribution. Otherwise run incremental scan
if (env.CHANGE_ID == null) {
Expand Down Expand Up @@ -135,7 +135,7 @@ pipeline {
}
}
steps{
withMaven(maven: 'maven-latest', jdk: 'jdk11', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LINUX_MVN_RANDOM}') {
withMaven(maven: 'maven-latest', jdk: 'jdk17', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LINUX_MVN_RANDOM}') {
sh 'mvn deploy -B -DskipStatic=true -DskipTests=true -DretryFailedDeploymentCount=10 $DISABLE_DOWNLOAD_PROGRESS_OPTS'
}
}
Expand All @@ -153,7 +153,7 @@ pipeline {
//catchError trap added here to prevent job failure when SonarCloud analysis upload fails
catchError(buildResult: null, stageResult: 'FAILURE', message: 'SonarCloud Analysis upload failed') {
// -DskipITs is temporary to skip all the tests that were failing at the time. See https://github.com/codice/ddf/issues/5777
withMaven(maven: 'maven-latest', jdk: 'jdk11', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LARGE_MVN_OPTS} ${LINUX_MVN_RANDOM}') {
withMaven(maven: 'maven-latest', jdk: 'jdk17', globalMavenSettingsConfig: 'default-global-settings', mavenSettingsConfig: 'codice-maven-settings', mavenOpts: '${LARGE_MVN_OPTS} ${LINUX_MVN_RANDOM}') {
script {
sh 'mvn -q -B -DskipITs -Dcheckstyle.skip=true org.jacoco:jacoco-maven-plugin:prepare-agent sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN -Dsonar.organization=codice -Dsonar.projectKey=ddf -Dsonar.exclusions=${COVERAGE_EXCLUSIONS} -pl !$DOCS -P !itests $DISABLE_DOWNLOAD_PROGRESS_OPTS'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ public SystemSubjectBinder(Security security) {
*/
@Override
public void process(Exchange exchange) {
ThreadContext.bind(security.getSystemSubject());
ThreadContext.bind(security.runAsAdmin(security::getSystemSubject));
}
}
}
4 changes: 2 additions & 2 deletions catalog/opensearch/catalog-opensearch-endpoint/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
<name>DDF :: Catalog :: OpenSearch :: Endpoint</name>
<packaging>bundle</packaging>
<properties>
<parboiled.version>1.3.1</parboiled.version>
<parboiled.version>1.4.1</parboiled.version>
<!-- Overriding the asm version from the root pom to stay in sync with parboiled-java -->
<opensearch.asm.version>7.1</opensearch.asm.version>
<opensearch.asm.version>9.2</opensearch.asm.version>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class OpenSearchEndpointSpec extends Specification {
getQueryParameters() >> Mock(MultivaluedMap) {
get(_) >> null
}
getRequestUri() >> new URI()
getRequestUri() >> URI.create("http://localhost")
},
null,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.Optional;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
Expand All @@ -46,6 +47,7 @@ public class SchematronValidationServiceTest {

@Before
public void setup() throws IOException {
System.setProperty("ddf.home", "./");
URL src = SchematronValidationServiceTest.class.getClassLoader().getResource("dog_legs.sch");
fileWithSpaces =
Paths.get(testFolder.getRoot().getAbsolutePath())
Expand All @@ -55,6 +57,11 @@ public void setup() throws IOException {
FileUtils.copyURLToFile(src, fileWithSpaces);
}

@After
public void after() {
System.clearProperty("ddf.home");
}

@Test
public void testSingleSchematron()
throws ValidationException, IOException, SchematronInitializationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class CacheCommandTest extends SolrCommandTest {

@Test
public void testCacheClear() throws Exception {
setDdfHome();
setDdfEtc();
SolrClient cloudClient = mock(SolrClient.class);
NamedList<Object> pingStatus = new NamedList<>();
pingStatus.add("status", "OK");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,20 @@
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.util.NamedList;
import org.codice.ddf.security.Security;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;

@RunWith(MockitoJUnitRunner.class)
public class ReindexCommandTest extends SolrCommandTest {

@BeforeClass
public static void beforeClass() {
setDdfHome();
setDdfEtc();
}

@Test(expected = IllegalArgumentException.class)
public void testNoArgReindex() throws Exception {
ReindexCommand reindexCommand = new ReindexCommand();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.util.NamedList;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;

public abstract class SolrCommandTest {
Expand All @@ -51,9 +50,9 @@ public abstract class SolrCommandTest {

protected static final String DEFAULT_DDF_HOME = "/opt/ddf";

@Rule @ClassRule public static TemporaryFolder baseDir = new TemporaryFolder();
@ClassRule public static TemporaryFolder baseDir = new TemporaryFolder();

@Rule @ClassRule public static TemporaryFolder backupLocation = new TemporaryFolder();
@ClassRule public static TemporaryFolder backupLocation = new TemporaryFolder();

protected ConsoleOutput consoleOutput;

Expand Down
2 changes: 1 addition & 1 deletion catalog/spatial/geocoding/spatial-geocoding-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.12.0</version>
<version>1.13.1</version>
<executions>
<execution>
<goals>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ org.osgi.framework.system.packages.extra = \
org.apache.xerces.stax;uses:=\"javax.xml.namespace,javax.xml.stream,javax.xml.stream.events,org.apache.xerces.stax.events\";version=${xerces.version}, \
org.apache.xerces.dom;uses:=\"org.apache.xerces.parsers,org.apache.xerces.dom3.as,org.w3c.dom,org.apache.xerces.impl.xs,org.apache.xerces.xni,org.apache.xerces.impl.dv.xs,org.apache.xerces.impl,org.apache.xerces.impl.dtd,org.apache.xerces.util,org.w3c.dom.ls,org.apache.xml.serialize,org.w3c.dom.events,org.apache.xerces.xni.grammars,org.apache.xerces.xni.parser,org.apache.xerces.impl.validation,org.apache.xerces.impl.dv,org.apache.xerces.impl.msg,org.apache.xerces.impl.xs.util,org.apache.xerces.xs,org.apache.xerces.dom.events,org.w3c.dom.traversal,org.w3c.dom.ranges\";version=${xerces.version}, \
org.apache.xml.serialize;uses:=\"org.apache.xerces.util,org.w3c.dom.ls,org.xml.sax.ext,org.apache.xerces.dom,org.w3c.dom,org.xml.sax,org.apache.xerces.impl,sun.io,org.w3c.dom.html,org.apache.xerces.xni,org.xml.sax.helpers\";version=${xerces.version}, \
javax.activation;version=${jakarta.activation.version}, \
javax.annotation;version=${javax.annotation-api.version}, \
javax.annotation.security;version=${javax.annotation-api.version}, \
javax.annotation.sql;version=${javax.annotation-api.version}, \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ size = 500
# Previous pattern:
# %d{ABSOLUTE} | %-5.5p | %-16.16t | %-32.32c{1} | %-32.32C %4L | %X{bundle.id} - %X{bundle.name} - %X{bundle.version} | %m%n
#
pattern = %d{ABSOLUTE} | %-5.5p | %-16.16t | %-40.40C %4L | %-20.20X{bundle.name} | %m%n
pattern = %d{ABSOLUTE} | %-5.5p | %-16.16t | %-40.40C %4L | %-20.20X{bundle.name} | {%m}%n
2 changes: 1 addition & 1 deletion distribution/docker/ddf-docker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

<properties>
<!-- Set the version of the codice/ddf-base docker image to build on top of here -->
<docker.ddf.base.version>2.27-alpine</docker.ddf.base.version>
<docker.ddf.base.version>2.29-alpine</docker.ddf.base.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.xml.HasXPath.hasXPath;

import dev.failsafe.Failsafe;
import dev.failsafe.RetryPolicy;
import io.restassured.filter.log.LogDetail;
import io.restassured.response.Response;
import io.restassured.response.ValidatableResponse;
import java.io.IOException;
import java.time.Duration;
import java.util.function.Supplier;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.xml.xpath.XPathExpressionException;
Expand Down Expand Up @@ -162,6 +166,16 @@ public static String ingestXmlFromResourceAndWait(String resourceName) {
return id[0];
}

public static <T> T retryAssertionErrorCall(Supplier<T> call, int retries, int waitPeriodSec) {
return Failsafe.with(
RetryPolicy.<T>builder()
.handle(AssertionError.class)
.withMaxRetries(retries)
.withDelay(Duration.ofSeconds(waitPeriodSec))
.build())
.get(call::get);
}

/**
* Does a wildcard search and verifies that one of the results is a metacard with the given id.
* This doesn't query directly on the metacard id because that query can return the metacard
Expand Down
6 changes: 0 additions & 6 deletions distribution/test/itests/test-itests-ddf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,6 @@
<version>${pax.exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-spi</artifactId>
<version>${pax.exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ public void testCswXmlWithHeaderIngest() {
}

@Test
@Ignore("https://github.com/codice/ddf/issues/6798")
public void testCswUtmQuery() {
Response response = ingestXmlViaCsw();
response.then();
Expand Down Expand Up @@ -693,22 +694,28 @@ public void testCswCQLFunctionQuery() {
public void testCswFunctionQuery() {
String id = ingest(getFileContent("metacard5.xml"), "text/xml");
try {
given()
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML)
.body(
getCswFunctionQuery(
"metadata",
true,
"application/xml",
"http://www.opengis.net/cat/csw/2.0.2",
"proximity",
2,
"All Hail Our SysAdmin"))
.post(CSW_PATH.getUrl())
.then()
.assertThat()
.statusCode(equalTo(200))
.body(hasXPath("/GetRecordsResponse/SearchResults[@numberOfRecordsReturned]"), not("0"));
CatalogTestCommons.retryAssertionErrorCall(
() ->
given()
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_XML)
.body(
getCswFunctionQuery(
"metadata",
true,
"application/xml",
"http://www.opengis.net/cat/csw/2.0.2",
"proximity",
2,
"All Hail Our SysAdmin"))
.post(CSW_PATH.getUrl())
.then()
.assertThat()
.statusCode(equalTo(200))
.body(
hasXPath("/GetRecordsResponse/SearchResults[@numberOfRecordsReturned]"),
not("0")),
3,
1);
} finally {
delete(id);
}
Expand Down Expand Up @@ -1511,6 +1518,7 @@ public void testVideoThumbnail() throws Exception {
}

@Test
@Ignore("https://github.com/codice/ddf/issues/6798")
public void testPptxTumbnail() throws Exception {
final String file = "testPPT.pptx";

Expand Down Expand Up @@ -1538,6 +1546,7 @@ public void testPptxTumbnail() throws Exception {
}

@Test
@Ignore("https://github.com/codice/ddf/issues/6798")
public void testContentDirectoryMonitor() throws Exception {
final String TMP_PREFIX = "tcdm_";
Path tmpDir = Files.createTempDirectory(TMP_PREFIX);
Expand Down
Loading

0 comments on commit d65e6eb

Please sign in to comment.