Commit 8b763ead authored by Łukasz Nowak's avatar Łukasz Nowak

Impement instance update API.

New workflow method available on software instance
(requestUpdateComputerPartition) allows update software instance.

It reuses need_modification flag and informs slapos node that computer partition
shall be modified.

No changes are required on nodes, as this supports proper replies from nodes.

Squashed commit of the following:

commit 949488534c541d1c960b5e1a8f82de5067aaf706
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 14:47:49 2011 +0200

    Cover person begin requesting.

commit 09fb07bcae69e806c82953762cf95c7762f62973
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 14:26:23 2011 +0200

    Prove that no update packing list is created when request is in progress.

commit 93dfc1fc1015da6ee53cd2aa061e994994f6a8a5
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 11:29:03 2011 +0200

    Rewrite test in order to follow logic.

    It raises before, but leave required checks.

commit 328666079187437bf23d259abf7e2e132fefe5ae
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 11:04:16 2011 +0200

    Prove that during destruction in progress no update is created.

    Again: such operation will result in update software instance.

commit 5b7a0abe18e325d16eb228794eb8546c236bf49f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 10:58:02 2011 +0200

    Prove that during start in progress no update is done.

commit 420c66b7f3d9ff3bde7a483d3a72107fe591f754
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 10:54:25 2011 +0200

    Do not interfere with start or destruction in progress.

    Those actions will result in instance update, no need to create any.

commit e7e7c1a40cb57dafb4d0044d39ba6eae00716e81
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 10:32:54 2011 +0200

    One another place to avoid update creation.

    Add notes about impossibly to fetch correct tag.

commit 41bc0f1b92d5b836635b6c43ba98d9c5b6095d4d
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 10:28:46 2011 +0200

    Another lock test to avoid update during request.

commit 3c9d408c8ac6381e6a8706543dfa85857eef43bd
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 09:45:11 2011 +0200

    Revert "Avoid resetting test CA."

    This reverts commit a3e246e8156d4b016723aaa13ddc116f0dad14e2.

    Conflicts:

    	master/product/Vifib/tests/VifibMixin.py

commit 70a6f27faf44bdeeeb6930516b4b45b53cedab96
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Oct 3 09:41:00 2011 +0200

    Revert "For safety make small gap."

    This reverts commit 925c10370d7cf002188500f704d3ae882ba7aeb1.

commit 8a510bcfa1d24fe005e3383e7dec093e672e303d
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 17:23:47 2011 +0200

    No, setup in delivered is NOT supported.

commit 925c10370d7cf002188500f704d3ae882ba7aeb1
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 17:21:33 2011 +0200

    For safety make small gap.

commit 4efecddd41251928f8f0116dfd2dc8f804978b44
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 16:41:05 2011 +0200

    Cover ignored cases.

commit 58d502c49633468e8c8df66660cb870e5f06d1f1
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 16:32:47 2011 +0200

    OpenSSL serials are in base 16.

commit aec5e64ad158f5eec0c61bb2cfb22450b3841486
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 16:27:11 2011 +0200

    Check started and special stopped state.

    Started is usual state.

    When instance was requested in stopped state, instace update shall support case
    of instance setup packing list.

commit 8ab1ffe4f5beb8047523461dd4072f7db63a97f7
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 16:25:41 2011 +0200

    Support case of request SI with stopped state.

    In such case there is only Instance Setup Packing List which if in stopped
    state allows to deliver inset update PPL.

commit 43568cd2017cfbc4ed4676f075535394caf77352
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 15:47:42 2011 +0200

    Proof that update works on stopped software instance.

commit 8a855c01f1cdcfa70b819609ff423ed574ed949b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 15:25:40 2011 +0200

    Typo.

commit 30dc522284e5ff23681966c44b6d73c5eac5ed15
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 15:22:34 2011 +0200

    It is better to reset test environment instead of CA.

commit 85accd973f72e98cc33356644701fe910adbea0a
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 15:07:36 2011 +0200

    Define tests.

commit 9621885fd1be692b7d5387c59f0f596257ec89e7
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 14:34:04 2011 +0200

    Drop local_permission_vifib_interaction_workflow

    It is defined and configured in vifib_erp5.

