Hi list!

Using wounittest2 I've stuck with testing methods containing calls of
EOEnterpriseObjectClazz.objectWithPrimaryKeyValue(ec, pk);
or 
EOUtilities.objectWithPrimaryKeyValue(ec, entity, pk);

These methods create qualifiers against primary key attribute which is not
selected as a class property in model. So array of registered in
mockEditingContext enterprise objects cannot be filtered in memory by
EOFetcher using objectsWithFetchSpecification because of exception in
EOQualifier.filteredArrayWithQualifier().

What is a right way of testing methods with these calls with wounittest?
Is it a way to implement support of filtering by primary key or filtering by
other non-class property attributes?

Here is an exception¹s stack:
java.lang.RuntimeException:
com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException:
<dm.threesixtypro.FileRubric 0x6715f8> valueForKey(): lookup of unknown key:
'rowid'.
This class does not have an instance variable of the name rowid or _rowid,
nor a method of the name rowid, _rowid, getRowid, or _getRowid
    at 
dm.threesixtypro.ContentItem$ContentItemClazz.objectsForQueryDictionary(Cont
entItem.java:37)
    at 
dm.threesixtypro.tests.FileTest.testObjectsForQueryDictionary(FileTest.java:
31)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
    at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at 
org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunn
er.java:99)
    at 
org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.
java:81)
    at 
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterR
unner.java:34)
    at 
org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:
75)
    at 
org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
    at 
org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClass
MethodsRunner.java:71)
    at 
org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner
.java:35)
    at 
org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.
java:42)
    at 
org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterR
unner.java:34)
    at 
org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
    at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestRef
erence.java:38)
    at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:3
8)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:460)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRu
nner.java:673)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.
java:386)
    at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner
.java:196)
Caused by: com.webobjects.foundation.NSKeyValueCoding$UnknownKeyException:
<dm.threesixtypro.FileRubric 0x6715f8> valueForKey(): lookup of unknown key:
'rowid'.
This class does not have an instance variable of the name rowid or _rowid,
nor a method of the name rowid, _rowid, getRowid, or _getRowid
    at 
com.webobjects.foundation.NSKeyValueCoding$DefaultImplementation.handleQuery
WithUnboundKey(NSKeyValueCoding.java:1316)
    at 
com.webobjects.eocontrol.EOCustomObject.handleQueryWithUnboundKey(EOCustomOb
ject.java:1623)
    at 
com.webobjects.foundation.NSKeyValueCoding$Utility.handleQueryWithUnboundKey
(NSKeyValueCoding.java:544)
    at 
com.webobjects.foundation.NSKeyValueCoding$_KeyBinding.valueInObject(NSKeyVa
lueCoding.java:920)
    at 
com.webobjects.eocontrol.EOCustomObject.valueForKey(EOCustomObject.java:1559
)
    at 
com.webobjects.foundation.NSKeyValueCoding$Utility.valueForKey(NSKeyValueCod
ing.java:498)
    at 
com.webobjects.foundation.NSKeyValueCodingAdditions$DefaultImplementation.va
lueForKeyPath(NSKeyValueCodingAdditions.java:212)
    at 
com.webobjects.eocontrol.EOCustomObject.valueForKeyPath(EOCustomObject.java:
1675)
    at 
com.webobjects.foundation.NSKeyValueCodingAdditions$Utility.valueForKeyPath(
NSKeyValueCodingAdditions.java:149)
    at 
com.webobjects.eocontrol.EOKeyValueQualifier.evaluateWithObject(EOKeyValueQu
alifier.java:131)
    at 
com.webobjects.eocontrol.EOQualifier.filteredArrayWithQualifier(EOQualifier.
java:635)
    at 
org.pekeler.eof.EOFetcher$EditingContextStore.rawObjectsWithFetchSpecificati
on(EOFetcher.java:186)
    at 
org.pekeler.eof.EOFetcher$EditingContextStore.objectsWithFetchSpecification(
EOFetcher.java:151)
    at 
org.pekeler.eof.EOFetcher.objectsWithFetchSpecification(EOFetcher.java:218)
    at 
org.wounittest.MockEditingContext.objectsWithFetchSpecification(MockEditingC
ontext.java:120)
    at 
com.webobjects.eocontrol.EOEditingContext.objectsWithFetchSpecification(EOEd
itingContext.java:4500)
    at 
com.webobjects.eoaccess.EOUtilities.objectWithPrimaryKey(EOUtilities.java:43
3)
    at 
com.webobjects.eoaccess.EOUtilities.objectWithPrimaryKeyValue(EOUtilities.ja
va:405)
    at 
dm.threesixtypro.ContentItem$ContentItemClazz.qualifierForQueryDictionary(Co
ntentItem.java:44)
    at 
dm.threesixtypro.ContentItem$ContentItemClazz.objectsForQueryDictionary(Cont
entItem.java:35)
    ... 21 more
 

Thanks in advance!

---
Eugene Khablov


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

This email sent to [email protected]

Reply via email to