Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create-rendition-test #292

Merged
merged 1 commit into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
ACS_IMAGE=alfresco/alfresco-content-repository-community
ACS_VERSION=23.2.1
TRANSFORM_CORE_AIO_IMAGE=alfresco/alfresco-transform-core-aio
TRANSFORM_CORE_AIO_VERSION=5.1.2
SHARE_IMAGE=alfresco/alfresco-share
SHARE_VERSION=23.2.1
ASS_IMAGE=alfresco/alfresco-search-services
Expand Down
20 changes: 20 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,26 @@ services:
- "8080:8080"
volumes:
- cral-acs-volume:/usr/local/tomcat/alf_data
transform-core-aio:
image: ${TRANSFORM_CORE_AIO_IMAGE}:${TRANSFORM_CORE_AIO_VERSION}
restart: on-failure
mem_limit: 2048m
environment:
JAVA_OPTS: "
-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
-Dserver.tomcat.threads.max=12
-Dserver.tomcat.threads.min=4
-Dlogging.level.org.alfresco.transform.common.TransformerDebug=ERROR
-Dlogging.level.org.alfresco.transform=ERROR
-Dlogging.level.org.apache.fontbox.ttf=ERROR
-Dlogging.level.org.apache.pdfbox.cos.COSDocument=ERROR
-Dlogging.level.org.apache.pdfbox.pdfparser=ERROR
-Dlogging.level.org.apache.pdfbox.filter.FlateFilter=ERROR
-Dlogging.level.org.apache.pdfbox.pdmodel.font=ERROR
-Dlogging.level.org.apache.pdfbox.pdmodel.font.PDSimpleFont=FATAL
-Dlogging.level.org.apache.pdfbox.pdmodel.font.PDFont=FATAL
-Dlogging.level.org.apache.pdfbox.pdmodel.font.PDCIDFont=FATAL
"
share:
image: ${SHARE_IMAGE}:${SHARE_VERSION}
mem_limit: 512m
Expand Down
Binary file added test-resources/Elkjaer_Briegel.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 43 additions & 0 deletions test/cral/renditions_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
; CRAL
; Copyright (C) 2023-2024 Saidone
;
; This program is free software: you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation, either version 3 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <http://www.gnu.org/licenses/>.

(ns cral.renditions-test
(:require [clojure.java.io :as io]
[clojure.test :refer :all]
[cral.api.auth :as auth]
[cral.api.core.nodes :as nodes]
[cral.api.core.renditions :as renditions]
[cral.config :as c]
[cral.fixtures :as fixtures]
[cral.model.alfresco.cm :as cm]
[cral.model.core :as model]
[cral.test-utils :as tu])
(:import (java.util UUID)))

(use-fixtures :once fixtures/setup)

(deftest create-rendition-test
(let [ticket (get-in (auth/create-ticket c/user c/password) [:body :entry])
;; create a node
created-node-id (->> (model/map->CreateNodeBody {:name (str (.toString (UUID/randomUUID)) ".jpg") :node-type cm/type-content})
(nodes/create-node ticket (tu/get-guest-home ticket))
(#(get-in % [:body :entry :id])))
;; update the node content
_ (nodes/update-node-content ticket created-node-id (io/as-file (io/resource "Elkjaer_Briegel.jpg")))
create-rendition-response (renditions/create-rendition ticket created-node-id [(model/map->CreateRenditionBody {:id "doclib"})])]
(is (= (:status create-rendition-response) 202))
;; clean up
(is (= (:status (nodes/delete-node ticket created-node-id {:permanent true})) 204))))