commit 6279404c4bd48c933c6a0e17e2e258affdc6d2b9
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 14:17:40 2011 +0200

    Do not set slap_interaction_workflow in vifib_base.

    This workflow is available in vifib_slap, and those types are configured in
    former business template.

commit 9bf84264777283f5c876d45d4b6b74a3fdc1ba3e
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 14:10:48 2011 +0200

    Skeleton for update packing list tests.

commit 8dfacef65bc5f4e7c940164a30f746db1e7b0534
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 14:08:32 2011 +0200

    Avoid plurals.

commit 784511374d47a89255b29d0fe69fa41e66d856e4
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 14:06:25 2011 +0200

    Cleanup imports.

    It lowers pyflakes complaints and allows to have minimalist required test module.

commit 8b7bc851d1724f40f2b843636d9f5a5f080ae15f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 13:55:32 2011 +0200

    Separate bug related tests.

commit d775aa6f6f95e40753c31235fe13f607312c613a
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 13:50:12 2011 +0200

    Keep "compatibility"

    If not update packing list was defined in active state fallback to previous
    "failing" behaviour.

    It is not defined what shall happen in cases when not correct
    (eg: stopped->stopped) is requested, and new functionality shall not impact it.

commit ff88c3704cde5aa8da0fee65ddbe8105a0bbe64b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 11:39:57 2011 +0200

    Process update packing list on started and stopped responses.

commit 2a833c884e558860dbeef3989adae95edbe6ff29
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 11:39:09 2011 +0200

    Provide update packing list delivery script.

    If there update packing list was found and it was in correct state, this scripts
    returns True, to indicate that update packing list was managed.

commit 4b9923f10730ad95816f70fff20c96531ef0d741
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 11:38:35 2011 +0200

    Allow to pass own state_list.

commit e34819d6d4892248cf4ca550e1d5fb710a1fe14f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 11:37:36 2011 +0200

    Support update packing list.

    It impacts presence of partition on list.

commit b95b568c7a90f71566bbf072058b2a623d736abf
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 11:25:26 2011 +0200

    Support update resource.

commit aecca5f228f7607c7037d28c14ac852885c352f5
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 10:43:26 2011 +0200

    Destroy is "unsupported" too.

commit 96fc577fff652a0311d1d1c4bc7def491fd8dd7e
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 10:42:25 2011 +0200

    Create update packing list.

    Create only when Instance Hosting or Setup are in correct states.

commit 2a95ee39a9d81ba7a2ade496556844e867d634d3
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Sep 28 10:42:13 2011 +0200

    Support None tag.

commit e56bc4390a084d1d3162c1c0c2c3c8b75b012e6d
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 18:44:56 2011 +0200

    Call proper script.

commit a3e246e8156d4b016723aaa13ddc116f0dad14e2
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 18:20:45 2011 +0200

    Avoid resetting test CA.

    It allows to live coexist test instance and development site on same instance.

commit dacd5ab8a2e1d77ef88051e8e6d9aa82d1e0342c
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 18:17:19 2011 +0200

    Make it pass consistency check.

commit 83f08e4ff8c3a1c066df8a2e0aca027abe7916b2
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 18:10:55 2011 +0200

    Add vifib_instance_update to data.

commit 2a5ef6f082a9ff2c2d05208a67419fab7bfdbd69
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 18:06:56 2011 +0200

    Add preferred_instance_update_resource_property with UI.

commit 420eaddf73f8ca41cc2089325372d14d870a533c
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 17:57:46 2011 +0200

    Export from ERP5.

    Seems like file was edited locally.

commit fd4377bca8a79ff25908c19b8b929396a49b8a13
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 17:57:20 2011 +0200

    Add missing BT5 metadata.

commit ce7d695587c81aa53a9f5c5680233b34183c22bb
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 17:49:56 2011 +0200

    Partially revert mistake in 324c9104

    Person document class was removed.

commit 206ec5c30e59ecfb62ea58eee9f6f4c35dc24aa4
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Sep 27 17:46:38 2011 +0200

    Add request_update_computer_partition.

    Also remove update_slave_partition_list, which seems like wrongly commited BT5.
