ISIS-1455: improves visibility of metamodel validation exceptions when running integration tests.
Modifies IsisSystemForTest so that if there are metamodel validation exceptions, then these are summarized and printed as part of the immediate fail() that is thrown when the integtest harness is bootstrapping. Project: http://git-wip-us.apache.org/repos/asf/isis/repo Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/a98cbfdd Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/a98cbfdd Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/a98cbfdd Branch: refs/heads/master Commit: a98cbfdd6cb0c20f9d4b26b7b367a54e3815d0fa Parents: cd41cea Author: Dan Haywood <d...@haywood-associates.co.uk> Authored: Thu Jun 23 16:48:59 2016 +0100 Committer: Dan Haywood <d...@haywood-associates.co.uk> Committed: Thu Jun 23 16:49:26 2016 +0100 ---------------------------------------------------------------------- .../isis/core/integtestsupport/IsisSystemForTest.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/isis/blob/a98cbfdd/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java ---------------------------------------------------------------------- diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java index d76979b..f9afd98 100644 --- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java +++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisSystemForTest.java @@ -22,6 +22,7 @@ package org.apache.isis.core.integtestsupport; import java.util.List; import java.util.Set; +import com.google.common.base.Joiner; import com.google.common.collect.Lists; import org.junit.Before; @@ -44,10 +45,10 @@ import org.apache.isis.core.runtime.authentication.AuthenticationManager; import org.apache.isis.core.runtime.authentication.AuthenticationRequest; import org.apache.isis.core.runtime.fixtures.FixturesInstallerDelegate; import org.apache.isis.core.runtime.logging.IsisLoggingConfigurer; -import org.apache.isis.core.runtime.system.session.IsisSessionFactoryBuilder; import org.apache.isis.core.runtime.system.context.IsisContext; import org.apache.isis.core.runtime.system.persistence.PersistenceSession; import org.apache.isis.core.runtime.system.session.IsisSessionFactory; +import org.apache.isis.core.runtime.system.session.IsisSessionFactoryBuilder; import org.apache.isis.core.runtime.system.transaction.IsisTransaction; import org.apache.isis.core.runtime.system.transaction.IsisTransaction.State; import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager; @@ -283,9 +284,12 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic private void initIfRequiredThenOpenSession(FireListeners fireListeners) throws Exception { - // exit as quickly as possible for this case... (will already have been logged) - if(IsisContext.getMetaModelInvalidExceptionIfAny() != null) { - fail("Metamodel invalid"); + // exit as quickly as possible for this case... + final MetaModelInvalidException mmie = IsisContext.getMetaModelInvalidExceptionIfAny(); + if(mmie != null) { + final Set<String> validationErrors = mmie.getValidationErrors(); + final String validationMsg = Joiner.on("\n").join(validationErrors); + fail(validationMsg); return; }