You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2015/08/06 11:31:48 UTC
isis git commit: ISIS-848: simplified design of
IsisComponentProiderDefault; pass GlobSpec through to IsisSystemForTest.
Repository: isis
Updated Branches:
refs/heads/ISIS-848 6ccf96c9a -> d5f4482f8
ISIS-848: simplified design of IsisComponentProiderDefault; pass GlobSpec through to IsisSystemForTest.
Added TODOs in the two IsisComponentProvider impls for optional support of GlobSpec.
Project: http://git-wip-us.apache.org/repos/asf/isis/repo
Commit: http://git-wip-us.apache.org/repos/asf/isis/commit/d5f4482f
Tree: http://git-wip-us.apache.org/repos/asf/isis/tree/d5f4482f
Diff: http://git-wip-us.apache.org/repos/asf/isis/diff/d5f4482f
Branch: refs/heads/ISIS-848
Commit: d5f4482f84929349afb8d034a307ebf0c0d3b3b3
Parents: 6ccf96c
Author: Dan Haywood <da...@haywood-associates.co.uk>
Authored: Thu Aug 6 10:31:45 2015 +0100
Committer: Dan Haywood <da...@haywood-associates.co.uk>
Committed: Thu Aug 6 10:31:45 2015 +0100
----------------------------------------------------------------------
.../IsisComponentProviderDefault.java | 198 ++++++++++---------
.../integtestsupport/IsisSystemForTest.java | 113 ++++++-----
.../IsisComponentProviderUsingInstallers.java | 47 ++---
.../fixture/dom/simple/SimpleObjectCreate.java | 71 +++++++
.../dom/simple/SimpleObjectsTearDown.java | 36 ++++
.../modules/simple/SimpleObjectCreate.java | 71 -------
.../modules/simple/SimpleObjectsTearDown.java | 36 ----
.../scenarios/RecreateSimpleObjects.java | 4 +-
.../bootstrap/SimpleAppSystemInitializer.java | 2 +-
.../modules/simple/SimpleObjectsIntegTest.java | 2 +-
10 files changed, 298 insertions(+), 282 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/isis/blob/d5f4482f/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisComponentProviderDefault.java
----------------------------------------------------------------------
diff --git a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisComponentProviderDefault.java b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisComponentProviderDefault.java
index a6e677c..2df42a0 100644
--- a/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisComponentProviderDefault.java
+++ b/core/integtestsupport/src/main/java/org/apache/isis/core/integtestsupport/IsisComponentProviderDefault.java
@@ -26,6 +26,7 @@ import java.util.Set;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
+import org.apache.isis.applib.GlobSpec;
import org.apache.isis.core.commons.config.IsisConfiguration;
import org.apache.isis.core.commons.config.IsisConfigurationDefault;
import org.apache.isis.core.commons.resource.ResourceStreamSourceContextLoaderClassPath;
@@ -60,146 +61,157 @@ import org.apache.isis.progmodels.dflt.ProgrammingModelFacetsJava5;
public class IsisComponentProviderDefault implements IsisComponentProvider {
private final DeploymentType deploymentType;
+ private final GlobSpec globSpecIfAny;
private final IsisConfiguration configuration;
- private final List<Object> servicesIfAny;
- private final ProgrammingModel programmingModelOverride;
- private final MetaModelValidator metaModelValidatorOverride;
+ private final List<Object> services;
+ private final ProgrammingModel programmingModel;
+ private final MetaModelValidator metaModelValidator;
+ private final FixturesInstaller fixturesInstaller;
+ private final AuthenticationManager authenticationManager;
+ private final AuthorizationManager authorizationManager;
public IsisComponentProviderDefault(
final DeploymentType deploymentType,
- final List<Object> services,
- final IsisConfiguration configuration,
+ final GlobSpec globSpecIfAny,
+ final List<Object> servicesOverride,
+ final IsisConfiguration configurationOverride,
final ProgrammingModel programmingModelOverride,
final MetaModelValidator metaModelValidatorOverride) {
+
this.deploymentType = deploymentType;
- this.configuration = configuration;
- this.servicesIfAny = services;
- this.programmingModelOverride = programmingModelOverride;
- this.metaModelValidatorOverride = metaModelValidatorOverride;
- }
+ this.globSpecIfAny = globSpecIfAny;
- static IsisConfiguration defaultConfiguration() {
- return new IsisConfigurationDefault(ResourceStreamSourceContextLoaderClassPath.create("config"));
- }
+ // TODO: alter behaviour accordingly if a globSpec has been provided.
+ this.configuration = elseDefault(configurationOverride);
+ this.services = elseDefault(servicesOverride, deploymentType, configuration);
+ this.programmingModel = elseDefault(programmingModelOverride, configuration);
+ this.metaModelValidator = elseDefault(metaModelValidatorOverride);
- @Override
- public DeploymentType getDeploymentType() {
- return deploymentType;
- }
+ this.fixturesInstaller = createFixturesInstaller(configuration);
+ this.authenticationManager = createAuthenticationManager(configuration);
+ this.authorizationManager = createAuthorizationManager(configuration);
+ }
/**
- * Reads <tt>isis.properties</tt> (and other optional property files) from the "config" package on the current classpath.
+ * Default will read <tt>isis.properties</tt> (and other optional property files) from the "config"
+ * package on the current classpath.
*/
- @Override
- public IsisConfiguration getConfiguration() {
- return configuration;
+ private static IsisConfiguration elseDefault(final IsisConfiguration configuration) {
+ return configuration != null
+ ? configuration
+ : new IsisConfigurationDefault(ResourceStreamSourceContextLoaderClassPath.create("config"));
}
+ private static List<Object> elseDefault(final List<Object> servicesOverride, DeploymentType deploymentType, final IsisConfiguration configuration) {
+ return servicesOverride != null
+ ? servicesOverride
+ : createDefaultServices(deploymentType, configuration);
+ }
- /**
- * Either the services explicitly provided by a constructor, otherwise reads from the configuration.
- */
- @Override
- public List<Object> obtainServices() {
- if(servicesIfAny != null) {
- return servicesIfAny;
- }
- // else
+ private static List<Object> createDefaultServices(
+ final DeploymentType deploymentType,
+ final IsisConfiguration configuration) {
final ServicesInstallerFromConfiguration servicesInstaller = new ServicesInstallerFromConfiguration();
- return servicesInstaller.getServices(getDeploymentType());
+ servicesInstaller.setConfiguration(configuration);
+ return servicesInstaller.getServices(deploymentType);
}
- /**
- * Install fixtures from configuration.
- */
- @Override
- public FixturesInstaller obtainFixturesInstaller() throws IsisSystemException {
- final FixturesInstallerFromConfiguration fixturesInstallerFromConfiguration = new FixturesInstallerFromConfiguration();
- fixturesInstallerFromConfiguration.setConfiguration(getConfiguration());
- return fixturesInstallerFromConfiguration;
- }
+ private static ProgrammingModel elseDefault(final ProgrammingModel programmingModel, final IsisConfiguration configuration) {
+ return programmingModel != null
+ ? programmingModel
+ : createDefaultProgrammingModel(configuration);
+ }
- /**
- * <p>
- * Each of the subcomponents can be overridden if required.
- *
- * @see #obtainReflectorFacetDecoratorSet()
- * @see #obtainReflectorMetaModelValidator()
- * @see #obtainReflectorProgrammingModel()
- */
- @Override
- public SpecificationLoaderSpi provideSpecificationLoaderSpi(
- DeploymentType deploymentType,
- Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException {
+ // TODO: this is duplicating logic in JavaReflectorInstallerNoDecorators; need to unify.
+ private static ProgrammingModel createDefaultProgrammingModel(final IsisConfiguration configuration) {
+ final ProgrammingModelFacetsJava5 programmingModel = new ProgrammingModelFacetsJava5();
+ ProgrammingModel.Util.includeFacetFactories(configuration, programmingModel);
+ ProgrammingModel.Util.excludeFacetFactories(configuration, programmingModel);
+ return programmingModel;
+ }
- final ProgrammingModel programmingModel = obtainReflectorProgrammingModel();
- final Set<FacetDecorator> facetDecorators = obtainReflectorFacetDecoratorSet();
- final MetaModelValidator mmv = obtainReflectorMetaModelValidator();
- final List<LayoutMetadataReader> layoutMetadataReaders = obtainLayoutMetadataReaders();
- return JavaReflectorHelper
- .createObjectReflector(programmingModel, metaModelRefiners, facetDecorators, layoutMetadataReaders, mmv,
- getConfiguration());
+ private static MetaModelValidator elseDefault(final MetaModelValidator metaModelValidator) {
+ return metaModelValidator != null
+ ? metaModelValidator
+ : new MetaModelValidatorDefault();
}
+ private static FixturesInstaller createFixturesInstaller(final IsisConfiguration configuration) {
+ final FixturesInstallerFromConfiguration fixturesInstallerFromConfiguration = new FixturesInstallerFromConfiguration();
+ fixturesInstallerFromConfiguration.setConfiguration(configuration);
+ return fixturesInstallerFromConfiguration;
+ }
- private ProgrammingModel obtainReflectorProgrammingModel() {
+ /**
+ * The standard authentication manager, configured with the default authenticator (allows all requests through).
+ */
+ private static AuthenticationManager createAuthenticationManager(final IsisConfiguration configuration) {
+ final AuthenticationManagerStandard authenticationManager = new AuthenticationManagerStandard(configuration);
+ Authenticator authenticator = new AuthenticatorBypass(configuration);
+ authenticationManager.addAuthenticator(authenticator);
+ return authenticationManager;
+ }
- if (programmingModelOverride != null) {
- return programmingModelOverride;
- }
+ /**
+ * The standard authorization manager, allowing all access.
+ */
+ private static AuthorizationManager createAuthorizationManager(final IsisConfiguration configuration) {
+ return new AuthorizationManagerStandard(configuration);
+ }
- final ProgrammingModelFacetsJava5 programmingModel = new ProgrammingModelFacetsJava5();
- // TODO: this is duplicating logic in JavaReflectorInstallerNoDecorators; need to unify.
+ @Override
+ public DeploymentType getDeploymentType() {
+ return deploymentType;
+ }
- ProgrammingModel.Util.includeFacetFactories(getConfiguration(), programmingModel);
- ProgrammingModel.Util.excludeFacetFactories(getConfiguration(), programmingModel);
- return programmingModel;
+ @Override
+ public IsisConfiguration getConfiguration() {
+ return configuration;
}
- /**
- * Optional hook method.
- */
- private Set<FacetDecorator> obtainReflectorFacetDecoratorSet() {
- return Sets.newHashSet((FacetDecorator) new StandardTransactionFacetDecorator(getConfiguration()));
+ @Override
+ public List<Object> obtainServices() {
+ return services;
}
- /**
- * Optional hook method.
- */
- protected MetaModelValidator obtainReflectorMetaModelValidator() {
- if(metaModelValidatorOverride != null) {
- return metaModelValidatorOverride;
- }
- return new MetaModelValidatorDefault();
+ @Override
+ public FixturesInstaller obtainFixturesInstaller() throws IsisSystemException {
+ return fixturesInstaller;
}
- protected List<LayoutMetadataReader> obtainLayoutMetadataReaders() {
- return Lists.<LayoutMetadataReader>newArrayList(new LayoutMetadataReaderFromJson());
+ @Override
+ public SpecificationLoaderSpi provideSpecificationLoaderSpi(
+ DeploymentType deploymentType, // unused
+ Collection<MetaModelRefiner> metaModelRefiners) throws IsisSystemException {
+
+ final Set<FacetDecorator> facetDecorators = Sets
+ .newHashSet((FacetDecorator) new StandardTransactionFacetDecorator(getConfiguration()));
+ final List<LayoutMetadataReader> layoutMetadataReaders =
+ Lists.<LayoutMetadataReader>newArrayList(new LayoutMetadataReaderFromJson());
+
+ return JavaReflectorHelper
+ .createObjectReflector(
+ programmingModel,
+ metaModelRefiners,
+ facetDecorators, layoutMetadataReaders,
+ metaModelValidator,
+ getConfiguration());
}
- /**
- * The standard authentication manager, configured with the default authenticator (allows all requests through).
- */
@Override
public AuthenticationManager provideAuthenticationManager(DeploymentType deploymentType) throws IsisSystemException {
- final AuthenticationManagerStandard authenticationManager = new AuthenticationManagerStandard(getConfiguration());
- Authenticator authenticator = new AuthenticatorBypass(configuration);
- authenticationManager.addAuthenticator(authenticator);
return authenticationManager;
}
- /**
- * The standard authorization manager, allowing all access.
- */
@Override
public AuthorizationManager provideAuthorizationManager(DeploymentType deploymentType) {
- return new AuthorizationManagerStandard(getConfiguration());
+ return authorizationManager;
}
@Override
http://git-wip-us.apache.org/repos/asf/isis/blob/d5f4482f/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 5743b4f..949df0d 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
@@ -32,6 +32,7 @@ import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.apache.isis.applib.DomainObjectContainer;
+import org.apache.isis.applib.GlobSpec;
import org.apache.isis.applib.fixtures.FixtureClock;
import org.apache.isis.applib.fixtures.InstallableFixture;
import org.apache.isis.applib.services.command.Command;
@@ -64,7 +65,6 @@ import org.apache.isis.core.runtime.system.transaction.IsisTransactionManager;
import org.apache.isis.core.runtime.systemusinginstallers.IsisComponentProvider;
import org.apache.isis.core.security.authentication.AuthenticationRequestNameOnly;
import org.apache.isis.core.specsupport.scenarios.DomainServiceProvider;
-import org.apache.isis.objectstore.jdo.datanucleus.DataNucleusPersistenceMechanismInstaller;
/**
* Wraps a plain {@link IsisSystem}, and provides a number of features to assist with testing.
@@ -151,17 +151,17 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
private IsisSystem isisSystem;
private AuthenticationSession authenticationSession;
- private final IsisConfiguration configuration;
- private final PersistenceMechanismInstaller persistenceMechanismInstaller;
+ private final GlobSpec globSpecIfAny;
+ private final IsisConfiguration configurationOverride;
private final AuthenticationRequest authenticationRequest;
- private final List<Object> services;
+ private final List<Object> servicesIfAny;
private final List<InstallableFixture> fixtures;
private List <Listener> listeners;
private org.apache.log4j.Level level = org.apache.log4j.Level.INFO;
- private final MetaModelValidator metaModelValidator;
- private final ProgrammingModel programmingModel;
+ private final MetaModelValidator metaModelValidatorOverride;
+ private final ProgrammingModel programmingModelOverride;
private DomainObjectContainer container;
@@ -175,9 +175,10 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
private AuthenticationRequest authenticationRequest = new AuthenticationRequestNameOnly("tester");
private IsisConfigurationDefault configuration;
- private PersistenceMechanismInstaller persistenceMechanismInstaller = new DataNucleusPersistenceMechanismInstaller();
- private MetaModelValidator metaModelValidator;
- private ProgrammingModel programmingModel;
+ private GlobSpec globSpecIfAny;
+
+ private MetaModelValidator metaModelValidatorOverride;
+ private ProgrammingModel programmingModelOverride;
private final List<Object> services = Lists.newArrayList();
private final List<InstallableFixture> fixtures = Lists.newArrayList();
@@ -190,18 +191,39 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
this.configuration = (IsisConfigurationDefault) configuration;
return this;
}
-
+
+ /**
+ * @deprecated - this is now a no-op because there is now only a single implementation of {@link PersistenceMechanismInstaller}, so this is redundant.
+ */
+ @Deprecated
public Builder with(PersistenceMechanismInstaller persistenceMechanismInstaller) {
- this.persistenceMechanismInstaller = persistenceMechanismInstaller;
return this;
}
-
+
+ public Builder with(MetaModelValidator metaModelValidator) {
+ this.metaModelValidatorOverride = metaModelValidator;
+ return this;
+ }
+
+ public Builder with(ProgrammingModel programmingModel) {
+ this.programmingModelOverride = programmingModel;
+ return this;
+ }
+
public Builder with(AuthenticationRequest authenticationRequest) {
this.authenticationRequest = authenticationRequest;
return this;
}
+ public Builder with(GlobSpec globSpec) {
+ this.globSpecIfAny = globSpec;
+ return this;
+ }
+
public Builder withServicesIn(String... packagePrefixes ) {
+ if(globSpecIfAny != null) {
+ throw new IllegalStateException("A globSpec has already been provided");
+ }
if(packagePrefixes.length == 0) {
throw new IllegalArgumentException("Specify packagePrefixes to search for @DomainService-annotated services");
}
@@ -221,6 +243,9 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
}
public Builder withServices(Object... services) {
+ if(globSpecIfAny != null) {
+ throw new IllegalStateException("A globSpec has already been provided");
+ }
this.services.addAll(Arrays.asList(services));
return this;
}
@@ -242,10 +267,10 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
public IsisSystemForTest build() {
final IsisSystemForTest isisSystem =
new IsisSystemForTest(
+ globSpecIfAny,
configuration,
- programmingModel,
- metaModelValidator,
- persistenceMechanismInstaller,
+ programmingModelOverride,
+ metaModelValidatorOverride,
authenticationRequest,
services,
fixtures,
@@ -291,15 +316,6 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
return this;
}
- public Builder with(MetaModelValidator metaModelValidator) {
- this.metaModelValidator = metaModelValidator;
- return this;
- }
-
- public Builder with(ProgrammingModel programmingModel) {
- this.programmingModel = programmingModel;
- return this;
- }
}
public static Builder builder() {
@@ -307,20 +323,20 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
}
private IsisSystemForTest(
- final IsisConfiguration configuration,
- final ProgrammingModel programmingModel,
- final MetaModelValidator metaModelValidator,
- final PersistenceMechanismInstaller persistenceMechanismInstaller,
- final AuthenticationRequest authenticationRequest,
- final List<Object> services,
- final List<InstallableFixture> fixtures,
+ final GlobSpec globSpecIfAny,
+ final IsisConfiguration configurationOverride,
+ final ProgrammingModel programmingModelOverride,
+ final MetaModelValidator metaModelValidatorOverride,
+ final AuthenticationRequest authenticationRequest,
+ final List<Object> servicesIfAny,
+ final List<InstallableFixture> fixtures,
final List<Listener> listeners) {
- this.configuration = configuration;
- this.programmingModel = programmingModel;
- this.metaModelValidator = metaModelValidator;
- this.persistenceMechanismInstaller = persistenceMechanismInstaller;
+ this.globSpecIfAny = globSpecIfAny;
+ this.configurationOverride = configurationOverride;
+ this.programmingModelOverride = programmingModelOverride;
+ this.metaModelValidatorOverride = metaModelValidatorOverride;
this.authenticationRequest = authenticationRequest;
- this.services = services;
+ this.servicesIfAny = servicesIfAny;
this.fixtures = fixtures;
this.listeners = listeners;
}
@@ -369,10 +385,13 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
isisLoggingConfigurer.configureLogging(".", new String[]{});
IsisComponentProvider componentProvider = new IsisComponentProviderDefault(
- DeploymentType.UNIT_TESTING, services,
- getConfigurationElseDefault(),
- this.programmingModel,
- this.metaModelValidator);
+ DeploymentType.UNIT_TESTING,
+ globSpecIfAny,
+ servicesIfAny,
+ this.configurationOverride,
+ this.programmingModelOverride,
+ this.metaModelValidatorOverride
+ );
isisSystem = new IsisSystem(componentProvider);
@@ -396,6 +415,7 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
}
}
+
private void wireAndInstallFixtures() {
FixturesInstallerDelegate fid = new FixturesInstallerDelegate(getPersistenceSession());
fid.addFixture(fixtures);
@@ -411,7 +431,7 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
}
public DomainObjectContainer getContainer() {
- for (Object service : services) {
+ for (Object service : servicesIfAny) {
if(service instanceof DomainObjectContainer) {
return (DomainObjectContainer) service;
}
@@ -460,12 +480,6 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
IsisContext.closeSession();
}
- private IsisConfiguration getConfigurationElseDefault() {
- return configuration != null
- ? configuration
- : IsisComponentProviderDefault.defaultConfiguration();
- }
-
////////////////////////////////////////////////////////////
// listeners
////////////////////////////////////////////////////////////
@@ -473,7 +487,7 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
private void fireInitAndPreSetupSystem(boolean firstTime) throws Exception {
if(firstTime) {
for(Listener listener: listeners) {
- listener.init(configuration);
+ listener.init(configurationOverride);
}
}
for(Listener listener: listeners) {
@@ -518,9 +532,6 @@ public class IsisSystemForTest implements org.junit.rules.TestRule, DomainServic
/**
* The {@link IsisSystem} created during {@link #setUpSystem()}.
- *
- * <p>
- * Can fine-tune the actual implementation using the hook {@link #createIsisSystem(List)}.
*/
public IsisSystem getIsisSystem() {
return isisSystem;
http://git-wip-us.apache.org/repos/asf/isis/blob/d5f4482f/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProviderUsingInstallers.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProviderUsingInstallers.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProviderUsingInstallers.java
index 0b61357..c8ff7ac 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProviderUsingInstallers.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/systemusinginstallers/IsisComponentProviderUsingInstallers.java
@@ -51,7 +51,6 @@ import static org.hamcrest.CoreMatchers.nullValue;
public class IsisComponentProviderUsingInstallers implements IsisComponentProvider {
private final DeploymentType deploymentType;
- private final InstallerLookup installerLookup;
private AuthenticationManagerInstaller authenticationInstaller;
private AuthorizationManagerInstaller authorizationInstaller;
@@ -60,34 +59,37 @@ public class IsisComponentProviderUsingInstallers implements IsisComponentProvid
private PersistenceMechanismInstaller persistenceMechanismInstaller;
private FixturesInstaller fixtureInstaller;
+ private final IsisConfiguration configuration;
+
public IsisComponentProviderUsingInstallers(
final DeploymentType deploymentType,
final InstallerLookup installerLookup) {
+
this.deploymentType = deploymentType;
ensureThatArg(installerLookup, is(not(nullValue())));
- this.installerLookup = installerLookup;
- lookupAndSetInstallers(deploymentType);
- }
-
- private void lookupAndSetInstallers(final DeploymentType deploymentType) {
+ // TODO: we check for isis.globSpec, and alter the bootstrapping accordingly...
+ // loading installers causes the configuration to be appended to successively
this.authenticationInstaller = installerLookup.authenticationManagerInstaller(
- getConfiguration().getString(SystemConstants.AUTHENTICATION_INSTALLER_KEY),
+ installerLookup.getConfiguration().getString(SystemConstants.AUTHENTICATION_INSTALLER_KEY),
deploymentType);
this.authorizationInstaller = installerLookup.authorizationManagerInstaller(
- getConfiguration().getString(SystemConstants.AUTHORIZATION_INSTALLER_KEY), deploymentType);
+ installerLookup.getConfiguration().getString(SystemConstants.AUTHORIZATION_INSTALLER_KEY), deploymentType);
this.fixtureInstaller = installerLookup.fixturesInstaller(
- getConfiguration().getString(SystemConstants.FIXTURES_INSTALLER_KEY));
+ installerLookup.getConfiguration().getString(SystemConstants.FIXTURES_INSTALLER_KEY));
+ // although there is only one implementation of PersistenceMechanismInstaller, we still do the lookup
+ // because this will add the persistor_datanucleus.properties and persistor.properties to the set of
+ // config files from which we read configuration properties.
persistenceMechanismInstaller = installerLookup.persistenceMechanismInstaller(
- getConfiguration().getString(SystemConstants.OBJECT_PERSISTOR_INSTALLER_KEY),
+ installerLookup.getConfiguration().getString(SystemConstants.OBJECT_PERSISTOR_INSTALLER_KEY),
deploymentType);
reflectorInstaller = installerLookup.reflectorInstaller(
- getConfiguration().getString(SystemConstants.REFLECTOR_KEY));
+ installerLookup.getConfiguration().getString(SystemConstants.REFLECTOR_KEY));
servicesInstaller = installerLookup.servicesInstaller(null);
@@ -104,31 +106,21 @@ public class IsisComponentProviderUsingInstallers implements IsisComponentProvid
// add in transaction support
reflectorInstaller.addFacetDecoratorInstaller(transactionFacetDecoratorInstaller);
- }
- //region > API
+ // capture the final configuration once all components have been loaded
+ configuration = installerLookup.getConfiguration();
+ }
+ @Override
public DeploymentType getDeploymentType() {
return deploymentType;
}
- /**
- * Returns a <i>snapshot</i> of the {@link IsisConfiguration configuration}.
- *
- * <p>
- * ... as held by the internal {@link InstallerLookup}.
- * </p>
- *
- * @see InstallerLookup#getConfiguration()
- */
@Override
public IsisConfiguration getConfiguration() {
- return installerLookup.getConfiguration();
+ return configuration;
}
- //endregion
-
-
@Override
public AuthenticationManager provideAuthenticationManager(final DeploymentType deploymentType) {
return authenticationInstaller.createAuthenticationManager();
@@ -159,7 +151,8 @@ public class IsisComponentProviderUsingInstallers implements IsisComponentProvid
@Override
public PersistenceSessionFactory providePersistenceSessionFactory(
final DeploymentType deploymentType,
- final ServicesInjectorSpi servicesInjectorSpi, final RuntimeContextFromSession runtimeContext) throws IsisSystemException {
+ final ServicesInjectorSpi servicesInjectorSpi,
+ final RuntimeContextFromSession runtimeContext) throws IsisSystemException {
return persistenceMechanismInstaller.createPersistenceSessionFactory(deploymentType, servicesInjectorSpi, getConfiguration(),
runtimeContext);
}
http://git-wip-us.apache.org/repos/asf/isis/blob/d5f4482f/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectCreate.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectCreate.java b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectCreate.java
new file mode 100644
index 0000000..8823dd9
--- /dev/null
+++ b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectCreate.java
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package domainapp.fixture.dom.simple;
+
+import org.apache.isis.applib.fixturescripts.FixtureScript;
+
+import domainapp.dom.simple.SimpleObject;
+import domainapp.dom.simple.SimpleObjects;
+
+public class SimpleObjectCreate extends FixtureScript {
+
+ //region > name (input)
+ private String name;
+ /**
+ * Name of the object (required)
+ */
+ public String getName() {
+ return name;
+ }
+
+ public SimpleObjectCreate setName(final String name) {
+ this.name = name;
+ return this;
+ }
+ //endregion
+
+
+ //region > simpleObject (output)
+ private SimpleObject simpleObject;
+
+ /**
+ * The created simple object (output).
+ * @return
+ */
+ public SimpleObject getSimpleObject() {
+ return simpleObject;
+ }
+ //endregion
+
+ @Override
+ protected void execute(final ExecutionContext ec) {
+
+ String name = checkParam("name", ec, String.class);
+
+ this.simpleObject = wrap(simpleObjects).create(name);
+
+ // also make available to UI
+ ec.addResult(this, simpleObject);
+ }
+
+ @javax.inject.Inject
+ private SimpleObjects simpleObjects;
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/d5f4482f/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectsTearDown.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectsTearDown.java b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectsTearDown.java
new file mode 100644
index 0000000..dd74086
--- /dev/null
+++ b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/dom/simple/SimpleObjectsTearDown.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package domainapp.fixture.dom.simple;
+
+import org.apache.isis.applib.fixturescripts.FixtureScript;
+import org.apache.isis.applib.services.jdosupport.IsisJdoSupport;
+
+public class SimpleObjectsTearDown extends FixtureScript {
+
+ @Override
+ protected void execute(ExecutionContext executionContext) {
+ isisJdoSupport.executeUpdate("delete from \"simple\".\"SimpleObject\"");
+ }
+
+
+ @javax.inject.Inject
+ private IsisJdoSupport isisJdoSupport;
+
+}
http://git-wip-us.apache.org/repos/asf/isis/blob/d5f4482f/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java
deleted file mode 100644
index b23f2be..0000000
--- a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectCreate.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package domainapp.fixture.modules.simple;
-
-import org.apache.isis.applib.fixturescripts.FixtureScript;
-
-import domainapp.dom.simple.SimpleObject;
-import domainapp.dom.simple.SimpleObjects;
-
-public class SimpleObjectCreate extends FixtureScript {
-
- //region > name (input)
- private String name;
- /**
- * Name of the object (required)
- */
- public String getName() {
- return name;
- }
-
- public SimpleObjectCreate setName(final String name) {
- this.name = name;
- return this;
- }
- //endregion
-
-
- //region > simpleObject (output)
- private SimpleObject simpleObject;
-
- /**
- * The created simple object (output).
- * @return
- */
- public SimpleObject getSimpleObject() {
- return simpleObject;
- }
- //endregion
-
- @Override
- protected void execute(final ExecutionContext ec) {
-
- String name = checkParam("name", ec, String.class);
-
- this.simpleObject = wrap(simpleObjects).create(name);
-
- // also make available to UI
- ec.addResult(this, simpleObject);
- }
-
- @javax.inject.Inject
- private SimpleObjects simpleObjects;
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/d5f4482f/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java
deleted file mode 100644
index cc06eb4..0000000
--- a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/modules/simple/SimpleObjectsTearDown.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package domainapp.fixture.modules.simple;
-
-import org.apache.isis.applib.fixturescripts.FixtureScript;
-import org.apache.isis.applib.services.jdosupport.IsisJdoSupport;
-
-public class SimpleObjectsTearDown extends FixtureScript {
-
- @Override
- protected void execute(ExecutionContext executionContext) {
- isisJdoSupport.executeUpdate("delete from \"simple\".\"SimpleObject\"");
- }
-
-
- @javax.inject.Inject
- private IsisJdoSupport isisJdoSupport;
-
-}
http://git-wip-us.apache.org/repos/asf/isis/blob/d5f4482f/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java
index 6b8943b..55b9045 100644
--- a/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java
+++ b/example/application/simpleapp/fixture/src/main/java/domainapp/fixture/scenarios/RecreateSimpleObjects.java
@@ -28,8 +28,8 @@ import com.google.common.collect.Lists;
import org.apache.isis.applib.fixturescripts.FixtureScript;
import domainapp.dom.simple.SimpleObject;
-import domainapp.fixture.modules.simple.SimpleObjectCreate;
-import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
+import domainapp.fixture.dom.simple.SimpleObjectCreate;
+import domainapp.fixture.dom.simple.SimpleObjectsTearDown;
public class RecreateSimpleObjects extends FixtureScript {
http://git-wip-us.apache.org/repos/asf/isis/blob/d5f4482f/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java
index 28e9d37..91244ec 100644
--- a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java
+++ b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/bootstrap/SimpleAppSystemInitializer.java
@@ -47,7 +47,7 @@ public class SimpleAppSystemInitializer {
private static IsisConfiguration testConfiguration() {
final IsisConfigurationForJdoIntegTests testConfiguration = new IsisConfigurationForJdoIntegTests();
- testConfiguration.addRegisterEntitiesPackagePrefix("domainapp.dom.modules");
+ testConfiguration.addRegisterEntitiesPackagePrefix("domainapp.dom");
return testConfiguration;
}
}
http://git-wip-us.apache.org/repos/asf/isis/blob/d5f4482f/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java
----------------------------------------------------------------------
diff --git a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java
index db6e3c1..2ada1fe 100644
--- a/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java
+++ b/example/application/simpleapp/integtests/src/test/java/domainapp/integtests/tests/modules/simple/SimpleObjectsIntegTest.java
@@ -35,7 +35,7 @@ import org.apache.isis.applib.fixturescripts.FixtureScripts;
import domainapp.dom.simple.SimpleObject;
import domainapp.dom.simple.SimpleObjects;
-import domainapp.fixture.modules.simple.SimpleObjectsTearDown;
+import domainapp.fixture.dom.simple.SimpleObjectsTearDown;
import domainapp.fixture.scenarios.RecreateSimpleObjects;
import domainapp.integtests.tests.SimpleAppIntegTest;
import static org.assertj.core.api.Assertions.assertThat;