parent 9153f4ae
......@@ -59,6 +59,10 @@ instance_setup_sale_packing_list_line = \\\n
instance_setup_sale_packing_list = instance_setup_sale_packing_list_line.getParentValue()\n
portal = context.getPortalObject()\n
sale_packing_list_module = portal.getDefaultModule(portal_type=\'Sale Packing List\')\n
if tag is not None:\n
activate_kw = {\'tag\': tag}\n
else:\n
activate_kw = None\n
sale_packing_list = sale_packing_list_module.newContent(\n
portal_type=\'Sale Packing List\',\n
specialise=instance_setup_sale_packing_list.getSpecialise() or instance_setup_sale_packing_list.getCausalityValue().getSpecialise(),\n
......@@ -69,14 +73,14 @@ sale_packing_list = sale_packing_list_module.newContent(\n
source_section=instance_setup_sale_packing_list.getSourceSection(),\n
price_currency=instance_setup_sale_packing_list.getPriceCurrency(),\n
start_date=DateTime(),\n
activate_kw={\'tag\': tag})\n
activate_kw=activate_kw)\n
\n
instance_hosting_sale_packing_list_line = sale_packing_list.newContent(\n
portal_type=\'Sale Packing List Line\',\n
resource=service_relative_url,\n
quantity=instance_setup_sale_packing_list_line.getQuantity(),\n
aggregate_list=instance_setup_sale_packing_list_line.getAggregateList(),\n
activate_kw={\'tag\': tag}\n
activate_kw=activate_kw\n
)\n
return sale_packing_list\n
</string> </value>
......
<?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>software_instance = state_change[\'object\']\n
service_relative_url = software_instance.portal_preferences.\\\n
getPreferredInstanceUpdateResource()\n
try:\n
line = context.SoftwareInstance_getInstancePackingListLine(\n
state_change, \n
service_relative_url=service_relative_url,\n
state_list=[\'confirmed\'])\n
except ValueError:\n
return False\n
else:\n
delivery = line.getParentValue()\n
delivery.start()\n
delivery.stop()\n
delivery.deliver()\n
return True\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_deliverActiveInstanceUpdatePackingListLine</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -71,10 +71,11 @@ else:\n
service_uid_list.append(service.getUid())\n
\n
# Packing List valid state\n
state_list = []\n
state_list.extend(portal.getPortalReservedInventoryStateList())\n
state_list.extend(portal.getPortalTransitInventoryStateList())\n
state_list.extend(portal.getPortalCurrentInventoryStateList())\n
if state_list is None:\n
state_list = []\n
state_list.extend(portal.getPortalReservedInventoryStateList())\n
state_list.extend(portal.getPortalTransitInventoryStateList())\n
state_list.extend(portal.getPortalCurrentInventoryStateList())\n
\n
packing_list_line = portal.portal_catalog.getResultValue(\n
portal_type=\'Sale Packing List Line\',\n
......@@ -94,7 +95,7 @@ else:\n
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change, service_relative_url=None</string> </value>
<value> <string>state_change, service_relative_url=None, state_list=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
<?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 encoding="cdata"><![CDATA[
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n
\n
software_instance = state_change[\'object\']\n
portal = software_instance.getPortalObject()\n
\n
# avoid conflicting with "in progress" update tasks\n
tag_list = ["%s_destroyInProgress" % software_instance.getUid(), "%s_startInProgress" % software_instance.getUid()]\n
for tag in tag_list:\n
if (portal.portal_activities.countMessageWithTag(tag) > 0):\n
# do nothing if something is progress\n
return\n
portal_preferences = portal.portal_preferences\n
\n
update_resource_relative_url = portal.restrictedTraverse(portal_preferences.getPreferredInstanceUpdateResource()).getUid()\n
setup_resource_uid = portal.restrictedTraverse(portal_preferences.getPreferredInstanceSetupResource()).getUid()\n
hosting_resource_uid = portal.restrictedTraverse(portal_preferences.getPreferredInstanceHostingResource()).getUid()\n
\n
service_uid_state_mapping = {\n
setup_resource_uid: [\'stopped\'],\n
hosting_resource_uid: [\'started\', \'delivered\']\n
}\n
previous_packing_list_line = context.SoftwareInstance_getInstancePackingListLine(state_change)\n
\n
if previous_packing_list_line.getResourceUid() == hosting_resource_uid:\n
if previous_packing_list_line.getSimulationState() not in service_uid_state_mapping[hosting_resource_uid]:\n
return\n
elif previous_packing_list_line.getResourceUid() == setup_resource_uid:\n
if previous_packing_list_line.getSimulationState() not in service_uid_state_mapping[setup_resource_uid]:\n
return\n
else:\n
# not "supported" resource, eg. cleanup\n
return\n
\n
# time to create packing list\n
context.SoftwareInstance_createSalePackingList(state_change, portal_preferences.getPreferredInstanceUpdateResource()).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_requestUpdate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -52,6 +52,9 @@
<key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Log import log\n
packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n
if packing_list_line.getSimulationState() == "started":\n
if context.SoftwareInstance_deliverActiveInstanceUpdatePackingListLine(state_change):\n
return\n
if packing_list_line.getSimulationState() != "started":\n
packing_list_line.getParentValue().start()\n
else:\n
......
......@@ -53,8 +53,20 @@
<value> <string>try:\n
packing_list_line = context.SoftwareInstance_getInstanceHostingPackingListLine(state_change)\n
except ValueError:\n
try:\n
instance_setup_packing_list_line = context.SoftwareInstance_getInstanceSetupPackingListLine(state_change)\n
except ValueError:\n
return\n
else:\n
if instance_setup_packing_list_line.getSimulationState() == \'stopped\':\n
# in case if instance was requested in stopped state, then update was done\n
# update shall be processed\n
context.SoftwareInstance_deliverActiveInstanceUpdatePackingListLine(state_change)\n
return\n
packing_list = packing_list_line.getParentValue()\n
if packing_list.getSimulationState() == \'delivered\':\n
if context.SoftwareInstance_deliverActiveInstanceUpdatePackingListLine(state_change):\n
return\n
packing_list.deliver()\n
</string> </value>
</item>
......
......@@ -33,13 +33,13 @@
<string>request_start_computer_partition_action</string>
<string>request_stop_computer_partition</string>
<string>request_stop_computer_partition_action</string>
<string>request_update_computer_partition</string>
<string>start_computer_partition</string>
<string>start_computer_partition_installation</string>
<string>start_requested</string>
<string>stop_computer_partition</string>
<string>stop_computer_partition_installation</string>
<string>stop_requested</string>
<string>update_slave_partition_list</string>
</tuple>
</value>
</item>
......
......@@ -33,13 +33,13 @@
<string>request_start_computer_partition_action</string>
<string>request_stop_computer_partition</string>
<string>request_stop_computer_partition_action</string>
<string>request_update_computer_partition</string>
<string>start_computer_partition</string>
<string>start_computer_partition_installation</string>
<string>start_requested</string>
<string>stop_computer_partition</string>
<string>stop_computer_partition_installation</string>
<string>stop_requested</string>
<string>update_slave_partition_list</string>
</tuple>
</value>
</item>
......
......@@ -33,13 +33,13 @@
<string>request_start_computer_partition_action</string>
<string>request_stop_computer_partition</string>
<string>request_stop_computer_partition_action</string>
<string>request_update_computer_partition</string>
<string>start_computer_partition</string>
<string>start_computer_partition_installation</string>
<string>start_requested</string>
<string>stop_computer_partition</string>
<string>stop_computer_partition_installation</string>
<string>stop_requested</string>
<string>update_slave_partition_list</string>
</tuple>
</value>
</item>
......
......@@ -33,13 +33,13 @@
<string>request_start_computer_partition_action</string>
<string>request_stop_computer_partition</string>
<string>request_stop_computer_partition_action</string>
<string>request_update_computer_partition</string>
<string>start_computer_partition</string>
<string>start_computer_partition_installation</string>
<string>start_requested</string>
<string>stop_computer_partition</string>
<string>stop_computer_partition_installation</string>
<string>stop_requested</string>
<string>update_slave_partition_list</string>
</tuple>
</value>
</item>
......
<?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_icon</string> </key>
<value> <string></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_requestUpdate</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_update_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>Requests update of Computer Partition</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
278
\ No newline at end of file
296
\ No newline at end of file
SoftwareInstance
Person
\ No newline at end of file
Slave Instance | edit_workflow
Slave Instance | item_workflow
Slave Instance | local_permission_vifib_interaction_workflow
Slave Instance | slap_interaction_workflow
Slave Instance | software_instance_slap_interface_workflow
Software Instance | edit_workflow
Software Instance | item_workflow
Software Instance | local_permission_vifib_interaction_workflow
Software Instance | slap_interaction_workflow
Software Instance | software_instance_slap_interface_workflow
\ No newline at end of file
<local_roles_item>
<local_roles>
<role id='ERP5TypeTestCase'>
<item>Owner</item>
</role>
<role id='IS-SYSAD'>
<item>Auditor</item>
</role>
<role id='PROD'>
<item>Auditor</item>
</role>
<role id='customer'>
<item>Auditor</item>
</role>
</local_roles>
</local_roles_item>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Service" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Author</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>aggregated_portal_type</string> </key>
<value>
<tuple>
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>quantity_unit/unit/piece</string>
</tuple>
</value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>instance_update</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>vifib_instance_update</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Service</string> </value>
</item>
<item>
<key> <string>required_aggregated_portal_type</string> </key>
<value>
<tuple>
<string>Computer Partition</string>
<string>Software Instance</string>
<string>Software Release</string>
<string>Subscription Item</string>
</tuple>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Instance Update</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -105,9 +105,13 @@
<key> <string>preferred_instance_setup_resource</string> </key>
<value> <string>service_module/vifib_instance_setup</string> </value>
</item>
<item>
<key> <string>preferred_instance_update_resource</string> </key>
<value> <string>service_module/vifib_instance_update</string> </value>
</item>
<item>
<key> <string>preferred_ooodoc_server_address</string> </key>
<value> <string>10.0.0.1</string> </value>
<value> <string>10.0.1.228</string> </value>
</item>
<item>
<key> <string>preferred_ooodoc_server_port_number</string> </key>
......
81
\ No newline at end of file
82
\ No newline at end of file
......@@ -4,5 +4,6 @@ service_module/memory_consumption
service_module/vifib_instance_cleanup
service_module/vifib_instance_hosting
service_module/vifib_instance_setup
service_module/vifib_instance_update
service_module/vifib_software_setup
service_module/vifib_usage_report
\ No newline at end of file
......@@ -6,3 +6,4 @@ service_module/vifib_instance_hosting
service_module/vifib_instance_setup
service_module/vifib_software_setup
service_module/vifib_usage_report
service_module/vifib_instance_update
\ No newline at end of file
......@@ -6,5 +6,6 @@ service_module/memory_consumption
service_module/vifib_instance_cleanup
service_module/vifib_instance_hosting
service_module/vifib_instance_setup
service_module/vifib_instance_update
service_module/vifib_software_setup
service_module/vifib_usage_report
\ No newline at end of file
......@@ -85,9 +85,7 @@
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
<value> <string>en</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
......@@ -327,7 +325,7 @@
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
<global id="4.1" name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
......@@ -342,6 +340,51 @@
</value>
</item>
</dictionary>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>ERP5TypeTestCase</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>913.21451.21198.26589</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass> <reference id="4.1"/> </klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1317140179.01</float>
<string>GMT+2</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</tuple>
</pickle>
......
96
\ No newline at end of file
97
\ No newline at end of file
......@@ -28,6 +28,10 @@
<key> <string>id</string> </key>
<value> <string>VifibSystemPreference</string> </value>
</item>
<item>
<key> <string>last_id</string> </key>
<value> <string>1</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>mode</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/string</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Resource used to represent fact of Software Instance update</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>preferred_instance_update_resource_property</string> </value>
</item>
<item>
<key> <string>mode</string> </key>
<value> <string>w</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>preference</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>python: \'\'</string> </value>
</item>
<item>
<key> <string>write_permission</string> </key>
<value> <string>Manage properties</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -57,8 +57,10 @@ hosting_service = context.restrictedTraverse(\n
context.portal_preferences.getPreferredInstanceHostingResource())\n
setup_service = context.restrictedTraverse(\n
context.portal_preferences.getPreferredInstanceSetupResource())\n
update_service = context.restrictedTraverse(\n
context.portal_preferences.getPreferredInstanceUpdateResource())\n
\n
service_uid_list = [hosting_service.getUid(), setup_service.getUid()]\n
service_uid_list = [hosting_service.getUid(), setup_service.getUid(), update_service.getUid()]\n
\n
state_list = ("confirmed", "started")\n
\n
......
......@@ -97,6 +97,7 @@
<string>my_preferred_instance_hosting_resource</string>
<string>my_preferred_instance_cleanup_resource</string>
<string>my_preferred_software_setup_resource</string>
<string>my_preferred_instance_update_resource</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_preferred_instance_update_resource</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_category</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Preferred Instance Update Resource</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'\', \'\')] + [(x.getTitle(), x.getRelativeUrl()) for x in here.portal_catalog(portal_type=\'Service\', sort_on=((\'title\', \'ASC\'),),checked_permission=\'View\')]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
418
\ No newline at end of file
420
\ No newline at end of file
......@@ -402,6 +402,12 @@ class SlapTool(BaseTool):
slap_partition._requested_state = 'destroyed'
slap_partition._need_modification = 0
update_movement = self._getSalePackingListLineForComputerPartition(
computer_partition_document, service_uid_list=[portal.restrictedTraverse(portal_preferences.getPreferredInstanceUpdateResource()).getUid()])
if update_movement is not None:
if update_movement.getSimulationState() != 'confirmed':
# only confirmed update movements are interesting
update_movement = None
movement = self._getSalePackingListLineForComputerPartition(
computer_partition_document)
if movement is not None:
......@@ -435,6 +441,8 @@ class SlapTool(BaseTool):
slap_partition._need_modification = 1
elif movement.getSimulationState() == 'stopped':
slap_partition._requested_state = 'stopped'
if update_movement is not None:
slap_partition._need_modification = 1
elif movement.getSimulationState() == 'delivered':
slap_partition._requested_state = 'destroyed'
else:
......@@ -450,11 +458,15 @@ class SlapTool(BaseTool):
slap_partition._requested_state = 'started'
slap_partition._need_modification = \
self._hasSlaveInstanceNeedModification(computer_partition_document)
if update_movement is not None:
slap_partition._need_modification = 1
elif movement.getSimulationState() == 'stopped':
slap_partition._requested_state = 'stopped'
slap_partition._need_modification = 1
elif movement.getSimulationState() == 'delivered':
slap_partition._requested_state = 'stopped'
if update_movement is not None:
slap_partition._need_modification = 1
else:
raise NotImplementedError, "Unexpected state %s" % \
movement.getSimulationState()
......@@ -833,13 +845,15 @@ class SlapTool(BaseTool):
def _getSalePackingListLineForComputerPartition(self,
computer_partition_document,
slave_reference=None):
slave_reference=None,
service_uid_list=None):
"""
Return latest meaningfull sale packing list related to a computer partition
document
"""
portal = self.getPortalObject()
portal_preferences = portal.portal_preferences
if service_uid_list is None:
service_uid_list = []
for service_relative_url in \
(portal_preferences.getPreferredInstanceSetupResource(),
......
from Products.ERP5Type.tests.Sequence import SequenceList
import unittest
from testVifibSlapWebService import TestVifibSlapWebServiceMixin
from Products.DCWorkflow.DCWorkflow import ValidationFailed
from random import random
class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin):
def stepRequestSoftwareInstanceUpdate(self, sequence, **kw):
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',
self.portal.portal_preferences.getPreferredInstanceUpdateResource(),
sequence)
def stepPersonRequestStoppedSoftwareInstance(self, sequence, **kw):
self.stepPersonRequestSoftwareInstance(sequence, state='stopped')
def stepCheckComputerPartitionNoInstanceUpdateSalePackingList(self,
sequence, **kw):
self._checkComputerPartitionNoSalePackingList(
self.portal.portal_preferences.getPreferredInstanceUpdateResource(),
sequence)
# expected scenarios
def test_update_support_stopped_instance_setup(self):
sequence_list = SequenceList()
sequence_string = self.prepare_published_software_release + \
self.prepare_formated_computer + """
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
LoginTestVifibCustomer
PersonRequestStoppedSoftwareInstance
Tic
Logout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
SlapLoginCurrentComputer
SoftwareInstanceBuilding
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListStarted
Logout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
SlapLogout
LoginDefaultUser
SetSelectedComputerPartition
CheckComputerPartitionInstanceSetupSalePackingListStopped
CheckComputerPartitionNoInstanceHostingSalePackingList
Logout
# prepared initally stopped instance
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceUpdateSalePackingListConfirmed
Logout
SlapLoginCurrentComputer
CheckSuccessComputerGetComputerPartitionCall
SlapLogout
SlapLoginCurrentComputer
CheckStoppedComputerPartitionGetStateCall
SlapLogout
SlapLoginCurrentComputer
SoftwareInstanceStopped
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionNoInstanceHostingSalePackingList
CheckComputerPartitionInstanceSetupSalePackingListStopped
CheckComputerPartitionInstanceUpdateSalePackingListDelivered
Logout
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_update_support_started_instance_hosting(self):
sequence_list = SequenceList()
sequence_string = self.prepare_started_computer_partition_sequence_string \
+ """
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceUpdateSalePackingListConfirmed
Logout
SlapLoginCurrentComputer
CheckSuccessComputerGetComputerPartitionCall
SlapLogout
SlapLoginCurrentComputer
CheckStartedComputerPartitionGetStateCall
SlapLogout
SlapLoginCurrentComputer
SoftwareInstanceStarted
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListStarted
CheckComputerPartitionInstanceUpdateSalePackingListDelivered
Logout
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_update_support_delivered_instance_hosting(self):
sequence_list = SequenceList()
sequence_string = self.prepare_stopped_computer_partition_sequence_string \
+ """
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceUpdateSalePackingListConfirmed
Logout
SlapLoginCurrentComputer
CheckSuccessComputerGetComputerPartitionCall
SlapLogout
SlapLoginCurrentComputer
CheckStoppedComputerPartitionGetStateCall
SlapLogout
SlapLoginCurrentComputer
SoftwareInstanceStopped
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListDelivered
CheckComputerPartitionInstanceUpdateSalePackingListDelivered
Logout
SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
# ignored scenarios
def test_update_not_created_confirmed_instance_setup(self):
sequence_list = SequenceList()
sequence_string = \
self.prepare_install_requested_computer_partition_sequence_string + """
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionNoInstanceUpdateSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_update_not_created_started_instance_setup(self):
sequence_list = SequenceList()
sequence_string = \
self.prepare_building_computer_partition_sequence_string + """
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionNoInstanceUpdateSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_update_not_created_delivered_instance_setup(self):
sequence_list = SequenceList()
sequence_string = self.prepare_published_software_release + \
self.prepare_formated_computer + """
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
LoginTestVifibCustomer
PersonRequestStoppedSoftwareInstance
Tic
Logout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
SetSelectedComputerPartition
SelectCurrentlyUsedSalePackingListUid
Logout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
SlapLoginCurrentComputer
SoftwareInstanceBuilding
Tic
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceSetupSalePackingListStarted
Logout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
SlapLogout
LoginDefaultUser
SetSelectedComputerPartition
CheckComputerPartitionInstanceSetupSalePackingListStopped
CheckComputerPartitionNoInstanceHostingSalePackingList
Logout
LoginDefaultUser
DeliverSalePackingList
Tic
CheckComputerPartitionInstanceSetupSalePackingListDelivered
Logout
# prepared delivered instance setup delivery
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionNoInstanceUpdateSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_update_not_created_confirmed_instance_hosting(self):
sequence_list = SequenceList()
sequence_string = \
self.prepare_installed_computer_partition_sequence_string + """
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionNoInstanceUpdateSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_update_not_created_stopped_instance_hosting(self):
sequence_list = SequenceList()
sequence_string = \
self.prepare_stop_requested_computer_partition_sequence_string + """
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionNoInstanceUpdateSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_update_not_created_confirmed_instance_cleanup(self):
sequence_list = SequenceList()
sequence_string = \
self.prepare_destroy_requested_computer_partition + """
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionNoInstanceUpdateSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_update_not_created_started_instance_cleanup(self):
sequence_list = SequenceList()
sequence_string = \
self.prepare_destroy_requested_computer_partition + """
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionNoInstanceUpdateSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepRequestSoftwareInstanceUpdateRaisesValidationFailed(self, sequence,
**kw):
instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
self.assertRaises(ValidationFailed, instance.requestUpdateComputerPartition)
def test_update_not_possible_delivered_instance_cleanup(self):
sequence_list = SequenceList()
sequence_string = \
self.prepare_destroyed_computer_partition + """
LoginTestVifibCustomer
RequestSoftwareInstanceUpdateRaisesValidationFailed
Tic
Logout
LoginDefaultUser
CheckComputerPartitionNoInstanceUpdateSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
# low level activity locks
def stepCheckActivityStartInProgress(self, sequence, **kw):
self.assertNotEqual(0, self.portal.portal_activities.
countMessageWithTag('%s_startInProgress' % sequence[
'software_instance_uid']))
def test_update_not_created_start_in_progress(self):
sequence_list = SequenceList()
sequence_string = \
self.prepare_stopped_computer_partition_sequence_string + """
LoginTestVifibCustomer
RequestSoftwareInstanceStart
Logout
LoginDefaultUser
CheckActivityStartInProgress
Logout
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionNoInstanceUpdateSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepCheckActivityDestroyInProgress(self, sequence, **kw):
self.assertNotEqual(0, self.portal.portal_activities.
countMessageWithTag('%s_destroyInProgress' % sequence[
'software_instance_uid']))
def test_update_not_created_destruction_in_progress(self):
sequence_list = SequenceList()
sequence_string = self\
.prepare_installed_computer_partition_sequence_string + """
LoginTestVifibCustomer
RequestSoftwareInstanceDestroy
Logout
LoginDefaultUser
CheckActivityDestroyInProgress
Logout
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionNoInstanceUpdateSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepCheckActivityRequestInProgress(self, sequence, **kw):
software_instance_uid = sequence['software_instance_uid']
software_type = sequence.get('software_type', 'requested_reference')
requested_partition_reference = sequence.get('software_type', 'requested_reference')
tag = "%s_%s_%s_inProgress" % (software_instance_uid,
software_type, requested_partition_reference)
self.assertNotEqual(0, self.portal.portal_activities.
countMessageWithTag(tag))
def test_update_not_created_request_in_progress(self):
self.computer_partition_amount = 2
sequence_list = SequenceList()
sequence_string = self\
.prepare_install_requested_computer_partition_sequence_string + """
SlapLoginCurrentSoftwareInstance
RequestComputerPartition
SlapLogout
LoginDefaultUser
CheckActivityRequestInProgress
Logout
LoginTestVifibCustomer
RequestSoftwareInstanceUpdate
Tic
Logout
LoginDefaultUser
CheckComputerPartitionNoInstanceUpdateSalePackingList
Logout
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def stepCheckActivityPersonRequestInProgress(self, sequence, **kw):
person_uid = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(
'test_vifib_customer').getUid()
software_type = sequence.get('software_type', 'RootSoftwareInstance')
software_title = sequence['root_software_instance_title']
tag = "%s_%s_%s_inProgress" % (person_uid, software_type,
software_title)
self.assertNotEqual(0, self.portal.portal_activities.
countMessageWithTag(tag))
def stepPersonRequestSoftwareInstanceNoTic(self, sequence, **kw):
person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue()
software_release = self.portal.portal_catalog.getResultValue(
uid=sequence['software_release_uid'])
software_title = self.id() + str(random())
person.requestSoftwareInstance(
software_release=software_release.getUrlString(),
software_title=software_title,
instance_xml=self.minimal_correct_xml,
**kw)
sequence.edit(root_software_instance_title=software_title)
def test_update_not_created_person_request_in_progress(self):
sequence_list = SequenceList()
sequence_string = self.prepare_published_software_release + \
self.prepare_formated_computer + """
LoginTestVifibAdmin
RequestSoftwareInstallation
Tic
Logout
SlapLoginCurrentComputer
ComputerSoftwareReleaseAvailable
Tic
SlapLogout
LoginTestVifibCustomer
PersonRequestSoftwareInstanceNoTic
Logout
LoginDefaultUser
CheckActivityPersonRequestInProgress
Logout
# and this that test finishes
# it is proven that person data are begin in progress
# but there is no way to request software instance update as...
# ...it does not exists yet
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestVifibSlapComputerPartitionUpdate))
return suite
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