Unable to run multiple tests

I’m getting an error trying to run multiple tests. If I run a single test at a time it’s fine if I run two or more I get the following stack trace

com.complexible.stardog.security.StardogAuthenticationException: Authentication failed for account 'admin'

	at com.complexible.stardog.StardogKernel.login(StardogKernel.java:978)
	at com.complexible.stardog.api.EmbeddedDriver.lambda$login$0(EmbeddedDriver.java:155)
	at org.apache.shiro.subject.support.SubjectRunnable.doRun(SubjectRunnable.java:120)
	at org.apache.shiro.subject.support.SubjectRunnable.run(SubjectRunnable.java:108)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:391)
	at com.complexible.stardog.api.EmbeddedDriver.login(EmbeddedDriver.java:154)
	at com.complexible.stardog.api.EmbeddedDriver.connectAdmin(EmbeddedDriver.java:185)
	at com.complexible.stardog.api.admin.AdminConnectionConfiguration.connect(AdminConnectionConfiguration.java:45)
	at com.semantalytics.stardog.plan.filter.functions.string.comparison.AbstractStardogTest.beforeClass(AbstractStardogTest.java:20)
	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:498)
	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.RunBefores.evaluate(RunBefores.java:24)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	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.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: org.apache.shiro.authc.AuthenticationException: Authentication failed for token submission [org.apache.shiro.authc.UsernamePasswordToken - admin, rememberMe=false].  Possible unexpected error? (Typical or expected login exceptions should extend from AuthenticationException).
	at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:214)
	at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)
	at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:270)
	at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256)
	at com.complexible.stardog.StardogKernel.login(StardogKernel.java:966)
	... 31 more
Caused by: java.lang.IllegalStateException: IndexConnection must be open.
	at com.google.common.base.Preconditions.checkState(Preconditions.java:173)
	at com.complexible.stardog.index.IndexConnectionImpl.assertOpen(IndexConnectionImpl.java:146)
	at com.complexible.stardog.index.IndexConnectionImpl.getReader(IndexConnectionImpl.java:82)
	at com.complexible.stardog.index.impl.DelegatingIndexConnection.getReader(DelegatingIndexConnection.java:94)
	at com.complexible.stardog.index.impl.DelegatingIndexConnection.getReader(DelegatingIndexConnection.java:94)
	at com.complexible.stardog.security.index.IndexPersistence.getResourceValue(IndexPersistence.java:128)
	at com.complexible.stardog.security.index.IndexAuthenticationManager.isUserEnabled(IndexAuthenticationManager.java:253)
	at com.complexible.stardog.security.impl.SystemSecurityManagerImpl.isUserEnabled(SystemSecurityManagerImpl.java:752)
	at com.complexible.stardog.security.index.IndexBackedSystemSecurityManager.isUserEnabled(IndexBackedSystemSecurityManager.java:400)
	at com.complexible.stardog.security.shiro.StardogRealm.authenticationInfo(StardogRealm.java:236)
	at com.complexible.stardog.security.shiro.StardogRealm.doGetAuthenticationInfo(StardogRealm.java:157)
	at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)
	at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication(ModularRealmAuthenticator.java:180)
	at org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate(ModularRealmAuthenticator.java:267)
	at org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:198)
	... 35 more

I was able to reproduce the problem by cloning the stardog-examples repo, copying the FOAFTest.java to FOAFText2.java and get the same error.

On a side note, should the from() method on ConnectionConfiguration be marked deprecated since it takes a snarl connection and snarl has been deprecated?

Hi Zach,

We are looking into the testing issue for stardog-examples, but I wanted to respond to your ConnectionConfiguration.from() statement: It is not actually supposed to be deprecated because it takes a connection string, which can validly be HTTP. I’m unsure what would happen if you gave it a SNARL connection string, but chances are it would error out.

Thanks. The confusion comes from the javadoc saying, “Create a SNARLConnectionConfiguration based on the full connection string.” for from()