Commit d53ac449 authored by Ryan Berkheimer's avatar Ryan Berkheimer
Browse files

added new integration test for standard session

parent 7642048a
{
"fields": [
{
"id": "file-path",
"type": "string",
"required": true
}
],
"conditions": [
{
"id": "is-relative-path",
"type": "comparison",
"operator": "gov.noaa.messageapi.operators.StringConditionOperator",
"constructor": {
"comparison": "contains"
},
"field": "file-path",
"value": "{}"
}
],
"collections": [
{
"id": "coll-1",
"classifiers": {},
"fields": [
"file-path"
],
"conditions": [
"is-relative-path"
]
}
],
"transformations": [
{
"id": "trans-1",
"operator": "gov.noaa.messageapi.test.transformations.FixRelativePathsTransformation",
"constructor": {
"transform-key": "file-collection",
"fields": [
"file-path"
]
},
"records": {
"file-collection": {
"COLLECTION": "coll-1"
}
}
}
],
"endpoints": [
{
"plugin": "gov.noaa.messageapi.test.endpoints.InMemoryFileReader",
"connections": [
{
"id": "conn-1",
"transformations": [
"trans-1"
],
"constructor": {
"file-fields": "file-path"
},
"fields": [
"value",
"number",
"length"
]
}
]
}
]
}
\ No newline at end of file
......@@ -9,6 +9,9 @@ import gov.noaa.messageapi.interfaces.IResponse
import gov.noaa.messageapi.interfaces.IRecord
import gov.noaa.messageapi.sessions.DefaultSession
import gov.noaa.messageapi.sessions.StandardSession
import gov.noaa.messageapi.utils.general.PathUtils
/**
This Spock test class demonstrates end to end behaviors for reading and validating reads of files.
......@@ -30,8 +33,8 @@ class FileReaderTests extends spock.lang.Specification {
response.getRecords().size() == 7
}*/
def "Tests submission of a full file reader task with 1 large input."() {
given: 'A standard condition test request'
def "Tests submission of a full file reader task with 1 large input using a Default Session."() {
given: 'A default session condition test request'
ISession session = new DefaultSession('{}/resources/test/file-reader/manifest.json')
IRequest request = session.createRequest()
IRecord record = request.createRecord()
......@@ -43,6 +46,30 @@ def "Tests submission of a full file reader task with 1 large input."() {
//println response.getRecords().get(0).getField("value").getValue()
response.getRejections().size() == 0
response.getRecords().size() == 79794
println 'finished default session test!'
}
def "Tests submission of a full file reader task with 1 large input using a Standard Session."() {
given: 'A standard session based condition test request'
String parameterPath = PathUtils.reconcileKeywords('{}/resources/test/file-reader/parameter_map_style.json')
println parameterPath
ISession session = new StandardSession(parameterPath)
IRequest request = session.createRequest()
IRecord record = request.createRecord()
String filePath = '{}/resources/test/inputs/file-reader/proc_sm_gtsnp_data_ftp_CF6_cf6_20190506.txt'
record.setField('file-path', filePath)
//println record.getField('file-path').getValue()
when: 'We submit the test session and wait for completion'
//println 'submitting standard session test'
IResponse response = request.submit()
//println 'submitted standard session test'
while (!response.isComplete()) {}
//println 'response is complete'
then: 'We should have no rejections and there should be 79794 records in the return set.'
//println response.getRecords().get(0).getField("value").getValue()
response.getRejections().size() == 0
//println 'Size of return records: ' + response.getRecords().size()
response.getRecords().size() == 79794
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment