Skip to content

Commit bb3a507

Browse files
committed
🎨 Trivial: Made Issue #15 tests more consistent with other tests
Also added some informational comments for future developers (or future me).
1 parent 2adb213 commit bb3a507

4 files changed

Lines changed: 11 additions & 5 deletions

File tree

‎rest-services/it.tests/src/test/java/com/_4point/aem/docservices/rest_services/it_tests/AemTargetType.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ public enum AemTargetType {
1414
REMOTE_LINUX(Path.of("/opt", "adobe", "ff_it_files")), // Running on remote Linux machine (assumes that machine name is TEST_MACHINE_NAME and port is TEST_MACHINE_PORT)
1515
TESTCONTAINERS(Path.of("/opt", "adobe", "ff_it_files")); // Running on local testcontainers image (gets port from TestContainers)
1616

17-
private final Path samplesPath; // Location where sample files are stored for this AEM target type.
17+
private final Path samplesPath; // Location where sample files are stored for this AEM target type.
18+
// Needs to be absolute path since (in some cases) it will be passed to AEM.
1819

1920
private AemTargetType(Path samplesPath) {
2021
this.samplesPath = samplesPath;

‎rest-services/it.tests/src/test/java/com/_4point/aem/docservices/rest_services/it_tests/TestUtils.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ public class TestUtils {
5454
private static final String SAMPLE_FORM_DATA_JSON_NAME = "SampleForm_data.json";
5555
private static final String SAMPLE_FORM_DATA_DOCX_NAME = "SampleForm.docx";
5656
private static final String SAMPLE_FORM_DDX_NAME = "SampleForm_DDX.xml";
57+
private static final String SAMPLE_ARTWORK_PDF = "SampleArtworkPdf.pdf";
5758

5859
public static final Path REMOTE_SAMPLE_FORM_PDF = AEM_TARGET_TYPE.samplesPath(SAMPLE_FORM_PDF_NAME);
5960
public static final Path REMOTE_SAMPLE_FORM_WITH_DATA_PDF = AEM_TARGET_TYPE.samplesPath(SAMPLE_FORM_WITH_DATA_PDF_NAME);
@@ -63,6 +64,7 @@ public class TestUtils {
6364
public static final Path REMOTE_SAMPLE_FORM_DATA_JSON = AEM_TARGET_TYPE.samplesPath(SAMPLE_FORM_DATA_JSON_NAME);
6465
public final static Path REMOTE_SAMPLE_FORM_DOCX = AEM_TARGET_TYPE.samplesPath(SAMPLE_FORM_DATA_DOCX_NAME);
6566
public static final Path REMOTE_SAMPLE_FORM_DDX = AEM_TARGET_TYPE.samplesPath(SAMPLE_FORM_DDX_NAME);
67+
public static final Path REMOTE_SAMPLE_ARTWORK_PDF = AEM_TARGET_TYPE.samplesPath(SAMPLE_ARTWORK_PDF);
6668

6769
public static final Path LOCAL_SAMPLE_FORM_PDF = AemTargetType.LOCAL.samplesPath(SAMPLE_FORM_PDF_NAME);
6870
public static final Path LOCAL_SAMPLE_FORM_WITH_DATA_PDF = AemTargetType.LOCAL.samplesPath(SAMPLE_FORM_WITH_DATA_PDF_NAME);
@@ -72,6 +74,8 @@ public class TestUtils {
7274
public static final Path LOCAL_SAMPLE_FORM_DATA_JSON = AemTargetType.LOCAL.samplesPath(SAMPLE_FORM_DATA_JSON_NAME);
7375
public final static Path LOCAL_SAMPLE_FORM_DOCX = AemTargetType.LOCAL.samplesPath(SAMPLE_FORM_DATA_DOCX_NAME);
7476
public static final Path LOCAL_SAMPLE_FORM_DDX = AemTargetType.LOCAL.samplesPath(SAMPLE_FORM_DDX_NAME);
77+
public static final Path LOCAL_SAMPLE_ARTWORK_PDF = AemTargetType.LOCAL.samplesPath(SAMPLE_ARTWORK_PDF);
78+
7579

7680
public static final Path RESOURCES_DIR = Paths.get("src", "test", "resources");
7781
public static final Path ACTUAL_RESULTS_DIR = RESOURCES_DIR.resolve("actualResults");

‎rest-services/it.tests/src/test/java/com/_4point/aem/docservices/rest_services/it_tests/client/af/RenderAdaptiveFormTest.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.apache.commons.io.IOUtils;
1313
import org.junit.jupiter.api.BeforeAll;
1414
import org.junit.jupiter.api.BeforeEach;
15+
import org.junit.jupiter.api.Disabled;
1516
import org.junit.jupiter.api.Tag;
1617
import org.junit.jupiter.api.Test;
1718

@@ -27,7 +28,7 @@
2728
class RenderAdaptiveFormTest {
2829

2930
private static final String SAMPLE_AF_NAME = "sample00002test";
30-
private static final String SAMPLE_JSON_AF_NAME = "sample-json-adaptive-form--1";
31+
private static final String SAMPLE_JSON_AF_NAME = "sample-json-adaptive-form--1"; // TODO: Locate this adaptive form (or generate one) and then enable testRenderAdaptiveFormStringJsonDocument().
3132

3233
private AdaptiveFormsService underTest;
3334

@@ -146,6 +147,7 @@ void testRenderAdaptiveFormPathDocument() throws Exception {
146147
assertThat(new String(resultBytes, StandardCharsets.UTF_8), allOf(containsString("Text Field1 Data"), containsString("Text Field2 Data")));
147148
}
148149

150+
@Disabled("This test is disabled because the sample JSON Adaptive Form is not available in the test environment. It can be enabled when the sample JSON Adaptive Form is available.")
149151
@Test
150152
void testRenderAdaptiveFormStringJsonDocument() throws Exception {
151153
String template = SAMPLE_JSON_AF_NAME;

‎rest-services/it.tests/src/test/java/com/_4point/aem/docservices/rest_services/it_tests/client/output/GeneratePdfOutputTest.java‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com._4point.aem.docservices.rest_services.client.jersey.JerseyRestClient;
2020
import com._4point.aem.docservices.rest_services.client.output.RestServicesOutputServiceAdapter;
2121
import com._4point.aem.docservices.rest_services.it_tests.AemInstance;
22-
import com._4point.aem.docservices.rest_services.it_tests.AemTargetType;
2322
import com._4point.aem.docservices.rest_services.it_tests.Pdf;
2423
import com._4point.aem.docservices.rest_services.it_tests.TestUtils;
2524
import com._4point.aem.fluentforms.api.Document;
@@ -110,7 +109,7 @@ void testGeneratePdfOutput_AllArgs() throws Exception {
110109
@DisplayName("Test generatePdfOutput() Just Form Doc. FluentFormsAPI Issue #15")
111110
void testGeneratePdfOutput_JustFormDocIssue15() throws Exception {
112111
Document pdfResult = underTest.generatePDFOutput()
113-
.executeOn(SimpleDocumentFactoryImpl.getFactory().create(AemTargetType.LOCAL.samplesPath("SampleArtworkPdf.pdf")));
112+
.executeOn(SimpleDocumentFactoryImpl.getFactory().create(LOCAL_SAMPLE_ARTWORK_PDF));
114113

115114
TestUtils.validatePdfResult(pdfResult.getInlineData(), "GeneratePdfOutput_JustFormDocIssue15.pdf", false, false, false);
116115
}
@@ -119,7 +118,7 @@ void testGeneratePdfOutput_JustFormDocIssue15() throws Exception {
119118
@DisplayName("Test generatePdfOutput() Just Form. FluentFormsAPI Issue #15")
120119
void testGeneratePdfOutput_JustFormIssue15() throws Exception {
121120
Document pdfResult = underTest.generatePDFOutput()
122-
.executeOn(AEM_TARGET_TYPE.samplesPath("SampleArtworkPdf.pdf"));
121+
.executeOn(REMOTE_SAMPLE_ARTWORK_PDF);
123122

124123
TestUtils.validatePdfResult(pdfResult.getInlineData(), "GeneratePdfOutput_JustFormDocIssue15.pdf", false, false, false);
125124
}

0 commit comments

Comments
 (0)