Le 2013-06-18 à 20:41, Samuel Pelletier <[email protected]> a écrit :

> Hi Chuck,
> 
> I think your last comment was correct: 
> 
>>> I think that means a model is being used that is not yet in an EOModelGroup.
> 
> I added the model name to the new MockEditingContext() call and no more fail 
> to date when I run only this test class. If I run the complete project tests, 
> I still have intermittent fail at the same place even after adding the model 
> name to all the MockEditingContext constructors. I hate intermittent 
> problems! 
> 
> Maybe Henrique Prange understand the situation. If the model name is 
> mandatory to ensure it's loading before the test run, I suggest to enforce at 
> least one name in the constructor of the MockEditingContext.

And lucky you, he will be at WOWODC :-)

> Samuel
> 
> 
> Le 2013-06-18 à 18:10, Chuck Hill <[email protected]> a écrit :
> 
>> Hi Samuel,
>> 
>> JUnit can/will run tests in a different order each time.  So if your tests 
>> depend on something else having happened (EOF getting fully initialized, 
>> some other test running first) you will see random failures like this.  I 
>> think it an/will run tests in multiple threads too (I use both JUnit and 
>> TestNG and sometimes mix up their features :-) so concurrency can also cause 
>> problems like this.
>> 
>> 
>> On 2013-06-18, at 2:13 PM, Samuel Pelletier wrote:
>> 
>>> Hi,
>>> 
>>> I have a test that succeed sometime and fail other times. If I run the 
>>> jUnit source that contain this test, it fail sometime in the 
>>> loadPermission() method. I have no idea where to look at. It is even more 
>>> strange that sometime, I can have 6 successful tests and after 4 failed in 
>>> a row.
>>> 
>>> These test are inside a framework project. When I run the tests, I have 
>>> these lines on the console but they do not seems to cause problem with the 
>>> about 100 others tests in the project.
>>> 
>>> - The EOModel 'erprototypes' has an empty connection dictionary.
>>> - The EOModel 'erprototypes' has an empty connection dictionary.
>> 
>> Those are likely to be OK.
>> 
>>> - The EOModel 'KAAccessControl' has an empty connection dictionary.
>>> - The EOModel 'KAAccessControl' has an empty connection dictionary.
>> 
>> I am guessing you need that model for the permissions testing.  This is 
>> likely a problem.
>> 
>> 
>>> - The model 'KAAccessControl' (path: 
>>> file:/Users/sam/work/KavijuWO/KAAccessControl/Resources/KAAccessControl.eomodeld)
>>>  cannot be added to model group <EOModelGroup (("KAAccessControl", 
>>> "file:/Users/sam/work/KavijuWO/KAAccessControl/Resources/KAAccessControl.eomodeld"),
>>>  ("erprototypes", 
>>> "file:/Users/sam/work/WonderSource/Frameworks/Core/ERPrototypes/Resources/erprototypes.eomodeld"))>
>>>  because it already contains a model with that name.
>>> 
>>> Any idea?
>> 
>> Do you have multiple EOF stacks (multiple EOObjectStoreCoordinators)?  You 
>> could be using default* methods that only work with the default stack.  Is 
>> there a stack trace for that last one to show where duplication model 
>> loading is having?
>> 
>> 
>>> 
>>> Samuel
>>> 
>>> RolesFileLoader load a plist file to create and update objects in the 
>>> database.
>>> 
>>> Here is a my test source with a single test:
>>> 
>>>     @Rule public MockEditingContext ec = new MockEditingContext();
>>>     
>>>     @Before
>>>     public void loadPermissions() {
>>>             ERXProperties.setStringForKey("SampleRolesFile", 
>>> RolesFileLoader.rolesFileNamePropertyKey);
>>>             RolesFileLoader.loadRolesFile(ec);
>>>     }
>>> 
>>>     @Test
>>>     public void testReloadPermissions() {
>>>             ERXProperties.setStringForKey("SampleRolesFile", 
>>> RolesFileLoader.rolesFileNamePropertyKey);
>>>             RolesFileLoader.loadRolesFile(ec);
>>>     }
>>> 
>>> The error stack:
>>> 
>>> com.webobjects.foundation.NSForwardException 
>>> [java.lang.reflect.InvocationTargetException] 
>>> null:java.lang.reflect.InvocationTargetException
>>>     …
>>> Caused by: java.lang.reflect.InvocationTargetException
>>>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>>>     at 
>>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>>>     at 
>>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>>>     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>>>     at 
>>> com.webobjects.foundation._NSUtilities.instantiateObjectWithConstructor(_NSUtilities.java:659)
>>>     ... 32 more
>>> Caused by: java.lang.NullPointerException
>>>     at 
>>> com.webobjects.eoaccess.EOModel.createPrototypeCache(EOModel.java:631)
>> 
>> I think that means a model is being used that is not yet in an EOModelGroup.
>> 
>> 
>> Chuck
>> 
>>>     at 
>>> com.webobjects.eoaccess.EOModel.prototypeAttributeNamed(EOModel.java:699)
>>>     at 
>>> com.webobjects.eoaccess.ERXModel.prototypeAttributeNamed(ERXModel.java:290)
>>>     at com.webobjects.eoaccess.EOAttribute.<init>(EOAttribute.java:998)
>>>     at com.webobjects.eoaccess.EOEntity.attributes(EOEntity.java:816)
>>>     at com.webobjects.eoaccess.EOEntity.attributeNamed(EOEntity.java:789)
>>>     at com.webobjects.eoaccess.EOEntity.classProperties(EOEntity.java:1098)
>>>     at 
>>> com.webobjects.eoaccess.EOEntity._propertyDictionaryInitializer(EOEntity.java:3321)
>>>     at 
>>> com.webobjects.eoaccess.EOEntity._newDictionaryForProperties(EOEntity.java:3667)
>>>     at 
>>> com.webobjects.eoaccess.EOEntityClassDescription._newDictionaryForProperties(EOEntityClassDescription.java:88)
>>>     at 
>>> com.webobjects.eocontrol.EOGenericRecord.__setClassDescription(EOGenericRecord.java:111)
>>>     at 
>>> com.webobjects.eocontrol.EOGenericRecord.__setClassDescription(EOGenericRecord.java:100)
>>>     at 
>>> com.webobjects.eocontrol.EOGenericRecord.<init>(EOGenericRecord.java:73)
>>>     at er.extensions.eof.ERXGenericRecord.<init>(ERXGenericRecord.java:106)
>>>     at 
>>> com.kaviju.accesscontrol.model.base._KAAccessList.<init>(_KAAccessList.java:15)
>>>     at 
>>> com.kaviju.accesscontrol.model.KAAccessList.<init>(KAAccessList.java:8)
>>>     ... 37 more
>> 
>> -- 
>> Chuck Hill             
>> Executive Managing Partner, VP Development and Technical Services
>> 
>> Practical WebObjects - for developers who want to increase their overall 
>> knowledge of WebObjects or who are trying to solve specific problems.    
>> http://www.global-village.net/gvc/practical_webobjects
>> 
>> Global Village Consulting ranks 13th in 2012 in BIV's Top 100 Fastest 
>> Growing Companies in B.C! 
>> 
>> Global Village Consulting ranks 44th in 25th annual PROFIT 500 ranking of 
>> Canada’s Fastest-Growing Companies by PROFIT Magazine!
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca
> 
> This email sent to [email protected]


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to