Skip to content

Commit

Permalink
Merge branch 'integration' into rest-api-test-automation
Browse files Browse the repository at this point in the history
  • Loading branch information
georgetarazevich committed Jan 10, 2024
2 parents e100d0d + 4eb51c4 commit 202b654
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 20 deletions.
7 changes: 6 additions & 1 deletion kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ spec:
labels:
project: verapdf-rest
spec:
terminationGracePeriodSeconds: 300
containers:
- name : verapdf-rest
image: ghcr.io/verapdf/rest:dev
lifecycle:
preStop:
exec:
command: ["/bin/sleep", "300"]
resources:
requests:
cpu: "250m"
limits:
cpu: "250m"
cpu: "2000m"
ports:
- containerPort: 8080
name : rest-api-port
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/verapdf/rest/resources/ProfileResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public static Set<PDFAFlavour> getFlavours() {
/**
* @param profileId
* the String id of the Validation profile (1b, 1a, 2b, 2a, 2u,
* 3b, 3a, 3u, 4, 4e, 4f or ua1)
* 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)
* @return a validation profile selected by id
*/
@GET
Expand All @@ -108,15 +108,15 @@ public static Set<PDFAFlavour> getFlavours() {
)})})
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public static ValidationProfile getProfile(@Parameter(description = "the String id of the Validation profile " +
"(1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f or ua1)")
"(1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)")
@PathParam("profileId") String profileId) {
return DIRECTORY.getValidationProfileById(profileId);
}

