What I'm trying to create is a junit rule, this is the initial effort for ti https://gist.github.com/velo/78b835b18d394b103198
On Sun, Sep 6, 2015 at 10:08 PM, Marvin Froeder <[email protected]> wrote: > On my tests I need to access document API over HTTP. > > Now I just wanna assert if all is fine making some queries.. That is why > I instantiate a server. > > admin/1234 is the user I set for my tests.... it work like a charm for > http. > > Any other idea? > > On Sun, Sep 6, 2015 at 7:48 PM, xvik <[email protected]> wrote: > >> By the way, you don't need the embedded server for unit tests: you can >> simply create new in-memory db and work with it >> >> ODatabaseDocumentTx db = new ODatabaseDocumentTx("memory:test"); >> db.create(); >> db.open("admin", "admin"); >> >> The behavior of in-memory database is the same as remote connection in >> many cases (not all ofc), but usually its enough for tests >> >> воскресенье, 6 сентября 2015 г., 13:39:11 UTC+6 пользователь xvik написал: >> >>> I suppose you are trying to connect with user from server configuration, >>> but server users and database users are different. >>> Try admin/admin - the default user created for each new database. >>> http://orientdb.com/docs/last/Database-Security.html#users >>> >>> воскресенье, 6 сентября 2015 г., 10:16:21 UTC+6 пользователь Marvin >>> Froeder написал: >>>> >>>> I'm starting an in-memory embedded server to run some "unit" tests. >>>> >>>> server = OServerMain.create(); >>>> server.startup(configuration); >>>> server.activate(); >>>> >>>> >>>> And the I query it by using: >>>> try (ODatabaseDocumentTx db = new ODatabaseDocumentTx(server. >>>> getStorageURL("test"));) { >>>> db.open("root", "1234"); >>>> return db.query(query, args); >>>> } >>>> >>>> >>>> And this give me the following error: >>>> com.orientechnologies.orient.core.exception.OSecurityAccessException: >>>> User or password not valid for database: 'test' >>>> at com.orientechnologies.orient.core.metadata.security.OSecurityShared >>>> .authenticate(OSecurityShared.java:173) >>>> at com.orientechnologies.orient.core.metadata.security.OSecurityProxy. >>>> authenticate(OSecurityProxy.java:87) >>>> at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx. >>>> open(ODatabaseDocumentTx.java:265) >>>> at io.sonarcloud.orientdb.EmbeddedOrientDB.query(EmbeddedOrientDB.java >>>> :91) >>>> at io.sonarcloud.github.routes.RecordRouteBuilderTest. >>>> testSendMatchingMessage(RecordRouteBuilderTest.java:82) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>> at sun.reflect.NativeMethodAccessorImpl.invoke( >>>> NativeMethodAccessorImpl.java:62) >>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >>>> DelegatingMethodAccessorImpl.java:43) >>>> at java.lang.reflect.Method.invoke(Method.java:497) >>>> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( >>>> FrameworkMethod.java:50) >>>> at org.junit.internal.runners.model.ReflectiveCallable.run( >>>> ReflectiveCallable.java:12) >>>> at org.junit.runners.model.FrameworkMethod.invokeExplosively( >>>> FrameworkMethod.java:47) >>>> at org.junit.internal.runners.statements.InvokeMethod.evaluate( >>>> InvokeMethod.java:17) >>>> at org.junit.internal.runners.statements.RunBefores.evaluate( >>>> RunBefores.java:26) >>>> at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters. >>>> java:27) >>>> at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) >>>> at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55) >>>> at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java: >>>> 48) >>>> at org.junit.rules.RunRules.evaluate(RunRules.java:20) >>>> at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) >>>> at org.junit.runners.BlockJUnit4ClassRunner.runChild( >>>> BlockJUnit4ClassRunner.java:78) >>>> at org.junit.runners.BlockJUnit4ClassRunner.runChild( >>>> BlockJUnit4ClassRunner.java:57) >>>> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) >>>> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) >>>> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) >>>> at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) >>>> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) >>>> at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters. >>>> java:27) >>>> at org.junit.runners.ParentRunner.run(ParentRunner.java:363) >>>> at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference >>>> ... >>> >>> -- >> >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "OrientDB" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/orient-database/Lqfnrgk2l6Y/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
