diff --git a/.github/workflows/_test-code-samples.yml b/.github/workflows/_test-code-samples.yml index dd68a5420..896227d18 100644 --- a/.github/workflows/_test-code-samples.yml +++ b/.github/workflows/_test-code-samples.yml @@ -3,6 +3,16 @@ on: workflow_call: workflow_dispatch: +env: + MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }} + WORKFLOW_ID: ${{ secrets.WORKFLOW_ID_SE_TESTS }} + MINDEE_V2_API_KEY: ${{ secrets.MINDEE_V2_SE_TESTS_API_KEY }} + MINDEE_V2_SE_TESTS_BLANK_PDF_URL: ${{ secrets.MINDEE_V2_SE_TESTS_BLANK_PDF_URL }} + MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID }} + MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID }} + MINDEE_V2_SE_TESTS_CROP_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_CROP_MODEL_ID }} + MINDEE_V2_SE_TESTS_SPLIT_MODEL_ID: ${{ secrets.MINDEE_V2_SE_TESTS_SPLIT_MODEL_ID }} + jobs: test_sample_code: name: Test Code Samples @@ -31,6 +41,10 @@ jobs: - name: Install mindee-java-api run: mvn clean install -DskipTests - - name: Tests sample code + - name: Tests v2 sample code + run: | + ./tests/test_v2_code_samples.sh + + - name: Tests v1 sample code run: | - ./tests/test_code_samples.sh ${{ secrets.MINDEE_ACCOUNT_SE_TESTS }} ${{ secrets.MINDEE_ENDPOINT_SE_TESTS }} ${{ secrets.MINDEE_API_KEY_SE_TESTS }} ${{ secrets.MINDEE_V2_SE_TESTS_API_KEY }} ${{ secrets.MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID }} + ./tests/test_v1_code_samples.sh ${{ secrets.MINDEE_ACCOUNT_SE_TESTS }} ${{ secrets.MINDEE_ENDPOINT_SE_TESTS }} diff --git a/docs/code_samples/bank_account_details_v1.txt b/docs/code_samples/bank_account_details_v1.txt index df892556e..c92adf1ca 100644 --- a/docs/code_samples/bank_account_details_v1.txt +++ b/docs/code_samples/bank_account_details_v1.txt @@ -5,7 +5,7 @@ import com.mindee.product.fr.bankaccountdetails.BankAccountDetailsV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/bank_account_details_v2.txt b/docs/code_samples/bank_account_details_v2.txt index 34d0abe75..7965f8b3d 100644 --- a/docs/code_samples/bank_account_details_v2.txt +++ b/docs/code_samples/bank_account_details_v2.txt @@ -5,7 +5,7 @@ import com.mindee.product.fr.bankaccountdetails.BankAccountDetailsV2; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/bank_check_v1.txt b/docs/code_samples/bank_check_v1.txt index 0eaa121bf..1823ad820 100644 --- a/docs/code_samples/bank_check_v1.txt +++ b/docs/code_samples/bank_check_v1.txt @@ -5,7 +5,7 @@ import com.mindee.product.us.bankcheck.BankCheckV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/barcode_reader_v1.txt b/docs/code_samples/barcode_reader_v1.txt index 53e886741..7d02437d7 100644 --- a/docs/code_samples/barcode_reader_v1.txt +++ b/docs/code_samples/barcode_reader_v1.txt @@ -5,7 +5,7 @@ import com.mindee.product.barcodereader.BarcodeReaderV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/bill_of_lading_v1_async.txt b/docs/code_samples/bill_of_lading_v1_async.txt index cebc3224d..4c77c884b 100644 --- a/docs/code_samples/bill_of_lading_v1_async.txt +++ b/docs/code_samples/bill_of_lading_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.billoflading.BillOfLadingV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/business_card_v1_async.txt b/docs/code_samples/business_card_v1_async.txt index c8ceefdf3..c92559522 100644 --- a/docs/code_samples/business_card_v1_async.txt +++ b/docs/code_samples/business_card_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.businesscard.BusinessCardV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/carte_grise_v1.txt b/docs/code_samples/carte_grise_v1.txt index df226abab..b95b3c542 100644 --- a/docs/code_samples/carte_grise_v1.txt +++ b/docs/code_samples/carte_grise_v1.txt @@ -5,7 +5,7 @@ import com.mindee.product.fr.cartegrise.CarteGriseV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/cropper_v1.txt b/docs/code_samples/cropper_v1.txt index 54e948541..ebfe63583 100644 --- a/docs/code_samples/cropper_v1.txt +++ b/docs/code_samples/cropper_v1.txt @@ -5,7 +5,7 @@ import com.mindee.product.cropper.CropperV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/custom_v1.txt b/docs/code_samples/custom_v1.txt index 21824c5f7..306ae8da8 100644 --- a/docs/code_samples/custom_v1.txt +++ b/docs/code_samples/custom_v1.txt @@ -6,7 +6,7 @@ import com.mindee.http.Endpoint; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/default.txt b/docs/code_samples/default.txt index 444def4b3..eb497b35d 100644 --- a/docs/code_samples/default.txt +++ b/docs/code_samples/default.txt @@ -6,7 +6,7 @@ import com.mindee.http.Endpoint; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/default_async.txt b/docs/code_samples/default_async.txt index 5f79252d2..11039520e 100644 --- a/docs/code_samples/default_async.txt +++ b/docs/code_samples/default_async.txt @@ -6,7 +6,7 @@ import com.mindee.http.Endpoint; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/delivery_notes_v1_async.txt b/docs/code_samples/delivery_notes_v1_async.txt index aaf2743ae..14ce28dab 100644 --- a/docs/code_samples/delivery_notes_v1_async.txt +++ b/docs/code_samples/delivery_notes_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.deliverynote.DeliveryNoteV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/driver_license_v1_async.txt b/docs/code_samples/driver_license_v1_async.txt index 046d923af..ff91d52a8 100644 --- a/docs/code_samples/driver_license_v1_async.txt +++ b/docs/code_samples/driver_license_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.driverlicense.DriverLicenseV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/energy_bill_fra_v1_async.txt b/docs/code_samples/energy_bill_fra_v1_async.txt index b6d01da7c..dbcc08313 100644 --- a/docs/code_samples/energy_bill_fra_v1_async.txt +++ b/docs/code_samples/energy_bill_fra_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.fr.energybill.EnergyBillV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/expense_receipts_v5.txt b/docs/code_samples/expense_receipts_v5.txt index 4e5249ff8..07390d160 100644 --- a/docs/code_samples/expense_receipts_v5.txt +++ b/docs/code_samples/expense_receipts_v5.txt @@ -5,7 +5,7 @@ import com.mindee.product.receipt.ReceiptV5; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/expense_receipts_v5_async.txt b/docs/code_samples/expense_receipts_v5_async.txt index 6fafe3e72..c6fe76144 100644 --- a/docs/code_samples/expense_receipts_v5_async.txt +++ b/docs/code_samples/expense_receipts_v5_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.receipt.ReceiptV5; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/financial_document_v1.txt b/docs/code_samples/financial_document_v1.txt index fd2826f7f..f9e269c5f 100644 --- a/docs/code_samples/financial_document_v1.txt +++ b/docs/code_samples/financial_document_v1.txt @@ -5,7 +5,7 @@ import com.mindee.product.financialdocument.FinancialDocumentV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/financial_document_v1_async.txt b/docs/code_samples/financial_document_v1_async.txt index 717735c21..2de07a924 100644 --- a/docs/code_samples/financial_document_v1_async.txt +++ b/docs/code_samples/financial_document_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.financialdocument.FinancialDocumentV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/french_healthcard_v1_async.txt b/docs/code_samples/french_healthcard_v1_async.txt index c93981c17..2f009c44d 100644 --- a/docs/code_samples/french_healthcard_v1_async.txt +++ b/docs/code_samples/french_healthcard_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.fr.healthcard.HealthCardV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/idcard_fr_v1.txt b/docs/code_samples/idcard_fr_v1.txt index 7672e9908..c760517d7 100644 --- a/docs/code_samples/idcard_fr_v1.txt +++ b/docs/code_samples/idcard_fr_v1.txt @@ -5,7 +5,7 @@ import com.mindee.product.fr.idcard.IdCardV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/idcard_fr_v2.txt b/docs/code_samples/idcard_fr_v2.txt index 6fd158d4f..15ad29781 100644 --- a/docs/code_samples/idcard_fr_v2.txt +++ b/docs/code_samples/idcard_fr_v2.txt @@ -5,7 +5,7 @@ import com.mindee.product.fr.idcard.IdCardV2; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/ind_passport_v1_async.txt b/docs/code_samples/ind_passport_v1_async.txt index fea275bca..2bde854cd 100644 --- a/docs/code_samples/ind_passport_v1_async.txt +++ b/docs/code_samples/ind_passport_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.ind.indianpassport.IndianPassportV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/international_id_v2_async.txt b/docs/code_samples/international_id_v2_async.txt index bab7bb49f..e12c1774b 100644 --- a/docs/code_samples/international_id_v2_async.txt +++ b/docs/code_samples/international_id_v2_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.internationalid.InternationalIdV2; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/invoice_splitter_v1_async.txt b/docs/code_samples/invoice_splitter_v1_async.txt index 05f914da3..69abfa569 100644 --- a/docs/code_samples/invoice_splitter_v1_async.txt +++ b/docs/code_samples/invoice_splitter_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.invoicesplitter.InvoiceSplitterV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/invoices_v4.txt b/docs/code_samples/invoices_v4.txt index 614e90c15..cb472586c 100644 --- a/docs/code_samples/invoices_v4.txt +++ b/docs/code_samples/invoices_v4.txt @@ -5,7 +5,7 @@ import com.mindee.product.invoice.InvoiceV4; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/invoices_v4_async.txt b/docs/code_samples/invoices_v4_async.txt index 292ca4513..51caddb3a 100644 --- a/docs/code_samples/invoices_v4_async.txt +++ b/docs/code_samples/invoices_v4_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.invoice.InvoiceV4; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/multi_receipts_detector_v1.txt b/docs/code_samples/multi_receipts_detector_v1.txt index 83186b9f8..190e9bfb0 100644 --- a/docs/code_samples/multi_receipts_detector_v1.txt +++ b/docs/code_samples/multi_receipts_detector_v1.txt @@ -5,7 +5,7 @@ import com.mindee.product.multireceiptsdetector.MultiReceiptsDetectorV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/nutrition_facts_v1_async.txt b/docs/code_samples/nutrition_facts_v1_async.txt index 528658aec..3320d196a 100644 --- a/docs/code_samples/nutrition_facts_v1_async.txt +++ b/docs/code_samples/nutrition_facts_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.nutritionfactslabel.NutritionFactsLabelV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/passport_v1.txt b/docs/code_samples/passport_v1.txt index a6201382d..9b3cb1950 100644 --- a/docs/code_samples/passport_v1.txt +++ b/docs/code_samples/passport_v1.txt @@ -5,7 +5,7 @@ import com.mindee.product.passport.PassportV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/payslip_fra_v2_async.txt b/docs/code_samples/payslip_fra_v2_async.txt index de1f74358..28788aa25 100644 --- a/docs/code_samples/payslip_fra_v2_async.txt +++ b/docs/code_samples/payslip_fra_v2_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.fr.payslip.PayslipV2; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/payslip_fra_v3_async.txt b/docs/code_samples/payslip_fra_v3_async.txt index 7ef75a803..ee10e4705 100644 --- a/docs/code_samples/payslip_fra_v3_async.txt +++ b/docs/code_samples/payslip_fra_v3_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.fr.payslip.PayslipV3; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/resume_v1_async.txt b/docs/code_samples/resume_v1_async.txt index dff6f5263..49eb98883 100644 --- a/docs/code_samples/resume_v1_async.txt +++ b/docs/code_samples/resume_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.resume.ResumeV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/us_healthcare_cards_v1_async.txt b/docs/code_samples/us_healthcare_cards_v1_async.txt index a202cc20a..9ac40e5e6 100644 --- a/docs/code_samples/us_healthcare_cards_v1_async.txt +++ b/docs/code_samples/us_healthcare_cards_v1_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.us.healthcarecard.HealthcareCardV1; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/us_mail_v3_async.txt b/docs/code_samples/us_mail_v3_async.txt index cff5c25d2..18afe0d36 100644 --- a/docs/code_samples/us_mail_v3_async.txt +++ b/docs/code_samples/us_mail_v3_async.txt @@ -5,7 +5,7 @@ import com.mindee.product.us.usmail.UsMailV3; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException, InterruptedException { String apiKey = "my-api-key"; diff --git a/docs/code_samples/default_v2.txt b/docs/code_samples/v2_extraction.txt similarity index 97% rename from docs/code_samples/default_v2.txt rename to docs/code_samples/v2_extraction.txt index bc395addb..c35f0e11a 100644 --- a/docs/code_samples/default_v2.txt +++ b/docs/code_samples/v2_extraction.txt @@ -5,7 +5,7 @@ import com.mindee.parsing.v2.InferenceResponse; import java.io.File; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV2 { public static void main(String[] args) throws IOException, InterruptedException diff --git a/docs/code_samples/workflow_execution.txt b/docs/code_samples/workflow_execution.txt index a0412c84a..86390e51f 100644 --- a/docs/code_samples/workflow_execution.txt +++ b/docs/code_samples/workflow_execution.txt @@ -5,7 +5,7 @@ import com.mindee.product.generated.GeneratedV1; import com.mindee.http.MindeeHttpException; import java.io.IOException; -public class SimpleMindeeClient { +public class SimpleMindeeClientV1 { public static void main(String[] args) throws IOException { String apiKey = "my-api-key"; diff --git a/tests/test_code_samples.sh b/tests/test_v1_code_samples.sh similarity index 60% rename from tests/test_code_samples.sh rename to tests/test_v1_code_samples.sh index 807b02adb..6f8e181ff 100755 --- a/tests/test_code_samples.sh +++ b/tests/test_v1_code_samples.sh @@ -1,12 +1,9 @@ #! /bin/sh set -e -OUTPUT_FILE='SimpleMindeeClient.java' +OUTPUT_FILE='SimpleMindeeClientV1.java' ACCOUNT=$1 ENDPOINT=$2 -API_KEY=$3 -API_KEY_V2=$4 -MODEL_ID=$5 if [ -z "${ACCOUNT}" ]; then echo "ACCOUNT is required"; exit 1; fi if [ -z "${ENDPOINT}" ]; then echo "ENDPOINT is required"; exit 1; fi @@ -14,21 +11,17 @@ if [ -z "${ENDPOINT}" ]; then echo "ENDPOINT is required"; exit 1; fi # We need the dependencies otherwise we get class not found exceptions mvn dependency:copy-dependencies -for f in $(find docs/code_samples -maxdepth 1 -name "*.txt" -not -name "workflow_execution.txt" | sort -h) +for f in $( + find docs/code_samples -maxdepth 1 -name "*.txt" -not -name "workflow_*.txt" -not -name "v2_*.txt" | sort -h +) do - if echo "${f}" | grep -q "default_v2.txt"; then - if [ -z "${API_KEY_V2}" ] || [ -z "${MODEL_ID}" ]; then - echo "Skipping ${f} (API_KEY_V2 or MODEL_ID not supplied)" - echo - continue - fi - fi echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo "${f}" echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" echo - cat "${f}" > $OUTPUT_FILE + sed "s/my-api-key/${MINDEE_API_KEY}/" "${f}" > $OUTPUT_FILE + sed -i "s/\/path\/to\/the\/file.ext/src\/test\/resources\/file_types\/pdf\/blank_1.pdf/" $OUTPUT_FILE if echo "${f}" | grep -q "custom_v1.txt" then @@ -50,18 +43,7 @@ do sed -i "s/my-version/1/" $OUTPUT_FILE fi - if echo "${f}" | grep -q "default_v2.txt" - then - sed -i "s/MY_API_KEY/$API_KEY_V2/" $OUTPUT_FILE - sed -i "s/MY_MODEL_ID/$MODEL_ID/" $OUTPUT_FILE - else - sed -i "s/my-api-key/$API_KEY/" $OUTPUT_FILE - fi - - sed -i "s/my-api-key/$API_KEY/" $OUTPUT_FILE - sed -i "s/\/path\/to\/the\/file.ext/src\/test\/resources\/file_types\/pdf\/blank_1.pdf/" $OUTPUT_FILE - - javac -cp ./target/dependency/*:./target/* SimpleMindeeClient.java - java -cp .:./target/dependency/*:./target/* SimpleMindeeClient - + sleep 0.5 # avoid too many request errors + javac -cp ./target/dependency/*:./target/* "${OUTPUT_FILE}" + java -cp .:./target/dependency/*:./target/* SimpleMindeeClientV1 done diff --git a/tests/test_v2_code_samples.sh b/tests/test_v2_code_samples.sh new file mode 100755 index 000000000..5c030cc23 --- /dev/null +++ b/tests/test_v2_code_samples.sh @@ -0,0 +1,50 @@ +#! /bin/sh +set -e + +OUTPUT_FILE='SimpleMindeeClientV2.java' + +# We need the dependencies otherwise we get class not found exceptions +mvn dependency:copy-dependencies + +for f in $( + find docs/code_samples -maxdepth 1 -name "v2_*.txt" | sort -h +) +do + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + echo "${f}" + echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + echo + + sed "s/MY_API_KEY/${MINDEE_V2_API_KEY}/" "${f}" > $OUTPUT_FILE + sed -i "s/\/path\/to\/the\/file.ext/src\/test\/resources\/file_types\/pdf\/blank_1.pdf/" $OUTPUT_FILE + + if echo "${f}" | grep -q "v2_classification.txt" + then + sed -i "s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_CLASSIFICATION_MODEL_ID}/" $OUTPUT_FILE + fi + + if echo "${f}" | grep -q "v2_crop.txt" + then + sed -i "s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_CROP_MODEL_ID}/" $OUTPUT_FILE + fi + + if echo "${f}" | grep -q "v2_extraction.txt" + then + sed -i "s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_FINDOC_MODEL_ID}/" $OUTPUT_FILE + fi + + if echo "${f}" | grep -q "v2_ocr.txt" + then + sed -i "s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_OCR_MODEL_ID}/" $OUTPUT_FILE + fi + + if echo "${f}" | grep -q "v2_split.txt" + then + sed -i "s/MY_MODEL_ID/${MINDEE_V2_SE_TESTS_SPLIT_MODEL_ID}/" $OUTPUT_FILE + fi + + sleep 0.5 # avoid too many request errors + javac -cp ./target/dependency/*:./target/* "${OUTPUT_FILE}" + java -cp .:./target/dependency/*:./target/* SimpleMindeeClientV2 + +done