From 88db33c6a8e2a03e72a0c676f51937418ee84912 Mon Sep 17 00:00:00 2001 From: Dominik Mizyn Date: Thu, 22 Aug 2019 14:04:44 +0200 Subject: Postman tests up Postman tests up Issue-ID: PORTAL-710 Change-Id: I2bdb4ba12b35f7c17014eff2a68fd5534e307bbd Signed-off-by: Dominik Mizyn --- .../src/main/java/org/onap/portal/configuration/SecurityConfig.java | 4 +++- .../main/java/org/onap/portal/controller/LanguageController.java | 5 +++-- .../src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java | 6 ++++-- portal-BE/src/main/resources/application.properties | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'portal-BE/src') diff --git a/portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java b/portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java index c73f7d57..b9e60334 100644 --- a/portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java +++ b/portal-BE/src/main/java/org/onap/portal/configuration/SecurityConfig.java @@ -83,7 +83,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { .permitAll() .and() .logout() - .permitAll(); + .permitAll() + .and() + .httpBasic(); http.csrf().disable(); http.headers().frameOptions().disable(); diff --git a/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java b/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java index 2ea4ff24..97fe03da 100644 --- a/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java +++ b/portal-BE/src/main/java/org/onap/portal/controller/LanguageController.java @@ -54,6 +54,7 @@ import org.onap.portal.service.fn.FnUserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -102,8 +103,8 @@ public class LanguageController { return new FnLanguage(); } - @PostMapping(value = "/language") - public PortalRestResponse saveLanguage(final Principal principal, final FnLanguage fnLanguage){ + @PostMapping(value = "/language", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) + public PortalRestResponse saveLanguage(final Principal principal, @RequestBody final FnLanguage fnLanguage){ PortalRestResponse response = new PortalRestResponse<>(); try { response.setMessage("SUCCESS"); diff --git a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java index 09cb5a6e..996929e7 100644 --- a/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java +++ b/portal-BE/src/main/java/org/onap/portal/domain/db/fn/FnLanguage.java @@ -40,6 +40,7 @@ package org.onap.portal.domain.db.fn; +import com.fasterxml.jackson.annotation.JsonInclude; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -72,6 +73,7 @@ CREATE TABLE `fn_language` ( @Getter @Setter @Entity +@JsonInclude() @SequenceGenerator(name="seq", initialValue=3, allocationSize=100) public class FnLanguage { @@ -82,12 +84,12 @@ public class FnLanguage { private Long languageId; @Column(name = "language_name", length = 100, nullable = false) @Size(max = 100) - @NotNull + @NotNull(message = "languageName must not be null") @SafeHtml private String languageName; @Column(name = "language_alias", length = 100, nullable = false) @Size(max = 100) - @NotNull + @NotNull(message = "languageAlias must not be null") @SafeHtml private String languageAlias; diff --git a/portal-BE/src/main/resources/application.properties b/portal-BE/src/main/resources/application.properties index eb346eef..f3db0623 100644 --- a/portal-BE/src/main/resources/application.properties +++ b/portal-BE/src/main/resources/application.properties @@ -1,4 +1,4 @@ -server.port=8090 +server.port=8080 spring.datasource.url=jdbc:mysql://localhost:3306/testdb?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver -- cgit 1.2.3-korg