-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SITES-20993 - Identifier com.adobe.cq.wcm.core.components.models.Comp…
…onentFiles cannot be correctly instantiated by the Use API (#2707) * Replaced injector annotations * Added test and test content for AMP page rendering * Cleanup unused import * Added empty head.socialmedia.html to avoid error logging in case the custom components do not provide one * Updated unit tests
- Loading branch information
1 parent
d87fc10
commit c2039a2
Showing
6 changed files
with
134 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
15 changes: 15 additions & 0 deletions
15
...ntent/jcr_root/apps/core/wcm/extensions/amp/components/page/v1/page/head.socialmedia.html
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,15 @@ | ||
<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
~ Copyright 2024 Adobe Systems Incorporated | ||
~ | ||
~ 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. | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/--> |
53 changes: 53 additions & 0 deletions
53
...it/http/src/test/java/com/adobe/cq/wcm/core/components/it/http/page/amp/v1/AmpPageIT.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,53 @@ | ||
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
~ Copyright 2024 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.it.http.page.amp.v1; | ||
|
||
import org.apache.sling.testing.clients.ClientException; | ||
import org.junit.BeforeClass; | ||
import org.junit.ClassRule; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.ErrorCollector; | ||
|
||
import com.adobe.cq.testing.client.CQClient; | ||
import com.adobe.cq.testing.junit.assertion.GraniteAssert; | ||
import com.adobe.cq.testing.junit.rules.CQAuthorPublishClassRule; | ||
import com.adobe.cq.testing.junit.rules.CQRule; | ||
|
||
public class AmpPageIT { | ||
|
||
@ClassRule | ||
public static final CQAuthorPublishClassRule cqBaseClassRule = new CQAuthorPublishClassRule(); | ||
|
||
@Rule | ||
public CQRule cqBaseRule = new CQRule(cqBaseClassRule.authorRule, cqBaseClassRule.publishRule); | ||
|
||
@Rule | ||
public ErrorCollector collector = new ErrorCollector(); | ||
|
||
static CQClient adminAuthor; | ||
|
||
@BeforeClass | ||
public static void beforeClass() { | ||
adminAuthor = cqBaseClassRule.authorRule.getAdminClient(CQClient.class); | ||
} | ||
|
||
@Test | ||
public void testAmpVersion() throws ClientException { | ||
String content = adminAuthor.doGet("/content/core-components/simple-page/amp-page-v1.amp.html", 200).getContent(); | ||
GraniteAssert.assertRegExFind(content, "AMP Title"); | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...content/src/content/jcr_root/content/core-components/simple-page/amp-page-v1/.content.xml
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,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
~ Copyright 2024 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. | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--> | ||
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:sling="http://sling.apache.org/jcr/sling/1.0" | ||
jcr:primaryType="cq:Page"> | ||
<jcr:content | ||
cq:lastModified="{Date}2024-03-29T09:33:24.972+02:00" | ||
cq:lastModifiedBy="admin" | ||
cq:template="/conf/core-components/settings/wcm/templates/simple-template-v3" | ||
jcr:primaryType="cq:PageContent" | ||
jcr:title="AMP Page V1" | ||
sling:resourceType="core/wcm/extensions/amp/components/page/v1/page" | ||
ampMode="pairedAmp" | ||
pwaCachestrategy="staleWhileRevalidate" | ||
pwaDisplay="standalone" | ||
pwaOrientation="any"> | ||
<root | ||
jcr:lastModified="{Date}2022-02-28T21:16:58.722+01:00" | ||
jcr:lastModifiedBy="admin" | ||
jcr:primaryType="nt:unstructured" | ||
sling:resourceType="core/wcm/components/container/v1/container"> | ||
<container | ||
jcr:created="{Date}2022-02-28T21:39:47.218+01:00" | ||
jcr:createdBy="admin" | ||
jcr:lastModified="{Date}2022-02-28T21:39:55.841+01:00" | ||
jcr:lastModifiedBy="admin" | ||
jcr:primaryType="nt:unstructured" | ||
sling:resourceType="core/wcm/components/container/v1/container" | ||
layout="responsiveGrid"> | ||
<title | ||
jcr:created="{Date}2022-02-28T21:41:13.598+01:00" | ||
jcr:createdBy="admin" | ||
jcr:lastModified="{Date}2022-02-28T21:41:13.598+01:00" | ||
jcr:lastModifiedBy="admin" | ||
jcr:primaryType="nt:unstructured" | ||
jcr:title="AMP Title" | ||
sling:resourceType="core/wcm/components/title/v3/title"/> | ||
</container> | ||
</root> | ||
<cq:featuredimage | ||
jcr:lastModified="{Date}2024-03-29T09:33:24.966+02:00" | ||
jcr:lastModifiedBy="admin" | ||
jcr:primaryType="nt:unstructured" | ||
sling:resourceType="core/wcm/components/image/v3/image" | ||
altValueFromDAM="false"/> | ||
</jcr:content> | ||
</jcr:root> |