Skip to content

Commit

Permalink
Merge pull request #1307 from Stirling-Tools/upgrades
Browse files Browse the repository at this point in the history
Tomcat to Jetty and other changes
  • Loading branch information
Frooodle authored May 27, 2024
2 parents 9041441 + 11497f5 commit 4781fd5
Show file tree
Hide file tree
Showing 31 changed files with 826 additions and 352 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ name: "Build repo"
on:
push:
branches: ["main"]
paths-ignore:
- ".github/**"
- "**/*.md"
pull_request:
branches: ["main"]
paths-ignore:
- ".github/**"
- "**/*.md"

jobs:
build:
Expand All @@ -36,7 +30,7 @@ jobs:

- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.6
gradle-version: 8.7

- name: Build with Gradle
run: ./gradlew build --no-build-cache
2 changes: 1 addition & 1 deletion .github/workflows/push-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.6
gradle-version: 8.7

- name: Run Gradle Command
run: ./gradlew clean build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/releaseArtifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 7.6
gradle-version: 8.7

- name: Generate jar (With Security=${{ matrix.enable_security }})
run: ./gradlew clean createExe
Expand Down
8 changes: 7 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ dependencies {
implementation("io.github.pixee:java-security-toolkit:1.1.3")

implementation 'org.yaml:snakeyaml:2.2'
implementation 'org.springframework.boot:spring-boot-starter-web:3.2.4'

// Exclude Tomcat and include Jetty
implementation('org.springframework.boot:spring-boot-starter-web:3.2.4') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}
implementation 'org.springframework.boot:spring-boot-starter-jetty:3.2.4'

implementation 'org.springframework.boot:spring-boot-starter-thymeleaf:3.2.4'

