You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by dk...@apache.org on 2020/08/21 01:45:29 UTC

[sling-org-apache-sling-app-cms] branch SLING-8913-multiple-instance-types updated (5d225b9 -> c115e06)

This is an automated email from the ASF dual-hosted git repository.

dklco pushed a change to branch SLING-8913-multiple-instance-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git.


    from 5d225b9  Fixing baseline and provisioning build issues
     new b7934d6  Minor -test improvements
     new c115e06  Updating to clean up the code around publishable resources including pages and files

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/sling/cms/CMSConstants.java    |  16 +-
 .../org/apache/sling/cms/PublishableResource.java  |   7 +
 .../sling/cms/publication/PublicationManager.java  |   4 +-
 .../sling/cms/core/internal/models/FileImpl.java   | 162 +---------
 .../sling/cms/core/internal/models/PageImpl.java   | 170 +---------
 ...{FileImpl.java => PublishableResourceImpl.java} | 107 +++---
 .../sling/cms/core/helpers/SlingCMSTestHelper.java |   2 +
 .../cms/core/internal/models/FileImplTest.java     |  25 +-
 .../cms/core/internal/models/PageImplTest.java     |  29 +-
 .../models/PublishableResourceImplTest.java        |  72 +++++
 .../internal/servlets/DownloadFileServletTest.java |   8 +-
 core/src/test/resources/conf.json                  | 357 +++++++++++++++++++++
 core/src/test/resources/content.json               |  11 +-
 core/src/test/resources/etc.json                   | 291 +++++++++++++++++
 .../resources/SLING-INF/nodetypes/nodetypes.cnd    |  37 +--
 15 files changed, 871 insertions(+), 427 deletions(-)
 copy core/src/main/java/org/apache/sling/cms/core/internal/models/{FileImpl.java => PublishableResourceImpl.java} (60%)
 copy archetype/src/main/resources/archetype-resources/src/test/java/__package__/HelloWorldModelTest.java => core/src/test/java/org/apache/sling/cms/core/internal/models/FileImplTest.java (68%)
 copy archetype/src/main/resources/archetype-resources/src/test/java/__package__/HelloWorldModelTest.java => core/src/test/java/org/apache/sling/cms/core/internal/models/PageImplTest.java (60%)
 create mode 100644 core/src/test/java/org/apache/sling/cms/core/internal/models/PublishableResourceImplTest.java
 create mode 100644 core/src/test/resources/conf.json
 create mode 100644 core/src/test/resources/etc.json


[sling-org-apache-sling-app-cms] 02/02: Updating to clean up the code around publishable resources including pages and files

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch SLING-8913-multiple-instance-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit c115e068225bf3ffa5c797f2e7deb925c579669c
Author: Dan Klco <dk...@apache.org>
AuthorDate: Thu Aug 20 21:45:16 2020 -0400

    Updating to clean up the code around publishable resources including pages and files
---
 .../java/org/apache/sling/cms/CMSConstants.java    |  16 +-
 .../org/apache/sling/cms/PublishableResource.java  |   7 +
 .../sling/cms/publication/PublicationManager.java  |   4 +-
 .../sling/cms/core/internal/models/FileImpl.java   | 162 +---------
 .../sling/cms/core/internal/models/PageImpl.java   | 170 +---------
 ...{FileImpl.java => PublishableResourceImpl.java} | 107 +++---
 .../sling/cms/core/helpers/SlingCMSTestHelper.java |   2 +
 .../cms/core/internal/models/FileImplTest.java     |  48 +++
 .../cms/core/internal/models/PageImplTest.java     |  52 +++
 .../models/PublishableResourceImplTest.java        |  72 +++++
 core/src/test/resources/conf.json                  | 357 +++++++++++++++++++++
 core/src/test/resources/content.json               |  11 +-
 core/src/test/resources/etc.json                   | 291 +++++++++++++++++
 .../resources/SLING-INF/nodetypes/nodetypes.cnd    |  37 +--
 14 files changed, 935 insertions(+), 401 deletions(-)

diff --git a/api/src/main/java/org/apache/sling/cms/CMSConstants.java b/api/src/main/java/org/apache/sling/cms/CMSConstants.java
index 621ea94..68eb3db 100644
--- a/api/src/main/java/org/apache/sling/cms/CMSConstants.java
+++ b/api/src/main/java/org/apache/sling/cms/CMSConstants.java
@@ -112,17 +112,21 @@ public class CMSConstants {
     /**
      * Published flag property
      */
-    public static final String PN_PUBLISHED = "published";
+    public static final String PN_PUBLISHED = "sling:published";
 
     /**
      * The last time the page was published
      */
-    public static final String PN_LAST_PUBLICATION = "lastPublication";
+    public static final String PN_LAST_PUBLICATION = "sling:lastPublication";
+    /**
+     * The last time the page was published
+     */
+    public static final String PN_LAST_PUBLICATION_BY = "sling:lastPublicationBy";
 
     /**
      * The last publication action
      */
-    public static final String PN_LAST_PUBLICATION_TYPE = "lastPublicationType";
+    public static final String PN_LAST_PUBLICATION_TYPE = "sling:lastPublicationType";
 
     /**
      * Constant for the Site URL
@@ -134,6 +138,12 @@ public class CMSConstants {
      */
     public static final String PN_TAXONOMY = NAMESPACE + ":taxonomy";
 
+
+    /**
+     * Template attribute name
+     */
+    public static final String PN_TEMPLATE = NAMESPACE + ":template";
+
     /**
      * Title attribute name
      */
diff --git a/api/src/main/java/org/apache/sling/cms/PublishableResource.java b/api/src/main/java/org/apache/sling/cms/PublishableResource.java
index 4b22687..068618d 100644
--- a/api/src/main/java/org/apache/sling/cms/PublishableResource.java
+++ b/api/src/main/java/org/apache/sling/cms/PublishableResource.java
@@ -139,4 +139,11 @@ public interface PublishableResource {
      */
     Calendar getLastPublication();
 
+    /**
+     * Get the name of the user who last published the page.
+     * 
+     * @return the user name or null
+     */
+    String getLastPublicationBy();
+
 }
\ No newline at end of file
diff --git a/api/src/main/java/org/apache/sling/cms/publication/PublicationManager.java b/api/src/main/java/org/apache/sling/cms/publication/PublicationManager.java
index 0de213a..02057c6 100644
--- a/api/src/main/java/org/apache/sling/cms/publication/PublicationManager.java
+++ b/api/src/main/java/org/apache/sling/cms/publication/PublicationManager.java
@@ -17,6 +17,7 @@
 package org.apache.sling.cms.publication;
 
 import org.apache.sling.cms.PublishableResource;
+import org.jetbrains.annotations.NotNull;
 
 /**
  * Publication Manager is used to get the publication status of content and get
@@ -34,7 +35,7 @@ public interface PublicationManager {
      * @param resource the resource to publish
      * @throws PublicationException an exception occurs publishing the resource
      */
-    void publish(PublishableResource resource) throws PublicationException;
+    void publish(@NotNull PublishableResource resource) throws PublicationException;
 
     /**
      * Un-publishes the resource.
@@ -49,6 +50,7 @@ public interface PublicationManager {
      * 
      * @return the publication mode
      */
+    @NotNull
     PUBLICATION_MODE getPublicationMode();
 
 }
