From f4da75b5613488da9730d83e6d76e79ac2f9c1e1 Mon Sep 17 00:00:00 2001 From: Marcos Perez Date: Thu, 12 Nov 2020 12:31:01 +0100 Subject: [PATCH] Fixe DB test url. Changed content type to match frontend request. --- .../blobapp/binary/service/api/rest/BinaryRestService.java | 7 +++---- .../binary/service/impl/rest/BinaryServiceTest.java | 4 ++-- core/src/test/resources/config/application.properties | 4 +++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/api/src/main/java/com/devonfw/example/blobapp/binary/service/api/rest/BinaryRestService.java b/api/src/main/java/com/devonfw/example/blobapp/binary/service/api/rest/BinaryRestService.java index c5ac63b..e10d9d7 100644 --- a/api/src/main/java/com/devonfw/example/blobapp/binary/service/api/rest/BinaryRestService.java +++ b/api/src/main/java/com/devonfw/example/blobapp/binary/service/api/rest/BinaryRestService.java @@ -58,12 +58,11 @@ public interface BinaryRestService { * @return the {@link BinaryObjectEto} * @throws SQLException */ - @Consumes("multipart/mixed") + @Consumes("multipart/form-data") @POST @Path("/binaryobject/") - public BinaryObjectEto saveBinaryObject( - @Multipart(value = "root", type = MediaType.APPLICATION_JSON) BinaryObjectEto binaryObjectEto, - @Multipart(value = "image", type = MediaType.APPLICATION_OCTET_STREAM) InputStream data); + public BinaryObjectEto saveBinaryObject(@Multipart("root") BinaryObjectEto binaryObjectEto, + @Multipart("image") InputStream data); // end::saveBinaryObject[] /** diff --git a/core/src/test/java/com/devonfw/example/blobapp/binary/service/impl/rest/BinaryServiceTest.java b/core/src/test/java/com/devonfw/example/blobapp/binary/service/impl/rest/BinaryServiceTest.java index 1b9b6eb..24fc788 100644 --- a/core/src/test/java/com/devonfw/example/blobapp/binary/service/impl/rest/BinaryServiceTest.java +++ b/core/src/test/java/com/devonfw/example/blobapp/binary/service/impl/rest/BinaryServiceTest.java @@ -72,7 +72,7 @@ public void testSaveBinaryObject() throws IOException, URISyntaxException { List attachments = createAttachments(imagePath, eto); - BinaryObjectEto resultEto = getClient().type("multipart/mixed").accept("application/json").path("binaryobject/") + BinaryObjectEto resultEto = getClient().type("multipart/form-data").accept("application/json").path("binaryobject/") .post(attachments, BinaryObjectEto.class); assertTrue(resultEto.getId() > 0); assertEquals(resultEto.getSize(), Files.size(imagePath)); @@ -115,7 +115,7 @@ public void testSaveUploadDeleteBinaryObject() throws IOException, URISyntaxExce List attachments = createAttachments(imagePath, myEto); - BinaryObjectEto resultEto = getClient().type("multipart/mixed").accept("application/json").path("binaryobject/") + BinaryObjectEto resultEto = getClient().type("multipart/form-data").accept("application/json").path("binaryobject/") .post(attachments, BinaryObjectEto.class); assertTrue(resultEto.getId() > 0); diff --git a/core/src/test/resources/config/application.properties b/core/src/test/resources/config/application.properties index cd56bfd..07bd6e3 100644 --- a/core/src/test/resources/config/application.properties +++ b/core/src/test/resources/config/application.properties @@ -5,7 +5,9 @@ spring.profiles.active=junit spring.jpa.database=oracle spring.datasource.username=c##blobapp spring.datasource.password=blobapp -spring.datasource.url=jdbc:oracle:thin:@localhost:32769:ORCLCDB +spring.datasource.url=jdbc:oracle:thin:@localhost:1521:ORCLCDB +#spring.datasource.url=jdbc:oracle:thin:@localhost:32769:ORCLCDB + spring.jpa.hibernate.ddl-auto=none