Commit f396d27f authored by Gabriel Monnerat's avatar Gabriel Monnerat Committed by Łukasz Nowak

Merge slave_instance_cleanup.

Work by Gabriel Monnerat.

The most important change: all requests are asynchronous and all are creating
Sale Orders.

Squashed commit of the following:

commit 4f59364ce970222ebd6e609c4cfc7837c92d05c5
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 22 10:42:04 2011 -0200

    invoke transaction before call alarm. With this, the alarm will be able to find the Sale Order ordered

commit f52291c24f26f3947dd59439ab3b0be70ef75a8e
Merge: ff0b621 06218fb1
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Dec 22 12:04:52 2011 +0100

    Merge branch 'master' into slave_instance_cleanup

    Conflicts:
    	master/bt5/vifib_slap/bt/revision

commit ff0b621d29f442f3ce709d64130b7b43721acb15
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 21 10:23:46 2011 -0200

    invoke transaction before call alarm. With this, the alarm will be able to find the Sale Order ordered

commit bf446dc95349385391fb337c95e3cd90ad901b85
Merge: b12096f 767ee613
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Dec 21 10:13:27 2011 +0100

    Merge remote-tracking branch 'origin/master' into slave_instance_cleanup

    Conflicts:
    	master/bt5/erp5_configurator_vifib/bt/revision
    	master/bt5/vifib_erp5/bt/revision
    	master/bt5/vifib_slap/bt/revision

commit b12096f202de55aa078f913b3019ee015989d2a1
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 20 11:51:37 2011 -0200

    refactor code to allow find packing list line with setup resource and fix the logic to give Auditor role in Hosting Subscription objects to Software Instance when the HOSTSUBS is related to Slave Instance

commit 5a051df52f899a5c0a167f1d7345d75c9c430f8e
Author: Cédric de Saint Martin <cedric.dsm@tiolive.com>
Date:   Mon Dec 19 17:18:09 2011 +0100

    Remove inexistent vifib_invoicing bt5 from configurator

    Conflicts:

    	master/bt5/erp5_configurator_vifib/bt/revision

commit fe730c3e4c321b736703d2f911c0dc27644adb4f
Author: Cédric de Saint Martin <cedric.dsm@tiolive.com>
Date:   Mon Dec 19 16:06:25 2011 +0100

    Add vifib_data_simulation BT to vifib configurator

    Conflicts:

    	master/bt5/erp5_configurator_vifib/bt/revision

commit 4276f1362bf18f9ed0328be11464260adc498cf0
Author: Cédric de Saint Martin <cedric.dsm@tiolive.com>
Date:   Mon Dec 19 14:19:48 2011 +0100

    Add missing dependency to vifib_erp5 BT5

    Conflicts:

    	master/bt5/vifib_erp5/bt/revision

commit a31d966e10da48749dae2d598477e108961ce89d
Merge: 84c02b2 cc169874
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Dec 19 10:57:06 2011 +0100

    Merge remote-tracking branch 'origin/master' into slave_instance_cleanup

    Conflicts:
    	master/bt5/vifib_slap/bt/revision

commit 84c02b2773e46b25409a108bb75b361ae74be65e
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Dec 16 13:59:55 2011 +0100

    Fix f9da7a498da04002795652c576e522417b933017.

    Keep usefull steps.

commit f9da7a498da04002795652c576e522417b933017
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Dec 16 12:03:03 2011 +0100

    Remove custom configuration.

    All configuration should be provided by the bt5

commit f8ec90fe555bb22e0a081e2d3dd019a5aa9ab371
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Dec 16 11:33:00 2011 +0100

    XML changes

commit 48461387048145868705aaf05cb5d794e19b38f2
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Dec 16 11:31:50 2011 +0100

    Instance only need view access on the sale trade condition module

commit 48769633651aaa6000751ee4c13f9b45fd8016c2
Merge: 85f9fdf ad0cac4e
Author: Romain Courteaud <romain@nexedi.com>
Date:   Fri Dec 16 09:46:17 2011 +0100

    Merge remote-tracking branch 'origin/master' into slave_instance_cleanup

commit 85f9fdfe84b91a26cbf5e2d189733e18d4dc196c
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Dec 15 17:51:39 2011 +0100

    Remove access on trade condition for instances.

commit 122854c08737bf85c3784f70573494585869191e
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Dec 15 17:48:26 2011 +0100

    Also export the portal type roles.

    It allows to be consistent with exported local roles.

commit 6df42f962af0d1c3aa0e4b61602b7bf8c6d8e3b9
Merge: e0af9e8 62908452
Author: Romain Courteaud <romain@nexedi.com>
Date:   Thu Dec 15 17:37:14 2011 +0100

    Merge remote-tracking branch 'origin/master' into slave_instance_cleanup

    Conflicts:
    	master/bt5/vifib_erp5/bt/revision
    	master/bt5/vifib_slap/bt/revision

commit e0af9e856d3af8d34afbb64576ff1097499a597a
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 15 12:58:04 2011 -0200

    remove parameter to sort because for this case is not relevant

commit 8efe2be5d5b2e3d0bd4e02128539104d9ff5a7ae
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Dec 15 14:42:08 2011 +0100

    Minimise diff.

commit 20a2efb131cf5626b7409e039d83fe5d8071f0a0
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Dec 15 14:37:12 2011 +0100

    Drop not needed step.

commit 3bda12f76c25e8e54a1a87dbdf4e7001ee78cc0b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Dec 15 14:11:40 2011 +0100

    Check that destroying slave does not affect partition.

commit 144ab1fc2e566400552526d7de24f9b5d592b31f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Dec 15 13:53:35 2011 +0100

    Minimise diff.

commit 2d4fd245725e1af820763166f29272c2e600cf09
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Dec 15 13:49:45 2011 +0100

    Minimise diff.

commit de9f6caba7df04f507385c9024442c39556faec4
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Dec 15 13:47:03 2011 +0100

    Minimise diff.

commit 4e8b995712456c11429d8fda7d70f5e100a95e04
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Dec 15 13:44:58 2011 +0100

    Drop half done refactoring.

commit 7fc01b34092148ee20ae895e707e75a7dc236a4e
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Dec 15 13:20:04 2011 +0100

    Revert "add steps used for the test added in d9d54601b44a43cbde59d46f6f6bbcf2daa3091a"

    This reverts commit 61ef0d448b07d21c260886ee93b596af27b4d301.

    d9d54601b44a43cbde59d46f6f6bbcf2daa3091a was dropped.

commit 80370d4ebb66a20b33f85e143721d56dfc8729da
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Dec 15 13:14:41 2011 +0100

    Revert "add test to check that requesting one Software Instance from another Software Instance that does not exists Sale Packing Lists related yet,  the second instance must be requested without raise exceptions"

    This reverts commit d9d54601b44a43cbde59d46f6f6bbcf2daa3091a.

    This test did not used slap library and was trying to do "impossible" things.
    Without calling registerComputerPartition (as instance was not prepared yet)
    it tried to request something. Of course such request will fail, and it is
    impossible to do it using slap library.

commit 73e703b6814c82bb5453c8e2e6e351771d178cb4
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Thu Dec 15 13:13:35 2011 +0100

    Revert "Use Sale Order Line to avoid the case when the Software Instance don't have Sale Packing List Line related. This test is to cover the test added in d9d54601b44a43cbde59d46f6f6bbcf2daa3091a"

    This reverts commit 27e6a10c10df9f52f965078cd5d56228fdb334cd.

    This software instance "does not exists yet". It is impossible to do register
    as not yet created (so without instance setup SPL) packing list.

    There is no need to support this case.

commit 843aa47e285f989e9ae17320e44e6c654857abce
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 15 09:47:09 2011 -0200

    remove steps because the for each step is duplicated. This steps have the same code of stepRequestSoftwareInstanceStop and stepRequestSoftwareInstanceStart

commit 7b86f1c64e7933154dcdbc6a8bcd2dd45c080f09
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 15 09:43:00 2011 -0200

    Remove trailing whitespaces

commit adc75060f7995299714d8a8306f8d3aecea64a94
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 15 09:10:18 2011 -0200

    invoke transactions to be possible the alarm find the Sale Order Line created when a Software Instance is requested

commit 0193242d5176fc3d67cbc18b521a720e5350d235
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 21:58:22 2011 -0200

    invoke transactions to be possible the alarm find the Sale Order Line created when a Software Instance is requested

commit 61ef0d448b07d21c260886ee93b596af27b4d301
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 21:10:02 2011 -0200

    add steps used for the test added in d9d54601b44a43cbde59d46f6f6bbcf2daa3091a

commit b511b59de07ddb720dda4a17dcd181bddbc223b9
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 21:05:07 2011 -0200

    refactor code to use portal_catalog instead of iterate over packing list

commit b37fdf4b86c4b6d836720b5c31529f929188e89f
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 18:36:11 2011 -0200

    pass a string instead of one list

commit 08e78b3cde9acecf7a627efef11373efba8d4b7d
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 17:21:30 2011 -0200

    fix code because service_uid is not passed inside one list anymore

commit 27e6a10c10df9f52f965078cd5d56228fdb334cd
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 15:25:27 2011 -0200

    Use Sale Order Line to avoid the case when the Software Instance don't have Sale Packing List Line related. This test is to cover the test added in d9d54601b44a43cbde59d46f6f6bbcf2daa3091a

commit d9d54601b44a43cbde59d46f6f6bbcf2daa3091a
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 15:16:19 2011 -0200

    add test to check that requesting one Software Instance from another Software Instance that does not exists Sale Packing Lists related yet,  the second instance must be requested without raise exceptions

commit f8bd366c9b6a10f6b7c2e7ada02897cf1c240457
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 12:20:15 2011 -0200

    invoke transactions to be possible the alarm find the Sale Order Line created when a Software Instance is requested

commit a6a5355fd4f98157668eec27cb7446b9cef63a2c
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 15:01:05 2011 -0200

    clean up the code because is not needed pass a list as parameter and the parameter query is not used anymore.

commit 638420ece76b047bbbdc32d155cc993a4ccf17ac
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Dec 14 15:51:24 2011 +0100

    Typo.

commit 43401199aacc9a7886c466c4e109bf611fc53412
Merge: 86b9146 da1186d4
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Dec 14 15:07:24 2011 +0100

    Merge remote-tracking branch 'origin/master' into slave_instance_cleanup

commit 86b914638148e4fda4729e671cc4f97509af68a1
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 11:49:04 2011 -0200

    Revert "Explain changed code on branch." because it is already done in 4c7f138906c49799c5638c95985215b6973c7725

    This reverts commit 94bc091ad7dc3e522ded12a6eb5b3b5c0c12c773.

commit 94bc091ad7dc3e522ded12a6eb5b3b5c0c12c773
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Wed Dec 14 14:29:26 2011 +0100

    Explain changed code on branch.

commit 4c7f138906c49799c5638c95985215b6973c7725
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 10:46:29 2011 -0200

    refactor step to check that the method serialize is called when one Computer Partition will be allocated when a Sale Order is confirmed. This step was changed because the Computer Partition is not allocated directly anymore

commit 4415751db23f286e661382097d2fff4d88aecf1c
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 14 01:55:48 2011 -0200

    don't call startRequested always. Call the right method according to the state

commit 29fa1363b1f07159a82451cced88fd1686a774c3
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 13 19:39:10 2011 -0200

    use variable that already exists instead of instantiate the same object many times

commit e990b832472729527e07db09f1447655093d6a5b
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 13 19:03:14 2011 -0200

    Clean up the code because the filtering should be inside the external methods and the methods are not configurable any more. Don't need pass the reference as parameter because it can get from context

commit 184677d91012d662cad028f4afeea7f32efc4587
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 13 18:54:34 2011 -0200

    extend code to get all Slave Instances related to the current Software Instance according to the Computer Partition that the Software Instance is installed

commit e08c39f6aebbb14792e894aad8e6be042577495f
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Dec 13 18:48:50 2011 +0100

    Revert "refactor code to allow pass parameters to the search inside the function. The goals filter the search, improve the perfomance and don't allow extract Slave Instances that should not be destroyed"

    This reverts commit 1955c97279f8be379f5138c90652b483cb4c129b.

    This is not the correct way.

    Security related method shall not accept parameters, and do everything on its
    own.

    They shall be kept simple and do only one operation, instead of begin to
    extensible.

commit c4025ae7e5f22b2796a92ba93fbf74d06d94aa91
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 13 15:36:59 2011 -0200

    Improve scripts which propagate the action to destroy Slave Instances related to the current Software Instance. With this, the search will be filtered to extract Slave Instances that is installed in the same Computer Partition only.

commit 1955c97279f8be379f5138c90652b483cb4c129b
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 13 15:31:26 2011 -0200

    refactor code to allow pass parameters to the search inside the function. The goals filter the search, improve the perfomance and don't allow extract Slave Instances that should not be destroyed

commit 9567de10346ffb042676ba10de750d4f51c5bb74
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 13 15:27:00 2011 -0200

    Add test to prove that when is request to destroy a Software Instance, only the Slave Instances related to this Software Instance is destroyed

commit 476cfe5f1450784122071154c4df0293a0c4bb06
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 13 12:44:59 2011 -0200

    invoke transacion before request destroy the software instance

commit e14c3985a8c9bf47f9dacabe8007edffa7768fd8
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Dec 13 14:44:28 2011 +0100

    Revert "add interaction to deliver all hosting packing list created"

    This reverts commit 5bfb811f5175dcf2e42b0981e3fad2c093bde3ec.

    This commit was incorrect, as it changed test assumptions without checking for
    real problem.

commit 4ccaa3fc8efa042a1416ade0fb777b312480de06
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Dec 13 14:44:03 2011 +0100

    Revert "add step to deliver one hosting packing list."

    This reverts commit 62bccba9e79b45a293a663c7d991c17651e7eb73.

    This commit was incorrect, as it changed test assumptions without checking for
    real problem.

commit a3b93e5979f5fd05fd9279fa3335b6659fa3556c
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Dec 13 14:43:25 2011 +0100

    Revert "refactor code to start all instances created. This function was called to deliver all hosting packing list. With this, a empty list will be returned when getComputerPartitionList is called to check if not exists modification to computer partition"

    This reverts commit 86b65424ca069dd6fc1248ca5011d0766a5b947b.

    This commit was incorrect, as it changed test assumptions without checking for
    real problem.

commit 78297b4e907467b4785cea868721fb8d9d31e441
Merge: 96e922a ab2bd41e
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Tue Dec 13 13:33:10 2011 +0100

    Merge remote-tracking branch 'origin/master' into slave_instance_cleanup

    Conflicts:
    	master/bt5/erp5_configurator_vifib/bt/revision
    	master/bt5/vifib_erp5/LocalRolesTemplateItem/sale_trade_condition_module.xml
    	master/bt5/vifib_erp5/PortalTypeRolesTemplateItem/Sale%20Trade%20Condition%20Module.xml
    	master/bt5/vifib_erp5/bt/revision

commit 96e922a7a416a0804c3d756e320c3df28f5b05f9
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 13 01:59:44 2011 -0200

    refactor code to don't request destroy for the same Slave Instance twice.

