• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: how open database connection for test
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how open database connection for test


  • Subject: Re: how open database connection for test
  • From: Alexis Tual <email@hidden>
  • Date: Tue, 17 Apr 2012 13:49:25 +1100

Hi,
why do you have to load a model ?
When needed, Wonder should load the models it founds in the classpath. If you want to override the connection dicitonnary, you can just set the right Wonder properties :
http://wiki.wocommunity.org/display/WO/The+EOModel#TheEOModel-ConnectionDictionary

Cheers,

Alex

2012/4/17 g.alexandre <email@hidden>
hi,
I want open database connection for create unit testing initialization with database access. 
I have test:

@Test
public void test(){
 ERXExtensions.initApp(Application.class, new String[0]);
 EOModel model = new EOModel(new URL("file:///Users/dev1/Documents/head/fitTest/ObjetsMetierCariatides/build/ObjetsMetierCariatides.framework/Resources/ModeleInitialisationDictionnaire.eomodeld"));

            this.connexionProperties = new NSMutableDictionary(model.connectionDictionary());
            this.tconnexionProperties.addEntriesFromDictionary(new NSDictionary(new Object[] {
                    "xxxx",
                    "xxxx",
                    "jdbc:oracle:thin:@xxx.xxx.xxx.xxx:xxxx:SID",
                    "oracle.jdbc.driver.OracleDriver",
                    "MyOraclePlugIn"
            }, new Object[] {
                    "username",
                    "password",
                    "URL",
                    "driver",
                    "plugin"
            }));

            model.setConnectionDictionary(this.connexionProperties);

            EOModelGroup.defaultGroup().addModel(model);
}

and when i execute the last line i have:

avr. 16 14:02:54 test[-1] WARN  er.extensions.eof.ERXModelGroup  - The EOModel 'erprototypes' has an empty connection dictionary.
avr. 16 14:02:54 test[-1] WARN  er.extensions.eof.ERXModelGroup  - The EOModel 'erprototypes' has an empty connection dictionary.
avr. 16 14:02:54 test[-1] ERROR er.extensions.eof.ERXEntityClassDescription  - Error registering model: EOMODELNAME
ClassNotFoundException: CLASSNAME
  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Class.java:169)
  at er.extensions.eof.ERXEntityClassDescription$Factory.registerDescriptionForEntity(ERXEntityClassDescription.java:580)
  at er.extensions.eof.ERXEntityClassDescription$Factory.registerDescriptionForEntitiesInModel(ERXEntityClassDescription.java:534)
  at er.extensions.eof.ERXEntityClassDescription$Factory.modelWasAdded(ERXEntityClassDescription.java:343)
     ... skipped 8 stack elements
  at er.extensions.eof.ERXModelGroup.addModel(ERXModelGroup.java:445)
  at er.extensions.eof.ERXModelGroup.addModelWithPathURL(ERXModelGroup.java:537)
  at er.extensions.eof.ERXModelGroup.loadModelsFromLoadedBundles(ERXModelGroup.java:271)
  at er.extensions.ERXExtensions.defaultModelGroup(ERXExtensions.java:145)
     ... skipped 5 stack elements
  at com.webobjects.foundation._NSDelegate._perform(_NSDelegate.java:225)
  at com.webobjects.foundation._NSDelegate.perform(_NSDelegate.java:158)
  at com.webobjects.eoaccess.EOModelGroup.defaultGroup(EOModelGroup.java:365)
  at your.app.testApplication.test(testApplication.java:118)
     ... skipped 4 stack elements
  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
  at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
  at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

but the class "CLASSNAME" exist so i don't know if the problem is a ClassNotFoundException. And i don't know if the database access is correctly opened.


best regards G.ALEXANDRE

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >how open database connection for test (From: "g.alexandre" <email@hidden>)

  • Prev by Date: Re: ERModernLook/ERModernDefaultSkin deployment
  • Next by Date: Re: SQL
  • Previous by thread: how open database connection for test
  • Next by thread: Multiple EO ObjectStoreCoordinators
  • Index(es):
    • Date
    • Thread