Skip to content

Commit 2970dfa

Browse files
committed
add tests and update example images
1 parent b29ff3c commit 2970dfa

File tree

6 files changed

+99
-41
lines changed

6 files changed

+99
-41
lines changed

Dockerfile

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,14 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3535
&& apt-get install -y nodejs \
3636
&& apt-get clean && rm -rf /var/lib/apt/lists/*
3737

38-
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-arm64 \
39-
PATH="/usr/lib/jvm/java-17-openjdk-arm64/bin:/opt/venv/bin:${PATH}"
40-
41-
# Verify installation and create architecture-agnostic symlink as fallback
42-
RUN set -eux; \
43-
if [ ! -d "$JAVA_HOME" ]; then \
44-
JAVA_HOME="$(dirname $(dirname $(readlink -f $(which java))))"; \
45-
fi; \
46-
ln -sf "$JAVA_HOME" /usr/local/java; \
47-
java -version; \
48-
javac -version
38+
# Set JAVA_HOME
39+
RUN export JAVA_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::") && \
40+
echo "JAVA_HOME=$JAVA_HOME" >> /etc/environment
41+
42+
ENV PATH="/opt/venv/bin:${PATH}"
43+
44+
# Verify Java installation
45+
RUN java -version && javac -version
4946

5047
# Set up Python virtual environment
5148
RUN python3 -m venv $VENV_PATH \
@@ -55,8 +52,10 @@ RUN python3 -m venv $VENV_PATH \
5552
# Install Python SDK
5653
RUN if [ "${ARCH}" = "linux-aarch64" ]; then \
5754
PYTHON_ARCH="linux_aarch64"; \
55+
SDK_ARCH="linux-aarch64"; \
5856
else \
5957
PYTHON_ARCH="linux_x86_64"; \
58+
SDK_ARCH="linux-x86_64"; \
6059
fi && \
6160
pip install "${SDK_BASE_URL}${SDK_VERSION}/scanbotsdk-${SDK_VERSION}-py3-none-${PYTHON_ARCH}.whl" && \
6261
echo "Python SDK installed successfully"
@@ -66,20 +65,26 @@ WORKDIR /workspaces/scanbot-sdk-example-linux
6665
COPY . .
6766

6867
# Download and install all remaining SDKs in optimal locations
69-
RUN echo "Installing Node.js, Java, and C SDKs for architecture: ${ARCH}" && \
70-
# Download platform-dependent SDKs (Java and C)
71-
curl -L -O "${SDK_BASE_URL}${SDK_VERSION}/scanbotsdk-${SDK_VERSION}-${ARCH}.jar" && \
72-
curl -L -O "${SDK_BASE_URL}${SDK_VERSION}/scanbotsdk-${SDK_VERSION}-${ARCH}.tar.gz" && \
73-
# Install Node.js SDK
68+
RUN echo "Installing Java and C SDKs for architecture: ${ARCH}" && \
69+
# Set the correct SDK architecture for downloads
70+
if [ "${ARCH}" = "linux-aarch64" ]; then \
71+
SDK_ARCH="linux-aarch64"; \
72+
else \
73+
SDK_ARCH="linux-x86_64"; \
74+
fi && \
75+
# Download platform-dependent SDKs (Java and C only)
76+
curl -L -O "${SDK_BASE_URL}${SDK_VERSION}/scanbotsdk-${SDK_VERSION}-${SDK_ARCH}.jar" && \
77+
curl -L -O "${SDK_BASE_URL}${SDK_VERSION}/scanbotsdk-${SDK_VERSION}-${SDK_ARCH}.tar.gz" && \
78+
# Install Node.js SDK (platform-independent npm package)
7479
cd examples/nodejs && \
7580
npm install "${SDK_BASE_URL}${SDK_VERSION}/nodejs-scanbotsdk-${SDK_VERSION}.tgz" && \
7681
cd /workspaces/scanbot-sdk-example-linux && \
77-
# Install Java SDK
82+
# Setup Java SDK
7883
mkdir -p examples/java/build/libs && \
79-
cp "scanbotsdk-${SDK_VERSION}-${ARCH}.jar" examples/java/build/libs/scanbotsdk.jar && \
80-
# Install C SDK
84+
cp "scanbotsdk-${SDK_VERSION}-${SDK_ARCH}.jar" examples/java/build/libs/scanbotsdk.jar && \
85+
# Setup C SDK
8186
mkdir -p examples/c/build/scanbotsdk && \
82-
tar -xzf "scanbotsdk-${SDK_VERSION}-${ARCH}.tar.gz" -C examples/c/build/scanbotsdk --strip-components=1 && \
87+
tar -xzf "scanbotsdk-${SDK_VERSION}-${SDK_ARCH}.tar.gz" -C examples/c/build/scanbotsdk --strip-components=1 && \
8388
# Clean up downloads
8489
rm -f *.tar.gz *.jar && \
8590
echo "All SDKs installed successfully"

Jenkinsfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pipeline {
33

44
options {
55
timestamps()
6-
timeout(time: 25, unit: 'MINUTES')
6+
timeout(time: 35, unit: 'MINUTES')
77
}
88

99
parameters {
@@ -43,7 +43,7 @@ pipeline {
4343
def dockerArch = ''
4444

4545
if (agentArch == 'x86_64') {
46-
dockerArch = 'linux-x86-64'
46+
dockerArch = 'linux-x86_64'
4747
} else if (agentArch == 'aarch64' || agentArch == 'arm64') {
4848
dockerArch = 'linux-aarch64'
4949
} else {

test-scripts/test-c.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,28 +46,38 @@ LICENSE_KEY="${SCANBOT_LICENSE}"
4646
echo "Testing SCAN commands..."
4747
commands=(
4848
"scan barcode --file ../../images/qrcode.png --license \"${LICENSE_KEY}\""
49-
"scan document --file ../../images/Document.JPG --license \"${LICENSE_KEY}\""
49+
"scan document --file ../../images/Document.png --license \"${LICENSE_KEY}\""
5050
"scan check --file ../../images/check.jpg --license \"${LICENSE_KEY}\""
5151
"scan credit_card --file ../../images/credit_card.png --license \"${LICENSE_KEY}\""
52-
"scan mrz --file \"../../images/MEXico MRZ passport old-1.jpg\" --license \"${LICENSE_KEY}\""
52+
"scan document_extractor --file ../../images/Document.png --license \"${LICENSE_KEY}\""
53+
"scan medical_certificate --file ../../images/medical_certificate.png --license \"${LICENSE_KEY}\""
54+
"scan mrz --file ../../images/MRZ_passport.png --license \"${LICENSE_KEY}\""
55+
"scan ocr --file ../../images/Document.png --license \"${LICENSE_KEY}\""
56+
"scan text_pattern --file ../../images/Document.png --license \"${LICENSE_KEY}\""
5357
"scan vin --file ../../images/VIN.png --license \"${LICENSE_KEY}\""
54-
"classify document --file ../../images/Document.JPG --license \"${LICENSE_KEY}\""
58+
"classify document --file ../../images/toll_receipt.png --license \"${LICENSE_KEY}\""
5559
"analyze analyze_multi_page --file ../../images/multi_page_document.pdf --license \"${LICENSE_KEY}\""
56-
"analyze crop_analyze --file ../../images/Document.JPG --save /tmp/crop.jpg --license \"${LICENSE_KEY}\""
60+
"analyze crop_analyze --file ../../images/Document.png --license \"${LICENSE_KEY}\""
5761
"parse mrz --text \"P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<<<<<<<<<<ERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<<<<<<<<<<\" --license \"${LICENSE_KEY}\""
62+
"parse barcode_doc --text \"QR_CODE:https://example.com\" --license \"${LICENSE_KEY}\""
5863
)
5964

6065
command_names=(
6166
"Barcode scan"
6267
"Document scan"
6368
"Check scan"
6469
"Credit card scan"
70+
"Document extractor scan"
71+
"Medical certificate scan"
6572
"MRZ scan"
73+
"OCR scan"
74+
"Text pattern scan"
6675
"VIN scan"
6776
"Document classify"
6877
"Multi-page analyze"
6978
"Crop analyze"
7079
"MRZ parse"
80+
"Barcode document parse"
7181
)
7282

7383
for i in "${!commands[@]}"; do

test-scripts/test-java.sh

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,42 @@ fi
3232

3333
LICENSE_KEY="${SCANBOT_LICENSE}"
3434

35-
echo "Testing SCAN commands..."
35+
echo "Testing JAVA commands..."
3636
# All failures are actual failures - no exceptions for license errors
3737
commands=(
3838
"scan barcode --file ../images/qrcode.png --license \"${LICENSE_KEY}\""
39-
"scan document --file ../images/Document.JPG --license \"${LICENSE_KEY}\""
39+
"scan document --file ../images/Document.png --license \"${LICENSE_KEY}\""
4040
"scan check --file ../images/check.jpg --license \"${LICENSE_KEY}\""
4141
"scan credit_card --file ../images/credit_card.png --license \"${LICENSE_KEY}\""
42-
"scan mrz --file \"../images/MEXico MRZ passport old-1.jpg\" --license \"${LICENSE_KEY}\""
42+
"scan document_extractor --file ../images/Document.png --license \"${LICENSE_KEY}\""
43+
"scan medical_certificate --file ../images/medical_certificate.png --license \"${LICENSE_KEY}\""
44+
"scan mrz --file ../images/MRZ_passport.png --license \"${LICENSE_KEY}\""
45+
"scan ocr --file ../images/Document.png --license \"${LICENSE_KEY}\""
46+
"scan text_pattern --file ../images/Document.png --license \"${LICENSE_KEY}\""
4347
"scan vin --file ../images/VIN.png --license \"${LICENSE_KEY}\""
44-
"classify document --file ../images/Document.JPG --license \"${LICENSE_KEY}\""
45-
"analyze analyze_multi_page --file ../images/multi_page_document.pdf --license \"${LICENSE_KEY}\""
46-
"analyze crop_analyze --file ../images/Document.JPG --save /tmp/crop.jpg --license \"${LICENSE_KEY}\""
48+
"classify document --file ../images/toll_receipt.png --license \"${LICENSE_KEY}\""
49+
"analyze analyze_multi_page --file ../images/multi_page_document.pdf --save /tmp/out.pdf --license \"${LICENSE_KEY}\""
50+
"analyze crop_analyze --file ../images/Document.png --save /tmp/crop.jpg --license \"${LICENSE_KEY}\""
4751
"parse mrz --text \"P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<<<<<<<<<<ERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<<<<<<<<<<\" --license \"${LICENSE_KEY}\""
52+
"parse barcode_doc --text \"QR_CODE:https://example.com\" --license \"${LICENSE_KEY}\""
53+
)
54+
55+
command_names=(
56+
"Barcode scan"
57+
"Document scan"
58+
"Check scan"
59+
"Credit card scan"
60+
"Document extractor scan"
61+
"Medical certificate scan"
62+
"MRZ scan"
63+
"OCR scan"
64+
"Text pattern scan"
65+
"VIN scan"
66+
"Document classify"
67+
"Multi-page analyze"
68+
"Crop analyze"
69+
"MRZ parse"
70+
"Barcode document parse"
4871
)
4972

5073
command_names=(

test-scripts/test-nodejs.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,32 +40,42 @@ fi
4040

4141
LICENSE_KEY="${SCANBOT_LICENSE}"
4242

43-
echo "Testing SCAN commands..."
43+
echo "Testing NODEJS commands..."
4444
# All failures are actual failures - no exceptions for license errors
4545
commands=(
4646
"scan barcode --file ../images/qrcode.png --license \"${LICENSE_KEY}\""
47-
"scan document --file ../images/Document.JPG --license \"${LICENSE_KEY}\""
47+
"scan document --file ../images/Document.png --license \"${LICENSE_KEY}\""
4848
"scan check --file ../images/check.jpg --license \"${LICENSE_KEY}\""
4949
"scan credit_card --file ../images/credit_card.png --license \"${LICENSE_KEY}\""
50-
"scan mrz --file \"../images/MEXico MRZ passport old-1.jpg\" --license \"${LICENSE_KEY}\""
50+
"scan document_extractor --file ../images/Document.png --license \"${LICENSE_KEY}\""
51+
"scan medical_certificate --file ../images/medical_certificate.png --license \"${LICENSE_KEY}\""
52+
"scan mrz --file ../images/MRZ_passport.png --license \"${LICENSE_KEY}\""
53+
"scan ocr --file ../images/Document.png --license \"${LICENSE_KEY}\""
54+
"scan text_pattern --file ../images/Document.png --license \"${LICENSE_KEY}\""
5155
"scan vin --file ../images/VIN.png --license \"${LICENSE_KEY}\""
52-
"classify document --file ../images/Document.JPG --license \"${LICENSE_KEY}\""
56+
"classify document --file ../images/toll_receipt.png --license \"${LICENSE_KEY}\""
5357
"analyze analyze_multi_page --file ../images/multi_page_document.pdf --license \"${LICENSE_KEY}\""
54-
"analyze crop_analyze --file ../images/Document.JPG --save /tmp/crop.jpg --license \"${LICENSE_KEY}\""
58+
"analyze crop_analyze --file ../images/Document.png --license \"${LICENSE_KEY}\""
5559
"parse mrz --text \"P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<<<<<<<<<<ERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<<<<<<<<<<\" --license \"${LICENSE_KEY}\""
60+
"parse barcode_doc --text \"QR_CODE:https://example.com\" --license \"${LICENSE_KEY}\""
5661
)
5762

5863
command_names=(
5964
"Barcode scan"
6065
"Document scan"
6166
"Check scan"
6267
"Credit card scan"
68+
"Document extractor scan"
69+
"Medical certificate scan"
6370
"MRZ scan"
71+
"OCR scan"
72+
"Text pattern scan"
6473
"VIN scan"
6574
"Document classify"
6675
"Multi-page analyze"
6776
"Crop analyze"
6877
"MRZ parse"
78+
"Barcode document parse"
6979
)
7080

7181
for i in "${!commands[@]}"; do

test-scripts/test-python.sh

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,38 @@ echo "Testing SCAN commands..."
3636
# All failures are actual failures - no exceptions for license errors
3737
commands=(
3838
"scan barcode --file ../images/qrcode.png --license \"${LICENSE_KEY}\""
39-
"scan document --file ../images/Document.JPG --license \"${LICENSE_KEY}\""
39+
"scan document --file ../images/Document.png --license \"${LICENSE_KEY}\""
4040
"scan check --file ../images/check.jpg --license \"${LICENSE_KEY}\""
4141
"scan credit_card --file ../images/credit_card.png --license \"${LICENSE_KEY}\""
42-
"scan mrz --file \"../images/MEXico MRZ passport old-1.jpg\" --license \"${LICENSE_KEY}\""
42+
"scan document_data_extractor --file ../images/Document.png --license \"${LICENSE_KEY}\""
43+
"scan medical_certificate --file \"../images/medical_certificate.png\" --license \"${LICENSE_KEY}\""
44+
"scan mrz --file \"../images/MRZ_passport.png\" --license \"${LICENSE_KEY}\""
45+
"scan ocr --file ../images/Document.png --license \"${LICENSE_KEY}\""
46+
"scan text_pattern --file ../images/Document.png --license \"${LICENSE_KEY}\""
4347
"scan vin --file ../images/VIN.png --license \"${LICENSE_KEY}\""
44-
"classify document --file ../images/Document.JPG --license \"${LICENSE_KEY}\""
48+
"classify document --file ../images/toll_receipt.png --license \"${LICENSE_KEY}\""
4549
"analyze analyze_multi_page --file ../images/multi_page_document.pdf --license \"${LICENSE_KEY}\""
46-
"analyze crop_analyze --file ../images/Document.JPG --license \"${LICENSE_KEY}\""
50+
"analyze crop_analyze --file ../images/Document.png --license \"${LICENSE_KEY}\""
4751
"parse mrz --text \"P<UTOERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<<<<<<<<<<ERIKSSON<<ANNA<MARIA<<<<<<<<<<<<<<<<<<<<<<<<<<<<\" --license \"${LICENSE_KEY}\""
52+
"parse barcode_doc --text \"QR_CODE:https://example.com\" --license \"${LICENSE_KEY}\""
4853
)
4954

5055
command_names=(
5156
"Barcode scan"
5257
"Document scan"
5358
"Check scan"
5459
"Credit card scan"
60+
"Document data extractor scan"
61+
"Medical certificate scan"
5562
"MRZ scan"
63+
"OCR scan"
64+
"Text pattern scan"
5665
"VIN scan"
5766
"Document classify"
5867
"Multi-page analyze"
5968
"Crop analyze"
6069
"MRZ parse"
70+
"Barcode document parse"
6171
)
6272

6373
for i in "${!commands[@]}"; do

0 commit comments

Comments
 (0)