|
| 1 | +#Copyright (C) 2015 by six42, All rights reserved. Contact the author via http://github.com/six42 |
| 2 | +# |
| 3 | + |
| 4 | +!3 Given |
| 5 | +!| SQLCommand|TestDatabase|select ID, City from TestData where ID ='%ID%'| |
| 6 | +|ID |City? | |
| 7 | +|1 |Berlin | |
| 8 | + |
| 9 | + |
| 10 | +!|Define Properties|Dummy| |
| 11 | +|key |value| |
| 12 | +|CMD | | |
| 13 | + |
| 14 | +!|Script | |
| 15 | +|# Your code here to create a Connection Object | |
| 16 | +|start |SQLCommand |Dummy | |
| 17 | +|$Cnn= |testHomeMadeConnection;|jdbc:h2:mem:h2db;DB_CLOSE_DELAY=-1|na|na| |
| 18 | +|# Now add the connection symbol to be able to use it | |
| 19 | +|addConnection;|ConnectionName |$Cnn | |
| 20 | + |
| 21 | +!3 When An asynchronus sql update starts which will execute after 1 seconds |
| 22 | + |
| 23 | +!|Script | |
| 24 | +|Start | DelayedExecutor| $Cnn| update TestData set City ='Miami' where ID='1'|1000| |
| 25 | + |
| 26 | +!3 Then the city value doesn't updates immediately |
| 27 | +!| SQLCommand|TestDatabase|select City from TestData where ID ='%ID%'| |
| 28 | +|ID |City? | |
| 29 | +|1 |Berlin | |
| 30 | + |
| 31 | +!3 When we add a retry (50 times in 10 seconds) |
| 32 | +!3 Then we catch the update once it happens |
| 33 | +!| SQLCommand|TestDatabase|select City from TestData where ID ='%ID%'|RETRY=50:10000| |
| 34 | +|ID |City? | |
| 35 | +|1 |Miami | |
| 36 | + |
| 37 | +# if no update happens then the retry stops with fail after the expected time |
| 38 | +#!| SQLCommand|TestDatabase|select City from TestData where ID ='%ID%'| RETRY=100:1000| |
| 39 | +#|ID |City? | |
| 40 | +#|1 |Berlin | |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +!4 Revert updates done |
| 45 | +!| SQLCommand|TestDatabase|update TestData set City ='%City%' where ID='%ID%'| |
| 46 | +|ID |City |Count?| |
| 47 | +|1 |Berlin |1| |
| 48 | + |
| 49 | +!4 Close the connection and remove it from the list of available connections |
| 50 | +!|Define Properties|UseHomeMadeConnection| |
| 51 | +|key |value | |
| 52 | +|DBConnection |ConnectionName | |
| 53 | +|CMD | | |
| 54 | + |
| 55 | +!|Script: SQLCommand|UseHomeMadeConnection| |
| 56 | +|closeConnection | |
| 57 | +|removeConnection |ConnectionName | |
0 commit comments