From b15e06e0302e180af8f8a8d6e6297c0d3e0686fd Mon Sep 17 00:00:00 2001 From: Dominik Przybyl Date: Tue, 8 Oct 2024 12:46:40 +0200 Subject: [PATCH] fixed int tests --- pkg/{test => }/filter_file_test.go | 8 +- pkg/{test => }/filter_root_test.go | 4 +- pkg/instance_test.go | 2 + .../exclude_patterns.xml | 0 .../filter_roots.xml | 0 .../clientlibs/clientlib-site/$.content.xml | 8 -- .../mysite/clientlibs/clientlib-site/css.txt | 3 - .../clientlibs/clientlib-site/css/site.css | 1 - .../mysite/clientlibs/clientlib-site/js.txt | 3 - .../clientlibs/clientlib-site/js/site.js | 1 - .../conf/mysite/settings/$.content.xml | 3 - .../template-types/page/initial/$.content.xml | 18 --- .../page/policies/$.content.xml | 18 --- .../page/structure/$.content.xml | 36 ----- .../conf/mysite/workflow/$.content.xml | 4 - .../mysite/workflow/launcher/$.content.xml | 4 - .../workflow/launcher/config/$.content.xml | 4 - .../config/asset_processing/$.content.xml | 12 -- .../conf/mysite/workflow/models/$.content.xml | 4 - .../models/archive_page/$.content.xml | 131 ------------------ .../clientlibs/clientlib-site/$.content.xml | 8 -- .../mysite/clientlibs/clientlib-site/css.txt | 3 - .../clientlibs/clientlib-site/css/site.css | 1 - .../mysite/clientlibs/clientlib-site/js.txt | 3 - .../clientlibs/clientlib-site/js/site.js | 1 - .../conf/mysite/settings/$.content.xml | 3 - .../template-types/page/initial/$.content.xml | 18 --- .../page/policies/$.content.xml | 18 --- .../page/structure/$.content.xml | 36 ----- .../conf/mysite/workflow/$.content.xml | 4 - .../mysite/workflow/launcher/$.content.xml | 4 - .../workflow/launcher/config/$.content.xml | 4 - .../config/asset_processing/$.content.xml | 13 -- .../conf/mysite/workflow/models/$.content.xml | 4 - .../models/archive_page/$.content.xml | 131 ------------------ .../components/helloworld/$_cq_editConfig.xml | 12 ++ .../helloworld/$_cq_template/$.content.xml | 4 + .../components/helloworld/helloworld.html | 11 ++ .../conf/mysite/$_sling_configs/$.content.xml | 9 ++ .../$.content.xml | 9 ++ .../content/mysite/us/en/$.content.xml | 83 +++++++++++ pkg/sync_file_test.go | 43 ++++++ pkg/test/output.go | 6 - pkg/test/sync_file_test.go | 25 ---- 44 files changed, 181 insertions(+), 536 deletions(-) rename pkg/{test => }/filter_file_test.go (80%) rename pkg/{test => }/filter_root_test.go (98%) rename pkg/{test/output => int_test_content}/exclude_patterns.xml (100%) rename pkg/{test/output => int_test_content}/filter_roots.xml (100%) delete mode 100644 pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/$.content.xml delete mode 100644 pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css.txt delete mode 100644 pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css/site.css delete mode 100644 pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js.txt delete mode 100644 pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js/site.js delete mode 100644 pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/$.content.xml delete mode 100644 pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/initial/$.content.xml delete mode 100644 pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/policies/$.content.xml delete mode 100644 pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/structure/$.content.xml delete mode 100644 pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/$.content.xml delete mode 100644 pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/$.content.xml delete mode 100644 pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/config/$.content.xml delete mode 100644 pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/config/asset_processing/$.content.xml delete mode 100644 pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/models/$.content.xml delete mode 100644 pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/models/archive_page/$.content.xml delete mode 100644 pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/$.content.xml delete mode 100644 pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css.txt delete mode 100644 pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css/site.css delete mode 100644 pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js.txt delete mode 100644 pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js/site.js delete mode 100644 pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/$.content.xml delete mode 100644 pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/initial/$.content.xml delete mode 100644 pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/policies/$.content.xml delete mode 100644 pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/structure/$.content.xml delete mode 100644 pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/$.content.xml delete mode 100644 pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/$.content.xml delete mode 100644 pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/config/$.content.xml delete mode 100644 pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/config/asset_processing/$.content.xml delete mode 100644 pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/models/$.content.xml delete mode 100644 pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/models/archive_page/$.content.xml create mode 100644 pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/$_cq_editConfig.xml create mode 100644 pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/$_cq_template/$.content.xml create mode 100644 pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/helloworld.html create mode 100644 pkg/int_test_content/sync_file/jcr_root/conf/mysite/$_sling_configs/$.content.xml create mode 100644 pkg/int_test_content/sync_file/jcr_root/conf/mysite/$_sling_configs/com.mysite.pdfviewer.PdfViewerCaConfig/$.content.xml create mode 100644 pkg/int_test_content/sync_file/jcr_root/content/mysite/us/en/$.content.xml create mode 100644 pkg/sync_file_test.go delete mode 100644 pkg/test/output.go delete mode 100644 pkg/test/sync_file_test.go diff --git a/pkg/test/filter_file_test.go b/pkg/filter_file_test.go similarity index 80% rename from pkg/test/filter_file_test.go rename to pkg/filter_file_test.go index 30c8c0a3..15a4bf98 100644 --- a/pkg/test/filter_file_test.go +++ b/pkg/filter_file_test.go @@ -1,4 +1,6 @@ -package test +//go:build int_test + +package pkg_test import ( "github.com/wttech/aemc/pkg/common/tplx" @@ -22,7 +24,7 @@ func testFilterFile(t *testing.T, filterFile string, expectedFile string, data m } func TestFilterRoots(t *testing.T) { - testFilterFile(t, "vault/META-INF/vault/filter.xml", "output/filter_roots.xml", + testFilterFile(t, "vault/META-INF/vault/filter.xml", "int_test_content/filter_roots.xml", map[string]any{ "FilterRoots": []string{"/apps/my_site", "/content/my_site"}, }, @@ -30,7 +32,7 @@ func TestFilterRoots(t *testing.T) { } func TestExcludePatterns(t *testing.T) { - testFilterFile(t, "vault/META-INF/vault/filter.xml", "output/exclude_patterns.xml", + testFilterFile(t, "vault/META-INF/vault/filter.xml", "int_test_content/exclude_patterns.xml", map[string]any{ "FilterRoots": []string{"/apps/my_site", "/content/my_site"}, "ExcludePatterns": []string{"/apps/my_site/cq:dialog(/.*)?", "/apps/my_site/rep:policy(/.*)?"}, diff --git a/pkg/test/filter_root_test.go b/pkg/filter_root_test.go similarity index 98% rename from pkg/test/filter_root_test.go rename to pkg/filter_root_test.go index 922a8764..834dbb98 100644 --- a/pkg/test/filter_root_test.go +++ b/pkg/filter_root_test.go @@ -1,4 +1,6 @@ -package test +//go:build int_test + +package pkg_test import ( "github.com/wttech/aemc/pkg" diff --git a/pkg/instance_test.go b/pkg/instance_test.go index 44b78f73..7b51497a 100644 --- a/pkg/instance_test.go +++ b/pkg/instance_test.go @@ -1,3 +1,5 @@ +//go:build int_test + package pkg_test import ( diff --git a/pkg/test/output/exclude_patterns.xml b/pkg/int_test_content/exclude_patterns.xml similarity index 100% rename from pkg/test/output/exclude_patterns.xml rename to pkg/int_test_content/exclude_patterns.xml diff --git a/pkg/test/output/filter_roots.xml b/pkg/int_test_content/filter_roots.xml similarity index 100% rename from pkg/test/output/filter_roots.xml rename to pkg/int_test_content/filter_roots.xml diff --git a/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/$.content.xml b/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/$.content.xml deleted file mode 100644 index cbb48e78..00000000 --- a/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/$.content.xml +++ /dev/null @@ -1,8 +0,0 @@ - - diff --git a/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css.txt b/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css.txt deleted file mode 100644 index f852363a..00000000 --- a/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css.txt +++ /dev/null @@ -1,3 +0,0 @@ -#base=css - -site.css \ No newline at end of file diff --git a/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css/site.css b/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css/site.css deleted file mode 100644 index 3a86ca3b..00000000 --- a/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css/site.css +++ /dev/null @@ -1 +0,0 @@ -body,html{background:#ececec;color:#202020;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:1pc;line-height:1.5;margin:0}@media(prefers-color-scheme:dark){body,html{background:#131313;color:#dfdfdf}}a{color:#2020e0}@media(prefers-color-scheme:dark){a{color:#dfdf1f}}button,input,optgroup,select,textarea{font:inherit}.cmp-helloworld__item-label{margin-bottom:0}.cmp-helloworld__item-output{margin-top:0}.cmp-navigation__item--level-0:hover>.cmp-navigation__group{background:#ececec}main.container{padding:.5em 1em}footer.experiencefragment{border-top:1px solid #202020;padding:.5em 1em}@media(prefers-color-scheme:dark){footer.experiencefragment{border-color:#dfdfdf}}footer.experiencefragment .cmp-separator__horizontal-rule{border:0;margin:0}header.experiencefragment{border-bottom:1px solid #202020;padding:.5em 1em}@media(prefers-color-scheme:dark){header.experiencefragment{border-bottom-color:#dfdfdf}}header.experiencefragment a{color:#202020;text-decoration:none}@media(prefers-color-scheme:dark){header.experiencefragment a{color:#dfdfdf}}header.experiencefragment a:focus,header.experiencefragment a:hover{color:#2020e0;text-decoration:underline}@media(prefers-color-scheme:dark){header.experiencefragment a:focus,header.experiencefragment a:hover{color:#dfdf1f}}header.experiencefragment .cmp-container{display:grid;grid-template-columns:4fr 1fr 1fr}header.experiencefragment .cmp-navigation__group{list-style:none;margin:0;padding:0}header.experiencefragment .cmp-navigation__item--level-0{display:grid;grid-template-columns:1fr 3fr}header.experiencefragment .cmp-navigation__item--level-0>.cmp-navigation__group{display:grid;grid-template-columns:repeat(3,1fr)}header.experiencefragment .cmp-navigation__item-link{display:block}header.experiencefragment .cmp-navigation__item--active>.cmp-navigation__item-link{font-weight:700}header.experiencefragment .cmp-languagenavigation{position:relative}header.experiencefragment .cmp-languagenavigation:before{background-image:url('data:image/svg+xml;utf8,');background-repeat:no-repeat;content:" ";display:block;height:1.5em}@media(prefers-color-scheme:dark){header.experiencefragment .cmp-languagenavigation:before{background-image:url('data:image/svg+xml;utf8,')}}header.experiencefragment .cmp-languagenavigation>.cmp-languagenavigation__group{background:#ececec;border:1px solid #202020;border-top:0;padding:0 8px;position:absolute;top:34px;-webkit-transition-delay:.5s;transition-delay:.5s;visibility:hidden;width:20em}@media(prefers-color-scheme:dark){header.experiencefragment .cmp-languagenavigation>.cmp-languagenavigation__group{background:#131313;border-color:#dfdfdf}}header.experiencefragment .cmp-languagenavigation:hover>.cmp-languagenavigation__group{-webkit-transition-delay:0s;transition-delay:0s;visibility:visible}header.experiencefragment .cmp-languagenavigation__group{list-style:none;margin:0;padding:0}header.experiencefragment .cmp-languagenavigation__item-title{font-size:x-small;text-transform:uppercase}header.experiencefragment .cmp-languagenavigation__item--level-0{margin-bottom:.5em}header.experiencefragment .cmp-languagenavigation__item--level-1{display:inline}header.experiencefragment .cmp-languagenavigation__item--level-1:not(:first-child):before{content:" | "}header.experiencefragment .cmp-languagenavigation__item--active>.cmp-languagenavigation__item-link{font-weight:700}header.experiencefragment .cmp-search__field{display:-webkit-box;display:-ms-flexbox;display:flex;margin:-3px 0}header.experiencefragment .cmp-search__input{height:26px} \ No newline at end of file diff --git a/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js.txt b/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js.txt deleted file mode 100644 index ffaf1afa..00000000 --- a/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js.txt +++ /dev/null @@ -1,3 +0,0 @@ -#base=js - -site.js \ No newline at end of file diff --git a/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js/site.js b/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js/site.js deleted file mode 100644 index 1ca7fa6c..00000000 --- a/pkg/int_test_content/main_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js/site.js +++ /dev/null @@ -1 +0,0 @@ -!function(){var e={356:function(){!function(){"use strict";var e='[data-cmp-is="helloworld"]',t='[data-cmp-hook-helloworld="property"]',n='[data-cmp-hook-helloworld="model"]';function o(e){e&&e.element&&function(e){e.element.removeAttribute("data-cmp-is");var o=e.element.querySelectorAll(t);o=1==o.length?o[0].textContent:null;var r=e.element.querySelectorAll(n);r=1==r.length?r[0].textContent:null,console&&console.log&&console.log("HelloWorld component JavaScript example","\nText property:\n",o,"\nModel message:\n",r)}(e)}function r(){for(var t=document.querySelectorAll(e),n=0;n0&&n.forEach((function(t){t.querySelectorAll&&[].slice.call(t.querySelectorAll(e)).forEach((function(e){new o({element:e})}))}))}))})).observe(l,{subtree:!0,childList:!0,characterData:!0})}"loading"!==document.readyState?r():document.addEventListener("DOMContentLoaded",r)}()}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,n),l.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";n(356)}()}(); \ No newline at end of file diff --git a/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/$.content.xml b/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/$.content.xml deleted file mode 100644 index 491392d5..00000000 --- a/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/$.content.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/initial/$.content.xml b/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/initial/$.content.xml deleted file mode 100644 index 20a1550d..00000000 --- a/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/initial/$.content.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/policies/$.content.xml b/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/policies/$.content.xml deleted file mode 100644 index 20096f30..00000000 --- a/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/policies/$.content.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/structure/$.content.xml b/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/structure/$.content.xml deleted file mode 100644 index 911a61a3..00000000 --- a/pkg/int_test_content/main_content/jcr_root/conf/mysite/settings/wcm/template-types/page/structure/$.content.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/$.content.xml b/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/$.content.xml deleted file mode 100644 index ee2e45c7..00000000 --- a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/$.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/$.content.xml b/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/$.content.xml deleted file mode 100644 index 32703c6c..00000000 --- a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/$.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/config/$.content.xml b/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/config/$.content.xml deleted file mode 100644 index 5b1063ab..00000000 --- a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/config/$.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/config/asset_processing/$.content.xml b/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/config/asset_processing/$.content.xml deleted file mode 100644 index 5dfea319..00000000 --- a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/launcher/config/asset_processing/$.content.xml +++ /dev/null @@ -1,12 +0,0 @@ - - diff --git a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/models/$.content.xml b/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/models/$.content.xml deleted file mode 100644 index 9f576d29..00000000 --- a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/models/$.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/models/archive_page/$.content.xml b/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/models/archive_page/$.content.xml deleted file mode 100644 index 41aa947b..00000000 --- a/pkg/int_test_content/main_content/jcr_root/conf/mysite/workflow/models/archive_page/$.content.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - <_x0031_ - jcr:primaryType="nt:unstructured" - sling:resourceType="cq/flow/components/parsys"> - - - - - <_x0032_ - jcr:primaryType="nt:unstructured" - sling:resourceType="cq/flow/components/parsys"> - - - - - - - - - - - - - - - - - - - - diff --git a/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/$.content.xml b/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/$.content.xml deleted file mode 100644 index cbb48e78..00000000 --- a/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/$.content.xml +++ /dev/null @@ -1,8 +0,0 @@ - - diff --git a/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css.txt b/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css.txt deleted file mode 100644 index f852363a..00000000 --- a/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css.txt +++ /dev/null @@ -1,3 +0,0 @@ -#base=css - -site.css \ No newline at end of file diff --git a/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css/site.css b/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css/site.css deleted file mode 100644 index 3a86ca3b..00000000 --- a/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/css/site.css +++ /dev/null @@ -1 +0,0 @@ -body,html{background:#ececec;color:#202020;font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:1pc;line-height:1.5;margin:0}@media(prefers-color-scheme:dark){body,html{background:#131313;color:#dfdfdf}}a{color:#2020e0}@media(prefers-color-scheme:dark){a{color:#dfdf1f}}button,input,optgroup,select,textarea{font:inherit}.cmp-helloworld__item-label{margin-bottom:0}.cmp-helloworld__item-output{margin-top:0}.cmp-navigation__item--level-0:hover>.cmp-navigation__group{background:#ececec}main.container{padding:.5em 1em}footer.experiencefragment{border-top:1px solid #202020;padding:.5em 1em}@media(prefers-color-scheme:dark){footer.experiencefragment{border-color:#dfdfdf}}footer.experiencefragment .cmp-separator__horizontal-rule{border:0;margin:0}header.experiencefragment{border-bottom:1px solid #202020;padding:.5em 1em}@media(prefers-color-scheme:dark){header.experiencefragment{border-bottom-color:#dfdfdf}}header.experiencefragment a{color:#202020;text-decoration:none}@media(prefers-color-scheme:dark){header.experiencefragment a{color:#dfdfdf}}header.experiencefragment a:focus,header.experiencefragment a:hover{color:#2020e0;text-decoration:underline}@media(prefers-color-scheme:dark){header.experiencefragment a:focus,header.experiencefragment a:hover{color:#dfdf1f}}header.experiencefragment .cmp-container{display:grid;grid-template-columns:4fr 1fr 1fr}header.experiencefragment .cmp-navigation__group{list-style:none;margin:0;padding:0}header.experiencefragment .cmp-navigation__item--level-0{display:grid;grid-template-columns:1fr 3fr}header.experiencefragment .cmp-navigation__item--level-0>.cmp-navigation__group{display:grid;grid-template-columns:repeat(3,1fr)}header.experiencefragment .cmp-navigation__item-link{display:block}header.experiencefragment .cmp-navigation__item--active>.cmp-navigation__item-link{font-weight:700}header.experiencefragment .cmp-languagenavigation{position:relative}header.experiencefragment .cmp-languagenavigation:before{background-image:url('data:image/svg+xml;utf8,');background-repeat:no-repeat;content:" ";display:block;height:1.5em}@media(prefers-color-scheme:dark){header.experiencefragment .cmp-languagenavigation:before{background-image:url('data:image/svg+xml;utf8,')}}header.experiencefragment .cmp-languagenavigation>.cmp-languagenavigation__group{background:#ececec;border:1px solid #202020;border-top:0;padding:0 8px;position:absolute;top:34px;-webkit-transition-delay:.5s;transition-delay:.5s;visibility:hidden;width:20em}@media(prefers-color-scheme:dark){header.experiencefragment .cmp-languagenavigation>.cmp-languagenavigation__group{background:#131313;border-color:#dfdfdf}}header.experiencefragment .cmp-languagenavigation:hover>.cmp-languagenavigation__group{-webkit-transition-delay:0s;transition-delay:0s;visibility:visible}header.experiencefragment .cmp-languagenavigation__group{list-style:none;margin:0;padding:0}header.experiencefragment .cmp-languagenavigation__item-title{font-size:x-small;text-transform:uppercase}header.experiencefragment .cmp-languagenavigation__item--level-0{margin-bottom:.5em}header.experiencefragment .cmp-languagenavigation__item--level-1{display:inline}header.experiencefragment .cmp-languagenavigation__item--level-1:not(:first-child):before{content:" | "}header.experiencefragment .cmp-languagenavigation__item--active>.cmp-languagenavigation__item-link{font-weight:700}header.experiencefragment .cmp-search__field{display:-webkit-box;display:-ms-flexbox;display:flex;margin:-3px 0}header.experiencefragment .cmp-search__input{height:26px} \ No newline at end of file diff --git a/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js.txt b/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js.txt deleted file mode 100644 index ffaf1afa..00000000 --- a/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js.txt +++ /dev/null @@ -1,3 +0,0 @@ -#base=js - -site.js \ No newline at end of file diff --git a/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js/site.js b/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js/site.js deleted file mode 100644 index 1ca7fa6c..00000000 --- a/pkg/int_test_content/new_content/jcr_root/apps/mysite/clientlibs/clientlib-site/js/site.js +++ /dev/null @@ -1 +0,0 @@ -!function(){var e={356:function(){!function(){"use strict";var e='[data-cmp-is="helloworld"]',t='[data-cmp-hook-helloworld="property"]',n='[data-cmp-hook-helloworld="model"]';function o(e){e&&e.element&&function(e){e.element.removeAttribute("data-cmp-is");var o=e.element.querySelectorAll(t);o=1==o.length?o[0].textContent:null;var r=e.element.querySelectorAll(n);r=1==r.length?r[0].textContent:null,console&&console.log&&console.log("HelloWorld component JavaScript example","\nText property:\n",o,"\nModel message:\n",r)}(e)}function r(){for(var t=document.querySelectorAll(e),n=0;n0&&n.forEach((function(t){t.querySelectorAll&&[].slice.call(t.querySelectorAll(e)).forEach((function(e){new o({element:e})}))}))}))})).observe(l,{subtree:!0,childList:!0,characterData:!0})}"loading"!==document.readyState?r():document.addEventListener("DOMContentLoaded",r)}()}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var l=t[o]={exports:{}};return e[o](l,l.exports,n),l.exports}n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,{a:t}),t},n.d=function(e,t){for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},function(){"use strict";n(356)}()}(); \ No newline at end of file diff --git a/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/$.content.xml b/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/$.content.xml deleted file mode 100644 index 491392d5..00000000 --- a/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/$.content.xml +++ /dev/null @@ -1,3 +0,0 @@ - - diff --git a/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/initial/$.content.xml b/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/initial/$.content.xml deleted file mode 100644 index 20a1550d..00000000 --- a/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/initial/$.content.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/policies/$.content.xml b/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/policies/$.content.xml deleted file mode 100644 index 20096f30..00000000 --- a/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/policies/$.content.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - diff --git a/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/structure/$.content.xml b/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/structure/$.content.xml deleted file mode 100644 index 911a61a3..00000000 --- a/pkg/int_test_content/new_content/jcr_root/conf/mysite/settings/wcm/template-types/page/structure/$.content.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/$.content.xml b/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/$.content.xml deleted file mode 100644 index ee2e45c7..00000000 --- a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/$.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/$.content.xml b/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/$.content.xml deleted file mode 100644 index 32703c6c..00000000 --- a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/$.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/config/$.content.xml b/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/config/$.content.xml deleted file mode 100644 index 5b1063ab..00000000 --- a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/config/$.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/config/asset_processing/$.content.xml b/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/config/asset_processing/$.content.xml deleted file mode 100644 index 746cf1ea..00000000 --- a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/launcher/config/asset_processing/$.content.xml +++ /dev/null @@ -1,13 +0,0 @@ - - diff --git a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/models/$.content.xml b/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/models/$.content.xml deleted file mode 100644 index 9f576d29..00000000 --- a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/models/$.content.xml +++ /dev/null @@ -1,4 +0,0 @@ - - diff --git a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/models/archive_page/$.content.xml b/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/models/archive_page/$.content.xml deleted file mode 100644 index 41aa947b..00000000 --- a/pkg/int_test_content/new_content/jcr_root/conf/mysite/workflow/models/archive_page/$.content.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - <_x0031_ - jcr:primaryType="nt:unstructured" - sling:resourceType="cq/flow/components/parsys"> - - - - - <_x0032_ - jcr:primaryType="nt:unstructured" - sling:resourceType="cq/flow/components/parsys"> - - - - - - - - - - - - - - - - - - - - diff --git a/pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/$_cq_editConfig.xml b/pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/$_cq_editConfig.xml new file mode 100644 index 00000000..e6cda673 --- /dev/null +++ b/pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/$_cq_editConfig.xml @@ -0,0 +1,12 @@ + + + + diff --git a/pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/$_cq_template/$.content.xml b/pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/$_cq_template/$.content.xml new file mode 100644 index 00000000..d42a4753 --- /dev/null +++ b/pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/$_cq_template/$.content.xml @@ -0,0 +1,4 @@ + + diff --git a/pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/helloworld.html b/pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/helloworld.html new file mode 100644 index 00000000..c036fb3e --- /dev/null +++ b/pkg/int_test_content/sync_file/jcr_root/apps/mysite/components/helloworld/helloworld.html @@ -0,0 +1,11 @@ +
+

