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

Allow table cache to be bypassed by ModelBean (#2359) #2362

Open
wants to merge 1 commit into
base: release/version6.14
Choose a base branch
from
Open
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
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
Loading