commit b0e28d9fbf0f636d08f79f422b7bbe901eda7955
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 13 00:40:02 2011 -0200

    refactor code to call destroy method before destroy the current Software Instance

commit ae6484067fb990a48c5aff43874fdc2ccbffc8e6
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 13 00:38:15 2011 -0200

    restore the original user before destroy each Slave Instance

commit f5f0dc9cf33a6cc4730b21e8df20a94bbbeb0dda
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 12 14:58:32 2011 -0200

    invoke transaction before call alarm

commit 05c28c1a62aa06e2f61ec1b9dda6757785a38166
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Dec 12 17:58:19 2011 +0100

    Partially revert revertion.

    Luke read the title instead of code, that's why he asked to revert ff4e7fc4068a9e80c7335449ae83909dade36911

    This will re-add roles on Slaves, which allow provider to do operations on them.

commit 701290e9112005c78b51e5182ef25b5f88de7da0
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 12 13:44:05 2011 -0200

    add external methods to call functions inside VifibSecurity to destroy Slave Instance related to Software Instance

commit 2cbeb6993b52cdee8b2cdfe6d9c0b5190e6e9843
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 12 13:38:41 2011 -0200

    remove interaction because to destroy the Slave Instance should use external method because in this case the user don't have permission to destroy instances created by different users

commit aa55ac4ee64e74e73a1fd4821ea4a0cecb3dae60
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 12 13:36:10 2011 -0200

    add functions to destroy the Slave Instances related to the Software Instance that  was requested destroy

commit ad1b337edf1282217e929669acfc62f3a090d5bf
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 12 13:35:07 2011 -0200

    extend code to propate the destroy methods to Slave Instance related

commit 5e95b523da2b4b74fe3ae19c28723031bb8af21a
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Dec 12 16:21:38 2011 +0100

    Revert "add test to check that one Software Instance can view and access one Slave Instance on the same tree"

    This reverts commit 99d861b6e7bce745732ef8c07377768c8663932e.

    This case is covered by test test_ComputerPartition_request_SlaveInstance_twiceDifferentParent

commit d9845cd3baf04e134557bf2f1fe53a4079ecfd3b
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Dec 12 15:35:45 2011 +0100

    Avoid code duplication.

commit 49e8d8060f4aca5147582416e46ed94c67f5db2d
Author: Łukasz Nowak <luke@nexedi.com>
Date:   Mon Dec 12 15:28:00 2011 +0100

    Fix typo.

commit e408577227bb0ee36a411ee9b13541b92ef21bed
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 12 11:34:03 2011 -0200

    fix my mistake during the merge

commit 5934da2604879b8dcb1debf77ffc5f472cf2a2c8
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 12 11:27:03 2011 -0200

    merge master into slave_instance_cleanup

commit 7a158c4cce6b088ad277f1ea08292389be9df477
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 12 11:23:30 2011 -0200

    change role to give Assignor role to reflect the same role configuration to Software Instance object

commit ff4e7fc4068a9e80c7335449ae83909dade36911
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 12 11:20:52 2011 -0200

    remove redudant role. The same role is given by relation with Hosting Subcription

commit b6d8c2320ee403ae19b99f37f6059c90e6839d58
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Sun Dec 11 23:38:55 2011 -0200

    add role to give Assignee permission to users with the same Hosting Subscription

commit 99d861b6e7bce745732ef8c07377768c8663932e
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Sun Dec 11 23:34:05 2011 -0200

    add test to check that one Software Instance can view and access one Slave Instance on the same tree

commit 6ff33fea3c73a07d450aba0b40ac7f51cc71f3b1
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 8 17:00:45 2011 -0200

    don't need load the object, the relative_url from Sale Trade Condition is enough.

commit c5febf0deb56a31c433d0926c9a7c10ea9f479a9
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 8 16:41:55 2011 -0200

    add role to give view permission to Software Instance users into Sale Trade Condition Module

commit 1faa108361aea73c8802cdc0df29cec89a32c697
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 8 10:25:46 2011 -0200

    merge master into slave_instance_cleanup

commit fd38e013500e687a529f8ff324ec74f00d6c5b46
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 7 23:30:48 2011 -0200

    add test to check that requesting a Slave Instance twice with same arguments from different Computer Partition will return same object.

commit 2f55ccfef62790707953f5578307562477025f3f
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 5 16:27:50 2011 -0200

    Add action to create one Sale Packing List with update resource when the Slave Instance is changed. For example, when the same Slave Instance is requested again but with different parameters.

commit 36c8878359d8ebb4664946cabc5ffa005da102a4
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 7 01:42:09 2011 -0200

    remove useless steps

commit 5bfb811f5175dcf2e42b0981e3fad2c093bde3ec
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 7 01:41:47 2011 -0200

    add interaction to deliver all hosting packing list created

commit 62bccba9e79b45a293a663c7d991c17651e7eb73
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 7 01:07:07 2011 -0200

    add step to deliver one hosting packing list.

commit f5b167a8251311e46060a3bdc67818a501749dd9
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Dec 7 00:59:40 2011 -0200

    move step to confirm the Sale Order ordered after request the software instance because inside the step FinishSoftwareInstancePartlyDestroyedTree is needed create the setup packing list before request to destroy the Software Instance created

commit ed5fc18b2224df1f0012a9aa9024ba3bb0646af6
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 6 17:23:48 2011 -0200

    refactor steps because NotFoundError is not raised anymore when a Slave Instance is requested. With this, another steps were used to prove the scenario expected by the test

commit 0edb8e1d1661e1748e92063ab481aaa8a6115530
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 6 17:22:51 2011 -0200

    add step to select the last Slave Instance created and validate if one exception will be raised if the sale order created try select one computer partition

commit bbd21c07e6cf9ac0c441e9ff17a3fda50892cc02
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 6 17:21:05 2011 -0200

    add step to select a slave instance that was created but not exist one packing list related for this instance yet

commit 86b65424ca069dd6fc1248ca5011d0766a5b947b
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 6 17:19:59 2011 -0200

    refactor code to start all instances created. This function was called to deliver all hosting packing list. With this, a empty list will be returned when getComputerPartitionList is called to check if not exists modification to computer partition

commit 7eccb68622083bbd08604fb487504dd483b7a358
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Dec 6 16:24:19 2011 -0200

    refactor steps because NotFoundError is not raised anymore when a Slave Instance is requested. With this, another steps were used to prove the scenario expected by the test

commit 24996c872ac431b6f8c191d83951a4710c334211
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 5 17:13:10 2011 -0200

    extend code to allow find update packing lists with state confirmed. With this, if one Slave Instance is changed, it will force the modification for the Computer Partition where the instance is installed

commit 7c1a2bab8c118c946e5f39b3e5b4a706281a0485
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 5 17:04:51 2011 -0200

    remove argument to sort the query because in this return one search sorted is not relevent and increase the time of search without need

commit 1b2258cb1fdf6216ed635a224ba3117553fb7547
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 5 17:00:22 2011 -0200

    clean up the code to remove duplicated arguments for the query

commit b3764d1b3aa84b5b878b97c4057dae22c2d974af
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 5 16:53:52 2011 -0200

    add test to check that requesting to change the parameter dict of a Slave Instance, one update packing list will be created correctly

commit 3db2dc64a44160ee313fd97f8790448f6aff87be
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Dec 5 16:51:48 2011 -0200

    move step to be used by another test cases

commit 913c78e711db0a00d6a56d3af0422b503f367171
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 1 21:10:02 2011 -0200

    add steps to confirm Sale Orders ordered

commit 38857175d66976d15ce310aa9e755bd2e47e38ad
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 1 18:01:23 2011 -0200

    add step to confirm Sale Orders ordered

