ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Petar Tahchiev <paranoia...@gmail.com>
Subject Re: Cactus 1.8 / Ant 1.8 Integration
Date Tue, 12 Feb 2008 08:18:44 GMT

Well, this solution is my really last plan for this :-). But thanks, anyway. 

Some other proposals?



rigel wrote:
> 
> Hello Peter,
> 
> I know you probably know ;-)
> that this fast solution which I post now is not so well appreciated due
> to its possible privileges unconvenients, but in the meanwhile
> if I was you I would access private members with a PrivilegedAction:
> 
> <xmp>
>     public static Object testAccess(Object instance, String s) {
>     	try {
>     		final Field f = instance.getClass().getDeclaredField(s);
>     		AccessController.doPrivileged(new PrivilegedAction() {
>         		public Object run() { 
>         			f.setAccessible(true);
>         			return null;
>         		}
>         	});
>     		Object o = f.get(instance);
>     		return o;
>     	} catch(Exception e) {
>     		e.printStackTrace();
>     	}
>     	return null;
>     }
> </xmp>
> 
> Hoping it would be be useful as temporary patch ;-)
> 
> Bye
> 
> 
> Petar Tahchiev wrote:
>> 
>> Sorry for the formating :-(.
>> 
>> 
>> Hi guys,
>> 
>> it's Petar Tahchiev from the Jakarta Cactus Team (again :-)).
>> I am trying to integrate the CactusTask with Ant 1.8-alpha.
>> The CactusTask does:
>> 0) Extends the JUnitTask from Ant.
>> 1) Gets all the tests from JUnitTask
>> 2) Iterates over them and sets different properties to each one of them.
>> 3) Calls the JUnitTask to executes the test-cases.
>> 
>> So, the basis is that we are no longer able to use
>> 
>> execute(org.apache.tools.ant.taskdefs.optional.junit.JUnitTest);
>> 
>> because the delegate field (Object of type JUnitTaskMirror) leaves
>> uninitialized and thus the CactusTask throws NLPE.
>> This way to execute the tests we are bound to use the execute() method of
>> the
>> JUnitTask (because in that method the delegate object gets initialized).
>> When calling
>> the execute() method we have to have our tests configured. But when I get
>> the tests and configure them with:
>> ===============================================================
>>                 Enumeration tests = getIndividualTests();
>>                
>>                 while (tests.hasMoreElements())
>>                 {
>>                     JUnitTest test = (JUnitTest) tests.nextElement();
>>                    
>>                     if (test.shouldRun(getProject())
>>                      && !theWrapper.isExcluded(test.getName()))
>>                     {
>>                         test.setFork(true);
>>                         if (theWrapper.getToDir() != null)
>>                         {
>>                             test.setTodir(theWrapper.getToDir());
>>                         }
>> ===============================================================
>> 
>> I am no longer able to set them in the JUnitTask. The field tests is
>> private:
>> 
>>     private Vector tests = new Vector();
>> 
>> and there is no setter for an individual test, or a vector of tests.
>> 
>> Please, can you look serious to this and supply a setter method for this.
>> This way I can configure
>> the tests and set them in the JUnitTask, and after that just call
>> execute().
>> 
>> Thank you very much.
>> 
>> P.S. Please keep me in a CC, because I am not subscribed to the Ant
>> Developers' lists.
>> 
>> -- 
>> Regards, Petar!
>> Karlovo, Bulgaria.
>> 
>> EOOXML Objections
>> http://www.grokdoc.net/index.php/EOOXML_objections
>> 
>> Public PGP Key at:
>> https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611
>> Key Fingerprint: A369 A7EE 61BC 93A3 CDFF  55A5 1965 8550 C311 0611 
>> 
> 
> 



-- 
View this message in context: http://www.nabble.com/Cactus-1.8---Ant-1.8-Integration-tp15396771p15428349.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message