commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: cvs commit: jakarta-commons-sandbox/chain/src/test/org/apache/commons/chain/web/servlet ServletGetLocaleCommandTestCase.java ServletSetLocaleCommandTestCase.java ServletWebContextTestCase.java
Date Mon, 29 Sep 2003 17:07:49 GMT
Ted Husted wrote:

> craigmcc@apache.org wrote:
>
>>   Initial phase of switching to Context "is-a" Map instead of
>>   Context "has-a" Map.  There are some pretty interesting intricacies
>>   to implementing the entire Map contract.
>
>
> I moved my current development over this morning. It seemed to go 
> fine, except that I had a "isNew" method on the original. It's not a 
> property, but a utility method that tested properties. This being a 
> young project, I refactored the name to "newEntry" for now, and 
> everything fell into place. Of course, that wouldn't work for 
> everyone. I didn't try to figure out if there's a fix, so here's the 
> trace:
>
> Testcase: testAddPermit took 1.422 sec
>     Caused an ERROR
> Exception writing property 'new': Property 'new' is not writeable
> java.lang.UnsupportedOperationException: Exception writing property 
> 'new': Property 'new' is not writeable
>     at 
> org.apache.commons.chain.impl.ContextBase.writeProperty(ContextBase.java:629) 
>
>     at 
> org.apache.commons.chain.impl.ContextBase.put(ContextBase.java:361)
>     at 
> org.apache.commons.chain.impl.ContextBase.putAll(ContextBase.java:390)
>     at 
> us_ok_deq_wqdata.context.CpuPermitContext.<init>(CpuPermitContext.java:35) 
>
>     at 
> us_ok_deq_wqdata.dao.mock.MockCpuPermitDao.insert(MockCpuPermitDao.java:80) 
>
>     at 
> us_ok_deq_wqdata.command.PermitInsert.execute(PermitInsert.java:20)
>     at 
> us_ok_deq_wqdata.command.CpuPermitInsertTest.testAddPermit(CpuPermitInsertTest.java:17)

>
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

That's what you would get if you have isNew() without a setNew() on your 
Context implementation.

>
>
>>   FIXME:  Missing unit tests for ...
>
>
> I can work on these this afternoon.
>
>
> [related thread]
> > * For the property transparency thing:
>
> I haven't tried this yet, but will. To give the new Base a test, I 
> temporarily gave my properties member fields [gotta love those IDE 
> refactoring features :)]

In a "Context is-a Map" world I would likely be against having something 
like getField/setField -- the way that the Context implementation 
chooses to store its state information should be invisible outside the 
implementation class.

You'll also find that the attribute-property transparency really does 
work already, comes for free if you subclass ContextBase, and that it's 
quite cool :-).

>
> -Ted.

Craig



Mime
View raw message