commit a954857eca7723cc28547386edb95a3df201bdb4
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 1 16:46:28 2011 -0200

    change user to call the alarm to confirm the Sale Orders created. This steps were add because when you request a new instance from one computer partition, one Sale Order is created instead of one Sale Packing List directly

commit 493b521594e89c73d95a8c45449b8443bcc3570a
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 1 16:31:33 2011 -0200

    merge master into slave_instance_cleanup branch

commit 56a2e2f89588d3b2c85ea187ba57f3e048daf9d0
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 1 16:21:02 2011 -0200

    add step to confirm Sale Orders ordered

commit e4dc934cfe069313e6164574d9ad99509ceb7980
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Dec 1 15:39:46 2011 -0200

    add step to confirm Sale Orders ordered

commit 22d76dd5ad336cb51d32536a56ca5565115dcb2d
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Nov 29 19:04:06 2011 -0200

    add step to call alarm to confirm the sale order ordered

commit 9def587ee82d9264077650f0e101ae4e7c0f3283
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Nov 29 14:53:27 2011 -0200

    add step to call alarm to confirm the sale order ordered

commit 0311ad2e47109848037214df8d97be8b5f59e65f
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Nov 28 21:55:44 2011 -0200

    add step to confirm Sale Orders ordered

commit b8af24a09ae1997a8b118d9e85c2bb452fdaec05
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Nov 28 21:55:03 2011 -0200

    change step name because the exception NotFound is not raised anymore

commit bcc475a220ae57fda09480e6c23cca48b972e195
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Nov 28 20:17:07 2011 -0200

    add step to confirm Sale Orders ordered

commit 3ff48b0bbd90dbcfa4f57fae30119d1aab55cd7d
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Nov 28 20:16:00 2011 -0200

    change step name because the exception NotFound is not raised anymore

commit 97e3c03657929d92ccf65664c774fc2e2a50cbe4
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Nov 24 12:15:25 2011 -0200

    add more steps to call the alarm to confirm the Sale Order created

commit a8bb885c03f061bb5b89a3339f64d9512135aeb1
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Nov 24 11:13:48 2011 -0200

    add more steps to call the alarm to confirm the Sale Order created

commit 7e1124b3cfc306e6be60b5043e67645b92ba3a65
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Nov 24 10:53:54 2011 -0200

    add steps to call the alarm to confirm the Sale Order created

commit 14d916c1b505c35900f56c224f7e71836da0b65a
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Nov 23 16:44:54 2011 -0200

    add step to call the alarm to confirm the sale orders created. This is needed because the script SoftwareInstance_requestSoftwareInstance was changed to create a Sale Order instead of create a new Sale Packing List directly

commit c6fc401de8f489232f736aee4bf62a6dc80d366d
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Nov 23 15:49:22 2011 -0200

    missing update the local roles file to Sale Order Module. This changes should be pushed with a0cb47ba2502bb18b4be576010a009d314f563f6

commit d4e0d6d26bde2dab64099271561e0fb39fb6973b
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Nov 22 16:45:29 2011 -0200

    No need create a new Open Order Line. Open Order Line is created for the root instance of the tree only

commit 7e120a350c5d511267abc611c1875c7702b18091
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Nov 22 15:01:49 2011 -0200

    use the same trade condition used to create a Sale Packing List to create a new Sale Order

commit 20d245b01801e4ccdc01c38f584c2feb8c2b4349
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Nov 21 17:50:53 2011 -0200

    add condition to check if exists activities related to the Slave Instance, if exists it means that the requestDestroy was already called for this object

commit 52a22bd906e2eecc635b8ab90fbce34c401eda40
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Nov 21 17:26:36 2011 -0200

    Add test to check that destroying the Software Instance after request destroy a Slave Instance, the request to destroy the Software Instance will not raise exception

commit 44f8eeb18977be1ae109630e2538982e32c75769
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Nov 21 16:16:56 2011 -0200

    add test to check that one Slave Instance is destroyed when one Software Instance is destroyed and the owner users are different

commit 151452565c755afbb1d43b008d1c12d80c6b5396
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Nov 21 16:12:00 2011 -0200

    refactor test to check if the Slave Instance is destroying using the same user

commit 93cd0c435cee8243c0f902b53b0caf48310e3315
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Nov 21 15:29:05 2011 -0200

    Give role as Author to Instance users(i.e Software Instance) to allow create Sale Orders inside Sale Order Module

commit a0cb47ba2502bb18b4be576010a009d314f563f6
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Nov 21 14:04:05 2011 -0200

    remove script and transition because this transition is not used anymore by SoftwareInstance_requestSoftwareInstance.

commit 72c39df815d4ca36a35074830d359df0693fc356
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Mon Nov 21 14:02:20 2011 -0200

    extend the code to create one Sale Order instead of Sale Packing List. The goals of create a new Sale Order is to the client don't get NotFound error. With this change, the request will be processed after the alarm

commit 66baee25f1189e500a96fb4fa58612fb237ee674
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Nov 17 18:41:09 2011 +0100

    Revert b3ef8a366ff8d7ed965777d3f2a7978565eacd19. The id of the owner should not be added

commit 25c01c4dbbc2dcbb9c42635e0e446eecfe120726
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Nov 17 18:06:32 2011 +0100

    fix the role name. Should be Assignee instead of Auditor

commit 5abff87cb2f1b883df3d7c896aa8660f94ddc12f
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Nov 17 17:35:09 2011 +0100

    Add comments to be fixed in a clean way

commit b3ef8a366ff8d7ed965777d3f2a7978565eacd19
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Nov 17 17:31:09 2011 +0100

    add the id of software instance owner to give permission for this person

commit e60a12470a0c5ddb1151bd55f61dfd17972519e9
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Thu Nov 17 15:27:57 2011 +0100

    change parameter on the script ERP5Site_getSlaveInstanceListFromComputerPartition to be possible one list of resource instead of only one.

commit a962506d00e330ddfd1af3912dc1d3d4e35ada93
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Wed Nov 16 13:08:34 2011 +0100

    add test to check that one slave instance will be destroyed correctly when the context have 2 Slave Instances requested by different users

commit 2c1c27d81741dc2f33f5d4cfc6f2e69df42b8821
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Nov 15 18:11:25 2011 +0100

    fix test. The state of the Sale Packing List related to Slave Instance after destroy should be simulation_state == delivered and the resource == cleanup

commit ef1b196c0904ae97a3c0fa1ade16c2a5a4c6a673
Author: Gabriel Monnerat <gabriel@tiolive.com>
Date:   Tue Nov 15 18:04:18 2011 +0100

    change workflow interaction to destroy the Slave Instance when is requested to destroy the Software Instance related.
