Skip to content
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
19 changes: 8 additions & 11 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 1.8
uses: actions/setup-java@v3
- uses: actions/checkout@v5
- name: Set up JDK 21
uses: actions/setup-java@v5
with:
java-version: 8
java-version: 21
distribution: temurin

- name: build and test cadc-app-kit
run: cd cadc-app-kit && ../gradlew --info clean build javadoc checkstyleMain install

- name: build and test cadc-download-manager
run: cd cadc-download-manager && ../gradlew --info clean build javadoc checkstyleMain install

- name: build and test cadc-upload-manager
run: cd cadc-upload-manager && ../gradlew --info clean build javadoc checkstyleMain install

- name: build and test cadc-download-manager-server
run: cd cadc-download-manager-server && ../gradlew --info clean build javadoc checkstyleMain install
run: cd cadc-download-manager-server && ../gradlew --info clean build javadoc checkstyleMain install

- name: build and test downloadManager application
run: cd downloadManager && ../gradlew --info clean build javadoc checkstyleMain
7 changes: 5 additions & 2 deletions cadc-app-kit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id 'java'
id 'maven'
id 'maven-publish'
id 'checkstyle'
}
Expand All @@ -12,7 +11,11 @@ repositories {

version = '1.0.1'
group = 'org.opencadc'
sourceCompatibility = 1.8

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

description = 'OpenCADC Swing App Kit'
def git_url = 'https://github.com/opencadc/apps'
Expand Down
10 changes: 6 additions & 4 deletions cadc-download-manager-server/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id 'java'
id 'maven'
id 'maven-publish'
id 'checkstyle'
}
Expand All @@ -12,17 +11,20 @@ repositories {

version = '1.6.0'
group = 'org.opencadc'
sourceCompatibility = 1.8

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

description = 'OpenCADC DownloadManager server library'
def git_url = 'https://github.com/opencadc/apps'



dependencies {
implementation 'javax.servlet:javax.servlet-api:[3.1,)'

implementation 'org.opencadc:cadc-app-kit:[1.0,)'
implementation 'org.opencadc:cadc-cdp:[1.4.0,2.0.0)'
implementation 'org.opencadc:cadc-dali:[1.2.15,)'
implementation 'org.opencadc:cadc-download-manager:[1.5.0,)'
implementation 'org.opencadc:cadc-log:[1.0,)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ protected void doPost(HttpServletRequest request, HttpServletResponse response)

private String getToken(final Subject subject) throws Exception {
final LocalAuthority localAuthority = new LocalAuthority();
final URI oAuthServiceURI = localAuthority.getServiceURI(Standards.SECURITY_METHOD_OPENID.toString());
final URI oAuthServiceURI = localAuthority.getResourceID(Standards.SECURITY_METHOD_OPENID);
final RegistryClient registryClient = new RegistryClient();
final URL baseOAuthServiceURL = registryClient.getServiceURL(oAuthServiceURI, Standards.SECURITY_METHOD_OPENID,
AuthMethod.COOKIE);
Expand Down
6 changes: 4 additions & 2 deletions cadc-download-manager/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
plugins {
id 'java'
id 'maven'
id 'maven-publish'
id 'application'
id 'checkstyle'
Expand All @@ -13,7 +12,10 @@ repositories {

version = '1.5.2'
group = 'org.opencadc'
sourceCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

description = 'OpenCADC DownloadManager client'
def git_url = 'https://github.com/opencadc/apps'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

package ca.nrc.cadc.dlm;

import ca.nrc.cadc.dali.DoubleInterval;
import ca.nrc.cadc.dali.Interval;
import ca.nrc.cadc.dali.Shape;
import java.net.URI;

Expand All @@ -79,7 +79,7 @@ public class DownloadTuple {

// These values can all be null
public Shape posCutout;
public DoubleInterval bandCutout;
public Interval<Double> bandCutout;
public String pixelCutout;
public String label;

Expand All @@ -106,7 +106,7 @@ public DownloadTuple(URI id) {
* @param pixelCutout (Optional) String to be used for pixel cutout (passed through without validation)
* @param label (Optional) sent as LABEL parameter to SODA calls
*/
public DownloadTuple(URI id, Shape posCutout, DoubleInterval bandCutout, String pixelCutout, String label) {
public DownloadTuple(URI id, Shape posCutout, Interval<Double> bandCutout, String pixelCutout, String label) {
if (id == null) {
throw new IllegalArgumentException("id can not be null");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import ca.nrc.cadc.caom2.artifact.resolvers.CadcResolver;
import ca.nrc.cadc.dali.Circle;
import ca.nrc.cadc.dali.DoubleInterval;
import ca.nrc.cadc.dali.Interval;
import ca.nrc.cadc.dali.Point;
import ca.nrc.cadc.dali.Polygon;
import ca.nrc.cadc.dlm.DownloadDescriptor;
Expand All @@ -41,13 +42,16 @@
import ca.nrc.cadc.util.Log4jInit;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;

/**
Expand All @@ -59,11 +63,19 @@ public class CadcDownloadGeneratorTest {
Log4jInit.setLevel("ca.nrc.cadc.dlm.handlers", Level.DEBUG);
}

URL baseURL;
@Before
public void setUp() {
System.setProperty(RegistryClient.class.getName() + ".host", "ws.cadc-ccda.hia-iha.nrc-cnrc.gc.ca");
}

@After
public void tearDown() {
System.clearProperty(RegistryClient.class.getName() + ".host");
}

public CadcDownloadGeneratorTest() {
private static URL getBaseURL() {
final RegistryClient rc = new RegistryClient();
this.baseURL = rc.getServiceURL(CadcResolver.STORAGE_INVENTORY_URI, Standards.SI_FILES, AuthMethod.ANON);
return rc.getServiceURL(CadcResolver.STORAGE_INVENTORY_URI, Standards.SI_FILES, AuthMethod.ANON);
}

@Test
Expand All @@ -78,6 +90,7 @@ public void testURL() {
Assert.assertTrue(descriptorIterator.hasNext());

final DownloadDescriptor dd = descriptorIterator.next();
final URL baseURL = CadcDownloadGeneratorTest.getBaseURL();

Assert.assertEquals("uri", uri.toASCIIString(), dd.uri);
Assert.assertEquals("protocol", baseURL.getProtocol(), dd.url.getProtocol());
Expand Down Expand Up @@ -110,6 +123,7 @@ public void testURLPlusSUBCutout() {
log.debug(dd.status);
Assert.assertEquals(DownloadDescriptor.OK, dd.status);

final URL baseURL = CadcDownloadGeneratorTest.getBaseURL();
Assert.assertEquals("uri", uri.toASCIIString(), dd.uri);
Assert.assertEquals("protocol", baseURL.getProtocol(), dd.url.getProtocol());
Assert.assertEquals("hostname", baseURL.getHost(), dd.url.getHost());
Expand Down Expand Up @@ -141,6 +155,8 @@ public void testURLPlusCIRCLECutout() {
log.debug(dd.status);
Assert.assertEquals(DownloadDescriptor.OK, dd.status);

final URL baseURL = CadcDownloadGeneratorTest.getBaseURL();

Assert.assertEquals("uri", uri.toASCIIString(), dd.uri);
Assert.assertEquals("protocol", baseURL.getProtocol(), dd.url.getProtocol());
Assert.assertEquals("hostname", baseURL.getHost(), dd.url.getHost());
Expand All @@ -162,7 +178,7 @@ public void testURLPlusBANDAndPOLYGONCutout() {
final URI uri = URI.create("cadc:archiveName/file_1.fits");

final DownloadTuple dt = new DownloadTuple(uri);
dt.bandCutout = new DoubleInterval(14.6D, 64.1D);
dt.bandCutout = new Interval<>(14.6D, 64.1D);

final Polygon polygon = new Polygon();
polygon.getVertices().add(new Point(10.0D, 10.0D));
Expand All @@ -180,6 +196,8 @@ public void testURLPlusBANDAndPOLYGONCutout() {
log.debug(dd.status);
Assert.assertEquals(DownloadDescriptor.OK, dd.status);

final URL baseURL = CadcDownloadGeneratorTest.getBaseURL();

Assert.assertEquals("uri", uri.toASCIIString(), dd.uri);
Assert.assertEquals("protocol", baseURL.getProtocol(), dd.url.getProtocol());
Assert.assertEquals("hostname", baseURL.getHost(), dd.url.getHost());
Expand Down Expand Up @@ -219,10 +237,6 @@ public void testIllegalScheme() {
}

private static String encodeString(String str) {
try {
return URLEncoder.encode(str, "UTF-8");
} catch (UnsupportedEncodingException ignore) {
}
return null;
return URLEncoder.encode(str, StandardCharsets.UTF_8);
}
}
6 changes: 6 additions & 0 deletions downloadManager/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM images.opencadc.org/library/cadc-tomcat:1.4

# Clear out the webapps directory.
RUN rm -rf webapps/*

COPY build/libs/*.war /usr/share/tomcat/webapps/
14 changes: 14 additions & 0 deletions downloadManager/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

known issues:

"gradle clean build" fails because something done in the configuration phase gets wiped by the clean

build always unzips and signs the jnlp jar files

work around: do the clean and build as separate commands

Running integration tests requires:
- valid test certificates (in $A/test-certificates)
- valid servops.pem
- valid ca.crt file

9 changes: 9 additions & 0 deletions downloadManager/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## deployable containers have a semantic and build tag
# version tag: major.minor.patch
# build version tag: timestamp
# tags with and without build number so operators use the versioned
# tag but we always keep a timestamped tag in case a semantic tag gets
# replaced accidentally
VER=1.6.0
TAGS="${VER} ${VER}-$(date -u +"%Y%m%dT%H%M%S")"
unset VER
72 changes: 72 additions & 0 deletions downloadManager/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
plugins {
id 'war'
id 'checkstyle'
}

repositories {
mavenCentral()
mavenLocal()
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

dependencies {
providedCompile 'javax.servlet:javax.servlet-api:3.1.+'

implementation 'org.apache.commons:commons-configuration2:[2.7,3.0)'
implementation 'org.apache.commons:commons-lang3:[3.18,4.0)'
implementation 'org.opencadc:cadc-access-control-identity:[1.1.0,2.0)'
implementation 'org.opencadc:cadc-dali:[1.2.15,2.0)'
implementation 'org.opencadc:cadc-download-manager-server:[1.6.0,)'
implementation 'org.opencadc:cadc-log:[1.1.1,)'
implementation 'org.opencadc:cadc-util:[1.6.0,2.0)'

runtimeOnly 'org.opencadc:cadc-access-control-identity:[1.1.0,)'
runtimeOnly 'org.opencadc:cadc-download-manager:1.5.2'
runtimeOnly 'jstl:jstl:1.2'

testImplementation 'org.opencadc:cadc-download-manager:1.5.2'
testImplementation 'junit:junit:4.+'
}

ext {
intTest_default_web_app_url = 'https://rc-www.cadc-ccda.hia-iha.nrc-cnrc.gc.ca'
intTest_default_web_app_endpoint = '/download'
}

war {
from(file('build/tmp')) {
include 'codebase/*.jar'
}
}

tasks.register('duplicateENWar', Copy) {
from 'build/libs/downloadManager.war'
into 'build/libs'
rename('downloadManager.war', 'en#download.war')
}

tasks.register('duplicateFRWar', Copy) {
from 'build/libs/downloadManager.war'
into 'build/libs'
rename('downloadManager.war', 'fr#telecharger.war')
}

configurations {
intTestImplementation.extendsFrom testImplementation
intTestRuntime.extendsFrom testRuntime
}

tasks.register('compileDeps', DependencyReportTask) {
configurations = [project.configurations.implementation] as Set
}

duplicateFRWar.dependsOn(duplicateENWar)

build.finalizedBy(duplicateENWar, duplicateFRWar)
assemble.finalizedBy(duplicateENWar, duplicateFRWar)

apply from: '../opencadc.gradle'
Loading