if (System.getenv('DOCKER_ENABLE_SECURITY') != 'false') {
Expand Down
Binary file added cucumber/exampleFiles/example.docx
Binary file not shown.
Binary file added cucumber/exampleFiles/example.odp
Binary file not shown.
Binary file added cucumber/exampleFiles/example.odt
Binary file not shown.
Binary file added cucumber/exampleFiles/example.pptx
Binary file not shown.
158 changes: 158 additions & 0 deletions cucumber/exampleFiles/example.rtf

Large diffs are not rendered by default.

136 changes: 12 additions & 124 deletions cucumber/features/examples.feature
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
@example
Feature: API Validation

@positive @password
Scenario: Remove password
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
Expand All @@ -12,7 +14,8 @@ Feature: API Validation
And the response file should have size greater than 0
And the response PDF is not passworded
And the response status code should be 200


@negative @password
Scenario: Remove password wrong password
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
Expand All @@ -24,13 +27,15 @@ Feature: API Validation
Then the response status code should be 500
And the response should contain error message "Internal Server Error"

@positive @info
Scenario: Get info
Given I generate a PDF file as "fileInput"
When I send the API request to the endpoint "/api/v1/security/get-info-on-pdf"
Then the response content type should be "application/json"
And the response file should have size greater than 100
And the response status code should be 200

@positive @password
Scenario: Add password
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
Expand All @@ -43,6 +48,7 @@ Feature: API Validation
And the response PDF is passworded
And the response status code should be 200

@positive @password
Scenario: Add password with other params
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
Expand All @@ -59,7 +65,7 @@ Feature: API Validation
And the response PDF is passworded
And the response status code should be 200

@positive @watermark
Scenario: Add watermark
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages
Expand All @@ -76,18 +82,8 @@ Feature: API Validation
Then the response content type should be "application/pdf"
And the response file should have size greater than 100
And the response status code should be 200



Scenario: Repair PDF
Given I generate a PDF file as "fileInput"
When I send the API request to the endpoint "/api/v1/misc/repair"
Then the response content type should be "application/pdf"
And the response file should have size greater than 0
And the response status code should be 200



@positive
Scenario: Remove blank pages
Given I generate a PDF file as "fileInput"
And the pdf contains 3 blank pages
Expand All @@ -100,80 +96,8 @@ Feature: API Validation
And the response file should have size greater than 0
And the response PDF should contain 0 pages
And the response status code should be 200

@ocr
Scenario: Process PDF with OCR
Given I generate a PDF file as "fileInput"
And the request data includes
| parameter | value |
| languages | eng |
| sidecar | false |
| deskew | true |
| clean | true |
| cleanFinal | true |
| ocrType | Normal |
| ocrRenderType | hocr |
| removeImagesAfter| false |
When I send the API request to the endpoint "/api/v1/misc/ocr-pdf"
Then the response content type should be "application/pdf"
And the response file should have size greater than 0
And the response status code should be 200

@ocr
Scenario: Process PDF with text and OCR with type normal
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages with random text
And the request data includes
| parameter | value |
| languages | eng |
| sidecar | false |
| deskew | true |
| clean | true |
| cleanFinal | true |
| ocrType | Normal |
| ocrRenderType | hocr |
| removeImagesAfter| false |
When I send the API request to the endpoint "/api/v1/misc/ocr-pdf"
Then the response status code should be 500

@ocr
Scenario: Process PDF with OCR
Given I generate a PDF file as "fileInput"
And the request data includes
| parameter | value |
| languages | eng |
| sidecar | false |
| deskew | true |
| clean | true |
| cleanFinal | true |
| ocrType | Force |
| ocrRenderType | hocr |
| removeImagesAfter| false |
When I send the API request to the endpoint "/api/v1/misc/ocr-pdf"
Then the response content type should be "application/pdf"
And the response file should have size greater than 0
And the response status code should be 200

@ocr
Scenario: Process PDF with OCR with sidecar
Given I generate a PDF file as "fileInput"
And the request data includes
| parameter | value |
| languages | eng |
| sidecar | true |
| deskew | true |
| clean | true |
| cleanFinal | true |
| ocrType | Force |
| ocrRenderType | hocr |
| removeImagesAfter| false |
When I send the API request to the endpoint "/api/v1/misc/ocr-pdf"
Then the response content type should be "application/octet-stream"
And the response file should have extension ".zip"
And the response file should have size greater than 0
And the response status code should be 200


@positive @flatten
Scenario: Flatten PDF
Given I generate a PDF file as "fileInput"
And the request data includes
Expand All @@ -184,6 +108,7 @@ Feature: API Validation
And the response file should have size greater than 0
And the response status code should be 200

@positive @metadata
Scenario: Update metadata
Given I generate a PDF file as "fileInput"
And the request data includes
Expand All @@ -202,41 +127,4 @@ Feature: API Validation
And the response PDF metadata should include "Title" as "Sample Title"
And the response status code should be 200

@libre
Scenario: Convert PDF to DOCX
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages with random text
And the request data includes
| parameter | value |
| outputFormat | docx |
When I send the API request to the endpoint "/api/v1/convert/pdf/word"
Then the response status code should be 200
And the response file should have size greater than 100
And the response file should have extension ".docx"
# And the response DOCX should contain 3 pages

@libre
Scenario: Convert PDF to ODT
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages with random text
And the request data includes
| parameter | value |
| outputFormat | odt |
When I send the API request to the endpoint "/api/v1/convert/pdf/word"
Then the response status code should be 200
And the response file should have size greater than 100
And the response file should have extension ".odt"
# And the response ODT should contain 3 pages

@libre
Scenario: Convert PDF to DOC
Given I generate a PDF file as "fileInput"
And the pdf contains 3 pages with random text
And the request data includes
| parameter | value |
| outputFormat | doc |
When I send the API request to the endpoint "/api/v1/convert/pdf/word"
Then the response status code should be 200
And the response file should have extension ".doc"
And the response file should have size greater than 100
# And the response DOC should contain 3 pages

Loading

0 comments on commit 4781fd5

Please sign in to comment.