This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch CAUSEWAY-3866 in repository https://gitbox.apache.org/repos/asf/causeway.git
commit ac05932f5436efa35e998366d1ccd7805157651d Author: Dan Haywood <[email protected]> AuthorDate: Fri Oct 17 13:17:01 2025 +0100 CAUSEWAY-3866: removes more jdo and datanucleus references --- .../applib-classes/pages/mixees-and-mixins.adoc | 24 --- .../applib-classes/partials/module-nav.adoc | 5 - .../partials/the-theory/naked-objects-pattern.adoc | 2 +- .../applib/services/repository/EntityState.java | 17 +- core/metamodel/src/main/java/module-info.java | 7 - ...oveDatanucleusPersistableTypesFacetFactory.java | 66 ------- .../RemoveDnPrefixedMethodsFacetFactory.java | 48 ----- extensions/core/excel/integtests/translations.pot | 129 ------------- .../setup-and-configure-mavendeps-jdo.adoc | 25 --- .../incubating/log4j2-debug-persistence.xml | 28 +-- regressiontests/incubating/pom.xml | 6 - .../testdomain/shiro/AbstractShiroTest.java | 148 --------------- .../testdomain/shiro/ShiroSecmanLdapTest.java | 200 --------------------- .../shiro/ShiroSecmanLdap_restfulStressTest.java | 140 --------------- .../causeway/testdomain/shiro/ShiroSecmanTest.java | 142 --------------- .../causeway/testdomain/shiro/ShiroSimpleTest.java | 91 ---------- .../adoc/modules/starters/pages/simpleapp.adoc | 2 - testing/fakedata/integtests/translations.pot | 25 --- 18 files changed, 4 insertions(+), 1101 deletions(-) diff --git a/antora/components/refguide/modules/applib-classes/pages/mixees-and-mixins.adoc b/antora/components/refguide/modules/applib-classes/pages/mixees-and-mixins.adoc index 90060d39df3..aff8ed941cf 100644 --- a/antora/components/refguide/modules/applib-classes/pages/mixees-and-mixins.adoc +++ b/antora/components/refguide/modules/applib-classes/pages/mixees-and-mixins.adoc @@ -49,30 +49,6 @@ Two mixins contribute to this interface: These allow the view model/DTO to be seriailized, respectively, as XML and as the XSD schema for said XML. - -[[Persistable]] -== Persistable - - -All JDO domain entities implement the DataNucleus `Persistable` role interface as a result of the enhancer process (the fully qualified class name is `org.datanucleus.enhancement.Persistable`). - -Using this, the following mixins (actions and properties) are available for all JDO entities: - -* xref:refguide:persistence:index/jdo/datanucleus/mixins/Persistable_downloadJdoMetadata.adoc[Persistable_downloadJdoMetadata] - -* xref:refguide:persistence:index/jdo/datanucleus/mixins/Persistable_datanucleusVersionLong.adoc[Persistable_datanucleusVersionLong] (property) -+ -only visible if the entity is annotated with `javax.jdo.annotations.Version` and the `version` field introduced by enhancing can be cast to `Long`. - -* xref:refguide:persistence:index/jdo/datanucleus/mixins/Persistable_datanucleusVersionTimestamp.adoc[Persistable_datanucleusVersionTimestamp] (property) -+ -only visible if the entity is annotated with `javax.jdo.annotations.Version` and the `version` field introduced by enhancing can be cast to `java.sql.Timestamp`. - -As a developer you do not need to write any code to obtain the mixins that contribute to this interface. - -These mixin properties/actions are all associated with the "Metadata" fieldset. - - == Security Domain objects that are created, updated or otherwise associated with a user can implement the xref:refguide:applib:index/mixins/security/HasUsername.adoc[HasUsername] mixee interface. diff --git a/antora/components/refguide/modules/applib-classes/partials/module-nav.adoc b/antora/components/refguide/modules/applib-classes/partials/module-nav.adoc index 29f289228e1..13e4584774c 100644 --- a/antora/components/refguide/modules/applib-classes/partials/module-nav.adoc +++ b/antora/components/refguide/modules/applib-classes/partials/module-nav.adoc @@ -41,11 +41,6 @@ *** xref:refguide:applib:index/mixins/dto/Dto_downloadXml.adoc[Dto_downloadXml] *** xref:refguide:applib:index/mixins/dto/Dto_downloadXsd.adoc[Dto_downloadXsd] -*** JDO -**** xref:refguide:persistence:index/jdo/datanucleus/mixins/Persistable_downloadJdoMetadata.adoc[Persistable_downloadJdoMetadata] -**** xref:refguide:persistence:index/jdo/datanucleus/mixins/Persistable_datanucleusVersionLong.adoc[Persistable_datanucleusVersionLong] (property) -**** xref:refguide:persistence:index/jdo/datanucleus/mixins/Persistable_datanucleusVersionTimestamp.adoc[Persistable_datanucleusVersionTimestamp] (property) - *** Command Log **** xref:refguide:extensions:index/commandlog/applib/contributions/Object_recentCommands.adoc[Object_recentCommands] **** xref:refguide:extensions:index/commandlog/applib/contributions/HasInteractionId_commandLogEntry.adoc[HasInteraction_commandLogEntry] diff --git a/antora/components/userguide/modules/ROOT/partials/the-theory/naked-objects-pattern.adoc b/antora/components/userguide/modules/ROOT/partials/the-theory/naked-objects-pattern.adoc index 568d077f0c0..2327974769e 100644 --- a/antora/components/userguide/modules/ROOT/partials/the-theory/naked-objects-pattern.adoc +++ b/antora/components/userguide/modules/ROOT/partials/the-theory/naked-objects-pattern.adoc @@ -39,7 +39,7 @@ You might also want to read Richard's link:{attachmentsdir}/core-concepts/Pawson == Object Interface Mapping Another -- more technical -- way to think about the naked objects pattern is as an _object interface mapper_, or `OIM`. -Just as an ORM (such as link:http://datanucleus.org[DataNucleus] or link:http://hibernate.org[Hibernate]) maps domain entities to a database, you can think of the naked objects pattern as representing the concept of mapping domain objects to a user interface. +Just as an ORM (such as link:http://www.eclipse.dev/eclipselink.org[EclipseLink] or link:http://hibernate.org[Hibernate]) maps domain entities to a database, you can think of the naked objects pattern as representing the concept of mapping domain objects to a user interface. We sometimes use this idea to explain naked objects to a developer audience. diff --git a/api/applib/src/main/java/org/apache/causeway/applib/services/repository/EntityState.java b/api/applib/src/main/java/org/apache/causeway/applib/services/repository/EntityState.java index ccc96abfd71..174ecd1b68d 100644 --- a/api/applib/src/main/java/org/apache/causeway/applib/services/repository/EntityState.java +++ b/api/applib/src/main/java/org/apache/causeway/applib/services/repository/EntityState.java @@ -62,19 +62,7 @@ public enum EntityState { */ DETACHED(true), /** - * This entity state is not<h1>JDO specific</h1> - * Object with this state is an entity that no longer attached to a - * persistence session and cannot be re-attached. - * In other words: changes to the entity will <i>not</i> - * be tracked nor flushed back to the database. - * <p> - * JDO distinguishes between DETACHED and HOLLOW, - * by virtue of {@code javax.jdo.option.detachAllOnCommit=false}. - * <p> - * (Unfortunately, we have not found a way to recover _OIDs_ from _hollow_ entities, as used for serialization post commit. - * We have instead implemented a workaround using the <code>DnStateManagerForHollow</code> class). - * - * @see "https://www.datanucleus.org/products/accessplatform_6_0/jdo/persistence.html#lifecycle" + * @deprecated - This entity state is no longer in use; was specific to JDO/DataNucleus object store, now retired. */ @Deprecated // JDO specific HOLLOW(true), @@ -85,8 +73,7 @@ public enum EntityState { */ TRANSIENT_OR_REMOVED(false), /** - * <h1>JDO specific</h1> - * Not supported by JPA. (Cannot distinguish between TRANSIENT and REMOVED.) + * @deprecated - This entity state is no longer in use; was specific to JDO/DataNucleus object store, now retired. */ @Deprecated // JDO specific REMOVED(false) diff --git a/core/metamodel/src/main/java/module-info.java b/core/metamodel/src/main/java/module-info.java index 8731f9e0390..bce3eed5164 100644 --- a/core/metamodel/src/main/java/module-info.java +++ b/core/metamodel/src/main/java/module-info.java @@ -73,13 +73,6 @@ exports org.apache.causeway.core.metamodel.facets.properties.update.modify; exports org.apache.causeway.core.metamodel.facets.value.semantics; - exports org.apache.causeway.core.metamodel.facets.object.parented - to org.apache.causeway.persistence.jdo.metamodel; - exports org.apache.causeway.core.metamodel.facets.object.ignore.datanucleus - to org.apache.causeway.persistence.jdo.metamodel; - exports org.apache.causeway.core.metamodel.facets.object.ignore.jdo - to org.apache.causeway.persistence.jdo.metamodel; - exports org.apache.causeway.core.metamodel.interactions; exports org.apache.causeway.core.metamodel.interactions.acc; exports org.apache.causeway.core.metamodel.interactions.managed; diff --git a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/ignore/datanucleus/RemoveDatanucleusPersistableTypesFacetFactory.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/ignore/datanucleus/RemoveDatanucleusPersistableTypesFacetFactory.java deleted file mode 100644 index be8b1249fd9..00000000000 --- a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/ignore/datanucleus/RemoveDatanucleusPersistableTypesFacetFactory.java +++ /dev/null @@ -1,66 +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 org.apache.causeway.core.metamodel.facets.object.ignore.datanucleus; - -import java.util.List; - -import jakarta.inject.Inject; - -import org.apache.causeway.commons.internal.collections._Lists; -import org.apache.causeway.commons.internal.factory._InstanceUtil; -import org.apache.causeway.commons.internal.reflection._GenericResolver.ResolvedMethod; -import org.apache.causeway.core.metamodel.context.MetaModelContext; -import org.apache.causeway.core.metamodel.facetapi.FeatureType; -import org.apache.causeway.core.metamodel.facets.FacetFactoryAbstract; - -/** - * Removes all methods inherited from <tt>org.datanucleus.enhancement.Persistable</tt> (if datanucleus 4.1.x is on the classpath). - */ -public class RemoveDatanucleusPersistableTypesFacetFactory -extends FacetFactoryAbstract { - - private final List<ResolvedMethod> datanucleusPersistableMethodsToIgnore = _Lists.newArrayList(); - - @Inject - public RemoveDatanucleusPersistableTypesFacetFactory(final MetaModelContext mmc) { - super(mmc, FeatureType.OBJECTS_ONLY); - - final String typeToIgnoreIfOnClasspath = "org.datanucleus.enhancement.Persistable"; - try { - Class<?> typeToIgnore = _InstanceUtil.loadClass(typeToIgnoreIfOnClasspath); - addMethodsToBeIgnored(typeToIgnore); - } catch(Exception ex) { - // ignore - } - } - - private void addMethodsToBeIgnored(final Class<?> typeToIgnore) { - getClassCache() - .streamPublicMethods(typeToIgnore) - .forEach(datanucleusPersistableMethodsToIgnore::add); - } - - @Override - public void process(final ProcessClassContext processClassContext) { - for (final ResolvedMethod mapt : datanucleusPersistableMethodsToIgnore) { - processClassContext.removeMethod(mapt.name(), null, mapt.paramTypes()); - } - } - -} diff --git a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/ignore/datanucleus/RemoveDnPrefixedMethodsFacetFactory.java b/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/ignore/datanucleus/RemoveDnPrefixedMethodsFacetFactory.java deleted file mode 100644 index b1fb58d4630..00000000000 --- a/core/metamodel/src/main/java/org/apache/causeway/core/metamodel/facets/object/ignore/datanucleus/RemoveDnPrefixedMethodsFacetFactory.java +++ /dev/null @@ -1,48 +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 org.apache.causeway.core.metamodel.facets.object.ignore.datanucleus; - -import jakarta.inject.Inject; - -import org.apache.causeway.core.metamodel.context.MetaModelContext; -import org.apache.causeway.core.metamodel.facetapi.FeatureType; -import org.apache.causeway.core.metamodel.facets.FacetFactoryAbstract; - -/** - * Removes all methods with prefix "dn" (as introduced by DataNucleus enhancement). - */ -public class RemoveDnPrefixedMethodsFacetFactory -extends FacetFactoryAbstract { - - @Inject - public RemoveDnPrefixedMethodsFacetFactory(final MetaModelContext mmc) { - super(mmc, FeatureType.OBJECTS_ONLY); - } - - @Override - public void process(final ProcessClassContext context) { - - getClassCache() - .streamPublicMethods(context.getCls()) - .filter(method->method.name().startsWith("dn")) - .forEach(context::removeMethod); - - } - -} diff --git a/extensions/core/excel/integtests/translations.pot b/extensions/core/excel/integtests/translations.pot index 97977bd0874..f9bac6b94a3 100644 --- a/extensions/core/excel/integtests/translations.pot +++ b/extensions/core/excel/integtests/translations.pot @@ -51,7 +51,6 @@ msgstr "" #: org.apache.causeway.applib.services.layout.Object_downloadLayoutXml#act() #: org.apache.causeway.applib.services.layout.Object_openRestApi#act() #: org.apache.causeway.applib.services.layout.Object_rebuildMetamodel#act() -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_downloadJdoMetadata#act() #: org.apache.causeway.extensions.excel.fixtures.demoapp.demomodule.contributions.ExcelDemoToDoItem_export#act() #: org.apache.causeway.extensions.excel.fixtures.demoapp.demomodule.contributions.ExcelDemoToDoItem_export2#act() msgid "Act" @@ -98,11 +97,6 @@ msgid "Attachment" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract$ChangeType#AUDIT_ENTRY -msgid "Audit Entry" -msgstr "" - - #: org.apache.causeway.extensions.excel.fixtures.demoapp.demomodule.dom.bulkupdate.BulkUpdateMenuForDemoToDoItem#bulkUpdateManager() msgid "Bulk Update Manager" msgstr "" @@ -138,21 +132,11 @@ msgid "Chores" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract#targetClass -msgid "Class" -msgstr "" - - #: org.apache.causeway.core.runtime.services.i18n.po.TranslationServicePoMenu#resetTranslationCache() msgid "Clear translation cache" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract$ChangeType#COMMAND -msgid "Command" -msgstr "" - - #: org.apache.causeway.applib.services.layout.LayoutService$Style#COMPLETE #: org.apache.causeway.extensions.excel.fixtures.demoapp.demomodule.dom.bulkupdate.BulkUpdateLineItemForDemoToDoItem#complete #: org.apache.causeway.extensions.excel.fixtures.demoapp.demomodule.dom.bulkupdate.BulkUpdateManagerForDemoToDoItem#complete @@ -230,16 +214,6 @@ msgid "Description" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract -msgid "Detail" -msgstr "" - - -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract -msgid "Domain Change" -msgstr "" - - #: org.apache.causeway.extensions.excel.fixtures.demoapp.todomodule.dom.Category$2#Domestic msgid "Domestic" msgstr "" @@ -250,11 +224,6 @@ msgid "Download Demo Pivotsheet" msgstr "" -#: org.apache.causeway.extensions.excel.fixtures.demoapp.todomodule.dom.ExcelDemoToDoItem#downloadJdoMetadata() -msgid "Download Jdo Metadata" -msgstr "" - - #: org.apache.causeway.applib.AbstractViewModel#downloadLayoutXml() #: org.apache.causeway.applib.ViewModel#downloadLayoutXml() #: org.apache.causeway.applib.domain.DomainObjectList#downloadLayoutXml() @@ -383,7 +352,6 @@ msgstr "" #: org.apache.causeway.applib.services.dto.Dto_downloadXsd#act(java.lang.String,org.apache.causeway.applib.services.jaxb.JaxbService$CausewaySchemas) #: org.apache.causeway.applib.services.layout.LayoutServiceMenu#downloadMenuBarsLayout(java.lang.String,org.apache.causeway.applib.services.menu.MenuBarsService$Type) #: org.apache.causeway.applib.services.layout.Object_downloadLayoutXml#act(java.lang.String,org.apache.causeway.applib.services.layout.LayoutService$Style) -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_downloadJdoMetadata#act(java.lang.String) msgid "File name" msgstr "" @@ -420,17 +388,6 @@ msgid "Housework" msgstr "" -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusIdLong#prop() -#: org.apache.causeway.extensions.excel.fixtures.demoapp.todomodule.dom.ExcelDemoToDoItem#datanucleusIdLong() -msgid "Id" -msgstr "" - - -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract -msgid "Identifiers" -msgstr "" - - #: org.apache.causeway.applib.services.jaxb.JaxbService$CausewaySchemas#IGNORE msgid "Ignore" msgstr "" @@ -471,18 +428,10 @@ msgid "Marketing" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract#targetAction msgid "Member" msgstr "" -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusIdLong -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusVersionLong -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusVersionTimestamp -msgid "Metadata" -msgstr "" - - #: org.apache.causeway.applib.services.layout.LayoutService$Style#MINIMAL msgid "Minimal" msgstr "" @@ -504,21 +453,11 @@ msgid "Notes" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract#targetStr -msgid "Object" -msgstr "" - - #: org.apache.causeway.applib.domain.DomainObjectList#objects msgid "Objects" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract#openTargetObject() -msgid "Open" -msgstr "" - - #: org.apache.causeway.applib.AbstractViewModel#openRestApi() #: org.apache.causeway.applib.ViewModel#openRestApi() #: org.apache.causeway.applib.domain.DomainObjectList#openRestApi() @@ -580,16 +519,6 @@ msgid "Parameters" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract#postValue -msgid "Post Value" -msgstr "" - - -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract#preValue -msgid "Pre Value" -msgstr "" - - #: org.apache.causeway.extensions.excel.fixtures.demoapp.todomodule.dom.ExcelDemoToDoItem#previousCost msgid "Previous Cost" msgstr "" @@ -615,11 +544,6 @@ msgid "Prop" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract#propertyId -msgid "Property Id" -msgstr "" - - #: org.apache.causeway.applib.services.fixturespec.FixtureScriptsDefault #: org.apache.causeway.applib.services.hsqldb.HsqlDbManagerMenu #: org.apache.causeway.applib.services.layout.LayoutServiceMenu @@ -636,16 +560,6 @@ msgid "Public" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract$ChangeType#PUBLISHED_EVENT -msgid "Published Event" -msgstr "" - - -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract$ChangeType#PUBLISHED_INTERACTION -msgid "Published Interaction" -msgstr "" - - #: org.apache.causeway.applib.AbstractViewModel#rebuildMetamodel() #: org.apache.causeway.applib.ViewModel#rebuildMetamodel() #: org.apache.causeway.applib.domain.DomainObjectList#rebuildMetamodel() @@ -760,21 +674,6 @@ msgid "Switch To Writing Translations" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract -msgid "Target" -msgstr "" - - -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract -msgid "TargetStr" -msgstr "" - - -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract#timestamp -msgid "Timestamp" -msgstr "" - - #: org.apache.causeway.extensions.excel.fixtures.demoapp.demomodule.dom.bulkupdate.BulkUpdateLineItemForDemoToDoItem#toDoItem #: org.apache.causeway.extensions.excel.fixtures.demoapp.todomodule.dom.ExcelDemoToDoItem msgid "To Do Item" @@ -796,16 +695,6 @@ msgid "To Do Items Not Yet Complete" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract#transactionId -msgid "Transaction Id" -msgstr "" - - -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract#type -msgid "Type" -msgstr "" - - #: org.apache.causeway.extensions.excel.fixtures.demoapp.todomodule.dom.ExcelDemoToDoItem#updateCosts() msgid "Update Costs" msgstr "" @@ -821,35 +710,17 @@ msgid "Upload Spreadsheet" msgstr "" -#: org.apache.causeway.objectstore.jdo.applib.service.DomainChangeJdoAbstract#user -msgid "User" -msgstr "" - - #: org.apache.causeway.applib.services.config.ConfigurationProperty#value msgid "Value" msgstr "" -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusVersionLong#prop() -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusVersionTimestamp#prop() -#: org.apache.causeway.extensions.excel.fixtures.demoapp.todomodule.dom.ExcelDemoToDoItem#datanucleusVersionLong() -#: org.apache.causeway.extensions.excel.fixtures.demoapp.todomodule.dom.ExcelDemoToDoItem#datanucleusVersionTimestamp() -msgid "Version" -msgstr "" - #: org.apache.causeway.applib.services.swagger.SwaggerService$Format#YAML msgid "Yaml" msgstr "" -#: org.apache.causeway.applib.services.layout.Object_downloadLayoutXml -#: org.apache.causeway.applib.services.layout.Object_openRestApi -#: org.apache.causeway.applib.services.layout.Object_rebuildMetamodel -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_downloadJdoMetadata -msgid "datanucleusIdLong" -msgstr "" #: org.apache.causeway.extensions.excel.fixtures.demoapp.todomodule.dom.ExcelDemoToDoItem diff --git a/mavendeps/adoc/modules/mavendeps/partials/setup-and-configure-mavendeps-jdo.adoc b/mavendeps/adoc/modules/mavendeps/partials/setup-and-configure-mavendeps-jdo.adoc deleted file mode 100644 index 71520e680db..00000000000 --- a/mavendeps/adoc/modules/mavendeps/partials/setup-and-configure-mavendeps-jdo.adoc +++ /dev/null @@ -1,25 +0,0 @@ -= Maven pom.xml - -:Notice: 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 ag [...] -:page-partial: - - -include::docs:mavendeps:partial$setup-and-configure-dependencyManagement.adoc[leveloffset=+1] - - -== Dependency - -For every Maven module that includes JDO entities, add the following dependency: - -[source,xml] -.pom.xml ----- -<dependencies> - <dependency> - <groupId>org.apache.causeway.persistence</groupId> - <artifactId>causeway-persistence-jdo-datanucleus</artifactId> - <type>pom</type> - </dependency> -</dependencies> ----- - diff --git a/regressiontests/incubating/log4j2-debug-persistence.xml b/regressiontests/incubating/log4j2-debug-persistence.xml index 1aec9b2b7bb..0bf7dc69df8 100644 --- a/regressiontests/incubating/log4j2-debug-persistence.xml +++ b/regressiontests/incubating/log4j2-debug-persistence.xml @@ -40,36 +40,10 @@ under the License. <Logger name="org.eclipse.jetty.util.component.AbstractLifeCycle" level="error" /> <Logger name="org.hibernate.validator.internal.util.Version" level="warn" /> <logger name="org.springframework.boot.actuate.endpoint.jmx" level="warn"/> - - <logger name="DataNucleus.Persistence" level="debug"/> - <logger name="DataNucleus.Transaction" level="debug"/> - <logger name="DataNucleus.Datastore.Schema" level="debug"/> - <logger name="DataNucleus.Datastore.Native" level="debug"/> - + <Root level="info"> <AppenderRef ref="Console" /> </Root> </Loggers> </Configuration> -<!-- # DataNucleus Logging Categories --> -<!-- DataNucleus.Persistence - All messages relating to the persistence process --> -<!-- DataNucleus.Transaction - All messages relating to transactions --> -<!-- DataNucleus.Connection - All messages relating to Connections. --> -<!-- DataNucleus.Query - All messages relating to queries --> -<!-- DataNucleus.Cache - All messages relating to the DataNucleus Cache --> -<!-- DataNucleus.MetaData - All messages relating to MetaData --> -<!-- DataNucleus.Datastore - All general datastore messages --> -<!-- DataNucleus.Datastore.Schema - All schema related datastore log messages --> -<!-- DataNucleus.Datastore.Persist - All datastore persistence messages --> -<!-- DataNucleus.Datastore.Retrieve - All datastore retrieval messages --> -<!-- DataNucleus.Datastore.Native - Log of all 'native' statements sent to the datastore --> -<!-- DataNucleus.General - All general operational messages --> -<!-- DataNucleus.Lifecycle - All messages relating to object lifecycle changes --> -<!-- DataNucleus.ValueGeneration - All messages relating to value generation --> -<!-- DataNucleus.Enhancer - All messages from the DataNucleus Enhancer. --> -<!-- DataNucleus.SchemaTool - All messages from DataNucleus SchemaTool --> -<!-- DataNucleus.JDO - All messages general to JDO --> -<!-- DataNucleus.JPA - All messages general to JPA --> -<!-- DataNucleus.JCA - All messages relating to Connector JCA. --> -<!-- DataNucleus.IDE - Messages from the DataNucleus IDE. --> \ No newline at end of file diff --git a/regressiontests/incubating/pom.xml b/regressiontests/incubating/pom.xml index 3d70405a6fb..a742c1b3e9e 100644 --- a/regressiontests/incubating/pom.xml +++ b/regressiontests/incubating/pom.xml @@ -58,12 +58,6 @@ <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.causeway.persistence</groupId> - <artifactId>causeway-persistence-jdo-datanucleus</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.apache.causeway.testing</groupId> <artifactId>causeway-testing-fixtures-applib</artifactId> diff --git a/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/AbstractShiroTest.java b/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/AbstractShiroTest.java deleted file mode 100644 index 483bbe078ac..00000000000 --- a/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/AbstractShiroTest.java +++ /dev/null @@ -1,148 +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 org.apache.causeway.testdomain.shiro; - -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.UnavailableSecurityManagerException; -import org.apache.shiro.config.Ini; -import org.apache.shiro.ini.IniSecurityManagerFactory; -import org.apache.shiro.lang.util.LifecycleUtils; -import org.apache.shiro.mgt.SecurityManager; -import org.apache.shiro.subject.Subject; -import org.apache.shiro.subject.support.SubjectThreadState; -import org.apache.shiro.util.ThreadContext; -import org.apache.shiro.util.ThreadState; - -import org.apache.causeway.applib.services.inject.ServiceInjector; -import org.apache.causeway.commons.internal.assertions._Assert; -//import org.apache.causeway.security.shiro.webmodule.WebModuleShiro.EnvironmentLoaderListenerForCauseway; - -import lombok.SneakyThrows; -import lombok.val; - -/** - * - * This class was initially copied over from the ApacheDS user Guide, however it has/had - * some glitches with inconsistent LocalThread (subjectThreadState) context. - * <p> - * IniSecurityManagerFactory was deprecated in Shiro 1.4, but we could not find a migration guide yet. - * - */ -@SuppressWarnings("deprecation") -class AbstractShiroTest { - - private static ThreadState subjectThreadState; - - public AbstractShiroTest() { - } - - /** - * Allows subclasses to set the currently executing {@link Subject} instance. - * - * @param subject the Subject instance - */ - protected void setSubject(final Subject subject) { - clearSubject(); - subjectThreadState = createThreadState(subject); - subjectThreadState.bind(); - } - - protected Subject getSubject() { - return SecurityUtils.getSubject(); - } - - protected ThreadState createThreadState(final Subject subject) { - return new SubjectThreadState(subject); - } - - /** - * Clears Shiro's thread state, ensuring the thread remains clean for future test execution. - */ - protected void clearSubject() { - doClearSubject(); - } - - private static void doClearSubject() { - - Subject subject = ThreadContext.getSubject(); - if(subject!=null) { - ThreadContext.unbindSubject(); - } - - if (subjectThreadState != null) { - subjectThreadState.clear(); - subjectThreadState = null; - } - } - - @SneakyThrows - protected static void setSecurityManager(final ServiceInjector serviceInjector, final String iniResource) { - - val ini = Ini.fromResourcePath(iniResource); - val factory = new IniSecurityManagerFactory(ini); - val securityManager = factory.getInstance(); - - /*TODO[ISIS-3275] shiro-web no jakarta API support - val listener = new EnvironmentLoaderListenerForCauseway(serviceInjector); - listener.injectServicesIntoRealms(securityManager); - */ - -//debug -// ini.getSections().forEach(section->{ -// section.entrySet().forEach(es->{ -// System.out.println("" + es.getKey() + "=" +es.getValue()); -// }); -// }); - - setSecurityManager(securityManager); - } - - protected static void setSecurityManager(final SecurityManager securityManager) { - try { - // guard against SecurityManager already being set - getSecurityManager(); - throw new IllegalStateException("It seems a previous test, did not cleanup the its SecurityManager."); - } catch (UnavailableSecurityManagerException e) { - // happy case, fall through - } - SecurityUtils.setSecurityManager(securityManager); - - _Assert.assertEquals(securityManager, SecurityUtils.getSecurityManager(), "expected same object"); - } - - protected static SecurityManager getSecurityManager() { - return SecurityUtils.getSecurityManager(); - } - - public static void tearDownShiro() { - doClearSubject(); - try { - SecurityManager securityManager = getSecurityManager(); - LifecycleUtils.destroy(securityManager); - } catch (UnavailableSecurityManagerException e) { - //we don't care about this when cleaning up the test environment - //(for example, maybe the subclass is a unit test and it didn't - // need a SecurityManager instance because it was using only - // mock Subject instances) - } - SecurityUtils.setSecurityManager(null); - - } - -} diff --git a/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSecmanLdapTest.java b/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSecmanLdapTest.java deleted file mode 100644 index 38c56a72a64..00000000000 --- a/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSecmanLdapTest.java +++ /dev/null @@ -1,200 +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 org.apache.causeway.testdomain.shiro; - -import jakarta.inject.Inject; - -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.authc.CredentialsException; -import org.apache.shiro.authc.DisabledAccountException; -import org.apache.shiro.authc.UsernamePasswordToken; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.PropertySource; -import org.springframework.context.annotation.PropertySources; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertThrows; - -import org.apache.causeway.applib.services.inject.ServiceInjector; -import org.apache.causeway.core.config.presets.CausewayPresets; -import org.apache.causeway.extensions.secman.delegated.shiro.realm.CausewayModuleExtSecmanShiroRealm; -import org.apache.causeway.extensions.secman.encryption.spring.CausewayModuleExtSecmanEncryptionSpring; -import org.apache.causeway.extensions.secman.integration.CausewayModuleExtSecmanIntegration; -import org.apache.causeway.extensions.secman.jdo.CausewayModuleExtSecmanPersistenceJdo; -import org.apache.causeway.extensions.secman.jdo.role.dom.ApplicationRoleRepository; -import org.apache.causeway.extensions.secman.jdo.user.dom.ApplicationUserRepository; -import org.apache.causeway.testdomain.conf.Configuration_usingJdoAndShiro; -import org.apache.causeway.testdomain.jdo.JdoTestDomainPersona; -import org.apache.causeway.testdomain.ldap.LdapConstants; -import org.apache.causeway.testdomain.ldap.LdapServerService; -import org.apache.causeway.testing.fixtures.applib.fixturescripts.FixtureScripts; - -import lombok.val; - -@SpringBootTest( - classes = { - Configuration_usingJdoAndShiro.class, - }, - properties = { - //"logging.config=log4j2-test.xml", - "logging.config=log4j2-debug-persistence.xml", - //CausewayPresets.DebugPersistence, - //"datanucleus.schema.autoCreateDatabase=true", - }) -@Import({ - - // Embedded LDAP server for testing - LdapServerService.class, - - // Security Manager Extension (secman) - CausewayModuleExtSecmanIntegration.class, - CausewayModuleExtSecmanShiroRealm.class, - CausewayModuleExtSecmanPersistenceJdo.class, - CausewayModuleExtSecmanEncryptionSpring.class, -}) -@PropertySources({ - @PropertySource(CausewayPresets.DatanucleusAutocreateNoValidate) -}) -class ShiroSecmanLdapTest extends AbstractShiroTest { - - @Inject FixtureScripts fixtureScripts; - @Inject LdapServerService ldapServerService; - @Inject ApplicationUserRepository applicationUserRepository; - @Inject ApplicationRoleRepository applicationRoleRepository; - //@Inject SecmanConfiguration securityConfig; - @Inject ServiceInjector serviceInjector; - - @BeforeEach - void beforeEach() { - - setSecurityManager(serviceInjector, "classpath:shiro-secman-ldap.ini"); - - // given - fixtureScripts.runPersona(JdoTestDomainPersona.SvenApplicationUser); - } - - @AfterEach - void afterEach() { - tearDownShiro(); - } - - @Test - void loginLogoutRoundtrip() { - - val secMan = SecurityUtils.getSecurityManager(); - assertNotNull(secMan); - - val subject = SecurityUtils.getSubject(); - assertNotNull(subject); - assertFalse(subject.isAuthenticated()); - - val token = new UsernamePasswordToken( - LdapConstants.SVEN_PRINCIPAL, - "pass"); - - subject.login(token); - assertTrue(subject.isAuthenticated()); - - subject.logout(); - assertFalse(subject.isAuthenticated()); - - } - - @Test - void login_withAccountOnlyKnownToLdap() { - - val secMan = getSecurityManager(); - assertNotNull(secMan); - - val subject = SecurityUtils.getSubject(); - assertNotNull(subject); - assertFalse(subject.isAuthenticated()); - - val username = LdapConstants.OLAF_PRINCIPAL; - val token = new UsernamePasswordToken( - username, - "pass"); - - // default behavior is to create the account within the DB but leave it disabled - assertThrows(DisabledAccountException.class, ()->{ - subject.login(token); - }); - - val olafUser = applicationUserRepository.findByUsername(username).orElse(null); - assertNotNull(olafUser); - assertNotNull(olafUser.getStatus()); - assertFalse(olafUser.getStatus().isUnlocked()); - } - - @Test - void login_withInvalidPassword() { - - val secMan = SecurityUtils.getSecurityManager(); - assertNotNull(secMan); - - val subject = SecurityUtils.getSubject(); - assertNotNull(subject); - assertFalse(subject.isAuthenticated()); - - val token = new UsernamePasswordToken( - LdapConstants.SVEN_PRINCIPAL, - "invalid-pass"); - - assertThrows(CredentialsException.class, ()->{ - subject.login(token); - }); - - assertFalse(subject.isAuthenticated()); - - } - - @Test - void login_withNonExistentUser() { - - val secMan = SecurityUtils.getSecurityManager(); - assertNotNull(secMan); - - val subject = SecurityUtils.getSubject(); - assertNotNull(subject); - assertFalse(subject.isAuthenticated()); - - val username = "non-existent-user"; - val token = new UsernamePasswordToken( - username, - "invalid-pass"); - - assertThrows(CredentialsException.class, ()->{ - subject.login(token); - }); - - assertFalse(subject.isAuthenticated()); - - val nonUser = applicationUserRepository.findByUsername(username); - assertNull(nonUser); - - } - -} diff --git a/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSecmanLdap_restfulStressTest.java b/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSecmanLdap_restfulStressTest.java deleted file mode 100644 index fb3615aaaf7..00000000000 --- a/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSecmanLdap_restfulStressTest.java +++ /dev/null @@ -1,140 +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 org.apache.causeway.testdomain.shiro; - -import static java.time.Duration.ofMillis; - -import jakarta.inject.Inject; - -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.PropertySource; -import org.springframework.context.annotation.PropertySources; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTimeout; - -import org.apache.causeway.applib.services.inject.ServiceInjector; -import org.apache.causeway.core.config.presets.CausewayPresets; -import org.apache.causeway.extensions.secman.delegated.shiro.realm.CausewayModuleExtSecmanShiroRealm; -import org.apache.causeway.extensions.secman.encryption.spring.CausewayModuleExtSecmanEncryptionSpring; -import org.apache.causeway.extensions.secman.integration.CausewayModuleExtSecmanIntegration; -import org.apache.causeway.extensions.secman.jdo.CausewayModuleExtSecmanPersistenceJdo; -import org.apache.causeway.security.shiro.webmodule.WebModuleShiro; -import org.apache.causeway.testdomain.conf.Configuration_usingJdoAndShiro; -import org.apache.causeway.testdomain.jdo.JdoTestDomainPersona; -import org.apache.causeway.testdomain.ldap.LdapServerService; -import org.apache.causeway.testdomain.util.rest.RestEndpointService; -import org.apache.causeway.testing.fixtures.applib.fixturescripts.FixtureScripts; -import org.apache.causeway.viewer.restfulobjects.viewer.CausewayModuleViewerRestfulObjectsViewer; - -import lombok.val; - -@SpringBootTest( - classes = { - Configuration_usingJdoAndShiro.class - }, - properties = { - //"logging.config=log4j2-test.xml", - "logging.config=log4j2-debug-persistence.xml", - "server.servlet.session.persistent=false", // defaults to false - }, - webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) -@Import({ - - // Restful server - CausewayModuleViewerRestfulObjectsViewer.class, - RestEndpointService.class, - - // Embedded LDAP server for testing - LdapServerService.class, - - // Security Manager Extension (secman) - CausewayModuleExtSecmanIntegration.class, - CausewayModuleExtSecmanShiroRealm.class, - CausewayModuleExtSecmanPersistenceJdo.class, - CausewayModuleExtSecmanEncryptionSpring.class, -}) -@PropertySources({ - @PropertySource(CausewayPresets.DatanucleusAutocreateNoValidate) -}) -//XXX "does not work, when executed in sequence with other regressiontests -class ShiroSecmanLdap_restfulStressTest extends AbstractShiroTest { - - @Inject FixtureScripts fixtureScripts; - @Inject RestEndpointService restService; - @Inject LdapServerService ldapServerService; -// @Inject ApplicationUserRepository applicationUserRepository; -// @Inject ApplicationRoleRepository applicationRoleRepository; -// @Inject SecmanConfiguration securityConfig; - @Inject ServiceInjector serviceInjector; - - @BeforeAll - static void setup() { - WebModuleShiro.setShiroIniResource("classpath:shiro-secman-ldap.ini"); - } - - @BeforeEach - void beforeEach() { - - setSecurityManager(serviceInjector, "classpath:shiro-secman-ldap.ini"); - - // given - fixtureScripts.runPersona(JdoTestDomainPersona.SvenApplicationUser); - } - - @AfterEach - void afterEach() { - tearDownShiro(); - } - - @Test - void stressTheRestEndpoint() { - - val useRequestDebugLogging = false; - val restfulClient = restService.newClient(useRequestDebugLogging); - - assertTimeout(ofMillis(5000), ()->{ - - for(int i=0; i<100; ++i) { - val digest = restService.getHttpSessionInfo(restfulClient) - .ifFailure(Assertions::fail); - - val httpSessionInfo = digest.getValue().orElseThrow(); - - assertNotNull(httpSessionInfo); - - // impersonation in UserService means that we _do_ now get - // an httpSession as a side-effect - //assertEquals("no http-session", httpSessionInfo); - assertEquals("http-session attribute names: {}", httpSessionInfo); - - } - - }); - - } - -} diff --git a/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSecmanTest.java b/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSecmanTest.java deleted file mode 100644 index 462059b8285..00000000000 --- a/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSecmanTest.java +++ /dev/null @@ -1,142 +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 org.apache.causeway.testdomain.shiro; - -import jakarta.inject.Inject; - -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.authc.CredentialsException; -import org.apache.shiro.authc.UsernamePasswordToken; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.TestPropertySource; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.jupiter.api.Assertions.assertThrows; - -import org.apache.causeway.applib.services.inject.ServiceInjector; -import org.apache.causeway.core.config.CausewayConfiguration; -import org.apache.causeway.core.config.presets.CausewayPresets; -import org.apache.causeway.extensions.secman.delegated.shiro.realm.CausewayModuleExtSecmanShiroRealm; -import org.apache.causeway.extensions.secman.encryption.spring.CausewayModuleExtSecmanEncryptionSpring; -import org.apache.causeway.extensions.secman.integration.CausewayModuleExtSecmanIntegration; -import org.apache.causeway.extensions.secman.jdo.CausewayModuleExtSecmanPersistenceJdo; -import org.apache.causeway.testdomain.conf.Configuration_usingJdoAndShiro; - -import lombok.val; - -@SpringBootTest( - classes = { - Configuration_usingJdoAndShiro.class, - }) -@Import({ - // Security Manager Extension (secman) - CausewayModuleExtSecmanIntegration.class, - CausewayModuleExtSecmanShiroRealm.class, - CausewayModuleExtSecmanPersistenceJdo.class, - CausewayModuleExtSecmanEncryptionSpring.class, -}) -@TestPropertySource(CausewayPresets.UseLog4j2Test) -class ShiroSecmanTest extends AbstractShiroTest { - - @Inject CausewayConfiguration causewayConfig; - @Inject ServiceInjector serviceInjector; - - @BeforeEach - void beforeEach() { - setSecurityManager(serviceInjector, "classpath:shiro-secman-ldap.ini"); - } - - @AfterEach - void afterEach() { - tearDownShiro(); - } - - @Test - void loginLogoutRoundtrip() { - - val secMan = getSecurityManager(); - assertNotNull(secMan); - - val subject = SecurityUtils.getSubject(); - assertNotNull(subject); - assertFalse(subject.isAuthenticated()); - - val token = new UsernamePasswordToken( - causewayConfig.getExtensions().getSecman().getSeed().getAdmin().getUserName(), - causewayConfig.getExtensions().getSecman().getSeed().getAdmin().getPassword()); - - subject.login(token); - assertTrue(subject.isAuthenticated()); - - subject.logout(); - assertFalse(subject.isAuthenticated()); - - } - - @Test - void login_withInvalidPassword() { - - val secMan = SecurityUtils.getSecurityManager(); - assertNotNull(secMan); - - val subject = SecurityUtils.getSubject(); - assertNotNull(subject); - assertFalse(subject.isAuthenticated()); - - val token = new UsernamePasswordToken( - causewayConfig.getExtensions().getSecman().getSeed().getAdmin().getUserName(), - "invalid-pass"); - - assertThrows(CredentialsException.class, ()->{ - subject.login(token); - }); - - assertFalse(subject.isAuthenticated()); - - } - - @Test - void login_withNonExistentUser() { - - val secMan = SecurityUtils.getSecurityManager(); - assertNotNull(secMan); - - val subject = SecurityUtils.getSubject(); - assertNotNull(subject); - assertFalse(subject.isAuthenticated()); - - val token = new UsernamePasswordToken( - "non-existent-user", - "invalid-pass"); - - assertThrows(CredentialsException.class, ()->{ - subject.login(token); - }); - - assertFalse(subject.isAuthenticated()); - - } - -} diff --git a/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSimpleTest.java b/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSimpleTest.java deleted file mode 100644 index ee134252a15..00000000000 --- a/regressiontests/incubating/src/test/java/org/apache/causeway/testdomain/shiro/ShiroSimpleTest.java +++ /dev/null @@ -1,91 +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 org.apache.causeway.testdomain.shiro; - -import org.apache.shiro.SecurityUtils; -import org.apache.shiro.authc.AuthenticationToken; -import org.apache.shiro.authc.UsernamePasswordToken; -import org.apache.shiro.subject.Subject; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.apache.causeway.applib.services.inject.ServiceInjector; - -import lombok.val; - -class ShiroSimpleTest extends AbstractShiroTest { - - @BeforeAll - static void beforeClass() { - - val serviceInjector = Mockito.mock(ServiceInjector.class); - - //0. Build and set the SecurityManager used to build Subject instances used in your tests - // This typically only needs to be done once per class if your shiro.ini doesn't change, - // otherwise, you'll need to do this logic in each test that is different - setSecurityManager(serviceInjector, "classpath:shiro-simple.ini"); - } - - @AfterAll - static void tearDownSubject() { - tearDownShiro(); - } - - @BeforeEach - void setUp() { - //1. Build the Subject instance for the test to run: - val subjectUnderTest = new Subject.Builder(getSecurityManager()).buildSubject(); - //2. Bind the subject to the current thread: - setSubject(subjectUnderTest); - } - - @AfterEach - void cleanUp() { - //3. Unbind the subject from the current thread: - clearSubject(); - } - - @Test - void loginLogoutRoundtrip() { - - val secMan = SecurityUtils.getSecurityManager(); - assertNotNull(secMan); - - val subject = SecurityUtils.getSubject(); - assertNotNull(subject); - assertFalse(subject.isAuthenticated()); - - val token = (AuthenticationToken) new UsernamePasswordToken("sven", "pass"); - subject.login(token); - assertTrue(subject.isAuthenticated()); - - subject.logout(); - assertFalse(subject.isAuthenticated()); - - } - -} diff --git a/starters/adoc/modules/starters/pages/simpleapp.adoc b/starters/adoc/modules/starters/pages/simpleapp.adoc index 34969fa272b..a5c6b6f4081 100644 --- a/starters/adoc/modules/starters/pages/simpleapp.adoc +++ b/starters/adoc/modules/starters/pages/simpleapp.adoc @@ -1045,8 +1045,6 @@ spring.datasource.password=simpleapp #causeway.persistence.schema.create-schema-sql-template= (use flyway instead) causeway.persistence.schema.auto-create-schemas= -# DataNucleus, and must use camelCase rather than kebab-case -datanucleus.schema.autoCreateAll=false ---- Flyway in turn reads the migration scripts under `db.migration` package (in `src/main/resources` of the `webapp` module). diff --git a/testing/fakedata/integtests/translations.pot b/testing/fakedata/integtests/translations.pot index a75e53bf4df..3714893d6bc 100644 --- a/testing/fakedata/integtests/translations.pot +++ b/testing/fakedata/integtests/translations.pot @@ -246,9 +246,7 @@ msgid "HSQL DB Manager" msgstr "" -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusIdLong#prop() #: org.causewayaddons.module.fakedata.fixture.demoapp.demomodule.dom.FakeDataDemoObjectWithAll -#: org.causewayaddons.module.fakedata.fixture.demoapp.demomodule.dom.FakeDataDemoObjectWithAll#datanucleusIdLong() msgid "Id" msgstr "" @@ -298,13 +296,6 @@ msgid "Member" msgstr "" -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusIdLong -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusVersionLong -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusVersionTimestamp -msgid "Metadata" -msgstr "" - - #: org.apache.causeway.applib.services.layout.LayoutService$Style#MINIMAL msgid "Minimal" msgstr "" @@ -788,14 +779,6 @@ msgid "Value" msgstr "" -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusVersionLong#prop() -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_datanucleusVersionTimestamp#prop() -#: org.causewayaddons.module.fakedata.fixture.demoapp.demomodule.dom.FakeDataDemoObjectWithAll#datanucleusVersionLong() -#: org.causewayaddons.module.fakedata.fixture.demoapp.demomodule.dom.FakeDataDemoObjectWithAll#datanucleusVersionTimestamp() -msgid "Version" -msgstr "" - - #: org.causewayaddons.module.fakedata.fixture.demoapp.demomodule.dom.EnumOf3#VISA msgid "Visa" msgstr "" @@ -811,14 +794,6 @@ msgid "Yaml" msgstr "" -#: org.apache.causeway.applib.services.layout.Object_downloadLayoutXml -#: org.apache.causeway.applib.services.layout.Object_openRestApi -#: org.apache.causeway.applib.services.layout.Object_rebuildMetamodel -#: org.apache.causeway.core.metamodel.services.jdosupport.Persistable_downloadJdoMetadata -msgid "datanucleusIdLong" -msgstr "" - - #: org.causewayaddons.module.fakedata.fixture.demoapp.demomodule.dom.FakeDataDemoObjectWithAll#someInt msgid "description of some int" msgstr ""
