Just to be sure I have all the latest dependencies downloaded, I cleaned my
local Maven repo. After that I get another error than before. My tests actually
run but with the following error:
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 5.554 sec <<<
FAILURE! - in integration.tests.CompaniesIntegTest
happyCase(integration.tests.CompaniesIntegTest) Time elapsed: 0.114 sec <<<
ERROR!
javax.jdo.JDOException: Exception thrown when executing query
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.ExpressionColumn.checkColumnsResolved(Unknown Source)
at org.hsqldb.QueryExpression.resolve(Unknown Source)
at org.hsqldb.ParserDQL.compileCursorSpecification(Unknown Source)
at org.hsqldb.ParserCommand.compilePart(Unknown Source)
at org.hsqldb.ParserCommand.compileStatement(Unknown Source)
at org.hsqldb.Session.compileStatement(Unknown Source)
at org.hsqldb.StatementManager.compile(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
at org.hsqldb.jdbc.JDBCPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.JDBCConnection.prepareStatement(Unknown Source)
at
org.datanucleus.store.rdbms.datasource.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:296)
at
org.datanucleus.store.rdbms.datasource.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:320)
at
org.datanucleus.store.rdbms.SQLController.getStatementForQuery(SQLController.java:350)
at
org.datanucleus.store.rdbms.query.RDBMSQueryUtils.getPreparedStatementForQuery(RDBMSQueryUtils.java:194)
at
org.datanucleus.store.rdbms.query.JDOQLQuery.performExecute(JDOQLQuery.java:633)
at org.datanucleus.store.query.Query.executeQuery(Query.java:1786)
at org.datanucleus.store.query.Query.executeWithArray(Query.java:1672)
at org.datanucleus.store.query.Query.execute(Query.java:1654)
at
org.datanucleus.api.jdo.query.JDOTypesafeQuery.executeInternalQuery(JDOTypesafeQuery.java:980)
at
org.datanucleus.api.jdo.query.JDOTypesafeQuery.executeList(JDOTypesafeQuery.java:750)
at nl.pocos.dom.company.Companies.listAllForTest(Companies.java:483)
at
integration.tests.CompaniesIntegTest.happyCase(CompaniesIntegTest.java:35)
The test calls the following method:
public List<PortalCompany> listAllForTest()
{
TypesafeQuery<PortalCompany> tq =
newTypesafeQuery(PortalCompany.class);
QPortalCompany cand = QPortalCompany.candidate();
tq.filter(cand.active.eq(true));
return tq.executeList();
}
My ToDoSystemInitializer has the following private class (like the
ToDoApp-integtests):
private static class ToDoSystemBuilder extends IsisSystemForTest.Builder {
public ToDoSystemBuilder() {
withLoggingAt(org.apache.log4j.Level.INFO);
with(testConfiguration());
with(new DataNucleusPersistenceMechanismInstaller());
// services annotated with @DomainService
withServicesIn("nl.pocos.dom"
,"nl.pocos.dom.company"
,"webapp.admin"
,"org.apache.isis.core.wrapper"
,"org.apache.isis.applib"
,"org.apache.isis.core.metamodel.services"
,"org.apache.isis.core.runtime.services"
,"org.apache.isis.objectstore.jdo.datanucleus.service.support" //
IsisJdoSupportImpl
,"org.apache.isis.objectstore.jdo.datanucleus.service.eventbus" //
EventBusServiceJdo
);
}
private static IsisConfiguration testConfiguration() {
final IsisConfigurationForJdoIntegTests testConfiguration = new
IsisConfigurationForJdoIntegTests();
testConfiguration.addRegisterEntitiesPackagePrefix("nl.pocos.dom");
return testConfiguration;
}
}
Do I need to configure anything more for using the in memory database?
Thanks,
Erik
________________________________________
From: Dan Haywood [[email protected]]
Sent: Wednesday, October 08, 2014 2:22 PM
To: users
Subject: Re: integration tests fail: problem with registration of services
is this against 1.7.0-snapshot or 1.6.0?
and (even better) can you provide an example demonstrating the issue on
github?
On 8 October 2014 13:17, Erik de Hair <[email protected]> wrote:
> Hi,
>
> When running integration tests I get the following stacktrace:
>
> Caused by: java.lang.IllegalStateException: No service found for thread;
> make sure ((RequestScopedService)service).__isis_startRequest() is called
> first
> at
> org.apache.isis.core.runtime.services.ServiceInstantiator$2.invoke(ServiceInstantiator.java:117)
> at
> org.apache.isis.applib.annotation.Bulk$InteractionContext_$$_jvst36f_0.hashCode(Bulk$InteractionContext_$$_jvst36f_0.java)
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.PojoAdapterHashMap.add(PojoAdapterHashMap.java:121)
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.mapAndInjectServices(AdapterManagerDefault.java:717)
> at
> org.apache.isis.core.runtime.persistence.adaptermanager.AdapterManagerDefault.adapterFor(AdapterManagerDefault.java:174)
> at
> org.apache.isis.core.runtime.system.persistence.PersistenceSession.createServiceAdapters(PersistenceSession.java:221)
> at
> org.apache.isis.core.runtime.system.persistence.PersistenceSession.initServices(PersistenceSession.java:209)
> at
> org.apache.isis.core.runtime.system.persistence.PersistenceSession.open(PersistenceSession.java:199)
> at
> org.apache.isis.core.runtime.system.session.IsisSessionDefault.open(IsisSessionDefault.java:110)
> at
> org.apache.isis.core.runtime.system.context.IsisContextStatic.openSessionInstance(IsisContextStatic.java:71)
> at
> org.apache.isis.core.runtime.system.context.IsisContext.openSession(IsisContext.java:279)
> at
> org.apache.isis.core.runtime.system.IsisSystemFixturesHookAbstract.initializeServices(IsisSystemFixturesHookAbstract.java:177)
>
> I'm using the todo app ToDoSystemInitializer with the following
> registration of services:
>
> // services annotated with @DomainService
> withServices(new Contacts(), new Companies(),
> new Permissions(), new Roles(),
> new NestedSetManagerService(),
> new QueryResultsCache());
>
> withServicesIn("org.apache.isis.core.wrapper"
> ,"org.apache.isis.applib"
> ,"org.apache.isis.core.metamodel.services"
> ,"org.apache.isis.core.runtime.services"
>
> ,"org.apache.isis.objectstore.jdo.datanucleus.service.support" //
> IsisJdoSupportImpl
>
> ,"org.apache.isis.objectstore.jdo.datanucleus.service.eventbus" //
> EventBusServiceJdo
> );
>
> When I omit the withServicesIn-call my tests start but I get an other
> error later on.
>
> I used the todoapp as the basis for my tests but had to replace/remove the
> dom-part with my own dom. The todoapp tests run OK.
>
> Any idea?
> Erik
>