Skip to content

Commit

Permalink
Dev (#188)
Browse files Browse the repository at this point in the history
Co-authored-by: adrrossi <[email protected]>
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: adrrss <[email protected]>
Co-authored-by: SMANUM <[email protected]>
Co-authored-by: LuciaM1 <[email protected]>
Co-authored-by: GiacomoB <[email protected]>
Co-authored-by: Simone Munao <[email protected]>
Co-authored-by: LuciaM1 <[email protected]>
Co-authored-by: ElisKina-dev <[email protected]>
Co-authored-by: ElisKina-dev <[email protected]>
Co-authored-by: Gabriele Maiocchi <[email protected]>
Co-authored-by: Giacomo Brancazi <[email protected]>
  • Loading branch information
13 people authored Sep 25, 2024
1 parent e86a950 commit 488d079
Show file tree
Hide file tree
Showing 13 changed files with 16,193 additions and 16,098 deletions.
10 changes: 5 additions & 5 deletions _TMP/coverage-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

| Outcome | Value |
|-------------------------|---------------------------------------------------------------------|
| Code Coverage % | 92.07% |
| :heavy_check_mark: Number of Lines Covered | 2276 |
| :x: Number of Lines Missed | 196 |
| Total Number of Lines | 2472 |
| Code Coverage % | 91.82% |
| :heavy_check_mark: Number of Lines Covered | 2278 |
| :x: Number of Lines Missed | 203 |
| Total Number of Lines | 2481 |


## Details:
Expand Down Expand Up @@ -902,7 +902,7 @@
#### Lines Missed:
- Line #110
- Line #143
```
} catch (IOException e) {
```
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: v1.27.0
version: v1.27.0-dev.3
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/environments/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ database:
password: PASSWORD_DB

tracing:
enabled: "true"
enabled: "false"
endpointBasePath: "http://jaeger-collector.default.svc.cluster.local:4317"
enableJDBCMonitoring: "true"

Expand Down
2 changes: 1 addition & 1 deletion helm-chart/environments/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ database:
password: PASSWORD_DB

tracing:
enabled: "true"
enabled: "false"
endpointBasePath: "http://jaeger-collector.default.svc.cluster.local:4317"
enableJDBCMonitoring: "true"

Expand Down
2 changes: 1 addition & 1 deletion helm-chart/environments/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ database:
password: PASSWORD_DB

tracing:
enabled: "true"
enabled: "false"
endpointBasePath: "http://jeager-manual-trace-ecs-priv-b19cfd091be2d616.elb.eu-south-1.amazonaws.com:4317"
enableJDBCMonitoring: "true"

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>it.gov.pagopa</groupId>
<artifactId>atm-layer-model</artifactId>
<version>1.27.0</version>
<version>1.27.0-dev.3</version>
<name>atm-layer-model</name>
<properties>
<compiler-plugin.version>3.11.0</compiler-plugin.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,17 @@ public class BpmnResource {
private final BpmnFileStorageService bpmnFileStorageService;
private final BpmnVersionMapper bpmnVersionMapper;
private final BpmnConfigMapper bpmnConfigMapper;
private final Tracer tracer;

@Inject
public BpmnResource(BpmnVersionService bpmnVersionService, BpmnBankConfigService bpmnBankConfigService,
BpmnEntityValidator bpmnEntityValidator, BpmnFileStorageService bpmnFileStorageService,
BpmnVersionMapper bpmnVersionMapper, BpmnConfigMapper bpmnConfigMapper, Tracer tracer) {
BpmnVersionMapper bpmnVersionMapper, BpmnConfigMapper bpmnConfigMapper) {
this.bpmnVersionService = bpmnVersionService;
this.bpmnBankConfigService = bpmnBankConfigService;
this.bpmnEntityValidator = bpmnEntityValidator;
this.bpmnFileStorageService = bpmnFileStorageService;
this.bpmnVersionMapper = bpmnVersionMapper;
this.bpmnConfigMapper = bpmnConfigMapper;
this.tracer = tracer;
}

@GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,11 @@
public class WorkflowResourceResource {
private final WorkflowResourceService workflowResourceService;
private final WorkflowResourceMapper workflowResourceMapper;
private final Tracer tracer;

@Inject
public WorkflowResourceResource(WorkflowResourceService workflowResourceService, WorkflowResourceMapper workflowResourceMapper,
Tracer tracer) {
public WorkflowResourceResource(WorkflowResourceService workflowResourceService, WorkflowResourceMapper workflowResourceMapper) {
this.workflowResourceService = workflowResourceService;
this.workflowResourceMapper = workflowResourceMapper;
this.tracer = tracer;
}

@GET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import jakarta.ws.rs.core.Response;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.SystemUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

Expand All @@ -20,9 +21,14 @@
import java.math.BigInteger;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import java.util.EnumSet;
import java.util.Set;

import static it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorCodeEnum.BPMN_FILE_DOES_NOT_HAVE_DEFINITION_KEY;
import static it.gov.pagopa.atmlayer.service.model.enumeration.AppErrorCodeEnum.CANNOT_EXTRACT_FILE_DEFINITION_KEY;
Expand Down Expand Up @@ -98,12 +104,39 @@ public static String toHexString(byte[] hash) {
public static File fromStringToFile(String fileBase64) {
try {
byte[] decodedBytes = Base64.getDecoder().decode(fileBase64);

Path tempDir = Files.createTempDirectory("multipleUpload");
File tempFile = File.createTempFile("tempfile", ".tmp", tempDir.toFile());
try (FileOutputStream fos = new FileOutputStream(tempFile)) {

Path tempFilePath;

if (SystemUtils.IS_OS_UNIX) {
Set<PosixFilePermission> permissions = EnumSet.of(
PosixFilePermission.OWNER_READ,
PosixFilePermission.OWNER_WRITE,
PosixFilePermission.OWNER_EXECUTE
);
FileAttribute<Set<PosixFilePermission>> fileAttributes = PosixFilePermissions.asFileAttribute(permissions);

tempFilePath = Files.createTempFile(tempDir, "tempfile", ".tmp", fileAttributes);
} else {
tempFilePath = Files.createTempFile(tempDir, "tempfile", ".tmp");

File tempFile = tempFilePath.toFile();

boolean readable = tempFile.setReadable(true, true);
boolean writable = tempFile.setWritable(true, true);
boolean executable = tempFile.setExecutable(true, true);

if (!readable || !writable || !executable) {
throw new IOException("Impossibile impostare i permessi di sicurezza sul file temporaneo.");
}
}

try (FileOutputStream fos = new FileOutputStream(tempFilePath.toFile())) {
fos.write(decodedBytes);
}
return tempFile;

return tempFilePath.toFile();
} catch (IllegalArgumentException e) {
log.error("Errore nella decodifica del Base64: " + e.getMessage());
throw new AtmLayerException("Errore nella decodifica del File Base64", Response.Status.NOT_ACCEPTABLE, AppErrorCodeEnum.FILE_DECODE_ERROR);
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application-local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ cdn.offset-path=${CDN_OFFSET_PATH:RESOURCE/}
###################
# TRACING
###################
quarkus.otel.traces.enabled=${TRACING_ENABLED:true}
quarkus.otel.traces.enabled=${TRACING_ENABLED:false}
quarkus.otel.exporter.otlp.traces.endpoint=${TRACING_ENDPOINT_BASE_PATH:http://localhost:4317}
quarkus.datasource.jdbc.telemetry=${TRACING_ENABLE_JDBC_MONITORING:true}
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ cdn.offset-path=${CDN_OFFSET_PATH:RESOURCE/}
###################
# TRACING
###################
quarkus.otel.traces.enabled=${TRACING_ENABLED:true}
quarkus.otel.traces.enabled=${TRACING_ENABLED:false}
quarkus.otel.exporter.otlp.traces.endpoint=${TRACING_ENDPOINT_BASE_PATH:http://jaeger-collector.default.svc.cluster.local:4317}
quarkus.datasource.jdbc.telemetry=${TRACING_ENABLE_JDBC_MONITORING:true}

Expand Down
Loading

0 comments on commit 488d079

Please sign in to comment.