Skip to content

Commit ec73f41

Browse files
vjystvasrivastvrismehta
authored
FORMS-19758: Addition of fragmentPath to the CRISPR JSON in Author View (#1593)
* Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * updating crispr spec version in dialog * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * RTC Updated AdaptiveFormVersion * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Adding Default specVersionfor formcontainerv2 test * Added fragment path in Crispr json for Author view * RTC Adding Default specVersionfor formcontainerv2 test * RTC updating test baseline * updated baseline * updating baseline * Added test cases and addressed review comments * RTC Removed duplicate function * RTC Updated AdaptiveFormVersion * RTC Updated AdaptiveFormVersion or rest-submission * RTC Updated AdaptiveFormVersion or rest-submission * RTC Updated AdaptiveFormVersion in formcontainerv2 * RTC Updated AdaptiveFormVersion in formcontainerv2WithAutoSave * Fixing code formatting --------- Co-authored-by: srivastv <[email protected]> Co-authored-by: Rishi Mehta <[email protected]>
1 parent e4a040e commit ec73f41

File tree

43 files changed

+5134
-17
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+5134
-17
lines changed

bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FragmentImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
import com.adobe.cq.forms.core.components.models.form.FormContainer;
4444
import com.adobe.cq.forms.core.components.models.form.Fragment;
4545
import com.adobe.cq.forms.core.components.util.ComponentUtils;
46+
import com.adobe.cq.forms.core.components.views.Views;
4647
import com.fasterxml.jackson.annotation.JsonIgnore;
48+
import com.fasterxml.jackson.annotation.JsonView;
4749

4850
@Model(
4951
adaptables = { SlingHttpServletRequest.class, Resource.class },
@@ -80,7 +82,7 @@ private void initFragmentModel() {
8082
}
8183
}
8284

83-
@JsonIgnore
85+
@JsonView(Views.Author.class)
8486
public String getFragmentPath() {
8587
return fragmentPath;
8688
}

bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/models/form/FormContainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public interface FormContainer extends Container {
6464
*/
6565
String PN_CLIENT_LIB_REF = GuideConstants.CLIENT_LIB_REF;
6666

67-
String DEFAULT_FORMS_SPEC_VERSION = "0.14.2";
67+
String DEFAULT_FORMS_SPEC_VERSION = "0.15.2";
6868

6969
/**
7070
* Returns form metadata {@link FormMetaData}

bundles/af-core/src/test/java/com/adobe/cq/forms/core/Utils.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@
5353
*/
5454
public class Utils {
5555

56-
public static InputStream getJson(Object model) {
56+
public static InputStream getJson(Object model, Class<? extends Views.Publish> viewType) {
5757
Writer writer = new StringWriter();
5858
ObjectMapper mapper = new ObjectMapper();
5959
PageModuleProvider pageModuleProvider = new PageModuleProvider();
6060
mapper.registerModule(pageModuleProvider.getModule());
6161
DefaultMethodSkippingModuleProvider defaultMethodSkippingModuleProvider = new DefaultMethodSkippingModuleProvider();
6262
mapper.registerModule(defaultMethodSkippingModuleProvider.getModule());
6363
try {
64-
mapper.writerWithView(Views.Publish.class).writeValue(writer, model);
64+
mapper.writerWithView(viewType).writeValue(writer, model);
6565
} catch (IOException e) {
6666
fail(String.format("Unable to generate JSON export for model %s: %s", model.getClass().getName(),
6767
e.getMessage()));
@@ -77,7 +77,7 @@ public static InputStream getCompleteJson(Object model) {
7777
DefaultMethodSkippingModuleProvider defaultMethodSkippingModuleProvider = new DefaultMethodSkippingModuleProvider();
7878
mapper.registerModule(defaultMethodSkippingModuleProvider.getModule());
7979
try {
80-
mapper.writer().writeValue(writer, model);
80+
mapper.writerWithView(Views.Author.class).writeValue(writer, model);
8181
} catch (IOException e) {
8282
fail(String.format("Unable to generate JSON export for model %s: %s", model.getClass().getName(),
8383
e.getMessage()));
@@ -95,8 +95,8 @@ public static InputStream getCompleteJson(Object model) {
9595
* @param expectedJsonResource
9696
* the class path resource providing the expected JSON object
9797
*/
98-
public static void testJSONExport(Object model, String expectedJsonResource) {
99-
InputStream modeInputStream = getJson(model);
98+
public static void testJSONExport(Object model, String expectedJsonResource, Class<? extends Views.Publish> viewType) {
99+
InputStream modeInputStream = getJson(model, viewType);
100100
JsonReader outputReader = Json.createReader(modeInputStream);
101101
InputStream is = Utils.class.getResourceAsStream(expectedJsonResource);
102102
if (is != null) {
@@ -113,6 +113,20 @@ public static void testJSONExport(Object model, String expectedJsonResource) {
113113
}
114114
}
115115

116+
/**
117+
* Provided a {@code model} object and an {@code expectedJsonResource} identifying a JSON file in the class path,
118+
* this method will test the JSON export of the model and compare it to the JSON object provided by the
119+
* {@code expectedJsonResource}.
120+
*
121+
* @param model
122+
* the Sling Model
123+
* @param expectedJsonResource
124+
* the class path resource providing the expected JSON object
125+
*/
126+
public static void testJSONExport(Object model, String expectedJsonResource) {
127+
testJSONExport(model, expectedJsonResource, Views.Publish.class);
128+
}
129+
116130
/**
117131
* The given model is validated against adaptive form specification
118132
*
@@ -126,14 +140,14 @@ public static void testSchemaValidation(@NotNull Object model) {
126140
// create an instance of the JsonSchemaFactory using version flag
127141
JsonSchemaFactory schemaFactory = JsonSchemaFactory.getInstance(SpecVersion.VersionFlag.V7);
128142
try {
129-
InputStream schemaStream = Utils.class.getResourceAsStream("/schema/0.14.2/adaptive-form.schema.json");
143+
InputStream schemaStream = Utils.class.getResourceAsStream("/schema/0.15.2/adaptive-form.schema.json");
130144
JsonSchema schema = schemaFactory.getSchema(schemaStream);
131145
// read data from the stream and store it into JsonNode
132146
JsonNode json = objectMapper.readTree(jsonStream);
133147
// if there is a version bump of schema, then it needs to be validated against its corresponding sling model here
134148
// by explicitly checking the model implementation
135149
if (!(model instanceof FormContainerImpl)) {
136-
InputStream formContainerTemplate = Utils.class.getResourceAsStream("/schema/0.14.2/form.json");
150+
InputStream formContainerTemplate = Utils.class.getResourceAsStream("/schema/0.15.2/form.json");
137151
JsonNode formContainerTemplateNode = objectMapper.readTree(formContainerTemplate);
138152
((ObjectNode) formContainerTemplateNode).putArray("items").add(json);
139153
json = formContainerTemplateNode;

bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FragmentImplTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import com.adobe.cq.forms.core.components.models.form.FormClientLibManager;
3939
import com.adobe.cq.forms.core.components.models.form.Fragment;
4040
import com.adobe.cq.forms.core.components.models.form.TextInput;
41+
import com.adobe.cq.forms.core.components.views.Views;
4142
import com.adobe.cq.forms.core.context.FormsCoreComponentTestContext;
4243
import com.day.cq.wcm.api.NameConstants;
4344
import com.day.cq.wcm.msm.api.MSMNameConstants;
@@ -55,6 +56,7 @@ public class FragmentImplTest {
5556
private static final String PATH_FRAGMENT = CONTENT_ROOT + "/fragment";
5657
private static final String PATH_FRAGMENT_DAMPATH = CONTENT_ROOT + "/fragment-dampath";
5758
private static final String PATH_FRAGMENT_WITHOUT_FIELDTYPE = CONTENT_ROOT + "/fragment-without-fieldtype";
59+
private static final String PATH_FRAGMENT_WITH_FRAGMENT_PATH = CONTENT_ROOT + "/fragment-with-fragment-path";
5860
private final AemContext context = FormsCoreComponentTestContext.newAemContext();
5961

6062
@BeforeEach
@@ -133,6 +135,12 @@ void testJSONExportWithDamPath() throws Exception {
133135
Utils.testJSONExport(fragment, Utils.getTestExporterJSONPath(BASE, PATH_FRAGMENT_DAMPATH));
134136
}
135137

138+
@Test
139+
void testJSONExportWithFragmentPath() throws Exception {
140+
Fragment fragment = Utils.getComponentUnderTest(PATH_FRAGMENT_WITH_FRAGMENT_PATH, Fragment.class, context);
141+
Utils.testJSONExport(fragment, Utils.getTestExporterJSONPath(BASE, PATH_FRAGMENT_WITH_FRAGMENT_PATH), Views.Author.class);
142+
}
143+
136144
@Test
137145
void testGetChildrenModels() {
138146
Fragment fragment = Utils.getComponentUnderTest(PATH_FRAGMENT, Fragment.class, context);

bundles/af-core/src/test/java/com/adobe/cq/forms/core/components/internal/models/v2/form/FormContainerImplTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ void testGetAdaptiveFormCustomVersion() throws Exception {
189189
void testGetAdaptiveFormDefaultVersion() throws Exception {
190190
FormContainer formContainer = Utils.getComponentUnderTest(PATH_FORM_1, FormContainer.class, context);
191191
assertNotNull(formContainer.getAdaptiveFormVersion());
192-
assertEquals("0.14.2", formContainer.getAdaptiveFormVersion());
192+
assertEquals("0.15.2", formContainer.getAdaptiveFormVersion());
193193
}
194194

195195
@Test

bundles/af-core/src/test/resources/form/formcontainer/exporter-formContainer-cc-form-rest-submission.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@
5252
"grammar": "json-formula-1.0.0",
5353
"version": "1.0.0"
5454
},
55-
"adaptiveform": "0.14.2",
55+
"adaptiveform": "0.15.2",
5656
":type": "fd/components/form/v1/form"
5757
}

bundles/af-core/src/test/resources/form/formcontainer/exporter-formContainer-cc-form-spreadsheet-submission.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@
5252
"grammar": "json-formula-1.0.0",
5353
"version": "1.0.0"
5454
},
55-
"adaptiveform": "0.14.2",
55+
"adaptiveform": "0.15.2",
5656
":type": "fd/components/form/v1/form"
5757
}

bundles/af-core/src/test/resources/form/formcontainer/exporter-formContainer-ue-form-rest-submission.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@
5252
"version": "1.0.0",
5353
"grammar": "json-formula-1.0.0"
5454
},
55-
"adaptiveform": "0.14.2",
55+
"adaptiveform": "0.15.2",
5656
":type": "fd/franklin/components/form/v1/form"
5757
}

bundles/af-core/src/test/resources/form/formcontainer/exporter-formContainer-ue-form-spreadsheet-submission.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@
5252
"version": "1.0.0",
5353
"grammar": "json-formula-1.0.0"
5454
},
55-
"adaptiveform": "0.14.2",
55+
"adaptiveform": "0.15.2",
5656
":type": "fd/franklin/components/form/v1/form"
5757
}

bundles/af-core/src/test/resources/form/formcontainer/exporter-formcontainerv2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
":itemsOrder": [
2626
"textinput"
2727
],
28-
"adaptiveform": "0.14.2",
28+
"adaptiveform": "0.15.2",
2929
"metadata": {
3030
"version": "1.0.0",
3131
"grammar": "json-formula-1.0.0"

0 commit comments

Comments
 (0)