Skip to content

Commit

Permalink
Using GET instead of POST in integration test (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi authored Oct 4, 2024
1 parent 96a6c3b commit 16288a5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Map;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;

Expand Down Expand Up @@ -114,7 +114,7 @@ private JasperPrint fill() throws JRException {
return jasperPrint;
}

@POST
@GET
@Path("csv")
public byte[] csv() throws JRException {
long start = System.currentTimeMillis();
Expand All @@ -132,7 +132,7 @@ public byte[] csv() throws JRException {
return outputStream.toByteArray();
}

@POST
@GET
@Path("xml")
public byte[] xml(@QueryParam("embedded") boolean embedded) throws JRException {
long start = System.currentTimeMillis();
Expand All @@ -151,7 +151,7 @@ public byte[] xml(@QueryParam("embedded") boolean embedded) throws JRException {
return outputStream.toByteArray();
}

@POST
@GET
@Path("html")
public byte[] html() throws JRException {
long start = System.currentTimeMillis();
Expand All @@ -167,7 +167,7 @@ public byte[] html() throws JRException {
return outputStream.toByteArray();
}

@POST
@GET
@Path("rtf")
public byte[] rtf() throws JRException {
long start = System.currentTimeMillis();
Expand All @@ -190,7 +190,7 @@ public byte[] rtf() throws JRException {

//

@POST
@GET
@Path("odt")
public byte[] odt() throws JRException {
long start = System.currentTimeMillis();
Expand All @@ -208,7 +208,7 @@ public byte[] odt() throws JRException {
return outputStream.toByteArray();
}

@POST
@GET
@Path("ods")
public byte[] ods() throws JRException {
long start = System.currentTimeMillis();
Expand All @@ -229,7 +229,7 @@ public byte[] ods() throws JRException {
return outputStream.toByteArray();
}

@POST
@GET
@Path("docx")
public byte[] docx() throws JRException {
long start = System.currentTimeMillis();
Expand All @@ -247,7 +247,7 @@ public byte[] docx() throws JRException {
return outputStream.toByteArray();
}

@POST
@GET
@Path("xlsx")
public byte[] xlsx() throws JRException {
long start = System.currentTimeMillis();
Expand All @@ -268,7 +268,7 @@ public byte[] xlsx() throws JRException {
return outputStream.toByteArray();
}

@POST
@GET
@Path("pptx")
public byte[] pptx() throws JRException {
long start = System.currentTimeMillis();
Expand All @@ -288,15 +288,15 @@ public byte[] pptx() throws JRException {
return outputStream.toByteArray();
}

@POST
@GET
@Path("print")
public void print() throws JRException {
long start = System.currentTimeMillis();
JasperPrintManager.printReport("CustomersReport.jrprint", true);
Log.info("Printing time : " + (System.currentTimeMillis() - start));
}

@POST
@GET
@Path("xls")
public byte[] xls() throws JRException {
long start = System.currentTimeMillis();
Expand All @@ -318,7 +318,7 @@ public byte[] xls() throws JRException {
return outputStream.toByteArray();
}

// @POST
// @GET
// @Path("pdf")
// public byte[] pdf() throws JRException {
// long start = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,97 +12,97 @@ class JasperReportsResourceTest {
@Test
void testExportCSV() {
given()
.when().post("/jasperreports/csv")
.when().get("/jasperreports/csv")
.then()
.statusCode(200);
}

@Test
void testExportXML() {
given()
.when().post("/jasperreports/xml")
.when().get("/jasperreports/xml")
.then()
.statusCode(200);

given()
.when().post("/jasperreports/xml?embedded=true")
.when().get("/jasperreports/xml?embedded=true")
.then()
.statusCode(200);
}

@Test
void testExportHTML() {
given()
.when().post("/jasperreports/html")
.when().get("/jasperreports/html")
.then()
.statusCode(200);
}

@Test
void testExportRTF() {
given()
.when().post("/jasperreports/rtf")
.when().get("/jasperreports/rtf")
.then()
.statusCode(200);
}

@Test
void testExportODT() {
given()
.when().post("/jasperreports/odt")
.when().get("/jasperreports/odt")
.then()
.statusCode(200);
}

@Test
void testExportODS() {
given()
.when().post("/jasperreports/ods")
.when().get("/jasperreports/ods")
.then()
.statusCode(200);
}

@Test
void testExportDOCX() {
given()
.when().post("/jasperreports/docx")
.when().get("/jasperreports/docx")
.then()
.statusCode(200);
}

@Test
void testExportXLSX() {
given()
.when().post("/jasperreports/xlsx")
.when().get("/jasperreports/xlsx")
.then()
.statusCode(200);
}

@Test
void testExportPPTX() {
given()
.when().post("/jasperreports/pptx")
.when().get("/jasperreports/pptx")
.then()
.statusCode(200);
}

@Test
void testExportXLS() {
given()
.when().post("/jasperreports/xls")
.when().get("/jasperreports/xls")
.then()
.statusCode(200);
}

// @Test
// void testExportPDF() {
// given()
// .when().post("/jasperreports/pdf")
// .when().get("/jasperreports/pdf")
// .then()
// .statusCode(200);
// }
//

//

}
}

0 comments on commit 16288a5

Please sign in to comment.