diff --git a/core/src/main/java/org/apache/sling/cms/core/internal/models/FileImpl.java b/core/src/main/java/org/apache/sling/cms/core/internal/models/FileImpl.java
index db3dcb8..15f6561 100644
--- a/core/src/main/java/org/apache/sling/cms/core/internal/models/FileImpl.java
+++ b/core/src/main/java/org/apache/sling/cms/core/internal/models/FileImpl.java
@@ -16,12 +16,11 @@
  */
 package org.apache.sling.cms.core.internal.models;
 
-import java.util.Calendar;
 import java.util.Map;
+import java.util.Optional;
 import java.util.TreeMap;
 
 import javax.inject.Inject;
-import javax.inject.Named;
 
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.util.Text;
@@ -30,77 +29,22 @@ import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.api.wrappers.ValueMapDecorator;
 import org.apache.sling.cms.CMSConstants;
 import org.apache.sling.cms.File;
-import org.apache.sling.cms.Site;
-import org.apache.sling.cms.SiteManager;
-import org.apache.sling.cms.publication.PublicationType;
-import org.apache.sling.models.annotations.Default;
 import org.apache.sling.models.annotations.Model;
-import org.apache.sling.models.annotations.Optional;
+import org.apache.sling.models.annotations.injectorspecific.Self;
 
 /**
  * A model representing a file
  */
 @Model(adaptables = Resource.class, adapters = File.class)
-public class FileImpl implements File {
+public class FileImpl extends PublishableResourceImpl implements File {
 
-    @Inject
-    @Optional
-    @Named("jcr:content")
-    private Resource contentResource;
-
-    @Inject
-    @Named("jcr:content/jcr:mimeType")
-    private String contentType;
-
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:created")
-    private Calendar created;
-
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:createdBy")
-    private String createdBy;
-
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:lastModified")
-    private Calendar lastModified;
-
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:lastModifiedBy")
-    private String lastModifiedBy;
-
-    @Inject
-    @Optional
-    @Named("jcr:content/lastPublication")
-    private Calendar lastPublication;
-
-    @Inject
-    @Optional
-    @Named("jcr:content/lastPublicationType")
-    @Default(values = "NONE")
-    private String lastPublicationType;
-
-    @Inject
-    @Named("jcr:content/published")
-    @Default(booleanValues = false)
-    private boolean published;
-
-    protected Resource resource;
+    private final String contentType;
 
     @Inject
-    @Named("jcr:primaryType")
-    private String type;
-
-    public FileImpl(Resource resource) {
-        this.resource = resource;
-    }
-
-    @Override
-    public Resource getContentResource() {
-        return contentResource;
+    public FileImpl(@Self Resource resource) {
+        super(resource);
+        this.contentType = Optional.ofNullable(this.getContentResource())
+                .map(r -> r.getValueMap().get(JcrConstants.JCR_MIMETYPE, String.class)).orElse(null);
     }
 
     @Override
@@ -109,36 +53,6 @@ public class FileImpl implements File {
     }
 
     @Override
-    public Calendar getCreated() {
-        return created;
-    }
-
-    @Override
-    public String getCreatedBy() {
-        return createdBy;
-    }
-
-    @Override
-    public Calendar getLastModified() {
-        return lastModified != null ? lastModified : created;
-    }
-
-    @Override
-    public String getLastModifiedBy() {
-        return lastModifiedBy != null ? lastModifiedBy : createdBy;
-    }
-
-    @Override
-    public PublicationType getLastPublicationType() {
-        return PublicationType.valueOf(lastPublicationType);
-    }
-
-    @Override
-    public Calendar getLastPublication() {
-        return lastPublication;
-    }
-
-    @Override
     public ValueMap getMetadata() {
         Resource metadata = this.getContentResource().getChild(CMSConstants.NN_METADATA);
         Map<String, Object> data = new TreeMap<>();
@@ -150,64 +64,4 @@ public class FileImpl implements File {
         return new ValueMapDecorator(data);
     }
 
-    @Override
-    public String getName() {
-        return resource.getName();
-    }
-
-    @Override
-    public Resource getParent() {
-        return resource.getParent();
-    }
-
-    @Override
-    public String getPath() {
-        return resource.getPath();
-    }
-
-    @Override
-    public ValueMap getProperties() {
-        return getContentResource().getValueMap();
-    }
-
-    @Override
-    public String getPublishedPath() {
-        Site site = getSite();
-        if (site != null) {
-            return resource.getPath().replace(site.getPath(), "");
-        } else {
-            return resource.getPath();
-        }
-    }
-
-    @Override
-    public String getPublishedUrl() {
-        Site site = getSite();
-        if (site != null) {
-            return site.getUrl() + getPublishedPath();
-        } else {
-            return resource.getPath();
-        }
-    }
-
-    @Override
-    public Resource getResource() {
-        return resource;
-    }
-
-    @Override
-    public Site getSite() {
-        SiteManager siteMgr = resource.adaptTo(SiteManager.class);
-        Site site = null;
-        if (siteMgr != null) {
-            site = siteMgr.getSite();
-        }
-        return site;
-    }
-
-    @Override
-    public boolean isPublished() {
-        return published;
-    }
-
 }
diff --git a/core/src/main/java/org/apache/sling/cms/core/internal/models/PageImpl.java b/core/src/main/java/org/apache/sling/cms/core/internal/models/PageImpl.java
index d05c740..0158870 100644
--- a/core/src/main/java/org/apache/sling/cms/core/internal/models/PageImpl.java
+++ b/core/src/main/java/org/apache/sling/cms/core/internal/models/PageImpl.java
@@ -17,14 +17,11 @@
 package org.apache.sling.cms.core.internal.models;
 
 import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.List;
 
 import javax.inject.Inject;
-import javax.inject.Named;
 
 import org.apache.commons.lang3.StringUtils;
-import org.apache.jackrabbit.JcrConstants;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.cms.CMSConstants;
@@ -32,17 +29,14 @@ import org.apache.sling.cms.CMSUtils;
 import org.apache.sling.cms.Page;
 import org.apache.sling.cms.PageTemplate;
 import org.apache.sling.cms.Site;
-import org.apache.sling.cms.SiteManager;
-import org.apache.sling.cms.publication.PublicationType;
-import org.apache.sling.models.annotations.Default;
 import org.apache.sling.models.annotations.Model;
-import org.apache.sling.models.annotations.Optional;
+import org.apache.sling.models.annotations.injectorspecific.Self;
 
 /**
  * A model representing a page.
  */
 @Model(adaptables = Resource.class, adapters = Page.class)
-public class PageImpl implements Page {
+public class PageImpl extends PublishableResourceImpl implements Page {
 
     public static final Page getContainingPage(Resource resource) {
         Resource pageRsrc = CMSUtils.findParentResourceofType(resource, CMSConstants.NT_PAGE);
@@ -53,85 +47,25 @@ public class PageImpl implements Page {
         return page;
     }
 
-    @Inject
-    @Optional
-    @Named("jcr:content")
-    private Resource contentResource;
-
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:created")
-    private Calendar created;
-
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:createdBy")
-    private String createdBy;
+    private final String[] taxonomy;
 
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:lastModified")
-    private Calendar lastModified;
+    private final String template;
 
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:lastModifiedBy")
-    private String lastModifiedBy;
+    private final String title;
 
     @Inject
-    @Optional
-    @Named("jcr:content/lastPublication")
-    private Calendar lastPublication;
-
-    @Inject
-    @Optional
-    @Named("jcr:content/lastPublicationType")
-    @Default(values = "NONE")
-    private String lastPublicationType;
-
-    @Inject
-    @Named("jcr:content/published")
-    @Default(booleanValues = false)
-    private boolean published;
-
-    protected Resource resource;
-
-    @Inject
-    @Optional
-    @Named(JcrConstants.JCR_CONTENT + "/" + CMSConstants.PN_TAXONOMY)
-    private String[] taxonomy;
-
-    @Inject
-    @Optional
-    @Named("jcr:content/sling:template")
-    private String template;
-
-    @Inject
-    @Named("jcr:content/jcr:title")
-    @Optional
-    private String title;
-
-    @Inject
-    @Named("jcr:primaryType")
-    private String type;
-
-    public PageImpl(Resource resource) {
-        this.resource = resource;
-    }
-
-    @Override
-    public Resource getContentResource() {
-        return contentResource;
-    }
-
-    @Override
-    public Calendar getCreated() {
-        return created;
-    }
-
-    @Override
-    public String getCreatedBy() {
-        return createdBy;
+    public PageImpl(@Self Resource resource) {
+        super(resource);
+        if (this.getContentResource() != null) {
+            ValueMap properties = this.getContentResource().getValueMap();
+            taxonomy = properties.get(CMSConstants.PN_TAXONOMY, String[].class);
+            template = properties.get(CMSConstants.PN_TEMPLATE, String.class);
+            title = properties.get(CMSConstants.PN_TITLE, String.class);
+        } else {
+            this.taxonomy = new String[0];
+            this.template = null;
+            this.title = null;
+        }
     }
 
     @Override
@@ -149,46 +83,6 @@ public class PageImpl implements Page {
     }
 
     @Override
-    public Calendar getLastModified() {
-        return lastModified != null ? lastModified : created;
-    }
-
-    @Override
-    public String getLastModifiedBy() {
-        return lastModifiedBy != null ? lastModifiedBy : createdBy;
-    }
-
-    @Override
-    public PublicationType getLastPublicationType() {
-        return PublicationType.valueOf(lastPublicationType);
-    }
-
-    @Override
-    public Calendar getLastPublication() {
-        return lastPublication;
-    }
-
-    @Override
-    public String getName() {
-        return resource.getName();
-    }
-
-    @Override
-    public Resource getParent() {
-        return resource.getParent();
-    }
-
-    @Override
-    public String getPath() {
-        return resource.getPath();
-    }
-
-    @Override
-    public ValueMap getProperties() {
-        return getContentResource().getValueMap();
-    }
-
-    @Override
     public String getPublishedPath() {
         Site site = getSite();
         if (site != null) {
@@ -199,31 +93,6 @@ public class PageImpl implements Page {
     }
 
     @Override
-    public String getPublishedUrl() {
-        Site site = getSite();
-        if (site != null) {
-            return site.getUrl() + getPublishedPath();
-        } else {
-            return resource.getPath();
-        }
-    }
-
-    @Override
-    public Resource getResource() {
-        return resource;
-    }
-
-    @Override
-    public Site getSite() {
-        SiteManager siteMgr = resource.adaptTo(SiteManager.class);
-        Site site = null;
-        if (siteMgr != null) {
-            site = siteMgr.getSite();
-        }
-        return site;
-    }
-
-    @Override
     public PageTemplate getTemplate() {
         Resource templateResource = this.resource.getResourceResolver().getResource(template);
         if (templateResource != null) {
@@ -246,9 +115,4 @@ public class PageImpl implements Page {
             return resource.getName();
         }
     }
-
-    @Override
-    public boolean isPublished() {
-        return published;
-    }
 }
diff --git a/core/src/main/java/org/apache/sling/cms/core/internal/models/FileImpl.java b/core/src/main/java/org/apache/sling/cms/core/internal/models/PublishableResourceImpl.java
similarity index 60%
copy from core/src/main/java/org/apache/sling/cms/core/internal/models/FileImpl.java
copy to core/src/main/java/org/apache/sling/cms/core/internal/models/PublishableResourceImpl.java
index db3dcb8..bd1366f 100644
--- a/core/src/main/java/org/apache/sling/cms/core/internal/models/FileImpl.java
+++ b/core/src/main/java/org/apache/sling/cms/core/internal/models/PublishableResourceImpl.java
@@ -17,85 +17,70 @@
 package org.apache.sling.cms.core.internal.models;
 
 import java.util.Calendar;
-import java.util.Map;
-import java.util.TreeMap;
 
 import javax.inject.Inject;
-import javax.inject.Named;
 
 import org.apache.jackrabbit.JcrConstants;
-import org.apache.jackrabbit.util.Text;
+import org.apache.jackrabbit.oak.spi.nodetype.NodeTypeConstants;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.api.wrappers.ValueMapDecorator;
 import org.apache.sling.cms.CMSConstants;
-import org.apache.sling.cms.File;
+import org.apache.sling.cms.PublishableResource;
 import org.apache.sling.cms.Site;
 import org.apache.sling.cms.SiteManager;
 import org.apache.sling.cms.publication.PublicationType;
-import org.apache.sling.models.annotations.Default;
 import org.apache.sling.models.annotations.Model;
-import org.apache.sling.models.annotations.Optional;
+import org.apache.sling.models.annotations.injectorspecific.Self;
 
 /**
- * A model representing a file
+ * Implementation of the publishable resource interface and adaptable from a
+ * resource.
  */
-@Model(adaptables = Resource.class, adapters = File.class)
-public class FileImpl implements File {
+@Model(adaptables = Resource.class, adapters = PublishableResource.class)
+public class PublishableResourceImpl implements PublishableResource {
 
-    @Inject
-    @Optional
-    @Named("jcr:content")
-    private Resource contentResource;
+    private final Resource contentResource;
 
-    @Inject
-    @Named("jcr:content/jcr:mimeType")
-    private String contentType;
+    private final Calendar created;
 
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:created")
-    private Calendar created;
+    private final String createdBy;
 
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:createdBy")
-    private String createdBy;
+    private final Calendar lastModified;
 
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:lastModified")
-    private Calendar lastModified;
+    private final String lastModifiedBy;
 
-    @Inject
-    @Optional
-    @Named("jcr:content/jcr:lastModifiedBy")
-    private String lastModifiedBy;
+    private final Calendar lastPublication;
 
-    @Inject
-    @Optional
-    @Named("jcr:content/lastPublication")
-    private Calendar lastPublication;
+    private final String lastPublicationType;
 
-    @Inject
-    @Optional
-    @Named("jcr:content/lastPublicationType")
-    @Default(values = "NONE")
-    private String lastPublicationType;
+    private final boolean published;
 
-    @Inject
-    @Named("jcr:content/published")
-    @Default(booleanValues = false)
-    private boolean published;
+    protected final Resource resource;
 
-    protected Resource resource;
+    private String lastPublicationBy;
 
     @Inject
-    @Named("jcr:primaryType")
-    private String type;
-
-    public FileImpl(Resource resource) {
+    public PublishableResourceImpl(@Self Resource resource) {
         this.resource = resource;
+        this.created = resource.getValueMap().get(JcrConstants.JCR_CREATED, Calendar.class);
+        this.createdBy = resource.getValueMap().get(NodeTypeConstants.JCR_CREATEDBY, String.class);
+        this.contentResource = resource.getChild(JcrConstants.JCR_CONTENT);
+        if (this.contentResource != null) {
+            ValueMap properties = contentResource.getValueMap();
+            this.lastModified = properties.get(JcrConstants.JCR_LASTMODIFIED, Calendar.class);
+            this.lastModifiedBy = properties.get(NodeTypeConstants.JCR_LASTMODIFIEDBY, String.class);
+            this.lastPublication = properties.get(CMSConstants.PN_LAST_PUBLICATION, Calendar.class);
+            this.lastPublicationBy = properties.get(NodeTypeConstants.JCR_LASTMODIFIEDBY, String.class);
+            this.lastPublicationType = properties.get(CMSConstants.PN_LAST_PUBLICATION_TYPE, String.class);
+            this.published = properties.get(CMSConstants.PN_PUBLISHED, false);
+        } else {
+            this.lastModified = null;
+            this.lastModifiedBy = null;
+            this.lastPublication = null;
+            this.lastPublicationBy = null;
+            this.lastPublicationType = null;
+            this.published = false;
+        }
     }
 
     @Override
@@ -104,11 +89,6 @@ public class FileImpl implements File {
     }
 
     @Override
-    public String getContentType() {
-        return contentType;
-    }
-
-    @Override
     public Calendar getCreated() {
         return created;
     }
@@ -139,15 +119,8 @@ public class FileImpl implements File {
     }
 
     @Override
-    public ValueMap getMetadata() {
-        Resource metadata = this.getContentResource().getChild(CMSConstants.NN_METADATA);
-        Map<String, Object> data = new TreeMap<>();
-        if (metadata != null) {
-            metadata.getValueMap().entrySet()
-                    .forEach(e -> data.put(Text.unescapeIllegalJcrChars(e.getKey()), e.getValue()));
-        }
-        data.remove(JcrConstants.JCR_PRIMARYTYPE);
-        return new ValueMapDecorator(data);
+    public String getLastPublicationBy() {
+        return lastPublicationBy;
     }
 
     @Override
@@ -210,4 +183,4 @@ public class FileImpl implements File {
         return published;
     }
 
-}
+}
\ No newline at end of file
diff --git a/core/src/test/java/org/apache/sling/cms/core/helpers/SlingCMSTestHelper.java b/core/src/test/java/org/apache/sling/cms/core/helpers/SlingCMSTestHelper.java
index 0ec82ba..393e21c 100644
--- a/core/src/test/java/org/apache/sling/cms/core/helpers/SlingCMSTestHelper.java
+++ b/core/src/test/java/org/apache/sling/cms/core/helpers/SlingCMSTestHelper.java
@@ -49,7 +49,9 @@ public class SlingCMSTestHelper {
         context.addModelsForPackage("org.apache.sling.cms.core.internal.models");
         context.addModelsForPackage("org.apache.sling.cms.core.models");
 
+        context.load().json("/conf.json", "/conf");
         context.load().json("/content.json", "/content");
+        context.load().json("/etc.json", "/etc");
         context.load().json("/referencecomponents.json", "/apps/reference/components");
         context.load().json("/generalcomponents.json", "/libs/sling-cms/components/general");
         context.load().binaryResource("/apache.png", "/content/apache/sling-apache-org/index/apache.png/jcr:content");
diff --git a/core/src/test/java/org/apache/sling/cms/core/internal/models/FileImplTest.java b/core/src/test/java/org/apache/sling/cms/core/internal/models/FileImplTest.java
new file mode 100644
index 0000000..7fb6815
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/cms/core/internal/models/FileImplTest.java
@@ -0,0 +1,48 @@
+/*
+ * 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.sling.cms.core.internal.models;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.sling.cms.File;
+import org.apache.sling.cms.core.helpers.SlingCMSTestHelper;
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class FileImplTest {
+
+    @Rule
+    public final SlingContext context = new SlingContext();
+
+    @Before
+    public void init() {
+        SlingCMSTestHelper.initContext(context);
+    }
+
+    @Test
+    public void testValid() {
+        context.currentResource("/content/apache/sling-apache-org/apache.png");
+        File file = context.currentResource().adaptTo(File.class);
+
+        assertNotNull(file);
+        assertEquals("image/png", file.getContentType());
+        assertNotNull(file.getMetadata());
+    }
+}
\ No newline at end of file
diff --git a/core/src/test/java/org/apache/sling/cms/core/internal/models/PageImplTest.java b/core/src/test/java/org/apache/sling/cms/core/internal/models/PageImplTest.java
new file mode 100644
index 0000000..679565c
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/cms/core/internal/models/PageImplTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.sling.cms.core.internal.models;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.sling.cms.Page;
+import org.apache.sling.cms.core.helpers.SlingCMSTestHelper;
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class PageImplTest {
+
+    @Rule
+    public final SlingContext context = new SlingContext();
+
+    @Before
+    public void init() {
+        SlingCMSTestHelper.initContext(context);
+    }
+
+    @Test
+    public void testValid() {
+        context.currentResource("/content/apache/sling-apache-org/index");
+        Page page = context.currentResource().adaptTo(Page.class);
+
+        assertNotNull(page);
+
+        assertArrayEquals(new String[] { "Community" }, page.getKeywords());
+        assertEquals("Apache Sling - Bringing Back the Fun!", page.getTitle());
+        assertEquals("/conf/global/site/templates/base-page", page.getTemplatePath());
+        assertNotNull(page.getTemplatePath());
+    }
+}
\ No newline at end of file
diff --git a/core/src/test/java/org/apache/sling/cms/core/internal/models/PublishableResourceImplTest.java b/core/src/test/java/org/apache/sling/cms/core/internal/models/PublishableResourceImplTest.java
new file mode 100644
index 0000000..7e8b8e0
--- /dev/null
+++ b/core/src/test/java/org/apache/sling/cms/core/internal/models/PublishableResourceImplTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.sling.cms.core.internal.models;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import org.apache.sling.cms.PublishableResource;
+import org.apache.sling.cms.core.helpers.SlingCMSTestHelper;
+import org.apache.sling.cms.publication.PublicationType;
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class PublishableResourceImplTest {
+
+    @Rule
+    public final SlingContext context = new SlingContext();
+
+    @Before
+    public void init() {
+        SlingCMSTestHelper.initContext(context);
+    }
+
+    @Test
+    public void testValid() {
+        context.currentResource("/content/apache/sling-apache-org/index");
+        PublishableResource publishableResource = context.currentResource().adaptTo(PublishableResource.class);
+        assertNotNull(publishableResource);
+        assertNotNull(publishableResource.getContentResource());
+        assertEquals("/content/apache/sling-apache-org/index/jcr:content",
+                publishableResource.getContentResource().getPath());
+        assertNotNull(publishableResource.getCreated());
+        assertEquals("admin", publishableResource.getCreatedBy());
+        assertNotNull(publishableResource.getLastModified());
+        assertEquals("admin", publishableResource.getLastModifiedBy());
+        assertNotNull(publishableResource.getLastPublication());
+        assertEquals("admin", publishableResource.getLastPublicationBy());
+        assertEquals(PublicationType.ADD, publishableResource.getLastPublicationType());
+        assertEquals("index", publishableResource.getName());
+        assertEquals(context.currentResource().getParent().getPath(), publishableResource.getParent().getPath());
+        assertNotNull(publishableResource.getProperties());
+        assertEquals("/index", publishableResource.getPublishedPath());
+        assertEquals("https://sling.apache.org/index", publishableResource.getPublishedUrl());
+        assertEquals(context.currentResource(), publishableResource.getResource());
+        assertNotNull(publishableResource.getSite());
+    }
+
+    @Test
+    public void testInValid() {
+        context.currentResource("/content/apache/sling-apache-org/index/jcr:content");
+        PublishableResource publishableResource = context.currentResource().adaptTo(PublishableResource.class);
+        assertNotNull(publishableResource);
+        assertNull(publishableResource.getContentResource());
+    }
+}
\ No newline at end of file
diff --git a/core/src/test/resources/conf.json b/core/src/test/resources/conf.json
new file mode 100644
index 0000000..89e2b0b
--- /dev/null
+++ b/core/src/test/resources/conf.json
@@ -0,0 +1,357 @@
+{
+    "jcr:primaryType": "sling:OrderedFolder",
+    "jcr:mixinTypes": [
+        "rep:AccessControllable"
+    ],
+    "jcr:createdBy": "admin",
+    "jcr:created": "Thu Aug 20 2020 21:32:16 GMT-0400",
+    "rep:policy": {
+        "jcr:primaryType": "rep:ACL",
+        "allow": {
+            "jcr:primaryType": "rep:GrantACE",
+            "rep:principalName": "everyone",
+            "rep:privileges": [
+                "jcr:read"
+            ]
+        }
+    },
+    "global": {
+        "jcr:primaryType": "sling:OrderedFolder",
+        "jcr:createdBy": "admin",
+        "jcr:created": "Thu Aug 20 2020 21:32:20 GMT-0400",
+        "jcr:content": {
+            "jcr:primaryType": "nt:unstructured",
+            "jcr:title": "Global"
+        },
+        "files": {
+            "jcr:primaryType": "sling:OrderedFolder",
+            "jcr:createdBy": "admin",
+            "jcr:created": "Thu Aug 20 2020 21:32:20 GMT-0400",
+            "jcr:content": {
+                "jcr:primaryType": "nt:unstructured",
+                "jcr:title": "File Configurations"
+            },
+            "editors": {
+                "jcr:primaryType": "sling:Config",
+                "jcr:createdBy": "admin",
+                "jcr:title": "File Editors",
+                "jcr:lastModifiedBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "jcr:lastModified": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "sling:resourceType": "sling-cms/components/caconfig/fileeditor",
+                "default": {
+                    "jcr:primaryType": "nt:unstructured",
+                    "jcr:title": "Default File Editor",
+                    "sling:resourceType": "sling-cms/components/caconfig/fileeditor/config",
+                    "fields": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "title": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "required": false,
+                            "name": "jcr:content/jcr:title",
+                            "type": "text",
+                            "label": "Title",
+                            "sling:resourceType": "sling-cms/components/editor/fields/text"
+                        },
+                        "jcrmimeType": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "required": true,
+                            "name": "jcr:content/jcr:mimeType",
+                            "type": "text",
+                            "label": "MIME Type",
+                            "sling:resourceType": "sling-cms/components/editor/fields/text"
+                        },
+                        "licensing": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "required": false,
+                            "name": "jcr:content/licensing",
+                            "type": "text",
+                            "label": "Licensing",
+                            "sling:resourceType": "sling-cms/components/editor/fields/text"
+                        },
+                        "taxonomy": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "name": "jcr:content/sling:taxonomy",
+                            "label": "Taxonomy",
+                            "sling:resourceType": "sling-cms/components/editor/fields/taxonomy"
+                        },
+                        "taxonomyTypeHint": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "name": "jcr:content/sling:taxonomy@TypeHint",
+                            "value": "String[]",
+                            "sling:resourceType": "sling-cms/components/editor/fields/hidden"
+                        },
+                        "published": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "name": "jcr:content/published",
+                            "label": "Published",
+                            "sling:resourceType": "sling-cms/components/editor/fields/publication"
+                        },
+                        "filemetadata": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "name": "jcr:content/filemetadata",
+                            "label": "File Metadata",
+                            "sling:resourceType": "sling-cms/components/editor/fields/filemetadata"
+                        }
+                    }
+                }
+            },
+            "transformations": {
+                "jcr:primaryType": "sling:Config",
+                "jcr:createdBy": "admin",
+                "jcr:title": "Transformations",
+                "jcr:lastModifiedBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "jcr:lastModified": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "sling:resourceType": "sling-cms/components/caconfig/transformations",
+                "sling-cms-thumbnail": {
+                    "jcr:primaryType": "nt:unstructured",
+                    "name": "sling-cms-thumbnail",
+                    "sling:resourceType": "sling-cms/components/caconfig/transformation",
+                    "handlers": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "size": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "height": "480",
+                            "width": "600",
+                            "sling:resourceType": "sling-cms/components/caconfig/transformationhandlers/size"
+                        },
+                        "crop": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "position": "CENTER",
+                            "sling:resourceType": "sling-cms/components/caconfig/transformationhandlers/crop"
+                        }
+                    }
+                },
+                "sling-cms-thumbnail128": {
+                    "jcr:primaryType": "nt:unstructured",
+                    "name": "sling-cms-thumbnail128",
+                    "sling:resourceType": "sling-cms/components/caconfig/transformation",
+                    "handlers": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "size": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "height": "128",
+                            "width": "128",
+                            "sling:resourceType": "sling-cms/components/caconfig/transformationhandlers/size"
+                        },
+                        "crop": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "position": "CENTER",
+                            "sling:resourceType": "sling-cms/components/caconfig/transformationhandlers/crop"
+                        }
+                    }
+                },
+                "sling-cms-thumbnail32": {
+                    "jcr:primaryType": "nt:unstructured",
+                    "name": "sling-cms-thumbnail32",
+                    "sling:resourceType": "sling-cms/components/caconfig/transformation",
+                    "handlers": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "size": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "height": "32",
+                            "width": "32",
+                            "sling:resourceType": "sling-cms/components/caconfig/transformationhandlers/size"
+                        },
+                        "crop": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "position": "CENTER",
+                            "sling:resourceType": "sling-cms/components/caconfig/transformationhandlers/crop"
+                        }
+                    }
+                }
+            }
+        },
+        "site": {
+            "jcr:primaryType": "sling:OrderedFolder",
+            "jcr:createdBy": "admin",
+            "jcr:created": "Thu Aug 20 2020 21:32:20 GMT-0400",
+            "jcr:content": {
+                "jcr:primaryType": "nt:unstructured",
+                "jcr:title": "Default Site Configuration"
+            },
+            "rewrite": {
+                "jcr:primaryType": "sling:Config",
+                "jcr:createdBy": "admin",
+                "jcr:title": "Rewriter",
+                "jcr:lastModifiedBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "attributes": [
+                    "action",
+                    "href",
+                    "src"
+                ],
+                "jcr:lastModified": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "sling:resourceType": "sling-cms/components/caconfig/rewriter",
+                "doctype": "<!DOCTYPE html>"
+            },
+            "policies": {
+                "jcr:primaryType": "sling:Config",
+                "jcr:createdBy": "admin",
+                "jcr:title": "Default Policy",
+                "jcr:lastModifiedBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "jcr:lastModified": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "sling:resourceType": "sling-cms/components/caconfig/policies",
+                "policy": {
+                    "jcr:primaryType": "nt:unstructured",
+                    "jcr:title": "Bootstrap CSS Policy",
+                    "availableComponentTypes": [
+                        "General"
+                    ],
+                    "sling:resourceType": "sling-cms/components/caconfig/policy",
+                    "componentConfigurations": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "component": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "fieldConfigGroups": "Form Field,General",
+                            "checkInputClass": "form-check-input",
+                            "fieldGroupClass": "form-group",
+                            "checkLabelClass": "form-check-label",
+                            "fieldRequiredClass": "text-danger",
+                            "type": "reference/components/forms/form",
+                            "submitClass": "btn btn-primary",
+                            "fieldClass": "form-control",
+                            "actionConfigGroups": "Form Action",
+                            "providerConfigGroups": "Form Value Provider",
+                            "sling:resourceType": "sling-cms/components/caconfig/component",
+                            "checkFieldClass": "form-check",
+                            "formClass": "form",
+                            "alertClass": "alert alert-dark"
+                        },
+                        "component_1310080869": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "ctaClasses": [
+                                "Primary=btn-primary"
+                            ],
+                            "type": "reference/components/general/cta",
+                            "sling:resourceType": "sling-cms/components/caconfig/component"
+                        },
+                        "component_867209498": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "type": "reference/components/general/columncontrol",
+                            "containerclass": "container",
+                            "columns": [
+                                "100%=col-md-12",
+                                "50% 50%=col-6,col-6",
+                                "33% 33% 33%=col-4,col-4,col-4"
+                            ],
+                            "sling:resourceType": "sling-cms/components/caconfig/component"
+                        },
+                        "component_1644835788": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "iframeClass": "frame",
+                            "type": "reference/components/general/iframe",
+                            "sling:resourceType": "sling-cms/components/caconfig/component",
+                            "wrapperClasses": [
+                                "embed-responsive"
+                            ]
+                        },
+                        "component_1264147350": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "type": "reference/components/general/image",
+                            "sling:resourceType": "sling-cms/components/caconfig/component",
+                            "imageClasses": [
+                                "Responsive=img-responsive"
+                            ]
+                        },
+                        "component_2817746": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "pageItemClass": "page-item",
+                            "pageLinkClass": "page-link",
+                            "type": "reference/components/general/list",
+                            "paginationClass": "pagination",
+                            "sling:resourceType": "sling-cms/components/caconfig/component"
+                        },
+                        "component_55724978": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "pageItemClass": "page-item",
+                            "pageLinkClass": "page-link",
+                            "searchClass": "search",
+                            "resultClass": "search-result",
+                            "type": "reference/components/general/search",
+                            "paginationClass": "pagination",
+                            "resultHeaderClass": "search-header",
+                            "sling:resourceType": "sling-cms/components/caconfig/component"
+                        },
+                        "component_928101893": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "buttonClass": "btn btn-primary",
+                            "type": "reference/components/general/searchform",
+                            "sling:resourceType": "sling-cms/components/caconfig/component",
+                            "inputClass": "input",
+                            "formClass": "form"
+                        },
+                        "component_1816434016": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "tagPage": "",
+                            "listClass": "tag-list",
+                            "type": "reference/components/general/tags",
+                            "listTag": "div",
+                            "sling:resourceType": "sling-cms/components/caconfig/component",
+                            "itemTag": "div",
+                            "itemClass": "tag-item"
+                        }
+                    }
+                }
+            },
+            "settings": {
+                "jcr:primaryType": "sling:Config",
+                "jcr:createdBy": "admin",
+                "jcr:title": "Site Settings",
+                "jcr:lastModifiedBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "taxonomyroot": "/etc/taxonomy",
+                "jcr:lastModified": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "sling:resourceType": "sling-cms/components/caconfig/sitesettings"
+            },
+            "templates": {
+                "jcr:primaryType": "sling:Config",
+                "jcr:createdBy": "admin",
+                "jcr:title": "Templates",
+                "jcr:lastModifiedBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "jcr:lastModified": "Thu Aug 20 2020 21:32:20 GMT-0400",
+                "sling:resourceType": "sling-cms/components/caconfig/templates",
+                "base-page": {
+                    "jcr:primaryType": "nt:unstructured",
+                    "jcr:title": "Base Page",
+                    "template": "{\r\n  \"jcr:primaryType\": \"sling:Page\",\r\n  \"jcr:content\": {\r\n    \"jcr:primaryType\": \"nt:unstructured\",\r\n    \"jcr:title\": \"{{title}}\",\r\n    \"sling:template\": \"/conf/global/site/templates/base-page\",\r\n    \"sling:resourceType\": \"reference/components/pages/base\",\r\n    \"published\": false\r\n  }\r\n}",
+                    "allowedPaths": [
+                        "/content/apache/sling-apache-org.*"
+                    ],
+                    "sling:resourceType": "sling-cms/components/caconfig/template",
+                    "fields": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "text": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "required": true,
+                            "name": "title",
+                            "type": "text",
+                            "label": "Title",
+                            "sling:resourceType": "sling-cms/components/editor/fields/text"
+                        },
+                        "text_1147023191": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "required": true,
+                            "name": ":name",
+                            "type": "text",
+                            "label": "Name",
+                            "sling:resourceType": "sling-cms/components/editor/fields/text"
+                        }
+                    },
+                    "policies": {
+                        "jcr:primaryType": "nt:unstructured",
+                        "policymapping": {
+                            "jcr:primaryType": "nt:unstructured",
+                            "sling:resourceType": "sling-cms/components/caconfig/policymapping",
+                            "pathPattern": ".*",
+                            "policyPath": "/conf/global/site/policies/policy"
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/core/src/test/resources/content.json b/core/src/test/resources/content.json
index 9325468..7acf199 100644
--- a/core/src/test/resources/content.json
+++ b/core/src/test/resources/content.json
@@ -75,7 +75,10 @@
                     "sling:taxonomy": "/etc/taxonomy/reference/community",
                     "jcr:lastModified": "Wed May 15 2019 14:05:46 GMT-0400",
                     "sling:resourceType": "reference/components/pages/base",
-                    "published": true,
+                    "sling:published": true,
+                    "sling:lastPublication": "Wed May 15 2019 14:05:46 GMT-0400",
+                    "sling:lastPublicationBy": "admin",
+                    "sling:lastPublicationType": "ADD",
                     "hideInSitemap": false,
                     "container": {
                         "jcr:primaryType": "nt:unstructured",
@@ -97,7 +100,11 @@
                 }
             },
             "apache.png": {
-                "jcr:primaryType": "sling:File"
+                "jcr:primaryType": "sling:File",
+                "jcr:content": {
+                    "jcr:primaryType": "sling:FileContent",
+                    "jcr:mimeType": "image/png"
+                }
             },
             "sling.pdf": {
                 "jcr:primaryType": "sling:File"
diff --git a/core/src/test/resources/etc.json b/core/src/test/resources/etc.json
new file mode 100644
index 0000000..affe31f
--- /dev/null
+++ b/core/src/test/resources/etc.json
@@ -0,0 +1,291 @@
+{
+    "jcr:primaryType": "sling:OrderedFolder",
+    "jcr:createdBy": "admin",
+    "jcr:created": "Thu Aug 20 2020 21:32:16 GMT-0400",
+    "i18n": {
+        "jcr:primaryType": "sling:OrderedFolder",
+        "jcr:mixinTypes": [
+            "rep:AccessControllable"
+        ],
+        "jcr:createdBy": "admin",
+        "jcr:created": "Thu Aug 20 2020 21:32:16 GMT-0400",
+        "rep:policy": {
+            "jcr:primaryType": "rep:ACL",
+            "allow": {
+                "jcr:primaryType": "rep:GrantACE",
+                "rep:principalName": "everyone",
+                "rep:privileges": [
+                    "jcr:read"
+                ]
+            }
+        },
+        "jcr:content": {
+            "jcr:primaryType": "nt:unstructured",
+            "jcr:title": "i18n"
+        }
+    },
+    "taxonomy": {
+        "jcr:primaryType": "sling:OrderedFolder",
+        "jcr:mixinTypes": [
+            "rep:AccessControllable"
+        ],
+        "jcr:createdBy": "admin",
+        "jcr:created": "Thu Aug 20 2020 21:32:16 GMT-0400",
+        "rep:policy": {
+            "jcr:primaryType": "rep:ACL",
+            "allow": {
+                "jcr:primaryType": "rep:GrantACE",
+                "rep:principalName": "everyone",
+                "rep:privileges": [
+                    "jcr:read"
+                ]
+            },
+            "allow1": {
+                "jcr:primaryType": "rep:GrantACE",
+                "rep:principalName": "taxonomy-users",
+                "rep:privileges": [
+                    "jcr:versionManagement",
+                    "rep:write"
+                ]
+            }
+        },
+        "jcr:content": {
+            "jcr:primaryType": "nt:unstructured",
+            "jcr:title": "Taxonomy"
+        },
+        "reference": {
+            "jcr:primaryType": "sling:Taxonomy",
+            "jcr:createdBy": "admin",
+            "jcr:title": "Reference",
+            "jcr:lastModifiedBy": "admin",
+            "jcr:created": "Thu Aug 20 2020 21:32:29 GMT-0400",
+            "jcr:lastModified": "Thu Aug 20 2020 21:32:29 GMT-0400",
+            "community": {
+                "jcr:primaryType": "sling:Taxonomy",
+                "jcr:createdBy": "admin",
+                "jcr:title": "Community",
+                "jcr:lastModifiedBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:29 GMT-0400",
+                "jcr:lastModified": "Thu Aug 20 2020 21:32:29 GMT-0400"
+            }
+        }
+    },
+    "usergenerated": {
+        "jcr:primaryType": "sling:OrderedFolder",
+        "jcr:mixinTypes": [
+            "rep:AccessControllable"
+        ],
+        "jcr:createdBy": "admin",
+        "jcr:created": "Thu Aug 20 2020 21:32:16 GMT-0400",
+        "rep:policy": {
+            "jcr:primaryType": "rep:ACL",
+            "allow": {
+                "jcr:primaryType": "rep:GrantACE",
+                "rep:principalName": "everyone",
+                "rep:privileges": [
+                    "jcr:read"
+                ]
+            },
+            "allow1": {
+                "jcr:primaryType": "rep:GrantACE",
+                "rep:principalName": "ugc-users",
+                "rep:privileges": [
+                    "jcr:versionManagement",
+                    "rep:write"
+                ]
+            },
+            "allow2": {
+                "jcr:primaryType": "rep:GrantACE",
+                "rep:principalName": "sling-cms-ugc",
+                "rep:privileges": [
+                    "jcr:versionManagement",
+                    "rep:write"
+                ]
+            }
+        }
+    },
+    "clientlibs": {
+        "jcr:primaryType": "sling:Folder",
+        "jcr:createdBy": "admin",
+        "jcr:created": "Thu Aug 20 2020 21:32:22 GMT-0400",
+        "repl": {
+            "jcr:primaryType": "sling:Folder",
+            "jcr:createdBy": "admin",
+            "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+            "script.js": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "application/javascript",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 5518,
+                    "jcr:uuid": "7399069e-d3a1-494d-baf7-2b10b1ded320"
+                }
+            },
+            "ace.js": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "application/javascript",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 302977,
+                    "jcr:uuid": "5b568ac3-5d5a-4303-a680-7dc410cbdbdf"
+                }
+            },
+            "mode-java.js": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "application/javascript",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 23341,
+                    "jcr:uuid": "742d9a90-b09a-4082-b6bb-c091557ae0db"
+                }
+            },
+            "style.css": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "text/css",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 1516,
+                    "jcr:uuid": "6adf6944-cc56-4d4f-87de-18dc0fb9187e"
+                }
+            },
+            "images": {
+                "jcr:primaryType": "sling:Folder",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "htl.svg": {
+                    "jcr:primaryType": "nt:file",
+                    "jcr:createdBy": "admin",
+                    "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                    "jcr:content": {
+                        "jcr:primaryType": "nt:resource",
+                        "jcr:lastModifiedBy": "admin",
+                        "jcr:mimeType": "image/svg+xml",
+                        "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                        ":jcr:data": 6825,
+                        "jcr:uuid": "cec6f7d8-edde-4dec-945d-4d2adc5b802e"
+                    }
+                }
+            },
+            "mode-javascript.js": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "application/javascript",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 19534,
+                    "jcr:uuid": "0501be01-4835-4d91-8d9d-79e81ed72dfb"
+                }
+            },
+            "jquery.min.js": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "application/javascript",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 96381,
+                    "jcr:uuid": "639a508f-96ce-47fb-9c5f-726f5cd9caea"
+                }
+            },
+            "bootstrap-theme.min.css": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "text/css",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 13185,
+                    "jcr:uuid": "5ef51f25-f205-4995-81c5-3b6bfbcf35b2"
+                }
+            },
+            "bootstrap.min.css": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "text/css",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 99961,
+                    "jcr:uuid": "20f38589-ca2e-4ed4-87a1-07a4108bb1e1"
+                }
+            },
+            "mode-html.js": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "application/javascript",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 41898,
+                    "jcr:uuid": "11b10a8e-71f5-4e47-88bf-4bb39b71d458"
+                }
+            },
+            "html5shiv.js": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "application/javascript",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 2429,
+                    "jcr:uuid": "6dcf4128-9e81-4735-8d03-241e576ba331"
+                }
+            },
+            "bootstrap.min.js": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "application/javascript",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 29110,
+                    "jcr:uuid": "9c60cd32-1b87-4094-a48f-2e0e5c9f5190"
+                }
+            },
+            "respond.min.js": {
+                "jcr:primaryType": "nt:file",
+                "jcr:createdBy": "admin",
+                "jcr:created": "Thu Aug 20 2020 21:32:30 GMT-0400",
+                "jcr:content": {
+                    "jcr:primaryType": "nt:resource",
+                    "jcr:lastModifiedBy": "admin",
+                    "jcr:mimeType": "application/javascript",
+                    "jcr:lastModified": "Tue Jun 19 2018 11:43:44 GMT+0000",
+                    ":jcr:data": 4377,
+                    "jcr:uuid": "cf442a2d-e88b-45e9-a687-2eafae9a482c"
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd b/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
index f164147..1d85577 100644
--- a/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
+++ b/ui/src/main/resources/SLING-INF/nodetypes/nodetypes.cnd
@@ -21,61 +21,56 @@
 //    -  http://sling.apache.org/site/content-loading.html
 //    -  http://jackrabbit.apache.org/node-type-notation.html
 
-<sling = 'http://sling.apache.org/jcr/sling/1.0'>
-    
+<'sling'='http://sling.apache.org/jcr/sling/1.0'>
+<'nt'='http://www.jcp.org/jcr/nt/1.0'>
+<'mix'='http://www.jcp.org/jcr/mix/1.0'>
+<'jcr'='http://www.jcp.org/jcr/1.0'>
+
+[mix:publishable] mixin
+- sling:published (boolean)
+- sling:lastPublication (date)
+- sling:lastPublicationBy (string)
+- sling:lastPublicationType (string)
 
 [sling:Component] > nt:unstructured
     - componentType (string)
     - jcr:title (string)
     
-[sling:Config] > nt:hierarchyNode
+[sling:Config] > nt:hierarchyNode, mix:lastModified
     orderable
-    - sling:created (date)
-    - sling:createdBy (string)
     - sling:resourceType (string)
-    - jcr:lastModified (date)
-    - jcr:lastModifiedBy (string)
     - jcr:title (string)
     + * (nt:unstructured) = nt:unstructured version
     - * (UNDEFINED) multiple
     - * (UNDEFINED)
     
-[sling:File] > nt:file
+[sling:File] > nt:file, mix:publishable
      - * (undefined) copy
      + jcr:content (sling:FileContent) = sling:FileContent copy primary autocreated
     
-[sling:FileContent] > nt:resource
+[sling:FileContent] > nt:resource, mix:publishable
     - * (undefined) copy
     - * (undefined) copy multiple
     + metadata (nt:unstructured) = nt:unstructured copy primary
     + renditions (nt:unstructured) = nt:unstructured copy primary
 
-[sling:Page] > nt:hierarchyNode
+[sling:Page] > nt:hierarchyNode, mix:lastModified
     orderable
-    - published (boolean)
     + jcr:content (nt:unstructured) = nt:unstructured copy primary
     + * (nt:base) = nt:base version
 
-[sling:Site] > nt:hierarchyNode
+[sling:Site] > nt:hierarchyNode, mix:lastModified
     orderable
     - sling:configRef (string)
-    - sling:created (date)
-    - sling:createdBy (string)
     - sling:url (string)
     - jcr:language (string)
-    - jcr:lastModified (date)
-    - jcr:lastModifiedBy (string)
     - jcr:title (string)
     - jcr:description (string)
     + * (nt:base) = nt:base version
 
-[sling:Taxonomy] > nt:hierarchyNode
+[sling:Taxonomy] > nt:hierarchyNode, mix:lastModified
     orderable
     - sling:related (string)
-    - sling:created (date)
-    - sling:createdBy (string)
-    - jcr:lastModified (date)
-    - jcr:lastModifiedBy (string)
     - jcr:title (string)
     + * (sling:Taxonomy) = sling:Taxonomy version
 


[sling-org-apache-sling-app-cms] 01/02: Minor -test improvements

Posted by dk...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dklco pushed a commit to branch SLING-8913-multiple-instance-types
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git

commit b7934d62bfa10695dab739218776a650196aee32
Author: Dan Klco <dk...@apache.org>
AuthorDate: Thu Aug 20 21:42:45 2020 -0400

    Minor -test improvements
---
 .../sling/cms/core/internal/servlets/DownloadFileServletTest.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/core/src/test/java/org/apache/sling/cms/core/internal/servlets/DownloadFileServletTest.java b/core/src/test/java/org/apache/sling/cms/core/internal/servlets/DownloadFileServletTest.java
index c66d4af..50da469 100644
--- a/core/src/test/java/org/apache/sling/cms/core/internal/servlets/DownloadFileServletTest.java
+++ b/core/src/test/java/org/apache/sling/cms/core/internal/servlets/DownloadFileServletTest.java
@@ -16,6 +16,7 @@
  */
 package org.apache.sling.cms.core.internal.servlets;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -47,11 +48,10 @@ public class DownloadFileServletTest {
         DownloadFileServlet dfs = new DownloadFileServlet();
 
         dfs.doGet(context.request(), context.response());
-        
-        assertTrue(context.response().getStatus() == 200);
+
+        assertEquals(200, context.response().getStatus());
         assertTrue(context.response().getHeaderNames().contains("Content-Disposition"));
     }
-    
 
     @Test
     public void testInValidRequest() throws ServletException, IOException {
@@ -62,7 +62,7 @@ public class DownloadFileServletTest {
 
         dfs.doGet(context.request(), context.response());
         
-        assertTrue(context.response().getStatus() == 404);
+        assertEquals(404, context.response().getStatus());
         assertFalse(context.response().getHeaderNames().contains("Content-Disposition"));
     }
 }