ups, there were 2 errors in my script: wrong regexp and bad index to get
text before "=".
Following works:
<groovyScript>
class MyProperty extends org.apache.tools.ant.taskdefs.Property
{
String encoding
protected void loadFile(File file)
{
def text = file.getText(encoding)
def lines = text.split("[\\n\\r]+")
lines.each {
if (!it.startsWith("#")) {
def pos = it.indexOf("=")
if (pos > 0) {
addProperty(it[0..pos-1], it[(pos+1)..-1])
}
}
}
}
}
project.addTaskDefinition "myProperty", MyProperty
</groovyScript>
Cheers,
Marc.
--
Blog: http://mguillem.wordpress.com
Mart Toom wrote:
> Marc Guillemot wrote:
>>
>> I think that it is not the correct format for a property file. Normally
>> you should have
>> property.name=property value
>
> Tried also this way but still no progress.
>
> in file there is following row:
> minuVanaIsa=Mõõda pärmitaigna kõrgust öö jooksul lõkke ääres ühe
> sentimeetri sügavuselt mitu korda.
>
> In test I used it like this:
>
> <testInfo type="test" description="${minuVanaIsa}"/>
> And in test report I get still ${minuVanaIsa}, so property not resolved.
>
>
>>> Debug mode didn't show anything useful, only thing I saw about
>>> myProperty was:
>>> Trying to override old definition of task myProperty
>>
>> ???
>> did you define it twice?
>
> No, only in one place. Made a search over my test project and checked
> also from WebTest folder. It was found only there where I put it.
> When this script was commented out, then ant will complain about not
> knowing what <myProperty file="conf/utf-8.txt" encoding="UTF-8"/> means.
>
> Mart
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest