Skip to content

Commit

Permalink
* Allow metadata table cache to be bypassed by ModelBean (#2359)
Browse files Browse the repository at this point in the history
* Update accumulo-utils version
* Add ModelBean quickstart integration tests
* Address PR feedback:
  Extend '/import' to enable update/replace semantics via
  optional path parameter, i.e., '/import/{modelName}'
  • Loading branch information
keith-ratcliffe committed Jun 5, 2024
1 parent 3d27c1e commit c2e9015
Show file tree
Hide file tree
Showing 4 changed files with 234 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
modelName=Model1
modelFile=${DW_DATAWAVE_SOURCE_DIR}/web-services/model/src/test/resources/ModelBeanTest_m1.xml

################################################################
# Test /Model/import endpoint
#

setCurlData @${modelFile}

configureTest \
ImportQueryModel200 \
"Imports an example query model named '${modelName}'" \
"--header 'Content-Type: application/xml;charset=UTF-8' ${DW_CURL_DATA} -X POST ${URI_ROOT}/Model/import" \
"application/xml;charset=UTF-8" \
200

runTest

################################################################
# Test GET /Model/admin/{name} endpoint (200 b/c cache bypassed)
#

configureTest \
AdminGetQueryModel200 \
"Retrieve the imported query model" \
"-X GET ${URI_ROOT}/Model/admin/${modelName}" \
"application/xml;charset=UTF-8" \
200

runTest

################################################################
# Retry /Model/import on the same file
#

setCurlData @${modelFile}

configureTest \
ImportQueryModelAgain412 \
"Try to import the same query model, expecting 412 response b/c model exists" \
"--header 'Content-Type: application/xml;charset=UTF-8' ${DW_CURL_DATA} -X POST ${URI_ROOT}/Model/import" \
"application/xml;charset=UTF-8" \
412

runTest

################################################################
# Retry import on the same file, but this time using -X PUT
# '/Model/import/{modelName}' to enable update/replace
#

setCurlData @${modelFile}

configureTest \
ImportQueryModelAgainWithPUT200 \
"Try to import the same query model, expecting 200 response b/c '/Model/import/{modelName}' was used" \
"--header 'Content-Type: application/xml;charset=UTF-8' ${DW_CURL_DATA} -X PUT ${URI_ROOT}/Model/import/${modelName}" \
"application/xml;charset=UTF-8" \
200

runTest

################################################################
# Attempt '/Model/import/WrongModelName' and get 412 error
#

setCurlData @${modelFile}

configureTest \
ImportQueryModelAgainWithPUT412 \
"Try to update/replace but pass incorrect model name, expecting 412" \
"--header 'Content-Type: application/xml;charset=UTF-8' ${DW_CURL_DATA} -X PUT ${URI_ROOT}/Model/import/WrongModelName" \
"application/xml;charset=UTF-8" \
412

runTest

################################################################
# Test DELETE /Model/{name} endpoint
#

configureTest \
DeleteQueryModel200 \
"Delete the imported query model" \
"-X DELETE ${URI_ROOT}/Model/${modelName}" \
"application/xml;charset=UTF-8" \
200

runTest

################################################################
# Try to GET the deleted model with admin endpoint: 404 b/c cache is bypassed
#

configureTest \
GetDeletedQueryModelAndFail404 \
"Try and fail to retrieve the deleted query model, as appropriate" \
"-X GET ${URI_ROOT}/Model/admin/${modelName}" \
"application/xml;charset=UTF-8" \
404

# This last test is executed by run.sh, as usual
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<version.maven-install-plugin>2.5.2</version.maven-install-plugin>
<version.metrics-cdi>1.6.0</version.metrics-cdi>
<version.microservice.accumulo-api>3.0.0</version.microservice.accumulo-api>
<version.microservice.accumulo-utils>3.0.2</version.microservice.accumulo-utils>
<version.microservice.accumulo-utils>3.0.3</version.microservice.accumulo-utils>
<version.microservice.audit-api>3.0.0</version.microservice.audit-api>
<version.microservice.authorization-api>3.0.0</version.microservice.authorization-api>
<version.microservice.base-rest-responses>3.0.0</version.microservice.base-rest-responses>
Expand Down
Loading

0 comments on commit c2e9015

Please sign in to comment.