Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ekaterina
wendelin
Commits
70f1cb31
Commit
70f1cb31
authored
Jun 22, 2015
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generate Dynamically Data Supply for test.
parent
93fc04b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
8 deletions
+102
-8
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/PortalIngestionPolicy_addDataSupply.xml
...ins/erp5_wendelin/PortalIngestionPolicy_addDataSupply.xml
+78
-0
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
...tTemplateItem/portal_components/test.erp5.testWendelin.py
+19
-4
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.xml
...TemplateItem/portal_components/test.erp5.testWendelin.xml
+5
-4
No files found.
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/PortalIngestionPolicy_addDataSupply.xml
0 → 100644
View file @
70f1cb31
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_body
</string>
</key>
<value>
<string>
"""\n
Add a data supply structure for a data ingestion on a portal ingestion policy.\n
"""\n
data_supply = context.data_supply_module.newContent( \\\n
portal_type=\'Data Supply\', **data_supply_kw)\n
data_supply.validate()\n
\n
# add default line\n
data_supply_line = data_supply.newContent(portal_type=\'Data Supply Line\', \\\n
**data_supply_line_kw)\n
\n
return data_supply\n
</string>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
data_supply_kw, data_supply_line_kw
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
PortalIngestionPolicy_addDataSupply
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.py
View file @
70f1cb31
...
...
@@ -26,6 +26,7 @@
##############################################################################
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
DateTime
import
DateTime
import
msgpack
import
numpy
as
np
import
string
...
...
@@ -60,6 +61,7 @@ class Test(ERP5TypeTestCase):
Test ingestion using a POST Request containing a msgpack encoded message
simulating input from fluentd
"""
now
=
DateTime
()
portal
=
self
.
portal
request
=
portal
.
REQUEST
...
...
@@ -71,19 +73,32 @@ class Test(ERP5TypeTestCase):
request
.
set
(
'reference'
,
'car'
)
request
.
set
(
'data_chunk'
,
data_chunk
)
ingestion_policy
=
portal
.
portal_ingestion_policies
.
wendelin_car_logs
# create new Data Stream for test purposes
data_stream
=
portal
.
data_stream_module
.
newContent
(
\
portal_type
=
'Data Stream'
,
\
reference
=
'car'
)
data_stream
.
validate
()
# asssign it to Data Supply (XXX add dynamically needed test structure in step)
data_supply_line
=
portal
.
restrictedTraverse
(
'data_supply_module/wendelin_3/1'
)
data_supply_line
.
setDestinationSectionValue
(
data_stream
)
# create Data Supply
resource
=
portal
.
restrictedTraverse
(
'data_product_module/wendelin_4'
)
sensor
=
portal
.
restrictedTraverse
(
'sensor_module/wendelin_1'
)
data_supply_kw
=
{
'reference'
:
'car'
,
'version'
:
'001'
,
'start_date'
:
now
,
'stop_date'
:
now
+
365
}
data_supply_line_kw
=
{
'resource_value'
:
resource
,
'source_section_value'
:
sensor
,
'destination_section_value'
:
data_stream
}
data_supply
=
ingestion_policy
.
PortalIngestionPolicy_addDataSupply
(
\
data_supply_kw
,
\
data_supply_line_kw
)
self
.
tic
()
# do real ingestion call
portal
.
portal_ingestion_policies
.
wendelin_car_logs
.
ingest
()
ingestion_policy
.
ingest
()
# ingestion handler script saves new data using new line so we
# need to remove it, it also stringifies thus we need to
...
...
bt5/erp5_wendelin/TestTemplateItem/portal_components/test.erp5.testWendelin.xml
View file @
70f1cb31
...
...
@@ -46,10 +46,11 @@
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W: 54, 4: Unused variable \'scipy\' (unused-variable)
</string>
<string>
W: 56, 4: Unused variable \'pandas\' (unused-variable)
</string>
<string>
W: 55, 4: Unused variable \'sklearn\' (unused-variable)
</string>
<string>
W: 95, 72: Unused variable \'n\' (unused-variable)
</string>
<string>
W: 55, 4: Unused variable \'scipy\' (unused-variable)
</string>
<string>
W: 57, 4: Unused variable \'pandas\' (unused-variable)
</string>
<string>
W: 56, 4: Unused variable \'sklearn\' (unused-variable)
</string>
<string>
W: 95, 4: Unused variable \'data_supply\' (unused-variable)
</string>
<string>
W:110, 72: Unused variable \'n\' (unused-variable)
</string>
</tuple>
</value>
</item>
...
...
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