Skip to content

Commit

Permalink
Merge pull request #710 from Epic-Breakfast-Productions/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
GregJohnStewart authored Oct 14, 2024
2 parents 4ebfcb7 + c91f934 commit 66aa8fa
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#

[Unit]
Description=Keycloak server for Open Quartermaster. Version ${version}, using Keycloak tagged to "24.0".
Description=Keycloak server for Open Quartermaster. Version ${version}, using Keycloak tagged to "26.0".
Documentation=https://github.com/Epic-Breakfast-Productions/OpenQuarterMaster/tree/main/software/Infrastructure
After=docker.service
Wants=network-online.target
Expand All @@ -20,11 +20,11 @@ Requires=oqm-infra-postgres.service
[Service]
Type=simple
Restart=always
TimeoutSec=5m
TimeoutSec=10m
# setup operating variables
Environment="CONTAINER_NAME=oqm-infra-keycloak"
Environment="IMAGE_NAME=quay.io/keycloak/keycloak"
Environment="IMAGE_VERSION=24.0"
Environment="IMAGE_VERSION=26.0"
Environment="ENV_CONFIG_FILE=/tmp/oqm/serviceConfig/infra/keycloak/env.list"

ExecStartPre=/bin/bash -c "/usr/bin/docker stop -t 10 $CONTAINER_NAME || echo 'Could not stop keycloak container'"
Expand All @@ -38,6 +38,7 @@ ExecStartPre=/bin/bash -c "cp \"$(oqm-config -g cert.certs.privateKey)\" /etc/oq
ExecStartPre=/bin/bash -c "cp \"$(oqm-config -g cert.certs.systemCert)\" /etc/oqm/serviceConfig/infra/keycloak/files/publicCert.pem"
ExecStartPre=/bin/bash -c "cp \"$(oqm-config -g cert.certs.keystore)\" /etc/oqm/serviceConfig/infra/keycloak/files/keystore.p12"
ExecStartPre=/bin/bash -c "mkdir -p /tmp/oqm/serviceConfig/infra/keycloak"
# TODO:: use file templating to achieve this
ExecStartPre=/bin/bash -c "touch $ENV_CONFIG_FILE"
ExecStartPre=/bin/bash -c "chmod 600 $ENV_CONFIG_FILE"
ExecStartPre=/bin/bash -c "truncate -s 0 $ENV_CONFIG_FILE"
Expand Down Expand Up @@ -101,7 +102,7 @@ ExecStartPost=/bin/bash -c "running=\"false\"; \
echo \"Container was stopped!\"; \
exit 1; \
fi; \
hcGet=\"$(/usr/bin/curl -k \"https://$hostname:$servicePort/health\")\"; \
hcGet=\"$(docker run --network=oqm-internal docker.io/curlimages/curl:latest https://oqm-infra-keycloak:9000/health -k)\"; \
echo \"Health check get: $hcGet\"; \
status=\"$(jq --argjson hcGet \"$hcGet\" -nr '$hcGet.status')\"; \
echo \"Status: $status\"; \
Expand Down
10 changes: 5 additions & 5 deletions software/oqm-core-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java'
id 'io.quarkus'
id "io.freefair.lombok" version "8.7.1"
id "io.freefair.lombok" version "8.10.2"
}

group 'com.ebp.openQuarterMaster'
Expand Down Expand Up @@ -50,9 +50,9 @@ dependencies {
// https://mvnrepository.com/artifact/tech.uom.lib/uom-lib-jackson
implementation 'tech.uom.lib:uom-lib-jackson:2.1'

implementation 'org.apache.commons:commons-lang3:3.16.0'
implementation 'org.apache.commons:commons-compress:1.27.0'
implementation 'org.apache.commons:commons-csv:1.11.0'
implementation 'org.apache.commons:commons-lang3:3.17.0'
implementation 'org.apache.commons:commons-compress:1.27.1'
implementation 'org.apache.commons:commons-csv:1.12.0'
implementation 'org.apache.commons:commons-io:1.3.2'
implementation 'commons-codec:commons-codec:1.17.1'
implementation 'org.apache.tika:tika-core:2.9.2'
Expand All @@ -65,7 +65,7 @@ dependencies {
testImplementation group: 'io.rest-assured', name: 'rest-assured'
testImplementation 'io.quarkus:quarkus-smallrye-jwt-build'
testImplementation 'io.quarkus:quarkus-test-kafka-companion'
testImplementation 'net.datafaker:datafaker:2.3.1'
testImplementation 'net.datafaker:datafaker:2.4.0'
testImplementation 'org.assertj:assertj-core:3.26.3'
testImplementation 'io.jaegertracing:jaeger-testcontainers:0.7.0'
}
Expand Down
2 changes: 1 addition & 1 deletion software/oqm-core-api/installerSrc/oqm-core-api.service
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Requires=oqm-infra-keycloak.service
[Service]
Type=simple
Restart=always
TimeoutSec=5m
TimeoutSec=10m
# Setup operating variables
Environment="CONTAINER_NAME=oqm-core-api"
Environment="IMAGE_NAME=ebprod/oqm-core-api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,68 +27,70 @@ public class InvItemCsvConverter {
public static final Character COMMENT_CHAR = '#';

public List<InventoryItem<?, ?, ?>> csvIsToItems(InputStream is) throws IOException {
List<InventoryItem<?, ?, ?>> output = new ArrayList<>();
Reader in = new InputStreamReader(is);

Iterable<CSVRecord> records = CSVFormat.Builder
.create(CSVFormat.EXCEL)
.setCommentMarker(COMMENT_CHAR)
.setHeader(CSV_HEADERS)
.setSkipHeaderRecord(true)
.setTrim(true)
.build().parse(in);

for (CSVRecord record : records) {
StorageType storageType = StorageType.valueOf(record.get("storageType"));
InventoryItem<?, ?, ?> item = switch (storageType) {
case AMOUNT_SIMPLE -> new SimpleAmountItem();
case AMOUNT_LIST -> new ListAmountItem();
case TRACKED -> new TrackedItem();
default -> throw new IllegalArgumentException("Invalid Storage Type Given: " + record.get("storageType"));
};

item.setName(record.get("name"));
item.setDescription(record.get("description"));

if (!record.get("barcode").isBlank()) {
item.setBarcode(record.get("barcode"));
}
if (!record.get("storageBlock").isBlank()) {
item.getStoredWrapperForStorage(new ObjectId(record.get("storageBlock")), true);
}

String unitVal = record.get("storageBlock");
switch (storageType) {
case AMOUNT_SIMPLE:
SimpleAmountItem sai = (SimpleAmountItem) item;
if (!unitVal.isBlank()) {
sai.setUnit(UnitUtils.unitFromString(unitVal));
}
if (!record.get("valuePerUnit").isBlank()) {
sai.setValuePerUnit(new BigDecimal(record.get("valuePerUnit")));
}
break;
case AMOUNT_LIST:
ListAmountItem lai = ((ListAmountItem) item);
if (!unitVal.isBlank()) {
lai.setUnit(UnitUtils.unitFromString(unitVal));
}
if (!record.get("valuePerUnit").isBlank()) {
lai.setValuePerUnit(new BigDecimal(record.get("valuePerUnit")));
}
break;
case TRACKED:
TrackedItem tri = ((TrackedItem) item);

tri.setTrackedItemIdentifierName(record.get("trackedItemId"));

if (!record.get("valuePerUnit").isBlank()) {
tri.setDefaultValue(new BigDecimal(record.get("valuePerUnit")));
}
break;
}
output.add(item);
}
return output;
throw new IllegalStateException("Not implemented yet");
//TODO:: 708 move to plugin
// List<InventoryItem<?, ?, ?>> output = new ArrayList<>();
// Reader in = new InputStreamReader(is);
//
// Iterable<CSVRecord> records = CSVFormat.Builder
// .create(CSVFormat.EXCEL)
// .setCommentMarker(COMMENT_CHAR)
// .setHeader(CSV_HEADERS)
// .setSkipHeaderRecord(true)
// .setTrim(true)
// .build().parse(in);
//
// for (CSVRecord record : records) {
// StorageType storageType = StorageType.valueOf(record.get("storageType"));
// InventoryItem<?, ?, ?> item = switch (storageType) {
// case AMOUNT_SIMPLE -> new SimpleAmountItem();
// case AMOUNT_LIST -> new ListAmountItem();
// case TRACKED -> new TrackedItem();
// default -> throw new IllegalArgumentException("Invalid Storage Type Given: " + record.get("storageType"));
// };
//
// item.setName(record.get("name"));
// item.setDescription(record.get("description"));
//
// if (!record.get("barcode").isBlank()) {
// item.setBarcode(record.get("barcode"));
// }
// if (!record.get("storageBlock").isBlank()) {
// item.getStoredWrapperForStorage(new ObjectId(record.get("storageBlock")), true);
// }
//
// String unitVal = record.get("storageBlock");
// switch (storageType) {
// case AMOUNT_SIMPLE:
// SimpleAmountItem sai = (SimpleAmountItem) item;
// if (!unitVal.isBlank()) {
// sai.setUnit(UnitUtils.unitFromString(unitVal));
// }
// if (!record.get("valuePerUnit").isBlank()) {
// sai.setValuePerUnit(new BigDecimal(record.get("valuePerUnit")));
// }
// break;
// case AMOUNT_LIST:
// ListAmountItem lai = ((ListAmountItem) item);
// if (!unitVal.isBlank()) {
// lai.setUnit(UnitUtils.unitFromString(unitVal));
// }
// if (!record.get("valuePerUnit").isBlank()) {
// lai.setValuePerUnit(new BigDecimal(record.get("valuePerUnit")));
// }
// break;
// case TRACKED:
// TrackedItem tri = ((TrackedItem) item);
//
// tri.setTrackedItemIdentifierName(record.get("trackedItemId"));
//
// if (!record.get("valuePerUnit").isBlank()) {
// tri.setDefaultValue(new BigDecimal(record.get("valuePerUnit")));
// }
// break;
// }
// output.add(item);
// }
// return output;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,10 @@ public void testUpdateTrackedItem() throws JsonProcessingException {
ObjectNode updateData = ObjectUtils.OBJECT_MAPPER.createObjectNode();
updateData.put("name", FAKER.commerce().productName());
}

@Test


//TODO:: 708 move to new service
// @Test
public void testAddFromCsv() throws IOException {
User user = this.getTestUserService().getTestUser();

Expand Down
12 changes: 6 additions & 6 deletions software/oqm-core-base-station/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id 'java'
id 'io.quarkus'
id "io.freefair.lombok" version "8.7.1"
id "io.freefair.lombok" version "8.10.2"
}

group 'com.ebp.openQuarterMaster'
version '1.4.3'
version '1.4.4'

repositories {
mavenCentral()
Expand Down Expand Up @@ -34,19 +34,19 @@ dependencies {
implementation 'org.apache.commons:commons-text:1.12.0'

implementation group: 'org.jsoup', name: 'jsoup', version: '1.18.1'
implementation 'uk.org.okapibarcode:okapibarcode:0.4.7'
implementation 'uk.org.okapibarcode:okapibarcode:0.4.8'
implementation 'com.itextpdf:html2pdf:5.0.5'

//webjars
implementation 'org.webjars:jquery:3.7.1'
implementation 'org.webjars:bootstrap:5.3.3'

testImplementation 'io.quarkus:quarkus-junit5'
testImplementation "org.junit.jupiter:junit-jupiter-params:5.11.0"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.11.2"
testImplementation 'io.rest-assured:rest-assured'
testImplementation 'net.datafaker:datafaker:2.3.1'
testImplementation 'net.datafaker:datafaker:2.4.0'

testImplementation 'com.microsoft.playwright:playwright:1.46.0'
testImplementation 'com.microsoft.playwright:playwright:1.47.0'
testImplementation 'com.deque.html.axe-core:playwright:4.9.1'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Requires=oqm-infra-keycloak.service
[Service]
Type=simple
Restart=always
TimeoutSec=5m
TimeoutSec=10m
# Setup operating variables
Environment="CONTAINER_NAME=oqm-core-base_station"
Environment="IMAGE_NAME=ebprod/oqm-core-base_station"
Expand Down
2 changes: 1 addition & 1 deletion software/plugins/external-item-search/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java'
id 'io.quarkus'
id "io.freefair.lombok" version "8.7.1"
id "io.freefair.lombok" version "8.10.2"
}

repositories {
Expand Down

0 comments on commit 66aa8fa

Please sign in to comment.