From 3dc7e9fd928572fdd1589b00702493eb30609805 Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Tue, 12 Nov 2024 14:27:52 -0800
Subject: [PATCH 01/30] Update Dockerfile
---
backend/Dockerfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index f6ca1795d..925124df2 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -6,6 +6,7 @@ FROM quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:jdk-21 AS build
# Image defaults to /project; copy controlled by .dockerignore
COPY --chown=quarkus:quarkus . ./
+RUN ls -la . && ls -la .. && ls -la backend
RUN chmod +x ./mvnw && ./mvnw package -Pnative -DskipTests
# "A base image to run Quarkus native application using UBI Micro"
From f035670798c5101af5a59c03aede4c052fc6903c Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Tue, 12 Nov 2024 14:31:04 -0800
Subject: [PATCH 02/30] Update Dockerfile
---
backend/Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index 925124df2..02d9288c2 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -6,7 +6,7 @@ FROM quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:jdk-21 AS build
# Image defaults to /project; copy controlled by .dockerignore
COPY --chown=quarkus:quarkus . ./
-RUN ls -la . && ls -la .. && ls -la backend
+COPY ../pom.xml ../pom.xml
RUN chmod +x ./mvnw && ./mvnw package -Pnative -DskipTests
# "A base image to run Quarkus native application using UBI Micro"
From 029f483e0e034f0258869f7c5383fbe350ab4114 Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Tue, 12 Nov 2024 15:49:39 -0800
Subject: [PATCH 03/30] Update openshift-dev.yml
---
.github/workflows/openshift-dev.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/openshift-dev.yml b/.github/workflows/openshift-dev.yml
index 2f668ed46..6744512bd 100644
--- a/.github/workflows/openshift-dev.yml
+++ b/.github/workflows/openshift-dev.yml
@@ -24,6 +24,8 @@ jobs:
- uses: bcgov-nr/action-builder-ghcr@v2.2.0
with:
keep_versions: 50
+ build_context: .
+ build_file: ${{matrix.package}}/Dockerfile
package: ${{ matrix.package }}
tag: ${{ github.event.number }}
tag_fallback: latest
From 1bd74de923c843a7d3ff5324efb134f94910f2b7 Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Tue, 12 Nov 2024 15:52:19 -0800
Subject: [PATCH 04/30] Update Dockerfile for changed context
---
backend/Dockerfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index 02d9288c2..5b59f39fc 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -5,8 +5,8 @@
FROM quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:jdk-21 AS build
# Image defaults to /project; copy controlled by .dockerignore
-COPY --chown=quarkus:quarkus . ./
-COPY ../pom.xml ../pom.xml
+COPY --chown=quarkus:quarkus ./backend ./
+COPY ./pom.xml ./parent-pom.xml
RUN chmod +x ./mvnw && ./mvnw package -Pnative -DskipTests
# "A base image to run Quarkus native application using UBI Micro"
From 6cc49a584c948b0b7d2019679993b99aabbe3810 Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Tue, 12 Nov 2024 15:56:14 -0800
Subject: [PATCH 05/30] Update Dockerfile for new context
---
frontend/Dockerfile | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/frontend/Dockerfile b/frontend/Dockerfile
index d25b7367c..78fd27150 100644
--- a/frontend/Dockerfile
+++ b/frontend/Dockerfile
@@ -1,12 +1,12 @@
# Build static files
# Node Bullseye has npm
FROM node:20.17.0-bullseye-slim AS build
-
+ARG CONTEXT="./frontend"
# Install packages, build and keep only prod packages
WORKDIR /app
-COPY *.json *.ts index.html ./
-COPY public ./public
-COPY ./src ./src
+COPY ${CONTEXT}/*.json *.ts index.html ./
+COPY ${CONTEXT}/public ./public
+COPY ${CONTEXT}/src ./src
RUN npm ci --ignore-scripts --no-update-notifier --omit=dev && \
npm run build-only
@@ -20,7 +20,7 @@ RUN apk add --no-cache ca-certificates && \
# Copy static files and run formatting
COPY --from=build /app/dist /srv
-COPY Caddyfile /etc/caddy/Caddyfile
+COPY ${CONTEXT}/Caddyfile /etc/caddy/Caddyfile
RUN caddy fmt --overwrite /etc/caddy/Caddyfile
RUN chmod 755 /usr/bin/caddy
From 3012fa86ee980e39e1c0722f4d82bb7576825ab5 Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Tue, 12 Nov 2024 15:57:20 -0800
Subject: [PATCH 06/30] Parameterize context
---
backend/Dockerfile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index 5b59f39fc..19b413906 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -3,9 +3,10 @@
# "Provides the native-image executable. Used by the Maven and Gradle plugin from Quarkus to build linux64 executables"
FROM quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:jdk-21 AS build
+ARG CONTEXT="./backend"
# Image defaults to /project; copy controlled by .dockerignore
-COPY --chown=quarkus:quarkus ./backend ./
+COPY --chown=quarkus:quarkus ${CONTEXT} ./
COPY ./pom.xml ./parent-pom.xml
RUN chmod +x ./mvnw && ./mvnw package -Pnative -DskipTests
From 9a273d1e2617c5b803075539b49779243ccb6bd3 Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Tue, 12 Nov 2024 15:58:08 -0800
Subject: [PATCH 07/30] Update pom.xml
---
backend/pom.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/backend/pom.xml b/backend/pom.xml
index 9f9787228..05d1c4c53 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -5,6 +5,7 @@
ca.bc.gov.nrs.vdyp
vdyp-root
0.0.1-SNAPSHOT
+ ./parent-pom.xml
4.0.0
vdyp-backend-application
From 8ebb4e21f4c128d9802cbe0502b99c1786ebf422 Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Tue, 12 Nov 2024 16:00:40 -0800
Subject: [PATCH 08/30] Update Dockerfile
---
frontend/Dockerfile | 1 +
1 file changed, 1 insertion(+)
diff --git a/frontend/Dockerfile b/frontend/Dockerfile
index 78fd27150..7eb75a381 100644
--- a/frontend/Dockerfile
+++ b/frontend/Dockerfile
@@ -19,6 +19,7 @@ RUN apk add --no-cache ca-certificates && \
chown -R 1001:1001 /config/caddy /data/caddy
# Copy static files and run formatting
+ARG CONTEXT="./frontend"
COPY --from=build /app/dist /srv
COPY ${CONTEXT}/Caddyfile /etc/caddy/Caddyfile
RUN caddy fmt --overwrite /etc/caddy/Caddyfile
From 2911e6b191f1578d93ea2d922ce25fd9f6c82151 Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Tue, 12 Nov 2024 16:08:37 -0800
Subject: [PATCH 09/30] Add missing contexts
---
frontend/Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/frontend/Dockerfile b/frontend/Dockerfile
index 7eb75a381..04c742e78 100644
--- a/frontend/Dockerfile
+++ b/frontend/Dockerfile
@@ -4,7 +4,7 @@ FROM node:20.17.0-bullseye-slim AS build
ARG CONTEXT="./frontend"
# Install packages, build and keep only prod packages
WORKDIR /app
-COPY ${CONTEXT}/*.json *.ts index.html ./
+COPY ${CONTEXT}/*.json ${CONTEXT}/*.ts ${CONTEXT}/index.html ./
COPY ${CONTEXT}/public ./public
COPY ${CONTEXT}/src ./src
RUN npm ci --ignore-scripts --no-update-notifier --omit=dev && \
From 21a7a1f0f9807e972d2aa481d4b028d189d6a659 Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Thu, 14 Nov 2024 09:43:34 -0800
Subject: [PATCH 10/30] Install buildtools jar before running build
---
backend/Dockerfile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index 19b413906..c5ac495bc 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -8,6 +8,8 @@ ARG CONTEXT="./backend"
# Image defaults to /project; copy controlled by .dockerignore
COPY --chown=quarkus:quarkus ${CONTEXT} ./
COPY ./pom.xml ./parent-pom.xml
+COPY ./buildtools ./buildtools
+RUN cd buildtools && ./mvnw install -Pnative -DskipTests && cd ..
RUN chmod +x ./mvnw && ./mvnw package -Pnative -DskipTests
# "A base image to run Quarkus native application using UBI Micro"
From fd1275fb74aabf42c283f2097531a37b239eb2f7 Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Thu, 14 Nov 2024 09:45:13 -0800
Subject: [PATCH 11/30] Update mvnw path
---
backend/Dockerfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index c5ac495bc..3d6f08872 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -9,8 +9,8 @@ ARG CONTEXT="./backend"
COPY --chown=quarkus:quarkus ${CONTEXT} ./
COPY ./pom.xml ./parent-pom.xml
COPY ./buildtools ./buildtools
-RUN cd buildtools && ./mvnw install -Pnative -DskipTests && cd ..
-RUN chmod +x ./mvnw && ./mvnw package -Pnative -DskipTests
+RUN chmod +x ./mvnw && cd buildtools && ../mvnw install -Pnative -DskipTests && cd ..
+RUN ./mvnw package -Pnative -DskipTests
# "A base image to run Quarkus native application using UBI Micro"
FROM quay.io/quarkus/quarkus-micro-image:2.0
From 75fc2d43ba88f57a218b64edb32dabaa12e5265a Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Thu, 14 Nov 2024 09:54:11 -0800
Subject: [PATCH 12/30] Update relativePath to parent for buildtools
---
backend/Dockerfile | 2 +-
buildtools/pom.xml | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index 3d6f08872..ffcdac80d 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -7,8 +7,8 @@ ARG CONTEXT="./backend"
# Image defaults to /project; copy controlled by .dockerignore
COPY --chown=quarkus:quarkus ${CONTEXT} ./
+COPY --chown=quarkus:quarkus ./buildtools ./buildtools
COPY ./pom.xml ./parent-pom.xml
-COPY ./buildtools ./buildtools
RUN chmod +x ./mvnw && cd buildtools && ../mvnw install -Pnative -DskipTests && cd ..
RUN ./mvnw package -Pnative -DskipTests
diff --git a/buildtools/pom.xml b/buildtools/pom.xml
index a74d4dd14..4272585a2 100644
--- a/buildtools/pom.xml
+++ b/buildtools/pom.xml
@@ -12,6 +12,7 @@
ca.bc.gov.nrs.vdyp
vdyp-root
0.0.1-SNAPSHOT
+ ../parent-pom.xml
From 37083fae5285de91c9bc1c5cc1b4bec7bfb97a06 Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Thu, 14 Nov 2024 09:58:06 -0800
Subject: [PATCH 13/30] Reduce maven verbosity
---
backend/Dockerfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index ffcdac80d..75234e6ec 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -9,8 +9,8 @@ ARG CONTEXT="./backend"
COPY --chown=quarkus:quarkus ${CONTEXT} ./
COPY --chown=quarkus:quarkus ./buildtools ./buildtools
COPY ./pom.xml ./parent-pom.xml
-RUN chmod +x ./mvnw && cd buildtools && ../mvnw install -Pnative -DskipTests && cd ..
-RUN ./mvnw package -Pnative -DskipTests
+RUN chmod +x ./mvnw && cd buildtools && ../mvnw clean install -Pnative -DskipTests && cd ..
+RUN ./mvnw clean package -Pnative -DskipTests
# "A base image to run Quarkus native application using UBI Micro"
FROM quay.io/quarkus/quarkus-micro-image:2.0
From 611b19a0f643366d5ad78ad69a0817b610a8c2e9 Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Thu, 14 Nov 2024 10:06:05 -0800
Subject: [PATCH 14/30] Specify path to buildtools jar
---
backend/pom.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/backend/pom.xml b/backend/pom.xml
index cddc39843..1b4044b43 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -329,6 +329,7 @@
ca.bc.gov.nrs.vdyp
vdyp-buildtools
${project.version}
+ buildtools/target/vdyp-buildtools-${project-version}.jar
From c1de1100f079187b536b8c5fc2236bef79cdc061 Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Thu, 14 Nov 2024 10:08:01 -0800
Subject: [PATCH 15/30] Specify scope for buildtools
---
backend/pom.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/backend/pom.xml b/backend/pom.xml
index 1b4044b43..3d67eb83b 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -329,6 +329,7 @@
ca.bc.gov.nrs.vdyp
vdyp-buildtools
${project.version}
+ system
buildtools/target/vdyp-buildtools-${project-version}.jar
From 50fdf01563cae44170b3b1106f1ad2eabe9f9fdf Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Thu, 14 Nov 2024 10:10:17 -0800
Subject: [PATCH 16/30] make path absolute, not relative
---
backend/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backend/pom.xml b/backend/pom.xml
index 3d67eb83b..2c17841c4 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -330,7 +330,7 @@
vdyp-buildtools
${project.version}
system
- buildtools/target/vdyp-buildtools-${project-version}.jar
+ /project/buildtools/target/vdyp-buildtools-${project-version}.jar
From 338e6c0bf6a86f6705b066b0cb0f3109b974beba Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Thu, 14 Nov 2024 10:15:17 -0800
Subject: [PATCH 17/30] hardcode version to test functionality
---
backend/pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backend/pom.xml b/backend/pom.xml
index 2c17841c4..662311aa0 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -330,7 +330,7 @@
vdyp-buildtools
${project.version}
system
- /project/buildtools/target/vdyp-buildtools-${project-version}.jar
+ /project/buildtools/target/vdyp-buildtools-0.0.1-SNAPSHOT.jar
From 0239a0b65df789e3b08ecc5f2ff2593ac9882ab9 Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Thu, 14 Nov 2024 10:26:51 -0800
Subject: [PATCH 18/30] Update paths to parent pom
---
backend/Dockerfile | 2 +-
backend/pom.xml | 1 -
buildtools/pom.xml | 2 +-
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index 75234e6ec..5f8c451c8 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -8,7 +8,7 @@ ARG CONTEXT="./backend"
# Image defaults to /project; copy controlled by .dockerignore
COPY --chown=quarkus:quarkus ${CONTEXT} ./
COPY --chown=quarkus:quarkus ./buildtools ./buildtools
-COPY ./pom.xml ./parent-pom.xml
+COPY ./pom.xml ../pom.xml
RUN chmod +x ./mvnw && cd buildtools && ../mvnw clean install -Pnative -DskipTests && cd ..
RUN ./mvnw clean package -Pnative -DskipTests
diff --git a/backend/pom.xml b/backend/pom.xml
index 662311aa0..d95081c9f 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -5,7 +5,6 @@
ca.bc.gov.nrs.vdyp
vdyp-root
0.0.1-SNAPSHOT
- ./parent-pom.xml
4.0.0
Variable Density Yield Project - Backend
diff --git a/buildtools/pom.xml b/buildtools/pom.xml
index 4272585a2..21559db48 100644
--- a/buildtools/pom.xml
+++ b/buildtools/pom.xml
@@ -12,7 +12,7 @@
ca.bc.gov.nrs.vdyp
vdyp-root
0.0.1-SNAPSHOT
- ../parent-pom.xml
+ ../../pom.xml
From 2f039084a3226f21dfd7cfd33640f325eee75778 Mon Sep 17 00:00:00 2001
From: vivid-cpreston <97257824+vivid-cpreston@users.noreply.github.com>
Date: Thu, 14 Nov 2024 15:01:29 -0800
Subject: [PATCH 19/30] Remove use of native mode
---
backend/Dockerfile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index 5f8c451c8..f4f8f48e3 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -9,8 +9,8 @@ ARG CONTEXT="./backend"
COPY --chown=quarkus:quarkus ${CONTEXT} ./
COPY --chown=quarkus:quarkus ./buildtools ./buildtools
COPY ./pom.xml ../pom.xml
-RUN chmod +x ./mvnw && cd buildtools && ../mvnw clean install -Pnative -DskipTests && cd ..
-RUN ./mvnw clean package -Pnative -DskipTests
+RUN chmod +x ./mvnw && cd buildtools && ../mvnw clean install --batch-mode -DskipTests && cd ..
+RUN ./mvnw clean package --batch-mode -DskipTests
# "A base image to run Quarkus native application using UBI Micro"
FROM quay.io/quarkus/quarkus-micro-image:2.0
From 599d6b1623b48d87661f595eff4f0e2f29cc98ae Mon Sep 17 00:00:00 2001
From: Michael Junkin
Date: Mon, 18 Nov 2024 10:56:58 -0800
Subject: [PATCH 20/30] Adjusting application.properties to include necessary
resources
---
.../nrs/vdyp/backend/v1/gen/api/HelpApi.java | 16 +++-----
.../backend/v1/gen/api/ProjectionApi.java | 39 +++++++++----------
.../src/main/resources/application.properties | 2 +
3 files changed, 26 insertions(+), 31 deletions(-)
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/HelpApi.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/HelpApi.java
index 23c5ac64b..966df8e2e 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/HelpApi.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/HelpApi.java
@@ -21,17 +21,11 @@ public HelpApi(/* @Context ServletConfig servletContext */) {
HelpApiService delegate = null;
/*
- if (servletContext != null) {
- String implClass = servletContext.getInitParameter("HelpApi.implementation");
- if (implClass != null && !"".equals(implClass.trim())) {
- try {
- delegate = (HelpApiService) Class.forName(implClass).getDeclaredConstructor().newInstance();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
- */
+ * if (servletContext != null) { String implClass = servletContext.getInitParameter("HelpApi.implementation");
+ * if (implClass != null && !"".equals(implClass.trim())) { try { delegate = (HelpApiService)
+ * Class.forName(implClass).getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new
+ * RuntimeException(e); } } }
+ */
if (delegate == null) {
delegate = HelpApiServiceFactory.getHelpApi();
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionApi.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionApi.java
index a727931d5..e8b798770 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionApi.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionApi.java
@@ -27,19 +27,17 @@ public class ProjectionApi {
public ProjectionApi(/* @Context ServletConfig servletContext */) {
ProjectionApiService delegate = null;
- /*
- if (servletContext != null) {
- String implClass = servletContext.getInitParameter("ProjectionApi.implementation");
- if (implClass != null && !"".equals(implClass.trim())) {
- try {
- delegate = (ProjectionApiService) Class.forName(implClass).getDeclaredConstructor().newInstance();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
- }
- */
-
+// if (servletContext != null) {
+// String implClass = servletContext.getInitParameter("ProjectionApi.implementation");
+// if (implClass != null && !"".equals(implClass.trim())) {
+// try {
+// delegate = (ProjectionApiService) Class.forName(implClass).getDeclaredConstructor().newInstance();
+// } catch (Exception e) {
+// throw new RuntimeException(e);
+// }
+// }
+// }
+
if (delegate == null) {
delegate = ProjectionApiServiceFactory.getProjectionApi();
}
@@ -64,9 +62,8 @@ public ProjectionApi(/* @Context ServletConfig servletContext */) {
code = 201, message = "OK", response = ProjectionResponse.class
), @io.swagger.annotations.ApiResponse(code = 400, message = "Client Error. Response content is a list of one or more messages describing the error.", response = MessagesInner.class, responseContainer = "List") }
)
- public Response projectionDcsvPost(
- @ApiParam(value = "") @Valid ProjectionDcsvPostRequest projectionDcsvPostRequest
- /* , @Context SecurityContext securityContext */
+ public Response projectionDcsvPost(@ApiParam(value = "") @Valid ProjectionDcsvPostRequest projectionDcsvPostRequest
+ /* , @Context SecurityContext securityContext */
) throws NotFoundException {
return delegate.projectionDcsvPost(projectionDcsvPostRequest, null /* securityContext */);
@@ -90,8 +87,9 @@ public Response projectionDcsvPost(
), @io.swagger.annotations.ApiResponse(code = 400, message = "Client Error. Response content is a list of one or more messages describing the error.", response = MessagesInner.class, responseContainer = "List") }
)
public Response projectionHcsvPost(
- @ApiParam(value = "") @Valid ProjectionHcsvPostRequest projectionHcsvPostRequest
- /* , @Context SecurityContext securityContext */
+ //
+ @ApiParam(value = "") @Valid ProjectionHcsvPostRequest projectionHcsvPostRequest //
+ // , @Context SecurityContext securityContext
) throws NotFoundException {
return delegate.projectionHcsvPost(projectionHcsvPostRequest, null /* securityContext */);
}
@@ -114,8 +112,9 @@ public Response projectionHcsvPost(
), @io.swagger.annotations.ApiResponse(code = 400, message = "Client Error. Response content is a list of one or more messages describing the error.", response = MessagesInner.class, responseContainer = "List") }
)
public Response projectionScsvPost(
- @ApiParam(value = "") @Valid ProjectionScsvPostRequest projectionScsvPostRequest
- /* , @Context SecurityContext securityContext */
+ //
+ @ApiParam(value = "") @Valid ProjectionScsvPostRequest projectionScsvPostRequest //
+ // , @Context SecurityContext securityContext
) throws NotFoundException {
return delegate.projectionScsvPost(projectionScsvPostRequest, null /* securityContext */);
}
diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties
index 16dd7cd1e..f3aa1ac70 100644
--- a/backend/src/main/resources/application.properties
+++ b/backend/src/main/resources/application.properties
@@ -3,3 +3,5 @@
mp.openapi.scan.disable=true
quarkus.native.additional-build-args=--initialize-at-run-time=org.glassfish.jersey.server.internal.process.RequestProcessingContext
+quarkus.native.resources.includes=src/main/resources/VDYP7Console-sample-files/**
+
From e9a69a5c67c9595a8e8d97cbfbb33edde2c9d525 Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Mon, 18 Nov 2024 11:31:43 -0800
Subject: [PATCH 21/30] local changes for new build context
---
backend/Dockerfile | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index 5f8c451c8..6424dfe4e 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -6,11 +6,11 @@ FROM quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:jdk-21 AS build
ARG CONTEXT="./backend"
# Image defaults to /project; copy controlled by .dockerignore
-COPY --chown=quarkus:quarkus ${CONTEXT} ./
+COPY --chown=quarkus:quarkus ${CONTEXT} ./${CONTEXT}
COPY --chown=quarkus:quarkus ./buildtools ./buildtools
-COPY ./pom.xml ../pom.xml
+COPY ./pom.xml ./pom.xml
RUN chmod +x ./mvnw && cd buildtools && ../mvnw clean install -Pnative -DskipTests && cd ..
-RUN ./mvnw clean package -Pnative -DskipTests
+RUN cd ${CONTEXT} && ./mvnw clean package -Pnative -DskipTests
# "A base image to run Quarkus native application using UBI Micro"
FROM quay.io/quarkus/quarkus-micro-image:2.0
@@ -20,6 +20,7 @@ EXPOSE 3000
HEALTHCHECK --interval=300s --timeout=3s CMD curl -f http://localhost:3000/ || exit 1
# Startup
-COPY --chown=1001:root --from=build /project/target/*-runner /app
+ARG CONTEXT="./backend"
+COPY --chown=1001:root --from=build /project/${CONTEXT}/target/*-runner /app
USER 1001
CMD ["/app", "-Dquarkus.http.host=0.0.0.0"]
From d2b98d153fa4ff6599a039de24a401a45be7fcc5 Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Mon, 18 Nov 2024 11:41:14 -0800
Subject: [PATCH 22/30] Update wrapper path
---
backend/Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index afe7a3e86..cea8d8395 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -10,7 +10,7 @@ COPY --chown=quarkus:quarkus ./${CONTEXT} ./${CONTEXT}
COPY --chown=quarkus:quarkus ./buildtools ./buildtools
COPY ./pom.xml ./pom.xml
RUN chmod +x ./mvnw && cd buildtools && ../mvnw clean install --batch-mode -DskipTests && cd ..
-RUN cd ${CONTEXT} && ./mvnw clean package --batch-mode -DskipTests
+RUN cd ${CONTEXT} && ../mvnw clean package --batch-mode -DskipTests
# "A base image to run Quarkus native application using UBI Micro"
FROM quay.io/quarkus/quarkus-micro-image:2.0
From e1ea74b85f2faa618b49ad99b6b26756d1d52b6f Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Mon, 18 Nov 2024 11:48:32 -0800
Subject: [PATCH 23/30] Add mvnw wrapper to buildtools
---
backend/Dockerfile | 4 +-
buildtools/mvnw | 250 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 252 insertions(+), 2 deletions(-)
create mode 100644 buildtools/mvnw
diff --git a/backend/Dockerfile b/backend/Dockerfile
index cea8d8395..a674d1f3c 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -9,8 +9,8 @@ ARG CONTEXT="backend"
COPY --chown=quarkus:quarkus ./${CONTEXT} ./${CONTEXT}
COPY --chown=quarkus:quarkus ./buildtools ./buildtools
COPY ./pom.xml ./pom.xml
-RUN chmod +x ./mvnw && cd buildtools && ../mvnw clean install --batch-mode -DskipTests && cd ..
-RUN cd ${CONTEXT} && ../mvnw clean package --batch-mode -DskipTests
+RUN cd buildtools && chmod +x ./mvnw && ./mvnw clean install --batch-mode -DskipTests && cd ..
+RUN cd ${CONTEXT} && chmod +x ./mvnw && ./mvnw clean package --batch-mode -DskipTests
# "A base image to run Quarkus native application using UBI Micro"
FROM quay.io/quarkus/quarkus-micro-image:2.0
diff --git a/buildtools/mvnw b/buildtools/mvnw
new file mode 100644
index 000000000..08303327c
--- /dev/null
+++ b/buildtools/mvnw
@@ -0,0 +1,250 @@
+#!/bin/sh
+# ----------------------------------------------------------------------------
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# ----------------------------------------------------------------------------
+
+# ----------------------------------------------------------------------------
+# Apache Maven Wrapper startup batch script, version 3.3.0
+#
+# Optional ENV vars
+# -----------------
+# JAVA_HOME - location of a JDK home dir, required when download maven via java source
+# MVNW_REPOURL - repo url base for downloading maven distribution
+# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven
+# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output
+# ----------------------------------------------------------------------------
+
+set -euf
+[ "${MVNW_VERBOSE-}" != debug ] || set -x
+
+# OS specific support.
+native_path() { printf %s\\n "$1"; }
+case "$(uname)" in
+CYGWIN* | MINGW*)
+ [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")"
+ native_path() { cygpath --path --windows "$1"; }
+ ;;
+esac
+
+# set JAVACMD and JAVACCMD
+set_java_home() {
+ # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
+ if [ -n "${JAVA_HOME-}" ]; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ]; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACCMD="$JAVA_HOME/jre/sh/javac"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ JAVACCMD="$JAVA_HOME/bin/javac"
+
+ if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then
+ echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2
+ echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2
+ return 1
+ fi
+ fi
+ else
+ JAVACMD="$(
+ 'set' +e
+ 'unset' -f command 2>/dev/null
+ 'command' -v java
+ )" || :
+ JAVACCMD="$(
+ 'set' +e
+ 'unset' -f command 2>/dev/null
+ 'command' -v javac
+ )" || :
+
+ if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then
+ echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2
+ return 1
+ fi
+ fi
+}
+
+# hash string like Java String::hashCode
+hash_string() {
+ str="${1:-}" h=0
+ while [ -n "$str" ]; do
+ char="${str%"${str#?}"}"
+ h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296))
+ str="${str#?}"
+ done
+ printf %x\\n $h
+}
+
+verbose() { :; }
+[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; }
+
+die() {
+ printf %s\\n "$1" >&2
+ exit 1
+}
+
+# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties
+while IFS="=" read -r key value; do
+ case "${key-}" in
+ distributionUrl) distributionUrl="${value-}" ;;
+ distributionSha256Sum) distributionSha256Sum="${value-}" ;;
+ esac
+done <"${0%/*}/.mvn/wrapper/maven-wrapper.properties"
+[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in ${0%/*}/.mvn/wrapper/maven-wrapper.properties"
+
+case "${distributionUrl##*/}" in
+maven-mvnd-*bin.*)
+ MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/
+ case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in
+ *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;;
+ :Darwin*x86_64) distributionPlatform=darwin-amd64 ;;
+ :Darwin*arm64) distributionPlatform=darwin-aarch64 ;;
+ :Linux*x86_64*) distributionPlatform=linux-amd64 ;;
+ *)
+ echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2
+ distributionPlatform=linux-amd64
+ ;;
+ esac
+ distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip"
+ ;;
+maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;;
+*) MVN_CMD="mvn${0##*/mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;;
+esac
+
+# apply MVNW_REPOURL and calculate MAVEN_HOME
+# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/
+[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}"
+distributionUrlName="${distributionUrl##*/}"
+distributionUrlNameMain="${distributionUrlName%.*}"
+distributionUrlNameMain="${distributionUrlNameMain%-bin}"
+MAVEN_HOME="$HOME/.m2/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")"
+
+exec_maven() {
+ unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || :
+ exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD"
+}
+
+if [ -d "$MAVEN_HOME" ]; then
+ verbose "found existing MAVEN_HOME at $MAVEN_HOME"
+ exec_maven "$@"
+fi
+
+case "${distributionUrl-}" in
+*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;;
+*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;;
+esac
+
+# prepare tmp dir
+if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then
+ clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; }
+ trap clean HUP INT TERM EXIT
+else
+ die "cannot create temp dir"
+fi
+
+mkdir -p -- "${MAVEN_HOME%/*}"
+
+# Download and Install Apache Maven
+verbose "Couldn't find MAVEN_HOME, downloading and installing it ..."
+verbose "Downloading from: $distributionUrl"
+verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName"
+
+# select .zip or .tar.gz
+if ! command -v unzip >/dev/null; then
+ distributionUrl="${distributionUrl%.zip}.tar.gz"
+ distributionUrlName="${distributionUrl##*/}"
+fi
+
+# verbose opt
+__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR=''
+[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v
+
+# normalize http auth
+case "${MVNW_PASSWORD:+has-password}" in
+'') MVNW_USERNAME='' MVNW_PASSWORD='' ;;
+has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;;
+esac
+
+if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then
+ verbose "Found wget ... using wget"
+ wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl"
+elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then
+ verbose "Found curl ... using curl"
+ curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl"
+elif set_java_home; then
+ verbose "Falling back to use Java to download"
+ javaSource="$TMP_DOWNLOAD_DIR/Downloader.java"
+ targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName"
+ cat >"$javaSource" <<-END
+ public class Downloader extends java.net.Authenticator
+ {
+ protected java.net.PasswordAuthentication getPasswordAuthentication()
+ {
+ return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() );
+ }
+ public static void main( String[] args ) throws Exception
+ {
+ setDefault( new Downloader() );
+ java.nio.file.Files.copy( new java.net.URL( args[0] ).openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() );
+ }
+ }
+ END
+ # For Cygwin/MinGW, switch paths to Windows format before running javac and java
+ verbose " - Compiling Downloader.java ..."
+ "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java"
+ verbose " - Running Downloader.java ..."
+ "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")"
+fi
+
+# If specified, validate the SHA-256 sum of the Maven distribution zip file
+if [ -n "${distributionSha256Sum-}" ]; then
+ distributionSha256Result=false
+ if [ "$MVN_CMD" = mvnd.sh ]; then
+ echo "Checksum validation is not supported for maven-mvnd." >&2
+ echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
+ exit 1
+ elif command -v sha256sum >/dev/null; then
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c >/dev/null 2>&1; then
+ distributionSha256Result=true
+ fi
+ elif command -v shasum >/dev/null; then
+ if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then
+ distributionSha256Result=true
+ fi
+ else
+ echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
+ echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
+ exit 1
+ fi
+ if [ $distributionSha256Result = false ]; then
+ echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
+ echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
+ exit 1
+ fi
+fi
+
+# unzip and move
+if command -v unzip >/dev/null; then
+ unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip"
+else
+ tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar"
+fi
+printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/mvnw.url"
+mv -- "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME"
+
+clean || :
+exec_maven "$@"
From dcd18934664fe4a80c4a710533f440b93a1fb166 Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Mon, 18 Nov 2024 11:50:19 -0800
Subject: [PATCH 24/30] Add maven wrapper files
---
buildtools/.mvn/wrapper/.gitignore | 1 +
.../.mvn/wrapper/MavenWrapperDownloader.java | 98 +++++++++++++++++++
.../.mvn/wrapper/maven-wrapper.properties | 17 ++++
3 files changed, 116 insertions(+)
create mode 100644 buildtools/.mvn/wrapper/.gitignore
create mode 100644 buildtools/.mvn/wrapper/MavenWrapperDownloader.java
create mode 100644 buildtools/.mvn/wrapper/maven-wrapper.properties
diff --git a/buildtools/.mvn/wrapper/.gitignore b/buildtools/.mvn/wrapper/.gitignore
new file mode 100644
index 000000000..e72f5e8b7
--- /dev/null
+++ b/buildtools/.mvn/wrapper/.gitignore
@@ -0,0 +1 @@
+maven-wrapper.jar
diff --git a/buildtools/.mvn/wrapper/MavenWrapperDownloader.java b/buildtools/.mvn/wrapper/MavenWrapperDownloader.java
new file mode 100644
index 000000000..84d1e60d8
--- /dev/null
+++ b/buildtools/.mvn/wrapper/MavenWrapperDownloader.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.Authenticator;
+import java.net.PasswordAuthentication;
+import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+
+public final class MavenWrapperDownloader
+{
+ private static final String WRAPPER_VERSION = "3.2.0";
+
+ private static final boolean VERBOSE = Boolean.parseBoolean( System.getenv( "MVNW_VERBOSE" ) );
+
+ public static void main( String[] args )
+ {
+ log( "Apache Maven Wrapper Downloader " + WRAPPER_VERSION );
+
+ if ( args.length != 2 )
+ {
+ System.err.println( " - ERROR wrapperUrl or wrapperJarPath parameter missing" );
+ System.exit( 1 );
+ }
+
+ try
+ {
+ log( " - Downloader started" );
+ final URL wrapperUrl = new URL( args[0] );
+ final String jarPath = args[1].replace( "..", "" ); // Sanitize path
+ final Path wrapperJarPath = Paths.get( jarPath ).toAbsolutePath().normalize();
+ downloadFileFromURL( wrapperUrl, wrapperJarPath );
+ log( "Done" );
+ }
+ catch ( IOException e )
+ {
+ System.err.println( "- Error downloading: " + e.getMessage() );
+ if ( VERBOSE )
+ {
+ e.printStackTrace();
+ }
+ System.exit( 1 );
+ }
+ }
+
+ private static void downloadFileFromURL( URL wrapperUrl, Path wrapperJarPath )
+ throws IOException
+ {
+ log( " - Downloading to: " + wrapperJarPath );
+ if ( System.getenv( "MVNW_USERNAME" ) != null && System.getenv( "MVNW_PASSWORD" ) != null )
+ {
+ final String username = System.getenv( "MVNW_USERNAME" );
+ final char[] password = System.getenv( "MVNW_PASSWORD" ).toCharArray();
+ Authenticator.setDefault( new Authenticator()
+ {
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication()
+ {
+ return new PasswordAuthentication( username, password );
+ }
+ } );
+ }
+ try ( InputStream inStream = wrapperUrl.openStream() )
+ {
+ Files.copy( inStream, wrapperJarPath, StandardCopyOption.REPLACE_EXISTING );
+ }
+ log( " - Downloader complete" );
+ }
+
+ private static void log( String msg )
+ {
+ if ( VERBOSE )
+ {
+ System.out.println( msg );
+ }
+ }
+
+}
diff --git a/buildtools/.mvn/wrapper/maven-wrapper.properties b/buildtools/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 000000000..7f1562129
--- /dev/null
+++ b/buildtools/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip
From cc362c2bb85b17eb932b81db9ac1a1981e1c57aa Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Mon, 18 Nov 2024 12:18:24 -0800
Subject: [PATCH 25/30] Install parent pom
---
backend/Dockerfile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index a674d1f3c..f181e62f5 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -9,8 +9,9 @@ ARG CONTEXT="backend"
COPY --chown=quarkus:quarkus ./${CONTEXT} ./${CONTEXT}
COPY --chown=quarkus:quarkus ./buildtools ./buildtools
COPY ./pom.xml ./pom.xml
-RUN cd buildtools && chmod +x ./mvnw && ./mvnw clean install --batch-mode -DskipTests && cd ..
-RUN cd ${CONTEXT} && chmod +x ./mvnw && ./mvnw clean package --batch-mode -DskipTests
+RUN chmod +x buildtools/mvnw && chmod +x ${CONTEXT}/mvnw && ./buildtools/mvnw clean install -N
+RUN cd buildtools && ./mvnw clean install --batch-mode -DskipTests && cd ..
+RUN cd ${CONTEXT} && ./mvnw clean package --batch-mode -DskipTests
# "A base image to run Quarkus native application using UBI Micro"
FROM quay.io/quarkus/quarkus-micro-image:2.0
From 554ae77bd304a89058bf8cebc3027d4ba7f263d2 Mon Sep 17 00:00:00 2001
From: Chris Preston
Date: Mon, 18 Nov 2024 12:20:45 -0800
Subject: [PATCH 26/30] Reduce logging in build
---
backend/Dockerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backend/Dockerfile b/backend/Dockerfile
index f181e62f5..7ab5a04c0 100644
--- a/backend/Dockerfile
+++ b/backend/Dockerfile
@@ -9,7 +9,7 @@ ARG CONTEXT="backend"
COPY --chown=quarkus:quarkus ./${CONTEXT} ./${CONTEXT}
COPY --chown=quarkus:quarkus ./buildtools ./buildtools
COPY ./pom.xml ./pom.xml
-RUN chmod +x buildtools/mvnw && chmod +x ${CONTEXT}/mvnw && ./buildtools/mvnw clean install -N
+RUN chmod +x buildtools/mvnw && chmod +x ${CONTEXT}/mvnw && ./buildtools/mvnw clean install -N --batch-mode
RUN cd buildtools && ./mvnw clean install --batch-mode -DskipTests && cd ..
RUN cd ${CONTEXT} && ./mvnw clean package --batch-mode -DskipTests
From 5e8efbee2ea9570c476d8a991f30233df1b090a7 Mon Sep 17 00:00:00 2001
From: Michael Junkin
Date: Mon, 18 Nov 2024 14:55:43 -0800
Subject: [PATCH 27/30] Next steps in getting native executable to read
resources
---
backend/pom.xml | 3 ---
.../backend/v1/api/ProjectionApiService.java | 24 +++++++++----------
.../backend/v1/gen/api/ProjectionApi.java | 6 ++---
.../src/main/resources/application.properties | 5 ++--
4 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/backend/pom.xml b/backend/pom.xml
index 85c6a382d..2085f87ea 100644
--- a/backend/pom.xml
+++ b/backend/pom.xml
@@ -375,9 +375,6 @@
ca.bc.gov.nrs.vdyp
vdyp-buildtools
${project.version}
- system
-
- /project/buildtools/target/vdyp-buildtools-0.0.1-SNAPSHOT.jar
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
index d8257a2b7..ec46b7d5e 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
@@ -2,6 +2,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Files;
@@ -27,8 +28,7 @@ public class ProjectionApiService {
public Response projectionDcsvPost(
@Valid ProjectionDcsvPostRequest projectionDcsvPostRequest, SecurityContext securityContext
) throws NotFoundException {
- // TODO Auto-generated method stub
- return null;
+ return Response.serverError().entity("Not supported").build();
}
public Response projectionHcsvPost(
@@ -42,18 +42,18 @@ public Response projectionHcsvPost(
ZipEntry yieldTableZipEntry = new ZipEntry("Output_YldTbl.csv");
zipOut.putNextEntry(yieldTableZipEntry);
- var yieldTablePath = getResourceFile("Output_YldTbl.csv");
- zipOut.write(Files.readAllBytes(yieldTablePath));
+ var yieldTable = getResourceFile("Output_YldTbl.csv");
+ zipOut.write(yieldTable.readAllBytes());
ZipEntry logOutputEntry = new ZipEntry("Output_Log.txt");
zipOut.putNextEntry(logOutputEntry);
- var logFilePath = getResourceFile("Output_Log.txt");
- zipOut.write(Files.readAllBytes(logFilePath));
+ var logFile = getResourceFile("Output_Log.txt");
+ zipOut.write(logFile.readAllBytes());
ZipEntry errorOutputZipEntry = new ZipEntry("Output_Error.txt");
zipOut.putNextEntry(errorOutputZipEntry);
- var errorFilePath = getResourceFile("Output_Error.txt");
- zipOut.write(Files.readAllBytes(errorFilePath));
+ var errorFile = getResourceFile("Output_Error.txt");
+ zipOut.write(errorFile.readAllBytes());
zipOut.close();
@@ -76,13 +76,11 @@ public Response projectionHcsvPost(
public Response projectionScsvPost(
@Valid ProjectionScsvPostRequest projectionScsvPostRequest, SecurityContext securityContext
) throws NotFoundException {
- // TODO Auto-generated method stub
- return null;
+ return Response.serverError().entity("Not supported").build();
}
- private Path getResourceFile(String fileName) throws URISyntaxException {
+ private InputStream getResourceFile(String fileName) throws URISyntaxException {
String resourceFilePath = "VDYP7Console-sample-files/hcsv/vdyp-240/" + fileName;
- URL resourceUrl = getClass().getClassLoader().getResource(resourceFilePath);
- return Path.of(resourceUrl.toURI());
+ return getClass().getClassLoader().getResourceAsStream(resourceFilePath);
}
}
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionApi.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionApi.java
index e8b798770..1b59203d4 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionApi.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionApi.java
@@ -87,9 +87,9 @@ public Response projectionDcsvPost(@ApiParam(value = "") @Valid ProjectionDcsvPo
), @io.swagger.annotations.ApiResponse(code = 400, message = "Client Error. Response content is a list of one or more messages describing the error.", response = MessagesInner.class, responseContainer = "List") }
)
public Response projectionHcsvPost(
- //
+ //
@ApiParam(value = "") @Valid ProjectionHcsvPostRequest projectionHcsvPostRequest //
- // , @Context SecurityContext securityContext
+ // , @Context SecurityContext securityContext
) throws NotFoundException {
return delegate.projectionHcsvPost(projectionHcsvPostRequest, null /* securityContext */);
}
@@ -114,7 +114,7 @@ public Response projectionHcsvPost(
public Response projectionScsvPost(
//
@ApiParam(value = "") @Valid ProjectionScsvPostRequest projectionScsvPostRequest //
- // , @Context SecurityContext securityContext
+ // , @Context SecurityContext securityContext
) throws NotFoundException {
return delegate.projectionScsvPost(projectionScsvPostRequest, null /* securityContext */);
}
diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties
index f3aa1ac70..ec488b2b6 100644
--- a/backend/src/main/resources/application.properties
+++ b/backend/src/main/resources/application.properties
@@ -2,6 +2,5 @@
# key = value
mp.openapi.scan.disable=true
-quarkus.native.additional-build-args=--initialize-at-run-time=org.glassfish.jersey.server.internal.process.RequestProcessingContext
-quarkus.native.resources.includes=src/main/resources/VDYP7Console-sample-files/**
-
+quarkus.native.additional-build-args=--initialize-at-run-time=org.glassfish.jersey.server.internal.process.RequestProcessingContext,-H:+UnlockExperimentalVMOptions,-H:Log=registerResource:3,--emit build-report
+quarkus.native.resources.includes=VDYP7Console-sample-files/**
From c77936e3acbefaaaab3aaf059c03d02849964186 Mon Sep 17 00:00:00 2001
From: Michael Junkin
Date: Mon, 18 Nov 2024 16:17:36 -0800
Subject: [PATCH 28/30] Completed API definition and stub implementation
---
.../gov/nrs/vdyp/backend/v1/api/HelpApiService.java | 12 +++++++++---
.../vdyp/backend/v1/api/ProjectionApiService.java | 3 ---
.../bc/gov/nrs/vdyp/backend/v1/gen/api/HelpApi.java | 6 ++++--
.../v1/gen/model/ParameterDetailsMessage.java | 8 ++++++--
.../v1/model/ParameterDetailsMessageBuilder.java | 9 +++++++++
5 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/HelpApiService.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/HelpApiService.java
index 28b2daf32..41cb4c491 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/HelpApiService.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/HelpApiService.java
@@ -3,14 +3,20 @@
import java.util.ArrayList;
import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import ca.bc.gov.nrs.vdyp.backend.v1.gen.model.ParameterDetailsMessage;
import ca.bc.gov.nrs.vdyp.backend.v1.model.ParameterDetailsMessageBuilder;
-import jakarta.ws.rs.core.Response;
import jakarta.ws.rs.core.SecurityContext;
public class HelpApiService {
- public Response helpGet(SecurityContext securityContext) throws NotFoundException {
+ private static final Logger logger = LoggerFactory.getLogger(HelpApiService.class);
+
+ public List helpGet(SecurityContext securityContext) throws NotFoundException {
+
+ logger.info(" messageList = new ArrayList<>();
@@ -477,6 +483,6 @@ public Response helpGet(SecurityContext securityContext) throws NotFoundExceptio
)
);
- return Response.ok().entity(messageList).build();
+ return messageList;
}
}
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
index ec46b7d5e..46c36aad3 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
@@ -4,9 +4,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URISyntaxException;
-import java.net.URL;
-import java.nio.file.Files;
-import java.nio.file.Path;
import java.time.format.DateTimeFormatter;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/HelpApi.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/HelpApi.java
index 966df8e2e..0a23794a5 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/HelpApi.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/api/HelpApi.java
@@ -1,12 +1,13 @@
package ca.bc.gov.nrs.vdyp.backend.v1.gen.api;
+import java.util.List;
+
import ca.bc.gov.nrs.vdyp.backend.v1.api.HelpApiService;
import ca.bc.gov.nrs.vdyp.backend.v1.api.NotFoundException;
import ca.bc.gov.nrs.vdyp.backend.v1.api.factories.HelpApiServiceFactory;
import ca.bc.gov.nrs.vdyp.backend.v1.gen.model.ParameterDetailsMessage;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
-import jakarta.ws.rs.core.Response;
@Path("/v1/help")
@@ -54,7 +55,8 @@ public HelpApi(/* @Context ServletConfig servletContext */) {
code = 200, message = "OK", response = ParameterDetailsMessage.class, responseContainer = "List"
) }
)
- public Response helpGet(/* @Context SecurityContext securityContext */) throws NotFoundException {
+ public List helpGet(/* @Context SecurityContext securityContext */)
+ throws NotFoundException {
return delegate.helpGet(null /* securityContext */);
}
}
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/model/ParameterDetailsMessage.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/model/ParameterDetailsMessage.java
index b31d6614e..95b676466 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/model/ParameterDetailsMessage.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/gen/model/ParameterDetailsMessage.java
@@ -12,6 +12,7 @@
package ca.bc.gov.nrs.vdyp.backend.v1.gen.model;
+import java.io.Serializable;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -30,7 +31,10 @@
@jakarta.annotation.Generated(
value = "org.openapitools.codegen.languages.JavaJAXRSSpecServerCodegen", date = "2024-11-12T09:52:55.097945-08:00[America/Vancouver]", comments = "Generator version: 7.9.0"
)
-public class ParameterDetailsMessage {
+public class ParameterDetailsMessage implements Serializable {
+
+ private static final long serialVersionUID = -4514646435523721853L;
+
public static final String JSON_PROPERTY_FIELD = "field";
@JsonProperty(JSON_PROPERTY_FIELD)
private String field;
@@ -77,7 +81,7 @@ public ParameterDetailsMessage shortDescription(String shortDescription) {
}
/**
- * a brief description of the parameter's purpose
+ * a brief description of the parameter's purpose
*
* @return shortDescription
**/
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/model/ParameterDetailsMessageBuilder.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/model/ParameterDetailsMessageBuilder.java
index 4ef632f25..f46610bc6 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/model/ParameterDetailsMessageBuilder.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/model/ParameterDetailsMessageBuilder.java
@@ -1,8 +1,15 @@
package ca.bc.gov.nrs.vdyp.backend.v1.model;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import ca.bc.gov.nrs.vdyp.backend.v1.gen.model.ParameterDetailsMessage;
public class ParameterDetailsMessageBuilder {
+
+ @SuppressWarnings("unused")
+ private static final Logger logger = LoggerFactory.getLogger(ParameterDetailsMessageBuilder.class);
+
public static ParameterDetailsMessage build(
String field, String shortDescription, String parameterValue, String longDescription, String defaultValue
) {
@@ -14,6 +21,8 @@ public static ParameterDetailsMessage build(
m.setParameterValue(parameterValue);
m.setShortDescription(shortDescription);
+ // logger.info("built ParameterDetailsMessage {}", shortDescription);
+
return m;
}
}
From 1911c873cca78cfd91bfed03cd8e62762d8e2e3a Mon Sep 17 00:00:00 2001
From: Michael Junkin
Date: Mon, 18 Nov 2024 17:07:12 -0800
Subject: [PATCH 29/30] Completed unit tests
---
.../backend/v1/api/ProjectionApiService.java | 3 +-
.../api/v1/endpoints/HelpEndpointTest.java | 7 +-
.../v1/endpoints/ProjectionEndpointTest.java | 244 ++++++++++++++++++
3 files changed, 251 insertions(+), 3 deletions(-)
create mode 100644 backend/src/test/java/ca/bc/gov/nrs/api/v1/endpoints/ProjectionEndpointTest.java
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
index 46c36aad3..0420cebdc 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
@@ -16,6 +16,7 @@
import ca.bc.gov.nrs.vdyp.backend.v1.gen.model.ProjectionScsvPostRequest;
import jakarta.validation.Valid;
import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.Response.Status;
import jakarta.ws.rs.core.SecurityContext;
public class ProjectionApiService {
@@ -60,7 +61,7 @@ public Response projectionHcsvPost(
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH.mm.ss");
var outputFileName = "vdyp-output-" + java.time.LocalDateTime.now().format(formatter);
- return Response.ok(resultingByteArray)
+ return Response.ok(resultingByteArray).status(Status.CREATED)
.header("content-disposition", "attachment;filename=\"" + outputFileName + "\"").build();
} catch (IOException | URISyntaxException e) {
diff --git a/backend/src/test/java/ca/bc/gov/nrs/api/v1/endpoints/HelpEndpointTest.java b/backend/src/test/java/ca/bc/gov/nrs/api/v1/endpoints/HelpEndpointTest.java
index 4de7d922b..622047804 100644
--- a/backend/src/test/java/ca/bc/gov/nrs/api/v1/endpoints/HelpEndpointTest.java
+++ b/backend/src/test/java/ca/bc/gov/nrs/api/v1/endpoints/HelpEndpointTest.java
@@ -1,12 +1,13 @@
package ca.bc.gov.nrs.api.v1.endpoints;
import static io.restassured.RestAssured.given;
-import static org.hamcrest.CoreMatchers.equalTo;
+import org.hamcrest.Matchers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import ca.bc.gov.nrs.api.helpers.TestHelper;
+import ca.bc.gov.nrs.vdyp.backend.v1.model.ParameterDetailsMessageBuilder;
import io.quarkus.test.junit.QuarkusTest;
import jakarta.inject.Inject;
import net.datafaker.Faker;
@@ -28,7 +29,9 @@ void setup() {
@Test
void testGetHelp_shouldReturnStatusOK() {
- given().basePath("/v1").when().get("/help").then().statusCode(200);
+
+ given().basePath("/v1").when().get("/help").then().statusCode(200).and().contentType("application/json").and()
+ .body(Matchers.containsString("outputFormat"), Matchers.containsString("Output Data Format"));
}
// @Test
diff --git a/backend/src/test/java/ca/bc/gov/nrs/api/v1/endpoints/ProjectionEndpointTest.java b/backend/src/test/java/ca/bc/gov/nrs/api/v1/endpoints/ProjectionEndpointTest.java
new file mode 100644
index 000000000..66a86b723
--- /dev/null
+++ b/backend/src/test/java/ca/bc/gov/nrs/api/v1/endpoints/ProjectionEndpointTest.java
@@ -0,0 +1,244 @@
+package ca.bc.gov.nrs.api.v1.endpoints;
+
+import static io.restassured.RestAssured.given;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.hamcrest.Matchers;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import ca.bc.gov.nrs.api.helpers.TestHelper;
+import ca.bc.gov.nrs.vdyp.backend.v1.gen.model.Parameters;
+import ca.bc.gov.nrs.vdyp.backend.v1.gen.model.ProjectionDcsvPostRequest;
+import ca.bc.gov.nrs.vdyp.backend.v1.gen.model.ProjectionHcsvPostRequest;
+import ca.bc.gov.nrs.vdyp.backend.v1.gen.model.ProjectionScsvPostRequest;
+import io.quarkus.test.junit.QuarkusTest;
+import jakarta.inject.Inject;
+import net.datafaker.Faker;
+
+@QuarkusTest
+class ProjectionEndpointTest {
+
+ private final TestHelper testHelper;
+ private final Faker faker = new Faker();
+
+ @Inject
+ ProjectionEndpointTest(TestHelper testHelper) {
+ this.testHelper = testHelper;
+ }
+
+ @BeforeEach
+ void setup() {
+ }
+
+ @Test
+ void testProjectionHscv_shouldReturnStatusOK() throws IOException {
+
+ ProjectionHcsvPostRequest request = new ProjectionHcsvPostRequest();
+ request.setLayerInputData(buildTestFile());
+ request.setPolygonInputData(buildTestFile());
+ request.setProjectionParameters(new Parameters());
+
+ given().basePath("/v1").when().body(request).contentType("application/json").post("/projection/hcsv").then().statusCode(201).and().contentType("multipart/form-data").and()
+ .header("content-disposition", Matchers.startsWith("attachment;filename=\"vdyp-output-"))
+ .body(Matchers.not(Matchers.empty()));
+ }
+
+ @Test
+ void testProjectionSscv_shouldThrow() throws IOException {
+
+ ProjectionScsvPostRequest request = new ProjectionScsvPostRequest();
+ request.setLayerInputData(buildTestFile());
+ request.setPolygonInputData(buildTestFile());
+ request.setProjectionParameters(new Parameters());
+ request.setHistoryInputData(buildTestFile());
+ request.setNonVegetationInputData(buildTestFile());
+ request.setOtherVegetationInputData(buildTestFile());
+ request.setPolygonIdInputData(buildTestFile());
+ request.setSpeciesInputData(buildTestFile());
+ request.setVriAdjustInputData(buildTestFile());
+
+ given().basePath("/v1").when().body(request).contentType("application/json").post("/projection/scsv").then().statusCode(500)
+ .body(Matchers.containsString("Not supported"));
+ }
+
+ @Test
+ void testProjectionDscv_shouldThrow() throws IOException {
+
+ ProjectionDcsvPostRequest request = new ProjectionDcsvPostRequest();
+ request.setProjectionParameters(new Parameters());
+ request.setInputData(buildTestFile());
+
+ given().basePath("/v1").when().body(request).contentType("application/json").post("/projection/dcsv").then().statusCode(500)
+ .body(Matchers.containsString("Not supported"));
+ }
+
+ private File buildTestFile() throws IOException {
+ Path tmpFile = Files.createTempFile("ProjectionEndpointTest", ".csv");
+
+ OutputStream os = new ByteArrayOutputStream();
+ os.write("Test data".getBytes());
+
+ return tmpFile.toFile();
+ }
+
+// @Test
+// void testGetUserById_givenValidID_shouldReturnTheUserAndStatusOK() {
+// given()r
+// .basePath("/api/v1")
+// .pathParam("id", userEntity.getId())
+// .when().get("/users/{id}")
+// .then()
+// .statusCode(200)
+// .body("name", equalTo(userEntity.getName()))
+// .body("email", equalTo(userEntity.getEmail()));
+// }
+
+// @Test
+// void testGetUserById_givenRandomID_shouldReturnTheUserAndStatusOK() {
+// given()
+// .basePath("/api/v1")
+// .pathParam("id", 20000)
+// .when().get("/users/{id}")
+// .then()
+// .statusCode(404);
+// }
+
+// @Test
+// void testCreateUser_givenValidPayload_shouldReturnStatusCreated() {
+// var name = faker.name().fullName();
+// var email = faker.internet().emailAddress();
+// User user = new User(null, name, email);
+// given()
+// .basePath("/api/v1")
+// .contentType(ContentType.JSON)
+// .body(user)
+// .when().post("/users")
+// .then()
+// .statusCode(201)
+// .body("name", equalTo(name))
+// .body("email", equalTo(email));
+// }
+
+// @Test
+// void testCreateUser_givenInValidPayload_shouldReturnStatusBadRequest() {
+// var name = faker.name().fullName();
+// var email = faker.internet().domainName();
+// User user = new User(null, name, email);
+// given()
+// .basePath("/api/v1")
+// .contentType(ContentType.JSON)
+// .body(user)
+// .when().post("/users")
+// .then()
+// .statusCode(400);
+// }
+
+// @Test
+// void testUpdateUser_givenValidPayload_shouldReturnStatusOK() {
+// var name = faker.name().fullName();
+// var email = faker.internet().emailAddress();
+// User user = new User(userEntity.getId(), name, email);
+// given()
+// .basePath("/api/v1")
+// .contentType(ContentType.JSON)
+// .pathParam("id", userEntity.getId())
+// .body(user)
+// .when().put("/users/{id}")
+// .then()
+// .statusCode(200)
+// .body("name", equalTo(user.name()))
+// .body("email", equalTo(user.email()));
+// }
+
+// @Test
+// void testDeleteUser_givenValidID_shouldReturnStatusNoContent() {
+// given()
+// .basePath("/api/v1")
+// .pathParam("id", userEntity.getId())
+// .when().delete("/users/{id}")
+// .then()
+// .statusCode(204);
+// }
+
+// @Test
+// void testDeleteUser_givenInvalidID_shouldReturnStatusNotFound() {
+// given()
+// .basePath("/api/v1")
+// .pathParam("id", 100003330)
+// .when().delete("/users/{id}")
+// .then()
+// .statusCode(404);
+// }
+
+// @Test
+// void testGetUserAddresses_noCondition_shouldReturnAllUsersAddressesAndStatusOK() {
+// given()
+// .basePath("/api/v1")
+// .pathParam("id", userEntity.getId())
+// .when().get("/users/{id}/addresses")
+// .then()
+// .statusCode(200)
+// .body("$.size()", equalTo(1));
+// }
+
+// @Test
+// void testCreateUserAddress_givenValidPayload_shouldCreateTheUserAddressAndReturnStatusCreated() {
+// var street = faker.address().streetAddress();
+// var city =faker.address().city();
+// var state =faker.address().state();
+// var zipCode= faker.address().zipCode();
+// UserAddress userAddress = new UserAddress(null, street, city, state, zipCode, userEntity.getId());
+// given()
+// .basePath("/api/v1")
+// .contentType(ContentType.JSON)
+// .pathParam("id", userEntity.getId())
+// .body(userAddress)
+// .when().post("/users/{id}/addresses")
+// .then()
+// .statusCode(201)
+// .body("street", equalTo(street))
+// .body("city", equalTo(city))
+// .body("state", equalTo(state))
+// .body("zipCode", equalTo(zipCode));
+// }
+
+// @Test
+// void testUpdateUserAddress_givenValidPayload_shouldUpdateTheUserAddressAndReturnStatusOK() {
+// var street = faker.address().streetAddress();
+// var city =faker.address().city();
+// var state =faker.address().state();
+// var zipCode= faker.address().zipCode();
+// UserAddress userAddress = new UserAddress(addressEntity.getId(), street, city, state, zipCode, userEntity.getId());
+// given()
+// .basePath("/api/v1")
+// .contentType(ContentType.JSON)
+// .pathParam("id", userEntity.getId())
+// .pathParam("addressId", addressEntity.getId())
+// .body(userAddress)
+// .when().put("/users/{id}/addresses/{addressId}")
+// .then()
+// .statusCode(200)
+// .body("street", equalTo(street))
+// .body("city", equalTo(city))
+// .body("state", equalTo(state))
+// .body("zipCode", equalTo(zipCode));
+// }
+
+// @Test
+// void testDeleteUserAddress_givenValidPayload_shouldDeleteTheUserAddressAndReturnStatusNoContent() {
+// given()
+// .basePath("/api/v1")
+// .pathParam("id", userEntity.getId())
+// .pathParam("addressId", addressEntity.getId())
+// .when().delete("/users/{id}/addresses/{addressId}")
+// .then()
+// .statusCode(204);
+// }
+}
From 3c77c779a35ae7a5e044e234df2863fd3809c68d Mon Sep 17 00:00:00 2001
From: Michael Junkin
Date: Tue, 19 Nov 2024 09:09:23 -0800
Subject: [PATCH 30/30] Removed unused NotFoundException throws declarations
---
.../gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java | 6 +++---
.../bc/gov/nrs/vdyp/backend/v1/gen/api/ProjectionApi.java | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
index 0420cebdc..7cc6fbe93 100644
--- a/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
+++ b/backend/src/main/java/ca/bc/gov/nrs/vdyp/backend/v1/api/ProjectionApiService.java
@@ -25,13 +25,13 @@ public class ProjectionApiService {
public Response projectionDcsvPost(
@Valid ProjectionDcsvPostRequest projectionDcsvPostRequest, SecurityContext securityContext
- ) throws NotFoundException {
+ ) {
return Response.serverError().entity("Not supported").build();
}
public Response projectionHcsvPost(
@Valid ProjectionHcsvPostRequest projectionHcsvPostRequest, SecurityContext securityContext
- ) throws NotFoundException {
+ ) {
try {
logger.info("