Hello World Component

+
+
Text property:
+
${properties.text}
+
+
+
Model message:
+
${model.message}
+
+
diff --git a/pkg/int_test_content/sync_file/jcr_root/conf/mysite/$_sling_configs/$.content.xml b/pkg/int_test_content/sync_file/jcr_root/conf/mysite/$_sling_configs/$.content.xml new file mode 100644 index 00000000..a9759f5f --- /dev/null +++ b/pkg/int_test_content/sync_file/jcr_root/conf/mysite/$_sling_configs/$.content.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/pkg/int_test_content/sync_file/jcr_root/conf/mysite/$_sling_configs/com.mysite.pdfviewer.PdfViewerCaConfig/$.content.xml b/pkg/int_test_content/sync_file/jcr_root/conf/mysite/$_sling_configs/com.mysite.pdfviewer.PdfViewerCaConfig/$.content.xml new file mode 100644 index 00000000..725d21ea --- /dev/null +++ b/pkg/int_test_content/sync_file/jcr_root/conf/mysite/$_sling_configs/com.mysite.pdfviewer.PdfViewerCaConfig/$.content.xml @@ -0,0 +1,9 @@ + + + + diff --git a/pkg/int_test_content/sync_file/jcr_root/content/mysite/us/en/$.content.xml b/pkg/int_test_content/sync_file/jcr_root/content/mysite/us/en/$.content.xml new file mode 100644 index 00000000..5d91f0fc --- /dev/null +++ b/pkg/int_test_content/sync_file/jcr_root/content/mysite/us/en/$.content.xml @@ -0,0 +1,83 @@ + + + + + + + <container + jcr:primaryType="nt:unstructured" + sling:resourceType="mysite/components/container" + layout="responsiveGrid"> + <teaser + jcr:description="<p>Don't stop half way, go for the top!</p> " + jcr:primaryType="nt:unstructured" + jcr:title="Epic Journey" + sling:resourceType="mysite/components/teaser" + actionsEnabled="false" + descriptionFromPage="false" + textIsRich="true" + titleFromPage="false"> + <cq:responsive jcr:primaryType="nt:unstructured"> + <default + jcr:primaryType="nt:unstructured" + offset="0" + width="4"/> + </cq:responsive> + </teaser> + <teaser_copy + jcr:description="<p>Don't stop half way, go for the top!</p> " + jcr:primaryType="nt:unstructured" + jcr:title="Epic Journey" + sling:resourceType="mysite/components/teaser" + actionsEnabled="false" + descriptionFromPage="false" + textIsRich="true" + titleFromPage="false"> + <cq:responsive jcr:primaryType="nt:unstructured"> + <default + jcr:primaryType="nt:unstructured" + offset="0" + width="4"/> + </cq:responsive> + </teaser_copy> + <teaser_copy_1579324932 + jcr:description="<p>Don't stop half way, go for the top!</p> " + jcr:primaryType="nt:unstructured" + jcr:title="Epic Journey" + sling:resourceType="mysite/components/teaser" + actionsEnabled="false" + descriptionFromPage="false" + textIsRich="true" + titleFromPage="false"> + <cq:responsive jcr:primaryType="nt:unstructured"> + <default + jcr:primaryType="nt:unstructured" + offset="0" + width="4"/> + </cq:responsive> + </teaser_copy_1579324932> + <helloworld + jcr:primaryType="nt:unstructured" + sling:resourceType="mysite/components/helloworld" + text="lalala :)"/> + </container> + </container> + </root> + </jcr:content> +</jcr:root> diff --git a/pkg/sync_file_test.go b/pkg/sync_file_test.go new file mode 100644 index 00000000..e248eabd --- /dev/null +++ b/pkg/sync_file_test.go @@ -0,0 +1,43 @@ +//go:build int_test + +package pkg_test + +import ( + "github.com/wttech/aemc/pkg" + "github.com/wttech/aemc/pkg/common/pathx" + "github.com/wttech/aemc/pkg/content" + "os" + "path/filepath" + "strings" + "testing" +) + +func TestDetermineSyncFile(t *testing.T) { + workDir := pathx.RandomDir(os.TempDir(), "sync_file") + defer func() { _ = pathx.DeleteIfExists(workDir) }() + if err := copyFiles("int_test_content/sync_file", workDir); err != nil { + t.Fatal(err) + } + + tests := []struct { + path, expected string + }{ + {"/content/mysite/us/en/.content.xml", "/content/mysite/us/en/.content.xml"}, + {"/apps/mysite/components/helloworld/_cq_template/.content.xml", "/apps/mysite/components/helloworld/_cq_template/.content.xml"}, + {"/apps/mysite/components/helloworld/_cq_template.xml", "/apps/mysite/components/helloworld/_cq_template/.content.xml"}, + {"/apps/mysite/components/helloworld/_cq_editConfig.xml", "/apps/mysite/components/helloworld/_cq_editConfig.xml"}, + {"/apps/mysite/components/helloworld/helloworld.html", "/apps/mysite/components/helloworld/helloworld.html"}, + {"/conf/mysite/_sling_configs/com.mysite.pdfviewer.PdfViewerCaConfig/.content.xml", "/conf/mysite/_sling_configs/com.mysite.pdfviewer.PdfViewerCaConfig/.content.xml"}, + {"/conf/mysite/_sling_configs/.content.xml", "/conf/mysite/_sling_configs/.content.xml"}, + {"/content/mysite/us/en/.content.xml", "/content/mysite/us/en/.content.xml"}, + } + for _, test := range tests { + path := filepath.Join(workDir, content.JCRRoot, test.path) + expected := filepath.Join(workDir, content.JCRRoot, test.expected) + actual := pkg.DetermineSyncFile(workDir, path) + if actual != expected { + _, jcrPath, _ := strings.Cut(actual, content.JCRRoot) + t.Errorf("DetermineSyncFile(%s) = %s; want %s", test.path, jcrPath, test.expected) + } + } +} diff --git a/pkg/test/output.go b/pkg/test/output.go deleted file mode 100644 index 56a834e2..00000000 --- a/pkg/test/output.go +++ /dev/null @@ -1,6 +0,0 @@ -package test - -import "embed" - -//go:embed output -var VaultFS embed.FS diff --git a/pkg/test/sync_file_test.go b/pkg/test/sync_file_test.go deleted file mode 100644 index f9d066c2..00000000 --- a/pkg/test/sync_file_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package test - -import ( - "github.com/wttech/aemc/pkg" - "testing" -) - -func TestDetermineSyncFile(t *testing.T) { - tests := []struct { - path, expected string - }{ - {"/somepath/jcr_root/content/my_file.xml", "/somepath/jcr_root/content/my_file.xml"}, - {"/somepath/jcr_root/content/_jcr_content/my_file.xml", "/somepath/jcr_root/content/_jcr_content/my_file.xml"}, - {"/somepath/jcr_root/content/_jcr_content/_cq_file.xml", "/somepath/jcr_root/content/_jcr_content/_cq_file/.content.xml"}, - {"/somepath/jcr_root/content/_cq_file.xml", "/somepath/jcr_root/content/_cq_file/.content.xml"}, - {"/somepath/jcr_root/content/_cq_file/.content.xml", "/somepath/jcr_root/content/_cq_file/.content.xml"}, - {"/somepath/jcr_root/content/.content.xml", "/somepath/jcr_root/content/.content.xml"}, - } - for _, test := range tests { - actual := pkg.DetermineSyncFile(test.path) - if actual != test.expected { - t.Errorf("DetermineSyncFile(%s) = %s; want %s", test.path, actual, test.expected) - } - } -}