>> I need to implement the following functions for my testplan: >> 1. long __timestamp() >> returns new Date().getTime()
s> ${__time()} Oh, sorry. I thought it returns only string representation of time using specified format. I omitted corresponding notes in the documentation. >> 2. long __timeDuration(String variableName) >> returns new Date().getTime() - variables.get(variableName) s> ${__intSum(${__time()},-${variableName})} Thank you. I am always forgot about such this sort of notation like -${variableName} >> 3. boolean __isTimeoutExpaired(String variableName, long timeout) >> returns true if __timeduration for variableName more than specified >> timeout. s> ${__javaScript(${variableName} > timeout)} Yes, you are right, but I don't like to use __javaScript at all. When I replaced my __javaScripts calculations to __BeanShell my test plan works in several times faster. Maybe it is so only for calculations but not for comparing operations. In any case I agree with you it is not necessary function without previous. Thank you. >> It is useful for me to use them in operations with timeouts. >> E.g.: For sending request to server while something is not received or >> time is expired. >> >> It is possible to use javaScript or beanShell for this needs. >> But it is not clear for me to read and work with this plan... s> See above. >> If community wants I can send you patches to commit. s> Please don't e-mail patches - they should be provided via Bugzilla. >> But I think Function.java interface involves code duplication in several >> places, such as the following example for Varialble.java: >> >> public synchronized void setParameters(Collection parameters) throws >> InvalidVariableException { >> values = parameters.toArray(); >> if ((values.length < MIN_PARAMETER_COUNT) || (values.length > >> MAX_PARAMETER_COUNT)) { >> throw new InvalidVariableException("Parameter Count not between " + >> MIN_PARAMETER_COUNT + " & " >> + MAX_PARAMETER_COUNT); >> } >> } >> >> I think it will be better to have: >> protected int getMinParameterCount() >> protected int getMaxParameterCount() >> >> and use them to verify parameters diapason and set it to values list for >> all functions. >> Also the following code construction is used 46 times for function >> implementations: >> >> ((CompoundVariable) values[index]).execute() >> >> I think to extract this method to some utils >> class in this package or to the AbstractFunction class, for example: >> >> protected (static?) String getParameter(Object obj) >> >> and so on... >> >> I understand that a lot of developers have own function implementation >> based on Function API and it is not good to change this API but it is >> possible to change AbstractFunction or add new super class extended from >> AbstractFunction and use it for predefined functions. s> Quite possibly... What way do you prefer? I suggest to change AbstractFunction at the beginning. >> Just let me know if you want this refactoring too and I can do it. I s> If you are keen to do it, I suggest you provide a patch for just one s> of the functions so it can be reviewed before further work is done. ok. >> need to know your opinion for changing only my stuff or to refactor >> all other functions too. Thank you. -- Best regards, Dmitry Kudrenko ARDAS group (http://www.ardas.dp.ua) --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]