Skip to content

Commit

Permalink
added integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Przybyl committed Oct 4, 2024
1 parent 0b0a36d commit 8a8c844
Show file tree
Hide file tree
Showing 38 changed files with 845 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/content_manager_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ func TestPullOnePage(t *testing.T) {
testPullContent(t, "test_cases/pull_tests/one_page", "", "/content/mysite/us/.content.xml", nil, "")
}

func TestPullCqTemplateNormal(t *testing.T) {
testPullContent(t, "test_cases/pull_tests/cq_template", "", "apps/mysite/components/tabs/_cq_template/.content.xml", nil, "")
}

func TestPullCqTemplateFlatten(t *testing.T) {
testPullContent(t, "test_cases/pull_tests/cq_template", "", "apps/mysite/components/tabs/_cq_template.xml", nil, "")
}

func testPullContent(t *testing.T, expectedDir string, relDir string, relFile string, filterRoots []string, filterFile string) {
aem := pkg.DefaultAEM()
contentManager := pkg.NewContentManager(aem)
Expand Down
5 changes: 5 additions & 0 deletions pkg/test_cases/main_content/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Manifest-Version: 1.0
Content-Package-Roots: /apps/mysite,/conf/mysite,/content/mysite
Content-Package-Type: mixed
Content-Package-Id: my_packages:test-content

93 changes: 93 additions & 0 deletions pkg/test_cases/main_content/META-INF/vault/config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!--
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.
-->
<vaultfs version="1.1">
<!--
Defines the content aggregation. The order of the defined aggregates
is important for finding the correct aggregator.
-->
<aggregates>
<!--
Defines an aggregate that handles nt:file and nt:resource nodes.
-->
<aggregate type="file" title="File Aggregate"/>

<!--
Defines an aggregate that handles file/folder like nodes. It matches
all nt:hierarchyNode nodes that have or define a jcr:content
child node and excludes child nodes that are nt:hierarchyNodes.
-->
<aggregate type="filefolder" title="File/Folder Aggregate"/>

<!--
Defines an aggregate that handles nt:nodeType nodes and serializes
them into .cnd notation.
-->
<aggregate type="nodetype" title="Node Type Aggregate" />

<!--
Defines an aggregate that defines full coverage for certain node
types that cannot be covered by the default aggregator.
-->
<aggregate type="full" title="Full Coverage Aggregate">
<matches>
<include nodeType="rep:AccessControl" respectSupertype="true" />
<include nodeType="rep:Policy" respectSupertype="true" />
<include nodeType="cq:Widget" respectSupertype="true" />
<include nodeType="cq:EditConfig" respectSupertype="true" />
<include nodeType="cq:WorkflowModel" respectSupertype="true" />
<include nodeType="vlt:FullCoverage" respectSupertype="true" />
<include nodeType="mix:language" respectSupertype="true" />
<include nodeType="sling:OsgiConfig" respectSupertype="true" />
</matches>
</aggregate>

<!--
Defines an aggregate that handles nt:folder like nodes.
-->
<aggregate type="generic" title="Folder Aggregate">
<matches>
<include nodeType="nt:folder" respectSupertype="true" />
</matches>
<contains>
<exclude isNode="true" />
</contains>
</aggregate>

<!--
Defines the default aggregate
-->
<aggregate type="generic" title="Default Aggregator" isDefault="true">
<matches>
<!-- all -->
</matches>
<contains>
<exclude nodeType="nt:hierarchyNode" respectSupertype="true" />
</contains>
</aggregate>

</aggregates>

<!--
defines the input handlers
-->
<handlers>
<handler type="folder"/>
<handler type="file"/>
<handler type="nodetype"/>
<handler type="generic"/>
</handlers>
</vaultfs>
38 changes: 38 additions & 0 deletions pkg/test_cases/main_content/META-INF/vault/definition/.content.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:vlt="http://www.day.com/jcr/vault/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:created="{Date}2024-10-04T00:03:44.258Z"
jcr:createdBy="admin"
jcr:description=""
jcr:lastModified="{Date}2024-10-04T00:03:44.258Z"
jcr:lastModifiedBy="admin"
jcr:primaryType="vlt:PackageDefinition"
buildCount="2"
builtWith="Adobe Experience Manager-6.5.11.0"
dependencies="[]"
group="my_packages"
lastUnwrapped="{Date}2024-10-04T00:03:44.258Z"
lastUnwrappedBy="admin"
lastWrapped="{Date}2024-10-04T00:03:44.258Z"
lastWrappedBy="admin"
name="test-content"
requiresRestart="{Boolean}false"
requiresRoot="{Boolean}false"
version="">
<filter jcr:primaryType="nt:unstructured">
<f0
jcr:primaryType="nt:unstructured"
mode="replace"
root="/apps/mysite"
rules="[]"/>
<f1
jcr:primaryType="nt:unstructured"
mode="replace"
root="/conf/mysite"
rules="[]"/>
<f2
jcr:primaryType="nt:unstructured"
mode="replace"
root="/content/mysite"
rules="[]"/>
</filter>
</jcr:root>
6 changes: 6 additions & 0 deletions pkg/test_cases/main_content/META-INF/vault/filter.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<workspaceFilter version="1.0">
<filter root="/apps/mysite"/>
<filter root="/conf/mysite"/>
<filter root="/content/mysite"/>
</workspaceFilter>
145 changes: 145 additions & 0 deletions pkg/test_cases/main_content/META-INF/vault/nodetypes.cnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<'sling'='http://sling.apache.org/jcr/sling/1.0'>
<'cq'='http://www.day.com/jcr/cq/1.0'>
<'nt'='http://www.jcp.org/jcr/nt/1.0'>
<'jcr'='http://www.jcp.org/jcr/1.0'>
<'mix'='http://www.jcp.org/jcr/mix/1.0'>
<'rep'='internal'>
<'dam'='http://www.day.com/dam/1.0'>

[sling:Resource]
mixin
- sling:resourceType (string)

[cq:ClientLibraryFolder] > sling:Folder
- dependencies (string) multiple
- categories (string) multiple
- embed (string) multiple
- channels (string) multiple

[sling:Folder] > nt:folder
- * (undefined) multiple
- * (undefined)
+ * (nt:base) = sling:Folder version

[cq:Page] > nt:hierarchyNode
orderable primaryitem jcr:content
+ jcr:content (nt:base) = nt:unstructured
+ * (nt:base) = nt:base version

[cq:Taggable]
mixin
- cq:tags (string) multiple

[sling:OrderedFolder] > sling:Folder
orderable
+ * (nt:base) = sling:OrderedFolder version

[cq:Component] > mix:title, nt:folder, sling:ResourceSuperType
- dialogPath (string)
- cq:noDecoration (boolean)
- allowedChildren (string) multiple
- * (undefined)
- cq:isContainer (boolean)
- allowedParents (string) multiple
- * (undefined) multiple
- cq:cellName (string)
- componentGroup (string)
+ dialog (nt:base) = nt:unstructured
+ design_dialog (nt:base) = nt:unstructured
+ cq:htmlTag (nt:base) = nt:unstructured
+ * (nt:base) = nt:base multiple version
+ cq:infoProviders (nt:base) = nt:unstructured
+ cq:editConfig (cq:EditConfig) = cq:EditConfig
+ icon.png (nt:file)
+ cq:childEditConfig (cq:EditConfig) = cq:EditConfig
+ thumbnail.png (nt:file)
+ virtual (nt:base) = sling:Folder

[sling:ResourceSuperType]
mixin
- sling:resourceSuperType (string)

[cq:EditConfig] > nt:hierarchyNode, nt:unstructured
orderable
- cq:dialogMode (string) < 'auto', 'floating', 'inline'
- cq:emptyText (string)
- cq:layout (string) < 'editbar', 'rollover', 'auto'
- cq:inherit (boolean)
- cq:actions (string) multiple
+ cq:inplaceEditing (cq:InplaceEditingConfig) = cq:InplaceEditingConfig
+ cq:actionConfigs (nt:base) = nt:unstructured
+ cq:listeners (nt:base) = cq:EditListenersConfig
+ cq:formParameters (nt:base) = nt:unstructured
+ cq:dropTargets (nt:base) = nt:unstructured

[cq:InplaceEditingConfig] > nt:unstructured
orderable
- editorType (string)
- configPath (string)
- active (boolean)
+ config (nt:unstructured) = nt:unstructured

[cq:EditListenersConfig]
- afteredit (string)
- aftermove (string)
- afterremove (string)
- afterinsert (string)
- * (undefined)
- afterdelete (string)
- * (undefined) multiple
- aftercreate (string)
+ * (nt:base) = nt:base multiple version

[cq:ReplicationStatus]
mixin
- cq:lastReplicatedBy (string) ignore
- cq:lastPublished (date) ignore
- cq:lastReplicationStatus (string) ignore
- cq:lastPublishedBy (string) ignore
- cq:lastReplicationAction (string) ignore
- cq:lastReplicated (date) ignore

[rep:RepoAccessControllable]
mixin
+ rep:repoPolicy (rep:Policy) protected ignore

[cq:PageContent] > cq:OwnerTaggable, cq:ReplicationStatus, mix:created, mix:title, nt:unstructured, sling:Resource, sling:VanityPath
orderable
- cq:lastModified (date)
- cq:template (string)
- pageTitle (string)
- offTime (date)
- hideInNav (boolean)
- cq:lastModifiedBy (string)
- onTime (date)
- jcr:language (string)
- cq:allowedTemplates (string) multiple
- cq:designPath (string)
- navTitle (string)

[cq:OwnerTaggable] > cq:Taggable
mixin

[sling:VanityPath]
mixin
- sling:vanityPath (string) multiple
- sling:redirect (boolean)
- sling:vanityOrder (long)
- sling:redirectStatus (long)

[cq:Template] > mix:title, nt:hierarchyNode
- * (undefined) multiple
- allowedChildren (string) multiple
- allowedParents (string) multiple
- ranking (long)
- * (undefined)
+ thumbnail.png (nt:file)
+ workflows (nt:base)
+ * (nt:base) = nt:base multiple version
+ jcr:content (nt:base)
+ icon.png (nt:file)

[dam:Thumbnails]
mixin
+ dam:thumbnails (nt:folder)

21 changes: 21 additions & 0 deletions pkg/test_cases/main_content/META-INF/vault/properties.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<comment>FileVault Package Properties</comment>
<entry key="createdBy">admin</entry>
<entry key="name">test-content</entry>
<entry key="lastModified">2024-10-04T00:03:44.258Z</entry>
<entry key="lastModifiedBy">admin</entry>
<entry key="requiresRestart">false</entry>
<entry key="created">2024-10-04T00:03:44.358Z</entry>
<entry key="buildCount">2</entry>
<entry key="version"/>
<entry key="packageType">mixed</entry>
<entry key="requiresRoot">false</entry>
<entry key="dependencies"/>
<entry key="packageFormatVersion">2</entry>
<entry key="description"/>
<entry key="group">my_packages</entry>
<entry key="lastWrapped">2024-10-04T00:03:44.258Z</entry>
<entry key="lastWrappedBy">admin</entry>
</properties>
6 changes: 6 additions & 0 deletions pkg/test_cases/main_content/jcr_root/.content.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:rep="internal"
jcr:mixinTypes="[rep:AccessControllable,rep:RepoAccessControllable]"
jcr:primaryType="rep:root"
sling:resourceType="sling:redirect"
sling:target="/index.html"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:ClientLibraryFolder"
allowProxy="{Boolean}true"
categories="[mysite.site]"
cssProcessor="[default:none,min:none]"
dependencies="[mysite.dependencies]"
jsProcessor="[default:none,min:none]"/>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#base=css

site.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#base=js

site.js
Loading

0 comments on commit 8a8c844

Please sign in to comment.