Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ryan Berkheimer
messageapi
Commits
d53ac449
Commit
d53ac449
authored
Oct 01, 2020
by
Ryan Berkheimer
Browse files
added new integration test for standard session
parent
7642048a
Changes
5
Hide whitespace changes
Inline
Side-by-side
dist/artifacts/c/messageapi_1_0_0/messageapi.tar
View file @
d53ac449
No preview for this file type
dist/artifacts/java/messageapi_1_0_0/messageapi.tar
View file @
d53ac449
No preview for this file type
dist/docs/api/messageapi_docs.tar
View file @
d53ac449
No preview for this file type
resources/test/file-reader/parameter_map_style.json
0 → 100644
View file @
d53ac449
{
"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
src/groovy/test/endtoend/FileReaderTests.groovy
View file @
d53ac449
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment