Added zip export
This commit is contained in:
@@ -85,6 +85,8 @@ public abstract class AbstractTest {
|
||||
repDataSet.addReplacementObject("NULL_DATE", null);
|
||||
repDataSet.addReplacementObject("NULL_NUMBER", null);
|
||||
repDataSet.addReplacementObject("NULL_STRING", null);
|
||||
repDataSet.addReplacementObject("QUESTIONNAIRE_JSON", QUESTIONNAIRE_JSON);
|
||||
|
||||
try {
|
||||
DatabaseOperation.CLEAN_INSERT.execute(conn, repDataSet);
|
||||
} finally {
|
||||
@@ -179,4 +181,323 @@ public abstract class AbstractTest {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static final String QUESTIONNAIRE_JSON = """
|
||||
[
|
||||
{
|
||||
"id": "question1",
|
||||
"title": "",
|
||||
"order": 1,
|
||||
"type": "singleChoice",
|
||||
"data":
|
||||
{
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "Nicht-kaufender Kunde",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"id": "answer2",
|
||||
"answer": "Bestandskunde",
|
||||
"selected": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "question2",
|
||||
"title": "Haben Sie Rezeptpatienten(GKV) für Inko?",
|
||||
"order": 2,
|
||||
"type": "singleChoice",
|
||||
"data":
|
||||
{
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "Ja",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "Nein",
|
||||
"selected": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "question3",
|
||||
"title": "Warum nicht?",
|
||||
"order": 3,
|
||||
"type": "multiplChoice",
|
||||
"data":
|
||||
{
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "Lagergründe",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "answer2",
|
||||
"answer": "Wirtschaftlichkeitsgründe",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"id": "answer3",
|
||||
"answer": "Administrativer Aufwand",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"id": "answer4",
|
||||
"answer": "Personeller Aufwand",
|
||||
"selected": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "question4",
|
||||
"title": "Haben Sie Privatrezeptpatienten für inko?",
|
||||
"order": 4,
|
||||
"type": "singleChoice",
|
||||
"data":
|
||||
{
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "Ja",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "answer2",
|
||||
"answer": "Nein",
|
||||
"selected": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "question5",
|
||||
"title": "Wie viele Patienten versorgen Sie regelmäßig? (Privat) un GKV",
|
||||
"order": 5,
|
||||
"type": "number",
|
||||
"data":
|
||||
{
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": 47,
|
||||
"selected": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "question6",
|
||||
"title": "Mit welchem Herstellern arbeiten Sie zusammen?",
|
||||
"order": 6,
|
||||
"type": "multiplChoice",
|
||||
"data":
|
||||
{
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "HARTMANN",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "answer2",
|
||||
"answer": "TZMO",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"id": "answer3",
|
||||
"answer": "Essity",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"id": "answer4",
|
||||
"answer": "Ontex",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "answer5",
|
||||
"answer": "Param",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "answer6",
|
||||
"answer": "Andere",
|
||||
"selected": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "question7",
|
||||
"title": "Was sind Ihre Gründe für die Zusammenarbeit?",
|
||||
"order": 7,
|
||||
"type": "matrix",
|
||||
"data":
|
||||
{
|
||||
"questions":
|
||||
[
|
||||
{
|
||||
"id": "subq1",
|
||||
"title": "Preis",
|
||||
"order": 1,
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "HARTMANN",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "answer2",
|
||||
"answer": "Essity",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"id": "answer3",
|
||||
"answer": "Ontex",
|
||||
"selected": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "subq2",
|
||||
"title": "Einkaufskondition",
|
||||
"order": 2,
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "HARTMANN",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "answer2",
|
||||
"answer": "Essity",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"id": "answer3",
|
||||
"answer": "Ontex",
|
||||
"selected": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "subq3",
|
||||
"title": "Qualität",
|
||||
"order": 3,
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "HARTMANN",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "answer2",
|
||||
"answer": "Essity",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"id": "answer3",
|
||||
"answer": "Ontex",
|
||||
"selected": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "question8",
|
||||
"title": "Beziehen Sie Produkte direkt oder über den Großhandel?",
|
||||
"order": 8,
|
||||
"type": "singleChoice",
|
||||
"data":
|
||||
{
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "primär direkt",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "answer2",
|
||||
"answer": "primär Großhandel",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"id": "answer3",
|
||||
"answer": "ptimär teils. Großhandel",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"id": "answer4",
|
||||
"answer": "unterschiedlich",
|
||||
"selected": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "question9",
|
||||
"title": "Gründe für Bezug?",
|
||||
"order": 10,
|
||||
"type": "singleChoice",
|
||||
"data":
|
||||
{
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "Umsatzziel mit Händler",
|
||||
"selected": false
|
||||
},
|
||||
{
|
||||
"id": "answer2",
|
||||
"answer": "Warenverfügbarkeit/ Liefergeschwindigkeit und Frequent",
|
||||
"selected": true
|
||||
},
|
||||
{
|
||||
"id": "answer3",
|
||||
"answer": "Einkaufskondition",
|
||||
"selected": true
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "question10",
|
||||
"title": "Weiter/Kommentare Hinweise?",
|
||||
"order": 11,
|
||||
"type": "freeText",
|
||||
"data":
|
||||
{
|
||||
"answers":
|
||||
[
|
||||
{
|
||||
"id": "answer1",
|
||||
"answer": "Kommentar eintragen",
|
||||
"selected": true
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
""";
|
||||
}
|
||||
|
||||
@@ -194,11 +194,29 @@ public class QuestionnaireCustomerResourceTest extends AbstractRestTest {
|
||||
String expected = fileToString(BASE_DOWNLOAD + "doGetCustomer.json");
|
||||
jsonAssert(expected, text);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doDownloadZip() throws IOException {
|
||||
LOG.info("doDownload");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
LOG.info("authorization: " + authorization);
|
||||
String path = deploymentURL + PATH + "/exportall";
|
||||
Request request = Request.Get(path).addHeader("Accept", "application/zip")
|
||||
.addHeader("Authorization", authorization);
|
||||
|
||||
HttpResponse httpResponse = executeRequest(request);
|
||||
int code = httpResponse.getStatusLine().getStatusCode();
|
||||
assertEquals(200, code);
|
||||
|
||||
byte[] text = getResponse(httpResponse);
|
||||
writeFile(text, "doDownload.zip");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@Disabled // FIXME: enable when we have implemented excel download
|
||||
public void doDownload() throws IOException {
|
||||
public void doDownloadExcel() throws IOException {
|
||||
LOG.info("doDownload");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
@@ -212,12 +230,12 @@ public class QuestionnaireCustomerResourceTest extends AbstractRestTest {
|
||||
assertEquals(200, code);
|
||||
|
||||
byte[] text = getResponse(httpResponse);
|
||||
writeFile(text, "doDownload.pdf");
|
||||
writeFile(text, "doDownload.xlsx");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
public void doDownloadNotExist() throws IOException {
|
||||
public void doDownloadExcelNotExist() throws IOException {
|
||||
LOG.info("doDownloadNotExist");
|
||||
|
||||
String authorization = getAuthorization();
|
||||
|
||||
@@ -36,14 +36,14 @@
|
||||
<questionnaire_customer customer_id="3" customer_number="3456" name="Schmidt Apotheke" city="Hamburg" zip="56732" jpa_active="true" jpa_created="2024-10-24 10:09:30" jpa_updated="2024-10-24 10:09:30" jpa_version="0" />
|
||||
|
||||
<questionnaire questionnaire_id="1" username="verboomp" questionnaire_date="2026-01-01 10:09:30" comment="good looking picture 1" evaluation="1" jpa_active="true" jpa_created="2024-10-24 10:09:30" jpa_updated="2024-10-24 10:09:30" jpa_version="0" customer_id_fk="1"
|
||||
questions="{}"/>
|
||||
questions="QUESTIONNAIRE_JSON"/>
|
||||
<questionnaire questionnaire_id="2" username="verboomp" questionnaire_date="2026-01-02 10:09:30" comment="good looking picture 2" evaluation="1" jpa_active="true" jpa_created="2024-10-24 10:09:30" jpa_updated="2024-10-24 10:09:30" jpa_version="0" customer_id_fk="1"
|
||||
questions="{}"/>
|
||||
questions="QUESTIONNAIRE_JSON"/>
|
||||
<questionnaire questionnaire_id="3" username="verboomp" questionnaire_date="2026-01-05 10:09:30" comment="good looking picture 3" evaluation="1" jpa_active="true" jpa_created="2024-10-24 10:09:30" jpa_updated="2024-10-24 10:09:30" jpa_version="0" customer_id_fk="2"
|
||||
questions="{}"/>
|
||||
questions="QUESTIONNAIRE_JSON"/>
|
||||
<questionnaire questionnaire_id="4" username="verboomp" questionnaire_date="2026-01-07 10:09:30" comment="good looking picture 4" evaluation="1" jpa_active="true" jpa_created="2024-10-24 10:09:30" jpa_updated="2024-10-24 10:09:30" jpa_version="0" customer_id_fk="3"
|
||||
questions="{}"/>
|
||||
questions="QUESTIONNAIRE_JSON"/>
|
||||
<questionnaire questionnaire_id="5" username="verboomp" questionnaire_date="2026-01-12 10:09:30" comment="good looking picture 5" evaluation="1" jpa_active="true" jpa_created="2024-10-24 10:09:30" jpa_updated="2024-10-24 10:09:30" jpa_version="0" customer_id_fk="3"
|
||||
questions="{}"/>
|
||||
questions="QUESTIONNAIRE_JSON"/>
|
||||
|
||||
</dataset>
|
||||
|
||||
Reference in New Issue
Block a user