Commit 29343e47 authored by Antoine Catton's avatar Antoine Catton

Merge branch 'master' into rename_instance

Conflicts:
	master/bt5/vifib_base/WorkflowTemplateItem/portal_workflow/software_instance_slap_interface_workflow/scripts/SoftwareInstance_requestSoftwareInstance.xml
	master/bt5/vifib_base/bt/revision
	master/bt5/vifib_erp5/PortalTypeRolesTemplateItem/Slave%20Instance.xml
	master/bt5/vifib_erp5/bt/revision
	master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/SlaveInstance_requestUpdateOnChange.xml
	master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/SoftwareInstance_requestDestroy.xml
	master/bt5/vifib_slap/bt/revision
	master/product/Vifib/tests/testVifibSlapWebServiceSlaveInstance.py
parents d18ecc9b 0fa4efaa
22
\ No newline at end of file
24
\ No newline at end of file
......@@ -322,25 +322,18 @@
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from DateTime import DateTime\n
from Products.ERP5Type.DateUtils import getClosestDate\n
from Products.ZSQLCatalog.SQLCatalog import Query\n
\n
kw[\'query\'] = Query(portal_type=\'Simulation Movement\',\n
parent_specialise_portal_type=\'Subscription Item Root Simulation Rule\',\n
simulation_state=\'planned\', causality_state=\'expanded\')\n
from DateTime import DateTime\n
\n
build_before = kw.get(\'build_before\', None)\n
# support build_before\n
build_before = kw.pop(\'build_before\', None)\n
if build_before is None:\n
build_before = getClosestDate(target_date=DateTime(), precision=\'month\', before=0)\n
kw[\'movement.start_date\'] = \'< %s\' % build_before\n
\n
if src__==0:\n
candidate_list = [x.getObject() for x in context.portal_catalog(**kw)]\n
movement_list = []\n
for x in candidate_list:\n
if x.getStartDate() < build_before:\n
movement_list.append(x)\n
return movement_list\n
return context.portal_catalog(**kw)\n
\n
else:\n
return context.portal_catalog(src__=1, **kw)\n
......@@ -353,7 +346,7 @@ else:\n
</item>
<item>
<key> <string>id</string> </key>
<value> <string>HostingSubscription_selectMovement</string> </value>
<value> <string>VifibDeliveryBuilder_selectMovement</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -57,18 +57,18 @@ from Products.ERP5Type.Message import translateString\n
\n
packing_list = context\n
\n
try:\n
packing_list.PackingList_copyOrderProperties()\n
except AttributeError:\n
# does not come from Order\n
pass\n
\n
# Then, modify state\n
confirm_tag = \'%s_confirm\' % packing_list.getPath()\n
packing_list.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n
(\'immediateReindexObject\',\'recursiveImmediateReindexObject\')),\n
tag=confirm_tag).Delivery_confirm()\n
\n
# # Start delivery\n
# start_tag = \'%s_start\' % packing_list.getPath()\n
# packing_list.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n
# (\'immediateReindexObject\',\'recursiveImmediateReindexObject\')),\n
# tag=start_tag, after_tag=confirm_tag).Delivery_startConfirmedSalePackingList()\n
\n
# First set the packing_list in the building state\n
packing_list.startBuilding()\n
# Then an activity should put the causality state in diverged or solved\n
......@@ -83,7 +83,7 @@ packing_list.activate(after_path_and_method_id=(related_simulation_movement_path
</item>
<item>
<key> <string>id</string> </key>
<value> <string>HostingSubscriptionSalePackingList_copyProperties</string> </value>
<value> <string>VifibSalePackingList_postGeneration</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -50,20 +50,27 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>software_instance = state_change[\'object\']\n
<value> <string>from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
\n
software_instance = state_change[\'object\']\n
# mark destroy is requested\n
portal = context.getPortalObject()\n
if software_instance.getPortalType() == "Software Instance":\n
software_instance.SoftwareInstance_destroySlaveInstanceRelated()\n
\n
software_instance.destroyRequested()\n
# deliver proper packing list\n
packing_list_line = context.SoftwareInstance_getInstanceDestroyPackingListLine(state_change)\n
\n
packing_list = packing_list_line.getParentValue()\n
if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_list, \'start\'):\n
if portal.portal_workflow.isTransitionPossible(packing_list, \'start\'):\n
packing_list.start()\n
if packing_list.getPortalObject().portal_workflow.isTransitionPossible(packing_list, \'deliver\'):\n
if portal.portal_workflow.isTransitionPossible(packing_list, \'deliver\'):\n
packing_list.deliver()\n
\n
# revoke certificate\n
try:\n
context.getPortalObject().portal_certificate_authority\\\n
portal.portal_certificate_authority\\\n
.revokeCertificate(software_instance.getDestinationReference())\n
except ValueError:\n
# Ignore already revoked certificates, as OpenSSL backend is\n
......
<?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>from DateTime import DateTime\n
\n
portal = context.getPortalObject()\n
software_instance = state_change[\'object\']\n
software_release_url_string = state_change.kwargs[\'software_release\']\n
hosting_subscription_uid = state_change.kwargs[\'hosting_subscription_uid\']\n
\n
# Assertion: No packing list line should be related to this software instance\n
packing_list_line = software_instance.getAggregateRelatedValue(portal_type=\'Sale Packing List Line\')\n
if packing_list_line is not None:\n
raise ValueError("Software Instance %s is already associated to a packing list line" % software_instance.getRelativeurl())\n
\n
# Find a free computer partition. This means:\n
# Computer Partition which doesn\'t have non delivered sale packing list related\n
\n
software_release_document = context.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n
url_string=software_release_url_string)\n
\n
# protect computer partition from being selected again\n
portal = context.getPortalObject()\n
\n
hosting_subscription = software_instance.portal_catalog.getResultValue(uid=hosting_subscription_uid)\n
\n
open_order = portal.portal_catalog.getResultValue(\n
portal_type="Open Sale Order",\n
validation_state="validated")\n
computer_partition_relative_url = open_order.OpenSaleOrder_restrictMethodAsShadowUser(\n
open_order=open_order,\n
callable_object=open_order.OpenSaleOrder_findPartition,\n
argument_list=[software_release_url_string, software_instance.getSourceReference(),\n
software_instance.getPortalType(), software_instance.getSlaXmlAsDict()])\n
\n
sale_packing_list_line = context.HostingSubscription_getInstancePackingListLine(state_change)\n
base_sale_packing_list = sale_packing_list_line.getParentValue()\n
# XXX: SoftwareInstance_createSalePackingList shall be used to create new Sale Packing List\n
sale_packing_list_module = portal.getDefaultModule(portal_type=\'Sale Packing List\')\n
\n
sale_packing_list = sale_packing_list_module.newContent(\n
portal_type=\'Sale Packing List\', \n
start_date=DateTime(),\n
specialise=base_sale_packing_list.getSpecialise() or base_sale_packing_list.getCausalityValue().getSpecialise(),\n
destination=base_sale_packing_list.getDestination(),\n
destination_section=base_sale_packing_list.getDestinationSection(),\n
destination_decision=base_sale_packing_list.getDestinationDecision(),\n
source=base_sale_packing_list.getSource(),\n
source_section=base_sale_packing_list.getSourceSection(),\n
price_currency=base_sale_packing_list.getPriceCurrency())\n
sale_packing_list_line = sale_packing_list.newContent(\n
portal_type=\'Sale Packing List Line\',\n
resource=context.portal_preferences.getPreferredInstanceSetupResource(),\n
aggregate_list=[software_instance.getRelativeUrl(), software_release_document.getRelativeUrl(), \n
computer_partition_relative_url, hosting_subscription.getRelativeUrl()]\n
)\n
\n
# confirm Sale Packing List\n
sale_packing_list.confirm()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareInstance_requestComputerPartition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -63,6 +63,9 @@ service_relative_url = software_instance.portal_preferences.\\\n
getPreferredInstanceCleanupResource()\n
sale_packing_list = context.SoftwareInstance_createSalePackingList(state_change, service_relative_url, tag=tag)\n
sale_packing_list.confirm(activate_kw={\'tag\':tag})\n
\n
if software_instance.getPortalType() == "Software Instance":\n
software_instance.SoftwareInstance_requestDestroySlaveInstanceRelated()\n
]]></string> </value>
......
......@@ -126,13 +126,36 @@ if (request_software_instance is None):\n
**portal.Base_getNewSoftwareInstanceCoordinate()\n
)\n
request_software_instance.portal_workflow.doActionFor(request_software_instance, \'validate_action\')\n
sale_packing_list_line = context.SoftwareInstance_getInstanceSetupPackingListLine(state_change)\n
hosting_subscription_uid = sale_packing_list_line.getAggregateValue(portal_type=\'Hosting Subscription\').getUid()\n
request_software_instance.requestComputerPartition(\n
software_release=software_release_url_string,\n
hosting_subscription_uid=hosting_subscription_uid,\n
software_type=software_type,\n
tag=tag)\n
packing_list_line = software_instance.getAggregateRelatedValue(portal_type="Sale Packing List Line")\n
subscription = packing_list_line.getAggregateValue(portal_type="Hosting Subscription")\n
software_release_document = context.portal_catalog.getResultValue(\n
portal_type=\'Software Release\',\n
url_string=software_release_url_string)\n
base_sale_packing_list = packing_list_line.getParentValue()\n
trade_condition = packing_list_line.getSpecialise(portal_type="Sale Trade Condition")\n
sale_order = portal.getDefaultModule(portal_type="Sale Order").newContent(\n
portal_type="Sale Order",\n
destination=base_sale_packing_list.getDestination(),\n
destination_section=base_sale_packing_list.getDestinationSection(),\n
destination_decision=base_sale_packing_list.getDestinationDecision(),\n
start_date=DateTime(),\n
received_date=DateTime(),\n
# XXX Hardcoded values\n
source="organisation_module/vifib_internet",\n
source_section="organisation_module/vifib_internet",\n
price_currency="currency_module/EUR",\n
activate_kw={\'tag\': tag},\n
)\n
\n
sale_order.setSpecialise(trade_condition, portal_type="Sale Trade Condition")\n
sale_order_line = sale_order.newContent(\n
portal_type="Sale Order Line",\n
resource=setup_service_relative_url,\n
quantity=1,\n
aggregate_value_list=[request_software_instance,subscription,software_release_document],\n
activate_kw={\'tag\': tag},\n
)\n
sale_order.order()\n
else:\n
# Update existing software instance\n
# Sale Packing List interaction has to be requested automatically with an interaction workflow\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>SoftwareInstance_requestComputerPartition</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>request_computer_partition</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string>SoftwareInstance_checkConsistency</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Request Computer Partition</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
347
\ No newline at end of file
340
\ No newline at end of file
vifib_base
vifib_simulation
\ No newline at end of file
......@@ -94,7 +94,7 @@
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
<string>Hosting Subscription</string>
</tuple>
</value>
</item>
......@@ -169,7 +169,7 @@
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
<string>Hosting Subscription</string>
</tuple>
</value>
</item>
......
......@@ -59,7 +59,7 @@
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
<string>Hosting Subscription</string>
</tuple>
</value>
</item>
......@@ -104,7 +104,7 @@
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
<string>Hosting Subscription</string>
</tuple>
</value>
</item>
......
......@@ -59,7 +59,7 @@
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
<string>Hosting Subscription</string>
</tuple>
</value>
</item>
......@@ -102,7 +102,7 @@
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
<string>Hosting Subscription</string>
</tuple>
</value>
</item>
......
......@@ -67,7 +67,7 @@
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
<string>Hosting Subscription</string>
</tuple>
</value>
</item>
......@@ -110,7 +110,7 @@
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
<string>Hosting Subscription</string>
</tuple>
</value>
</item>
......
......@@ -67,7 +67,7 @@
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
<string>Hosting Subscription</string>
</tuple>
</value>
</item>
......@@ -110,7 +110,7 @@
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
<string>Hosting Subscription</string>
</tuple>
</value>
</item>
......
87
\ No newline at end of file
88
\ No newline at end of file
......@@ -106,7 +106,6 @@
<string>trade_phase/vifib/delivery</string>
<string>predecessor/trade_state/ordered</string>
<string>successor/trade_state/delivered</string>
<string>delivery_builder/portal_deliveries/hosting_subscription_sale_packing_list_builder</string>
<string>delivery_builder/portal_deliveries/vifib_sale_packing_list_builder</string>
</tuple>
</value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Delivery Builder" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>collect_order</string> </key>
<value>
<tuple>
<string>OrderMovementGroup</string>
<string>PathMovementGroup</string>
<string>DateMovementGroup</string>
<string>ResourceMovementGroup</string>
<string>VariantMovementGroup</string>
</tuple>
</value>
</item>
<item>
<key> <string>collect_order_list</string> </key>
<value>
<list>
<string>test</string>
<string>test2</string>
</list>
</value>
</item>
<item>
<key> <string>collect_order_list_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>delivery_after_generation_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>delivery_after_generation_script_id</string> </key>
<value> <string>HostingSubscriptionSalePackingList_copyProperties</string> </value>
</item>
<item>
<key> <string>delivery_cell_collect_order</string> </key>
<value>
<tuple>
<string>VariantMovementGroup</string>
<string>CausalityAssignmentMovementGroup</string>
</tuple>
</value>
</item>
<item>
<key> <string>delivery_cell_portal_type</string> </key>
<value> <string>Sale Packing List Cell</string> </value>
</item>
<item>
<key> <string>delivery_cell_separate_order</string> </key>
<value>
<tuple>
<string>calculateAveragePrice</string>
<string>calculateAddQuantity</string>
</tuple>
</value>
</item>
<item>
<key> <string>delivery_collect_order</string> </key>
<value>
<tuple>
<string>OrderMovementGroup</string>
<string>DateMovementGroup</string>
<string>PathMovementGroup</string>
<string>SectionPathMovementGroup</string>
<string>PriceCurrencyMovementGroup</string>
<string>DecisionPathMovementGroup</string>
<string>AdministrationPathMovementGroup</string>
</tuple>
</value>
</item>
<item>
<key> <string>delivery_line_collect_order</string> </key>
<value>
<tuple>
<string>ResourceMovementGroup</string>
<string>BaseVariantMovementGroup</string>
<string>AggregateMovementGroup</string>
<string>CausalityAssignmentMovementGroup</string>
</tuple>
</value>
</item>
<item>
<key> <string>delivery_line_portal_type</string> </key>
<value> <string>Sale Packing List Line</string> </value>
</item>
<item>
<key> <string>delivery_module</string> </key>
<value> <string>sale_packing_list_module</string> </value>
</item>
<item>
<key> <string>delivery_portal_type</string> </key>
<value> <string>Sale Packing List</string> </value>
</item>
<item>
<key> <string>delivery_select_method_id</string> </key>
<value> <string>DeliveryBuilder_selectConfirmedDeliveryList</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>hosting_subscription_sale_packing_list_builder</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Delivery Builder</string> </value>
</item>
<item>
<key> <string>resource_portal_type</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>simulation_select_method_id</string> </key>
<value> <string>HostingSubscription_selectMovement</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Vifib Instance Hosting Sale Packing List Builder</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>divergence_scope/category</string>
<string>collect_order_group/delivery</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>category_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Movement Group</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>delivery_mode</string>
<string>incoterm</string>
<string>source</string>
<string>destination</string>
<string>source_section</string>
<string>destination_section</string>
<string>source_decision</string>
<string>destination_decision</string>
<string>source_administration</string>
<string>destination_administration</string>
<string>source_project</string>
<string>destination_project</string>
<string>source_payment</string>
<string>destination_payment</string>
<string>price_currency</string>
<string>specialise</string>
</tuple>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>category_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>divergence_scope/category</string>
<string>collect_order_group/line</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>category_movement_group_on_line</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Movement Group</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>resource</string>
<string>aggregate</string>
<string>base_application</string>
<string>base_contribution</string>
<string>quantity_unit</string>
<string>source_account</string>
<string>destination_account</string>
<string>source_function</string>
<string>destination_function</string>
</tuple>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>category_movement_group_on_line</string> </value>
</item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Causality Assignment Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/cell</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>causality_assignment_movement_group_on_cell</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Causality Assignment Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>causality_assignment_movement_group_on_cell</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Causality Assignment Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/line</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>causality_assignment_movement_group_on_line</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Causality Assignment Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>causality_assignment_movement_group_on_line</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>divergence_scope/property</string>
<string>collect_order_group/delivery</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Movement Group</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>start_date</string>
<string>stop_date</string>
</tuple>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>divergence_scope/property</string>
<string>collect_order_group/line</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>property_movement_group_on_line</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Movement Group</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>description</string>
</tuple>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value>
<none/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Variant Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/cell</string>
<string>divergence_scope/category</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>variant_movement_group_on_cell</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Variant Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>variant_movement_group_on_cell</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -109,7 +109,7 @@
</item>
<item>
<key> <string>simulation_select_method_id</string> </key>
<value> <string>PaymentTransaction_selectMovement</string> </value>
<value> <string>VifibDeliveryBuilder_selectMovement</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -112,7 +112,7 @@
</item>
<item>
<key> <string>simulation_select_method_id</string> </key>
<value> <string>PurchaseOrder_selectMovement</string> </value>
<value> <string>VifibDeliveryBuilder_selectMovement</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -148,7 +148,7 @@
</item>
<item>
<key> <string>simulation_select_method_id</string> </key>
<value> <string>SaleInvoiceTransaction_selectPackingListMovement</string> </value>
<value> <string>VifibDeliveryBuilder_selectMovement</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -143,7 +143,7 @@
</item>
<item>
<key> <string>simulation_select_method_id</string> </key>
<value> <string>SaleInvoiceTransaction_selectInvoiceMovement</string> </value>
<value> <string>VifibDeliveryBuilder_selectMovement</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
......@@ -65,7 +65,7 @@
</item>
<item>
<key> <string>delivery_after_generation_script_id</string> </key>
<value> <string>SalePackingList_copyOrderProperties</string> </value>
<value> <string>VifibSalePackingList_postGeneration</string> </value>
</item>
<item>
<key> <string>delivery_cell_collect_order</string> </key>
......@@ -152,7 +152,7 @@
</item>
<item>
<key> <string>simulation_select_method_id</string> </key>
<value> <string>SaleOrder_selectMovement</string> </value>
<value> <string>VifibDeliveryBuilder_selectMovement</string> </value>
</item>
<item>
<key> <string>title</string> </key>
......
58
\ No newline at end of file
64
\ No newline at end of file
......@@ -16,8 +16,6 @@ business_process_module/vifib_sale_business_process/**
portal_categories/trade_phase/vifib
portal_categories/trade_phase/vifib/**
portal_categories/trade_state/**
portal_deliveries/hosting_subscription_sale_packing_list_builder
portal_deliveries/hosting_subscription_sale_packing_list_builder/**
portal_deliveries/vifib_payment_transaction_builder
portal_deliveries/vifib_payment_transaction_builder/**
portal_deliveries/vifib_purchase_packing_list_builder
......
......@@ -75,6 +75,71 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
# Restore the original user.
setSecurityManager(sm)
def SoftwareInstance_requestDestroySlaveInstanceRelated(self):
""" request destroy all Slave Instance allocated in the Computer Partition
related to the Software Instance """
sm = getSecurityManager()
portal = self.getPortalObject()
service_relative_url = portal.portal_preferences.getPreferredInstanceCleanupResource()
newSecurityManager(None, portal.acl_users.getUserById(
self.getReference()))
computer_partition_relative_url = self.getAggregateRelatedValue(
"Sale Packing List Line").getAggregate(portal_type="Computer Partition")
portal_preferences = portal.portal_preferences
simulation_state = ["started", "confirmed"]
service_uid_list = [
portal.restrictedTraverse(portal_preferences.getPreferredInstanceHostingResource()).getUid(),
portal.restrictedTraverse(portal_preferences.getPreferredInstanceSetupResource()).getUid(),
]
try:
result_list = self.portal_catalog(portal_type="Sale Packing List Line",
aggregate_portal_type="Slave Instance",
computer_partition_relative_url=computer_partition_relative_url,
simulation_state=simulation_state,
default_resource_uid=service_uid_list)
slave_instance_list = [line.getAggregateValue(portal_type="Slave Instance") for line in result_list]
for slave_instance in slave_instance_list:
cleanup_packing_list = self.portal_catalog(
portal_type='Sale Packing List Line',
aggregate_relative_url=slave_instance.getRelativeUrl(),
resource_relative_url=service_relative_url,
limit=1,
)
if len(cleanup_packing_list) == 0:
slave_instance.requestDestroyComputerPartition()
finally:
# Restore the original user.
setSecurityManager(sm)
def SoftwareInstance_destroySlaveInstanceRelated(self):
""" destroy all Slave Instance allocated in the Computer Partition
related to the Software Instance """
sm = getSecurityManager()
newSecurityManager(None, self.getPortalObject().acl_users.getUserById(
self.getReference()))
portal = self.getPortalObject()
portal_preferences = portal.portal_preferences
computer_partition_relative_url = self.getAggregateRelatedValue(
"Sale Packing List Line").getAggregate(portal_type="Computer Partition")
simulation_state = ["confirmed"]
service_uid_list = [
portal.restrictedTraverse(portal_preferences.getPreferredInstanceCleanupResource()).getUid(),
]
try:
result_list = self.portal_catalog(portal_type="Sale Packing List Line",
aggregate_portal_type="Slave Instance",
computer_partition_relative_url=computer_partition_relative_url,
simulation_state=simulation_state,
default_resource_uid=service_uid_list)
slave_instance_list = [line.getAggregateValue(portal_type="Slave Instance") for line in result_list]
# restore the original user to destroy each Slave Instance
setSecurityManager(sm)
for slave_instance in slave_instance_list:
slave_instance.destroyComputerPartition()
finally:
# Restore the original user.
setSecurityManager(sm)
def getComputerSecurityCategory(self, base_category_list, user_name,
object, portal_type):
"""
......
......@@ -9,6 +9,7 @@
</role>
<role id='R-INSTANCE'>
<item>Auditor</item>
<item>Author</item>
</role>
<role id='R-MEMBER'>
<item>Auditor</item>
......
......@@ -4,6 +4,9 @@
<item>Auditor</item>
<item>Author</item>
</role>
<role id='R-INSTANCE'>
<item>Auditor</item>
</role>
<role id='R-MEMBER'>
<item>Auditor</item>
<item>Author</item>
......
......@@ -9,7 +9,7 @@
<multi_property id='category'>group/company</multi_property>
<multi_property id='base_category'>group</multi_property>
</role>
<role id='Auditor'>
<role id='Auditor; Author'>
<property id='title'>Instance</property>
<multi_property id='category'>role/instance</multi_property>
<multi_property id='base_category'>role</multi_property>
......
......@@ -4,6 +4,11 @@
<multi_property id='category'>group/company</multi_property>
<multi_property id='base_category'>group</multi_property>
</role>
<role id='Auditor'>
<property id='title'>Instance</property>
<multi_property id='category'>role/instance</multi_property>
<multi_property id='base_category'>role</multi_property>
</role>
<role id='Auditor; Author'>
<property id='title'>Member</property>
<multi_property id='category'>role/member</multi_property>
......
......@@ -15,14 +15,14 @@
<property id='base_category_script'>ERP5Type_acquireSecurityFromOwner</property>
<multi_property id='base_category'>source</multi_property>
</role>
<role id='Assignee'>
<role id='Assignor'>
<property id='title'>Slave Instance related by Hosting Subscription</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByHostingSubscription</property>
<multi_property id='base_category'>aggregate</multi_property>
</role>
<role id='Assignee'>
<property id='title'>Slave Instance related by Software Instance</property>
<role id='Assignor'>
<property id='title'>Software Instance which provides this Slave Instance</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromSoftwareInstance</property>
<multi_property id='base_category'>source</multi_property>
<multi_property id='base_category'>aggregate</multi_property>
</role>
</type_roles>
\ No newline at end of file
......@@ -72,8 +72,11 @@ state_list = portal.getPortalCurrentInventoryStateList() + \\\n
portal.getPortalReservedInventoryStateList() + \\\n
portal.getPortalTransitInventoryStateList()\n
\n
resource_list = [portal.portal_preferences.getPreferredInstanceSetupResource(),\n
portal.portal_preferences.getPreferredInstanceHostingResource()]\n
\n
sale_packing_list_line = portal.portal_catalog.getResultValue(\n
resource_relative_url=portal.portal_preferences.getPreferredInstanceHostingResource(),\n
resource_relative_url=resource_list,\n
aggregate_uid=obj.getUid(),\n
portal_type="Sale Packing List Line",\n
simulation_state=state_list)\n
......@@ -91,14 +94,27 @@ query = ComplexQuery(\n
Query(aggregate_relative_url=software_release.getRelativeUrl()),\n
operator="AND",\n
)\n
\n
catalog_result = portal.portal_catalog(portal_type="Sale Packing List Line",\n
aggregate_portal_type="Slave Instance",\n
aggregate_relative_url=obj.getRelativeUrl(),\n
simulation_state=state_list,\n
aggregate_relative_url=query,\n
limit=1,\n
query=query,\n
)\n
for sale_packing_list_line in catalog_result:\n
software_instance = sale_packing_list_line.getAggregateValue(\n
\n
if len(catalog_result) == 0:\n
return catalog_result\n
\n
packing_list_line = portal.portal_catalog.getResultValue(\n
portal_type="Sale Packing List Line",\n
aggregate_portal_type="Software Instance",\n
simulation_state=state_list,\n
query=query,)\n
\n
if packing_list_line is not None:\n
software_instance = packing_list_line.getAggregateValue(\n
portal_type="Software Instance")\n
if software_instance is not None:\n
return {"Auditor": [software_instance.getReference(),]}\n
\n
return category_list\n
......
......@@ -89,7 +89,7 @@ catalog_result = portal.portal_catalog(portal_type=movement_portal_type,\n
for item in catalog_result:\n
software_instance = item.getAggregateValue(portal_type="Software Instance")\n
if software_instance is not None:\n
return {"Assignee": [software_instance.getReference(),]}\n
return [{"aggregate": [software_instance.getRelativeUrl()]}]\n
</string> </value>
</item>
<item>
......
......@@ -2,39 +2,25 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Order Movement Group" module="erp5.portal_type"/>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/delivery</string>
</tuple>
</value>
<key> <string>_function</string> </key>
<value> <string>SoftwareInstance_destroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
<key> <string>_module</string> </key>
<value> <string>VifibSecurity</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>order_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Order Movement Group</string> </value>
<value> <string>SoftwareInstance_destroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>order_movement_group_on_delivery</string> </value>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -2,39 +2,25 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Variant Movement Group" module="erp5.portal_type"/>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/line</string>
</tuple>
</value>
<key> <string>_function</string> </key>
<value> <string>SoftwareInstance_requestDestroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
<key> <string>_module</string> </key>
<value> <string>VifibSecurity</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>base_variant_movement_group_in_line</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Variant Movement Group</string> </value>
<value> <string>SoftwareInstance_requestDestroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>base_variant_movement_group_in_line</string> </value>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
......
311
\ No newline at end of file
326
\ No newline at end of file
......@@ -51,7 +51,6 @@
<item>
<key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
business_process = portal.business_process_module.vifib_sale_business_process\n
\n
build_before = None\n
if params is not None:\n
......@@ -60,9 +59,11 @@ if params is not None:\n
else:\n
kw = {}\n
\n
for link in business_process.contentValues(portal_type="Business Link"):\n
for delivery_builder in link.getDeliveryBuilderValueList():\n
delivery_builder.activate().build(**kw)\n
for business_process in [\n
portal.business_process_module.vifib_sale_business_process,\n
portal.business_process_module.vifib_purchase_business_process]:\n
for link in business_process.contentValues(portal_type="Business Link"):\n
link.build(**kw)\n
</string> </value>
</item>
<item>
......
......@@ -52,8 +52,11 @@
<key> <string>_body</string> </key>
<value> <string>computer = state_change[\'object\']\n
for computer_partition in [x for x in computer.contentValues(portal_type=\'Computer Partition\') if x.getSlapState() == \'busy\']:\n
# raises ValueError in case of no packing list found, left as is\n
try:\n
packing_list_line = computer_partition.Item_getInstancePackingListLine()\n
except ValueError:\n
# no need to bang trees without any delivery line\n
continue\n
software_instance = packing_list_line.getAggregateValue(portal_type=\'Software Instance\')\n
software_instance.activate().SoftwareInstance_bangAsSelf(reference=software_instance.getReference(),\n
comment=state_change.kwargs.get(\'comment\', \'\'))\n
......
......@@ -27,7 +27,9 @@
<item>
<key> <string>after_script_name</string> </key>
<value>
<tuple/>
<list>
<string>SlaveInstance_requestUpdate</string>
</list>
</value>
</item>
<item>
......@@ -43,30 +45,32 @@
<item>
<key> <string>guard</string> </key>
<value>
<none/>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareInstance_destroy</string> </value>
<value> <string>SlaveInstance_requestUpdateOnChange</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>destroyComputerPartition</string>
<string>_setTitle</string>
<string>_setSourceReference</string>
<string>_setTextContent</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Software Instance</string>
<string>Slave Instance</string>
</list>
</value>
</item>
......@@ -80,7 +84,7 @@
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......@@ -93,4 +97,32 @@
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: len(here.checkConsistency()) == 0</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -75,7 +75,6 @@ query = ComplexQuery(computer_partition_query, \n
\n
return portal.portal_catalog(portal_type=\'Sale Packing List Line\',\n
default_resource_uid=service_uid_list,\n
sort_on=((\'movement.start_date\', \'DESC\'),),\n
query=query, **kw)\n
</string> </value>
</item>
......
<?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>portal = context.getPortalObject()\n
count_result_kw = dict(portal_type="Sale Packing List Line",\n
aggregate_uid=state_change["object"].getUid(),\n
limit=1)\n
\n
if len(portal.portal_catalog(**count_result_kw)) == 1:\n
state_change[\'object\'].requestUpdateComputerPartition()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SlaveInstance_requestUpdate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
484
\ No newline at end of file
489
\ No newline at end of file
......@@ -547,28 +547,34 @@ class SlapTool(BaseTool):
setup_service = portal.restrictedTraverse(
portal_preferences.getPreferredInstanceSetupResource())
hosting_query = ComplexQuery(Query(aggregate_portal_type="Slave Instance"),
Query(aggregate_relative_url=computer_partition_document.getRelativeUrl()),
# Search only for Confirmed and Stopped, the only one states that require
# buildout be re-updated.
Query(simulation_state=["confirmed", "stopped"]),
update_service = portal.restrictedTraverse(
portal_preferences.getPreferredInstanceUpdateResource())
global_query_kw = dict(aggregate_portal_type="Slave Instance",
aggregate_relative_url=computer_partition_document.getRelativeUrl(),)
hosting_query = ComplexQuery(Query(simulation_state=["confirmed", "stopped"]),
Query(default_resource_uid=hosting_service.getUid()),
operator="AND")
setup_query = ComplexQuery(Query(aggregate_portal_type="Slave Instance"),
Query(aggregate_relative_url=computer_partition_document.getRelativeUrl()),
Query(simulation_state=["confirmed", "started"]),
setup_query = ComplexQuery(Query(simulation_state=["confirmed", "started"]),
Query(default_resource_uid=setup_service.getUid()),
operator="AND")
query = ComplexQuery(hosting_query, setup_query, operator="OR")
update_query = ComplexQuery(Query(simulation_state=["confirmed"]),
Query(default_resource_uid=update_service.getUid()),
operator="AND")
query = ComplexQuery(hosting_query,
setup_query,
update_query,
operator="OR")
# Use getTrackingList
catalog_result = portal.portal_catalog(
portal_type='Sale Packing List Line',
sort_on=(('movement.start_date', 'DESC'),),
limit=1,
query=query)
query=query, **global_query_kw)
return len(catalog_result)
......
......@@ -7,27 +7,23 @@ from DateTime.DateTime import DateTime
class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
def stepBuildOneMoreSalePackingList(self, sequence, **kw):
def stepTriggerNextBuild(self, sequence, **kw):
build_before = sequence.get('build_before')
self.portal.portal_alarms.vifib_trigger_build.activeSense()
if build_before is None:
build_before = getClosestDate(
target_date=DateTime(), precision='month', before=0)
self.portal.portal_alarms.build_deliver_path.activeSense()
self.portal.portal_alarms.vifib_trigger_build.activeSense()
else:
build_before = addToDate(build_before, month=1)
self.portal.portal_alarms.build_deliver_path.activeSense(
self.portal.portal_alarms.vifib_trigger_build.activeSense(
params={'build_before':build_before})
sequence.edit(build_before=build_before)
def stepTriggerNextBuild(self, sequence, **kw):
sequence.edit(
number_of_sale_packing_list=sequence.get(
'number_of_sale_packing_list', 0) + 1,
number_of_invoice=sequence.get('number_of_invoice', 0) + 1,
number_of_payment=sequence.get('number_of_payment', 0) + 1
invoice_amount=sequence.get('invoice_amount', 0) + 1,
payment_amount=sequence.get('payment_amount', 0) + 1,
build_before=build_before
)
self.portal.portal_alarms.vifib_trigger_build.activeSense()
def stepCheckOneMoreDocumentList(self, sequence, **kw):
hosting_subscription = self.portal.portal_catalog\
......@@ -43,7 +39,7 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
sale_packing_list = sale_packing_list_list[0].getObject()
sale_invoice_transaction_list = sale_packing_list\
.getCausalityRelatedValueList(portal_type='Sale Invoice Transaction')
self.assertEqual(1, len(sale_invoice_transaction_list))
self.assertEqual(sequence['invoice_amount'], len(sale_invoice_transaction_list))
sale_invoice_transaction = sale_invoice_transaction_list[0]
payment_transaction_list = sale_invoice_transaction\
......
......@@ -180,7 +180,7 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_invoice.getSpecialise())
self.assertEquals("service_module/vifib_instance_subscription",
simulation_movement_invoice.getResource())
self.assertEquals("default/invoicing",
self.assertEquals("vifib/invoicing",
simulation_movement_invoice.getTradePhase())
self.assertEquals(expected_time_frame_list[idx+1],
simulation_movement_invoice.getStartDate())
......@@ -215,11 +215,11 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_invoice_transaction_debit = None
for simulation_movement_invoice_transaction in \
simulation_movement_invoice_transaction_list:
if "business_process_module/erp5_default_business_process/account_credit_path" \
if "business_process_module/vifib_sale_business_process/account_credit_path" \
in simulation_movement_invoice_transaction.getCausalityList():
simulation_movement_invoice_transaction_credit = \
simulation_movement_invoice_transaction.getObject()
if "business_process_module/erp5_default_business_process/account_debit_path" \
if "business_process_module/vifib_sale_business_process/account_debit_path" \
in simulation_movement_invoice_transaction.getCausalityList():
simulation_movement_invoice_transaction_debit = \
simulation_movement_invoice_transaction.getObject()
......@@ -247,7 +247,7 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_invoice_transaction_credit.getResource())
self.assertEquals(open_order_line.getSpecialise(),
simulation_movement_invoice_transaction_credit.getSpecialise())
self.assertEquals("default/accounting",
self.assertEquals("vifib/accounting",
simulation_movement_invoice_transaction_credit.getTradePhase())
self.assertEquals(expected_time_frame_list[idx+1],
simulation_movement_invoice_transaction_credit.getStartDate())
......@@ -274,7 +274,7 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_invoice_transaction_debit.getResource())
self.assertEquals(open_order_line.getSpecialise(),
simulation_movement_invoice_transaction_debit.getSpecialise())
self.assertEquals("default/accounting",
self.assertEquals("vifib/accounting",
simulation_movement_invoice_transaction_debit.getTradePhase())
self.assertEquals(expected_time_frame_list[idx+1],
simulation_movement_invoice_transaction_debit.getStartDate())
......@@ -302,11 +302,11 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_credit_payment_debit = None
for simulation_movement_credit_payment in \
simulation_movement_credit_payment_list:
if "business_process_module/erp5_default_business_process/payment_credit_path" \
if "business_process_module/vifib_sale_business_process/payment_credit_path" \
in simulation_movement_credit_payment.getCausalityList():
simulation_movement_credit_payment_credit = \
simulation_movement_credit_payment.getObject()
if "business_process_module/erp5_default_business_process/payment_debit_path" \
if "business_process_module/vifib_sale_business_process/payment_debit_path" \
in simulation_movement_credit_payment.getCausalityList():
simulation_movement_credit_payment_debit = \
simulation_movement_credit_payment.getObject()
......@@ -332,7 +332,7 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_credit_payment_credit.getDestinationSection())
self.assertEquals(open_order_line.getSpecialise(),
simulation_movement_credit_payment_credit.getSpecialise())
self.assertEquals("default/payment",
self.assertEquals("vifib/payment",
simulation_movement_credit_payment_credit.getTradePhase())
self.assertEquals(expected_time_frame_list[idx+1],
simulation_movement_credit_payment_credit.getStartDate())
......@@ -357,7 +357,7 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_credit_payment_debit.getDestinationSection())
self.assertEquals(open_order_line.getSpecialise(),
simulation_movement_credit_payment_debit.getSpecialise())
self.assertEquals("default/payment",
self.assertEquals("vifib/payment",
simulation_movement_credit_payment_debit.getTradePhase())
self.assertEquals(expected_time_frame_list[idx+1],
simulation_movement_credit_payment_debit.getStartDate())
......
......@@ -481,6 +481,8 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSoftwareInstanceAndRelatedComputerPartition
CheckRequestedSoftwareInstanceAndRelatedComputerPartition
Logout
......@@ -528,7 +530,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# now this computer patrition request new one
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse
RequestComputerPartition
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
......@@ -610,7 +612,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# now this computer patrition request new one
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse
RequestComputerPartition
SlapLogout
# now vifib_admin computer partition request new one and suceeds
......@@ -624,6 +626,8 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSoftwareInstanceAndRelatedComputerPartition
CheckRequestedSoftwareInstanceAndRelatedComputerPartition
Logout
......@@ -671,7 +675,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# now this computer patrition request new one
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse
RequestComputerPartition
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
......@@ -711,7 +715,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# now this computer patrition request new one
SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse
RequestComputerPartition
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
......
......@@ -25,18 +25,22 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
root_software_instance.requestSoftwareInstance(partition_reference=S1,
**common_kw)
self.stepTic()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
S1_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=S1)
S1_instance.requestSoftwareInstance(partition_reference=S2, **common_kw)
self.stepTic()
S1_instance.requestSoftwareInstance(partition_reference=S3, **common_kw)
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
root_software_instance.requestSoftwareInstance(partition_reference=S4,
**common_kw)
self.stepTic()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
S2_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=S2)
......@@ -141,7 +145,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
LoginDefaultUser
FinishSoftwareInstanceTree
Logout
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
......@@ -363,7 +366,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
software_type='any', instance_xml=self.minimal_correct_xml,
state='stopped')
self.logout()
self.login(sequence['software_instance_reference'])
root_software_instance.requestSoftwareInstance(
partition_reference=S1,
......@@ -373,6 +375,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
</instance>""" % sequence['computer_reference_c1'],
**common_kw)
self.stepTic()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
self.logout()
self.stepLoginDefaultUser()
......@@ -380,7 +384,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
portal_type='Software Instance', title=S1)
S1_reference = S1_instance.getReference()
self.logout()
self.login(S1_reference)
S1_instance.requestSoftwareInstance(
partition_reference=S2,
......@@ -390,6 +393,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
</instance>""" % sequence['computer_reference_c0'],
**common_kw)
self.stepTic()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
self.logout()
self.stepLoginDefaultUser()
......@@ -410,6 +415,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
self.logout()
self.stepLoginDefaultUser()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
S3_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=S3)
S3_reference = S3_instance.getReference()
......@@ -550,6 +557,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
FinishSoftwareInstanceSpannedTree
Tic
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
ComputerBang
......@@ -631,6 +639,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
partition_reference=S1,
**common_kw)
self.stepTic()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
self.logout()
self.stepLoginDefaultUser()
......
......@@ -350,7 +350,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Tic
SlapLogout
......@@ -740,7 +743,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Tic
SlapLogout
......@@ -766,6 +773,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentSoftwareInstance
Tic
RequestComputerPartition
Tic
......@@ -891,7 +903,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Tic
SlapLogout
......@@ -917,7 +933,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Tic
SlapLogout
......@@ -1051,7 +1071,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
Tic
SlapLogout
......@@ -1347,7 +1371,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestSlaveInstanceFromComputerPartition
Tic
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentSoftwareInstance
SoftwareInstanceAvailable
Tic
......
......@@ -340,7 +340,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin
SlapLogout \
\
LoginTestVifibCustomer \
RequestSlaveInstanceStop \
RequestSoftwareInstanceStop \
Tic \
Logout \
\
......
......@@ -20,7 +20,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotFoundResponse \
RequestComputerPartition \
SlapLogout \
'
sequence_list.addSequenceString(sequence_string)
......@@ -43,6 +43,8 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
SlapLogout \
\
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
......@@ -81,6 +83,8 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
SlapLogout \
\
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
......@@ -146,8 +150,9 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
CheckRaisesNotFoundComputerPartitionParameterDict \
Tic \
SlapLogout \
\
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
......@@ -209,8 +214,9 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
CheckRaisesNotFoundComputerPartitionParameterDict \
Tic \
SlapLogout \
\
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
......@@ -220,7 +226,9 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
Tic \
CheckRequestedComputerPartitionCleanParameterList \
SlapLogout \
\
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
LoginDefaultUser \
SetCurrentSoftwareInstanceRequested \
SetSelectedComputerPartition \
......@@ -429,6 +437,8 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
SlapLogout \
\
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
......@@ -458,8 +468,9 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
CheckRaisesNotFoundComputerPartitionParameterDict \
Tic \
SlapLogout \
\
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
CheckSoftwareInstanceAndRelatedComputerPartition \
CheckRequestedSoftwareInstanceAndRelatedComputerPartition \
Logout \
......@@ -528,7 +539,10 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
RequestComputerPartition
Tic
SlapLogout
......@@ -558,7 +572,10 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
RequestComputerPartition
Tic
SlapLogout
......@@ -735,7 +752,11 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
RequestComputerPartition
Tic
SlapLogout
......@@ -753,7 +774,10 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
RequestComputerPartition
Tic
SlapLogout
......@@ -838,12 +862,16 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\
LoginDefaultUser \
SlapLoginCurrentSoftwareInstance \
SelectRequestedReferenceChildrenA \
SelectEmptyRequestedParameterDict \
RequestComputerComputerPartitionCheckSerializeCalledOnSelected \
RequestComputerPartition \
SlapLogout \
LoginDefaultUser \
ConfirmSaleOrderOrderedToCheckSerializeCalledOnSelected \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
......@@ -876,7 +904,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
\
SelectYetAnotherRequestedReference \
SlapLoginCurrentSoftwareInstance \
RequestComputerPartitionNotFoundResponse \
RequestComputerPartition \
Tic \
SlapLogout \
'
......@@ -1023,9 +1051,18 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
SlapLoginCurrentSoftwareInstance
SelectEmptyRequestedParameterDict
SelectRequestedReference
RequestSlaveInstanceFromComputerPartitionNotFoundError
RequestSlaveInstanceFromComputerPartition
Tic
RequestSlaveInstanceFromComputerPartitionNotFoundError
LoginDefaultUser
SelectSlaveInstanceFromSaleOrderOrdered
SoftwareInstanceSaleOrderConfirmRaisesValueError
ConfirmOrderedSaleOrderActiveSense
Tic
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
CheckComputerPartitionInstanceSetupSalePackingListStopped
CheckComputerPartitionInstanceHostingSalePackingListConfirmed
SetDeliveryLineAmountEqualZero
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
......@@ -1124,22 +1161,38 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
SelectAnotherRequestedReference \
SelectEmptyRequestedParameterDict \
SlapLoginCurrentSoftwareInstance \
RequestSlaveInstanceFromComputerPartitionNotFoundError \
RequestSlaveInstanceFromComputerPartition \
Tic \
SlapLogout \
\
LoginDefaultUser \
SelectSlaveInstanceFromSaleOrderOrdered \
SoftwareInstanceSaleOrderConfirmRaisesValueError \
Tic \
CheckComputerPartitionInstanceSetupSalePackingListConfirmed \
Logout \
SlapLoginCurrentSoftwareInstance \
SetRequestedFilterParameterDict \
RequestSlaveInstanceFromComputerPartition \
Tic \
SlapLogout \
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
SetDeliveryLineAmountEqualTwo \
CheckComputerPartitionInstanceSetupSalePackingListConfirmed \
Logout \
\
SetRequestedWrongFilterParameterDict \
SelectYetAnotherRequestedReference \
SlapLoginCurrentSoftwareInstance \
RequestSlaveInstanceFromComputerPartitionNotFoundError \
RequestSlaveInstanceFromComputerPartition \
Tic \
SlapLogout \
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
CheckComputerPartitionInstanceSetupSalePackingListConfirmed \
Logout \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
......@@ -1152,6 +1205,13 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
**kw):
sequence.edit(requested_software_type="FirstSoftwareType")
def stepSelectSlaveInstanceFromSaleOrderOrdered(self, sequence):
order_line = self.portal.portal_catalog.getResultValue(
portal_type="Sale Order Line", simulation_state="ordered")
slave_instance_uid = order_line.getAggregateValue(
portal_type="Slave Instance").getUid()
sequence.edit(software_instance_uid=slave_instance_uid)
def stepRequestComputerPartitionWithAnotherSoftwareType(self, sequence, **kw):
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url, timeout=None)
......@@ -1207,12 +1267,20 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
SetFirstSoftwareType \
RequestComputerPartition \
Tic \
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
Logout \
RequestComputerPartition \
Tic \
RequestComputerPartitionWithAnotherSoftwareType \
Tic \
RequestComputerPartitionWithAnotherSoftwareType \
Tic \
LoginDefaultUser \
ConfirmOrderedSaleOrderActiveSense \
Tic \
Logout \
CheckRequestComputerPartitionWithAnotherSoftwareType \
Tic \
SlapLogout \
......
......@@ -10,12 +10,6 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin):
self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid']).requestUpdateComputerPartition()
def stepCheckComputerPartitionInstanceUpdateSalePackingListConfirmed(self,
sequence, **kw):
self._checkComputerPartitionSalePackingListState('confirmed',
self.portal.portal_preferences.getPreferredInstanceUpdateResource(),
sequence)
def stepCheckComputerPartitionInstanceUpdateSalePackingListDelivered(self,
sequence, **kw):
self._checkComputerPartitionSalePackingListState('delivered',
......
......@@ -332,6 +332,12 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.portal.portal_preferences.getPreferredInstanceCleanupResource(),
sequence)
def stepCheckComputerPartitionInstanceUpdateSalePackingListConfirmed(self,
sequence, **kw):
self._checkComputerPartitionSalePackingListState('confirmed',
self.portal.portal_preferences.getPreferredInstanceUpdateResource(),
sequence)
def stepCheckComputerPartitionInstanceCleanupSalePackingListCancelled(self,
sequence, **kw):
self._checkComputerPartitionSalePackingListState('cancelled',
......@@ -1080,7 +1086,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict \
Tic \
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
RequestComputerPartition \
Tic \
SlapLogout
......@@ -1095,7 +1104,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
RequestComputerPartition
Tic
CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
RequestComputerPartition
Tic
SlapLogout
......@@ -1728,8 +1740,13 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
software_type, software_type + str(1))
second = slap_computer_partition.request(software_release,
software_type, software_type + str(2))
self.stepLoginDefaultUser()
transaction.commit()
self.tic()
self.stepConfirmOrderedSaleOrderActiveSense()
transaction.commit()
self.tic()
self.stepLogout()
first = slap_computer_partition.request(software_release,
software_type, software_type + str(1))
second = slap_computer_partition.request(software_release,
......@@ -1761,21 +1778,6 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
requested_computer_partition_reference=\
requested_slap_computer_partition.getId())
def stepRequestComputerPartitionNotFoundResponse(self, sequence, **kw):
self.slap = slap.slap()
self.slap.initializeConnection(self.server_url, timeout=None)
slap_computer_partition = self.slap.registerComputerPartition(
sequence['computer_reference'],
sequence['computer_partition_reference'])
self.assertRaises(slap.NotFoundError, slap_computer_partition.request,
software_release=sequence['software_release_uri'],
software_type=sequence.get('requested_reference', 'requested_reference'),
partition_reference=sequence.get('requested_reference',
'requested_reference'),
partition_parameter_kw=sequence.get('requested_parameter_dict', {}),
filter_kw=sequence.get('requested_filter_dict', {}),
state=sequence.get('instance_state'))
def _stepSetSoftwareInstanceChildren(self, sequence, source_reference):
software_instance_uid = sequence['root_software_instance_uid']
hosting_subscription_uid = sequence['hosting_subscription_uid']
......@@ -1944,15 +1946,8 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
finally:
Base.serialize = Base.serialize_call
def stepRequestComputerComputerPartitionCheckSerializeCalledOnSelected(
def stepConfirmSaleOrderOrderedToCheckSerializeCalledOnSelected(
self, sequence, **kw):
software_release_uri = sequence['software_release_uri']
requested_reference = sequence['requested_reference']
software_instance_uid = sequence['software_instance_uid']
# slap cannot be used to this test, as ERP5 itself shall raise
requester = self.portal.portal_catalog.getResultValue(
uid=software_instance_uid)
# check that on being_requested serialise is being called
# code stolen from testERP5Security:test_MultiplePersonReferenceConcurrentTransaction
......@@ -1972,15 +1967,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
Base.serialize = verify_serialize_call
try:
self.assertRaises(DummyTestException, requester.requestSoftwareInstance,
software_release=software_release_uri,
partition_reference=requested_reference,
software_type=requested_reference,
shared=False,
filter_kw={},
instance_xml=self.minimal_correct_xml,
sla_xml=self.minimal_correct_xml,
state=None)
sale_order_ordered = self.portal.portal_catalog.getResultValue(
portal_type="Sale Order", simulation_state="ordered")
self.assertRaises(DummyTestException, sale_order_ordered.confirm)
finally:
Base.serialize = Base.serialize_call
......@@ -3834,16 +3823,6 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
uid=sequence["software_instance_uid"])
slave_instance.startComputerPartition()
def stepRequestSlaveInstanceStart(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence["software_instance_uid"])
slave_instance.requestStartComputerPartition()
def stepRequestSlaveInstanceStop(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence["software_instance_uid"])
slave_instance.requestStopComputerPartition()
def stepSlaveInstanceStopped(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence["software_instance_uid"])
......
......@@ -440,14 +440,113 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
LoginTestVifibCustomer
RequestDestroySoftwareInstanceFromCurrentComputerPartition
Tic
SetDeliveryLineAmountEqualOne
CheckComputerPartitionInstanceHostingSalePackingListStopped
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
SlapLoginCurrentComputer
SoftwareInstanceDestroyed
Tic
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListDelivered
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_destroy_SoftwareInstance_after_request_SlaveInstance(self):
"""
Check that destroying the Software Instance after request Slave
Instance with the same user, the Slave Instance must be destroyed
correctly
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
LoginTestVifibCustomer
RequestDestroySoftwareInstanceFromCurrentComputerPartition
Tic
SetDeliveryLineAmountEqualTwo
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
SlapLoginCurrentComputer
SoftwareInstanceDestroyed
Tic
CheckComputerPartitionInstanceHostingSalePackingListStopped
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListDelivered
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_destroy_SoftwareInstance_after_request_SlaveInstance_with_another_user(self):
"""
Check that destroying the Software Instance after request Slave
Instance with the different user, the Slave Instance must be destroyed
correctly
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
LoginTestVifibCustomerA
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
LoginTestVifibCustomer
RequestDestroySoftwareInstanceFromCurrentComputerPartition
Tic
SetDeliveryLineAmountEqualTwo
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
SlapLoginCurrentComputer
SoftwareInstanceDestroyed
Tic
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListDelivered
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_destroy_SoftwareInstance_after_destroy_SlaveInstance(self):
"""
Check that destroying the Software Instance after request destroy Slave
Instance, the request to destroy the Software Instance will not raise
exception
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
LoginTestVifibCustomer
PersonRequestSlaveInstance
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
LoginTestVifibCustomer
RequestSoftwareInstanceDestroy
Tic
RequestDestroySoftwareInstanceFromCurrentComputerPartition
Tic
SetDeliveryLineAmountEqualTwo
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
SlapLoginCurrentComputer
SoftwareInstanceDestroyed
Tic
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListDelivered
Logout
"""
......@@ -480,7 +579,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic
SlapLogout
LoginTestVifibCustomer
RequestSlaveInstanceStop
RequestSoftwareInstanceStop
Tic
Logout
LoginDefaultUser
......@@ -506,6 +605,12 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepCheckComputerPartitionIsBusy(self, sequence, **kw):
computer_partition_uid = sequence["computer_partition_uid"]
computer_partition = self.portal.portal_catalog.getResultValue(
uid=computer_partition_uid)
self.assertEqual('busy', computer_partition.getSlapState())
def test_SlaveInstance_request_destroy(self):
"""
Check that the Slave Instance will be destroyed correctly
......@@ -524,6 +629,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
CheckComputerPartitionIsBusy
Logout
"""
sequence_list.addSequenceString(sequence_string)
......@@ -684,6 +790,106 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Security_after_destroy_SoftwareInstance_with_different_user(self):
"""
Check that destroying one Software Instance it will not destroy Slave
Instances that is not related to your Software Instance.
Scenario:
VifibCustomer CustomerA
| |
SoftwareInstance SoftwareInstanceA (requestDestroy)
| |
SlaveInstance SlaveInstanceA
The Slave Instance related to Customer should not be destroyed
"""
self.computer_partition_amount = 4
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
CheckEmptySlaveInstanceListFromOneComputerPartition
SlapLoginCurrentSoftwareInstance
SelectEmptyRequestedParameterDict
SetRandomRequestedReference
RequestSlaveInstanceFromComputerPartition
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentSoftwareInstance
RequestSlaveInstanceFromComputerPartition
SlapLogout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
LoginDefaultUser
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceSetupSalePackingListStopped
CheckComputerPartitionInstanceHostingSalePackingListConfirmed """ + \
self.prepare_published_software_release + """
Tic
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
LoginAsCustomerA
PersonRequestSoftwareInstance
Logout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
SlapLoginCurrentSoftwareInstance
SelectEmptyRequestedParameterDict
SetRandomRequestedReference
RequestSlaveInstanceFromComputerPartition
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentSoftwareInstance
RequestSlaveInstanceFromComputerPartition
Tic
SlapLogout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
SlapLogout
LoginDefaultUser
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceSetupSalePackingListStopped
CheckComputerPartitionInstanceHostingSalePackingListConfirmed
Logout
LoginAsCustomerA
RequestDestroySoftwareInstanceFromCurrentComputerPartition
Tic
Logout
LoginDefaultUser
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapWebServiceSlaveInstance))
......
......@@ -101,12 +101,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
"""
prepare_configured_instance = """ \
InitializeTime \
\
LoginERP5TypeTestCase \
ConfigureInstance \
Tic \
Logout""" + \
InitializeTime""" + \
TestVifibSlapWebServiceMixin.prepare_confirmed_cleanup_resource_packing_list
prepare_reported_usage_call = """ \
......@@ -121,29 +116,6 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
sequence['first_call'] = False
sequence['second_call'] = False
def stepConfigureInstance(self, sequence, **kw):
"""
Configures the Instance
"""
portal = self.getPortalObject()
# We validate some documents
for rule in portal.portal_rules.contentValues():
if rule.getObject().getValidationState() == 'draft':
rule.getObject().validate()
for person in portal.person_module.contentValues():
if person.getObject().getValidationState() == 'draft':
person.getObject().validate()
for business_process in portal.business_process_module.contentValues():
if business_process.getObject().getValidationState() == 'draft':
business_process.getObject().validate()
for sale_trade in portal.sale_trade_condition_module.contentValues():
if sale_trade.getObject().getValidationState() == 'draft':
sale_trade.getObject().validate()
def stepSlapReportUsageCall(self, sequence, **kw):
"""
Checks that slap.reportUsage is successfully called.
......
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