/**
* @param profileId
* the String id of the Validation profile (1b, 1a, 2b, 2a, 2u,
* 3b, 3a, 3u, 4, 4e, 4f or ua1)
* 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)
* @return the {@link java.util.Set} of
* {@link org.verapdf.pdfa.validation.profiles.RuleId}s for the selected
* Validation Profile
Expand All @@ -133,7 +133,7 @@ public static ValidationProfile getProfile(@Parameter(description = "the String
)})})
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public static Set<RuleId> getProfileRules(@Parameter(description = "the String id of the Validation profile " +
"(1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f or ua1)")
"(1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)")
@PathParam("profileId") String profileId) {
SortedSet<RuleId> ids = new TreeSet<>(new Profiles.RuleIdComparator());
for (Rule rule : DIRECTORY.getValidationProfileById(profileId).getRules()) {
Expand All @@ -145,7 +145,7 @@ public static Set<RuleId> getProfileRules(@Parameter(description = "the String i
/**
* @param profileId
* the String id of the Validation profile (1b, 1a, 2b, 2a, 2u,
* 3b, 3a, 3u, 4, 4e, 4f or ua1)
* 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)
* @param clause
* a {@link java.lang.String} identifying the profile clause to
* return the Rules for
Expand All @@ -165,7 +165,7 @@ public static Set<RuleId> getProfileRules(@Parameter(description = "the String i
)})})
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public static Set<Rule> getRulesForClause(@Parameter(description = "the String id of the Validation profile " +
"(1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f or ua1)")
"(1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)")
@PathParam("profileId") String profileId,
@Parameter(description = "a string identifying the profile clause to return the rules for")
@PathParam("clause") String clause) {
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/org/verapdf/rest/resources/ValidateResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static ComponentDetails getDetails() {
* @param profileId
* the String id of the Validation profile
* (auto, 1b, 1a, 2b, 2a, 2u,
* 3b, 3a, 3u, 4, 4e, 4f or ua1)
* 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)
* @param uploadedInputStream
* a {@link java.io.InputStream} to the PDF to
* be validated
Expand All @@ -108,7 +108,7 @@ public static ComponentDetails getDetails() {
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.APPLICATION_XML})
public static InputStream validateXml(@Parameter(description = "the String id of the Validation profile " +
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f or ua1)")
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)")
@PathParam("profileId") String profileId,
@Parameter(name = "file", schema = @Schema(implementation = File.class),
style = ParameterStyle.FORM, description = "an InputStream of the PDF to be validated")
Expand All @@ -123,7 +123,7 @@ public static InputStream validateXml(@Parameter(description = "the String id of
* @param profileId
* the String id of the Validation profile
* (auto, 1b, 1a, 2b, 2a, 2u,
* 3b, 3a, 3u, 4, 4e, 4f or ua1)
* 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)
* @param sha1Hex
* the hex String representation of the file's
* SHA-1 hash
Expand All @@ -149,7 +149,7 @@ public static InputStream validateXml(@Parameter(description = "the String id of
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.APPLICATION_XML})
public static InputStream validateXml(@Parameter(description = "the String id of the Validation profile " +
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f or ua1)")
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)")
@PathParam("profileId") String profileId,
@Parameter(description = "the hex String representation of the file's SHA-1 hash")
@FormDataParam("sha1Hex") String sha1Hex,
Expand Down Expand Up @@ -177,7 +177,7 @@ public static InputStream validateXml(@Parameter(description = "the String id of
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.APPLICATION_XML})
public static InputStream validateXml(@Parameter(description = "the String id of the Validation profile " +
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f or ua1)")
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)")
@PathParam("profileId") String profileId,
@Parameter(description = "a URL of PDF to be validated")
@FormDataParam("url") String urlLink,
Expand All @@ -190,7 +190,7 @@ public static InputStream validateXml(@Parameter(description = "the String id of
* @param profileId
* the String id of the Validation profile
* (auto, 1b, 1a, 2b, 2a, 2u,
* 3b, 3a, 3u, 4, 4e, 4f or ua1)
* 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)
* @param uploadedInputStream
* a {@link java.io.InputStream} to the PDF to
* be validated
Expand All @@ -203,7 +203,7 @@ public static InputStream validateXml(@Parameter(description = "the String id of
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.APPLICATION_JSON})
public static InputStream validateJson(@Parameter(description = "the String id of the Validation profile " +
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f or ua1)")
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)")
@PathParam("profileId") String profileId,
@Parameter(name = "file", schema = @Schema(implementation = File.class),
style = ParameterStyle.FORM, description = "an InputStream of the PDF to be validated")
Expand All @@ -218,7 +218,7 @@ public static InputStream validateJson(@Parameter(description = "the String id o
* @param profileId
* the String id of the Validation profile
* (auto, 1b, 1a, 2b, 2a, 2u,
* 3b, 3a, 3u, 4, 4e, 4f or ua1)
* 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)
* @param sha1Hex
* the hex String representation of the file's
* SHA-1 hash
Expand All @@ -234,7 +234,7 @@ public static InputStream validateJson(@Parameter(description = "the String id o
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.APPLICATION_JSON})
public static InputStream validateJson(@Parameter(description = "the String id of the Validation profile " +
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f or ua1)")
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)")
@PathParam("profileId") String profileId,
@Parameter(description = "the hex String representation of the file's SHA-1 hash")
@FormDataParam("sha1Hex") String sha1Hex,
Expand All @@ -253,7 +253,7 @@ public static InputStream validateJson(@Parameter(description = "the String id o
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.APPLICATION_JSON})
public static InputStream validateJson(@Parameter(description = "the String id of the Validation profile " +
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f or ua1)")
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)")
@PathParam("profileId") String profileId,
@Parameter(description = "a URL of PDF to be validated")
@FormDataParam("url") String urlLink,
Expand All @@ -266,7 +266,7 @@ public static InputStream validateJson(@Parameter(description = "the String id o
* @param profileId
* the String id of the Validation profile
* (auto, 1b, 1a, 2b, 2a, 2u,
* 3b, 3a, 3u, 4, 4e, 4f or ua1)
* 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)
* @param uploadedInputStream
* a {@link java.io.InputStream} to the PDF to
* be validated
Expand All @@ -291,7 +291,7 @@ public static InputStream validateHtml(@PathParam("profileId") String profileId,
* @param profileId
* the String id of the Validation profile
* (auto, 1b, 1a, 2b, 2a, 2u,
* 3b, 3a, 3u, 4, 4e, 4f or ua1)
* 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)
* @param sha1Hex
* the hex String representation of the file's
* SHA-1 hash
Expand Down Expand Up @@ -322,7 +322,7 @@ public static InputStream validateHtml(@PathParam("profileId") String profileId,
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces({MediaType.TEXT_HTML})
public static InputStream validateHtml(@Parameter(description = "the String id of the Validation profile " +
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f or ua1)")
"(auto, 1b, 1a, 2b, 2a, 2u, 3b, 3a, 3u, 4, 4e, 4f, ua1 or ua2)")
@PathParam("profileId") String profileId,
@Parameter(description = "a URL of PDF to be validated")
@FormDataParam("url") String urlLink,
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/org/verapdf/rest/views/restclient.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<option value="4e">PDF/A-4e Engineering</option>
<option value="4f">PDF/A-4f EmbeddedFiles</option>
<option value="ua1">PDF/UA-1</option>
<option value="ua2">PDF/UA-2</option>
</select>
</div>
<div class="form-group">
Expand Down Expand Up @@ -151,6 +152,9 @@
<li><a target="_blank" href="https://www.loc.gov/preservation/digital/formats/fdd/fdd000350.shtml">PDF/UA-1</a> |
<a href="/api/profiles/ua1" target="_blank">ua1</a>
</li>
<li><a target="_blank">PDF/UA-2</a> |
<a href="/api/profiles/ua2" target="_blank">ua2</a>
</li>
</ul>
</div>
<div id="footer">
Expand Down

0 comments on commit 202b654

Please sign in to comment.