parent 06218fb1
22 24
\ No newline at end of file \ No newline at end of file
...@@ -50,20 +50,27 @@ ...@@ -50,20 +50,27 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <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 # 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 software_instance.destroyRequested()\n
# deliver proper packing list\n # deliver proper packing list\n
packing_list_line = context.SoftwareInstance_getInstanceDestroyPackingListLine(state_change)\n packing_list_line = context.SoftwareInstance_getInstanceDestroyPackingListLine(state_change)\n
\n
packing_list = packing_list_line.getParentValue()\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 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 packing_list.deliver()\n
\n \n
# revoke certificate\n # revoke certificate\n
try:\n try:\n
context.getPortalObject().portal_certificate_authority\\\n portal.portal_certificate_authority\\\n
.revokeCertificate(software_instance.getDestinationReference())\n .revokeCertificate(software_instance.getDestinationReference())\n
except ValueError:\n except ValueError:\n
# Ignore already revoked certificates, as OpenSSL backend is\n # Ignore already revoked certificates, as OpenSSL backend is\n
......
...@@ -63,6 +63,9 @@ service_relative_url = software_instance.portal_preferences.\\\n ...@@ -63,6 +63,9 @@ service_relative_url = software_instance.portal_preferences.\\\n
getPreferredInstanceCleanupResource()\n getPreferredInstanceCleanupResource()\n
sale_packing_list = context.SoftwareInstance_createSalePackingList(state_change, service_relative_url, tag=tag)\n sale_packing_list = context.SoftwareInstance_createSalePackingList(state_change, service_relative_url, tag=tag)\n
sale_packing_list.confirm(activate_kw={\'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> ]]></string> </value>
......
...@@ -121,13 +121,41 @@ if (request_software_instance is None):\n ...@@ -121,13 +121,41 @@ if (request_software_instance is None):\n
**portal.Base_getNewSoftwareInstanceCoordinate()\n **portal.Base_getNewSoftwareInstanceCoordinate()\n
)\n )\n
request_software_instance.portal_workflow.doActionFor(request_software_instance, \'validate_action\')\n request_software_instance.portal_workflow.doActionFor(request_software_instance, \'validate_action\')\n
sale_packing_list_line = context.SoftwareInstance_getInstanceSetupPackingListLine(state_change)\n if state == "started":\n
hosting_subscription_uid = sale_packing_list_line.getAggregateValue(portal_type=\'Hosting Subscription\').getUid()\n request_software_instance.startRequested()\n
request_software_instance.requestComputerPartition(\n if state == "stopped":\n
software_release=software_release_url_string,\n request_software_instance.stopRequested()\n
hosting_subscription_uid=hosting_subscription_uid,\n setup_service_relative_url = portal.portal_preferences.getPreferredInstanceSetupResource()\n
software_type=software_type,\n packing_list_line = software_instance.getAggregateRelatedValue(portal_type="Sale Packing List Line")\n
tag=tag)\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 else:\n
# Update existing software instance\n # Update existing software instance\n
# Sale Packing List interaction has to be requested automatically with an interaction workflow\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>
325 337
\ No newline at end of file \ No newline at end of file
...@@ -75,6 +75,71 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None, ...@@ -75,6 +75,71 @@ def SoftwareInstance_bangAsSelf(self, relative_url=None, reference=None,
# Restore the original user. # Restore the original user.
setSecurityManager(sm) 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, def getComputerSecurityCategory(self, base_category_list, user_name,
object, portal_type): object, portal_type):
""" """
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
</role> </role>
<role id='R-INSTANCE'> <role id='R-INSTANCE'>
<item>Auditor</item> <item>Auditor</item>
<item>Author</item>
</role> </role>
<role id='R-MEMBER'> <role id='R-MEMBER'>
<item>Auditor</item> <item>Auditor</item>
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
<item>Auditor</item> <item>Auditor</item>
<item>Author</item> <item>Author</item>
</role> </role>
<role id='R-INSTANCE'>
<item>Auditor</item>
</role>
<role id='R-MEMBER'> <role id='R-MEMBER'>
<item>Auditor</item> <item>Auditor</item>
<item>Author</item> <item>Author</item>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<multi_property id='category'>group/company</multi_property> <multi_property id='category'>group/company</multi_property>
<multi_property id='base_category'>group</multi_property> <multi_property id='base_category'>group</multi_property>
</role> </role>
<role id='Auditor'> <role id='Auditor; Author'>
<property id='title'>Instance</property> <property id='title'>Instance</property>
<multi_property id='category'>role/instance</multi_property> <multi_property id='category'>role/instance</multi_property>
<multi_property id='base_category'>role</multi_property> <multi_property id='base_category'>role</multi_property>
......
...@@ -4,6 +4,11 @@ ...@@ -4,6 +4,11 @@
<multi_property id='category'>group/company</multi_property> <multi_property id='category'>group/company</multi_property>
<multi_property id='base_category'>group</multi_property> <multi_property id='base_category'>group</multi_property>
</role> </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'> <role id='Auditor; Author'>
<property id='title'>Member</property> <property id='title'>Member</property>
<multi_property id='category'>role/member</multi_property> <multi_property id='category'>role/member</multi_property>
......
...@@ -15,9 +15,14 @@ ...@@ -15,9 +15,14 @@
<property id='base_category_script'>ERP5Type_acquireSecurityFromOwner</property> <property id='base_category_script'>ERP5Type_acquireSecurityFromOwner</property>
<multi_property id='base_category'>source</multi_property> <multi_property id='base_category'>source</multi_property>
</role> </role>
<role id='Assignee'> <role id='Assignor'>
<property id='title'>Slave Instance related by Software Instance</property> <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='Assignor'>
<property id='title'>Software Instance which provides this Slave Instance</property>
<property id='base_category_script'>ERP5Type_getSecurityCategoryFromSoftwareInstance</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> </role>
</type_roles> </type_roles>
\ No newline at end of file
...@@ -72,8 +72,11 @@ state_list = portal.getPortalCurrentInventoryStateList() + \\\n ...@@ -72,8 +72,11 @@ state_list = portal.getPortalCurrentInventoryStateList() + \\\n
portal.getPortalReservedInventoryStateList() + \\\n portal.getPortalReservedInventoryStateList() + \\\n
portal.getPortalTransitInventoryStateList()\n portal.getPortalTransitInventoryStateList()\n
\n \n
resource_list = [portal.portal_preferences.getPreferredInstanceSetupResource(),\n
portal.portal_preferences.getPreferredInstanceHostingResource()]\n
\n
sale_packing_list_line = portal.portal_catalog.getResultValue(\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 aggregate_uid=obj.getUid(),\n
portal_type="Sale Packing List Line",\n portal_type="Sale Packing List Line",\n
simulation_state=state_list)\n simulation_state=state_list)\n
...@@ -91,15 +94,28 @@ query = ComplexQuery(\n ...@@ -91,15 +94,28 @@ query = ComplexQuery(\n
Query(aggregate_relative_url=software_release.getRelativeUrl()),\n Query(aggregate_relative_url=software_release.getRelativeUrl()),\n
operator="AND",\n operator="AND",\n
)\n )\n
\n
catalog_result = portal.portal_catalog(portal_type="Sale Packing List Line",\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 simulation_state=state_list,\n
aggregate_relative_url=query,\n limit=1,\n
query=query,\n
)\n )\n
for sale_packing_list_line in catalog_result:\n \n
software_instance = sale_packing_list_line.getAggregateValue(\n if len(catalog_result) == 0:\n
portal_type="Software Instance")\n return catalog_result\n
if software_instance is not None:\n \n
return {"Auditor": [software_instance.getReference(),]}\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
return {"Auditor": [software_instance.getReference(),]}\n
\n \n
return category_list\n return category_list\n
</string> </value> </string> </value>
......
...@@ -89,7 +89,7 @@ catalog_result = portal.portal_catalog(portal_type=movement_portal_type,\n ...@@ -89,7 +89,7 @@ catalog_result = portal.portal_catalog(portal_type=movement_portal_type,\n
for item in catalog_result:\n for item in catalog_result:\n
software_instance = item.getAggregateValue(portal_type="Software Instance")\n software_instance = item.getAggregateValue(portal_type="Software Instance")\n
if software_instance is not None:\n if software_instance is not None:\n
return {"Assignee": [software_instance.getReference(),]}\n return [{"aggregate": [software_instance.getRelativeUrl()]}]\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>SoftwareInstance_destroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>VifibSecurity</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareInstance_destroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>SoftwareInstance_requestDestroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>VifibSecurity</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SoftwareInstance_requestDestroySlaveInstanceRelated</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <value>
<list> <list>
<string>SoftwareInstance_requestStopSlaveInstanceListFromComputerPartition</string> <string>SlaveInstance_requestUpdate</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -45,30 +45,32 @@ ...@@ -45,30 +45,32 @@
<item> <item>
<key> <string>guard</string> </key> <key> <string>guard</string> </key>
<value> <value>
<none/> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SoftwareInstance_destroy</string> </value> <value> <string>SlaveInstance_requestUpdateOnChange</string> </value>
</item> </item>
<item> <item>
<key> <string>method_id</string> </key> <key> <string>method_id</string> </key>
<value> <value>
<list> <list>
<string>destroyComputerPartition</string> <string>_setTitle</string>
<string>_setSourceReference</string>
<string>_setTextContent</string>
</list> </list>
</value> </value>
</item> </item>
<item> <item>
<key> <string>once_per_transaction</string> </key> <key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>portal_type_filter</string> </key> <key> <string>portal_type_filter</string> </key>
<value> <value>
<list> <list>
<string>Software Instance</string> <string>Slave Instance</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -80,7 +82,7 @@ ...@@ -80,7 +82,7 @@
</item> </item>
<item> <item>
<key> <string>temporary_document_disallowed</string> </key> <key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value> <value> <int>0</int> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
...@@ -93,4 +95,32 @@ ...@@ -93,4 +95,32 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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> </ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</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>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<list>
<string>SoftwareInstance_requestStopSlaveInstanceListFromComputerPartition</string>
</list>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<tuple/>
</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>SoftwareInstance_requestDestroy</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>requestDestroyComputerPartition</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Software Instance</string>
</list>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -75,7 +75,6 @@ query = ComplexQuery(computer_partition_query, \n ...@@ -75,7 +75,6 @@ query = ComplexQuery(computer_partition_query, \n
\n \n
return portal.portal_catalog(portal_type=\'Sale Packing List Line\',\n return portal.portal_catalog(portal_type=\'Sale Packing List Line\',\n
default_resource_uid=service_uid_list,\n default_resource_uid=service_uid_list,\n
sort_on=((\'movement.start_date\', \'DESC\'),),\n
query=query, **kw)\n query=query, **kw)\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -75,7 +75,7 @@ else:\n ...@@ -75,7 +75,7 @@ else:\n
\n \n
# Deliver all SPL related to this software instance\n # Deliver all SPL related to this software instance\n
isTransitionPossible = context.portal_workflow.isTransitionPossible\n isTransitionPossible = context.portal_workflow.isTransitionPossible\n
software_instance = current_delivery_line.getAggregateValue(portal_type="Software Instance")\n software_instance = current_delivery_line.getAggregateValue(portal_type=["Software Instance", "Slave Instance"])\n
for sale_packing_list_line in portal.portal_catalog(\n for sale_packing_list_line in portal.portal_catalog(\n
portal_type="Sale Packing List Line", \n portal_type="Sale Packing List Line", \n
default_aggregate_uid=software_instance.getUid(),\n default_aggregate_uid=software_instance.getUid(),\n
......
...@@ -50,63 +50,13 @@ ...@@ -50,63 +50,13 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from DateTime import DateTime\n <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 \n
portal = context.getPortalObject()\n if len(portal.portal_catalog(**count_result_kw)) == 1:\n
software_instance = state_change[\'object\']\n state_change[\'object\'].requestUpdateComputerPartition()\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> </string> </value>
</item> </item>
<item> <item>
...@@ -115,7 +65,7 @@ sale_packing_list.confirm()\n ...@@ -115,7 +65,7 @@ sale_packing_list.confirm()\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>SoftwareInstance_requestComputerPartition</string> </value> <value> <string>SlaveInstance_requestUpdate</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
484 485
\ No newline at end of file \ No newline at end of file
...@@ -536,28 +536,34 @@ class SlapTool(BaseTool): ...@@ -536,28 +536,34 @@ class SlapTool(BaseTool):
setup_service = portal.restrictedTraverse( setup_service = portal.restrictedTraverse(
portal_preferences.getPreferredInstanceSetupResource()) portal_preferences.getPreferredInstanceSetupResource())
hosting_query = ComplexQuery(Query(aggregate_portal_type="Slave Instance"), update_service = portal.restrictedTraverse(
Query(aggregate_relative_url=computer_partition_document.getRelativeUrl()), portal_preferences.getPreferredInstanceUpdateResource())
# Search only for Confirmed and Stopped, the only one states that require
# buildout be re-updated. global_query_kw = dict(aggregate_portal_type="Slave Instance",
Query(simulation_state=["confirmed", "stopped"]), aggregate_relative_url=computer_partition_document.getRelativeUrl(),)
hosting_query = ComplexQuery(Query(simulation_state=["confirmed", "stopped"]),
Query(default_resource_uid=hosting_service.getUid()), Query(default_resource_uid=hosting_service.getUid()),
operator="AND") operator="AND")
setup_query = ComplexQuery(Query(aggregate_portal_type="Slave Instance"), setup_query = ComplexQuery(Query(simulation_state=["confirmed", "started"]),
Query(aggregate_relative_url=computer_partition_document.getRelativeUrl()),
Query(simulation_state=["confirmed", "started"]),
Query(default_resource_uid=setup_service.getUid()), Query(default_resource_uid=setup_service.getUid()),
operator="AND") 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 # Use getTrackingList
catalog_result = portal.portal_catalog( catalog_result = portal.portal_catalog(
portal_type='Sale Packing List Line', portal_type='Sale Packing List Line',
sort_on=(('movement.start_date', 'DESC'),),
limit=1, limit=1,
query=query) query=query, **global_query_kw)
return len(catalog_result) return len(catalog_result)
......
...@@ -481,6 +481,8 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): ...@@ -481,6 +481,8 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
SlapLogout SlapLogout
LoginDefaultUser LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSoftwareInstanceAndRelatedComputerPartition CheckSoftwareInstanceAndRelatedComputerPartition
CheckRequestedSoftwareInstanceAndRelatedComputerPartition CheckRequestedSoftwareInstanceAndRelatedComputerPartition
Logout Logout
...@@ -528,7 +530,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): ...@@ -528,7 +530,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# now this computer patrition request new one # now this computer patrition request new one
SlapLoginCurrentSoftwareInstance SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse RequestComputerPartition
SlapLogout SlapLogout
""" """
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -610,7 +612,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): ...@@ -610,7 +612,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# now this computer patrition request new one # now this computer patrition request new one
SlapLoginCurrentSoftwareInstance SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse RequestComputerPartition
SlapLogout SlapLogout
# now vifib_admin computer partition request new one and suceeds # now vifib_admin computer partition request new one and suceeds
...@@ -624,6 +626,8 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): ...@@ -624,6 +626,8 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
SlapLogout SlapLogout
LoginDefaultUser LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
CheckSoftwareInstanceAndRelatedComputerPartition CheckSoftwareInstanceAndRelatedComputerPartition
CheckRequestedSoftwareInstanceAndRelatedComputerPartition CheckRequestedSoftwareInstanceAndRelatedComputerPartition
Logout Logout
...@@ -671,7 +675,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): ...@@ -671,7 +675,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# now this computer patrition request new one # now this computer patrition request new one
SlapLoginCurrentSoftwareInstance SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse RequestComputerPartition
SlapLogout SlapLogout
""" """
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -711,7 +715,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): ...@@ -711,7 +715,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin):
# now this computer patrition request new one # now this computer patrition request new one
SlapLoginCurrentSoftwareInstance SlapLoginCurrentSoftwareInstance
RequestComputerPartitionNotFoundResponse RequestComputerPartition
SlapLogout SlapLogout
""" """
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
......
...@@ -25,18 +25,22 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -25,18 +25,22 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
root_software_instance.requestSoftwareInstance(partition_reference=S1, root_software_instance.requestSoftwareInstance(partition_reference=S1,
**common_kw) **common_kw)
self.stepTic() self.stepTic()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
S1_instance = self.portal.portal_catalog.getResultValue( S1_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=S1) portal_type='Software Instance', title=S1)
S1_instance.requestSoftwareInstance(partition_reference=S2, **common_kw) S1_instance.requestSoftwareInstance(partition_reference=S2, **common_kw)
self.stepTic() self.stepTic()
S1_instance.requestSoftwareInstance(partition_reference=S3, **common_kw) S1_instance.requestSoftwareInstance(partition_reference=S3, **common_kw)
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic() self.stepTic()
root_software_instance.requestSoftwareInstance(partition_reference=S4, root_software_instance.requestSoftwareInstance(partition_reference=S4,
**common_kw) **common_kw)
self.stepTic() self.stepTic()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
S2_instance = self.portal.portal_catalog.getResultValue( S2_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=S2) portal_type='Software Instance', title=S2)
...@@ -141,7 +145,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -141,7 +145,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
LoginDefaultUser LoginDefaultUser
FinishSoftwareInstanceTree FinishSoftwareInstanceTree
Logout Logout
SlapLoginCurrentComputer SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall CheckEmptyComputerGetComputerPartitionCall
SlapLogout SlapLogout
...@@ -363,7 +366,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -363,7 +366,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
software_type='any', instance_xml=self.minimal_correct_xml, software_type='any', instance_xml=self.minimal_correct_xml,
state='stopped') state='stopped')
self.logout() self.logout()
self.login(sequence['software_instance_reference']) self.login(sequence['software_instance_reference'])
root_software_instance.requestSoftwareInstance( root_software_instance.requestSoftwareInstance(
partition_reference=S1, partition_reference=S1,
...@@ -373,6 +375,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -373,6 +375,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
</instance>""" % sequence['computer_reference_c1'], </instance>""" % sequence['computer_reference_c1'],
**common_kw) **common_kw)
self.stepTic() self.stepTic()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
self.logout() self.logout()
self.stepLoginDefaultUser() self.stepLoginDefaultUser()
...@@ -380,7 +384,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -380,7 +384,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
portal_type='Software Instance', title=S1) portal_type='Software Instance', title=S1)
S1_reference = S1_instance.getReference() S1_reference = S1_instance.getReference()
self.logout() self.logout()
self.login(S1_reference) self.login(S1_reference)
S1_instance.requestSoftwareInstance( S1_instance.requestSoftwareInstance(
partition_reference=S2, partition_reference=S2,
...@@ -390,6 +393,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -390,6 +393,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
</instance>""" % sequence['computer_reference_c0'], </instance>""" % sequence['computer_reference_c0'],
**common_kw) **common_kw)
self.stepTic() self.stepTic()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
self.logout() self.logout()
self.stepLoginDefaultUser() self.stepLoginDefaultUser()
...@@ -410,6 +415,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -410,6 +415,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
self.logout() self.logout()
self.stepLoginDefaultUser() self.stepLoginDefaultUser()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
S3_instance = self.portal.portal_catalog.getResultValue( S3_instance = self.portal.portal_catalog.getResultValue(
portal_type='Software Instance', title=S3) portal_type='Software Instance', title=S3)
S3_reference = S3_instance.getReference() S3_reference = S3_instance.getReference()
...@@ -550,6 +557,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -550,6 +557,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
FinishSoftwareInstanceSpannedTree FinishSoftwareInstanceSpannedTree
Tic
SlapLoginCurrentComputer SlapLoginCurrentComputer
CheckEmptyComputerGetComputerPartitionCall CheckEmptyComputerGetComputerPartitionCall
ComputerBang ComputerBang
...@@ -631,6 +639,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): ...@@ -631,6 +639,8 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin):
partition_reference=S1, partition_reference=S1,
**common_kw) **common_kw)
self.stepTic() self.stepTic()
self.stepConfirmOrderedSaleOrderActiveSense()
self.stepTic()
self.logout() self.logout()
self.stepLoginDefaultUser() self.stepLoginDefaultUser()
......
...@@ -349,7 +349,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -349,7 +349,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition RequestComputerPartition
Tic Tic
CheckRaisesNotFoundComputerPartitionParameterDict CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic Tic
SlapLoginCurrentSoftwareInstance
RequestComputerPartition RequestComputerPartition
Tic Tic
SlapLogout SlapLogout
...@@ -738,7 +741,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -738,7 +741,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition RequestComputerPartition
Tic Tic
CheckRaisesNotFoundComputerPartitionParameterDict CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic Tic
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartition RequestComputerPartition
Tic Tic
SlapLogout SlapLogout
...@@ -764,6 +771,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -764,6 +771,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition RequestComputerPartition
Tic Tic
CheckRaisesNotFoundComputerPartitionParameterDict CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentSoftwareInstance
Tic Tic
RequestComputerPartition RequestComputerPartition
Tic Tic
...@@ -888,7 +900,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -888,7 +900,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition RequestComputerPartition
Tic Tic
CheckRaisesNotFoundComputerPartitionParameterDict CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic Tic
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartition RequestComputerPartition
Tic Tic
SlapLogout SlapLogout
...@@ -914,7 +930,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -914,7 +930,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition RequestComputerPartition
Tic Tic
CheckRaisesNotFoundComputerPartitionParameterDict CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic Tic
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartition RequestComputerPartition
Tic Tic
SlapLogout SlapLogout
...@@ -1048,7 +1068,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -1048,7 +1068,11 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestComputerPartition RequestComputerPartition
Tic Tic
CheckRaisesNotFoundComputerPartitionParameterDict CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic Tic
Logout
SlapLoginCurrentSoftwareInstance
RequestComputerPartition RequestComputerPartition
Tic Tic
SlapLogout SlapLogout
...@@ -1344,7 +1368,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): ...@@ -1344,7 +1368,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin):
RequestSlaveInstanceFromComputerPartition RequestSlaveInstanceFromComputerPartition
Tic Tic
SlapLogout SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentSoftwareInstance SlapLoginCurrentSoftwareInstance
SoftwareInstanceAvailable SoftwareInstanceAvailable
Tic Tic
......
...@@ -340,7 +340,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin ...@@ -340,7 +340,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin
SlapLogout \ SlapLogout \
\ \
LoginTestVifibCustomer \ LoginTestVifibCustomer \
RequestSlaveInstanceStop \ RequestSoftwareInstanceStop \
Tic \ Tic \
Logout \ Logout \
\ \
......
...@@ -10,12 +10,6 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): ...@@ -10,12 +10,6 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin):
self.portal.portal_catalog.getResultValue( self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid']).requestUpdateComputerPartition() uid=sequence['software_instance_uid']).requestUpdateComputerPartition()
def stepCheckComputerPartitionInstanceUpdateSalePackingListConfirmed(self,
sequence, **kw):
self._checkComputerPartitionSalePackingListState('confirmed',
self.portal.portal_preferences.getPreferredInstanceUpdateResource(),
sequence)
def stepCheckComputerPartitionInstanceUpdateSalePackingListDelivered(self, def stepCheckComputerPartitionInstanceUpdateSalePackingListDelivered(self,
sequence, **kw): sequence, **kw):
self._checkComputerPartitionSalePackingListState('delivered', self._checkComputerPartitionSalePackingListState('delivered',
......
...@@ -332,6 +332,12 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -332,6 +332,12 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
self.portal.portal_preferences.getPreferredInstanceCleanupResource(), self.portal.portal_preferences.getPreferredInstanceCleanupResource(),
sequence) sequence)
def stepCheckComputerPartitionInstanceUpdateSalePackingListConfirmed(self,
sequence, **kw):
self._checkComputerPartitionSalePackingListState('confirmed',
self.portal.portal_preferences.getPreferredInstanceUpdateResource(),
sequence)
def stepCheckComputerPartitionInstanceCleanupSalePackingListCancelled(self, def stepCheckComputerPartitionInstanceCleanupSalePackingListCancelled(self,
sequence, **kw): sequence, **kw):
self._checkComputerPartitionSalePackingListState('cancelled', self._checkComputerPartitionSalePackingListState('cancelled',
...@@ -1080,7 +1086,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1080,7 +1086,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
RequestComputerPartition RequestComputerPartition
Tic Tic
CheckRaisesNotFoundComputerPartitionParameterDict \ CheckRaisesNotFoundComputerPartitionParameterDict \
Tic \ LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
RequestComputerPartition \ RequestComputerPartition \
Tic \ Tic \
SlapLogout SlapLogout
...@@ -1095,7 +1104,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1095,7 +1104,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
RequestComputerPartition RequestComputerPartition
Tic Tic
CheckRaisesNotFoundComputerPartitionParameterDict CheckRaisesNotFoundComputerPartitionParameterDict
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic Tic
Logout
RequestComputerPartition RequestComputerPartition
Tic Tic
SlapLogout SlapLogout
...@@ -1728,8 +1740,13 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1728,8 +1740,13 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
software_type, software_type + str(1)) software_type, software_type + str(1))
second = slap_computer_partition.request(software_release, second = slap_computer_partition.request(software_release,
software_type, software_type + str(2)) software_type, software_type + str(2))
self.stepLoginDefaultUser()
transaction.commit()
self.tic()
self.stepConfirmOrderedSaleOrderActiveSense()
transaction.commit() transaction.commit()
self.tic() self.tic()
self.stepLogout()
first = slap_computer_partition.request(software_release, first = slap_computer_partition.request(software_release,
software_type, software_type + str(1)) software_type, software_type + str(1))
second = slap_computer_partition.request(software_release, second = slap_computer_partition.request(software_release,
...@@ -1761,21 +1778,6 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1761,21 +1778,6 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
requested_computer_partition_reference=\ requested_computer_partition_reference=\
requested_slap_computer_partition.getId()) 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): def _stepSetSoftwareInstanceChildren(self, sequence, source_reference):
software_instance_uid = sequence['root_software_instance_uid'] software_instance_uid = sequence['root_software_instance_uid']
software_instance = self.portal.portal_catalog.getResultValue( software_instance = self.portal.portal_catalog.getResultValue(
...@@ -1931,15 +1933,8 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1931,15 +1933,8 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
finally: finally:
Base.serialize = Base.serialize_call Base.serialize = Base.serialize_call
def stepRequestComputerComputerPartitionCheckSerializeCalledOnSelected( def stepConfirmSaleOrderOrderedToCheckSerializeCalledOnSelected(
self, sequence, **kw): 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 # check that on being_requested serialise is being called
# code stolen from testERP5Security:test_MultiplePersonReferenceConcurrentTransaction # code stolen from testERP5Security:test_MultiplePersonReferenceConcurrentTransaction
...@@ -1959,15 +1954,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -1959,15 +1954,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
Base.serialize = verify_serialize_call Base.serialize = verify_serialize_call
try: try:
self.assertRaises(DummyTestException, requester.requestSoftwareInstance, sale_order_ordered = self.portal.portal_catalog.getResultValue(
software_release=software_release_uri, portal_type="Sale Order", simulation_state="ordered")
partition_reference=requested_reference, self.assertRaises(DummyTestException, sale_order_ordered.confirm)
software_type=requested_reference,
shared=False,
filter_kw={},
instance_xml=self.minimal_correct_xml,
sla_xml=self.minimal_correct_xml,
state=None)
finally: finally:
Base.serialize = Base.serialize_call Base.serialize = Base.serialize_call
...@@ -3819,16 +3808,6 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): ...@@ -3819,16 +3808,6 @@ class TestVifibSlapWebServiceMixin(testVifibMixin):
uid=sequence["software_instance_uid"]) uid=sequence["software_instance_uid"])
slave_instance.startComputerPartition() 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): def stepSlaveInstanceStopped(self, sequence):
slave_instance = self.portal.portal_catalog.getResultValue( slave_instance = self.portal.portal_catalog.getResultValue(
uid=sequence["software_instance_uid"]) uid=sequence["software_instance_uid"])
......
...@@ -440,14 +440,113 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): ...@@ -440,14 +440,113 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
LoginTestVifibCustomer LoginTestVifibCustomer
RequestDestroySoftwareInstanceFromCurrentComputerPartition RequestDestroySoftwareInstanceFromCurrentComputerPartition
Tic Tic
SetDeliveryLineAmountEqualOne SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceHostingSalePackingListStopped
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed 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 SlapLoginCurrentComputer
SoftwareInstanceDestroyed SoftwareInstanceDestroyed
Tic 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 CheckComputerPartitionInstanceCleanupSalePackingListDelivered
Logout Logout
""" """
...@@ -480,7 +579,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): ...@@ -480,7 +579,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
Tic Tic
SlapLogout SlapLogout
LoginTestVifibCustomer LoginTestVifibCustomer
RequestSlaveInstanceStop RequestSoftwareInstanceStop
Tic Tic
Logout Logout
LoginDefaultUser LoginDefaultUser
...@@ -506,6 +605,12 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): ...@@ -506,6 +605,12 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) 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): def test_SlaveInstance_request_destroy(self):
""" """
Check that the Slave Instance will be destroyed correctly Check that the Slave Instance will be destroyed correctly
...@@ -524,6 +629,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): ...@@ -524,6 +629,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
SlapLogout SlapLogout
LoginDefaultUser LoginDefaultUser
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
CheckComputerPartitionIsBusy
Logout Logout
""" """
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
...@@ -635,6 +741,154 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): ...@@ -635,6 +741,154 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_SlaveInstance_change_parameter_dict_after_request(self):
"""
Check that request to change the parameter dict from a Slave Instance
will create update packing list correctly
"""
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
StartSoftwareInstanceFromCurrentComputerPartition
Logout
Tic
SoftwareInstanceStarted
Tic
CheckEmptyComputerGetComputerPartitionCall
SlapLogout
SlapLoginCurrentSoftwareInstance
SelectRequestedParameterDictRequestedParameter
RequestSlaveInstanceFromComputerPartition
SlapLogout
LoginDefaultUser
CheckComputerPartitionInstanceUpdateSalePackingListConfirmed
Logout
SlapLoginCurrentComputer
CheckSuccessComputerGetComputerPartitionCall
SlapLogout
"""
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(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
...@@ -101,12 +101,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin): ...@@ -101,12 +101,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
""" """
prepare_configured_instance = """ \ prepare_configured_instance = """ \
InitializeTime \ InitializeTime""" + \
\
LoginERP5TypeTestCase \
ConfigureInstance \
Tic \
Logout""" + \
TestVifibSlapWebServiceMixin.prepare_confirmed_cleanup_resource_packing_list TestVifibSlapWebServiceMixin.prepare_confirmed_cleanup_resource_packing_list
prepare_reported_usage_call = """ \ prepare_reported_usage_call = """ \
...@@ -121,29 +116,6 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin): ...@@ -121,29 +116,6 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin):
sequence['first_call'] = False sequence['first_call'] = False
sequence['second_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): def stepSlapReportUsageCall(self, sequence, **kw):
""" """
Checks that slap.reportUsage is successfully called. 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