Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Experience Fragment also exports the actual contents of the experience fragment directly in itself * Change fragment path to fragment variation path * RAT files, test coverage * Removed unused import * improve test coverage to meet requirements * formatting Co-authored-by: Niek Raaijmakers <niek@adobe.com>
- Loading branch information
1 parent
b179741
commit 80f3f56
Showing
35 changed files
with
684 additions
and
143 deletions.
There are no files selected for viewing
261 changes: 191 additions & 70 deletions
261
...main/java/com/adobe/cq/wcm/core/components/internal/models/v1/ExperienceFragmentImpl.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
...test/java/com/adobe/cq/wcm/core/components/internal/models/dummy/DummyTestImageModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
~ Copyright 2017 Adobe | ||
~ | ||
~ Licensed 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 com.adobe.cq.wcm.core.components.internal.models.dummy; | ||
|
||
import com.adobe.cq.export.json.ComponentExporter; | ||
import com.adobe.cq.export.json.ExporterConstants; | ||
import org.apache.sling.api.SlingHttpServletRequest; | ||
import org.apache.sling.models.annotations.DefaultInjectionStrategy; | ||
import org.apache.sling.models.annotations.Exporter; | ||
import org.apache.sling.models.annotations.Model; | ||
import org.apache.sling.models.annotations.injectorspecific.ValueMapValue; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
@Model( | ||
adaptables = SlingHttpServletRequest.class, | ||
adapters = {DummyTestImageModel.class, ComponentExporter.class}, | ||
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL, | ||
resourceType = DummyTestImageModel.RESOURCE_TYPE) | ||
@Exporter( | ||
name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, | ||
extensions = ExporterConstants.SLING_MODEL_EXTENSION) | ||
public class DummyTestImageModel implements ComponentExporter { | ||
|
||
static final String RESOURCE_TYPE = "my/test/image"; | ||
|
||
@ValueMapValue | ||
private String url; | ||
|
||
public String getUrl() { | ||
return url; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String getExportedType() { | ||
return RESOURCE_TYPE; | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
.../test/java/com/adobe/cq/wcm/core/components/internal/models/dummy/DummyTestTextModel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
~ Copyright 2017 Adobe | ||
~ | ||
~ Licensed 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 com.adobe.cq.wcm.core.components.internal.models.dummy; | ||
|
||
import com.adobe.cq.export.json.ComponentExporter; | ||
import com.adobe.cq.export.json.ExporterConstants; | ||
import org.apache.sling.api.SlingHttpServletRequest; | ||
import org.apache.sling.models.annotations.DefaultInjectionStrategy; | ||
import org.apache.sling.models.annotations.Exporter; | ||
import org.apache.sling.models.annotations.Model; | ||
import org.apache.sling.models.annotations.injectorspecific.ValueMapValue; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
@Model( | ||
adaptables = SlingHttpServletRequest.class, | ||
adapters = {DummyTestTextModel.class, ComponentExporter.class}, | ||
defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL, | ||
resourceType = DummyTestTextModel.RESOURCE_TYPE) | ||
@Exporter( | ||
name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, | ||
extensions = ExporterConstants.SLING_MODEL_EXTENSION) | ||
public class DummyTestTextModel implements ComponentExporter { | ||
|
||
static final String RESOURCE_TYPE = "my/test/text"; | ||
|
||
@ValueMapValue | ||
private String text; | ||
|
||
public String getText() { | ||
return text; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public String getExportedType() { | ||
return RESOURCE_TYPE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 7 additions & 3 deletions
10
bundles/core/src/test/resources/experiencefragment/exporter-xf1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
{ | ||
"localizedFragmentVariationPath":"/content/experience-fragments/mysite/en/footer/master/jcr:content", | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} | ||
"localizedFragmentVariationPath": "/content/experience-fragments/mysite/en/footer/master/jcr:content", | ||
"configured": false, | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment", | ||
":itemsOrder": [], | ||
":items": {}, | ||
"classNames": "aem-xf empty" | ||
} |
10 changes: 7 additions & 3 deletions
10
bundles/core/src/test/resources/experiencefragment/exporter-xf10.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
{ | ||
"localizedFragmentVariationPath":"/content/experience-fragments/mysite/en/footer/master/jcr:content", | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} | ||
"localizedFragmentVariationPath": "/content/experience-fragments/mysite/en/footer/master/jcr:content", | ||
"configured": false, | ||
"classNames": "aem-xf empty", | ||
":itemsOrder": [], | ||
":items": {}, | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} |
10 changes: 7 additions & 3 deletions
10
bundles/core/src/test/resources/experiencefragment/exporter-xf11.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
{ | ||
"localizedFragmentVariationPath":"/content/experience-fragments/mysite/es/footer/master/jcr:content", | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} | ||
"localizedFragmentVariationPath": "/content/experience-fragments/mysite/es/footer/master/jcr:content", | ||
"configured": false, | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment", | ||
"classNames": "aem-xf empty", | ||
":itemsOrder": [], | ||
":items": {} | ||
} |
10 changes: 7 additions & 3 deletions
10
bundles/core/src/test/resources/experiencefragment/exporter-xf11a.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
{ | ||
"localizedFragmentVariationPath":"/content/experience-fragments/mysite/en/footer/master/jcr:content", | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} | ||
"localizedFragmentVariationPath": "/content/experience-fragments/mysite/en/footer/master/jcr:content", | ||
"configured": false, | ||
":itemsOrder": [], | ||
":items": {}, | ||
"classNames": "aem-xf empty", | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} |
8 changes: 6 additions & 2 deletions
8
bundles/core/src/test/resources/experiencefragment/exporter-xf12.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{ | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} | ||
"configured": false, | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment", | ||
":itemsOrder": [], | ||
":items": {}, | ||
"classNames": "aem-xf empty" | ||
} |
8 changes: 6 additions & 2 deletions
8
bundles/core/src/test/resources/experiencefragment/exporter-xf13.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{ | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} | ||
"configured": false, | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment", | ||
"classNames": "aem-xf empty", | ||
":itemsOrder": [], | ||
":items": {} | ||
} |
7 changes: 7 additions & 0 deletions
7
bundles/core/src/test/resources/experiencefragment/exporter-xf13a.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"configured": false, | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment", | ||
"classNames": "aem-xf empty", | ||
":itemsOrder": [], | ||
":items": {} | ||
} |
6 changes: 5 additions & 1 deletion
6
bundles/core/src/test/resources/experiencefragment/exporter-xf2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{ | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
"configured":false, | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment", | ||
"classNames":"aem-xf empty", | ||
":itemsOrder":[], | ||
":items":{} | ||
} |
10 changes: 7 additions & 3 deletions
10
bundles/core/src/test/resources/experiencefragment/exporter-xf20.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
{ | ||
"localizedFragmentVariationPath":"/content/experience-fragments/mysite/us/en/footer/master/jcr:content", | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} | ||
"localizedFragmentVariationPath": "/content/experience-fragments/mysite/us/en/footer/master/jcr:content", | ||
"configured": false, | ||
":itemsOrder": [], | ||
":items": {}, | ||
"classNames": "aem-xf empty", | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} |
10 changes: 7 additions & 3 deletions
10
bundles/core/src/test/resources/experiencefragment/exporter-xf21.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
{ | ||
"localizedFragmentVariationPath":"/content/experience-fragments/mysite/us/es/footer/master/jcr:content", | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} | ||
"localizedFragmentVariationPath": "/content/experience-fragments/mysite/us/es/footer/master/jcr:content", | ||
"configured": false, | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment", | ||
"classNames": "aem-xf empty", | ||
":itemsOrder": [], | ||
":items": {} | ||
} |
10 changes: 7 additions & 3 deletions
10
bundles/core/src/test/resources/experiencefragment/exporter-xf21a.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
{ | ||
"localizedFragmentVariationPath":"/content/experience-fragments/mysite/us/en/footer/master/jcr:content", | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} | ||
"localizedFragmentVariationPath": "/content/experience-fragments/mysite/us/en/footer/master/jcr:content", | ||
"configured": false, | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment", | ||
"classNames": "aem-xf empty", | ||
":itemsOrder": [], | ||
":items": {} | ||
} |
8 changes: 6 additions & 2 deletions
8
bundles/core/src/test/resources/experiencefragment/exporter-xf22.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{ | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} | ||
"configured": false, | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment", | ||
":itemsOrder": [], | ||
":items": {}, | ||
"classNames": "aem-xf empty" | ||
} |
8 changes: 6 additions & 2 deletions
8
bundles/core/src/test/resources/experiencefragment/exporter-xf3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
{ | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment" | ||
} | ||
"configured": false, | ||
":type": "core/wcm/components/experiencefragment/v1/experiencefragment", | ||
"classNames": "aem-xf empty", | ||
":itemsOrder": [], | ||
":items": {} | ||
} |
Oops, something went wrong.