From fe1642be6f13d0f3c886cd8c023df4fccabade51 Mon Sep 17 00:00:00 2001 From: chirag d Date: Tue, 4 Feb 2020 22:19:12 +0530 Subject: [PATCH 001/130] BAEL3771: Cache Headers in Spring MVC --- .../baeldung/spring/web/config/WebConfig.java | 25 +++++- .../controller/CacheControlController.java | 55 ++++++++++++ .../src/main/webapp/resources/hello.css | 0 ...CacheControlControllerIntegrationTest.java | 84 +++++++++++++++++++ 4 files changed, 160 insertions(+), 4 deletions(-) create mode 100644 spring-mvc-java/src/main/java/com/baeldung/web/controller/CacheControlController.java create mode 100644 spring-mvc-java/src/main/webapp/resources/hello.css create mode 100644 spring-mvc-java/src/test/java/com/baeldung/web/controller/CacheControlControllerIntegrationTest.java diff --git a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java b/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java index 96e300464b..5cc165680f 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java +++ b/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java @@ -2,6 +2,7 @@ package com.baeldung.spring.web.config; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.TimeUnit; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; @@ -9,15 +10,19 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Description; import org.springframework.context.support.ResourceBundleMessageSource; +import org.springframework.http.CacheControl; import org.springframework.http.MediaType; import org.springframework.http.converter.ByteArrayHttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping; +import org.springframework.web.servlet.mvc.WebContentInterceptor; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; import org.springframework.web.util.UrlPathHelper; @@ -30,14 +35,14 @@ import com.baeldung.excel.ExcelPOIHelper; @EnableWebMvc @Configuration -@ComponentScan(basePackages = { "com.baeldung.web.controller" }) +@ComponentScan(basePackages = {"com.baeldung.web.controller"}) public class WebConfig implements WebMvcConfigurer { - + @Override public void addViewControllers(final ViewControllerRegistry registry) { registry.addViewController("/").setViewName("index"); } - + @Bean public ViewResolver thymeleafViewResolver() { final ThymeleafViewResolver viewResolver = new ThymeleafViewResolver(); @@ -84,7 +89,10 @@ public class WebConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(final ResourceHandlerRegistry registry) { - registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); + registry.addResourceHandler("/resources/**").addResourceLocations("/resources/") + .setCacheControl(CacheControl.maxAge(60, TimeUnit.SECONDS) + .noTransform() + .mustRevalidate()); } @Override @@ -121,4 +129,13 @@ public class WebConfig implements WebMvcConfigurer { public ExcelPOIHelper excelPOIHelper() { return new ExcelPOIHelper(); } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + WebContentInterceptor interceptor = new WebContentInterceptor(); + interceptor.addCacheMapping(CacheControl.maxAge(60, TimeUnit.SECONDS) + .noTransform() + .mustRevalidate(), "/cache/*"); + registry.addInterceptor(interceptor); + } } \ No newline at end of file diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/CacheControlController.java b/spring-mvc-java/src/main/java/com/baeldung/web/controller/CacheControlController.java new file mode 100644 index 0000000000..f1614ab448 --- /dev/null +++ b/spring-mvc-java/src/main/java/com/baeldung/web/controller/CacheControlController.java @@ -0,0 +1,55 @@ +package com.baeldung.web.controller; + +import org.springframework.http.CacheControl; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.context.request.WebRequest; + +import javax.servlet.http.HttpServletResponse; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.concurrent.TimeUnit; + +@Controller +public class CacheControlController { + + @RequestMapping(value = "/hello/{name}", method = RequestMethod.GET) + public ResponseEntity helloWorld(@PathVariable String name) { + CacheControl cacheControl = CacheControl.maxAge(60, TimeUnit.SECONDS) + .noTransform() + .mustRevalidate(); + return ResponseEntity.ok() + .cacheControl(cacheControl) + .body("Hello " + name); + } + + @RequestMapping(value = "/home/{name}", method = RequestMethod.GET) + public String home(@PathVariable String name, final HttpServletResponse response) { + response.addHeader("Cache-Control", "max-age=60, must-revalidate, no-transform"); + return "home"; + } + + @RequestMapping(value = "/cache/{name}", method = RequestMethod.GET) + public ResponseEntity intercept(@PathVariable String name) { + return ResponseEntity.ok().body("Hello " + name); + } + + @RequestMapping(value = "/validate/{name}", method = RequestMethod.GET) + public ResponseEntity validate(@PathVariable String name, WebRequest request) { + + ZoneId zoneId = ZoneId.of("GMT"); + long lastModifiedTimestamp = LocalDateTime.of(2020, 02, 4, 19, 57, 45) + .atZone(zoneId).toInstant().toEpochMilli(); + + if (request.checkNotModified(lastModifiedTimestamp)) { + return ResponseEntity.status(304).build(); + } + + return ResponseEntity.ok().body("Hello " + name); + } + + +} diff --git a/spring-mvc-java/src/main/webapp/resources/hello.css b/spring-mvc-java/src/main/webapp/resources/hello.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/CacheControlControllerIntegrationTest.java b/spring-mvc-java/src/test/java/com/baeldung/web/controller/CacheControlControllerIntegrationTest.java new file mode 100644 index 0000000000..b03f628b20 --- /dev/null +++ b/spring-mvc-java/src/test/java/com/baeldung/web/controller/CacheControlControllerIntegrationTest.java @@ -0,0 +1,84 @@ +package com.baeldung.web.controller; + +import com.baeldung.spring.web.config.WebConfig; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpHeaders; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultHandlers; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import java.time.LocalDate; +import java.time.LocalDateTime; + +import static org.springframework.http.HttpHeaders.IF_UNMODIFIED_SINCE; + +@ExtendWith(SpringExtension.class) +@WebAppConfiguration +@ContextConfiguration(classes = {WebConfig.class, WebConfig.class}) +public class CacheControlControllerIntegrationTest { + + @Autowired + private WebApplicationContext wac; + + private MockMvc mockMvc; + + @BeforeEach + void setup() throws Exception { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); + } + + @Test + void whenResponseBody_thenReturnCacheHeader() throws Exception { + this.mockMvc.perform(MockMvcRequestBuilders.get("/hello/baeldung")) + .andDo(MockMvcResultHandlers.print()) + .andExpect(MockMvcResultMatchers.status().isOk()) + .andExpect(MockMvcResultMatchers.header().string("Cache-Control","max-age=60, must-revalidate, no-transform")); + } + + @Test + void whenViewName_thenReturnCacheHeader() throws Exception { + this.mockMvc.perform(MockMvcRequestBuilders.get("/home/baeldung")) + .andDo(MockMvcResultHandlers.print()) + .andExpect(MockMvcResultMatchers.status().isOk()) + .andExpect(MockMvcResultMatchers.header().string("Cache-Control","max-age=60, must-revalidate, no-transform")) + .andExpect(MockMvcResultMatchers.view().name("home")); + } + + @Test + void whenStaticResources_thenReturnCacheHeader() throws Exception { + this.mockMvc.perform(MockMvcRequestBuilders.get("/resources/hello.css")) + .andDo(MockMvcResultHandlers.print()) + .andExpect(MockMvcResultMatchers.status().isOk()) + .andExpect(MockMvcResultMatchers.header().string("Cache-Control","max-age=60, must-revalidate, no-transform")); + } + + @Test + void whenInterceptor_thenReturnCacheHeader() throws Exception { + this.mockMvc.perform(MockMvcRequestBuilders.get("/cache/baeldung")) + .andDo(MockMvcResultHandlers.print()) + .andExpect(MockMvcResultMatchers.status().isOk()) + .andExpect(MockMvcResultMatchers.header().string("Cache-Control","max-age=60, must-revalidate, no-transform")); + } + + @Test + void whenValidate_thenReturnCacheHeader() throws Exception { + HttpHeaders headers = new HttpHeaders(); + headers.add(IF_UNMODIFIED_SINCE, "Tue, 04 Feb 2020 19:57:25 GMT"); + this.mockMvc.perform(MockMvcRequestBuilders.get("/validate/baeldung").headers(headers)) + .andDo(MockMvcResultHandlers.print()) + .andExpect(MockMvcResultMatchers.status().is(304)); + } + + + + +} From 92b7e549a14f82dcef37d29e793a19c8ea853f98 Mon Sep 17 00:00:00 2001 From: chirag d Date: Sat, 8 Feb 2020 16:34:45 +0530 Subject: [PATCH 002/130] BEAL3771: Cache Headers in Spring MVC --- pom.xml | 1 + spring-mvc-java-2/.gitignore | 13 ++++++ spring-mvc-java-2/pom.xml | 39 ++++++++++++++++++ .../cache}/CacheControlController.java | 2 +- .../java/com/baeldung/cache/WebConfig.java | 41 +++++++++++++++++++ .../src/main/webapp/resources/hello.css | 0 ...CacheControlControllerIntegrationTest.java | 6 +-- .../baeldung/spring/web/config/WebConfig.java | 25 ++--------- 8 files changed, 100 insertions(+), 27 deletions(-) create mode 100644 spring-mvc-java-2/.gitignore create mode 100644 spring-mvc-java-2/pom.xml rename {spring-mvc-java/src/main/java/com/baeldung/web/controller => spring-mvc-java-2/src/main/java/com/baeldung/cache}/CacheControlController.java (98%) create mode 100644 spring-mvc-java-2/src/main/java/com/baeldung/cache/WebConfig.java rename {spring-mvc-java => spring-mvc-java-2}/src/main/webapp/resources/hello.css (100%) rename {spring-mvc-java/src/test/java/com/baeldung/web/controller => spring-mvc-java-2/src/test/java/com/baeldung/cache}/CacheControlControllerIntegrationTest.java (95%) diff --git a/pom.xml b/pom.xml index 6e6316edd6..1972350c75 100644 --- a/pom.xml +++ b/pom.xml @@ -692,6 +692,7 @@ spring-mvc-forms-jsp spring-mvc-forms-thymeleaf spring-mvc-java + spring-mvc-java-2 spring-mvc-kotlin spring-mvc-velocity diff --git a/spring-mvc-java-2/.gitignore b/spring-mvc-java-2/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/spring-mvc-java-2/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/spring-mvc-java-2/pom.xml b/spring-mvc-java-2/pom.xml new file mode 100644 index 0000000000..d5b7d087ab --- /dev/null +++ b/spring-mvc-java-2/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + spring-mvc-java-2 + 0.1-SNAPSHOT + spring-mvc-java-2 + war + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + javax.servlet + javax.servlet-api + ${javax.version} + + + org.springframework + spring-webmvc + ${spring.mvc.version} + + + + + + 4.0.1 + 5.2.2.RELEASE + + + + + \ No newline at end of file diff --git a/spring-mvc-java/src/main/java/com/baeldung/web/controller/CacheControlController.java b/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheControlController.java similarity index 98% rename from spring-mvc-java/src/main/java/com/baeldung/web/controller/CacheControlController.java rename to spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheControlController.java index f1614ab448..5bf095888e 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/web/controller/CacheControlController.java +++ b/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheControlController.java @@ -1,4 +1,4 @@ -package com.baeldung.web.controller; +package com.baeldung.cache; import org.springframework.http.CacheControl; import org.springframework.http.ResponseEntity; diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/cache/WebConfig.java b/spring-mvc-java-2/src/main/java/com/baeldung/cache/WebConfig.java new file mode 100644 index 0000000000..728479979c --- /dev/null +++ b/spring-mvc-java-2/src/main/java/com/baeldung/cache/WebConfig.java @@ -0,0 +1,41 @@ +package com.baeldung.cache; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.CacheControl; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.mvc.WebContentInterceptor; + +import java.util.concurrent.TimeUnit; + +@EnableWebMvc +@Configuration +@ComponentScan(basePackages = {"com.baeldung.cache"}) +public class WebConfig implements WebMvcConfigurer { + + @Override + public void addViewControllers(final ViewControllerRegistry registry) { + registry.addViewController("/").setViewName("index"); + } + + @Override + public void addResourceHandlers(final ResourceHandlerRegistry registry) { + registry.addResourceHandler("/resources/**").addResourceLocations("/resources/") + .setCacheControl(CacheControl.maxAge(60, TimeUnit.SECONDS) + .noTransform() + .mustRevalidate()); + } + + @Override + public void addInterceptors(InterceptorRegistry registry) { + WebContentInterceptor interceptor = new WebContentInterceptor(); + interceptor.addCacheMapping(CacheControl.maxAge(60, TimeUnit.SECONDS) + .noTransform() + .mustRevalidate(), "/cache/*"); + registry.addInterceptor(interceptor); + } +} \ No newline at end of file diff --git a/spring-mvc-java/src/main/webapp/resources/hello.css b/spring-mvc-java-2/src/main/webapp/resources/hello.css similarity index 100% rename from spring-mvc-java/src/main/webapp/resources/hello.css rename to spring-mvc-java-2/src/main/webapp/resources/hello.css diff --git a/spring-mvc-java/src/test/java/com/baeldung/web/controller/CacheControlControllerIntegrationTest.java b/spring-mvc-java-2/src/test/java/com/baeldung/cache/CacheControlControllerIntegrationTest.java similarity index 95% rename from spring-mvc-java/src/test/java/com/baeldung/web/controller/CacheControlControllerIntegrationTest.java rename to spring-mvc-java-2/src/test/java/com/baeldung/cache/CacheControlControllerIntegrationTest.java index b03f628b20..ef408038ae 100644 --- a/spring-mvc-java/src/test/java/com/baeldung/web/controller/CacheControlControllerIntegrationTest.java +++ b/spring-mvc-java-2/src/test/java/com/baeldung/cache/CacheControlControllerIntegrationTest.java @@ -1,6 +1,5 @@ -package com.baeldung.web.controller; +package com.baeldung.cache; -import com.baeldung.spring.web.config.WebConfig; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -16,9 +15,6 @@ import org.springframework.test.web.servlet.result.MockMvcResultMatchers; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; -import java.time.LocalDate; -import java.time.LocalDateTime; - import static org.springframework.http.HttpHeaders.IF_UNMODIFIED_SINCE; @ExtendWith(SpringExtension.class) diff --git a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java b/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java index 5cc165680f..96e300464b 100644 --- a/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java +++ b/spring-mvc-java/src/main/java/com/baeldung/spring/web/config/WebConfig.java @@ -2,7 +2,6 @@ package com.baeldung.spring.web.config; import java.util.ArrayList; import java.util.List; -import java.util.concurrent.TimeUnit; import org.springframework.context.MessageSource; import org.springframework.context.annotation.Bean; @@ -10,19 +9,15 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Description; import org.springframework.context.support.ResourceBundleMessageSource; -import org.springframework.http.CacheControl; import org.springframework.http.MediaType; import org.springframework.http.converter.ByteArrayHttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; -import org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping; -import org.springframework.web.servlet.mvc.WebContentInterceptor; import org.springframework.web.servlet.view.InternalResourceViewResolver; import org.springframework.web.servlet.view.JstlView; import org.springframework.web.util.UrlPathHelper; @@ -35,14 +30,14 @@ import com.baeldung.excel.ExcelPOIHelper; @EnableWebMvc @Configuration -@ComponentScan(basePackages = {"com.baeldung.web.controller"}) +@ComponentScan(basePackages = { "com.baeldung.web.controller" }) public class WebConfig implements WebMvcConfigurer { - + @Override public void addViewControllers(final ViewControllerRegistry registry) { registry.addViewController("/").setViewName("index"); } - + @Bean public ViewResolver thymeleafViewResolver() { final ThymeleafViewResolver viewResolver = new ThymeleafViewResolver(); @@ -89,10 +84,7 @@ public class WebConfig implements WebMvcConfigurer { @Override public void addResourceHandlers(final ResourceHandlerRegistry registry) { - registry.addResourceHandler("/resources/**").addResourceLocations("/resources/") - .setCacheControl(CacheControl.maxAge(60, TimeUnit.SECONDS) - .noTransform() - .mustRevalidate()); + registry.addResourceHandler("/resources/**").addResourceLocations("/resources/"); } @Override @@ -129,13 +121,4 @@ public class WebConfig implements WebMvcConfigurer { public ExcelPOIHelper excelPOIHelper() { return new ExcelPOIHelper(); } - - @Override - public void addInterceptors(InterceptorRegistry registry) { - WebContentInterceptor interceptor = new WebContentInterceptor(); - interceptor.addCacheMapping(CacheControl.maxAge(60, TimeUnit.SECONDS) - .noTransform() - .mustRevalidate(), "/cache/*"); - registry.addInterceptor(interceptor); - } } \ No newline at end of file From e6b1faa8c2ae0edfbc292c98a22f5eee0964a120 Mon Sep 17 00:00:00 2001 From: chirag d Date: Sat, 8 Feb 2020 18:17:34 +0530 Subject: [PATCH 003/130] BEAL3771: Cache Headers in Spring MVC --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 1972350c75..6bc56a8ab6 100644 --- a/pom.xml +++ b/pom.xml @@ -1194,6 +1194,7 @@ spring-mvc-forms-jsp spring-mvc-forms-thymeleaf spring-mvc-java + spring-mvc-java-2 spring-mvc-kotlin spring-mvc-velocity From af596b23381616097aa132ef2eacfcd3eeaad02e Mon Sep 17 00:00:00 2001 From: chirag d Date: Sat, 15 Feb 2020 21:57:54 +0530 Subject: [PATCH 004/130] BAEL:3771 Few review comments --- .../cache/CacheControlController.java | 21 +++++++++---------- .../java/com/baeldung/cache/WebConfig.java | 2 +- ...CacheControlControllerIntegrationTest.java | 7 ++++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheControlController.java b/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheControlController.java index 5bf095888e..7305f836cf 100644 --- a/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheControlController.java +++ b/spring-mvc-java-2/src/main/java/com/baeldung/cache/CacheControlController.java @@ -3,9 +3,8 @@ package com.baeldung.cache; import org.springframework.http.CacheControl; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.context.request.WebRequest; import javax.servlet.http.HttpServletResponse; @@ -16,28 +15,28 @@ import java.util.concurrent.TimeUnit; @Controller public class CacheControlController { - @RequestMapping(value = "/hello/{name}", method = RequestMethod.GET) - public ResponseEntity helloWorld(@PathVariable String name) { + @GetMapping(value = "/hello/{name}") + public ResponseEntity hello(@PathVariable String name) { CacheControl cacheControl = CacheControl.maxAge(60, TimeUnit.SECONDS) - .noTransform() - .mustRevalidate(); + .noTransform() + .mustRevalidate(); return ResponseEntity.ok() - .cacheControl(cacheControl) - .body("Hello " + name); + .cacheControl(cacheControl) + .body("Hello " + name); } - @RequestMapping(value = "/home/{name}", method = RequestMethod.GET) + @GetMapping(value = "/home/{name}") public String home(@PathVariable String name, final HttpServletResponse response) { response.addHeader("Cache-Control", "max-age=60, must-revalidate, no-transform"); return "home"; } - @RequestMapping(value = "/cache/{name}", method = RequestMethod.GET) + @GetMapping(value = "/login/{name}") public ResponseEntity intercept(@PathVariable String name) { return ResponseEntity.ok().body("Hello " + name); } - @RequestMapping(value = "/validate/{name}", method = RequestMethod.GET) + @GetMapping(value = "/productInfo/{name}") public ResponseEntity validate(@PathVariable String name, WebRequest request) { ZoneId zoneId = ZoneId.of("GMT"); diff --git a/spring-mvc-java-2/src/main/java/com/baeldung/cache/WebConfig.java b/spring-mvc-java-2/src/main/java/com/baeldung/cache/WebConfig.java index 728479979c..2f07912e80 100644 --- a/spring-mvc-java-2/src/main/java/com/baeldung/cache/WebConfig.java +++ b/spring-mvc-java-2/src/main/java/com/baeldung/cache/WebConfig.java @@ -35,7 +35,7 @@ public class WebConfig implements WebMvcConfigurer { WebContentInterceptor interceptor = new WebContentInterceptor(); interceptor.addCacheMapping(CacheControl.maxAge(60, TimeUnit.SECONDS) .noTransform() - .mustRevalidate(), "/cache/*"); + .mustRevalidate(), "/login/*"); registry.addInterceptor(interceptor); } } \ No newline at end of file diff --git a/spring-mvc-java-2/src/test/java/com/baeldung/cache/CacheControlControllerIntegrationTest.java b/spring-mvc-java-2/src/test/java/com/baeldung/cache/CacheControlControllerIntegrationTest.java index ef408038ae..7acfe5e480 100644 --- a/spring-mvc-java-2/src/test/java/com/baeldung/cache/CacheControlControllerIntegrationTest.java +++ b/spring-mvc-java-2/src/test/java/com/baeldung/cache/CacheControlControllerIntegrationTest.java @@ -37,7 +37,8 @@ public class CacheControlControllerIntegrationTest { this.mockMvc.perform(MockMvcRequestBuilders.get("/hello/baeldung")) .andDo(MockMvcResultHandlers.print()) .andExpect(MockMvcResultMatchers.status().isOk()) - .andExpect(MockMvcResultMatchers.header().string("Cache-Control","max-age=60, must-revalidate, no-transform")); + .andExpect(MockMvcResultMatchers.header() + .string("Cache-Control","max-age=60, must-revalidate, no-transform")); } @Test @@ -59,7 +60,7 @@ public class CacheControlControllerIntegrationTest { @Test void whenInterceptor_thenReturnCacheHeader() throws Exception { - this.mockMvc.perform(MockMvcRequestBuilders.get("/cache/baeldung")) + this.mockMvc.perform(MockMvcRequestBuilders.get("/login/baeldung")) .andDo(MockMvcResultHandlers.print()) .andExpect(MockMvcResultMatchers.status().isOk()) .andExpect(MockMvcResultMatchers.header().string("Cache-Control","max-age=60, must-revalidate, no-transform")); @@ -69,7 +70,7 @@ public class CacheControlControllerIntegrationTest { void whenValidate_thenReturnCacheHeader() throws Exception { HttpHeaders headers = new HttpHeaders(); headers.add(IF_UNMODIFIED_SINCE, "Tue, 04 Feb 2020 19:57:25 GMT"); - this.mockMvc.perform(MockMvcRequestBuilders.get("/validate/baeldung").headers(headers)) + this.mockMvc.perform(MockMvcRequestBuilders.get("/productInfo/baeldung").headers(headers)) .andDo(MockMvcResultHandlers.print()) .andExpect(MockMvcResultMatchers.status().is(304)); } From ae6aaf40f057741fec9429fa5ba1e6576fe6310f Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Tue, 10 Mar 2020 00:50:53 +0200 Subject: [PATCH 005/130] BAEL-3859 - Add implementation for AtomicMarkableReference article. --- .../AtomicMarkableReferenceUnitTest.java | 193 ++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java diff --git a/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java b/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java new file mode 100644 index 0000000000..b864c78559 --- /dev/null +++ b/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java @@ -0,0 +1,193 @@ +package com.baeldung.concurrent.atomic; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicMarkableReference; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class AtomicMarkableReferenceUnitTest { + + private AtomicMarkableReference employeeNode; + + class Employee { + private int id; + private String name; + + Employee(int id, String name) { + this.id = id; + this.name = name; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof Employee)) + return false; + Employee employee = (Employee) obj; + return id == employee.id && name.equals(employee.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + } + + @Test + void givenMarkValueAsTrue_whenUsingIsMarkedMethod_thenMarkValueShouldBeTrue() { + employeeNode = new AtomicMarkableReference(new Employee(123, "Mike"), true); + + Assertions.assertTrue(employeeNode.isMarked()); + } + + @Test + void givenMarkValueAsFalse_whenUsingIsMarkedMethod_thenMarkValueShouldBeFalse() { + employeeNode = new AtomicMarkableReference(new Employee(123, "Mike"), false); + + Assertions.assertFalse(employeeNode.isMarked()); + } + + @Test + void whenUsingGetReferenceMethod_thenCurrentReferenceShouldBeReturned() { + Employee employee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(employee, false); + + Assertions.assertEquals(employeeNode.getReference(), employee); + } + + @Test + void whenUsingGetMethod_thenCurrentReferenceAndMarkShouldBeReturned() { + Employee employee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(employee, true); + + boolean[] markHolder = new boolean[1]; + Employee currentEmployee = employeeNode.get(markHolder); + + Assertions.assertEquals(currentEmployee, employee); + Assertions.assertTrue(markHolder[0]); + } + + @Test + void givenNewReferenceAndMark_whenUsingSetMethod_thenCurrentReferenceAndMarkShouldBeUpdated() { + Employee employee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(employee, true); + + Employee newEmployee = new Employee(124, "John"); + employeeNode.set(newEmployee, false); + + Assertions.assertEquals(employeeNode.getReference(), newEmployee); + Assertions.assertFalse(employeeNode.isMarked()); + } + + @Test + void givenTheSameObjectReference_whenUsingAttemptMarkMethod_thenMarkShouldBeUpdated() { + Employee employee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(employee, true); + + Assertions.assertTrue(employeeNode.attemptMark(employee, false)); + Assertions.assertFalse(employeeNode.isMarked()); + } + + @Test + void givenDifferentObjectReference_whenUsingAttemptMarkMethod_thenMarkShouldNotBeUpdated() { + Employee employee = new Employee(123, "Mike"); + Employee expectedEmployee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(employee, true); + + Assertions.assertFalse(employeeNode.attemptMark(expectedEmployee, false)); + Assertions.assertTrue(employeeNode.isMarked()); + } + + @Test + void givenCurrentReferenceAndCurrentMark_whenUsingCompareAndSet_thenReferenceAndMarkShouldBeUpdated() { + Employee employee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(employee, true); + Employee newEmployee = new Employee(124, "John"); + + Assertions.assertTrue(employeeNode.compareAndSet(employee, newEmployee, true, false)); + Assertions.assertEquals(employeeNode.getReference(), newEmployee); + Assertions.assertFalse(employeeNode.isMarked()); + } + + @Test + void givenNotCurrentReferenceAndCurrentMark_whenUsingCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { + Employee employee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(employee, true); + Employee newEmployee = new Employee(124, "John"); + + Assertions.assertFalse(employeeNode.compareAndSet(new Employee(1234, "Steve"), newEmployee, true, false)); + Assertions.assertEquals(employeeNode.getReference(), employee); + Assertions.assertTrue(employeeNode.isMarked()); + } + + @Test + void givenCurrentReferenceAndNotCurrentMark_whenUsingCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { + Employee employee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(employee, true); + Employee newEmployee = new Employee(124, "John"); + + Assertions.assertFalse(employeeNode.compareAndSet(employee, newEmployee, false, true)); + Assertions.assertEquals(employeeNode.getReference(), employee); + Assertions.assertTrue(employeeNode.isMarked()); + } + + @Test + void givenNotCurrentReferenceAndNotCurrentMark_whenUsingCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { + Employee employee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(employee, true); + Employee newEmployee = new Employee(124, "John"); + + Assertions.assertFalse(employeeNode.compareAndSet(new Employee(1234, "Steve"), newEmployee, false, true)); + Assertions.assertEquals(employeeNode.getReference(), employee); + Assertions.assertTrue(employeeNode.isMarked()); + } + + @Test + void givenCurrentReferenceAndCurrentMark_whenUsingWeakCompareAndSet_thenReferenceAndMarkShouldBeUpdated() { + Employee employee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(employee, true); + Employee newEmployee = new Employee(124, "John"); + + Assertions.assertTrue(employeeNode.weakCompareAndSet(employee, newEmployee, true, false)); + Assertions.assertEquals(employeeNode.getReference(), newEmployee); + Assertions.assertFalse(employeeNode.isMarked()); + } + + @Test + void givenNotCurrentReferenceAndCurrentMark_whenUsingWeakCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { + Employee expectedEmployee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(expectedEmployee, true); + Employee newEmployee = new Employee(124, "John"); + + Assertions.assertFalse(employeeNode.weakCompareAndSet(new Employee(1234, "Steve"), newEmployee, true, false)); + Assertions.assertEquals(employeeNode.getReference(), expectedEmployee); + Assertions.assertTrue(employeeNode.isMarked()); + } + + @Test + void givenCurrentReferenceAndNotCurrentMark_whenUsingWeakCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { + Employee expectedEmployee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(expectedEmployee, true); + Employee newEmployee = new Employee(124, "John"); + + Assertions.assertFalse(employeeNode.weakCompareAndSet(expectedEmployee, newEmployee, false, true)); + Assertions.assertEquals(employeeNode.getReference(), expectedEmployee); + Assertions.assertTrue(employeeNode.isMarked()); + } + + @Test + void givenNotCurrentReferenceAndNotCurrentMark_whenUsingWeakCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { + Employee employee = new Employee(123, "Mike"); + employeeNode = new AtomicMarkableReference(employee, true); + Employee newEmployee = new Employee(124, "John"); + + Assertions.assertFalse(employeeNode.weakCompareAndSet(new Employee(1234, "Steve"), newEmployee, false, true)); + Assertions.assertEquals(employeeNode.getReference(), employee); + Assertions.assertTrue(employeeNode.isMarked()); + } +} From 205ee99874c09154d3416729ca964149a72e57a1 Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Fri, 13 Mar 2020 21:25:17 +0200 Subject: [PATCH 006/130] BAEL-3859 Remove unnecessary equals and hashcode overriden methods. --- .../AtomicMarkableReferenceUnitTest.java | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java b/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java index b864c78559..4ac9e53a43 100644 --- a/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java +++ b/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java @@ -1,6 +1,5 @@ package com.baeldung.concurrent.atomic; -import java.util.Objects; import java.util.concurrent.atomic.AtomicMarkableReference; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -18,24 +17,21 @@ public class AtomicMarkableReferenceUnitTest { this.name = name; } - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (!(obj instanceof Employee)) - return false; - Employee employee = (Employee) obj; - return id == employee.id && name.equals(employee.name); + public int getId() { + return id; } - @Override - public int hashCode() { - return Objects.hash(id, name); + public void setId(int id) { + this.id = id; } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } } @Test From f7ae2095371e0c0852724a63c53ea3d14d78367e Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Fri, 13 Mar 2020 22:46:41 +0200 Subject: [PATCH 007/130] BAEL-3859 Add type to employeeNode and fix order of parameters in assertEquals method calls. --- .../AtomicMarkableReferenceUnitTest.java | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java b/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java index 4ac9e53a43..d83146c6e8 100644 --- a/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java +++ b/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java @@ -6,8 +6,6 @@ import org.junit.jupiter.api.Test; public class AtomicMarkableReferenceUnitTest { - private AtomicMarkableReference employeeNode; - class Employee { private int id; private String name; @@ -31,19 +29,19 @@ public class AtomicMarkableReferenceUnitTest { public void setName(String name) { this.name = name; - } + } } @Test void givenMarkValueAsTrue_whenUsingIsMarkedMethod_thenMarkValueShouldBeTrue() { - employeeNode = new AtomicMarkableReference(new Employee(123, "Mike"), true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(new Employee(123, "Mike"), true); Assertions.assertTrue(employeeNode.isMarked()); } @Test void givenMarkValueAsFalse_whenUsingIsMarkedMethod_thenMarkValueShouldBeFalse() { - employeeNode = new AtomicMarkableReference(new Employee(123, "Mike"), false); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(new Employee(123, "Mike"), false); Assertions.assertFalse(employeeNode.isMarked()); } @@ -51,39 +49,39 @@ public class AtomicMarkableReferenceUnitTest { @Test void whenUsingGetReferenceMethod_thenCurrentReferenceShouldBeReturned() { Employee employee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(employee, false); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, false); - Assertions.assertEquals(employeeNode.getReference(), employee); + Assertions.assertEquals(employee, employeeNode.getReference()); } @Test void whenUsingGetMethod_thenCurrentReferenceAndMarkShouldBeReturned() { Employee employee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(employee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); boolean[] markHolder = new boolean[1]; Employee currentEmployee = employeeNode.get(markHolder); - Assertions.assertEquals(currentEmployee, employee); + Assertions.assertEquals(employee, currentEmployee); Assertions.assertTrue(markHolder[0]); } @Test void givenNewReferenceAndMark_whenUsingSetMethod_thenCurrentReferenceAndMarkShouldBeUpdated() { Employee employee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(employee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Employee newEmployee = new Employee(124, "John"); employeeNode.set(newEmployee, false); - Assertions.assertEquals(employeeNode.getReference(), newEmployee); + Assertions.assertEquals(newEmployee, employeeNode.getReference()); Assertions.assertFalse(employeeNode.isMarked()); } @Test void givenTheSameObjectReference_whenUsingAttemptMarkMethod_thenMarkShouldBeUpdated() { Employee employee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(employee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Assertions.assertTrue(employeeNode.attemptMark(employee, false)); Assertions.assertFalse(employeeNode.isMarked()); @@ -93,7 +91,7 @@ public class AtomicMarkableReferenceUnitTest { void givenDifferentObjectReference_whenUsingAttemptMarkMethod_thenMarkShouldNotBeUpdated() { Employee employee = new Employee(123, "Mike"); Employee expectedEmployee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(employee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Assertions.assertFalse(employeeNode.attemptMark(expectedEmployee, false)); Assertions.assertTrue(employeeNode.isMarked()); @@ -102,88 +100,88 @@ public class AtomicMarkableReferenceUnitTest { @Test void givenCurrentReferenceAndCurrentMark_whenUsingCompareAndSet_thenReferenceAndMarkShouldBeUpdated() { Employee employee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(employee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Employee newEmployee = new Employee(124, "John"); Assertions.assertTrue(employeeNode.compareAndSet(employee, newEmployee, true, false)); - Assertions.assertEquals(employeeNode.getReference(), newEmployee); + Assertions.assertEquals(newEmployee, employeeNode.getReference()); Assertions.assertFalse(employeeNode.isMarked()); } @Test void givenNotCurrentReferenceAndCurrentMark_whenUsingCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { Employee employee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(employee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Employee newEmployee = new Employee(124, "John"); Assertions.assertFalse(employeeNode.compareAndSet(new Employee(1234, "Steve"), newEmployee, true, false)); - Assertions.assertEquals(employeeNode.getReference(), employee); + Assertions.assertEquals(employee, employeeNode.getReference()); Assertions.assertTrue(employeeNode.isMarked()); } @Test void givenCurrentReferenceAndNotCurrentMark_whenUsingCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { Employee employee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(employee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Employee newEmployee = new Employee(124, "John"); Assertions.assertFalse(employeeNode.compareAndSet(employee, newEmployee, false, true)); - Assertions.assertEquals(employeeNode.getReference(), employee); + Assertions.assertEquals(employee, employeeNode.getReference()); Assertions.assertTrue(employeeNode.isMarked()); } @Test void givenNotCurrentReferenceAndNotCurrentMark_whenUsingCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { Employee employee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(employee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Employee newEmployee = new Employee(124, "John"); Assertions.assertFalse(employeeNode.compareAndSet(new Employee(1234, "Steve"), newEmployee, false, true)); - Assertions.assertEquals(employeeNode.getReference(), employee); + Assertions.assertEquals(employee, employeeNode.getReference()); Assertions.assertTrue(employeeNode.isMarked()); } @Test void givenCurrentReferenceAndCurrentMark_whenUsingWeakCompareAndSet_thenReferenceAndMarkShouldBeUpdated() { Employee employee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(employee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Employee newEmployee = new Employee(124, "John"); Assertions.assertTrue(employeeNode.weakCompareAndSet(employee, newEmployee, true, false)); - Assertions.assertEquals(employeeNode.getReference(), newEmployee); + Assertions.assertEquals(newEmployee, employeeNode.getReference()); Assertions.assertFalse(employeeNode.isMarked()); } @Test void givenNotCurrentReferenceAndCurrentMark_whenUsingWeakCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { Employee expectedEmployee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(expectedEmployee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(expectedEmployee, true); Employee newEmployee = new Employee(124, "John"); Assertions.assertFalse(employeeNode.weakCompareAndSet(new Employee(1234, "Steve"), newEmployee, true, false)); - Assertions.assertEquals(employeeNode.getReference(), expectedEmployee); + Assertions.assertEquals(expectedEmployee, employeeNode.getReference()); Assertions.assertTrue(employeeNode.isMarked()); } @Test void givenCurrentReferenceAndNotCurrentMark_whenUsingWeakCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { Employee expectedEmployee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(expectedEmployee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(expectedEmployee, true); Employee newEmployee = new Employee(124, "John"); Assertions.assertFalse(employeeNode.weakCompareAndSet(expectedEmployee, newEmployee, false, true)); - Assertions.assertEquals(employeeNode.getReference(), expectedEmployee); + Assertions.assertEquals(expectedEmployee, employeeNode.getReference()); Assertions.assertTrue(employeeNode.isMarked()); } @Test void givenNotCurrentReferenceAndNotCurrentMark_whenUsingWeakCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { Employee employee = new Employee(123, "Mike"); - employeeNode = new AtomicMarkableReference(employee, true); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Employee newEmployee = new Employee(124, "John"); Assertions.assertFalse(employeeNode.weakCompareAndSet(new Employee(1234, "Steve"), newEmployee, false, true)); - Assertions.assertEquals(employeeNode.getReference(), employee); + Assertions.assertEquals(employee, employeeNode.getReference()); Assertions.assertTrue(employeeNode.isMarked()); } } From 8e3d81fcb962c262bd306bb8e5d1ac6c97566db6 Mon Sep 17 00:00:00 2001 From: chirag d Date: Sat, 14 Mar 2020 12:24:44 +0530 Subject: [PATCH 008/130] BAEL-3901 Clear Site Data Header in Spring Security --- spring-security-modules/pom.xml | 1 + .../spring-security-clear-site-data/pom.xml | 54 +++++++++++++++++++ .../LogoutClearSiteDataController.java | 16 ++++++ .../com/baeldung/SpringSecurityConfig.java | 35 ++++++++++++ .../src/main/java/com/baeldung/WebConfig.java | 19 +++++++ ...LogoutClearSiteDataControllerUnitTest.java | 47 ++++++++++++++++ 6 files changed, 172 insertions(+) create mode 100644 spring-security-modules/spring-security-clear-site-data/pom.xml create mode 100644 spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/LogoutClearSiteDataController.java create mode 100644 spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/SpringSecurityConfig.java create mode 100644 spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/WebConfig.java create mode 100644 spring-security-modules/spring-security-clear-site-data/src/test/java/com/baeldung/LogoutClearSiteDataControllerUnitTest.java diff --git a/spring-security-modules/pom.xml b/spring-security-modules/pom.xml index 49a0db03ed..07c326c10e 100644 --- a/spring-security-modules/pom.xml +++ b/spring-security-modules/pom.xml @@ -17,6 +17,7 @@ spring-security-acl spring-security-angular/server spring-security-cache-control + spring-security-clear-site-data spring-security-core spring-security-cors spring-security-kerberos diff --git a/spring-security-modules/spring-security-clear-site-data/pom.xml b/spring-security-modules/spring-security-clear-site-data/pom.xml new file mode 100644 index 0000000000..e58debc0aa --- /dev/null +++ b/spring-security-modules/spring-security-clear-site-data/pom.xml @@ -0,0 +1,54 @@ + + + + 4.0.0 + + com.baeldung + spring-security-clear-site-data + 1.0-SNAPSHOT + spring-security-clear-site-data + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../../parent-boot-2 + + + + + org.springframework.security + spring-security-web + ${spring.mvc.version} + + + org.springframework.security + spring-security-config + ${spring.mvc.version} + + + org.springframework.security + spring-security-test + ${spring.mvc.version} + test + + + org.springframework + spring-webmvc + ${spring.mvc.version} + + + javax.servlet + javax.servlet-api + ${javax.version} + + + + + + 5.2.2.RELEASE + 4.0.1 + + + diff --git a/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/LogoutClearSiteDataController.java b/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/LogoutClearSiteDataController.java new file mode 100644 index 0000000000..d27fa18116 --- /dev/null +++ b/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/LogoutClearSiteDataController.java @@ -0,0 +1,16 @@ +package com.baeldung; + +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +@Controller +public class LogoutClearSiteDataController { + + @GetMapping(value = "/baeldung/logout") + public ResponseEntity logout(@PathVariable String name) { + return ResponseEntity.ok().build(); + } + +} diff --git a/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/SpringSecurityConfig.java b/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/SpringSecurityConfig.java new file mode 100644 index 0000000000..fd43fb2c9e --- /dev/null +++ b/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/SpringSecurityConfig.java @@ -0,0 +1,35 @@ +package com.baeldung; + + +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.web.authentication.logout.HeaderWriterLogoutHandler; +import org.springframework.security.web.header.writers.ClearSiteDataHeaderWriter; + +import static org.springframework.security.web.header.writers.ClearSiteDataHeaderWriter.Directive.CACHE; +import static org.springframework.security.web.header.writers.ClearSiteDataHeaderWriter.Directive.COOKIES; +import static org.springframework.security.web.header.writers.ClearSiteDataHeaderWriter.Directive.STORAGE; + +@Configuration +@EnableWebSecurity +@EnableGlobalMethodSecurity(prePostEnabled = true) +public class SpringSecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + + http.csrf() + .disable() + .formLogin() + .loginPage("/login.html") + .loginProcessingUrl("/perform_login") + .defaultSuccessUrl("/homepage.html", true) + .and() + .logout().logoutUrl("/baeldung/logout") + .addLogoutHandler(new HeaderWriterLogoutHandler( + new ClearSiteDataHeaderWriter(CACHE, COOKIES, STORAGE))); + } +} diff --git a/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/WebConfig.java b/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/WebConfig.java new file mode 100644 index 0000000000..16826e28b8 --- /dev/null +++ b/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/WebConfig.java @@ -0,0 +1,19 @@ +package com.baeldung; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.CacheControl; +import org.springframework.web.servlet.config.annotation.EnableWebMvc; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import org.springframework.web.servlet.mvc.WebContentInterceptor; + +import java.util.concurrent.TimeUnit; + +@EnableWebMvc +@Configuration +@ComponentScan(basePackages = {"com.baeldung"}) +public class WebConfig implements WebMvcConfigurer { +} \ No newline at end of file diff --git a/spring-security-modules/spring-security-clear-site-data/src/test/java/com/baeldung/LogoutClearSiteDataControllerUnitTest.java b/spring-security-modules/spring-security-clear-site-data/src/test/java/com/baeldung/LogoutClearSiteDataControllerUnitTest.java new file mode 100644 index 0000000000..905a866413 --- /dev/null +++ b/spring-security-modules/spring-security-clear-site-data/src/test/java/com/baeldung/LogoutClearSiteDataControllerUnitTest.java @@ -0,0 +1,47 @@ +package com.baeldung; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.result.MockMvcResultHandlers; +import org.springframework.test.web.servlet.result.MockMvcResultMatchers; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; +import javax.servlet.Filter; + +@ExtendWith(SpringExtension.class) +@WebAppConfiguration +@ContextConfiguration(classes = {SpringSecurityConfig.class, WebConfig.class}) +public class LogoutClearSiteDataControllerUnitTest { + + @Autowired + private WebApplicationContext wac; + + @Autowired + private Filter springSecurityFilterChain; + + private MockMvc mockMvc; + + @BeforeEach + void setup() throws Exception { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).addFilters(springSecurityFilterChain).build(); + } + + @Test + void whenResponseBody_thenReturnCacheHeader() throws Exception { + this.mockMvc + .perform(MockMvcRequestBuilders + .get("/baeldung/logout").secure(true)) + .andDo(MockMvcResultHandlers.print()) + .andExpect(MockMvcResultMatchers.status().is(302)) + .andExpect(MockMvcResultMatchers.header() + .string("Clear-Site-Data", "\"cache\", \"cookies\", \"storage\"")); + } + +} From 2eded212580b3e810a79561a3adc227f633bc8ec Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Sat, 14 Mar 2020 23:17:58 +0300 Subject: [PATCH 009/130] BAEL-3832: Difference between BeanFactory and ApplicationContext completed --- spring-core-3/pom.xml | 7 + .../bean/CustomBeanFactoryPostProcessor.java | 16 ++ .../bean/CustomBeanPostProcessor.java | 17 +++ .../baeldung/ioccontainer/bean/Student.java | 12 ++ .../ioccontainer/IOCContainerAppTest.java | 137 ++++++++++++++++++ .../ioc-container-difference-example.xml | 11 ++ 6 files changed, 200 insertions(+) create mode 100644 spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java create mode 100644 spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java create mode 100644 spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java create mode 100644 spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java create mode 100644 spring-core-3/src/test/resources/ioc-container-difference-example.xml diff --git a/spring-core-3/pom.xml b/spring-core-3/pom.xml index 205259e8e4..d1163a174c 100644 --- a/spring-core-3/pom.xml +++ b/spring-core-3/pom.xml @@ -67,6 +67,12 @@ ${junit-jupiter.version} test + + + log4j + log4j + ${log4j.version} + @@ -83,6 +89,7 @@ 2.22.1 1.3.2 2.2.2.RELEASE + 1.2.17 \ No newline at end of file diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java new file mode 100644 index 0000000000..d6e2c92144 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java @@ -0,0 +1,16 @@ +package com.baeldung.ioccontainer.bean; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; + +public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor { + static final Logger LOGGER = LogManager.getLogger(CustomBeanPostProcessor.class.getName()); + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + LOGGER.info("BeanFactoryPostProcessor is Registered"); + } +} diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java new file mode 100644 index 0000000000..bf34453388 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java @@ -0,0 +1,17 @@ +package com.baeldung.ioccontainer.bean; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; + +public class CustomBeanPostProcessor implements BeanPostProcessor { + + static final Logger LOGGER = LogManager.getLogger(CustomBeanPostProcessor.class.getName()); + + public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + LOGGER.info("BeanPostProcessor is Registered Before Initialization"); + return bean; + } + +} diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java new file mode 100644 index 0000000000..e32b4ecc29 --- /dev/null +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java @@ -0,0 +1,12 @@ +package com.baeldung.ioccontainer.bean; + +import org.apache.log4j.LogManager; +import org.apache.log4j.Logger; + +public class Student { + static final Logger LOGGER = LogManager.getLogger(Student.class.getName()); + + public void postConstruct() { + LOGGER.info("Student Bean is initialized"); + } +} diff --git a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java new file mode 100644 index 0000000000..b97aa08f80 --- /dev/null +++ b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java @@ -0,0 +1,137 @@ +package com.baeldung.ioccontainer; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.log4j.AppenderSkeleton; +import org.apache.log4j.Logger; +import org.apache.log4j.spi.LoggingEvent; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.BeanFactory; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanFactory; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; + +import com.baeldung.ioccontainer.bean.CustomBeanFactoryPostProcessor; +import com.baeldung.ioccontainer.bean.CustomBeanPostProcessor; +import com.baeldung.ioccontainer.bean.Student; + +public class IOCContainerAppTest { + + private LogAppender logAppender; + private List loggingEvents; + + @BeforeEach + public void initializeLogAppender() { + logAppender = new LogAppender(); + Logger.getRootLogger() + .addAppender(logAppender); + loggingEvents = logAppender.events; + } + + @AfterEach + public void removeLogAppender() { + Logger.getRootLogger() + .removeAppender(logAppender); + } + + @Test + public void whenBFInitialized_thenNoStudentLogPrinted() { + Resource res = new ClassPathResource("ioc-container-difference-example.xml"); + BeanFactory factory = new XmlBeanFactory(res); + + String expected = "Student Bean is initialized"; + assertFalse(checkWhetherLoggerContains(expected)); + } + + @Test + public void whenBFInitialized_thenStudentLogPrinted() { + + Resource res = new ClassPathResource("ioc-container-difference-example.xml"); + BeanFactory factory = new XmlBeanFactory(res); + Student student = (Student) factory.getBean("student"); + + String expected = "Student Bean is initialized"; + assertTrue(checkWhetherLoggerContains(expected)); + } + + @Test + public void whenAppContInitialized_thenStudentObjInitialized() { + ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); + + String expected = "Student Bean is initialized"; + assertTrue(checkWhetherLoggerContains(expected)); + } + + @Test + public void whenBFInitialized_thenBFPProcessorAndBPProcessorNotRegAutomatically() { + Resource res = new ClassPathResource("ioc-container-difference-example.xml"); + ConfigurableListableBeanFactory factory = new XmlBeanFactory(res); + + String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; + assertFalse(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); + + String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; + assertFalse(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + } + + @Test + public void whenAppContInitialized_thenBFPostProcessorAndBPostProcessorRegisteredAutomatically() { + ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); + + String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; + assertTrue(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); + + String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; + assertTrue(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + } + + @Test + public void whenBFPostProcessorAndBPProcessorRegisteredManually_thenReturnTrue() { + Resource res = new ClassPathResource("ioc-container-difference-example.xml"); + ConfigurableListableBeanFactory factory = new XmlBeanFactory(res); + + CustomBeanFactoryPostProcessor beanFactoryPostProcessor = new CustomBeanFactoryPostProcessor(); + beanFactoryPostProcessor.postProcessBeanFactory(factory); + String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; + assertTrue(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); + + CustomBeanPostProcessor beanPostProcessor = new CustomBeanPostProcessor(); + factory.addBeanPostProcessor(beanPostProcessor); + Student student = (Student) factory.getBean("student"); + String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; + assertTrue(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + } + + private boolean checkWhetherLoggerContains(String expectedLogMessge) { + boolean isLogExist = loggingEvents.stream() + .anyMatch(logEvent -> logEvent.getMessage() + .equals(expectedLogMessge)); + return isLogExist; + } + + public static class LogAppender extends AppenderSkeleton { + public List events = new ArrayList(); + + public void close() { + } + + public boolean requiresLayout() { + return false; + } + + @Override + protected void append(LoggingEvent event) { + events.add(event); + } + + } +} diff --git a/spring-core-3/src/test/resources/ioc-container-difference-example.xml b/spring-core-3/src/test/resources/ioc-container-difference-example.xml new file mode 100644 index 0000000000..9bb01efe66 --- /dev/null +++ b/spring-core-3/src/test/resources/ioc-container-difference-example.xml @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file From 5ad0170cb6423a462d1f7d685ff51c8b8992ede0 Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Sun, 15 Mar 2020 10:04:16 +0300 Subject: [PATCH 010/130] BAEL-3832: renamed the unit test case as per the naming convention --- .../{IOCContainerAppTest.java => IOCContainerAppUnitTest.java} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-core-3/src/test/java/com/baeldung/ioccontainer/{IOCContainerAppTest.java => IOCContainerAppUnitTest.java} (99%) diff --git a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java similarity index 99% rename from spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java rename to spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java index b97aa08f80..66b6842d0f 100644 --- a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppTest.java +++ b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java @@ -24,7 +24,7 @@ import com.baeldung.ioccontainer.bean.CustomBeanFactoryPostProcessor; import com.baeldung.ioccontainer.bean.CustomBeanPostProcessor; import com.baeldung.ioccontainer.bean.Student; -public class IOCContainerAppTest { +public class IOCContainerAppUnitTest { private LogAppender logAppender; private List loggingEvents; From 3aa7a8f8a2bcf9d17f3c2b503b780fc06d3bed1b Mon Sep 17 00:00:00 2001 From: Florin Hriscu Date: Mon, 16 Mar 2020 01:42:29 +0200 Subject: [PATCH 011/130] BAEL-3859 Changes after review. --- .../AtomicMarkableReferenceUnitTest.java | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java b/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java index d83146c6e8..5f526344be 100644 --- a/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java +++ b/core-java-modules/core-java-concurrency-basic-2/src/test/java/com/baeldung/concurrent/atomic/AtomicMarkableReferenceUnitTest.java @@ -34,14 +34,16 @@ public class AtomicMarkableReferenceUnitTest { @Test void givenMarkValueAsTrue_whenUsingIsMarkedMethod_thenMarkValueShouldBeTrue() { - AtomicMarkableReference employeeNode = new AtomicMarkableReference(new Employee(123, "Mike"), true); + Employee employee = new Employee(123, "Mike"); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Assertions.assertTrue(employeeNode.isMarked()); } @Test void givenMarkValueAsFalse_whenUsingIsMarkedMethod_thenMarkValueShouldBeFalse() { - AtomicMarkableReference employeeNode = new AtomicMarkableReference(new Employee(123, "Mike"), false); + Employee employee = new Employee(123, "Mike"); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, false); Assertions.assertFalse(employeeNode.isMarked()); } @@ -49,7 +51,7 @@ public class AtomicMarkableReferenceUnitTest { @Test void whenUsingGetReferenceMethod_thenCurrentReferenceShouldBeReturned() { Employee employee = new Employee(123, "Mike"); - AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, false); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Assertions.assertEquals(employee, employeeNode.getReference()); } @@ -90,8 +92,8 @@ public class AtomicMarkableReferenceUnitTest { @Test void givenDifferentObjectReference_whenUsingAttemptMarkMethod_thenMarkShouldNotBeUpdated() { Employee employee = new Employee(123, "Mike"); - Employee expectedEmployee = new Employee(123, "Mike"); AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); + Employee expectedEmployee = new Employee(123, "Mike"); Assertions.assertFalse(employeeNode.attemptMark(expectedEmployee, false)); Assertions.assertTrue(employeeNode.isMarked()); @@ -154,23 +156,23 @@ public class AtomicMarkableReferenceUnitTest { @Test void givenNotCurrentReferenceAndCurrentMark_whenUsingWeakCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { - Employee expectedEmployee = new Employee(123, "Mike"); - AtomicMarkableReference employeeNode = new AtomicMarkableReference(expectedEmployee, true); + Employee employee = new Employee(123, "Mike"); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Employee newEmployee = new Employee(124, "John"); Assertions.assertFalse(employeeNode.weakCompareAndSet(new Employee(1234, "Steve"), newEmployee, true, false)); - Assertions.assertEquals(expectedEmployee, employeeNode.getReference()); + Assertions.assertEquals(employee, employeeNode.getReference()); Assertions.assertTrue(employeeNode.isMarked()); } @Test void givenCurrentReferenceAndNotCurrentMark_whenUsingWeakCompareAndSet_thenReferenceAndMarkShouldNotBeUpdated() { - Employee expectedEmployee = new Employee(123, "Mike"); - AtomicMarkableReference employeeNode = new AtomicMarkableReference(expectedEmployee, true); + Employee employee = new Employee(123, "Mike"); + AtomicMarkableReference employeeNode = new AtomicMarkableReference(employee, true); Employee newEmployee = new Employee(124, "John"); - Assertions.assertFalse(employeeNode.weakCompareAndSet(expectedEmployee, newEmployee, false, true)); - Assertions.assertEquals(expectedEmployee, employeeNode.getReference()); + Assertions.assertFalse(employeeNode.weakCompareAndSet(employee, newEmployee, false, true)); + Assertions.assertEquals(employee, employeeNode.getReference()); Assertions.assertTrue(employeeNode.isMarked()); } From d4a928cdfac363353c293a7f0b0abcd936a77919 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Mon, 16 Mar 2020 01:01:01 -0600 Subject: [PATCH 012/130] BAEL-3069 Spring jdbcTemplate Unit Testing --- .../spring-persistence-simple/pom.xml | 7 +++ .../baeldung/jdbc/EmployeeDAOUnitTest.java | 49 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java diff --git a/persistence-modules/spring-persistence-simple/pom.xml b/persistence-modules/spring-persistence-simple/pom.xml index 8a03310048..45605c853e 100644 --- a/persistence-modules/spring-persistence-simple/pom.xml +++ b/persistence-modules/spring-persistence-simple/pom.xml @@ -92,6 +92,12 @@ ${org.springframework.version} test + + org.mockito + mockito-core + ${mockito.version} + test + com.querydsl querydsl-jpa @@ -137,6 +143,7 @@ 9.0.0.M26 1.1 4.2.1 + 3.3.3 21.0 diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java new file mode 100644 index 0000000000..9894801a53 --- /dev/null +++ b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java @@ -0,0 +1,49 @@ +package com.baeldung.jdbc; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import javax.sql.DataSource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import org.springframework.test.util.ReflectionTestUtils; + + +@RunWith(MockitoJUnitRunner.class) + +public class EmployeeDAOUnitTest { + + @Mock + JdbcTemplate jdbcTemplate; + + @Test + public void whenMockJdbcTemplate_thenReturnCorrectEmployeeCount() { + EmployeeDAO employeeDAO = new EmployeeDAO(); + ReflectionTestUtils.setField(employeeDAO, "jdbcTemplate", jdbcTemplate); + Mockito.when(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class)) + .thenReturn(4); + assertEquals(4, employeeDAO.getCountOfEmployees()); + + Mockito.when(jdbcTemplate.queryForObject(Mockito.anyString(), Mockito.eq(Integer.class))) + .thenReturn(3); + assertEquals(3, employeeDAO.getCountOfEmployees()); + } + + @Test + public void whenInjectInMemoryDataSource_thenReturnCorrectEmployeeCount() { + DataSource dataSource = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2) + .addScript("classpath:jdbc/schema.sql") + .addScript("classpath:jdbc/test-data.sql") + .build(); + EmployeeDAO employeeDAO = new EmployeeDAO(); + employeeDAO.setDataSource(dataSource); + assertEquals(4, employeeDAO.getCountOfEmployees()); + } + +} From dc03fa58712d786cb4d8a5ebc54569f6ec8524d9 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 18 Mar 2020 17:12:36 +0530 Subject: [PATCH 013/130] JAVA-626 : Moved extra articles to java-math-2 module --- java-math/README.md | 2 - .../algorithms/gcd/GCDImplementation.java | 55 ------------------- .../gcd/GCDImplementationUnitTest.java | 32 ----------- .../logarithm/LogarithmUnitTest.java | 31 ----------- 4 files changed, 120 deletions(-) delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java delete mode 100644 java-math/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java diff --git a/java-math/README.md b/java-math/README.md index d80a07258a..49ff5afde1 100644 --- a/java-math/README.md +++ b/java-math/README.md @@ -14,5 +14,3 @@ This module contains articles about math in Java. - [Convert Latitude and Longitude to a 2D Point in Java](https://www.baeldung.com/java-convert-latitude-longitude) - [Debugging with Eclipse](https://www.baeldung.com/eclipse-debugging) - [Matrix Multiplication in Java](https://www.baeldung.com/java-matrix-multiplication) -- [Calculating Logarithms in Java](https://www.baeldung.com/java-logarithms) -- [Finding Greatest Common Divisor in Java](https://www.baeldung.com/java-greatest-common-divisor) diff --git a/java-math/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java b/java-math/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java deleted file mode 100644 index d4844abd9c..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.baeldung.algorithms.gcd; - -public class GCDImplementation { - - public static int gcdByBruteForce(int n1, int n2) { - int gcd = 1; - for (int i = 1; i <= n1 && i <= n2; i++) { - if (n1 % i == 0 && n2 % i == 0) { - gcd = i; - } - } - return gcd; - } - - public static int gcdByEuclidsAlgorithm(int n1, int n2) { - if (n2 == 0) { - return n1; - } - return gcdByEuclidsAlgorithm(n2, n1 % n2); - } - - public static int gcdBySteinsAlgorithm(int n1, int n2) { - if (n1 == 0) { - return n2; - } - - if (n2 == 0) { - return n1; - } - - int n; - for (n = 0; ((n1 | n2) & 1) == 0; n++) { - n1 >>= 1; - n2 >>= 1; - } - - while ((n1 & 1) == 0) { - n1 >>= 1; - } - - do { - while ((n2 & 1) == 0) { - n2 >>= 1; - } - - if (n1 > n2) { - int temp = n1; - n1 = n2; - n2 = temp; - } - n2 = (n2 - n1); - } while (n2 != 0); - return n1 << n; - } -} diff --git a/java-math/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java b/java-math/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java deleted file mode 100644 index d2c91a2eb8..0000000000 --- a/java-math/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.algorithms.gcd; - -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class GCDImplementationUnitTest { - - @Test - public void whenCalculatingGCDByBruteForceMethod_thenCorrect() { - int n1 = 60; - int n2 = 90; - int gcd = GCDImplementation.gcdByBruteForce(n1, n2); - assertThat(gcd).isEqualTo(30); - } - - @Test - public void whenCalculatingGCDByEuclidsAlgorithm_thenCorrect() { - int n1 = 60; - int n2 = 90; - int gcd = GCDImplementation.gcdByEuclidsAlgorithm(n1, n2); - assertThat(gcd).isEqualTo(30); - } - - @Test - public void whenCalculatingGCDBySteinsAlgorithm_thenCorrect() { - int n1 = 60; - int n2 = 90; - int gcd = GCDImplementation.gcdBySteinsAlgorithm(n1, n2); - assertThat(gcd).isEqualTo(30); - } -} diff --git a/java-math/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java b/java-math/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java deleted file mode 100644 index facad1edc4..0000000000 --- a/java-math/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.algorithms.logarithm; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.junit.Test; - -public class LogarithmUnitTest { - - @Test - public void givenLog10_shouldReturnValidResults() { - assertEquals(Math.log10(100), 2); - assertEquals(Math.log10(1000), 3); - } - - @Test - public void givenLogE_shouldReturnValidResults() { - assertEquals(Math.log(Math.E), 1); - assertEquals(Math.log(10), 2.30258, 0.00001); - } - - @Test - public void givenCustomLog_shouldReturnValidResults() { - assertEquals(customLog(2, 256), 8); - assertEquals(customLog(10, 100), 2); - } - - private static double customLog(double base, double logNumber) { - return Math.log(logNumber) / Math.log(base); - } - -} From 3ff81a894315d4553354d40c7c6589aeb3bdc817 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 18 Mar 2020 17:13:37 +0530 Subject: [PATCH 014/130] JAVA-626 : Moved extra articles from java-math module --- java-math-2/README.md | 3 +- java-math-2/pom.xml | 14 +++++ .../algorithms/gcd/GCDImplementation.java | 55 +++++++++++++++++++ .../gcd/GCDImplementationUnitTest.java | 32 +++++++++++ .../logarithm/LogarithmUnitTest.java | 31 +++++++++++ 5 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 java-math-2/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java create mode 100644 java-math-2/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java create mode 100644 java-math-2/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java diff --git a/java-math-2/README.md b/java-math-2/README.md index ca809e8623..5345564d5d 100644 --- a/java-math-2/README.md +++ b/java-math-2/README.md @@ -4,5 +4,6 @@ This module contains articles about math in Java. ### Relevant articles: -- [Basic Calculator in Java](https://www.baeldung.com/basic-calculator-in-java) +- [Calculating Logarithms in Java](https://www.baeldung.com/java-logarithms) +- [Finding Greatest Common Divisor in Java](https://www.baeldung.com/java-greatest-common-divisor) - More articles: [[<-- prev]](/../java-math) diff --git a/java-math-2/pom.xml b/java-math-2/pom.xml index e22dcc2b31..7bc05a3a86 100644 --- a/java-math-2/pom.xml +++ b/java-math-2/pom.xml @@ -12,4 +12,18 @@ 1.0.0-SNAPSHOT + + + org.assertj + assertj-core + ${org.assertj.core.version} + test + + + + + + 3.9.0 + + \ No newline at end of file diff --git a/java-math-2/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java b/java-math-2/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java new file mode 100644 index 0000000000..d4844abd9c --- /dev/null +++ b/java-math-2/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java @@ -0,0 +1,55 @@ +package com.baeldung.algorithms.gcd; + +public class GCDImplementation { + + public static int gcdByBruteForce(int n1, int n2) { + int gcd = 1; + for (int i = 1; i <= n1 && i <= n2; i++) { + if (n1 % i == 0 && n2 % i == 0) { + gcd = i; + } + } + return gcd; + } + + public static int gcdByEuclidsAlgorithm(int n1, int n2) { + if (n2 == 0) { + return n1; + } + return gcdByEuclidsAlgorithm(n2, n1 % n2); + } + + public static int gcdBySteinsAlgorithm(int n1, int n2) { + if (n1 == 0) { + return n2; + } + + if (n2 == 0) { + return n1; + } + + int n; + for (n = 0; ((n1 | n2) & 1) == 0; n++) { + n1 >>= 1; + n2 >>= 1; + } + + while ((n1 & 1) == 0) { + n1 >>= 1; + } + + do { + while ((n2 & 1) == 0) { + n2 >>= 1; + } + + if (n1 > n2) { + int temp = n1; + n1 = n2; + n2 = temp; + } + n2 = (n2 - n1); + } while (n2 != 0); + return n1 << n; + } +} diff --git a/java-math-2/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java b/java-math-2/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java new file mode 100644 index 0000000000..d2c91a2eb8 --- /dev/null +++ b/java-math-2/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java @@ -0,0 +1,32 @@ +package com.baeldung.algorithms.gcd; + +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +public class GCDImplementationUnitTest { + + @Test + public void whenCalculatingGCDByBruteForceMethod_thenCorrect() { + int n1 = 60; + int n2 = 90; + int gcd = GCDImplementation.gcdByBruteForce(n1, n2); + assertThat(gcd).isEqualTo(30); + } + + @Test + public void whenCalculatingGCDByEuclidsAlgorithm_thenCorrect() { + int n1 = 60; + int n2 = 90; + int gcd = GCDImplementation.gcdByEuclidsAlgorithm(n1, n2); + assertThat(gcd).isEqualTo(30); + } + + @Test + public void whenCalculatingGCDBySteinsAlgorithm_thenCorrect() { + int n1 = 60; + int n2 = 90; + int gcd = GCDImplementation.gcdBySteinsAlgorithm(n1, n2); + assertThat(gcd).isEqualTo(30); + } +} diff --git a/java-math-2/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java b/java-math-2/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java new file mode 100644 index 0000000000..facad1edc4 --- /dev/null +++ b/java-math-2/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java @@ -0,0 +1,31 @@ +package com.baeldung.algorithms.logarithm; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.Test; + +public class LogarithmUnitTest { + + @Test + public void givenLog10_shouldReturnValidResults() { + assertEquals(Math.log10(100), 2); + assertEquals(Math.log10(1000), 3); + } + + @Test + public void givenLogE_shouldReturnValidResults() { + assertEquals(Math.log(Math.E), 1); + assertEquals(Math.log(10), 2.30258, 0.00001); + } + + @Test + public void givenCustomLog_shouldReturnValidResults() { + assertEquals(customLog(2, 256), 8); + assertEquals(customLog(10, 100), 2); + } + + private static double customLog(double base, double logNumber) { + return Math.log(logNumber) / Math.log(base); + } + +} From 2dd0e5001b744b5902cc8e1478d1f325a8777837 Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Wed, 18 Mar 2020 19:59:02 +0300 Subject: [PATCH 015/130] BAEL-3832: Removed logger checks from the test cases --- .../bean/CustomBeanFactoryPostProcessor.java | 8 +- .../bean/CustomBeanPostProcessor.java | 11 +-- .../baeldung/ioccontainer/bean/Student.java | 7 +- .../ioccontainer/IOCContainerAppUnitTest.java | 91 +++++-------------- 4 files changed, 30 insertions(+), 87 deletions(-) diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java index d6e2c92144..fe773ce2df 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java @@ -1,16 +1,14 @@ package com.baeldung.ioccontainer.bean; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor { - static final Logger LOGGER = LogManager.getLogger(CustomBeanPostProcessor.class.getName()); - + public static boolean isBeanInstantiated = false; + @Override public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - LOGGER.info("BeanFactoryPostProcessor is Registered"); + isBeanInstantiated = true; } } diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java index bf34453388..1c2e011a6c 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java @@ -1,17 +1,14 @@ package com.baeldung.ioccontainer.bean; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; public class CustomBeanPostProcessor implements BeanPostProcessor { - - static final Logger LOGGER = LogManager.getLogger(CustomBeanPostProcessor.class.getName()); - + public static boolean isBeanInstantiated = false; + + @Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { - LOGGER.info("BeanPostProcessor is Registered Before Initialization"); + isBeanInstantiated = true; return bean; } - } diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java index e32b4ecc29..03e0b049ba 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java @@ -1,12 +1,9 @@ package com.baeldung.ioccontainer.bean; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; - public class Student { - static final Logger LOGGER = LogManager.getLogger(Student.class.getName()); + public static boolean isBeanInstantiated = false; public void postConstruct() { - LOGGER.info("Student Bean is initialized"); + isBeanInstantiated = true; } } diff --git a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java index 66b6842d0f..3c0a5b3dbe 100644 --- a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java +++ b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java @@ -3,12 +3,6 @@ package com.baeldung.ioccontainer; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.AppenderSkeleton; -import org.apache.log4j.Logger; -import org.apache.log4j.spi.LoggingEvent; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -26,49 +20,37 @@ import com.baeldung.ioccontainer.bean.Student; public class IOCContainerAppUnitTest { - private LogAppender logAppender; - private List loggingEvents; - @BeforeEach - public void initializeLogAppender() { - logAppender = new LogAppender(); - Logger.getRootLogger() - .addAppender(logAppender); - loggingEvents = logAppender.events; - } - @AfterEach - public void removeLogAppender() { - Logger.getRootLogger() - .removeAppender(logAppender); + public void resetInstantiationFlag() { + Student.isBeanInstantiated = false; + CustomBeanPostProcessor.isBeanInstantiated = false; + CustomBeanFactoryPostProcessor.isBeanInstantiated = false; } @Test - public void whenBFInitialized_thenNoStudentLogPrinted() { + public void whenBFInitialized_thenStudentNotInitialized() { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); BeanFactory factory = new XmlBeanFactory(res); - - String expected = "Student Bean is initialized"; - assertFalse(checkWhetherLoggerContains(expected)); + + assertFalse(Student.isBeanInstantiated); } @Test - public void whenBFInitialized_thenStudentLogPrinted() { - + public void whenBFInitialized_thenStudentInitialized() { + Resource res = new ClassPathResource("ioc-container-difference-example.xml"); BeanFactory factory = new XmlBeanFactory(res); Student student = (Student) factory.getBean("student"); - - String expected = "Student Bean is initialized"; - assertTrue(checkWhetherLoggerContains(expected)); + + assertTrue(Student.isBeanInstantiated); } - + @Test - public void whenAppContInitialized_thenStudentObjInitialized() { + public void whenAppContInitialized_thenStudentInitialized() { ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); - - String expected = "Student Bean is initialized"; - assertTrue(checkWhetherLoggerContains(expected)); + + assertTrue(Student.isBeanInstantiated); } @Test @@ -76,22 +58,16 @@ public class IOCContainerAppUnitTest { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); ConfigurableListableBeanFactory factory = new XmlBeanFactory(res); - String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; - assertFalse(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); - - String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; - assertFalse(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + assertFalse(CustomBeanFactoryPostProcessor.isBeanInstantiated); + assertFalse(CustomBeanPostProcessor.isBeanInstantiated); } @Test public void whenAppContInitialized_thenBFPostProcessorAndBPostProcessorRegisteredAutomatically() { ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); - String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; - assertTrue(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); - - String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; - assertTrue(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + assertTrue(CustomBeanFactoryPostProcessor.isBeanInstantiated); + assertTrue(CustomBeanPostProcessor.isBeanInstantiated); } @Test @@ -101,37 +77,12 @@ public class IOCContainerAppUnitTest { CustomBeanFactoryPostProcessor beanFactoryPostProcessor = new CustomBeanFactoryPostProcessor(); beanFactoryPostProcessor.postProcessBeanFactory(factory); - String beanFactoryPostProcessorExpectedLog = "BeanFactoryPostProcessor is Registered"; - assertTrue(checkWhetherLoggerContains(beanFactoryPostProcessorExpectedLog)); + assertTrue(CustomBeanFactoryPostProcessor.isBeanInstantiated); CustomBeanPostProcessor beanPostProcessor = new CustomBeanPostProcessor(); factory.addBeanPostProcessor(beanPostProcessor); Student student = (Student) factory.getBean("student"); - String beanPostProcessorExpectedLog = "BeanPostProcessor is Registered Before Initialization"; - assertTrue(checkWhetherLoggerContains(beanPostProcessorExpectedLog)); + assertTrue(CustomBeanPostProcessor.isBeanInstantiated); } - private boolean checkWhetherLoggerContains(String expectedLogMessge) { - boolean isLogExist = loggingEvents.stream() - .anyMatch(logEvent -> logEvent.getMessage() - .equals(expectedLogMessge)); - return isLogExist; - } - - public static class LogAppender extends AppenderSkeleton { - public List events = new ArrayList(); - - public void close() { - } - - public boolean requiresLayout() { - return false; - } - - @Override - protected void append(LoggingEvent event) { - events.add(event); - } - - } } From 42b945ce7353eb38007663e30b477ae5925f816a Mon Sep 17 00:00:00 2001 From: chirag d Date: Wed, 18 Mar 2020 22:41:58 +0530 Subject: [PATCH 016/130] BAEL3901 Changed the module --- .../spring-security-clear-site-data/pom.xml | 54 ------------------- .../spring-security-mvc/pom.xml | 27 ++++++++++ .../LogoutClearSiteDataController.java | 2 +- .../clearsitedata}/SpringSecurityConfig.java | 2 +- .../baeldung/clearsitedata}/WebConfig.java | 4 +- ...LogoutClearSiteDataControllerUnitTest.java | 2 +- 6 files changed, 32 insertions(+), 59 deletions(-) delete mode 100644 spring-security-modules/spring-security-clear-site-data/pom.xml rename spring-security-modules/{spring-security-clear-site-data/src/main/java/com/baeldung => spring-security-mvc/src/main/java/com/baeldung/clearsitedata}/LogoutClearSiteDataController.java (92%) rename spring-security-modules/{spring-security-clear-site-data/src/main/java/com/baeldung => spring-security-mvc/src/main/java/com/baeldung/clearsitedata}/SpringSecurityConfig.java (97%) rename spring-security-modules/{spring-security-clear-site-data/src/main/java/com/baeldung => spring-security-mvc/src/main/java/com/baeldung/clearsitedata}/WebConfig.java (88%) rename spring-security-modules/{spring-security-clear-site-data/src/test/java/com/baeldung => spring-security-mvc/src/test/java/com/baeldung/clearsitedata}/LogoutClearSiteDataControllerUnitTest.java (98%) diff --git a/spring-security-modules/spring-security-clear-site-data/pom.xml b/spring-security-modules/spring-security-clear-site-data/pom.xml deleted file mode 100644 index e58debc0aa..0000000000 --- a/spring-security-modules/spring-security-clear-site-data/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - 4.0.0 - - com.baeldung - spring-security-clear-site-data - 1.0-SNAPSHOT - spring-security-clear-site-data - - - com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../../parent-boot-2 - - - - - org.springframework.security - spring-security-web - ${spring.mvc.version} - - - org.springframework.security - spring-security-config - ${spring.mvc.version} - - - org.springframework.security - spring-security-test - ${spring.mvc.version} - test - - - org.springframework - spring-webmvc - ${spring.mvc.version} - - - javax.servlet - javax.servlet-api - ${javax.version} - - - - - - 5.2.2.RELEASE - 4.0.1 - - - diff --git a/spring-security-modules/spring-security-mvc/pom.xml b/spring-security-modules/spring-security-mvc/pom.xml index 7da047707a..517aa83270 100644 --- a/spring-security-modules/spring-security-mvc/pom.xml +++ b/spring-security-modules/spring-security-mvc/pom.xml @@ -64,9 +64,36 @@ org.springframework.security spring-security-test + ${spring.mvc.version} test + + org.springframework.security + spring-security-web + ${spring.mvc.version} + + + org.springframework.security + spring-security-config + ${spring.mvc.version} + + + org.springframework + spring-webmvc + ${spring.mvc.version} + + + javax.servlet + javax.servlet-api + ${javax.version} + + + + 5.2.2.RELEASE + 4.0.1 + + diff --git a/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/LogoutClearSiteDataController.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/LogoutClearSiteDataController.java similarity index 92% rename from spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/LogoutClearSiteDataController.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/LogoutClearSiteDataController.java index d27fa18116..fcf78ac82f 100644 --- a/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/LogoutClearSiteDataController.java +++ b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/LogoutClearSiteDataController.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.clearsitedata; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; diff --git a/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/SpringSecurityConfig.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/SpringSecurityConfig.java similarity index 97% rename from spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/SpringSecurityConfig.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/SpringSecurityConfig.java index fd43fb2c9e..13011da9e4 100644 --- a/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/SpringSecurityConfig.java +++ b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/SpringSecurityConfig.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.clearsitedata; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/WebConfig.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/WebConfig.java similarity index 88% rename from spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/WebConfig.java rename to spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/WebConfig.java index 16826e28b8..a523efa554 100644 --- a/spring-security-modules/spring-security-clear-site-data/src/main/java/com/baeldung/WebConfig.java +++ b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/clearsitedata/WebConfig.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.clearsitedata; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -14,6 +14,6 @@ import java.util.concurrent.TimeUnit; @EnableWebMvc @Configuration -@ComponentScan(basePackages = {"com.baeldung"}) +@ComponentScan(basePackages = {"com.baeldung.clearsitedata"}) public class WebConfig implements WebMvcConfigurer { } \ No newline at end of file diff --git a/spring-security-modules/spring-security-clear-site-data/src/test/java/com/baeldung/LogoutClearSiteDataControllerUnitTest.java b/spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/clearsitedata/LogoutClearSiteDataControllerUnitTest.java similarity index 98% rename from spring-security-modules/spring-security-clear-site-data/src/test/java/com/baeldung/LogoutClearSiteDataControllerUnitTest.java rename to spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/clearsitedata/LogoutClearSiteDataControllerUnitTest.java index 905a866413..30036eea89 100644 --- a/spring-security-modules/spring-security-clear-site-data/src/test/java/com/baeldung/LogoutClearSiteDataControllerUnitTest.java +++ b/spring-security-modules/spring-security-mvc/src/test/java/com/baeldung/clearsitedata/LogoutClearSiteDataControllerUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung; +package com.baeldung.clearsitedata; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; From 108cca4b4ba5b34c03d7ac41e841609b87f42089 Mon Sep 17 00:00:00 2001 From: chirag d Date: Wed, 18 Mar 2020 22:46:35 +0530 Subject: [PATCH 017/130] BAEL3901 updated pom to remove module --- spring-security-modules/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-security-modules/pom.xml b/spring-security-modules/pom.xml index 07c326c10e..49a0db03ed 100644 --- a/spring-security-modules/pom.xml +++ b/spring-security-modules/pom.xml @@ -17,7 +17,6 @@ spring-security-acl spring-security-angular/server spring-security-cache-control - spring-security-clear-site-data spring-security-core spring-security-cors spring-security-kerberos From cd23dbda280c7bd07a639c6d1d96151261633713 Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Wed, 18 Mar 2020 20:53:30 +0300 Subject: [PATCH 018/130] BAEL-3832: Removed log4j dependency from the pom.xml and formatted the configuration xml file --- spring-core-3/pom.xml | 6 ------ .../src/test/resources/ioc-container-difference-example.xml | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/spring-core-3/pom.xml b/spring-core-3/pom.xml index d1163a174c..3bde25f561 100644 --- a/spring-core-3/pom.xml +++ b/spring-core-3/pom.xml @@ -68,11 +68,6 @@ test - - log4j - log4j - ${log4j.version} - @@ -89,7 +84,6 @@ 2.22.1 1.3.2 2.2.2.RELEASE - 1.2.17 \ No newline at end of file diff --git a/spring-core-3/src/test/resources/ioc-container-difference-example.xml b/spring-core-3/src/test/resources/ioc-container-difference-example.xml index 9bb01efe66..ba84aa635d 100644 --- a/spring-core-3/src/test/resources/ioc-container-difference-example.xml +++ b/spring-core-3/src/test/resources/ioc-container-difference-example.xml @@ -5,7 +5,6 @@ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - - + \ No newline at end of file From f82ce12686f40e896106fb3bc3f0367ed6de386b Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Wed, 18 Mar 2020 20:56:04 +0300 Subject: [PATCH 019/130] BAEL-3832: removed unnecessary line from pom.xml --- spring-core-3/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-core-3/pom.xml b/spring-core-3/pom.xml index 3bde25f561..205259e8e4 100644 --- a/spring-core-3/pom.xml +++ b/spring-core-3/pom.xml @@ -67,7 +67,6 @@ ${junit-jupiter.version} test - From 2261dd80d44ccea40fefc212930c5eb133a5fc49 Mon Sep 17 00:00:00 2001 From: Donato Rimenti Date: Wed, 18 Mar 2020 10:34:00 +0100 Subject: [PATCH 020/130] [JAVA-22] Moved articles not in ebook from spring-boot-rest to spring-boot-mvc-2 --- .../spring-boot-mvc-2/README.md | 4 + spring-boot-modules/spring-boot-mvc-2/pom.xml | 22 +++ .../src/main/java/com/baeldung/etag/Foo.java | 95 +++++++++ .../java/com/baeldung/etag/FooController.java | 58 ++++++ .../main/java/com/baeldung/etag/FooDao.java | 8 + .../etag/SpringBootEtagApplication.java | 13 ++ .../java/com/baeldung/etag/WebConfig.java | 28 +++ .../SpringBootStudentsApplication.java | 13 ++ .../java/com/baeldung/students/Student.java | 53 ++++++ .../baeldung/students/StudentController.java | 74 +++++++ .../com/baeldung/students/StudentService.java | 51 +++++ .../src/main/resources/WEB-INF/web.xml | 18 ++ .../foo_API_test.postman_collection.json | 180 ++++++++++++++++++ .../baeldung/etag/EtagIntegrationTest.java | 123 ++++++++++++ .../java/com/baeldung/mime/FooLiveTest.java | 82 ++++++++ .../java/com/baeldung/mime/IMarshaller.java | 15 ++ .../com/baeldung/mime/JacksonMarshaller.java | 75 ++++++++ .../baeldung/mime/TestMarshallerFactory.java | 48 +++++ .../com/baeldung/mime/XStreamMarshaller.java | 46 +++++ .../StudentControllerIntegrationTest.java | 73 +++++++ spring-boot-rest/README.md | 6 +- 21 files changed, 1080 insertions(+), 5 deletions(-) create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/Foo.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/FooController.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/FooDao.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/SpringBootEtagApplication.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/WebConfig.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/SpringBootStudentsApplication.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/Student.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/StudentController.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/StudentService.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/resources/WEB-INF/web.xml create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/resources/foo_API_test.postman_collection.json create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/etag/EtagIntegrationTest.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/FooLiveTest.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/IMarshaller.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/JacksonMarshaller.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/TestMarshallerFactory.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/XStreamMarshaller.java create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/students/StudentControllerIntegrationTest.java diff --git a/spring-boot-modules/spring-boot-mvc-2/README.md b/spring-boot-modules/spring-boot-mvc-2/README.md index dc6a136131..d7341cca35 100644 --- a/spring-boot-modules/spring-boot-mvc-2/README.md +++ b/spring-boot-modules/spring-boot-mvc-2/README.md @@ -6,4 +6,8 @@ This module contains articles about Spring Web MVC in Spring Boot projects. - [Functional Controllers in Spring MVC](https://www.baeldung.com/spring-mvc-functional-controllers) - [Specify an Array of Strings as Body Parameters in Swagger](https://www.baeldung.com/swagger-body-array-of-strings) +- [ETags for REST with Spring](https://www.baeldung.com/etags-for-rest-with-spring) +- [Testing REST with multiple MIME types](https://www.baeldung.com/testing-rest-api-with-multiple-media-types) +- [Testing Web APIs with Postman Collections](https://www.baeldung.com/postman-testing-collections) +- [Spring Boot Consuming and Producing JSON](https://www.baeldung.com/spring-boot-json) - More articles: [[prev -->]](/spring-boot-modules/spring-boot-mvc) diff --git a/spring-boot-modules/spring-boot-mvc-2/pom.xml b/spring-boot-modules/spring-boot-mvc-2/pom.xml index edebd41986..f527fd78f6 100644 --- a/spring-boot-modules/spring-boot-mvc-2/pom.xml +++ b/spring-boot-modules/spring-boot-mvc-2/pom.xml @@ -49,6 +49,27 @@ org.apache.commons commons-lang3 + + + + org.springframework.boot + spring-boot-starter-data-jpa + + + + com.fasterxml.jackson.core + jackson-databind + + + + com.h2database + h2 + + + + com.thoughtworks.xstream + xstream + ${xstream.version} @@ -103,6 +124,7 @@ com.baeldung.swagger2boot.SpringBootSwaggerApplication 2.2.0.BUILD-SNAPSHOT + 1.4.11.1 \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/Foo.java b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/Foo.java new file mode 100644 index 0000000000..e553ca1b72 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/Foo.java @@ -0,0 +1,95 @@ +package com.baeldung.etag; + +import java.io.Serializable; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Version; + +@Entity +public class Foo implements Serializable { + + @Id + @GeneratedValue(strategy = GenerationType.AUTO) + private long id; + + @Column(nullable = false) + private String name; + + @Version + private long version; + + public Foo() { + super(); + } + + public Foo(final String name) { + super(); + + this.name = name; + } + + // API + + public long getId() { + return id; + } + + public void setId(final long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public long getVersion() { + return version; + } + + public void setVersion(long version) { + this.version = version; + } + + // + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((name == null) ? 0 : name.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Foo other = (Foo) obj; + if (name == null) { + if (other.name != null) + return false; + } else if (!name.equals(other.name)) + return false; + return true; + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("Foo [name=").append(name).append("]"); + return builder.toString(); + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/FooController.java b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/FooController.java new file mode 100644 index 0000000000..58f366501d --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/FooController.java @@ -0,0 +1,58 @@ +package com.baeldung.etag; + +import javax.servlet.http.HttpServletResponse; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.server.ResponseStatusException; + +@RestController +@RequestMapping(value = "/foos") +public class FooController { + + @Autowired + private FooDao fooDao; + + @GetMapping(value = "/{id}") + public Foo findById(@PathVariable("id") final Long id, final HttpServletResponse response) { + return fooDao.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); + } + + // Note: the global filter overrides the ETag value we set here. We can still + // analyze its behaviour in the Integration Test. + @GetMapping(value = "/{id}/custom-etag") + public ResponseEntity findByIdWithCustomEtag(@PathVariable("id") final Long id, + final HttpServletResponse response) { + final Foo foo = fooDao.findById(id).orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); + return ResponseEntity.ok().eTag(Long.toString(foo.getVersion())).body(foo); + } + + @PostMapping + @ResponseStatus(HttpStatus.CREATED) + public Foo create(@RequestBody final Foo resource, final HttpServletResponse response) { + return fooDao.save(resource); + } + + @PutMapping(value = "/{id}") + @ResponseStatus(HttpStatus.OK) + public void update(@PathVariable("id") final Long id, @RequestBody final Foo resource) { + fooDao.save(resource); + } + + @DeleteMapping(value = "/{id}") + @ResponseStatus(HttpStatus.OK) + public void delete(@PathVariable("id") final Long id) { + fooDao.deleteById(id); + } + +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/FooDao.java b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/FooDao.java new file mode 100644 index 0000000000..aff011af4a --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/FooDao.java @@ -0,0 +1,8 @@ +package com.baeldung.etag; + +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface FooDao extends CrudRepository{ +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/SpringBootEtagApplication.java b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/SpringBootEtagApplication.java new file mode 100644 index 0000000000..9e58a1550c --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/SpringBootEtagApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.etag; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringBootEtagApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootEtagApplication.class, args); + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/WebConfig.java b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/WebConfig.java new file mode 100644 index 0000000000..bef468452a --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/etag/WebConfig.java @@ -0,0 +1,28 @@ +package com.baeldung.etag; + +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.filter.ShallowEtagHeaderFilter; + +@Configuration +public class WebConfig { + + // Etags + + // If we're not using Spring Boot we can make use of + // AbstractAnnotationConfigDispatcherServletInitializer#getServletFilters + @Bean + public FilterRegistrationBean shallowEtagHeaderFilter() { + FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean<>( new ShallowEtagHeaderFilter()); + filterRegistrationBean.addUrlPatterns("/foos/*"); + filterRegistrationBean.setName("etagFilter"); + return filterRegistrationBean; + } + + // We can also just declare the filter directly + // @Bean + // public ShallowEtagHeaderFilter shallowEtagHeaderFilter() { + // return new ShallowEtagHeaderFilter(); + // } +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/SpringBootStudentsApplication.java b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/SpringBootStudentsApplication.java new file mode 100644 index 0000000000..9c499e6103 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/SpringBootStudentsApplication.java @@ -0,0 +1,13 @@ +package com.baeldung.students; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SpringBootStudentsApplication { + + public static void main(String[] args) { + SpringApplication.run(SpringBootStudentsApplication.class, args); + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/Student.java b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/Student.java new file mode 100644 index 0000000000..16d02fe14a --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/Student.java @@ -0,0 +1,53 @@ +package com.baeldung.students; + +public class Student { + + private long id; + private String firstName; + private String lastName; + + public Student() {} + + public Student(String firstName, String lastName) { + super(); + this.firstName = firstName; + this.lastName = lastName; + } + + public Student(long id, String firstName, String lastName) { + super(); + this.id = id; + this.firstName = firstName; + this.lastName = lastName; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + @Override + public String toString() { + return "Student [id=" + id + ", firstName=" + firstName + ", lastName=" + lastName + "]"; + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/StudentController.java b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/StudentController.java new file mode 100644 index 0000000000..c71bb6c6e6 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/StudentController.java @@ -0,0 +1,74 @@ +package com.baeldung.students; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.servlet.support.ServletUriComponentsBuilder; + +import com.baeldung.students.StudentService; + +@RestController +@RequestMapping("/students") +public class StudentController { + + @Autowired + private StudentService service; + + @GetMapping("/") + public List read() { + return service.readAll(); + } + + @GetMapping("/{id}") + public ResponseEntity read(@PathVariable("id") Long id) { + Student foundStudent = service.read(id); + if (foundStudent == null) { + return ResponseEntity.notFound().build(); + } else { + return ResponseEntity.ok(foundStudent); + } + } + + @PostMapping("/") + public ResponseEntity create(@RequestBody Student student) throws URISyntaxException { + Student createdStudent = service.create(student); + + URI uri = ServletUriComponentsBuilder.fromCurrentRequest() + .path("/{id}") + .buildAndExpand(createdStudent.getId()) + .toUri(); + + return ResponseEntity.created(uri) + .body(createdStudent); + + } + + @PutMapping("/{id}") + public ResponseEntity update(@RequestBody Student student, @PathVariable Long id) { + Student updatedStudent = service.update(id, student); + if (updatedStudent == null) { + return ResponseEntity.notFound().build(); + } else { + return ResponseEntity.ok(updatedStudent); + } + } + + @DeleteMapping("/{id}") + public ResponseEntity deleteStudent(@PathVariable Long id) { + service.delete(id); + + return ResponseEntity.noContent().build(); + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/StudentService.java b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/StudentService.java new file mode 100644 index 0000000000..80f6dfd514 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/java/com/baeldung/students/StudentService.java @@ -0,0 +1,51 @@ +package com.baeldung.students; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Function; +import java.util.stream.Collectors; + +import org.springframework.stereotype.Service; + +@Service +public class StudentService { + + // DB repository mock + private Map repository = Arrays.asList( + new Student[]{ + new Student(1, "Alan","Turing"), + new Student(2, "Sebastian","Bach"), + new Student(3, "Pablo","Picasso"), + }).stream() + .collect(Collectors.toConcurrentMap(s -> s.getId(), Function.identity())); + + // DB id sequence mock + private AtomicLong sequence = new AtomicLong(3); + + public List readAll() { + return repository.values().stream().collect(Collectors.toList()); + } + + public Student read(Long id) { + return repository.get(id); + } + + public Student create(Student student) { + long key = sequence.incrementAndGet(); + student.setId(key); + repository.put(key, student); + return student; + } + + public Student update(Long id, Student student) { + student.setId(id); + Student oldStudent = repository.replace(id, student); + return oldStudent == null ? null : student; + } + + public void delete(Long id) { + repository.remove(id); + } +} diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/resources/WEB-INF/web.xml b/spring-boot-modules/spring-boot-mvc-2/src/main/resources/WEB-INF/web.xml new file mode 100644 index 0000000000..7f36b33b38 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/resources/WEB-INF/web.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/resources/foo_API_test.postman_collection.json b/spring-boot-modules/spring-boot-mvc-2/src/main/resources/foo_API_test.postman_collection.json new file mode 100644 index 0000000000..dc4acafab3 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/resources/foo_API_test.postman_collection.json @@ -0,0 +1,180 @@ +{ + "info": { + "_postman_id": "9989b5be-13ba-4d22-8e43-d05dbf628e58", + "name": "foo API test", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "add a foo", + "event": [ + { + "listen": "test", + "script": { + "id": "a01534dc-6fc7-4c54-ba1d-6bcf311e5836", + "exec": [ + "pm.test(\"success status\", () => pm.response.to.be.success );", + "", + "pm.test(\"name is correct\", () => ", + " pm.expect(pm.response.json().name).to.equal(\"Transformers\"));", + "", + "pm.test(\"id was assigned\", () => ", + " pm.expect(pm.response.json().id).to.be.not.null );", + "", + "pm.variables.set(\"id\", pm.response.json().id);" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "name": "Content-Type", + "value": "application/json", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"Transformers\"\n}" + }, + "url": { + "raw": "http://localhost:8080/spring-boot-rest/foos", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8080", + "path": [ + "spring-boot-rest", + "foos" + ] + } + }, + "response": [] + }, + { + "name": "get a foo", + "event": [ + { + "listen": "test", + "script": { + "id": "03de440c-b483-4ab8-a11a-d0c99b349963", + "exec": [ + "pm.test(\"success status\", () => pm.response.to.be.success );", + "", + "pm.test(\"name is correct\", () => ", + " pm.expect(pm.response.json().name).to.equal(\"Transformers\"));", + "", + "pm.test(\"id is correct\", () => ", + " pm.expect(pm.response.json().id).to.equal(pm.variables.get(\"id\")) );" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://localhost:8080/spring-boot-rest/foos/{{id}}", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8080", + "path": [ + "spring-boot-rest", + "foos", + "{{id}}" + ] + } + }, + "response": [] + }, + { + "name": "delete a foo", + "event": [ + { + "listen": "test", + "script": { + "id": "74c1bb0f-c06c-48b1-a545-459233541b14", + "exec": [ + "pm.test(\"success status\", () => pm.response.to.be.success );" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "DELETE", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://localhost:8080/spring-boot-rest/foos/{{id}}", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8080", + "path": [ + "spring-boot-rest", + "foos", + "{{id}}" + ] + } + }, + "response": [] + }, + { + "name": "verify delete", + "event": [ + { + "listen": "test", + "script": { + "id": "03de440c-b483-4ab8-a11a-d0c99b349963", + "exec": [ + "pm.test(\"status is 500\", () => pm.response.to.have.status(500) );", + "", + "pm.test(\"no value present\", () => ", + " pm.expect(pm.response.json().cause).to.equal(\"No value present\"));" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://localhost:8080/spring-boot-rest/foos/{{id}}", + "protocol": "http", + "host": [ + "localhost" + ], + "port": "8080", + "path": [ + "spring-boot-rest", + "foos", + "{{id}}" + ] + } + }, + "response": [] + } + ] +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/etag/EtagIntegrationTest.java b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/etag/EtagIntegrationTest.java new file mode 100644 index 0000000000..88c5ae1686 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/etag/EtagIntegrationTest.java @@ -0,0 +1,123 @@ +package com.baeldung.etag; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import org.assertj.core.util.Preconditions; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import io.restassured.RestAssured; +import io.restassured.http.ContentType; +import io.restassured.response.Response; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) +@ComponentScan(basePackageClasses = WebConfig.class) +@EnableAutoConfiguration +public class EtagIntegrationTest { + + @LocalServerPort + private int port; + + @Test + public void givenResourceExists_whenRetrievingResource_thenEtagIsAlsoReturned() { + // Given + final String uriOfResource = createAsUri(); + + // When + final Response findOneResponse = RestAssured.given().header("Accept", "application/json").get(uriOfResource); + + // Then + assertNotNull(findOneResponse.getHeader(HttpHeaders.ETAG)); + } + + @Test + public void givenResourceWasRetrieved_whenRetrievingAgainWithEtag_thenNotModifiedReturned() { + // Given + final String uriOfResource = createAsUri(); + final Response findOneResponse = RestAssured.given().header("Accept", "application/json").get(uriOfResource); + final String etagValue = findOneResponse.getHeader(HttpHeaders.ETAG); + + // When + final Response secondFindOneResponse = RestAssured.given().header("Accept", "application/json") + .headers("If-None-Match", etagValue).get(uriOfResource); + + // Then + assertTrue(secondFindOneResponse.getStatusCode() == 304); + } + + @Test + public void givenResourceWasRetrievedThenModified_whenRetrievingAgainWithEtag_thenResourceIsReturned() { + // Given + final String uriOfResource = createAsUri(); + final Response firstFindOneResponse = RestAssured.given().header("Accept", "application/json") + .get(uriOfResource); + final String etagValue = firstFindOneResponse.getHeader(HttpHeaders.ETAG); + final long createdId = firstFindOneResponse.jsonPath().getLong("id"); + + Foo updatedFoo = new Foo("updated value"); + updatedFoo.setId(createdId); + Response updatedResponse = RestAssured.given().contentType(ContentType.JSON).body(updatedFoo) + .put(uriOfResource); + assertThat(updatedResponse.getStatusCode() == 200); + + // When + final Response secondFindOneResponse = RestAssured.given().header("Accept", "application/json") + .headers("If-None-Match", etagValue).get(uriOfResource); + + // Then + assertTrue(secondFindOneResponse.getStatusCode() == 200); + } + + @Test + @Ignore("Not Yet Implemented By Spring - https://jira.springsource.org/browse/SPR-10164") + public void givenResourceExists_whenRetrievedWithIfMatchIncorrectEtag_then412IsReceived() { + // Given + final String uriOfResource = createAsUri(); + + // When + final Response findOneResponse = RestAssured.given().header("Accept", "application/json") + .headers("If-Match", randomAlphabetic(8)).get(uriOfResource); + + // Then + assertTrue(findOneResponse.getStatusCode() == 412); + } + + private final String createAsUri() { + final Response response = createAsResponse(new Foo(randomAlphabetic(6))); + Preconditions.checkState(response.getStatusCode() == 201, "create operation: " + response.getStatusCode()); + + return getURL() + "/" + response.getBody().as(Foo.class).getId(); + } + + private Response createAsResponse(final Foo resource) { + String resourceAsString; + try { + resourceAsString = new ObjectMapper().writeValueAsString(resource); + } catch (JsonProcessingException e) { + throw new AssertionError("Error during serialization"); + } + return RestAssured.given().contentType(MediaType.APPLICATION_JSON.toString()).body(resourceAsString) + .post(getURL()); + } + + private String getURL() { + return "http://localhost:" + port + "/foos"; + } + +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/FooLiveTest.java b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/FooLiveTest.java new file mode 100644 index 0000000000..e65b106ead --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/FooLiveTest.java @@ -0,0 +1,82 @@ +package com.baeldung.mime; + +import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.etag.Foo; +import com.baeldung.etag.WebConfig; + +import io.restassured.RestAssured; +import io.restassured.response.Response; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes= WebConfig.class, webEnvironment = WebEnvironment.RANDOM_PORT) +@ComponentScan({"com.baeldung.mime", "com.baeldung.etag"}) +@EnableAutoConfiguration +@ActiveProfiles("test") +public class FooLiveTest { + + @LocalServerPort + private int port; + + @Autowired + protected IMarshaller marshaller; + + // API + + public final void create() { + create(new Foo(randomAlphabetic(6))); + } + + public final String createAsUri() { + return createAsUri(new Foo(randomAlphabetic(6))); + } + + protected final void create(final Foo resource) { + createAsUri(resource); + } + + private final String createAsUri(final Foo resource) { + final Response response = createAsResponse(resource); + return getURL() + "/" + response.getBody().as(Foo.class).getId(); + } + + private final Response createAsResponse(final Foo resource) { + + final String resourceAsString = marshaller.encode(resource); + return RestAssured.given() + .contentType(marshaller.getMime()) + .body(resourceAsString) + .post(getURL()); + } + + // + + protected String getURL() { + return "http://localhost:" + port + "/foos"; + } + + @Test + public void givenResourceExists_whenRetrievingResource_thenEtagIsAlsoReturned() { + // Given + final String uriOfResource = createAsUri(); + + // When + final Response findOneResponse = RestAssured.given().header("Accept", "application/json").get(uriOfResource); + + // Then + assertEquals(findOneResponse.getStatusCode(), 200); + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/IMarshaller.java b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/IMarshaller.java new file mode 100644 index 0000000000..79c0616043 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/IMarshaller.java @@ -0,0 +1,15 @@ +package com.baeldung.mime; + +import java.util.List; + +public interface IMarshaller { + + String encode(final T entity); + + T decode(final String entityAsString, final Class clazz); + + List decodeList(final String entitiesAsString, final Class clazz); + + String getMime(); + +} diff --git a/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/JacksonMarshaller.java b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/JacksonMarshaller.java new file mode 100644 index 0000000000..9dee0ef2cd --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/JacksonMarshaller.java @@ -0,0 +1,75 @@ +package com.baeldung.mime; + +import java.io.IOException; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.MediaType; + +import com.baeldung.etag.Foo; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; + +public final class JacksonMarshaller implements IMarshaller { + private final Logger logger = LoggerFactory.getLogger(JacksonMarshaller.class); + + private final ObjectMapper objectMapper; + + public JacksonMarshaller() { + super(); + + objectMapper = new ObjectMapper(); + } + + // API + + @Override + public final String encode(final T resource) { + String entityAsJSON = null; + try { + entityAsJSON = objectMapper.writeValueAsString(resource); + } catch (final IOException ioEx) { + logger.error("", ioEx); + } + + return entityAsJSON; + } + + @Override + public final T decode(final String resourceAsString, final Class clazz) { + T entity = null; + try { + entity = objectMapper.readValue(resourceAsString, clazz); + } catch (final IOException ioEx) { + logger.error("", ioEx); + } + + return entity; + } + + @SuppressWarnings("unchecked") + @Override + public final List decodeList(final String resourcesAsString, final Class clazz) { + List entities = null; + try { + if (clazz.equals(Foo.class)) { + entities = objectMapper.readValue(resourcesAsString, new TypeReference>() { + // ... + }); + } else { + entities = objectMapper.readValue(resourcesAsString, List.class); + } + } catch (final IOException ioEx) { + logger.error("", ioEx); + } + + return entities; + } + + @Override + public final String getMime() { + return MediaType.APPLICATION_JSON.toString(); + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/TestMarshallerFactory.java b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/TestMarshallerFactory.java new file mode 100644 index 0000000000..d7cd875ae4 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/TestMarshallerFactory.java @@ -0,0 +1,48 @@ +package com.baeldung.mime; + +import org.springframework.beans.factory.FactoryBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Profile; +import org.springframework.core.env.Environment; +import org.springframework.stereotype.Component; + +@Component +@Profile("test") +public class TestMarshallerFactory implements FactoryBean { + + @Autowired + private Environment env; + + public TestMarshallerFactory() { + super(); + } + + // API + + @Override + public IMarshaller getObject() { + final String testMime = env.getProperty("test.mime"); + if (testMime != null) { + switch (testMime) { + case "json": + return new JacksonMarshaller(); + case "xml": + return new XStreamMarshaller(); + default: + throw new IllegalStateException(); + } + } + + return new JacksonMarshaller(); + } + + @Override + public Class getObjectType() { + return IMarshaller.class; + } + + @Override + public boolean isSingleton() { + return true; + } +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/XStreamMarshaller.java b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/XStreamMarshaller.java new file mode 100644 index 0000000000..2c67694e83 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/mime/XStreamMarshaller.java @@ -0,0 +1,46 @@ +package com.baeldung.mime; + +import java.util.List; + +import org.springframework.http.MediaType; + +import com.baeldung.etag.Foo; +import com.thoughtworks.xstream.XStream; + +public final class XStreamMarshaller implements IMarshaller { + + private XStream xstream; + + public XStreamMarshaller() { + super(); + + xstream = new XStream(); + xstream.autodetectAnnotations(true); + xstream.processAnnotations(Foo.class); + } + + // API + + @Override + public final String encode(final T resource) { + return xstream.toXML(resource); + } + + @SuppressWarnings("unchecked") + @Override + public final T decode(final String resourceAsString, final Class clazz) { + return (T) xstream.fromXML(resourceAsString); + } + + @SuppressWarnings("unchecked") + @Override + public List decodeList(final String resourcesAsString, final Class clazz) { + return this.decode(resourcesAsString, List.class); + } + + @Override + public final String getMime() { + return MediaType.APPLICATION_XML.toString(); + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/students/StudentControllerIntegrationTest.java b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/students/StudentControllerIntegrationTest.java new file mode 100644 index 0000000000..577dbb6eb1 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/test/java/com/baeldung/students/StudentControllerIntegrationTest.java @@ -0,0 +1,73 @@ +package com.baeldung.students; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@RunWith(SpringRunner.class) +@SpringBootTest +@AutoConfigureMockMvc +public class StudentControllerIntegrationTest { + + private static final String STUDENTS_PATH = "/students/"; + + @Autowired + private MockMvc mockMvc; + + @Test + public void whenReadAll_thenStatusIsOk() throws Exception { + this.mockMvc.perform(get(STUDENTS_PATH)) + .andExpect(status().isOk()); + } + + @Test + public void whenReadOne_thenStatusIsOk() throws Exception { + this.mockMvc.perform(get(STUDENTS_PATH + 1)) + .andExpect(status().isOk()); + } + + @Test + public void whenCreate_thenStatusIsCreated() throws Exception { + Student student = new Student(10, "Albert", "Einstein"); + this.mockMvc.perform(post(STUDENTS_PATH).content(asJsonString(student)) + .contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(status().isCreated()); + } + + @Test + public void whenUpdate_thenStatusIsOk() throws Exception { + Student student = new Student(1, "Nikola", "Tesla"); + this.mockMvc.perform(put(STUDENTS_PATH + 1) + .content(asJsonString(student)) + .contentType(MediaType.APPLICATION_JSON_VALUE)) + .andExpect(status().isOk()); + } + + @Test + public void whenDelete_thenStatusIsNoContent() throws Exception { + this.mockMvc.perform(delete(STUDENTS_PATH + 3)) + .andExpect(status().isNoContent()); + } + + private String asJsonString(final Object obj) { + try { + return new ObjectMapper().writeValueAsString(obj); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + +} diff --git a/spring-boot-rest/README.md b/spring-boot-rest/README.md index f78c88d30b..861181c53e 100644 --- a/spring-boot-rest/README.md +++ b/spring-boot-rest/README.md @@ -4,12 +4,7 @@ This module contains articles about Spring Boot RESTful APIs. ### Relevant Articles -- [HATEOAS for a Spring REST Service](https://www.baeldung.com/rest-api-discoverability-with-spring) - [Versioning a REST API](https://www.baeldung.com/rest-versioning) -- [ETags for REST with Spring](https://www.baeldung.com/etags-for-rest-with-spring) -- [Testing REST with multiple MIME types](https://www.baeldung.com/testing-rest-api-with-multiple-media-types) -- [Testing Web APIs with Postman Collections](https://www.baeldung.com/postman-testing-collections) -- [Spring Boot Consuming and Producing JSON](https://www.baeldung.com/spring-boot-json) ### E-book @@ -25,6 +20,7 @@ These articles are part of the Spring REST E-book: 8. [An Intro to Spring HATEOAS](https://www.baeldung.com/spring-hateoas-tutorial) 9. [REST Pagination in Spring](https://www.baeldung.com/rest-api-pagination-in-spring) 10. [Test a REST API with Java](https://www.baeldung.com/integration-testing-a-rest-api) +11. [HATEOAS for a Spring REST Service](https://www.baeldung.com/rest-api-discoverability-with-spring) NOTE: Since this is a module tied to an e-book, it should not be moved or used to store the code for any further article. From 46d2ac9837c75732b5b5d7c1755a403659ea167b Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 20 Mar 2020 08:06:25 +0100 Subject: [PATCH 021/130] [JAVA-958] Standardize packages in spring-batch module --- spring-batch/repository.sqlite | Bin 49152 -> 73728 bytes .../java/{org => com}/baeldung/batch/App.java | 2 +- .../baeldung/batch/SpringBatchConfig.java | 16 ++++++++-------- .../batch/SpringBatchRetryConfig.java | 8 ++++---- .../baeldung/batch/SpringConfig.java | 2 +- .../baeldung/batch/model/Transaction.java | 4 ++-- .../CustomMultiResourcePartitioner.java | 2 +- .../SpringbatchPartitionConfig.java | 6 +++--- .../SpringbatchPartitionerApp.java | 2 +- .../batch/service/CustomItemProcessor.java | 4 ++-- .../batch/service/CustomSkipPolicy.java | 2 +- .../service/MissingUsernameException.java | 2 +- .../service/NegativeAmountException.java | 2 +- .../batch/service/RecordFieldSetMapper.java | 4 ++-- .../batch/service/RetryItemProcessor.java | 4 ++-- .../batch/service/SkippingItemProcessor.java | 4 ++-- .../service/adapter/LocalDateTimeAdapter.java | 2 +- .../batchscheduler/SpringBatchScheduler.java | 4 ++-- .../baeldung/batchscheduler/model/Book.java | 2 +- .../batchtesting/SpringBatchApplication.java | 2 +- .../SpringBatchConfiguration.java | 14 +++++++------- .../baeldung/batchtesting/model/Book.java | 2 +- .../batchtesting/model/BookDetails.java | 2 +- .../batchtesting/model/BookRecord.java | 2 +- .../service/BookDetailsItemProcessor.java | 6 +++--- .../service/BookItemProcessor.java | 6 +++--- .../service/BookRecordFieldSetMapper.java | 4 ++-- .../chunks/LineProcessor.java | 4 ++-- .../taskletsvschunks/chunks/LineReader.java | 6 +++--- .../taskletsvschunks/chunks/LinesWriter.java | 6 +++--- .../taskletsvschunks/config/ChunksConfig.java | 10 +++++----- .../config/TaskletsConfig.java | 8 ++++---- .../baeldung/taskletsvschunks/model/Line.java | 2 +- .../tasklets/LinesProcessor.java | 4 ++-- .../tasklets/LinesReader.java | 6 +++--- .../tasklets/LinesWriter.java | 6 +++--- .../taskletsvschunks/utils/FileUtils.java | 4 ++-- spring-batch/src/main/resources/logback.xml | 6 +++--- .../src/main/resources/spring-batch-intro.xml | 6 +++--- .../baeldung/SpringContextTest.java | 4 ++-- .../SpringBatchRetryIntegrationTest.java | 3 ++- .../SpringBatchSchedulerIntegrationTest.java | 3 ++- .../SpringBatchIntegrationTest.java | 3 ++- .../SpringBatchStepScopeIntegrationTest.java | 7 ++++--- .../chunks/ChunksIntegrationTest.java | 4 ++-- .../tasklets/TaskletsIntegrationTest.java | 4 ++-- spring-batch/xml/retryOutput.xml | 2 +- 47 files changed, 106 insertions(+), 102 deletions(-) rename spring-batch/src/main/java/{org => com}/baeldung/batch/App.java (98%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/SpringBatchConfig.java (92%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/SpringBatchRetryConfig.java (95%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/SpringConfig.java (99%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/model/Transaction.java (94%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/partitioner/CustomMultiResourcePartitioner.java (98%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/partitioner/SpringbatchPartitionConfig.java (98%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/partitioner/SpringbatchPartitionerApp.java (96%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/service/CustomItemProcessor.java (77%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/service/CustomSkipPolicy.java (96%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/service/MissingUsernameException.java (65%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/service/NegativeAmountException.java (87%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/service/RecordFieldSetMapper.java (93%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/service/RetryItemProcessor.java (95%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/service/SkippingItemProcessor.java (88%) rename spring-batch/src/main/java/{org => com}/baeldung/batch/service/adapter/LocalDateTimeAdapter.java (93%) rename spring-batch/src/main/java/{org => com}/baeldung/batchscheduler/SpringBatchScheduler.java (98%) rename spring-batch/src/main/java/{org => com}/baeldung/batchscheduler/model/Book.java (92%) rename spring-batch/src/main/java/{org => com}/baeldung/batchtesting/SpringBatchApplication.java (97%) rename spring-batch/src/main/java/{org => com}/baeldung/batchtesting/SpringBatchConfiguration.java (92%) rename spring-batch/src/main/java/{org => com}/baeldung/batchtesting/model/Book.java (92%) rename spring-batch/src/main/java/{org => com}/baeldung/batchtesting/model/BookDetails.java (96%) rename spring-batch/src/main/java/{org => com}/baeldung/batchtesting/model/BookRecord.java (96%) rename spring-batch/src/main/java/{org => com}/baeldung/batchtesting/service/BookDetailsItemProcessor.java (83%) rename spring-batch/src/main/java/{org => com}/baeldung/batchtesting/service/BookItemProcessor.java (79%) rename spring-batch/src/main/java/{org => com}/baeldung/batchtesting/service/BookRecordFieldSetMapper.java (89%) rename spring-batch/src/main/java/{org => com}/baeldung/taskletsvschunks/chunks/LineProcessor.java (92%) rename spring-batch/src/main/java/{org => com}/baeldung/taskletsvschunks/chunks/LineReader.java (87%) rename spring-batch/src/main/java/{org => com}/baeldung/taskletsvschunks/chunks/LinesWriter.java (87%) rename spring-batch/src/main/java/{org => com}/baeldung/taskletsvschunks/config/ChunksConfig.java (91%) rename spring-batch/src/main/java/{org => com}/baeldung/taskletsvschunks/config/TaskletsConfig.java (92%) rename spring-batch/src/main/java/{org => com}/baeldung/taskletsvschunks/model/Line.java (96%) rename spring-batch/src/main/java/{org => com}/baeldung/taskletsvschunks/tasklets/LinesProcessor.java (94%) rename spring-batch/src/main/java/{org => com}/baeldung/taskletsvschunks/tasklets/LinesReader.java (91%) rename spring-batch/src/main/java/{org => com}/baeldung/taskletsvschunks/tasklets/LinesWriter.java (91%) rename spring-batch/src/main/java/{org => com}/baeldung/taskletsvschunks/utils/FileUtils.java (96%) rename spring-batch/src/test/java/{org => com}/baeldung/SpringContextTest.java (73%) rename spring-batch/src/test/java/{org => com}/baeldung/batch/SpringBatchRetryIntegrationTest.java (98%) rename spring-batch/src/test/java/{org => com}/baeldung/batchscheduler/SpringBatchSchedulerIntegrationTest.java (96%) rename spring-batch/src/test/java/{org => com}/baeldung/batchtesting/SpringBatchIntegrationTest.java (98%) rename spring-batch/src/test/java/{org => com}/baeldung/batchtesting/SpringBatchStepScopeIntegrationTest.java (95%) rename spring-batch/src/test/java/{org => com}/baeldung/taskletsvschunks/chunks/ChunksIntegrationTest.java (89%) rename spring-batch/src/test/java/{org => com}/baeldung/taskletsvschunks/tasklets/TaskletsIntegrationTest.java (89%) diff --git a/spring-batch/repository.sqlite b/spring-batch/repository.sqlite index 4456ef63cc28948e07a545a72ec1b63366e9057b..2b549352ec8073708bd085fd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We3W(`_5W;E z;-+e9M_!q^r#JDjVv|0y)YEHBGO0Co?gM4g$tUl8M#?CY!U7wY=?2_ zxHcWvruQ~<^d}iFj!eonR=k1we}jmW!Ufj<|J+*t{|7Go2iNEkzajx7fCP}h6HMTp zU? zZ3}iiunY<&05`uyNgMef|FvJk-UkAps+GLQ`M>>tD?7g6 delta 609 zcmZoTz|zpbJV9DepMima2Z&)ndZLaoqyEMOJ!VFZ$%d@ro0l=)U}EG1GKD8^VBz1q zkS&>$jgkKh1OJ)Lf)ft$+Zi#kGH|H-rezitmpCPsBxiW#C#9GerdTAWSX!hR7$g}P zn50@-7#LVuTBIhYS(q4^r*Z*pW8^=_z<&;C#u0uuLl$*kPLfRE1)9LdpUc4ij{iFU zZvMsmZTz{L1p^}aS;g6yO*toDU>9MPW@WYovnDsNu&|1;FdK7De#k7$D#grf4PuEK zi!w1AaymJNID5o<`8&mX`UQtL`Z>D_Ffywn2?x6df~;fYKhD5^9O&S^{PyOIJPeGS ztgNi^^1Q4JOpK}fZ}0dCB6muF$BNGEyJKqTgz7s&neNf2*bsSI!{b1n#0dZphyAT^A3xgm-buGe5 Ts1!HCD4;X=|G { diff --git a/spring-batch/src/main/java/org/baeldung/batch/service/CustomSkipPolicy.java b/spring-batch/src/main/java/com/baeldung/batch/service/CustomSkipPolicy.java similarity index 96% rename from spring-batch/src/main/java/org/baeldung/batch/service/CustomSkipPolicy.java rename to spring-batch/src/main/java/com/baeldung/batch/service/CustomSkipPolicy.java index a156a65b6e..25401de022 100644 --- a/spring-batch/src/main/java/org/baeldung/batch/service/CustomSkipPolicy.java +++ b/spring-batch/src/main/java/com/baeldung/batch/service/CustomSkipPolicy.java @@ -1,4 +1,4 @@ -package org.baeldung.batch.service; +package com.baeldung.batch.service; import org.springframework.batch.core.step.skip.SkipLimitExceededException; import org.springframework.batch.core.step.skip.SkipPolicy; diff --git a/spring-batch/src/main/java/org/baeldung/batch/service/MissingUsernameException.java b/spring-batch/src/main/java/com/baeldung/batch/service/MissingUsernameException.java similarity index 65% rename from spring-batch/src/main/java/org/baeldung/batch/service/MissingUsernameException.java rename to spring-batch/src/main/java/com/baeldung/batch/service/MissingUsernameException.java index 2cf8f4d334..b12daa17cc 100644 --- a/spring-batch/src/main/java/org/baeldung/batch/service/MissingUsernameException.java +++ b/spring-batch/src/main/java/com/baeldung/batch/service/MissingUsernameException.java @@ -1,4 +1,4 @@ -package org.baeldung.batch.service; +package com.baeldung.batch.service; public class MissingUsernameException extends RuntimeException { } diff --git a/spring-batch/src/main/java/org/baeldung/batch/service/NegativeAmountException.java b/spring-batch/src/main/java/com/baeldung/batch/service/NegativeAmountException.java similarity index 87% rename from spring-batch/src/main/java/org/baeldung/batch/service/NegativeAmountException.java rename to spring-batch/src/main/java/com/baeldung/batch/service/NegativeAmountException.java index c9c05be671..ee46574f87 100644 --- a/spring-batch/src/main/java/org/baeldung/batch/service/NegativeAmountException.java +++ b/spring-batch/src/main/java/com/baeldung/batch/service/NegativeAmountException.java @@ -1,4 +1,4 @@ -package org.baeldung.batch.service; +package com.baeldung.batch.service; public class NegativeAmountException extends RuntimeException { diff --git a/spring-batch/src/main/java/org/baeldung/batch/service/RecordFieldSetMapper.java b/spring-batch/src/main/java/com/baeldung/batch/service/RecordFieldSetMapper.java similarity index 93% rename from spring-batch/src/main/java/org/baeldung/batch/service/RecordFieldSetMapper.java rename to spring-batch/src/main/java/com/baeldung/batch/service/RecordFieldSetMapper.java index e61c54193a..09478e9a30 100644 --- a/spring-batch/src/main/java/org/baeldung/batch/service/RecordFieldSetMapper.java +++ b/spring-batch/src/main/java/com/baeldung/batch/service/RecordFieldSetMapper.java @@ -1,6 +1,6 @@ -package org.baeldung.batch.service; +package com.baeldung.batch.service; -import org.baeldung.batch.model.Transaction; +import com.baeldung.batch.model.Transaction; import org.springframework.batch.item.file.mapping.FieldSetMapper; import org.springframework.batch.item.file.transform.FieldSet; import org.springframework.validation.BindException; diff --git a/spring-batch/src/main/java/org/baeldung/batch/service/RetryItemProcessor.java b/spring-batch/src/main/java/com/baeldung/batch/service/RetryItemProcessor.java similarity index 95% rename from spring-batch/src/main/java/org/baeldung/batch/service/RetryItemProcessor.java rename to spring-batch/src/main/java/com/baeldung/batch/service/RetryItemProcessor.java index d4e82452a7..c380e2c0ab 100644 --- a/spring-batch/src/main/java/org/baeldung/batch/service/RetryItemProcessor.java +++ b/spring-batch/src/main/java/com/baeldung/batch/service/RetryItemProcessor.java @@ -1,10 +1,10 @@ -package org.baeldung.batch.service; +package com.baeldung.batch.service; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.util.EntityUtils; -import org.baeldung.batch.model.Transaction; +import com.baeldung.batch.model.Transaction; import org.codehaus.jettison.json.JSONException; import org.codehaus.jettison.json.JSONObject; import org.slf4j.Logger; diff --git a/spring-batch/src/main/java/org/baeldung/batch/service/SkippingItemProcessor.java b/spring-batch/src/main/java/com/baeldung/batch/service/SkippingItemProcessor.java similarity index 88% rename from spring-batch/src/main/java/org/baeldung/batch/service/SkippingItemProcessor.java rename to spring-batch/src/main/java/com/baeldung/batch/service/SkippingItemProcessor.java index 307a8213e2..ee37eb6c1b 100644 --- a/spring-batch/src/main/java/org/baeldung/batch/service/SkippingItemProcessor.java +++ b/spring-batch/src/main/java/com/baeldung/batch/service/SkippingItemProcessor.java @@ -1,6 +1,6 @@ -package org.baeldung.batch.service; +package com.baeldung.batch.service; -import org.baeldung.batch.model.Transaction; +import com.baeldung.batch.model.Transaction; import org.springframework.batch.item.ItemProcessor; public class SkippingItemProcessor implements ItemProcessor { diff --git a/spring-batch/src/main/java/org/baeldung/batch/service/adapter/LocalDateTimeAdapter.java b/spring-batch/src/main/java/com/baeldung/batch/service/adapter/LocalDateTimeAdapter.java similarity index 93% rename from spring-batch/src/main/java/org/baeldung/batch/service/adapter/LocalDateTimeAdapter.java rename to spring-batch/src/main/java/com/baeldung/batch/service/adapter/LocalDateTimeAdapter.java index 45c35b87f1..561a7335b3 100644 --- a/spring-batch/src/main/java/org/baeldung/batch/service/adapter/LocalDateTimeAdapter.java +++ b/spring-batch/src/main/java/com/baeldung/batch/service/adapter/LocalDateTimeAdapter.java @@ -1,4 +1,4 @@ -package org.baeldung.batch.service.adapter; +package com.baeldung.batch.service.adapter; import javax.xml.bind.annotation.adapters.XmlAdapter; import java.time.LocalDateTime; diff --git a/spring-batch/src/main/java/org/baeldung/batchscheduler/SpringBatchScheduler.java b/spring-batch/src/main/java/com/baeldung/batchscheduler/SpringBatchScheduler.java similarity index 98% rename from spring-batch/src/main/java/org/baeldung/batchscheduler/SpringBatchScheduler.java rename to spring-batch/src/main/java/com/baeldung/batchscheduler/SpringBatchScheduler.java index 1beeb6b2bf..4de3e0a4b6 100644 --- a/spring-batch/src/main/java/org/baeldung/batchscheduler/SpringBatchScheduler.java +++ b/spring-batch/src/main/java/com/baeldung/batchscheduler/SpringBatchScheduler.java @@ -1,4 +1,4 @@ -package org.baeldung.batchscheduler; +package com.baeldung.batchscheduler; import java.util.Date; import java.util.IdentityHashMap; @@ -7,7 +7,7 @@ import java.util.Map; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import org.baeldung.batchscheduler.model.Book; +import com.baeldung.batchscheduler.model.Book; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.Job; diff --git a/spring-batch/src/main/java/org/baeldung/batchscheduler/model/Book.java b/spring-batch/src/main/java/com/baeldung/batchscheduler/model/Book.java similarity index 92% rename from spring-batch/src/main/java/org/baeldung/batchscheduler/model/Book.java rename to spring-batch/src/main/java/com/baeldung/batchscheduler/model/Book.java index f992bde20e..8ee986c729 100644 --- a/spring-batch/src/main/java/org/baeldung/batchscheduler/model/Book.java +++ b/spring-batch/src/main/java/com/baeldung/batchscheduler/model/Book.java @@ -1,4 +1,4 @@ -package org.baeldung.batchscheduler.model; +package com.baeldung.batchscheduler.model; public class Book { private int id; diff --git a/spring-batch/src/main/java/org/baeldung/batchtesting/SpringBatchApplication.java b/spring-batch/src/main/java/com/baeldung/batchtesting/SpringBatchApplication.java similarity index 97% rename from spring-batch/src/main/java/org/baeldung/batchtesting/SpringBatchApplication.java rename to spring-batch/src/main/java/com/baeldung/batchtesting/SpringBatchApplication.java index 39bfdfbee7..04185fb1ca 100644 --- a/spring-batch/src/main/java/org/baeldung/batchtesting/SpringBatchApplication.java +++ b/spring-batch/src/main/java/com/baeldung/batchtesting/SpringBatchApplication.java @@ -1,4 +1,4 @@ -package org.baeldung.batchtesting; +package com.baeldung.batchtesting; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobParametersBuilder; diff --git a/spring-batch/src/main/java/org/baeldung/batchtesting/SpringBatchConfiguration.java b/spring-batch/src/main/java/com/baeldung/batchtesting/SpringBatchConfiguration.java similarity index 92% rename from spring-batch/src/main/java/org/baeldung/batchtesting/SpringBatchConfiguration.java rename to spring-batch/src/main/java/com/baeldung/batchtesting/SpringBatchConfiguration.java index 2d891ad7da..664db3fbba 100644 --- a/spring-batch/src/main/java/org/baeldung/batchtesting/SpringBatchConfiguration.java +++ b/spring-batch/src/main/java/com/baeldung/batchtesting/SpringBatchConfiguration.java @@ -1,13 +1,13 @@ -package org.baeldung.batchtesting; +package com.baeldung.batchtesting; import java.io.IOException; -import org.baeldung.batchtesting.model.Book; -import org.baeldung.batchtesting.model.BookDetails; -import org.baeldung.batchtesting.model.BookRecord; -import org.baeldung.batchtesting.service.BookDetailsItemProcessor; -import org.baeldung.batchtesting.service.BookItemProcessor; -import org.baeldung.batchtesting.service.BookRecordFieldSetMapper; +import com.baeldung.batchtesting.model.Book; +import com.baeldung.batchtesting.model.BookDetails; +import com.baeldung.batchtesting.model.BookRecord; +import com.baeldung.batchtesting.service.BookDetailsItemProcessor; +import com.baeldung.batchtesting.service.BookItemProcessor; +import com.baeldung.batchtesting.service.BookRecordFieldSetMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.Job; diff --git a/spring-batch/src/main/java/org/baeldung/batchtesting/model/Book.java b/spring-batch/src/main/java/com/baeldung/batchtesting/model/Book.java similarity index 92% rename from spring-batch/src/main/java/org/baeldung/batchtesting/model/Book.java rename to spring-batch/src/main/java/com/baeldung/batchtesting/model/Book.java index 3ea4a29e7f..f34e6cb5f6 100644 --- a/spring-batch/src/main/java/org/baeldung/batchtesting/model/Book.java +++ b/spring-batch/src/main/java/com/baeldung/batchtesting/model/Book.java @@ -1,4 +1,4 @@ -package org.baeldung.batchtesting.model; +package com.baeldung.batchtesting.model; public class Book { diff --git a/spring-batch/src/main/java/org/baeldung/batchtesting/model/BookDetails.java b/spring-batch/src/main/java/com/baeldung/batchtesting/model/BookDetails.java similarity index 96% rename from spring-batch/src/main/java/org/baeldung/batchtesting/model/BookDetails.java rename to spring-batch/src/main/java/com/baeldung/batchtesting/model/BookDetails.java index d9284fbc66..3e994d2c92 100644 --- a/spring-batch/src/main/java/org/baeldung/batchtesting/model/BookDetails.java +++ b/spring-batch/src/main/java/com/baeldung/batchtesting/model/BookDetails.java @@ -1,4 +1,4 @@ -package org.baeldung.batchtesting.model; +package com.baeldung.batchtesting.model; public class BookDetails { diff --git a/spring-batch/src/main/java/org/baeldung/batchtesting/model/BookRecord.java b/spring-batch/src/main/java/com/baeldung/batchtesting/model/BookRecord.java similarity index 96% rename from spring-batch/src/main/java/org/baeldung/batchtesting/model/BookRecord.java rename to spring-batch/src/main/java/com/baeldung/batchtesting/model/BookRecord.java index 35fb40e878..d6a1692577 100644 --- a/spring-batch/src/main/java/org/baeldung/batchtesting/model/BookRecord.java +++ b/spring-batch/src/main/java/com/baeldung/batchtesting/model/BookRecord.java @@ -1,4 +1,4 @@ -package org.baeldung.batchtesting.model; +package com.baeldung.batchtesting.model; public class BookRecord { diff --git a/spring-batch/src/main/java/org/baeldung/batchtesting/service/BookDetailsItemProcessor.java b/spring-batch/src/main/java/com/baeldung/batchtesting/service/BookDetailsItemProcessor.java similarity index 83% rename from spring-batch/src/main/java/org/baeldung/batchtesting/service/BookDetailsItemProcessor.java rename to spring-batch/src/main/java/com/baeldung/batchtesting/service/BookDetailsItemProcessor.java index f3800fee51..514a383108 100644 --- a/spring-batch/src/main/java/org/baeldung/batchtesting/service/BookDetailsItemProcessor.java +++ b/spring-batch/src/main/java/com/baeldung/batchtesting/service/BookDetailsItemProcessor.java @@ -1,7 +1,7 @@ -package org.baeldung.batchtesting.service; +package com.baeldung.batchtesting.service; -import org.baeldung.batchtesting.model.BookDetails; -import org.baeldung.batchtesting.model.BookRecord; +import com.baeldung.batchtesting.model.BookDetails; +import com.baeldung.batchtesting.model.BookRecord; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.item.ItemProcessor; diff --git a/spring-batch/src/main/java/org/baeldung/batchtesting/service/BookItemProcessor.java b/spring-batch/src/main/java/com/baeldung/batchtesting/service/BookItemProcessor.java similarity index 79% rename from spring-batch/src/main/java/org/baeldung/batchtesting/service/BookItemProcessor.java rename to spring-batch/src/main/java/com/baeldung/batchtesting/service/BookItemProcessor.java index 69e72ba1d3..84e850fe71 100644 --- a/spring-batch/src/main/java/org/baeldung/batchtesting/service/BookItemProcessor.java +++ b/spring-batch/src/main/java/com/baeldung/batchtesting/service/BookItemProcessor.java @@ -1,7 +1,7 @@ -package org.baeldung.batchtesting.service; +package com.baeldung.batchtesting.service; -import org.baeldung.batchtesting.model.Book; -import org.baeldung.batchtesting.model.BookRecord; +import com.baeldung.batchtesting.model.Book; +import com.baeldung.batchtesting.model.BookRecord; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.item.ItemProcessor; diff --git a/spring-batch/src/main/java/org/baeldung/batchtesting/service/BookRecordFieldSetMapper.java b/spring-batch/src/main/java/com/baeldung/batchtesting/service/BookRecordFieldSetMapper.java similarity index 89% rename from spring-batch/src/main/java/org/baeldung/batchtesting/service/BookRecordFieldSetMapper.java rename to spring-batch/src/main/java/com/baeldung/batchtesting/service/BookRecordFieldSetMapper.java index cfc36fed7a..d9e8ee1158 100644 --- a/spring-batch/src/main/java/org/baeldung/batchtesting/service/BookRecordFieldSetMapper.java +++ b/spring-batch/src/main/java/com/baeldung/batchtesting/service/BookRecordFieldSetMapper.java @@ -1,6 +1,6 @@ -package org.baeldung.batchtesting.service; +package com.baeldung.batchtesting.service; -import org.baeldung.batchtesting.model.BookRecord; +import com.baeldung.batchtesting.model.BookRecord; import org.springframework.batch.item.file.mapping.FieldSetMapper; import org.springframework.batch.item.file.transform.FieldSet; import org.springframework.validation.BindException; diff --git a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/chunks/LineProcessor.java b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/chunks/LineProcessor.java similarity index 92% rename from spring-batch/src/main/java/org/baeldung/taskletsvschunks/chunks/LineProcessor.java rename to spring-batch/src/main/java/com/baeldung/taskletsvschunks/chunks/LineProcessor.java index 5b6cd9add3..87d0bdc3fb 100644 --- a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/chunks/LineProcessor.java +++ b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/chunks/LineProcessor.java @@ -1,6 +1,6 @@ -package org.baeldung.taskletsvschunks.chunks; +package com.baeldung.taskletsvschunks.chunks; -import org.baeldung.taskletsvschunks.model.Line; +import com.baeldung.taskletsvschunks.model.Line; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.ExitStatus; diff --git a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/chunks/LineReader.java b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/chunks/LineReader.java similarity index 87% rename from spring-batch/src/main/java/org/baeldung/taskletsvschunks/chunks/LineReader.java rename to spring-batch/src/main/java/com/baeldung/taskletsvschunks/chunks/LineReader.java index 5f6b6de218..6ffa730c19 100644 --- a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/chunks/LineReader.java +++ b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/chunks/LineReader.java @@ -1,7 +1,7 @@ -package org.baeldung.taskletsvschunks.chunks; +package com.baeldung.taskletsvschunks.chunks; -import org.baeldung.taskletsvschunks.model.Line; -import org.baeldung.taskletsvschunks.utils.FileUtils; +import com.baeldung.taskletsvschunks.model.Line; +import com.baeldung.taskletsvschunks.utils.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.ExitStatus; diff --git a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/chunks/LinesWriter.java b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/chunks/LinesWriter.java similarity index 87% rename from spring-batch/src/main/java/org/baeldung/taskletsvschunks/chunks/LinesWriter.java rename to spring-batch/src/main/java/com/baeldung/taskletsvschunks/chunks/LinesWriter.java index 66f9103a56..9f292b24b9 100644 --- a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/chunks/LinesWriter.java +++ b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/chunks/LinesWriter.java @@ -1,7 +1,7 @@ -package org.baeldung.taskletsvschunks.chunks; +package com.baeldung.taskletsvschunks.chunks; -import org.baeldung.taskletsvschunks.model.Line; -import org.baeldung.taskletsvschunks.utils.FileUtils; +import com.baeldung.taskletsvschunks.model.Line; +import com.baeldung.taskletsvschunks.utils.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.ExitStatus; diff --git a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/config/ChunksConfig.java b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/config/ChunksConfig.java similarity index 91% rename from spring-batch/src/main/java/org/baeldung/taskletsvschunks/config/ChunksConfig.java rename to spring-batch/src/main/java/com/baeldung/taskletsvschunks/config/ChunksConfig.java index 601ffb7f27..57288fb312 100644 --- a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/config/ChunksConfig.java +++ b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/config/ChunksConfig.java @@ -1,9 +1,9 @@ -package org.baeldung.taskletsvschunks.config; +package com.baeldung.taskletsvschunks.config; -import org.baeldung.taskletsvschunks.chunks.LineProcessor; -import org.baeldung.taskletsvschunks.chunks.LineReader; -import org.baeldung.taskletsvschunks.chunks.LinesWriter; -import org.baeldung.taskletsvschunks.model.Line; +import com.baeldung.taskletsvschunks.chunks.LineProcessor; +import com.baeldung.taskletsvschunks.chunks.LineReader; +import com.baeldung.taskletsvschunks.chunks.LinesWriter; +import com.baeldung.taskletsvschunks.model.Line; import org.springframework.batch.core.Job; import org.springframework.batch.core.Step; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; diff --git a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/config/TaskletsConfig.java b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/config/TaskletsConfig.java similarity index 92% rename from spring-batch/src/main/java/org/baeldung/taskletsvschunks/config/TaskletsConfig.java rename to spring-batch/src/main/java/com/baeldung/taskletsvschunks/config/TaskletsConfig.java index b9d06d2639..e7157ac520 100644 --- a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/config/TaskletsConfig.java +++ b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/config/TaskletsConfig.java @@ -1,8 +1,8 @@ -package org.baeldung.taskletsvschunks.config; +package com.baeldung.taskletsvschunks.config; -import org.baeldung.taskletsvschunks.tasklets.LinesProcessor; -import org.baeldung.taskletsvschunks.tasklets.LinesReader; -import org.baeldung.taskletsvschunks.tasklets.LinesWriter; +import com.baeldung.taskletsvschunks.tasklets.LinesProcessor; +import com.baeldung.taskletsvschunks.tasklets.LinesReader; +import com.baeldung.taskletsvschunks.tasklets.LinesWriter; import org.springframework.batch.core.Job; import org.springframework.batch.core.Step; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; diff --git a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/model/Line.java b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/model/Line.java similarity index 96% rename from spring-batch/src/main/java/org/baeldung/taskletsvschunks/model/Line.java rename to spring-batch/src/main/java/com/baeldung/taskletsvschunks/model/Line.java index fee6fd31a6..2d7d3ff63f 100644 --- a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/model/Line.java +++ b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/model/Line.java @@ -1,4 +1,4 @@ -package org.baeldung.taskletsvschunks.model; +package com.baeldung.taskletsvschunks.model; import java.io.Serializable; import java.time.LocalDate; diff --git a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/tasklets/LinesProcessor.java b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/tasklets/LinesProcessor.java similarity index 94% rename from spring-batch/src/main/java/org/baeldung/taskletsvschunks/tasklets/LinesProcessor.java rename to spring-batch/src/main/java/com/baeldung/taskletsvschunks/tasklets/LinesProcessor.java index ba7a3088d5..8b84c39174 100644 --- a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/tasklets/LinesProcessor.java +++ b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/tasklets/LinesProcessor.java @@ -1,6 +1,6 @@ -package org.baeldung.taskletsvschunks.tasklets; +package com.baeldung.taskletsvschunks.tasklets; -import org.baeldung.taskletsvschunks.model.Line; +import com.baeldung.taskletsvschunks.model.Line; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.ExitStatus; diff --git a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/tasklets/LinesReader.java b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/tasklets/LinesReader.java similarity index 91% rename from spring-batch/src/main/java/org/baeldung/taskletsvschunks/tasklets/LinesReader.java rename to spring-batch/src/main/java/com/baeldung/taskletsvschunks/tasklets/LinesReader.java index 9905ee8f8a..b1f58be4a4 100644 --- a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/tasklets/LinesReader.java +++ b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/tasklets/LinesReader.java @@ -1,7 +1,7 @@ -package org.baeldung.taskletsvschunks.tasklets; +package com.baeldung.taskletsvschunks.tasklets; -import org.baeldung.taskletsvschunks.model.Line; -import org.baeldung.taskletsvschunks.utils.FileUtils; +import com.baeldung.taskletsvschunks.model.Line; +import com.baeldung.taskletsvschunks.utils.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.ExitStatus; diff --git a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/tasklets/LinesWriter.java b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/tasklets/LinesWriter.java similarity index 91% rename from spring-batch/src/main/java/org/baeldung/taskletsvschunks/tasklets/LinesWriter.java rename to spring-batch/src/main/java/com/baeldung/taskletsvschunks/tasklets/LinesWriter.java index 937288a890..76128b7841 100644 --- a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/tasklets/LinesWriter.java +++ b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/tasklets/LinesWriter.java @@ -1,7 +1,7 @@ -package org.baeldung.taskletsvschunks.tasklets; +package com.baeldung.taskletsvschunks.tasklets; -import org.baeldung.taskletsvschunks.model.Line; -import org.baeldung.taskletsvschunks.utils.FileUtils; +import com.baeldung.taskletsvschunks.model.Line; +import com.baeldung.taskletsvschunks.utils.FileUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.core.ExitStatus; diff --git a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/utils/FileUtils.java b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/utils/FileUtils.java similarity index 96% rename from spring-batch/src/main/java/org/baeldung/taskletsvschunks/utils/FileUtils.java rename to spring-batch/src/main/java/com/baeldung/taskletsvschunks/utils/FileUtils.java index df36d5c756..fde3b1fa9d 100644 --- a/spring-batch/src/main/java/org/baeldung/taskletsvschunks/utils/FileUtils.java +++ b/spring-batch/src/main/java/com/baeldung/taskletsvschunks/utils/FileUtils.java @@ -1,8 +1,8 @@ -package org.baeldung.taskletsvschunks.utils; +package com.baeldung.taskletsvschunks.utils; import com.opencsv.CSVReader; import com.opencsv.CSVWriter; -import org.baeldung.taskletsvschunks.model.Line; +import com.baeldung.taskletsvschunks.model.Line; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-batch/src/main/resources/logback.xml b/spring-batch/src/main/resources/logback.xml index 9a622ceb65..55bbeba870 100644 --- a/spring-batch/src/main/resources/logback.xml +++ b/spring-batch/src/main/resources/logback.xml @@ -8,15 +8,15 @@ - + - + - + diff --git a/spring-batch/src/main/resources/spring-batch-intro.xml b/spring-batch/src/main/resources/spring-batch-intro.xml index 908b8aa2e1..2a7c1e7c4a 100644 --- a/spring-batch/src/main/resources/spring-batch-intro.xml +++ b/spring-batch/src/main/resources/spring-batch-intro.xml @@ -22,14 +22,14 @@ + class="com.baeldung.batch.service.RecordFieldSetMapper" /> - + @@ -40,7 +40,7 @@ - org.baeldung.batch.model.Transaction + com.baeldung.batch.model.Transaction diff --git a/spring-batch/src/test/java/org/baeldung/SpringContextTest.java b/spring-batch/src/test/java/com/baeldung/SpringContextTest.java similarity index 73% rename from spring-batch/src/test/java/org/baeldung/SpringContextTest.java rename to spring-batch/src/test/java/com/baeldung/SpringContextTest.java index 1a4f923a1e..b82bb35daf 100644 --- a/spring-batch/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-batch/src/test/java/com/baeldung/SpringContextTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.batch.App; +import com.baeldung.batch.App; import org.junit.Test; public class SpringContextTest { diff --git a/spring-batch/src/test/java/org/baeldung/batch/SpringBatchRetryIntegrationTest.java b/spring-batch/src/test/java/com/baeldung/batch/SpringBatchRetryIntegrationTest.java similarity index 98% rename from spring-batch/src/test/java/org/baeldung/batch/SpringBatchRetryIntegrationTest.java rename to spring-batch/src/test/java/com/baeldung/batch/SpringBatchRetryIntegrationTest.java index 293c97ac5d..df9154a765 100644 --- a/spring-batch/src/test/java/org/baeldung/batch/SpringBatchRetryIntegrationTest.java +++ b/spring-batch/src/test/java/com/baeldung/batch/SpringBatchRetryIntegrationTest.java @@ -1,5 +1,6 @@ -package org.baeldung.batch; +package com.baeldung.batch; +import com.baeldung.batch.SpringBatchRetryConfig; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.conn.ConnectTimeoutException; import org.apache.http.entity.StringEntity; diff --git a/spring-batch/src/test/java/org/baeldung/batchscheduler/SpringBatchSchedulerIntegrationTest.java b/spring-batch/src/test/java/com/baeldung/batchscheduler/SpringBatchSchedulerIntegrationTest.java similarity index 96% rename from spring-batch/src/test/java/org/baeldung/batchscheduler/SpringBatchSchedulerIntegrationTest.java rename to spring-batch/src/test/java/com/baeldung/batchscheduler/SpringBatchSchedulerIntegrationTest.java index 8927421ac5..81877fbc39 100644 --- a/spring-batch/src/test/java/org/baeldung/batchscheduler/SpringBatchSchedulerIntegrationTest.java +++ b/spring-batch/src/test/java/com/baeldung/batchscheduler/SpringBatchSchedulerIntegrationTest.java @@ -1,5 +1,6 @@ -package org.baeldung.batchscheduler; +package com.baeldung.batchscheduler; +import com.baeldung.batchscheduler.SpringBatchScheduler; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-batch/src/test/java/org/baeldung/batchtesting/SpringBatchIntegrationTest.java b/spring-batch/src/test/java/com/baeldung/batchtesting/SpringBatchIntegrationTest.java similarity index 98% rename from spring-batch/src/test/java/org/baeldung/batchtesting/SpringBatchIntegrationTest.java rename to spring-batch/src/test/java/com/baeldung/batchtesting/SpringBatchIntegrationTest.java index d66da89ba4..333c69684e 100644 --- a/spring-batch/src/test/java/org/baeldung/batchtesting/SpringBatchIntegrationTest.java +++ b/spring-batch/src/test/java/com/baeldung/batchtesting/SpringBatchIntegrationTest.java @@ -1,10 +1,11 @@ -package org.baeldung.batchtesting; +package com.baeldung.batchtesting; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; import java.util.Collection; +import com.baeldung.batchtesting.SpringBatchConfiguration; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-batch/src/test/java/org/baeldung/batchtesting/SpringBatchStepScopeIntegrationTest.java b/spring-batch/src/test/java/com/baeldung/batchtesting/SpringBatchStepScopeIntegrationTest.java similarity index 95% rename from spring-batch/src/test/java/org/baeldung/batchtesting/SpringBatchStepScopeIntegrationTest.java rename to spring-batch/src/test/java/com/baeldung/batchtesting/SpringBatchStepScopeIntegrationTest.java index f7b888f0f9..4655117b85 100644 --- a/spring-batch/src/test/java/org/baeldung/batchtesting/SpringBatchStepScopeIntegrationTest.java +++ b/spring-batch/src/test/java/com/baeldung/batchtesting/SpringBatchStepScopeIntegrationTest.java @@ -1,12 +1,13 @@ -package org.baeldung.batchtesting; +package com.baeldung.batchtesting; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; import java.util.Arrays; -import org.baeldung.batchtesting.model.Book; -import org.baeldung.batchtesting.model.BookRecord; +import com.baeldung.batchtesting.SpringBatchConfiguration; +import com.baeldung.batchtesting.model.Book; +import com.baeldung.batchtesting.model.BookRecord; import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-batch/src/test/java/org/baeldung/taskletsvschunks/chunks/ChunksIntegrationTest.java b/spring-batch/src/test/java/com/baeldung/taskletsvschunks/chunks/ChunksIntegrationTest.java similarity index 89% rename from spring-batch/src/test/java/org/baeldung/taskletsvschunks/chunks/ChunksIntegrationTest.java rename to spring-batch/src/test/java/com/baeldung/taskletsvschunks/chunks/ChunksIntegrationTest.java index eaf73e4a4a..1132e4d5e2 100644 --- a/spring-batch/src/test/java/org/baeldung/taskletsvschunks/chunks/ChunksIntegrationTest.java +++ b/spring-batch/src/test/java/com/baeldung/taskletsvschunks/chunks/ChunksIntegrationTest.java @@ -1,6 +1,6 @@ -package org.baeldung.taskletsvschunks.chunks; +package com.baeldung.taskletsvschunks.chunks; -import org.baeldung.taskletsvschunks.config.ChunksConfig; +import com.baeldung.taskletsvschunks.config.ChunksConfig; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-batch/src/test/java/org/baeldung/taskletsvschunks/tasklets/TaskletsIntegrationTest.java b/spring-batch/src/test/java/com/baeldung/taskletsvschunks/tasklets/TaskletsIntegrationTest.java similarity index 89% rename from spring-batch/src/test/java/org/baeldung/taskletsvschunks/tasklets/TaskletsIntegrationTest.java rename to spring-batch/src/test/java/com/baeldung/taskletsvschunks/tasklets/TaskletsIntegrationTest.java index 322b17bd55..2e1ad031aa 100644 --- a/spring-batch/src/test/java/org/baeldung/taskletsvschunks/tasklets/TaskletsIntegrationTest.java +++ b/spring-batch/src/test/java/com/baeldung/taskletsvschunks/tasklets/TaskletsIntegrationTest.java @@ -1,6 +1,6 @@ -package org.baeldung.taskletsvschunks.tasklets; +package com.baeldung.taskletsvschunks.tasklets; -import org.baeldung.taskletsvschunks.config.TaskletsConfig; +import com.baeldung.taskletsvschunks.config.TaskletsConfig; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-batch/xml/retryOutput.xml b/spring-batch/xml/retryOutput.xml index d30f2c4a32..c5dec44f16 100644 --- a/spring-batch/xml/retryOutput.xml +++ b/spring-batch/xml/retryOutput.xml @@ -1 +1 @@ -1010000.04302222015-10-31 00:00:001234sammy1012321.04302222015-12-03 00:00:009999john \ No newline at end of file + \ No newline at end of file From 8ecb1072a6b2fd34eabd0c4ebf5c6647f20dbccf Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 20 Mar 2020 08:09:11 +0100 Subject: [PATCH 022/130] [JAVA-958] Standardize packages in spring-5 module --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-5/src/test/java/{org => com}/baeldung/SpringContextTest.java (95%) diff --git a/spring-5/src/test/java/org/baeldung/SpringContextTest.java b/spring-5/src/test/java/com/baeldung/SpringContextTest.java similarity index 95% rename from spring-5/src/test/java/org/baeldung/SpringContextTest.java rename to spring-5/src/test/java/com/baeldung/SpringContextTest.java index 56e8697f5c..e3f67def90 100644 --- a/spring-5/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-5/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From 18c557679c3beb832dbde30a8c51f5f6823cf6fa Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 20 Mar 2020 08:16:56 +0100 Subject: [PATCH 023/130] [JAVA-958] Standardize packages in spring-5-data-reactive module --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-5-data-reactive/src/test/java/{org => com}/baeldung/SpringContextTest.java (95%) diff --git a/spring-5-data-reactive/src/test/java/org/baeldung/SpringContextTest.java b/spring-5-data-reactive/src/test/java/com/baeldung/SpringContextTest.java similarity index 95% rename from spring-5-data-reactive/src/test/java/org/baeldung/SpringContextTest.java rename to spring-5-data-reactive/src/test/java/com/baeldung/SpringContextTest.java index c3ea1d8435..bedb30fcaa 100644 --- a/spring-5-data-reactive/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-5-data-reactive/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From 6bc9e485303dea3edb9e79678222aa74887e7ca5 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 20 Mar 2020 08:18:56 +0100 Subject: [PATCH 024/130] [JAVA-958] Standardize packages in spring-5-reactive module --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-5-reactive/src/test/java/{org => com}/baeldung/SpringContextTest.java (95%) diff --git a/spring-5-reactive/src/test/java/org/baeldung/SpringContextTest.java b/spring-5-reactive/src/test/java/com/baeldung/SpringContextTest.java similarity index 95% rename from spring-5-reactive/src/test/java/org/baeldung/SpringContextTest.java rename to spring-5-reactive/src/test/java/com/baeldung/SpringContextTest.java index c3ea1d8435..bedb30fcaa 100644 --- a/spring-5-reactive/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-5-reactive/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From 580aa4d8b0c154640fb82fd3684a4d4308d200c5 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 20 Mar 2020 08:21:22 +0100 Subject: [PATCH 025/130] [JAVA-958] Standardize packages in spring-5-reactive-client module --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-5-reactive-client/src/test/java/{org => com}/baeldung/SpringContextTest.java (95%) diff --git a/spring-5-reactive-client/src/test/java/org/baeldung/SpringContextTest.java b/spring-5-reactive-client/src/test/java/com/baeldung/SpringContextTest.java similarity index 95% rename from spring-5-reactive-client/src/test/java/org/baeldung/SpringContextTest.java rename to spring-5-reactive-client/src/test/java/com/baeldung/SpringContextTest.java index 678d04897b..c0ca9b7e64 100644 --- a/spring-5-reactive-client/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-5-reactive-client/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From d38818530532360821b3fa40461bffc3a5058ac1 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 20 Mar 2020 08:23:39 +0100 Subject: [PATCH 026/130] [JAVA-958] Standardize packages in spring-5-reactive-security module --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-5-reactive-security/src/test/java/{org => com}/baeldung/SpringContextTest.java (95%) diff --git a/spring-5-reactive-security/src/test/java/org/baeldung/SpringContextTest.java b/spring-5-reactive-security/src/test/java/com/baeldung/SpringContextTest.java similarity index 95% rename from spring-5-reactive-security/src/test/java/org/baeldung/SpringContextTest.java rename to spring-5-reactive-security/src/test/java/com/baeldung/SpringContextTest.java index 479c35d986..b4f4118527 100644 --- a/spring-5-reactive-security/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-5-reactive-security/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From 76ee18f79959027dcba517a9ec8d22a4ac228968 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 20 Mar 2020 08:26:22 +0100 Subject: [PATCH 027/130] [JAVA-958] Standardize packages in spring-5-security module --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-5-security/src/test/java/{org => com}/baeldung/SpringContextTest.java (95%) diff --git a/spring-5-security/src/test/java/org/baeldung/SpringContextTest.java b/spring-5-security/src/test/java/com/baeldung/SpringContextTest.java similarity index 95% rename from spring-5-security/src/test/java/org/baeldung/SpringContextTest.java rename to spring-5-security/src/test/java/com/baeldung/SpringContextTest.java index 729790bd14..7812a5c063 100644 --- a/spring-5-security/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-5-security/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From e30cd5677ecd5e13cf55d07fd74b871c6c78fe2f Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 20 Mar 2020 08:29:03 +0100 Subject: [PATCH 028/130] [JAVA-958] Standardize packages in spring-apache-camel module --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-apache-camel/src/test/java/{org => com}/baeldung/SpringContextTest.java (89%) diff --git a/spring-apache-camel/src/test/java/org/baeldung/SpringContextTest.java b/spring-apache-camel/src/test/java/com/baeldung/SpringContextTest.java similarity index 89% rename from spring-apache-camel/src/test/java/org/baeldung/SpringContextTest.java rename to spring-apache-camel/src/test/java/com/baeldung/SpringContextTest.java index 1c098a56ab..14e7de2095 100644 --- a/spring-apache-camel/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-apache-camel/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; From 66c4fe3216b807a0bc137e0cf78046fb596b6b0b Mon Sep 17 00:00:00 2001 From: dupirefr Date: Fri, 20 Mar 2020 08:39:48 +0100 Subject: [PATCH 029/130] [JAVA-958] Standardize packages in spring-bom module --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-bom/src/test/java/{org => com}/baeldung/SpringContextTest.java (90%) diff --git a/spring-bom/src/test/java/org/baeldung/SpringContextTest.java b/spring-bom/src/test/java/com/baeldung/SpringContextTest.java similarity index 90% rename from spring-bom/src/test/java/org/baeldung/SpringContextTest.java rename to spring-bom/src/test/java/com/baeldung/SpringContextTest.java index 783567cdfa..0c7da10dd6 100644 --- a/spring-bom/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-bom/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; From cf216b69d6b04da2e98d16fd0b35a6e4de915ca2 Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Fri, 20 Mar 2020 11:58:47 +0300 Subject: [PATCH 030/130] BAEL-3832: added setters and getters and changed the testcases accordingly --- .../bean/CustomBeanFactoryPostProcessor.java | 15 +++++--- .../bean/CustomBeanPostProcessor.java | 15 +++++--- .../baeldung/ioccontainer/bean/Student.java | 12 +++++-- .../ioccontainer/IOCContainerAppUnitTest.java | 36 +++++++++---------- 4 files changed, 49 insertions(+), 29 deletions(-) diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java index fe773ce2df..65e249b15b 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanFactoryPostProcessor.java @@ -1,14 +1,21 @@ package com.baeldung.ioccontainer.bean; -import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; public class CustomBeanFactoryPostProcessor implements BeanFactoryPostProcessor { - public static boolean isBeanInstantiated = false; + private static boolean isBeanFactoryPostProcessorRegistered = false; @Override - public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { - isBeanInstantiated = true; + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory){ + setBeanFactoryPostProcessorRegistered(true); + } + + public static boolean isBeanFactoryPostProcessorRegistered() { + return isBeanFactoryPostProcessorRegistered; + } + + public static void setBeanFactoryPostProcessorRegistered(boolean isBeanFactoryPostProcessorRegistered) { + CustomBeanFactoryPostProcessor.isBeanFactoryPostProcessorRegistered = isBeanFactoryPostProcessorRegistered; } } diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java index 1c2e011a6c..6f99a5f0db 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/CustomBeanPostProcessor.java @@ -1,14 +1,21 @@ package com.baeldung.ioccontainer.bean; -import org.springframework.beans.BeansException; import org.springframework.beans.factory.config.BeanPostProcessor; public class CustomBeanPostProcessor implements BeanPostProcessor { - public static boolean isBeanInstantiated = false; + private static boolean isBeanPostProcessorRegistered = false; @Override - public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { - isBeanInstantiated = true; + public Object postProcessBeforeInitialization(Object bean, String beanName){ + setBeanPostProcessorRegistered(true); return bean; } + + public static boolean isBeanPostProcessorRegistered() { + return isBeanPostProcessorRegistered; + } + + public static void setBeanPostProcessorRegistered(boolean isBeanPostProcessorRegistered) { + CustomBeanPostProcessor.isBeanPostProcessorRegistered = isBeanPostProcessorRegistered; + } } diff --git a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java index 03e0b049ba..404f323b66 100644 --- a/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java +++ b/spring-core-3/src/main/java/com/baeldung/ioccontainer/bean/Student.java @@ -1,9 +1,17 @@ package com.baeldung.ioccontainer.bean; public class Student { - public static boolean isBeanInstantiated = false; + private static boolean isBeanInstantiated = false; public void postConstruct() { - isBeanInstantiated = true; + setBeanInstantiated(true); + } + + public static boolean isBeanInstantiated() { + return isBeanInstantiated; + } + + public static void setBeanInstantiated(boolean isBeanInstantiated) { + Student.isBeanInstantiated = isBeanInstantiated; } } diff --git a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java index 3c0a5b3dbe..e9b491813e 100644 --- a/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java +++ b/spring-core-3/src/test/java/com/baeldung/ioccontainer/IOCContainerAppUnitTest.java @@ -23,9 +23,9 @@ public class IOCContainerAppUnitTest { @BeforeEach @AfterEach public void resetInstantiationFlag() { - Student.isBeanInstantiated = false; - CustomBeanPostProcessor.isBeanInstantiated = false; - CustomBeanFactoryPostProcessor.isBeanInstantiated = false; + Student.setBeanInstantiated(false); + CustomBeanPostProcessor.setBeanPostProcessorRegistered(false); + CustomBeanFactoryPostProcessor.setBeanFactoryPostProcessorRegistered(false); } @Test @@ -33,24 +33,23 @@ public class IOCContainerAppUnitTest { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); BeanFactory factory = new XmlBeanFactory(res); - assertFalse(Student.isBeanInstantiated); + assertFalse(Student.isBeanInstantiated()); } @Test public void whenBFInitialized_thenStudentInitialized() { - Resource res = new ClassPathResource("ioc-container-difference-example.xml"); BeanFactory factory = new XmlBeanFactory(res); Student student = (Student) factory.getBean("student"); - assertTrue(Student.isBeanInstantiated); + assertTrue(Student.isBeanInstantiated()); } @Test public void whenAppContInitialized_thenStudentInitialized() { ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); - assertTrue(Student.isBeanInstantiated); + assertTrue(Student.isBeanInstantiated()); } @Test @@ -58,16 +57,8 @@ public class IOCContainerAppUnitTest { Resource res = new ClassPathResource("ioc-container-difference-example.xml"); ConfigurableListableBeanFactory factory = new XmlBeanFactory(res); - assertFalse(CustomBeanFactoryPostProcessor.isBeanInstantiated); - assertFalse(CustomBeanPostProcessor.isBeanInstantiated); - } - - @Test - public void whenAppContInitialized_thenBFPostProcessorAndBPostProcessorRegisteredAutomatically() { - ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); - - assertTrue(CustomBeanFactoryPostProcessor.isBeanInstantiated); - assertTrue(CustomBeanPostProcessor.isBeanInstantiated); + assertFalse(CustomBeanFactoryPostProcessor.isBeanFactoryPostProcessorRegistered()); + assertFalse(CustomBeanPostProcessor.isBeanPostProcessorRegistered()); } @Test @@ -77,12 +68,19 @@ public class IOCContainerAppUnitTest { CustomBeanFactoryPostProcessor beanFactoryPostProcessor = new CustomBeanFactoryPostProcessor(); beanFactoryPostProcessor.postProcessBeanFactory(factory); - assertTrue(CustomBeanFactoryPostProcessor.isBeanInstantiated); + assertTrue(CustomBeanFactoryPostProcessor.isBeanFactoryPostProcessorRegistered()); CustomBeanPostProcessor beanPostProcessor = new CustomBeanPostProcessor(); factory.addBeanPostProcessor(beanPostProcessor); Student student = (Student) factory.getBean("student"); - assertTrue(CustomBeanPostProcessor.isBeanInstantiated); + assertTrue(CustomBeanPostProcessor.isBeanPostProcessorRegistered()); } + + @Test + public void whenAppContInitialized_thenBFPostProcessorAndBPostProcessorRegisteredAutomatically() { + ApplicationContext context = new ClassPathXmlApplicationContext("ioc-container-difference-example.xml"); + assertTrue(CustomBeanFactoryPostProcessor.isBeanFactoryPostProcessorRegistered()); + assertTrue(CustomBeanPostProcessor.isBeanPostProcessorRegistered()); + } } From b13bb933750b70375a7f7353e8b22733efa2da13 Mon Sep 17 00:00:00 2001 From: Vikas Ramsingh Rajput Date: Sat, 21 Mar 2020 09:13:32 +0300 Subject: [PATCH 031/130] BAEL-3832: removed tab space --- .../src/test/resources/ioc-container-difference-example.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-core-3/src/test/resources/ioc-container-difference-example.xml b/spring-core-3/src/test/resources/ioc-container-difference-example.xml index ba84aa635d..e53dc11f89 100644 --- a/spring-core-3/src/test/resources/ioc-container-difference-example.xml +++ b/spring-core-3/src/test/resources/ioc-container-difference-example.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> - + \ No newline at end of file From 5e97741b072cf19eec9e7c7e33ae4ebae2366f53 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Sat, 21 Mar 2020 11:29:55 -0600 Subject: [PATCH 032/130] Revert "BAEL-3069 Spring jdbcTemplate Unit Testing" This reverts commit d4a928cdfac363353c293a7f0b0abcd936a77919. --- .../spring-persistence-simple/pom.xml | 7 --- .../baeldung/jdbc/EmployeeDAOUnitTest.java | 49 ------------------- 2 files changed, 56 deletions(-) delete mode 100644 persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java diff --git a/persistence-modules/spring-persistence-simple/pom.xml b/persistence-modules/spring-persistence-simple/pom.xml index 45605c853e..8a03310048 100644 --- a/persistence-modules/spring-persistence-simple/pom.xml +++ b/persistence-modules/spring-persistence-simple/pom.xml @@ -92,12 +92,6 @@ ${org.springframework.version} test - - org.mockito - mockito-core - ${mockito.version} - test - com.querydsl querydsl-jpa @@ -143,7 +137,6 @@ 9.0.0.M26 1.1 4.2.1 - 3.3.3 21.0 diff --git a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java b/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java deleted file mode 100644 index 9894801a53..0000000000 --- a/persistence-modules/spring-persistence-simple/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baeldung.jdbc; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import javax.sql.DataSource; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.junit.MockitoJUnitRunner; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; -import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; -import org.springframework.test.util.ReflectionTestUtils; - - -@RunWith(MockitoJUnitRunner.class) - -public class EmployeeDAOUnitTest { - - @Mock - JdbcTemplate jdbcTemplate; - - @Test - public void whenMockJdbcTemplate_thenReturnCorrectEmployeeCount() { - EmployeeDAO employeeDAO = new EmployeeDAO(); - ReflectionTestUtils.setField(employeeDAO, "jdbcTemplate", jdbcTemplate); - Mockito.when(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class)) - .thenReturn(4); - assertEquals(4, employeeDAO.getCountOfEmployees()); - - Mockito.when(jdbcTemplate.queryForObject(Mockito.anyString(), Mockito.eq(Integer.class))) - .thenReturn(3); - assertEquals(3, employeeDAO.getCountOfEmployees()); - } - - @Test - public void whenInjectInMemoryDataSource_thenReturnCorrectEmployeeCount() { - DataSource dataSource = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2) - .addScript("classpath:jdbc/schema.sql") - .addScript("classpath:jdbc/test-data.sql") - .build(); - EmployeeDAO employeeDAO = new EmployeeDAO(); - employeeDAO.setDataSource(dataSource); - assertEquals(4, employeeDAO.getCountOfEmployees()); - } - -} From c986147850ef773d8bfeb6cfac18256368adf683 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Sat, 21 Mar 2020 11:50:07 -0600 Subject: [PATCH 033/130] BAEL-3069 Spring jdbcTemplate Unit Testing. Create a new module for this article. --- .../spring-persistence-simple-1/.gitignore | 13 ++++ .../spring-persistence-simple-1/pom.xml | 60 +++++++++++++++++++ .../main/java/com/baeldung/jdbc/Employee.java | 44 ++++++++++++++ .../java/com/baeldung/jdbc/EmployeeDAO.java | 21 +++++++ .../src/main/resources/jdbc/schema.sql | 7 +++ .../src/main/resources/jdbc/test-data.sql | 4 ++ .../baeldung/jdbc/EmployeeDAOUnitTest.java | 47 +++++++++++++++ 7 files changed, 196 insertions(+) create mode 100644 persistence-modules/spring-persistence-simple-1/.gitignore create mode 100644 persistence-modules/spring-persistence-simple-1/pom.xml create mode 100644 persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/Employee.java create mode 100644 persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/EmployeeDAO.java create mode 100644 persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/schema.sql create mode 100644 persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/test-data.sql create mode 100644 persistence-modules/spring-persistence-simple-1/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java diff --git a/persistence-modules/spring-persistence-simple-1/.gitignore b/persistence-modules/spring-persistence-simple-1/.gitignore new file mode 100644 index 0000000000..83c05e60c8 --- /dev/null +++ b/persistence-modules/spring-persistence-simple-1/.gitignore @@ -0,0 +1,13 @@ +*.class + +#folders# +/target +/neoDb* +/data +/src/main/webapp/WEB-INF/classes +*/META-INF/* + +# Packaged files # +*.jar +*.war +*.ear \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple-1/pom.xml b/persistence-modules/spring-persistence-simple-1/pom.xml new file mode 100644 index 0000000000..a60db4b9e1 --- /dev/null +++ b/persistence-modules/spring-persistence-simple-1/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + spring-persistence-simple-1 + 0.1-SNAPSHOT + spring-persistence-simple-1 + + + com.baeldung + persistence-modules + 1.0.0-SNAPSHOT + + + + + + org.springframework + spring-orm + ${org.springframework.version} + + + org.springframework + spring-context + ${org.springframework.version} + + + + + com.h2database + h2 + ${h2.version} + test + + + + + org.springframework + spring-test + ${org.springframework.version} + test + + + org.mockito + mockito-core + ${mockito.version} + test + + + + + + 5.2.4.RELEASE + + 1.4.200 + + 3.3.3 + + + \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/Employee.java b/persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/Employee.java new file mode 100644 index 0000000000..a43eb265c7 --- /dev/null +++ b/persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/Employee.java @@ -0,0 +1,44 @@ +package com.baeldung.jdbc; + +public class Employee { + private int id; + + private String firstName; + + private String lastName; + + private String address; + + public int getId() { + return id; + } + + public void setId(final int id) { + this.id = id; + } + + public String getFirstName() { + return firstName; + } + + public void setFirstName(final String firstName) { + this.firstName = firstName; + } + + public String getLastName() { + return lastName; + } + + public void setLastName(final String lastName) { + this.lastName = lastName; + } + + public String getAddress() { + return address; + } + + public void setAddress(final String address) { + this.address = address; + } + +} diff --git a/persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/EmployeeDAO.java b/persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/EmployeeDAO.java new file mode 100644 index 0000000000..a7adb7933a --- /dev/null +++ b/persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/EmployeeDAO.java @@ -0,0 +1,21 @@ +package com.baeldung.jdbc; + +import javax.sql.DataSource; + +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.stereotype.Repository; + +@Repository +public class EmployeeDAO { + private JdbcTemplate jdbcTemplate; + + public void setDataSource(final DataSource dataSource) { + jdbcTemplate = new JdbcTemplate(dataSource); + } + + public int getCountOfEmployees() { + return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class); + } + + +} diff --git a/persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/schema.sql b/persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/schema.sql new file mode 100644 index 0000000000..3401c5d963 --- /dev/null +++ b/persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE EMPLOYEE +( + ID int NOT NULL PRIMARY KEY, + FIRST_NAME varchar(255), + LAST_NAME varchar(255), + ADDRESS varchar(255) +); \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/test-data.sql b/persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/test-data.sql new file mode 100644 index 0000000000..c1669c156d --- /dev/null +++ b/persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/test-data.sql @@ -0,0 +1,4 @@ +INSERT INTO EMPLOYEE VALUES (1, 'James', 'Gosling', 'Canada'); +INSERT INTO EMPLOYEE VALUES (2, 'Donald', 'Knuth', 'USA'); +INSERT INTO EMPLOYEE VALUES (3, 'Linus', 'Torvalds', 'Finland'); +INSERT INTO EMPLOYEE VALUES (4, 'Dennis', 'Ritchie', 'USA'); \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple-1/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java b/persistence-modules/spring-persistence-simple-1/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java new file mode 100644 index 0000000000..a64ba9b2f0 --- /dev/null +++ b/persistence-modules/spring-persistence-simple-1/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java @@ -0,0 +1,47 @@ +package com.baeldung.jdbc; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import javax.sql.DataSource; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.junit.MockitoJUnitRunner; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; +import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; +import org.springframework.test.util.ReflectionTestUtils; + + +@RunWith(MockitoJUnitRunner.class) + +public class EmployeeDAOUnitTest { + @Mock + JdbcTemplate jdbcTemplate; + + @Test + public void whenMockJdbcTemplate_thenReturnCorrectEmployeeCount() { + EmployeeDAO employeeDAO = new EmployeeDAO(); + ReflectionTestUtils.setField(employeeDAO, "jdbcTemplate", jdbcTemplate); + Mockito.when(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class)) + .thenReturn(4); + assertEquals(4, employeeDAO.getCountOfEmployees()); + + Mockito.when(jdbcTemplate.queryForObject(Mockito.anyString(), Mockito.eq(Integer.class))) + .thenReturn(3); + assertEquals(3, employeeDAO.getCountOfEmployees()); + } + + @Test + public void whenInjectInMemoryDataSource_thenReturnCorrectEmployeeCount() { + DataSource dataSource = new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2) + .addScript("classpath:jdbc/schema.sql") + .addScript("classpath:jdbc/test-data.sql") + .build(); + EmployeeDAO employeeDAO = new EmployeeDAO(); + employeeDAO.setDataSource(dataSource); + assertEquals(4, employeeDAO.getCountOfEmployees()); + } +} From 9f3c94929a1a761146e372c73a4c8dbd7fb4b6ec Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Sat, 21 Mar 2020 11:57:30 -0600 Subject: [PATCH 034/130] BAEL-3069 Rename the folder name to spring-persistence-simple-2 --- .../.gitignore | 0 .../pom.xml | 4 ++-- .../src/main/java/com/baeldung/jdbc/Employee.java | 0 .../src/main/java/com/baeldung/jdbc/EmployeeDAO.java | 0 .../src/main/resources/jdbc/schema.sql | 0 .../src/main/resources/jdbc/test-data.sql | 0 .../src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java | 0 7 files changed, 2 insertions(+), 2 deletions(-) rename persistence-modules/{spring-persistence-simple-1 => spring-persistence-simple-2}/.gitignore (100%) rename persistence-modules/{spring-persistence-simple-1 => spring-persistence-simple-2}/pom.xml (95%) rename persistence-modules/{spring-persistence-simple-1 => spring-persistence-simple-2}/src/main/java/com/baeldung/jdbc/Employee.java (100%) rename persistence-modules/{spring-persistence-simple-1 => spring-persistence-simple-2}/src/main/java/com/baeldung/jdbc/EmployeeDAO.java (100%) rename persistence-modules/{spring-persistence-simple-1 => spring-persistence-simple-2}/src/main/resources/jdbc/schema.sql (100%) rename persistence-modules/{spring-persistence-simple-1 => spring-persistence-simple-2}/src/main/resources/jdbc/test-data.sql (100%) rename persistence-modules/{spring-persistence-simple-1 => spring-persistence-simple-2}/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java (100%) diff --git a/persistence-modules/spring-persistence-simple-1/.gitignore b/persistence-modules/spring-persistence-simple-2/.gitignore similarity index 100% rename from persistence-modules/spring-persistence-simple-1/.gitignore rename to persistence-modules/spring-persistence-simple-2/.gitignore diff --git a/persistence-modules/spring-persistence-simple-1/pom.xml b/persistence-modules/spring-persistence-simple-2/pom.xml similarity index 95% rename from persistence-modules/spring-persistence-simple-1/pom.xml rename to persistence-modules/spring-persistence-simple-2/pom.xml index a60db4b9e1..8380d635de 100644 --- a/persistence-modules/spring-persistence-simple-1/pom.xml +++ b/persistence-modules/spring-persistence-simple-2/pom.xml @@ -2,9 +2,9 @@ 4.0.0 - spring-persistence-simple-1 + spring-persistence-simple-2 0.1-SNAPSHOT - spring-persistence-simple-1 + spring-persistence-simple-2 com.baeldung diff --git a/persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/Employee.java b/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/Employee.java similarity index 100% rename from persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/Employee.java rename to persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/Employee.java diff --git a/persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/EmployeeDAO.java b/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/EmployeeDAO.java similarity index 100% rename from persistence-modules/spring-persistence-simple-1/src/main/java/com/baeldung/jdbc/EmployeeDAO.java rename to persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/EmployeeDAO.java diff --git a/persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/schema.sql b/persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/schema.sql similarity index 100% rename from persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/schema.sql rename to persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/schema.sql diff --git a/persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/test-data.sql b/persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/test-data.sql similarity index 100% rename from persistence-modules/spring-persistence-simple-1/src/main/resources/jdbc/test-data.sql rename to persistence-modules/spring-persistence-simple-2/src/main/resources/jdbc/test-data.sql diff --git a/persistence-modules/spring-persistence-simple-1/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java b/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java similarity index 100% rename from persistence-modules/spring-persistence-simple-1/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java rename to persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java From 05e79680cfee68d6df3b8681fe9129bc3011b3e2 Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Sat, 21 Mar 2020 20:58:04 -0600 Subject: [PATCH 035/130] BAEL-3069 Remove git ignore file, add the new module name to the parent pom file. --- persistence-modules/pom.xml | 1 + .../spring-persistence-simple-2/.gitignore | 13 ------------- 2 files changed, 1 insertion(+), 13 deletions(-) delete mode 100644 persistence-modules/spring-persistence-simple-2/.gitignore diff --git a/persistence-modules/pom.xml b/persistence-modules/pom.xml index 15b62d5d77..675f8270eb 100644 --- a/persistence-modules/pom.xml +++ b/persistence-modules/pom.xml @@ -69,6 +69,7 @@ spring-jpa spring-persistence-simple + spring-persistence-simple-2 diff --git a/persistence-modules/spring-persistence-simple-2/.gitignore b/persistence-modules/spring-persistence-simple-2/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/persistence-modules/spring-persistence-simple-2/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.class - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* - -# Packaged files # -*.jar -*.war -*.ear \ No newline at end of file From 2fa275119ce57a3f3319445d9e67fa9c615b0b1c Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 20:48:49 +0100 Subject: [PATCH 036/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-acl --- .../main/java/{org => com}/baeldung/acl/Application.java | 2 +- .../java/{org => com}/baeldung/acl/config/ACLContext.java | 2 +- .../acl/config/AclMethodSecurityConfiguration.java | 2 +- .../baeldung/acl/config/JPAPersistenceConfig.java | 8 ++++---- .../acl/persistence/dao/NoticeMessageRepository.java | 4 ++-- .../baeldung/acl/persistence/entity/NoticeMessage.java | 2 +- .../spring-security-acl/src/main/resources/acl-data.sql | 2 +- ....properties => com.baeldung.acl.datasource.properties} | 0 .../baeldung/acl/SpringACLIntegrationTest.java | 8 ++++---- .../src/test/java/org/baeldung/SpringContextTest.java | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) rename spring-security-modules/spring-security-acl/src/main/java/{org => com}/baeldung/acl/Application.java (91%) rename spring-security-modules/spring-security-acl/src/main/java/{org => com}/baeldung/acl/config/ACLContext.java (99%) rename spring-security-modules/spring-security-acl/src/main/java/{org => com}/baeldung/acl/config/AclMethodSecurityConfiguration.java (96%) rename spring-security-modules/spring-security-acl/src/main/java/{org => com}/baeldung/acl/config/JPAPersistenceConfig.java (66%) rename spring-security-modules/spring-security-acl/src/main/java/{org => com}/baeldung/acl/persistence/dao/NoticeMessageRepository.java (88%) rename spring-security-modules/spring-security-acl/src/main/java/{org => com}/baeldung/acl/persistence/entity/NoticeMessage.java (92%) rename spring-security-modules/spring-security-acl/src/main/resources/{org.baeldung.acl.datasource.properties => com.baeldung.acl.datasource.properties} (100%) rename spring-security-modules/spring-security-acl/src/test/java/{org => com}/baeldung/acl/SpringACLIntegrationTest.java (96%) diff --git a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/Application.java b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/Application.java similarity index 91% rename from spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/Application.java rename to spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/Application.java index 665ca64076..b18a3a6527 100644 --- a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/Application.java +++ b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/Application.java @@ -1,4 +1,4 @@ -package org.baeldung.acl; +package com.baeldung.acl; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/ACLContext.java b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/config/ACLContext.java similarity index 99% rename from spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/ACLContext.java rename to spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/config/ACLContext.java index 337e745c3c..cb60ef1d45 100644 --- a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/ACLContext.java +++ b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/config/ACLContext.java @@ -1,4 +1,4 @@ -package org.baeldung.acl.config; +package com.baeldung.acl.config; import javax.sql.DataSource; diff --git a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/AclMethodSecurityConfiguration.java b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/config/AclMethodSecurityConfiguration.java similarity index 96% rename from spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/AclMethodSecurityConfiguration.java rename to spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/config/AclMethodSecurityConfiguration.java index e503cb1a41..1a8788b906 100644 --- a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/AclMethodSecurityConfiguration.java +++ b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/config/AclMethodSecurityConfiguration.java @@ -1,4 +1,4 @@ -package org.baeldung.acl.config; +package com.baeldung.acl.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/JPAPersistenceConfig.java b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/config/JPAPersistenceConfig.java similarity index 66% rename from spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/JPAPersistenceConfig.java rename to spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/config/JPAPersistenceConfig.java index 24d170e56c..5f7fff5ff3 100644 --- a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/config/JPAPersistenceConfig.java +++ b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/config/JPAPersistenceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.acl.config; +package com.baeldung.acl.config; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Configuration; @@ -8,9 +8,9 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration @EnableTransactionManagement -@EnableJpaRepositories(basePackages = "org.baeldung.acl.persistence.dao") -@PropertySource("classpath:org.baeldung.acl.datasource.properties") -@EntityScan(basePackages={ "org.baeldung.acl.persistence.entity" }) +@EnableJpaRepositories(basePackages = "com.baeldung.acl.persistence.dao") +@PropertySource("classpath:com.baeldung.acl.datasource.properties") +@EntityScan(basePackages={ "com.baeldung.acl.persistence.entity" }) public class JPAPersistenceConfig { } diff --git a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/persistence/dao/NoticeMessageRepository.java b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/persistence/dao/NoticeMessageRepository.java similarity index 88% rename from spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/persistence/dao/NoticeMessageRepository.java rename to spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/persistence/dao/NoticeMessageRepository.java index 91a2af7d83..be1a0118fc 100644 --- a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/persistence/dao/NoticeMessageRepository.java +++ b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/persistence/dao/NoticeMessageRepository.java @@ -1,8 +1,8 @@ -package org.baeldung.acl.persistence.dao; +package com.baeldung.acl.persistence.dao; import java.util.List; -import org.baeldung.acl.persistence.entity.NoticeMessage; +import com.baeldung.acl.persistence.entity.NoticeMessage; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.repository.query.Param; import org.springframework.security.access.prepost.PostAuthorize; diff --git a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/persistence/entity/NoticeMessage.java b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/persistence/entity/NoticeMessage.java similarity index 92% rename from spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/persistence/entity/NoticeMessage.java rename to spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/persistence/entity/NoticeMessage.java index bd1e866f83..80c04146e4 100644 --- a/spring-security-modules/spring-security-acl/src/main/java/org/baeldung/acl/persistence/entity/NoticeMessage.java +++ b/spring-security-modules/spring-security-acl/src/main/java/com/baeldung/acl/persistence/entity/NoticeMessage.java @@ -1,4 +1,4 @@ -package org.baeldung.acl.persistence.entity; +package com.baeldung.acl.persistence.entity; import javax.persistence.Column; import javax.persistence.Entity; diff --git a/spring-security-modules/spring-security-acl/src/main/resources/acl-data.sql b/spring-security-modules/spring-security-acl/src/main/resources/acl-data.sql index a4e0011834..3b48c83f3c 100644 --- a/spring-security-modules/spring-security-acl/src/main/resources/acl-data.sql +++ b/spring-security-modules/spring-security-acl/src/main/resources/acl-data.sql @@ -4,7 +4,7 @@ INSERT INTO acl_sid (id, principal, sid) VALUES (3, 0, 'ROLE_EDITOR'); INSERT INTO acl_class (id, class) VALUES -(1, 'org.baeldung.acl.persistence.entity.NoticeMessage'); +(1, 'com.baeldung.acl.persistence.entity.NoticeMessage'); INSERT INTO system_message(id,content) VALUES (1,'First Level Message'), diff --git a/spring-security-modules/spring-security-acl/src/main/resources/org.baeldung.acl.datasource.properties b/spring-security-modules/spring-security-acl/src/main/resources/com.baeldung.acl.datasource.properties similarity index 100% rename from spring-security-modules/spring-security-acl/src/main/resources/org.baeldung.acl.datasource.properties rename to spring-security-modules/spring-security-acl/src/main/resources/com.baeldung.acl.datasource.properties diff --git a/spring-security-modules/spring-security-acl/src/test/java/org/baeldung/acl/SpringACLIntegrationTest.java b/spring-security-modules/spring-security-acl/src/test/java/com/baeldung/acl/SpringACLIntegrationTest.java similarity index 96% rename from spring-security-modules/spring-security-acl/src/test/java/org/baeldung/acl/SpringACLIntegrationTest.java rename to spring-security-modules/spring-security-acl/src/test/java/com/baeldung/acl/SpringACLIntegrationTest.java index 1460d4f47b..dfdeafe059 100644 --- a/spring-security-modules/spring-security-acl/src/test/java/org/baeldung/acl/SpringACLIntegrationTest.java +++ b/spring-security-modules/spring-security-acl/src/test/java/com/baeldung/acl/SpringACLIntegrationTest.java @@ -1,12 +1,12 @@ -package org.baeldung.acl; +package com.baeldung.acl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import java.util.List; -import org.baeldung.acl.persistence.dao.NoticeMessageRepository; -import org.baeldung.acl.persistence.entity.NoticeMessage; +import com.baeldung.acl.persistence.dao.NoticeMessageRepository; +import com.baeldung.acl.persistence.entity.NoticeMessage; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -39,7 +39,7 @@ public class SpringACLIntegrationTest extends AbstractJUnit4SpringContextTests{ private static String EDITTED_CONTENT = "EDITED"; @Configuration - @ComponentScan("org.baeldung.acl.*") + @ComponentScan("com.baeldung.acl.*") public static class SpringConfig { } diff --git a/spring-security-modules/spring-security-acl/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-acl/src/test/java/org/baeldung/SpringContextTest.java index 74f26e2e5a..6ecc431ddd 100644 --- a/spring-security-modules/spring-security-acl/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-acl/src/test/java/org/baeldung/SpringContextTest.java @@ -1,6 +1,6 @@ package org.baeldung; -import org.baeldung.acl.Application; +import com.baeldung.acl.Application; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; From a9360918bab6cdc03ddf05166b59e3288b649f27 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 20:50:18 +0100 Subject: [PATCH 037/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-angular --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-security-modules/spring-security-angular/server/src/test/java/{org => com}/baeldung/SpringContextTest.java (95%) diff --git a/spring-security-modules/spring-security-angular/server/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-angular/server/src/test/java/com/baeldung/SpringContextTest.java similarity index 95% rename from spring-security-modules/spring-security-angular/server/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-angular/server/src/test/java/com/baeldung/SpringContextTest.java index e61d512bca..49314c0575 100644 --- a/spring-security-modules/spring-security-angular/server/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-angular/server/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From bc90bba63518e4daa88e93b2f21d3934844a5665 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 20:51:39 +0100 Subject: [PATCH 038/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-cache-control --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-security-modules/spring-security-cache-control/src/test/java/{org => com}/baeldung/SpringContextTest.java (95%) diff --git a/spring-security-modules/spring-security-cache-control/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-cache-control/src/test/java/com/baeldung/SpringContextTest.java similarity index 95% rename from spring-security-modules/spring-security-cache-control/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-cache-control/src/test/java/com/baeldung/SpringContextTest.java index 8fbaa7169b..0cde5d829d 100644 --- a/spring-security-modules/spring-security-cache-control/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-cache-control/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From 1d7aedeaad7e709453c846bcb2322c5f2ce49632 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 20:54:54 +0100 Subject: [PATCH 039/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-kerberos --- .../src/main/java/{org => com}/baeldung/Application.java | 2 +- .../java/{org => com}/baeldung/config/WebSecurityConfig.java | 4 ++-- .../baeldung/security/DummyUserDetailsService.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename spring-security-modules/spring-security-kerberos/src/main/java/{org => com}/baeldung/Application.java (92%) rename spring-security-modules/spring-security-kerberos/src/main/java/{org => com}/baeldung/config/WebSecurityConfig.java (97%) rename spring-security-modules/spring-security-kerberos/src/main/java/{org => com}/baeldung/security/DummyUserDetailsService.java (95%) diff --git a/spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/Application.java b/spring-security-modules/spring-security-kerberos/src/main/java/com/baeldung/Application.java similarity index 92% rename from spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/Application.java rename to spring-security-modules/spring-security-kerberos/src/main/java/com/baeldung/Application.java index 39c2b51356..37dbe7dab8 100644 --- a/spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/Application.java +++ b/spring-security-modules/spring-security-kerberos/src/main/java/com/baeldung/Application.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/config/WebSecurityConfig.java b/spring-security-modules/spring-security-kerberos/src/main/java/com/baeldung/config/WebSecurityConfig.java similarity index 97% rename from spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/config/WebSecurityConfig.java rename to spring-security-modules/spring-security-kerberos/src/main/java/com/baeldung/config/WebSecurityConfig.java index 49a1cf0a8e..c1c206e5c9 100644 --- a/spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/config/WebSecurityConfig.java +++ b/spring-security-modules/spring-security-kerberos/src/main/java/com/baeldung/config/WebSecurityConfig.java @@ -1,6 +1,6 @@ -package org.baeldung.config; +package com.baeldung.config; -import org.baeldung.security.DummyUserDetailsService; +import com.baeldung.security.DummyUserDetailsService; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.FileSystemResource; diff --git a/spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/security/DummyUserDetailsService.java b/spring-security-modules/spring-security-kerberos/src/main/java/com/baeldung/security/DummyUserDetailsService.java similarity index 95% rename from spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/security/DummyUserDetailsService.java rename to spring-security-modules/spring-security-kerberos/src/main/java/com/baeldung/security/DummyUserDetailsService.java index 10d71fca8f..6ddd6c8969 100644 --- a/spring-security-modules/spring-security-kerberos/src/main/java/org/baeldung/security/DummyUserDetailsService.java +++ b/spring-security-modules/spring-security-kerberos/src/main/java/com/baeldung/security/DummyUserDetailsService.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.userdetails.User; From d6e6e5a8cad28041a88fc5ed8e49fb480430acb3 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:01:20 +0100 Subject: [PATCH 040/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-ldap --- .../main/java/{org => com}/baeldung/SampleLDAPApplication.java | 2 +- .../java/{org => com}/baeldung/controller/MyController.java | 2 +- .../java/{org => com}/baeldung/security/SecurityConfig.java | 2 +- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) rename spring-security-modules/spring-security-ldap/src/main/java/{org => com}/baeldung/SampleLDAPApplication.java (98%) rename spring-security-modules/spring-security-ldap/src/main/java/{org => com}/baeldung/controller/MyController.java (98%) rename spring-security-modules/spring-security-ldap/src/main/java/{org => com}/baeldung/security/SecurityConfig.java (97%) rename spring-security-modules/spring-security-ldap/src/test/java/{org => com}/baeldung/SpringContextTest.java (85%) diff --git a/spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/SampleLDAPApplication.java b/spring-security-modules/spring-security-ldap/src/main/java/com/baeldung/SampleLDAPApplication.java similarity index 98% rename from spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/SampleLDAPApplication.java rename to spring-security-modules/spring-security-ldap/src/main/java/com/baeldung/SampleLDAPApplication.java index 5936aa30ef..ec585f2387 100644 --- a/spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/SampleLDAPApplication.java +++ b/spring-security-modules/spring-security-ldap/src/main/java/com/baeldung/SampleLDAPApplication.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/controller/MyController.java b/spring-security-modules/spring-security-ldap/src/main/java/com/baeldung/controller/MyController.java similarity index 98% rename from spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/controller/MyController.java rename to spring-security-modules/spring-security-ldap/src/main/java/com/baeldung/controller/MyController.java index e347bd8633..7c746cfb31 100644 --- a/spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/controller/MyController.java +++ b/spring-security-modules/spring-security-ldap/src/main/java/com/baeldung/controller/MyController.java @@ -1,4 +1,4 @@ -package org.baeldung.controller; +package com.baeldung.controller; import java.security.Principal; import java.util.Arrays; diff --git a/spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/security/SecurityConfig.java b/spring-security-modules/spring-security-ldap/src/main/java/com/baeldung/security/SecurityConfig.java similarity index 97% rename from spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/security/SecurityConfig.java rename to spring-security-modules/spring-security-ldap/src/main/java/com/baeldung/security/SecurityConfig.java index 0d444e36ff..a00cb02459 100644 --- a/spring-security-modules/spring-security-ldap/src/main/java/org/baeldung/security/SecurityConfig.java +++ b/spring-security-modules/spring-security-ldap/src/main/java/com/baeldung/security/SecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; diff --git a/spring-security-modules/spring-security-ldap/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-ldap/src/test/java/com/baeldung/SpringContextTest.java similarity index 85% rename from spring-security-modules/spring-security-ldap/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-ldap/src/test/java/com/baeldung/SpringContextTest.java index 30ba7671d8..a15ca31980 100644 --- a/spring-security-modules/spring-security-ldap/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-ldap/src/test/java/com/baeldung/SpringContextTest.java @@ -1,5 +1,6 @@ -package org.baeldung; +package com.baeldung; +import com.baeldung.SampleLDAPApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; From 15a48fcb7810c6d3f507e8e377915c5e01368489 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:06:42 +0100 Subject: [PATCH 041/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-mvc-custom --- .../MySimpleUrlAuthenticationSuccessHandler.java | 2 +- .../java/{org => com}/baeldung/spring/MvcConfig.java | 8 ++++---- .../{org => com}/baeldung/spring/SecSecurityConfig.java | 5 +++-- .../baeldung/web/controller/BankController.java | 2 +- .../baeldung/web/controller/FooController.java | 4 ++-- .../baeldung/web/controller/LoginController.java | 2 +- .../baeldung/web/controller/PrintUserController.java | 2 +- .../src/main/java/{org => com}/baeldung/web/dto/Foo.java | 2 +- .../baeldung/web/interceptor/LoggerInterceptor.java | 2 +- .../web/interceptor/SessionTimerInterceptor.java | 2 +- .../baeldung/web/interceptor/UserInterceptor.java | 2 +- .../src/main/resources/webSecurityConfig.xml | 9 ++------- .../java/{org => com}/baeldung/SpringContextTest.java | 6 +++--- .../security/csrf/CsrfAbstractIntegrationTest.java | 4 ++-- .../security/csrf/CsrfDisabledIntegrationTest.java | 6 +++--- .../security/csrf/CsrfEnabledIntegrationTest.java | 6 +++--- .../baeldung/security/spring/ManualSecurityConfig.java | 2 +- .../security/spring/ManualSecurityIntegrationTest.java | 4 ++-- .../baeldung/security/spring/SecurityWithCsrfConfig.java | 2 +- .../security/spring/SecurityWithoutCsrfConfig.java | 2 +- .../interceptor/LoggerInterceptorIntegrationTest.java | 6 +++--- .../SessionTimerInterceptorIntegrationTest.java | 6 +++--- .../web/interceptor/UserInterceptorIntegrationTest.java | 6 +++--- 23 files changed, 44 insertions(+), 48 deletions(-) rename spring-security-modules/spring-security-mvc-custom/src/main/java/{org => com}/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java (98%) rename spring-security-modules/spring-security-mvc-custom/src/main/java/{org => com}/baeldung/spring/MvcConfig.java (89%) rename spring-security-modules/spring-security-mvc-custom/src/main/java/{org => com}/baeldung/spring/SecSecurityConfig.java (92%) rename spring-security-modules/spring-security-mvc-custom/src/main/java/{org => com}/baeldung/web/controller/BankController.java (96%) rename spring-security-modules/spring-security-mvc-custom/src/main/java/{org => com}/baeldung/web/controller/FooController.java (96%) rename spring-security-modules/spring-security-mvc-custom/src/main/java/{org => com}/baeldung/web/controller/LoginController.java (97%) rename spring-security-modules/spring-security-mvc-custom/src/main/java/{org => com}/baeldung/web/controller/PrintUserController.java (95%) rename spring-security-modules/spring-security-mvc-custom/src/main/java/{org => com}/baeldung/web/dto/Foo.java (98%) rename spring-security-modules/spring-security-mvc-custom/src/main/java/{org => com}/baeldung/web/interceptor/LoggerInterceptor.java (98%) rename spring-security-modules/spring-security-mvc-custom/src/main/java/{org => com}/baeldung/web/interceptor/SessionTimerInterceptor.java (98%) rename spring-security-modules/spring-security-mvc-custom/src/main/java/{org => com}/baeldung/web/interceptor/UserInterceptor.java (98%) rename spring-security-modules/spring-security-mvc-custom/src/test/java/{org => com}/baeldung/SpringContextTest.java (82%) rename spring-security-modules/spring-security-mvc-custom/src/test/java/{org => com}/baeldung/security/csrf/CsrfAbstractIntegrationTest.java (95%) rename spring-security-modules/spring-security-mvc-custom/src/test/java/{org => com}/baeldung/security/csrf/CsrfDisabledIntegrationTest.java (87%) rename spring-security-modules/spring-security-mvc-custom/src/test/java/{org => com}/baeldung/security/csrf/CsrfEnabledIntegrationTest.java (88%) rename spring-security-modules/spring-security-mvc-custom/src/test/java/{org => com}/baeldung/security/spring/ManualSecurityConfig.java (98%) rename spring-security-modules/spring-security-mvc-custom/src/test/java/{org => com}/baeldung/security/spring/ManualSecurityIntegrationTest.java (96%) rename spring-security-modules/spring-security-mvc-custom/src/test/java/{org => com}/baeldung/security/spring/SecurityWithCsrfConfig.java (98%) rename spring-security-modules/spring-security-mvc-custom/src/test/java/{org => com}/baeldung/security/spring/SecurityWithoutCsrfConfig.java (98%) rename spring-security-modules/spring-security-mvc-custom/src/test/java/{org => com}/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java (91%) rename spring-security-modules/spring-security-mvc-custom/src/test/java/{org => com}/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java (93%) rename spring-security-modules/spring-security-mvc-custom/src/test/java/{org => com}/baeldung/web/interceptor/UserInterceptorIntegrationTest.java (92%) diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java similarity index 98% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java index 73c186cae3..728445952e 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import java.io.IOException; import java.util.Collection; diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/MvcConfig.java similarity index 89% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/MvcConfig.java index db6141d43e..fb54df155c 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/spring/MvcConfig.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/MvcConfig.java @@ -1,8 +1,8 @@ -package org.baeldung.spring; +package com.baeldung.spring; -import org.baeldung.web.interceptor.LoggerInterceptor; -import org.baeldung.web.interceptor.SessionTimerInterceptor; -import org.baeldung.web.interceptor.UserInterceptor; +import com.baeldung.web.interceptor.LoggerInterceptor; +import com.baeldung.web.interceptor.SessionTimerInterceptor; +import com.baeldung.web.interceptor.UserInterceptor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/SecSecurityConfig.java similarity index 92% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/SecSecurityConfig.java index fe00e6943b..9cee909ad4 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/spring/SecSecurityConfig.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/SecSecurityConfig.java @@ -1,6 +1,7 @@ -package org.baeldung.spring; +package com.baeldung.spring; -import org.baeldung.security.MySimpleUrlAuthenticationSuccessHandler; +import com.baeldung.security.MySimpleUrlAuthenticationSuccessHandler; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/BankController.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/BankController.java similarity index 96% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/BankController.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/BankController.java index 1a4322c611..c4bbde21f2 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/BankController.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/BankController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/FooController.java similarity index 96% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/FooController.java index 5a3c85d220..6f9268c976 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/FooController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; @@ -7,7 +7,7 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; -import org.baeldung.web.dto.Foo; +import com.baeldung.web.dto.Foo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.http.HttpStatus; diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/LoginController.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/LoginController.java similarity index 97% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/LoginController.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/LoginController.java index 99bf345a41..8a823cdf7e 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/LoginController.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/LoginController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/PrintUserController.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/PrintUserController.java similarity index 95% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/PrintUserController.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/PrintUserController.java index 78f164c7f1..9623471f12 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/controller/PrintUserController.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/controller/PrintUserController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/dto/Foo.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/dto/Foo.java similarity index 98% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/dto/Foo.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/dto/Foo.java index 02283e7df9..b349e75b72 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/dto/Foo.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/dto/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.web.dto; import java.io.Serializable; diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/LoggerInterceptor.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/LoggerInterceptor.java similarity index 98% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/LoggerInterceptor.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/LoggerInterceptor.java index 7c68d3e9c7..b54fda5a82 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/LoggerInterceptor.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/LoggerInterceptor.java @@ -1,4 +1,4 @@ -package org.baeldung.web.interceptor; +package com.baeldung.web.interceptor; import com.google.common.base.Strings; import org.slf4j.Logger; diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/SessionTimerInterceptor.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/SessionTimerInterceptor.java similarity index 98% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/SessionTimerInterceptor.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/SessionTimerInterceptor.java index 90199347b4..38e852305c 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/SessionTimerInterceptor.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/SessionTimerInterceptor.java @@ -1,4 +1,4 @@ -package org.baeldung.web.interceptor; +package com.baeldung.web.interceptor; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/UserInterceptor.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/UserInterceptor.java similarity index 98% rename from spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/UserInterceptor.java rename to spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/UserInterceptor.java index 6b808d885e..cd64a20842 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/org/baeldung/web/interceptor/UserInterceptor.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/web/interceptor/UserInterceptor.java @@ -1,4 +1,4 @@ -package org.baeldung.web.interceptor; +package com.baeldung.web.interceptor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-mvc-custom/src/main/resources/webSecurityConfig.xml index e79e14abeb..4853e6669b 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/resources/webSecurityConfig.xml +++ b/spring-security-modules/spring-security-mvc-custom/src/main/resources/webSecurityConfig.xml @@ -22,7 +22,7 @@ - + @@ -31,10 +31,5 @@ - - - - + ù \ No newline at end of file diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/SpringContextTest.java similarity index 82% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/SpringContextTest.java index 5ee80d856a..3a73503bca 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/SpringContextTest.java @@ -1,7 +1,7 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.spring.MvcConfig; -import org.baeldung.spring.SecSecurityConfig; +import com.baeldung.spring.MvcConfig; +import com.baeldung.spring.SecSecurityConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfAbstractIntegrationTest.java similarity index 95% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfAbstractIntegrationTest.java index 44424bf7f9..97972b7358 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfAbstractIntegrationTest.java +++ b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfAbstractIntegrationTest.java @@ -1,11 +1,11 @@ -package org.baeldung.security.csrf; +package com.baeldung.security.csrf; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.user; import javax.servlet.Filter; -import org.baeldung.web.dto.Foo; +import com.baeldung.web.dto.Foo; import org.junit.Before; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfDisabledIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfDisabledIntegrationTest.java similarity index 87% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfDisabledIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfDisabledIntegrationTest.java index 1d16e08514..a1c8be9daf 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfDisabledIntegrationTest.java +++ b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfDisabledIntegrationTest.java @@ -1,10 +1,10 @@ -package org.baeldung.security.csrf; +package com.baeldung.security.csrf; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import org.baeldung.security.spring.SecurityWithoutCsrfConfig; -import org.baeldung.spring.MvcConfig; +import com.baeldung.security.spring.SecurityWithoutCsrfConfig; +import com.baeldung.spring.MvcConfig; import org.junit.Test; import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfEnabledIntegrationTest.java similarity index 88% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfEnabledIntegrationTest.java index 9d882973bd..87e5005e17 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/csrf/CsrfEnabledIntegrationTest.java +++ b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/csrf/CsrfEnabledIntegrationTest.java @@ -1,11 +1,11 @@ -package org.baeldung.security.csrf; +package com.baeldung.security.csrf; import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.csrf; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import org.baeldung.security.spring.SecurityWithCsrfConfig; -import org.baeldung.spring.MvcConfig; +import com.baeldung.security.spring.SecurityWithCsrfConfig; +import com.baeldung.spring.MvcConfig; import org.junit.Test; import org.springframework.http.MediaType; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityConfig.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityConfig.java similarity index 98% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityConfig.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityConfig.java index 23d13a0ff1..438cec38bb 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityConfig.java +++ b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.security.spring; +package com.baeldung.security.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityIntegrationTest.java similarity index 96% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityIntegrationTest.java index afc86bd74c..002ba8df3e 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/ManualSecurityIntegrationTest.java +++ b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/ManualSecurityIntegrationTest.java @@ -1,11 +1,11 @@ -package org.baeldung.security.spring; +package com.baeldung.security.spring; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import javax.servlet.http.HttpSession; -import org.baeldung.spring.MvcConfig; +import com.baeldung.spring.MvcConfig; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithCsrfConfig.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithCsrfConfig.java similarity index 98% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithCsrfConfig.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithCsrfConfig.java index ca401622c0..9b3ac50546 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithCsrfConfig.java +++ b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithCsrfConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.security.spring; +package com.baeldung.security.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithoutCsrfConfig.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithoutCsrfConfig.java similarity index 98% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithoutCsrfConfig.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithoutCsrfConfig.java index 1067c70fea..4a1263b498 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/security/spring/SecurityWithoutCsrfConfig.java +++ b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/security/spring/SecurityWithoutCsrfConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.security.spring; +package com.baeldung.security.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java similarity index 91% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java index c33c9a04e8..9e850861bf 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java +++ b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/LoggerInterceptorIntegrationTest.java @@ -1,10 +1,10 @@ -package org.baeldung.web.interceptor; +package com.baeldung.web.interceptor; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import org.baeldung.security.spring.SecurityWithoutCsrfConfig; -import org.baeldung.spring.MvcConfig; +import com.baeldung.security.spring.SecurityWithoutCsrfConfig; +import com.baeldung.spring.MvcConfig; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java similarity index 93% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java index bdc1be2c44..07bc22f184 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java +++ b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/SessionTimerInterceptorIntegrationTest.java @@ -1,12 +1,12 @@ -package org.baeldung.web.interceptor; +package com.baeldung.web.interceptor; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import javax.servlet.http.HttpSession; -import org.baeldung.security.spring.SecurityWithoutCsrfConfig; -import org.baeldung.spring.MvcConfig; +import com.baeldung.security.spring.SecurityWithoutCsrfConfig; +import com.baeldung.spring.MvcConfig; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/UserInterceptorIntegrationTest.java b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/UserInterceptorIntegrationTest.java similarity index 92% rename from spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/UserInterceptorIntegrationTest.java rename to spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/UserInterceptorIntegrationTest.java index a85fd999a6..b7547cb23a 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/test/java/org/baeldung/web/interceptor/UserInterceptorIntegrationTest.java +++ b/spring-security-modules/spring-security-mvc-custom/src/test/java/com/baeldung/web/interceptor/UserInterceptorIntegrationTest.java @@ -1,10 +1,10 @@ -package org.baeldung.web.interceptor; +package com.baeldung.web.interceptor; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import org.baeldung.security.spring.SecurityWithoutCsrfConfig; -import org.baeldung.spring.MvcConfig; +import com.baeldung.security.spring.SecurityWithoutCsrfConfig; +import com.baeldung.spring.MvcConfig; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; From d1a28cbd6a9ed17a96852de66d4de7cd23e38a02 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:38:14 +0100 Subject: [PATCH 042/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-acl (finalized) --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-security-modules/spring-security-acl/src/test/java/{org => com}/baeldung/SpringContextTest.java (94%) diff --git a/spring-security-modules/spring-security-acl/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-acl/src/test/java/com/baeldung/SpringContextTest.java similarity index 94% rename from spring-security-modules/spring-security-acl/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-acl/src/test/java/com/baeldung/SpringContextTest.java index 6ecc431ddd..e60983733e 100644 --- a/spring-security-modules/spring-security-acl/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-acl/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import com.baeldung.acl.Application; import org.junit.Test; From c1b2f97a53227fa3a993e072a60a9922de96a8d4 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:39:57 +0100 Subject: [PATCH 043/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-mvc-custom (finalized) --- .../src/main/java/com/baeldung/spring/MvcConfig.java | 2 +- .../spring-security-mvc-custom/src/main/webapp/WEB-INF/web.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/MvcConfig.java index fb54df155c..583825a66a 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/MvcConfig.java +++ b/spring-security-modules/spring-security-mvc-custom/src/main/java/com/baeldung/spring/MvcConfig.java @@ -16,7 +16,7 @@ import org.springframework.web.servlet.view.JstlView; @EnableWebMvc @Configuration -@ComponentScan("org.baeldung.web.controller") +@ComponentScan("com.baeldung.web.controller") public class MvcConfig implements WebMvcConfigurer { public MvcConfig() { diff --git a/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/web.xml index e805828809..61fd248f53 100644 --- a/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/web.xml +++ b/spring-security-modules/spring-security-mvc-custom/src/main/webapp/WEB-INF/web.xml @@ -20,7 +20,7 @@ contextConfigLocation - org.baeldung.spring + com.baeldung.spring From ead60ef1f78543b60fa3002439cf984ec90dbec4 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:11:07 +0100 Subject: [PATCH 044/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-mvc-digest-auth --- .../baeldung/basic/MyBasicAuthenticationEntryPoint.java | 2 +- .../HttpComponentsClientHttpRequestFactoryDigestAuth.java | 2 +- .../java/{org => com}/baeldung/spring/ClientConfig.java | 4 ++-- .../main/java/{org => com}/baeldung/spring/MvcConfig.java | 2 +- .../{org => com}/baeldung/spring/SecSecurityConfig.java | 2 +- .../java/{org => com}/baeldung/SpringContextTest.java | 8 ++++---- .../{org => com}/baeldung/client/RawClientLiveTest.java | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) rename spring-security-modules/spring-security-mvc-digest-auth/src/main/java/{org => com}/baeldung/basic/MyBasicAuthenticationEntryPoint.java (97%) rename spring-security-modules/spring-security-mvc-digest-auth/src/main/java/{org => com}/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java (98%) rename spring-security-modules/spring-security-mvc-digest-auth/src/main/java/{org => com}/baeldung/spring/ClientConfig.java (94%) rename spring-security-modules/spring-security-mvc-digest-auth/src/main/java/{org => com}/baeldung/spring/MvcConfig.java (97%) rename spring-security-modules/spring-security-mvc-digest-auth/src/main/java/{org => com}/baeldung/spring/SecSecurityConfig.java (93%) rename spring-security-modules/spring-security-mvc-digest-auth/src/test/java/{org => com}/baeldung/SpringContextTest.java (78%) rename spring-security-modules/spring-security-mvc-digest-auth/src/test/java/{org => com}/baeldung/client/RawClientLiveTest.java (94%) diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java similarity index 97% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java index c51c0a0bc8..1b9ffc3db8 100644 --- a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java +++ b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java @@ -1,4 +1,4 @@ -package org.baeldung.basic; +package com.baeldung.basic; import java.io.IOException; import java.io.PrintWriter; diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java similarity index 98% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java index 1e6f213305..67c2d6031f 100644 --- a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java +++ b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryDigestAuth.java @@ -1,4 +1,4 @@ -package org.baeldung.client; +package com.baeldung.client; import org.apache.http.HttpHost; import org.apache.http.client.AuthCache; diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/ClientConfig.java b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/ClientConfig.java similarity index 94% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/ClientConfig.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/ClientConfig.java index f305321f13..b7145daaea 100644 --- a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/ClientConfig.java +++ b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/ClientConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.apache.http.HttpHost; import org.apache.http.auth.AuthScope; @@ -7,7 +7,7 @@ import org.apache.http.client.CredentialsProvider; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.baeldung.client.HttpComponentsClientHttpRequestFactoryDigestAuth; +import com.baeldung.client.HttpComponentsClientHttpRequestFactoryDigestAuth; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/MvcConfig.java similarity index 97% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/MvcConfig.java index 74c11478ee..0d9962cda0 100644 --- a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/MvcConfig.java +++ b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/MvcConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java similarity index 93% rename from spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java index 4ce80dab9f..cddef4d508 100644 --- a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java +++ b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/com/baeldung/SpringContextTest.java similarity index 78% rename from spring-security-modules/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/test/java/com/baeldung/SpringContextTest.java index cd2b796308..080935c8c1 100644 --- a/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/com/baeldung/SpringContextTest.java @@ -1,8 +1,8 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.spring.ClientConfig; -import org.baeldung.spring.MvcConfig; -import org.baeldung.spring.SecSecurityConfig; +import com.baeldung.spring.ClientConfig; +import com.baeldung.spring.MvcConfig; +import com.baeldung.spring.SecSecurityConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/org/baeldung/client/RawClientLiveTest.java b/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/com/baeldung/client/RawClientLiveTest.java similarity index 94% rename from spring-security-modules/spring-security-mvc-digest-auth/src/test/java/org/baeldung/client/RawClientLiveTest.java rename to spring-security-modules/spring-security-mvc-digest-auth/src/test/java/com/baeldung/client/RawClientLiveTest.java index e8dcf82ebc..de6dca3ec4 100644 --- a/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/org/baeldung/client/RawClientLiveTest.java +++ b/spring-security-modules/spring-security-mvc-digest-auth/src/test/java/com/baeldung/client/RawClientLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.client; +package com.baeldung.client; import java.io.IOException; @@ -6,7 +6,7 @@ import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.baeldung.spring.ClientConfig; +import com.baeldung.spring.ClientConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; From 56c6d78bd55ef43eddc1e31337e5fe0bbc286574 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:16:32 +0100 Subject: [PATCH 045/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-mvc-persisted-remember-me --- .../{org => com}/baeldung/controller/MyController.java | 2 +- .../security/MySimpleUrlAuthenticationSuccessHandler.java | 2 +- .../java/{org => com}/baeldung/security/SecurityRole.java | 2 +- .../security/SecurityWebApplicationInitializer.java | 2 +- .../baeldung/service/MyUserDetailsService.java | 4 ++-- .../main/java/{org => com}/baeldung/spring/MvcConfig.java | 4 ++-- .../{org => com}/baeldung/spring/PersistenceConfig.java | 2 +- .../java/{org => com}/baeldung/spring/SecurityConfig.java | 2 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- .../java/{org => com}/baeldung/SpringContextTest.java | 8 ++++---- 10 files changed, 15 insertions(+), 15 deletions(-) rename spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/{org => com}/baeldung/controller/MyController.java (96%) rename spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/{org => com}/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java (99%) rename spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/{org => com}/baeldung/security/SecurityRole.java (78%) rename spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/{org => com}/baeldung/security/SecurityWebApplicationInitializer.java (90%) rename spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/{org => com}/baeldung/service/MyUserDetailsService.java (96%) rename spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/{org => com}/baeldung/spring/MvcConfig.java (95%) rename spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/{org => com}/baeldung/spring/PersistenceConfig.java (97%) rename spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/{org => com}/baeldung/spring/SecurityConfig.java (95%) rename spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/java/{org => com}/baeldung/SpringContextTest.java (78%) diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/controller/MyController.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/controller/MyController.java similarity index 96% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/controller/MyController.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/controller/MyController.java index 51202225ee..0ef07a2c19 100644 --- a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/controller/MyController.java +++ b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/controller/MyController.java @@ -1,4 +1,4 @@ -package org.baeldung.controller; +package com.baeldung.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java similarity index 99% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java index 22fd2cdcb6..5d3c59be11 100644 --- a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java +++ b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/MySimpleUrlAuthenticationSuccessHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import java.io.IOException; import java.util.Collection; diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityRole.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/SecurityRole.java similarity index 78% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityRole.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/SecurityRole.java index e41e7a4c4f..ffe385996d 100644 --- a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityRole.java +++ b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/SecurityRole.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; /** * Simple enum of Security Roles available. diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityWebApplicationInitializer.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java similarity index 90% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityWebApplicationInitializer.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java index 75f782e7dc..98eb4cd41c 100644 --- a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/security/SecurityWebApplicationInitializer.java +++ b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer; diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/service/MyUserDetailsService.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/service/MyUserDetailsService.java similarity index 96% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/service/MyUserDetailsService.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/service/MyUserDetailsService.java index e6c77110b3..34782bdfab 100644 --- a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/service/MyUserDetailsService.java +++ b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/service/MyUserDetailsService.java @@ -1,8 +1,8 @@ -package org.baeldung.service; +package com.baeldung.service; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.baeldung.security.SecurityRole; +import com.baeldung.security.SecurityRole; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; import org.springframework.security.core.userdetails.User; diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/MvcConfig.java similarity index 95% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/MvcConfig.java index d4e0c55004..6fa3b522e7 100644 --- a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/MvcConfig.java +++ b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/MvcConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -14,7 +14,7 @@ import org.springframework.web.servlet.view.JstlView; * Spring Web Configuration. */ @EnableWebMvc -@ComponentScan("org.baeldung") +@ComponentScan("com.baeldung") @Configuration public class MvcConfig extends WebMvcConfigurerAdapter { diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/PersistenceConfig.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/PersistenceConfig.java similarity index 97% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/PersistenceConfig.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/PersistenceConfig.java index 02308e64fb..fe7b82b63d 100644 --- a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/PersistenceConfig.java +++ b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/PersistenceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import javax.sql.DataSource; diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/SecurityConfig.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/SecurityConfig.java similarity index 95% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/SecurityConfig.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/SecurityConfig.java index 2d9bb8e731..d3cfff81cb 100644 --- a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/org/baeldung/spring/SecurityConfig.java +++ b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/java/com/baeldung/spring/SecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/web.xml index aa52205420..11b922a801 100644 --- a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/web.xml +++ b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/main/webapp/WEB-INF/web.xml @@ -19,7 +19,7 @@ contextConfigLocation - org.baeldung.spring + com.baeldung.spring diff --git a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/java/com/baeldung/SpringContextTest.java similarity index 78% rename from spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/java/com/baeldung/SpringContextTest.java index 8113ed0fbe..bf4951c83a 100644 --- a/spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-mvc-persisted-remember-me/src/test/java/com/baeldung/SpringContextTest.java @@ -1,8 +1,8 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.spring.MvcConfig; -import org.baeldung.spring.PersistenceConfig; -import org.baeldung.spring.SecurityConfig; +import com.baeldung.spring.MvcConfig; +import com.baeldung.spring.PersistenceConfig; +import com.baeldung.spring.SecurityConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; From 833355f08d23f8c2ffc2f02999a8d54c2db88a19 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:18:03 +0100 Subject: [PATCH 046/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-mvc-socket --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename spring-security-modules/spring-security-mvc-socket/src/test/java/{org => com}/baeldung/SpringContextTest.java (97%) diff --git a/spring-security-modules/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-mvc-socket/src/test/java/com/baeldung/SpringContextTest.java similarity index 97% rename from spring-security-modules/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-mvc-socket/src/test/java/com/baeldung/SpringContextTest.java index 7b9c738904..4ef4948601 100644 --- a/spring-security-modules/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-mvc-socket/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From a12f9e878a142f32432c8efb26804bf0b096e859 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:20:39 +0100 Subject: [PATCH 047/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-react --- .../main/java/{org => com}/baeldung/spring/MvcConfig.java | 2 +- .../{org => com}/baeldung/spring/SecSecurityConfig.java | 2 +- .../spring-security-react/src/main/webapp/WEB-INF/web.xml | 2 +- .../test/java/{org => com}/baeldung/SpringContextTest.java | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) rename spring-security-modules/spring-security-react/src/main/java/{org => com}/baeldung/spring/MvcConfig.java (98%) rename spring-security-modules/spring-security-react/src/main/java/{org => com}/baeldung/spring/SecSecurityConfig.java (98%) rename spring-security-modules/spring-security-react/src/test/java/{org => com}/baeldung/SpringContextTest.java (82%) diff --git a/spring-security-modules/spring-security-react/src/main/java/org/baeldung/spring/MvcConfig.java b/spring-security-modules/spring-security-react/src/main/java/com/baeldung/spring/MvcConfig.java similarity index 98% rename from spring-security-modules/spring-security-react/src/main/java/org/baeldung/spring/MvcConfig.java rename to spring-security-modules/spring-security-react/src/main/java/com/baeldung/spring/MvcConfig.java index f970b84585..f8acdfe2ac 100644 --- a/spring-security-modules/spring-security-react/src/main/java/org/baeldung/spring/MvcConfig.java +++ b/spring-security-modules/spring-security-react/src/main/java/com/baeldung/spring/MvcConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-react/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-react/src/main/java/com/baeldung/spring/SecSecurityConfig.java similarity index 98% rename from spring-security-modules/spring-security-react/src/main/java/org/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-react/src/main/java/com/baeldung/spring/SecSecurityConfig.java index c64b433544..7b67028647 100644 --- a/spring-security-modules/spring-security-react/src/main/java/org/baeldung/spring/SecSecurityConfig.java +++ b/spring-security-modules/spring-security-react/src/main/java/com/baeldung/spring/SecSecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; diff --git a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/web.xml index eef48ec9b3..bc6f310147 100644 --- a/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/web.xml +++ b/spring-security-modules/spring-security-react/src/main/webapp/WEB-INF/web.xml @@ -15,7 +15,7 @@ contextConfigLocation - org.baeldung.spring + com.baeldung.spring diff --git a/spring-security-modules/spring-security-react/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-react/src/test/java/com/baeldung/SpringContextTest.java similarity index 82% rename from spring-security-modules/spring-security-react/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-react/src/test/java/com/baeldung/SpringContextTest.java index cfef3322dc..43ddb515eb 100644 --- a/spring-security-modules/spring-security-react/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-react/src/test/java/com/baeldung/SpringContextTest.java @@ -1,7 +1,7 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.spring.MvcConfig; -import org.baeldung.spring.SecSecurityConfig; +import com.baeldung.spring.MvcConfig; +import com.baeldung.spring.SecSecurityConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; From b993d0762d4bad1ee1ce5b0a17b001bed559d7b7 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:25:10 +0100 Subject: [PATCH 048/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-rest --- .../{org => com}/baeldung/errorhandling/ApiError.java | 2 +- .../errorhandling/CustomRestExceptionHandler.java | 2 +- .../{org => com}/baeldung/persistence/model/Foo.java | 2 +- .../baeldung/security/SecurityJavaConfig.java | 10 +++++----- .../security/SecurityWebApplicationInitializer.java | 2 +- ...ySavedRequestAwareAuthenticationSuccessHandler.java | 2 +- .../security/web/RestAuthenticationEntryPoint.java | 2 +- .../{org => com}/baeldung/spring/ClientWebConfig.java | 2 +- .../baeldung/spring/SecurityXmlConfig.java | 4 ++-- .../java/{org => com}/baeldung/spring/WebConfig.java | 4 ++-- .../{org => com}/baeldung/swagger2/SwaggerConfig.java | 4 ++-- .../baeldung/web/controller/AsyncController.java | 4 ++-- .../baeldung/web/controller/CustomController.java | 2 +- .../baeldung/web/controller/FooController.java | 4 ++-- .../baeldung/web/controller/RootController.java | 2 +- .../baeldung/web/error/CustomAccessDeniedHandler.java | 2 +- .../web/error/RestResponseEntityExceptionHandler.java | 2 +- .../web/exception/MyResourceNotFoundException.java | 2 +- .../baeldung/web/service/AsyncService.java | 2 +- .../baeldung/web/service/AsyncServiceImpl.java | 2 +- .../src/main/resources/webSecurityConfig.xml | 2 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- .../java/{org => com}/baeldung/SpringContextTest.java | 8 ++++---- .../baeldung/errorhandling/FooLiveTest.java | 5 ++--- .../baeldung/web/AsyncControllerIntegrationTest.java | 10 +++++----- .../{org => com}/baeldung/web/SwaggerLiveTest.java | 2 +- .../java/{org => com}/baeldung/web/TestConfig.java | 4 ++-- 27 files changed, 45 insertions(+), 46 deletions(-) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/errorhandling/ApiError.java (97%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/errorhandling/CustomRestExceptionHandler.java (99%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/persistence/model/Foo.java (97%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/security/SecurityJavaConfig.java (92%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/security/SecurityWebApplicationInitializer.java (90%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java (98%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/security/web/RestAuthenticationEntryPoint.java (95%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/spring/ClientWebConfig.java (91%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/spring/SecurityXmlConfig.java (77%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/spring/WebConfig.java (95%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/swagger2/SwaggerConfig.java (94%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/web/controller/AsyncController.java (94%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/web/controller/CustomController.java (90%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/web/controller/FooController.java (94%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/web/controller/RootController.java (94%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/web/error/CustomAccessDeniedHandler.java (96%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/web/error/RestResponseEntityExceptionHandler.java (99%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/web/exception/MyResourceNotFoundException.java (92%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/web/service/AsyncService.java (81%) rename spring-security-modules/spring-security-rest/src/main/java/{org => com}/baeldung/web/service/AsyncServiceImpl.java (97%) rename spring-security-modules/spring-security-rest/src/test/java/{org => com}/baeldung/SpringContextTest.java (77%) rename spring-security-modules/spring-security-rest/src/test/java/{org => com}/baeldung/errorhandling/FooLiveTest.java (96%) rename spring-security-modules/spring-security-rest/src/test/java/{org => com}/baeldung/web/AsyncControllerIntegrationTest.java (87%) rename spring-security-modules/spring-security-rest/src/test/java/{org => com}/baeldung/web/SwaggerLiveTest.java (95%) rename spring-security-modules/spring-security-rest/src/test/java/{org => com}/baeldung/web/TestConfig.java (89%) diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/errorhandling/ApiError.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/errorhandling/ApiError.java similarity index 97% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/errorhandling/ApiError.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/errorhandling/ApiError.java index 8a1ddd8882..0fba2deca5 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/errorhandling/ApiError.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/errorhandling/ApiError.java @@ -1,4 +1,4 @@ -package org.baeldung.errorhandling; +package com.baeldung.errorhandling; import java.util.Arrays; import java.util.List; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/errorhandling/CustomRestExceptionHandler.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/errorhandling/CustomRestExceptionHandler.java similarity index 99% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/errorhandling/CustomRestExceptionHandler.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/errorhandling/CustomRestExceptionHandler.java index cd4d58e60c..02bc0a2512 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/errorhandling/CustomRestExceptionHandler.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/errorhandling/CustomRestExceptionHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.errorhandling; +package com.baeldung.errorhandling; import java.util.ArrayList; import java.util.List; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/persistence/model/Foo.java similarity index 97% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/persistence/model/Foo.java index 05a7c7b9a0..d85cca1dcc 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/persistence/model/Foo.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/persistence/model/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import java.io.Serializable; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/SecurityJavaConfig.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/SecurityJavaConfig.java similarity index 92% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/SecurityJavaConfig.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/SecurityJavaConfig.java index 74623080b5..d20198c2bb 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/SecurityJavaConfig.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/SecurityJavaConfig.java @@ -1,8 +1,8 @@ -package org.baeldung.security; +package com.baeldung.security; -import org.baeldung.security.web.MySavedRequestAwareAuthenticationSuccessHandler; -import org.baeldung.security.web.RestAuthenticationEntryPoint; -import org.baeldung.web.error.CustomAccessDeniedHandler; +import com.baeldung.security.web.MySavedRequestAwareAuthenticationSuccessHandler; +import com.baeldung.security.web.RestAuthenticationEntryPoint; +import com.baeldung.web.error.CustomAccessDeniedHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -20,7 +20,7 @@ import org.springframework.security.web.authentication.SimpleUrlAuthenticationFa @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) -@ComponentScan("org.baeldung.security") +@ComponentScan("com.baeldung.security") public class SecurityJavaConfig extends WebSecurityConfigurerAdapter { @Autowired diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/SecurityWebApplicationInitializer.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java similarity index 90% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/SecurityWebApplicationInitializer.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java index 33978962bb..77e70d5b84 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/SecurityWebApplicationInitializer.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/SecurityWebApplicationInitializer.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import org.springframework.security.web.context.AbstractSecurityWebApplicationInitializer; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java similarity index 98% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java index c56568e979..2d74ed9dca 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/web/MySavedRequestAwareAuthenticationSuccessHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.security.web; +package com.baeldung.security.web; import java.io.IOException; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/web/RestAuthenticationEntryPoint.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/web/RestAuthenticationEntryPoint.java similarity index 95% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/web/RestAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/web/RestAuthenticationEntryPoint.java index 643e2f0575..162ee46727 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/security/web/RestAuthenticationEntryPoint.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/security/web/RestAuthenticationEntryPoint.java @@ -1,4 +1,4 @@ -package org.baeldung.security.web; +package com.baeldung.security.web; import java.io.IOException; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/ClientWebConfig.java similarity index 91% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/ClientWebConfig.java index 8e20358a5a..db24817f5b 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/ClientWebConfig.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/ClientWebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.EnableWebMvc; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/SecurityXmlConfig.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/SecurityXmlConfig.java similarity index 77% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/SecurityXmlConfig.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/SecurityXmlConfig.java index 0830a1ebe1..92f7cea784 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/SecurityXmlConfig.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/SecurityXmlConfig.java @@ -1,10 +1,10 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.ComponentScan; // @Configuration // @ImportResource({ "classpath:webSecurityConfig.xml" }) -@ComponentScan("org.baeldung.security") +@ComponentScan("com.baeldung.security") public class SecurityXmlConfig { public SecurityXmlConfig() { diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/WebConfig.java similarity index 95% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/WebConfig.java index dba07dc4e5..84b211a9bd 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/spring/WebConfig.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/spring/WebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -12,7 +12,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration -@ComponentScan("org.baeldung.web") +@ComponentScan("com.baeldung.web") @EnableWebMvc @EnableAsync public class WebConfig implements WebMvcConfigurer { diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/swagger2/SwaggerConfig.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/swagger2/SwaggerConfig.java similarity index 94% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/swagger2/SwaggerConfig.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/swagger2/SwaggerConfig.java index 67c760353d..c8c4227ebf 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/swagger2/SwaggerConfig.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/swagger2/SwaggerConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.swagger2; +package com.baeldung.swagger2; import static com.google.common.collect.Lists.newArrayList; @@ -25,7 +25,7 @@ public class SwaggerConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).select() - .apis(RequestHandlerSelectors.basePackage("org.baeldung.web.controller")) + .apis(RequestHandlerSelectors.basePackage("com.baeldung.web.controller")) .paths(PathSelectors.ant("/foos/*")) .build() .apiInfo(apiInfo()) diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/AsyncController.java similarity index 94% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/AsyncController.java index f6f1c392cb..c2123913c6 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/AsyncController.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/AsyncController.java @@ -1,11 +1,11 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import java.util.concurrent.Callable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.baeldung.web.service.AsyncService; +import com.baeldung.web.service.AsyncService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Controller; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomController.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/CustomController.java similarity index 90% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomController.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/CustomController.java index 7d40b9bb8d..d833d3af7a 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/CustomController.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/CustomController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/FooController.java similarity index 94% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/FooController.java index f914f82215..033bf2d1e3 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/FooController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic; @@ -6,7 +6,7 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; -import org.baeldung.persistence.model.Foo; +import com.baeldung.persistence.model.Foo; import org.springframework.http.HttpStatus; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PathVariable; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/RootController.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/RootController.java similarity index 94% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/RootController.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/RootController.java index 4253ed7a59..3abbe8a309 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/controller/RootController.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/controller/RootController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/error/CustomAccessDeniedHandler.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/error/CustomAccessDeniedHandler.java similarity index 96% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/error/CustomAccessDeniedHandler.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/error/CustomAccessDeniedHandler.java index cc07417427..6c686cd9e9 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/error/CustomAccessDeniedHandler.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/error/CustomAccessDeniedHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.web.error; +package com.baeldung.web.error; import java.io.IOException; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java similarity index 99% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java index 9ff4f040fe..9e6ae78d27 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/error/RestResponseEntityExceptionHandler.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/error/RestResponseEntityExceptionHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.web.error; +package com.baeldung.web.error; import org.springframework.dao.DataAccessException; import org.springframework.dao.DataIntegrityViolationException; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java similarity index 92% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java index 14b61f9832..fd002efc28 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/exception/MyResourceNotFoundException.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/exception/MyResourceNotFoundException.java @@ -1,4 +1,4 @@ -package org.baeldung.web.exception; +package com.baeldung.web.exception; public final class MyResourceNotFoundException extends RuntimeException { diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncService.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/service/AsyncService.java similarity index 81% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncService.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/service/AsyncService.java index 1ba4dfa4cb..ee07313ee8 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncService.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/service/AsyncService.java @@ -1,4 +1,4 @@ -package org.baeldung.web.service; +package com.baeldung.web.service; import java.util.concurrent.Callable; diff --git a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/service/AsyncServiceImpl.java similarity index 97% rename from spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java rename to spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/service/AsyncServiceImpl.java index d6d7f53dd7..8aebbc3234 100644 --- a/spring-security-modules/spring-security-rest/src/main/java/org/baeldung/web/service/AsyncServiceImpl.java +++ b/spring-security-modules/spring-security-rest/src/main/java/com/baeldung/web/service/AsyncServiceImpl.java @@ -1,4 +1,4 @@ -package org.baeldung.web.service; +package com.baeldung.web.service; import java.util.concurrent.Callable; diff --git a/spring-security-modules/spring-security-rest/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-rest/src/main/resources/webSecurityConfig.xml index edd3cba39c..2c0a0bc774 100644 --- a/spring-security-modules/spring-security-rest/src/main/resources/webSecurityConfig.xml +++ b/spring-security-modules/spring-security-rest/src/main/resources/webSecurityConfig.xml @@ -30,7 +30,7 @@ + class="com.baeldung.security.MySavedRequestAwareAuthenticationSuccessHandler" /> diff --git a/spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/web.xml index 3195603837..663c17bc56 100644 --- a/spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/web.xml +++ b/spring-security-modules/spring-security-rest/src/main/webapp/WEB-INF/web.xml @@ -17,7 +17,7 @@ contextConfigLocation - org.baeldung.spring + com.baeldung.spring diff --git a/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/SpringContextTest.java similarity index 77% rename from spring-security-modules/spring-security-rest/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-rest/src/test/java/com/baeldung/SpringContextTest.java index 11586ce670..bcc66558cb 100644 --- a/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/SpringContextTest.java @@ -1,8 +1,8 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.security.SecurityJavaConfig; -import org.baeldung.spring.ClientWebConfig; -import org.baeldung.spring.WebConfig; +import com.baeldung.security.SecurityJavaConfig; +import com.baeldung.spring.ClientWebConfig; +import com.baeldung.spring.WebConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; diff --git a/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/errorhandling/FooLiveTest.java b/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/errorhandling/FooLiveTest.java similarity index 96% rename from spring-security-modules/spring-security-rest/src/test/java/org/baeldung/errorhandling/FooLiveTest.java rename to spring-security-modules/spring-security-rest/src/test/java/com/baeldung/errorhandling/FooLiveTest.java index 8d1db5736f..e08a24676a 100644 --- a/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/errorhandling/FooLiveTest.java +++ b/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/errorhandling/FooLiveTest.java @@ -1,10 +1,9 @@ -package org.baeldung.errorhandling; +package com.baeldung.errorhandling; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import org.baeldung.errorhandling.ApiError; -import org.baeldung.web.TestConfig; +import com.baeldung.web.TestConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.http.HttpStatus; diff --git a/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/AsyncControllerIntegrationTest.java b/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/AsyncControllerIntegrationTest.java similarity index 87% rename from spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/AsyncControllerIntegrationTest.java rename to spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/AsyncControllerIntegrationTest.java index 1e5e1b7d85..bf93c14f1f 100644 --- a/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/AsyncControllerIntegrationTest.java +++ b/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/AsyncControllerIntegrationTest.java @@ -1,9 +1,9 @@ -package org.baeldung.web; +package com.baeldung.web; -import org.baeldung.security.SecurityJavaConfig; -import org.baeldung.spring.ClientWebConfig; -import org.baeldung.spring.WebConfig; -import org.baeldung.web.controller.AsyncController; +import com.baeldung.security.SecurityJavaConfig; +import com.baeldung.spring.ClientWebConfig; +import com.baeldung.spring.WebConfig; +import com.baeldung.web.controller.AsyncController; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java b/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/SwaggerLiveTest.java similarity index 95% rename from spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java rename to spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/SwaggerLiveTest.java index 792b3e28ce..3f86b63503 100644 --- a/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java +++ b/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/SwaggerLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung.web; +package com.baeldung.web; import static org.junit.Assert.assertEquals; diff --git a/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/TestConfig.java b/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/TestConfig.java similarity index 89% rename from spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/TestConfig.java rename to spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/TestConfig.java index 61bd6e776b..ddb7240611 100644 --- a/spring-security-modules/spring-security-rest/src/test/java/org/baeldung/web/TestConfig.java +++ b/spring-security-modules/spring-security-rest/src/test/java/com/baeldung/web/TestConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.web; +package com.baeldung.web; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -7,7 +7,7 @@ import org.springframework.web.multipart.MultipartResolver; import org.springframework.web.multipart.commons.CommonsMultipartResolver; @Configuration -@ComponentScan({ "org.baeldung.web" }) +@ComponentScan({ "com.baeldung.web" }) public class TestConfig { @Bean From 43299dc08224064454c8cf00a36b4f2fecebd03d Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:27:36 +0100 Subject: [PATCH 049/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-rest-basic-auth --- .../baeldung/basic/MyBasicAuthenticationEntryPoint.java | 2 +- .../HttpComponentsClientHttpRequestFactoryBasicAuth.java | 2 +- .../{org => com}/baeldung/client/RestTemplateFactory.java | 2 +- .../{org => com}/baeldung/client/spring/ClientConfig.java | 2 +- .../main/java/{org => com}/baeldung/filter/CustomFilter.java | 2 +- .../baeldung/filter/CustomWebSecurityConfigurerAdapter.java | 4 ++-- .../MySavedRequestAwareAuthenticationSuccessHandler.java | 2 +- .../baeldung/security/RestAuthenticationEntryPoint.java | 2 +- .../java/{org => com}/baeldung/spring/SecSecurityConfig.java | 2 +- .../src/main/java/{org => com}/baeldung/spring/WebConfig.java | 2 +- .../{org => com}/baeldung/web/controller/BarController.java | 4 ++-- .../{org => com}/baeldung/web/controller/FooController.java | 4 ++-- .../src/main/java/{org => com}/baeldung/web/dto/Bar.java | 2 +- .../src/main/java/{org => com}/baeldung/web/dto/Foo.java | 2 +- .../src/main/resources/webSecurityConfig.xml | 2 +- .../test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 16 files changed, 19 insertions(+), 19 deletions(-) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/basic/MyBasicAuthenticationEntryPoint.java (97%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java (97%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/client/RestTemplateFactory.java (97%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/client/spring/ClientConfig.java (88%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/filter/CustomFilter.java (94%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/filter/CustomWebSecurityConfigurerAdapter.java (95%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java (98%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/security/RestAuthenticationEntryPoint.java (96%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/spring/SecSecurityConfig.java (93%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/spring/WebConfig.java (96%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/web/controller/BarController.java (95%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/web/controller/FooController.java (92%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/web/dto/Bar.java (86%) rename spring-security-modules/spring-security-rest-basic-auth/src/main/java/{org => com}/baeldung/web/dto/Foo.java (86%) rename spring-security-modules/spring-security-rest-basic-auth/src/test/java/{org => com}/baeldung/SpringContextTest.java (94%) diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java similarity index 97% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java index f440bbd10c..07344819c0 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/basic/MyBasicAuthenticationEntryPoint.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/basic/MyBasicAuthenticationEntryPoint.java @@ -1,4 +1,4 @@ -package org.baeldung.basic; +package com.baeldung.basic; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java similarity index 97% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java index a2f51d343b..81f82a2c1c 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/HttpComponentsClientHttpRequestFactoryBasicAuth.java @@ -1,4 +1,4 @@ -package org.baeldung.client; +package com.baeldung.client; import java.net.URI; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/RestTemplateFactory.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/RestTemplateFactory.java similarity index 97% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/RestTemplateFactory.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/RestTemplateFactory.java index 3ed0bc82b7..aac4f8cebd 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/RestTemplateFactory.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/RestTemplateFactory.java @@ -1,4 +1,4 @@ -package org.baeldung.client; +package com.baeldung.client; import org.apache.http.HttpHost; import org.springframework.beans.factory.FactoryBean; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/spring/ClientConfig.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/spring/ClientConfig.java similarity index 88% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/spring/ClientConfig.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/spring/ClientConfig.java index 73e602855c..dd834628a6 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/client/spring/ClientConfig.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/spring/ClientConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.client.spring; +package com.baeldung.client.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomFilter.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/filter/CustomFilter.java similarity index 94% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomFilter.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/filter/CustomFilter.java index 01e5b0b59d..6bb12610fa 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomFilter.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/filter/CustomFilter.java @@ -1,4 +1,4 @@ -package org.baeldung.filter; +package com.baeldung.filter; import org.springframework.web.filter.GenericFilterBean; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomWebSecurityConfigurerAdapter.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/filter/CustomWebSecurityConfigurerAdapter.java similarity index 95% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomWebSecurityConfigurerAdapter.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/filter/CustomWebSecurityConfigurerAdapter.java index 7ca2a80c52..fb597e46c8 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/filter/CustomWebSecurityConfigurerAdapter.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/filter/CustomWebSecurityConfigurerAdapter.java @@ -1,6 +1,6 @@ -package org.baeldung.filter; +package com.baeldung.filter; -import org.baeldung.security.RestAuthenticationEntryPoint; +import com.baeldung.security.RestAuthenticationEntryPoint; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java similarity index 98% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java index 698052fa2b..7dc53e3e1e 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import java.io.IOException; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java similarity index 96% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java index 77aa32ff97..1ae89adb89 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import java.io.IOException; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java similarity index 93% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java index 4ce80dab9f..cddef4d508 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/SecSecurityConfig.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/WebConfig.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/WebConfig.java similarity index 96% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/WebConfig.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/WebConfig.java index 5876e1307b..e9d0d277f1 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/spring/WebConfig.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/WebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring; +package com.baeldung.spring; import java.util.List; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/BarController.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/controller/BarController.java similarity index 95% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/BarController.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/controller/BarController.java index 5f32b9f73b..6f7dc91e7e 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/BarController.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/controller/BarController.java @@ -1,9 +1,9 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import java.nio.charset.Charset; import org.apache.commons.codec.binary.Base64; -import org.baeldung.web.dto.Bar; +import com.baeldung.web.dto.Bar; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.http.HttpHeaders; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/controller/FooController.java similarity index 92% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/controller/FooController.java index b50edb2dcf..461a5e351a 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/controller/FooController.java @@ -1,6 +1,6 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; -import org.baeldung.web.dto.Foo; +import com.baeldung.web.dto.Foo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; import org.springframework.security.access.prepost.PreAuthorize; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Bar.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/dto/Bar.java similarity index 86% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Bar.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/dto/Bar.java index d33e39a823..eb139b0ec1 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Bar.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/dto/Bar.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.web.dto; import java.io.Serializable; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Foo.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/dto/Foo.java similarity index 86% rename from spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Foo.java rename to spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/dto/Foo.java index 09c1dac933..23cfab132d 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/org/baeldung/web/dto/Foo.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/web/dto/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.web.dto; import java.io.Serializable; diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-rest-basic-auth/src/main/resources/webSecurityConfig.xml index a93dc841b6..2ff9a1de15 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/resources/webSecurityConfig.xml +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/resources/webSecurityConfig.xml @@ -23,6 +23,6 @@ - + \ No newline at end of file diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-rest-basic-auth/src/test/java/com/baeldung/SpringContextTest.java similarity index 94% rename from spring-security-modules/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-rest-basic-auth/src/test/java/com/baeldung/SpringContextTest.java index f54cbf3b7b..91b34757e2 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From 4e839f8e324d3bf68b8d2dac5ba13d96f0350472 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:29:21 +0100 Subject: [PATCH 050/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-rest-custom --- .../{org => com}/baeldung/config/MainWebAppInitializer.java | 2 +- .../baeldung/config/child/MethodSecurityConfig.java | 2 +- .../java/{org => com}/baeldung/config/child/WebConfig.java | 2 +- .../{org => com}/baeldung/config/parent/SecurityConfig.java | 4 ++-- .../{org => com}/baeldung/config/parent/ServiceConfig.java | 2 +- .../baeldung/security/AuthenticationFacade.java | 2 +- .../baeldung/security/CustomAuthenticationProvider.java | 2 +- .../baeldung/security/IAuthenticationFacade.java | 2 +- .../MySavedRequestAwareAuthenticationSuccessHandler.java | 2 +- .../baeldung/security/RestAuthenticationEntryPoint.java | 2 +- .../main/java/{org => com}/baeldung/service/FooService.java | 4 ++-- .../java/{org => com}/baeldung/service/IFooService.java | 4 ++-- .../java/{org => com}/baeldung/service/RunAsService.java | 2 +- .../{org => com}/baeldung/web/controller/FooController.java | 6 +++--- .../controller/GetUserWithCustomInterfaceController.java | 4 ++-- .../controller/GetUserWithHTTPServletRequestController.java | 2 +- .../baeldung/web/controller/RunAsController.java | 2 +- .../baeldung/web/controller/SecurityController.java | 2 +- .../baeldung/web/controller/SecurityController1.java | 2 +- .../baeldung/web/controller/SecurityController3.java | 2 +- .../baeldung/web/controller/ViewController.java | 2 +- .../src/main/java/{org => com}/baeldung/web/dto/Foo.java | 2 +- 22 files changed, 28 insertions(+), 28 deletions(-) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/config/MainWebAppInitializer.java (98%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/config/child/MethodSecurityConfig.java (97%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/config/child/WebConfig.java (98%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/config/parent/SecurityConfig.java (93%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/config/parent/ServiceConfig.java (95%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/security/AuthenticationFacade.java (93%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/security/CustomAuthenticationProvider.java (98%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/security/IAuthenticationFacade.java (82%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java (98%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/security/RestAuthenticationEntryPoint.java (96%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/service/FooService.java (93%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/service/IFooService.java (52%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/service/RunAsService.java (94%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/web/controller/FooController.java (91%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/web/controller/GetUserWithCustomInterfaceController.java (90%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/web/controller/GetUserWithHTTPServletRequestController.java (95%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/web/controller/RunAsController.java (95%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/web/controller/SecurityController.java (94%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/web/controller/SecurityController1.java (97%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/web/controller/SecurityController3.java (95%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/web/controller/ViewController.java (90%) rename spring-security-modules/spring-security-rest-custom/src/main/java/{org => com}/baeldung/web/dto/Foo.java (86%) diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/MainWebAppInitializer.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/MainWebAppInitializer.java similarity index 98% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/MainWebAppInitializer.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/MainWebAppInitializer.java index 0a11cdab72..f24c96a686 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/MainWebAppInitializer.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/MainWebAppInitializer.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import java.util.Set; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/child/MethodSecurityConfig.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/MethodSecurityConfig.java similarity index 97% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/child/MethodSecurityConfig.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/MethodSecurityConfig.java index bc9a9f161b..7fb282ae8b 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/child/MethodSecurityConfig.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/MethodSecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config.child; +package com.baeldung.config.child; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/child/WebConfig.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/WebConfig.java similarity index 98% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/child/WebConfig.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/WebConfig.java index 7cbbcf31fa..0c95acc177 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/child/WebConfig.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/WebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config.child; +package com.baeldung.config.child; import java.util.List; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/SecurityConfig.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/SecurityConfig.java similarity index 93% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/SecurityConfig.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/SecurityConfig.java index fb3880a33f..36ce898fb6 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/SecurityConfig.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/SecurityConfig.java @@ -1,6 +1,6 @@ -package org.baeldung.config.parent; +package com.baeldung.config.parent; -import org.baeldung.security.CustomAuthenticationProvider; +import com.baeldung.security.CustomAuthenticationProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/ServiceConfig.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/ServiceConfig.java similarity index 95% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/ServiceConfig.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/ServiceConfig.java index 02af0165f4..6e45a32a87 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/config/parent/ServiceConfig.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/ServiceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config.parent; +package com.baeldung.config.parent; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/AuthenticationFacade.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/AuthenticationFacade.java similarity index 93% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/AuthenticationFacade.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/AuthenticationFacade.java index 5a3c77b070..bcf0ef0499 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/AuthenticationFacade.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/AuthenticationFacade.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/CustomAuthenticationProvider.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/CustomAuthenticationProvider.java similarity index 98% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/CustomAuthenticationProvider.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/CustomAuthenticationProvider.java index 4b9b3e8ee9..8e67714431 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/CustomAuthenticationProvider.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/CustomAuthenticationProvider.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import java.util.ArrayList; import java.util.List; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/IAuthenticationFacade.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/IAuthenticationFacade.java similarity index 82% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/IAuthenticationFacade.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/IAuthenticationFacade.java index d1223e41cf..bffbc3fef0 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/IAuthenticationFacade.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/IAuthenticationFacade.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import org.springframework.security.core.Authentication; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java similarity index 98% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java index 698052fa2b..7dc53e3e1e 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/MySavedRequestAwareAuthenticationSuccessHandler.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import java.io.IOException; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java similarity index 96% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java index 77aa32ff97..1ae89adb89 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/security/RestAuthenticationEntryPoint.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/security/RestAuthenticationEntryPoint.java @@ -1,4 +1,4 @@ -package org.baeldung.security; +package com.baeldung.security; import java.io.IOException; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/FooService.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/FooService.java similarity index 93% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/FooService.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/FooService.java index cb374ae4b0..f97c357566 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/FooService.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/FooService.java @@ -1,6 +1,6 @@ -package org.baeldung.service; +package com.baeldung.service; -import org.baeldung.web.dto.Foo; +import com.baeldung.web.dto.Foo; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/IFooService.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/IFooService.java similarity index 52% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/IFooService.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/IFooService.java index de234b1b45..3ab1faf98b 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/IFooService.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/IFooService.java @@ -1,6 +1,6 @@ -package org.baeldung.service; +package com.baeldung.service; -import org.baeldung.web.dto.Foo; +import com.baeldung.web.dto.Foo; public interface IFooService { diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/RunAsService.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/RunAsService.java similarity index 94% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/RunAsService.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/RunAsService.java index a6320f8b81..412330006b 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/service/RunAsService.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/service/RunAsService.java @@ -1,4 +1,4 @@ -package org.baeldung.service; +package com.baeldung.service; import org.springframework.security.access.annotation.Secured; import org.springframework.security.core.Authentication; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/FooController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/FooController.java similarity index 91% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/FooController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/FooController.java index 74fd5e403f..696dcccd02 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/FooController.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/FooController.java @@ -1,7 +1,7 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; -import org.baeldung.service.IFooService; -import org.baeldung.web.dto.Foo; +import com.baeldung.service.IFooService; +import com.baeldung.web.dto.Foo; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithCustomInterfaceController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithCustomInterfaceController.java similarity index 90% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithCustomInterfaceController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithCustomInterfaceController.java index b8521d6663..4166ca9102 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithCustomInterfaceController.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithCustomInterfaceController.java @@ -1,6 +1,6 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; -import org.baeldung.security.IAuthenticationFacade; +import com.baeldung.security.IAuthenticationFacade; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.stereotype.Controller; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithHTTPServletRequestController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithHTTPServletRequestController.java similarity index 95% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithHTTPServletRequestController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithHTTPServletRequestController.java index ace5688697..2e6951132d 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/GetUserWithHTTPServletRequestController.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/GetUserWithHTTPServletRequestController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import java.security.Principal; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/RunAsController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/RunAsController.java similarity index 95% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/RunAsController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/RunAsController.java index 08f39aa5f2..13a3f45bf3 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/RunAsController.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/RunAsController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import org.springframework.security.access.annotation.Secured; import org.springframework.security.core.Authentication; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController.java similarity index 94% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController.java index 7cf57a5275..f35940f54c 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import java.security.Principal; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController1.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController1.java similarity index 97% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController1.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController1.java index d06f15af93..1951e04dcb 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController1.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController1.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.ApplicationEventPublisher; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController3.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController3.java similarity index 95% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController3.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController3.java index fb207b43dd..2dcb98286b 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/SecurityController3.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/SecurityController3.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import org.springframework.security.core.Authentication; import org.springframework.security.core.userdetails.UserDetails; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/ViewController.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/ViewController.java similarity index 90% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/ViewController.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/ViewController.java index fbcb9b979e..870331f134 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/controller/ViewController.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/controller/ViewController.java @@ -1,4 +1,4 @@ -package org.baeldung.web.controller; +package com.baeldung.web.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/dto/Foo.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/dto/Foo.java similarity index 86% rename from spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/dto/Foo.java rename to spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/dto/Foo.java index 09c1dac933..23cfab132d 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/org/baeldung/web/dto/Foo.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/web/dto/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.web.dto; +package com.baeldung.web.dto; import java.io.Serializable; From 20e72465ccad732536a2be7b9ef2f4b7f479a2ab Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:33:21 +0100 Subject: [PATCH 051/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-sso --- .../java/{org => com}/baeldung/config/AuthServerConfig.java | 2 +- .../baeldung/config/AuthorizationServerApplication.java | 2 +- .../java/{org => com}/baeldung/config/SecurityConfig.java | 2 +- .../java/{org => com}/baeldung/config/UserController.java | 2 +- .../test/java/{org => com}/baeldung/SpringContextTest.java | 4 ++-- .../java/{org => com}/baeldung/UserInfoEndpointLiveTest.java | 2 +- .../src/main/java/com}/baeldung/config/UiApplication.java | 4 ++-- .../src/main/java/com}/baeldung/config/UiSecurityConfig.java | 2 +- .../src/main/java/com}/baeldung/config/UiWebConfig.java | 2 +- .../src/test/java/com}/baeldung/SpringContextTest.java | 4 ++-- .../src/main/java/com}/baeldung/config/UiApplication.java | 4 ++-- .../src/main/java/com}/baeldung/config/UiSecurityConfig.java | 2 +- .../src/main/java/com}/baeldung/config/UiWebConfig.java | 2 +- .../src/test/java/com}/baeldung/SpringContextTest.java | 4 ++-- 14 files changed, 19 insertions(+), 19 deletions(-) rename spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/{org => com}/baeldung/config/AuthServerConfig.java (98%) rename spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/{org => com}/baeldung/config/AuthorizationServerApplication.java (95%) rename spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/{org => com}/baeldung/config/SecurityConfig.java (98%) rename spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/{org => com}/baeldung/config/UserController.java (92%) rename spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/{org => com}/baeldung/SpringContextTest.java (86%) rename spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/{org => com}/baeldung/UserInfoEndpointLiveTest.java (99%) rename spring-security-modules/spring-security-sso/{spring-security-sso-ui/src/main/java/org => spring-security-sso-ui-2/src/main/java/com}/baeldung/config/UiApplication.java (95%) rename spring-security-modules/spring-security-sso/{spring-security-sso-ui/src/main/java/org => spring-security-sso-ui-2/src/main/java/com}/baeldung/config/UiSecurityConfig.java (96%) rename spring-security-modules/spring-security-sso/{spring-security-sso-ui/src/main/java/org => spring-security-sso-ui-2/src/main/java/com}/baeldung/config/UiWebConfig.java (97%) rename spring-security-modules/spring-security-sso/{spring-security-sso-ui/src/test/java/org => spring-security-sso-ui-2/src/test/java/com}/baeldung/SpringContextTest.java (88%) rename spring-security-modules/spring-security-sso/{spring-security-sso-ui-2/src/main/java/org => spring-security-sso-ui/src/main/java/com}/baeldung/config/UiApplication.java (95%) rename spring-security-modules/spring-security-sso/{spring-security-sso-ui-2/src/main/java/org => spring-security-sso-ui/src/main/java/com}/baeldung/config/UiSecurityConfig.java (96%) rename spring-security-modules/spring-security-sso/{spring-security-sso-ui-2/src/main/java/org => spring-security-sso-ui/src/main/java/com}/baeldung/config/UiWebConfig.java (97%) rename spring-security-modules/spring-security-sso/{spring-security-sso-ui-2/src/test/java/org => spring-security-sso-ui/src/test/java/com}/baeldung/SpringContextTest.java (88%) diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthServerConfig.java similarity index 98% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthServerConfig.java index 0835f3d721..9a6400abdf 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthServerConfig.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthServerConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthorizationServerApplication.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthorizationServerApplication.java similarity index 95% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthorizationServerApplication.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthorizationServerApplication.java index b74d2f144c..5cfcb2bb5b 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/AuthorizationServerApplication.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/AuthorizationServerApplication.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/SecurityConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/SecurityConfig.java similarity index 98% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/SecurityConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/SecurityConfig.java index 2254de8e39..29c7549753 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/SecurityConfig.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/SecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/UserController.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/UserController.java similarity index 92% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/UserController.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/UserController.java index 28128f9d97..80415fbd30 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/org/baeldung/config/UserController.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/main/java/com/baeldung/config/UserController.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import java.security.Principal; diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/SpringContextTest.java similarity index 86% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/SpringContextTest.java index f677f683b2..1f07837da9 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/SpringContextTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.config.AuthorizationServerApplication; +import com.baeldung.config.AuthorizationServerApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/UserInfoEndpointLiveTest.java b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/UserInfoEndpointLiveTest.java similarity index 99% rename from spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/UserInfoEndpointLiveTest.java rename to spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/UserInfoEndpointLiveTest.java index ffdb1df8fe..104f980dd2 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/UserInfoEndpointLiveTest.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/src/test/java/com/baeldung/UserInfoEndpointLiveTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import static org.junit.Assert.assertEquals; import java.util.HashMap; diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiApplication.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiApplication.java similarity index 95% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiApplication.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiApplication.java index 07d875d805..ca178cfa7e 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiApplication.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiApplication.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -6,10 +6,10 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer import org.springframework.context.annotation.Bean; import org.springframework.web.context.request.RequestContextListener; - @SpringBootApplication public class UiApplication extends SpringBootServletInitializer { + @Bean public RequestContextListener requestContextListener() { return new RequestContextListener(); diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiSecurityConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiSecurityConfig.java similarity index 96% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiSecurityConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiSecurityConfig.java index de81ada9e0..7ef1392659 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiSecurityConfig.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiSecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiWebConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiWebConfig.java similarity index 97% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiWebConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiWebConfig.java index c17bb85173..ae5008daa3 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/org/baeldung/config/UiWebConfig.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/com/baeldung/config/UiWebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/test/java/com/baeldung/SpringContextTest.java similarity index 88% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/test/java/com/baeldung/SpringContextTest.java index 61a2a022ed..1eeab34e94 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/test/java/com/baeldung/SpringContextTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.config.UiApplication; +import com.baeldung.config.UiApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiApplication.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiApplication.java similarity index 95% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiApplication.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiApplication.java index 0c20853aed..16d94d6d80 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiApplication.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiApplication.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -6,10 +6,10 @@ import org.springframework.boot.web.servlet.support.SpringBootServletInitializer import org.springframework.context.annotation.Bean; import org.springframework.web.context.request.RequestContextListener; + @SpringBootApplication public class UiApplication extends SpringBootServletInitializer { - @Bean public RequestContextListener requestContextListener() { return new RequestContextListener(); diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiSecurityConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiSecurityConfig.java similarity index 96% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiSecurityConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiSecurityConfig.java index de81ada9e0..7ef1392659 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiSecurityConfig.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiSecurityConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiWebConfig.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiWebConfig.java similarity index 97% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiWebConfig.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiWebConfig.java index c17bb85173..ae5008daa3 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/main/java/org/baeldung/config/UiWebConfig.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/main/java/com/baeldung/config/UiWebConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/test/java/com/baeldung/SpringContextTest.java similarity index 88% rename from spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-sso/spring-security-sso-ui/src/test/java/com/baeldung/SpringContextTest.java index 61a2a022ed..1eeab34e94 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui/src/test/java/com/baeldung/SpringContextTest.java @@ -1,6 +1,6 @@ -package org.baeldung; +package com.baeldung; -import org.baeldung.config.UiApplication; +import com.baeldung.config.UiApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; From abc4259c99d0a2cf1dfac4949cf809f1d8bcf43f Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:34:53 +0100 Subject: [PATCH 052/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-x509 --- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- .../src/test/java/{org => com}/baeldung/SpringContextTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/{org => com}/baeldung/SpringContextTest.java (95%) rename spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/{org => com}/baeldung/SpringContextTest.java (95%) diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/SpringContextTest.java similarity index 95% rename from spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/SpringContextTest.java index 5c65dd3e8a..1c89f706ab 100644 --- a/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-x509/spring-security-x509-basic-auth/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextTest.java b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/SpringContextTest.java similarity index 95% rename from spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextTest.java rename to spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/SpringContextTest.java index 5c65dd3e8a..1c89f706ab 100644 --- a/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextTest.java +++ b/spring-security-modules/spring-security-x509/spring-security-x509-client-auth/src/test/java/com/baeldung/SpringContextTest.java @@ -1,4 +1,4 @@ -package org.baeldung; +package com.baeldung; import org.junit.Test; import org.junit.runner.RunWith; From 8586e8de2ac7b35d0970f559ecd5027f713298ea Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:41:34 +0100 Subject: [PATCH 053/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-mvc-digest-auth (finalized) --- .../src/main/java/com/baeldung/spring/SecSecurityConfig.java | 2 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java index cddef4d508..4ba9d47f8d 100644 --- a/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java +++ b/spring-security-modules/spring-security-mvc-digest-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java @@ -6,7 +6,7 @@ import org.springframework.context.annotation.ImportResource; @Configuration @ImportResource({ "classpath:webSecurityConfig.xml" }) -@ComponentScan("org.baeldung.security") +@ComponentScan("com.baeldung.security") public class SecSecurityConfig { public SecSecurityConfig() { diff --git a/spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/web.xml index bebd5d9cd3..25f5a91932 100644 --- a/spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/web.xml +++ b/spring-security-modules/spring-security-mvc-digest-auth/src/main/webapp/WEB-INF/web.xml @@ -16,7 +16,7 @@ contextConfigLocation - org.baeldung.spring + com.baeldung.spring From 06347b6f1fcef93425b7e2bc2ff72b6ea3975684 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:42:33 +0100 Subject: [PATCH 054/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-mvc-login --- .../src/main/resources/channelWebSecurityConfig.xml | 2 +- .../src/main/resources/webSecurityConfig.xml | 6 +++--- .../src/test/resources/mvc-servlet.xml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml b/spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml index eff3e1a1a1..8b8b4cd2f3 100644 --- a/spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml +++ b/spring-security-modules/spring-security-mvc-login/src/main/resources/channelWebSecurityConfig.xml @@ -23,7 +23,7 @@ - + diff --git a/spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml b/spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml index 8a83bf5e93..543792fadc 100644 --- a/spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml +++ b/spring-security-modules/spring-security-mvc-login/src/main/resources/webSecurityConfig.xml @@ -25,11 +25,11 @@ - + - + - + diff --git a/spring-security-modules/spring-security-mvc-login/src/test/resources/mvc-servlet.xml b/spring-security-modules/spring-security-mvc-login/src/test/resources/mvc-servlet.xml index 4568d319b8..aee837c977 100644 --- a/spring-security-modules/spring-security-mvc-login/src/test/resources/mvc-servlet.xml +++ b/spring-security-modules/spring-security-mvc-login/src/test/resources/mvc-servlet.xml @@ -3,6 +3,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> - + \ No newline at end of file From 15ead38004ecbed71101788557425c5412f94ff6 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:43:08 +0100 Subject: [PATCH 055/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-rest-custom (finalized) --- .../main/java/com/baeldung/config/MainWebAppInitializer.java | 4 ++-- .../src/main/java/com/baeldung/config/child/WebConfig.java | 2 +- .../main/java/com/baeldung/config/parent/SecurityConfig.java | 2 +- .../main/java/com/baeldung/config/parent/ServiceConfig.java | 2 +- .../src/main/webapp/WEB-INF/web_old.xml | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/MainWebAppInitializer.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/MainWebAppInitializer.java index f24c96a686..4957a2604a 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/MainWebAppInitializer.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/MainWebAppInitializer.java @@ -30,7 +30,7 @@ public class MainWebAppInitializer implements WebApplicationInitializer { // Create the 'root' Spring application context final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext(); - root.scan("org.baeldung.config.parent"); + root.scan("com.baeldung.config.parent"); // root.getEnvironment().setDefaultProfiles("embedded"); // Manages the lifecycle of the root application context @@ -38,7 +38,7 @@ public class MainWebAppInitializer implements WebApplicationInitializer { // Handles requests into the application final AnnotationConfigWebApplicationContext childWebApplicationContext = new AnnotationConfigWebApplicationContext(); - childWebApplicationContext.scan("org.baeldung.config.child"); + childWebApplicationContext.scan("com.baeldung.config.child"); final ServletRegistration.Dynamic appServlet = sc.addServlet("api", new DispatcherServlet(childWebApplicationContext)); appServlet.setLoadOnStartup(1); final Set mappingConflicts = appServlet.addMapping("/"); diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/WebConfig.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/WebConfig.java index 0c95acc177..011528e3cc 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/WebConfig.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/child/WebConfig.java @@ -23,7 +23,7 @@ import org.thymeleaf.templateresolver.ITemplateResolver; @Configuration @EnableWebMvc -@ComponentScan("org.baeldung.web") +@ComponentScan("com.baeldung.web") //@ImportResource({ "classpath:prop.xml" }) //@PropertySource("classpath:foo.properties") public class WebConfig implements WebMvcConfigurer { diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/SecurityConfig.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/SecurityConfig.java index 36ce898fb6..c4d29ed5b7 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/SecurityConfig.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/SecurityConfig.java @@ -12,7 +12,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur @Configuration //@ImportResource({ "classpath:webSecurityConfig.xml" }) @EnableWebSecurity -@ComponentScan("org.baeldung.security") +@ComponentScan("com.baeldung.security") public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired diff --git a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/ServiceConfig.java b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/ServiceConfig.java index 6e45a32a87..55f837f674 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/ServiceConfig.java +++ b/spring-security-modules/spring-security-rest-custom/src/main/java/com/baeldung/config/parent/ServiceConfig.java @@ -7,7 +7,7 @@ import org.springframework.context.annotation.PropertySource; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; @Configuration -@ComponentScan("org.baeldung.service") +@ComponentScan("com.baeldung.service") // @ImportResource({ "classpath:prop.xml" }) @PropertySource("classpath:foo.properties") public class ServiceConfig { diff --git a/spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/web_old.xml b/spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/web_old.xml index 0fa9abd258..a498fdfd47 100644 --- a/spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/web_old.xml +++ b/spring-security-modules/spring-security-rest-custom/src/main/webapp/WEB-INF/web_old.xml @@ -16,7 +16,7 @@ contextConfigLocation - org.baeldung.config.parent + com.baeldung.config.parent @@ -29,7 +29,7 @@ org.springframework.web.servlet.DispatcherServlet - + 1 From dee9427fb75f665a8bda63b200fc425892aa2e05 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:43:28 +0100 Subject: [PATCH 056/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-rest-basic-auth (finalized) --- .../src/main/java/com/baeldung/client/spring/ClientConfig.java | 2 +- .../src/main/java/com/baeldung/spring/SecSecurityConfig.java | 2 +- .../src/main/java/com/baeldung/spring/WebConfig.java | 2 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/spring/ClientConfig.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/spring/ClientConfig.java index dd834628a6..03994b55a5 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/spring/ClientConfig.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/client/spring/ClientConfig.java @@ -4,7 +4,7 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration -@ComponentScan("org.baeldung.client") +@ComponentScan("com.baeldung.client") public class ClientConfig { public ClientConfig() { diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java index cddef4d508..4ba9d47f8d 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/SecSecurityConfig.java @@ -6,7 +6,7 @@ import org.springframework.context.annotation.ImportResource; @Configuration @ImportResource({ "classpath:webSecurityConfig.xml" }) -@ComponentScan("org.baeldung.security") +@ComponentScan("com.baeldung.security") public class SecSecurityConfig { public SecSecurityConfig() { diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/WebConfig.java b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/WebConfig.java index e9d0d277f1..8d5c1dc7f1 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/WebConfig.java +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/java/com/baeldung/spring/WebConfig.java @@ -11,7 +11,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration @EnableWebMvc -@ComponentScan("org.baeldung.web") +@ComponentScan("com.baeldung.web") public class WebConfig implements WebMvcConfigurer { public WebConfig() { diff --git a/spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/web.xml index 83b4aeb0a7..4b2dd54266 100644 --- a/spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/web.xml +++ b/spring-security-modules/spring-security-rest-basic-auth/src/main/webapp/WEB-INF/web.xml @@ -12,7 +12,7 @@ contextConfigLocation - org.baeldung.spring + com.baeldung.spring From 19c1d9fa11369efd819974b1b01400b87a89d553 Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:43:46 +0100 Subject: [PATCH 057/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-sso (finalized) --- spring-security-modules/spring-security-sso/pom.xml | 2 +- .../spring-security-sso/spring-security-sso-auth-server/pom.xml | 2 +- .../spring-security-sso/spring-security-sso-kerberos/pom.xml | 2 +- .../spring-security-sso/spring-security-sso-ui-2/pom.xml | 2 +- .../spring-security-sso/spring-security-sso-ui/pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-security-modules/spring-security-sso/pom.xml b/spring-security-modules/spring-security-sso/pom.xml index 3d9c1bf595..4e5bb49aa3 100644 --- a/spring-security-modules/spring-security-sso/pom.xml +++ b/spring-security-modules/spring-security-sso/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - org.baeldung + com.baeldung spring-security-sso 1.0.0-SNAPSHOT spring-security-sso diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/pom.xml b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/pom.xml index 933cb6a2b2..3537c01e46 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/pom.xml +++ b/spring-security-modules/spring-security-sso/spring-security-sso-auth-server/pom.xml @@ -7,7 +7,7 @@ war - org.baeldung + com.baeldung spring-security-sso 1.0.0-SNAPSHOT diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/pom.xml b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/pom.xml index 88b9354538..0864ead1c4 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/pom.xml +++ b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/pom.xml @@ -6,7 +6,7 @@ spring-security-sso-kerberos - org.baeldung + com.baeldung spring-security-sso 1.0.0-SNAPSHOT diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/pom.xml b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/pom.xml index 10592a5e92..0645ba3593 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/pom.xml +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui-2/pom.xml @@ -7,7 +7,7 @@ war - org.baeldung + com.baeldung spring-security-sso 1.0.0-SNAPSHOT diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-ui/pom.xml b/spring-security-modules/spring-security-sso/spring-security-sso-ui/pom.xml index 2f0ac3a42e..d34317a4b0 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-ui/pom.xml +++ b/spring-security-modules/spring-security-sso/spring-security-sso-ui/pom.xml @@ -7,7 +7,7 @@ war - org.baeldung + com.baeldung spring-security-sso 1.0.0-SNAPSHOT From 37fe2f968d6684842562a17586b5500ffd1ca0ae Mon Sep 17 00:00:00 2001 From: dupirefr Date: Thu, 19 Mar 2020 21:44:56 +0100 Subject: [PATCH 058/130] [JAVA-961] Standardize packages in spring-security-modules: spring-security-mvc --- .../java/com/baeldung/monitoring/MetricRegistrySingleton.java | 2 +- .../spring-security-mvc/src/main/webapp/WEB-INF/web.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java index e2224996c2..ce122db609 100644 --- a/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java +++ b/spring-security-modules/spring-security-mvc/src/main/java/com/baeldung/monitoring/MetricRegistrySingleton.java @@ -13,7 +13,7 @@ public final class MetricRegistrySingleton { public static final MetricRegistry metrics = new MetricRegistry(); static { - Logger logger = LoggerFactory.getLogger("org.baeldung.monitoring"); + Logger logger = LoggerFactory.getLogger("com.baeldung.monitoring"); final Slf4jReporter reporter = Slf4jReporter.forRegistry(metrics).outputTo(logger).convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).build(); reporter.start(5, TimeUnit.MINUTES); } diff --git a/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/web.xml b/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/web.xml index 88087c92ed..ec6bc0d3b4 100644 --- a/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/web.xml +++ b/spring-security-modules/spring-security-mvc/src/main/webapp/WEB-INF/web.xml @@ -30,7 +30,7 @@ contextConfigLocation - org.baeldung.spring + com.baeldung.spring @@ -60,7 +60,7 @@ \ No newline at end of file From cac1779e0d10646f2c31eab47ac20747fc1283ea Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 22 Mar 2020 16:52:39 +0530 Subject: [PATCH 060/130] JAVA-626 : retired modules java-math and java-math-2 --- java-math-2/README.md | 9 -- java-math-2/pom.xml | 29 ----- .../algorithms/gcd/GCDImplementation.java | 55 -------- java-math-2/src/main/resources/logback.xml | 13 -- .../gcd/GCDImplementationUnitTest.java | 32 ----- .../logarithm/LogarithmUnitTest.java | 31 ----- java-math/.gitignore | 4 - java-math/README.md | 16 --- java-math/pom.xml | 89 ------------- .../ApacheCommonsCombinationGenerator.java | 29 ----- .../CombinatoricsLibCombinationGenerator.java | 13 -- .../GuavaCombinationsGenerator.java | 17 --- .../IterativeCombinationGenerator.java | 52 -------- ...electionRecursiveCombinationGenerator.java | 53 -------- .../SetRecursiveCombinationGenerator.java | 50 -------- .../DistanceBetweenPointsService.java | 38 ------ .../algorithms/factorial/Factorial.java | 63 --------- .../LinesIntersectionService.java | 21 --- .../mercator/EllipticalMercator.java | 22 ---- .../algorithms/mercator/Mercator.java | 10 -- .../mercator/SphericalMercator.java | 14 -- .../percentage/PercentageCalculator.java | 21 --- .../algorithms/rectanglesoverlap/Point.java | 29 ----- .../rectanglesoverlap/Rectangle.java | 40 ------ .../roundedup/RoundUpToHundred.java | 20 --- .../com/baeldung/matrices/HomemadeMatrix.java | 23 ---- .../BigMatrixMultiplicationBenchmarking.java | 121 ------------------ .../matrices/benchmark/BigMatrixProvider.java | 46 ------- .../MatrixMultiplicationBenchmarking.java | 86 ------------- .../matrices/benchmark/MatrixProvider.java | 33 ----- java-math/src/main/resources/logback.xml | 13 -- .../combination/CombinationUnitTest.java | 35 ----- .../DistanceBetweenPointsServiceUnitTest.java | 52 -------- .../factorial/FactorialUnitTest.java | 72 ----------- .../LinesIntersectionServiceUnitTest.java | 40 ------ .../mercator/EllipticalMercatorUnitTest.java | 22 ---- .../mercator/SphericalMercatorUnitTest.java | 21 --- .../PercentageCalculatorUnitTest.java | 33 ----- .../rectanglesoverlap/RectangleUnitTest.java | 39 ------ .../roundedup/RoundUpToHundredUnitTest.java | 14 -- .../matrices/apache/RealMatrixUnitTest.java | 41 ------ .../matrices/colt/DoubleMatrix2DUnitTest.java | 46 ------- .../matrices/ejml/SimpleMatrixUnitTest.java | 41 ------ .../homemade/HomemadeMatrixUnitTest.java | 54 -------- .../matrices/la4j/Basic2DMatrixUnitTest.java | 42 ------ .../matrices/nd4j/INDArrayUnitTest.java | 42 ------ 46 files changed, 1686 deletions(-) delete mode 100644 java-math-2/README.md delete mode 100644 java-math-2/pom.xml delete mode 100644 java-math-2/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java delete mode 100644 java-math-2/src/main/resources/logback.xml delete mode 100644 java-math-2/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java delete mode 100644 java-math-2/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java delete mode 100644 java-math/.gitignore delete mode 100644 java-math/README.md delete mode 100644 java-math/pom.xml delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/combination/ApacheCommonsCombinationGenerator.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/combination/CombinatoricsLibCombinationGenerator.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/combination/GuavaCombinationsGenerator.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/combination/IterativeCombinationGenerator.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/combination/SelectionRecursiveCombinationGenerator.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/combination/SetRecursiveCombinationGenerator.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/factorial/Factorial.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/mercator/EllipticalMercator.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/mercator/Mercator.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/mercator/SphericalMercator.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/percentage/PercentageCalculator.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java delete mode 100644 java-math/src/main/java/com/baeldung/algorithms/roundedup/RoundUpToHundred.java delete mode 100644 java-math/src/main/java/com/baeldung/matrices/HomemadeMatrix.java delete mode 100644 java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixMultiplicationBenchmarking.java delete mode 100644 java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixProvider.java delete mode 100644 java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixMultiplicationBenchmarking.java delete mode 100644 java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixProvider.java delete mode 100644 java-math/src/main/resources/logback.xml delete mode 100644 java-math/src/test/java/com/baeldung/algorithms/combination/CombinationUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/algorithms/factorial/FactorialUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/algorithms/mercator/EllipticalMercatorUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/algorithms/mercator/SphericalMercatorUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/algorithms/percentage/PercentageCalculatorUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/algorithms/roundedup/RoundUpToHundredUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/matrices/apache/RealMatrixUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/matrices/homemade/HomemadeMatrixUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java delete mode 100644 java-math/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java diff --git a/java-math-2/README.md b/java-math-2/README.md deleted file mode 100644 index 5345564d5d..0000000000 --- a/java-math-2/README.md +++ /dev/null @@ -1,9 +0,0 @@ -## Java Math - -This module contains articles about math in Java. - -### Relevant articles: - -- [Calculating Logarithms in Java](https://www.baeldung.com/java-logarithms) -- [Finding Greatest Common Divisor in Java](https://www.baeldung.com/java-greatest-common-divisor) -- More articles: [[<-- prev]](/../java-math) diff --git a/java-math-2/pom.xml b/java-math-2/pom.xml deleted file mode 100644 index 7bc05a3a86..0000000000 --- a/java-math-2/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - 4.0.0 - java-math-2 - 0.0.1-SNAPSHOT - java-math-2 - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - - org.assertj - assertj-core - ${org.assertj.core.version} - test - - - - - - 3.9.0 - - - \ No newline at end of file diff --git a/java-math-2/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java b/java-math-2/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java deleted file mode 100644 index d4844abd9c..0000000000 --- a/java-math-2/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.baeldung.algorithms.gcd; - -public class GCDImplementation { - - public static int gcdByBruteForce(int n1, int n2) { - int gcd = 1; - for (int i = 1; i <= n1 && i <= n2; i++) { - if (n1 % i == 0 && n2 % i == 0) { - gcd = i; - } - } - return gcd; - } - - public static int gcdByEuclidsAlgorithm(int n1, int n2) { - if (n2 == 0) { - return n1; - } - return gcdByEuclidsAlgorithm(n2, n1 % n2); - } - - public static int gcdBySteinsAlgorithm(int n1, int n2) { - if (n1 == 0) { - return n2; - } - - if (n2 == 0) { - return n1; - } - - int n; - for (n = 0; ((n1 | n2) & 1) == 0; n++) { - n1 >>= 1; - n2 >>= 1; - } - - while ((n1 & 1) == 0) { - n1 >>= 1; - } - - do { - while ((n2 & 1) == 0) { - n2 >>= 1; - } - - if (n1 > n2) { - int temp = n1; - n1 = n2; - n2 = temp; - } - n2 = (n2 - n1); - } while (n2 != 0); - return n1 << n; - } -} diff --git a/java-math-2/src/main/resources/logback.xml b/java-math-2/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/java-math-2/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file diff --git a/java-math-2/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java b/java-math-2/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java deleted file mode 100644 index d2c91a2eb8..0000000000 --- a/java-math-2/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.algorithms.gcd; - -import org.junit.Test; - -import static org.assertj.core.api.Assertions.assertThat; - -public class GCDImplementationUnitTest { - - @Test - public void whenCalculatingGCDByBruteForceMethod_thenCorrect() { - int n1 = 60; - int n2 = 90; - int gcd = GCDImplementation.gcdByBruteForce(n1, n2); - assertThat(gcd).isEqualTo(30); - } - - @Test - public void whenCalculatingGCDByEuclidsAlgorithm_thenCorrect() { - int n1 = 60; - int n2 = 90; - int gcd = GCDImplementation.gcdByEuclidsAlgorithm(n1, n2); - assertThat(gcd).isEqualTo(30); - } - - @Test - public void whenCalculatingGCDBySteinsAlgorithm_thenCorrect() { - int n1 = 60; - int n2 = 90; - int gcd = GCDImplementation.gcdBySteinsAlgorithm(n1, n2); - assertThat(gcd).isEqualTo(30); - } -} diff --git a/java-math-2/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java b/java-math-2/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java deleted file mode 100644 index facad1edc4..0000000000 --- a/java-math-2/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.algorithms.logarithm; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.junit.Test; - -public class LogarithmUnitTest { - - @Test - public void givenLog10_shouldReturnValidResults() { - assertEquals(Math.log10(100), 2); - assertEquals(Math.log10(1000), 3); - } - - @Test - public void givenLogE_shouldReturnValidResults() { - assertEquals(Math.log(Math.E), 1); - assertEquals(Math.log(10), 2.30258, 0.00001); - } - - @Test - public void givenCustomLog_shouldReturnValidResults() { - assertEquals(customLog(2, 256), 8); - assertEquals(customLog(10, 100), 2); - } - - private static double customLog(double base, double logNumber) { - return Math.log(logNumber) / Math.log(base); - } - -} diff --git a/java-math/.gitignore b/java-math/.gitignore deleted file mode 100644 index 30b2b7442c..0000000000 --- a/java-math/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/target/ -.settings/ -.classpath -.project \ No newline at end of file diff --git a/java-math/README.md b/java-math/README.md deleted file mode 100644 index 49ff5afde1..0000000000 --- a/java-math/README.md +++ /dev/null @@ -1,16 +0,0 @@ -## Java Math - -This module contains articles about math in Java. - -### Relevant articles: - -- [Calculate Factorial in Java](https://www.baeldung.com/java-calculate-factorial) -- [Generate Combinations in Java](https://www.baeldung.com/java-combinations-algorithm) -- [Check If Two Rectangles Overlap In Java](https://www.baeldung.com/java-check-if-two-rectangles-overlap) -- [Calculate the Distance Between Two Points in Java](https://www.baeldung.com/java-distance-between-two-points) -- [Find the Intersection of Two Lines in Java](https://www.baeldung.com/java-intersection-of-two-lines) -- [Round Up to the Nearest Hundred](https://www.baeldung.com/java-round-up-nearest-hundred) -- [Calculate Percentage in Java](https://www.baeldung.com/java-calculate-percentage) -- [Convert Latitude and Longitude to a 2D Point in Java](https://www.baeldung.com/java-convert-latitude-longitude) -- [Debugging with Eclipse](https://www.baeldung.com/eclipse-debugging) -- [Matrix Multiplication in Java](https://www.baeldung.com/java-matrix-multiplication) diff --git a/java-math/pom.xml b/java-math/pom.xml deleted file mode 100644 index 9b4af4c13d..0000000000 --- a/java-math/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - 4.0.0 - java-math - 0.0.1-SNAPSHOT - java-math - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - - org.apache.commons - commons-math3 - ${commons-math3.version} - - - org.ejml - ejml-all - ${ejml.version} - - - org.nd4j - nd4j-native - ${nd4j.version} - - - org.la4j - la4j - ${la4j.version} - - - colt - colt - ${colt.version} - - - com.google.guava - guava - ${guava.version} - - - org.assertj - assertj-core - ${org.assertj.core.version} - test - - - com.github.dpaukov - combinatoricslib3 - ${combinatoricslib3.version} - - - - org.openjdk.jmh - jmh-generator-annprocess - ${jmh.version} - - - - - - - - org.codehaus.mojo - exec-maven-plugin - ${exec-maven-plugin.version} - - - - - - - 3.6.1 - 3.9.0 - 27.0.1-jre - 3.3.0 - 0.38 - 1.0.0-beta4 - 1.2.0 - 0.6.0 - 1.19 - - - \ No newline at end of file diff --git a/java-math/src/main/java/com/baeldung/algorithms/combination/ApacheCommonsCombinationGenerator.java b/java-math/src/main/java/com/baeldung/algorithms/combination/ApacheCommonsCombinationGenerator.java deleted file mode 100644 index 40142ce940..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/combination/ApacheCommonsCombinationGenerator.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.algorithms.combination; - -import java.util.Arrays; -import java.util.Iterator; - -import org.apache.commons.math3.util.CombinatoricsUtils; - -public class ApacheCommonsCombinationGenerator { - - private static final int N = 6; - private static final int R = 3; - - /** - * Print all combinations of r elements from a set - * @param n - number of elements in set - * @param r - number of elements in selection - */ - public static void generate(int n, int r) { - Iterator iterator = CombinatoricsUtils.combinationsIterator(n, r); - while (iterator.hasNext()) { - final int[] combination = iterator.next(); - System.out.println(Arrays.toString(combination)); - } - } - - public static void main(String[] args) { - generate(N, R); - } -} \ No newline at end of file diff --git a/java-math/src/main/java/com/baeldung/algorithms/combination/CombinatoricsLibCombinationGenerator.java b/java-math/src/main/java/com/baeldung/algorithms/combination/CombinatoricsLibCombinationGenerator.java deleted file mode 100644 index 0afdeefb8b..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/combination/CombinatoricsLibCombinationGenerator.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.baeldung.algorithms.combination; - -import org.paukov.combinatorics3.Generator; - -public class CombinatoricsLibCombinationGenerator { - - public static void main(String[] args) { - Generator.combination(0, 1, 2, 3, 4, 5) - .simple(3) - .stream() - .forEach(System.out::println); - } -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/combination/GuavaCombinationsGenerator.java b/java-math/src/main/java/com/baeldung/algorithms/combination/GuavaCombinationsGenerator.java deleted file mode 100644 index d2783881ba..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/combination/GuavaCombinationsGenerator.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.algorithms.combination; - -import java.util.Arrays; -import java.util.Set; - -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Sets; - -public class GuavaCombinationsGenerator { - - public static void main(String[] args) { - - Set> combinations = Sets.combinations(ImmutableSet.of(0, 1, 2, 3, 4, 5), 3); - System.out.println(combinations.size()); - System.out.println(Arrays.toString(combinations.toArray())); - } -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/combination/IterativeCombinationGenerator.java b/java-math/src/main/java/com/baeldung/algorithms/combination/IterativeCombinationGenerator.java deleted file mode 100644 index 676d2f41e3..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/combination/IterativeCombinationGenerator.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.baeldung.algorithms.combination; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class IterativeCombinationGenerator { - - private static final int N = 5; - private static final int R = 2; - - /** - * Generate all combinations of r elements from a set - * @param n the number of elements in input set - * @param r the number of elements in a combination - * @return the list containing all combinations - */ - public List generate(int n, int r) { - List combinations = new ArrayList<>(); - int[] combination = new int[r]; - - // initialize with lowest lexicographic combination - for (int i = 0; i < r; i++) { - combination[i] = i; - } - - while (combination[r - 1] < n) { - combinations.add(combination.clone()); - - // generate next combination in lexicographic order - int t = r - 1; - while (t != 0 && combination[t] == n - r + t) { - t--; - } - combination[t]++; - for (int i = t + 1; i < r; i++) { - combination[i] = combination[i - 1] + 1; - } - } - - return combinations; - } - - public static void main(String[] args) { - IterativeCombinationGenerator generator = new IterativeCombinationGenerator(); - List combinations = generator.generate(N, R); - System.out.println(combinations.size()); - for (int[] combination : combinations) { - System.out.println(Arrays.toString(combination)); - } - } -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/combination/SelectionRecursiveCombinationGenerator.java b/java-math/src/main/java/com/baeldung/algorithms/combination/SelectionRecursiveCombinationGenerator.java deleted file mode 100644 index 52305b8c2f..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/combination/SelectionRecursiveCombinationGenerator.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.baeldung.algorithms.combination; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class SelectionRecursiveCombinationGenerator { - - private static final int N = 6; - private static final int R = 3; - - /** - * Generate all combinations of r elements from a set - * @param n - number of elements in input set - * @param r - number of elements to be chosen - * @return the list containing all combinations - */ - public List generate(int n, int r) { - List combinations = new ArrayList<>(); - helper(combinations, new int[r], 0, n - 1, 0); - return combinations; - } - - /** - * Choose elements from set by recursing over elements selected - * @param combinations - List to store generated combinations - * @param data - current combination - * @param start - starting element of remaining set - * @param end - last element of remaining set - * @param index - number of elements chosen so far. - */ - private void helper(List combinations, int data[], int start, int end, int index) { - if (index == data.length) { - int[] combination = data.clone(); - combinations.add(combination); - } else { - int max = Math.min(end, end + 1 - data.length + index); - for (int i = start; i <= max; i++) { - data[index] = i; - helper(combinations, data, i + 1, end, index + 1); - } - } - } - - public static void main(String[] args) { - SelectionRecursiveCombinationGenerator generator = new SelectionRecursiveCombinationGenerator(); - List combinations = generator.generate(N, R); - for (int[] combination : combinations) { - System.out.println(Arrays.toString(combination)); - } - System.out.printf("generated %d combinations of %d items from %d ", combinations.size(), R, N); - } -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/combination/SetRecursiveCombinationGenerator.java b/java-math/src/main/java/com/baeldung/algorithms/combination/SetRecursiveCombinationGenerator.java deleted file mode 100644 index a73447b31d..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/combination/SetRecursiveCombinationGenerator.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.baeldung.algorithms.combination; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -public class SetRecursiveCombinationGenerator { - - private static final int N = 5; - private static final int R = 2; - - /** - * Generate all combinations of r elements from a set - * @param n - number of elements in set - * @param r - number of elements in selection - * @return the list containing all combinations - */ - public List generate(int n, int r) { - List combinations = new ArrayList<>(); - helper(combinations, new int[r], 0, n-1, 0); - return combinations; - } - - /** - * @param combinations - List to contain the generated combinations - * @param data - List of elements in the selection - * @param start - index of the starting element in the remaining set - * @param end - index of the last element in the set - * @param index - number of elements selected so far - */ - private void helper(List combinations, int data[], int start, int end, int index) { - if (index == data.length) { - int[] combination = data.clone(); - combinations.add(combination); - } else if (start <= end) { - data[index] = start; - helper(combinations, data, start + 1, end, index + 1); - helper(combinations, data, start + 1, end, index); - } - } - - public static void main(String[] args) { - SetRecursiveCombinationGenerator generator = new SetRecursiveCombinationGenerator(); - List combinations = generator.generate(N, R); - for (int[] combination : combinations) { - System.out.println(Arrays.toString(combination)); - } - System.out.printf("generated %d combinations of %d items from %d ", combinations.size(), R, N); - } -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java b/java-math/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java deleted file mode 100644 index 0c8eb86a38..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.baeldung.algorithms.distancebetweenpoints; - -import java.awt.geom.Point2D; - -public class DistanceBetweenPointsService { - - public double calculateDistanceBetweenPoints( - double x1, - double y1, - double x2, - double y2) { - - return Math.sqrt((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1)); - } - - public double calculateDistanceBetweenPointsWithHypot( - double x1, - double y1, - double x2, - double y2) { - - double ac = Math.abs(y2 - y1); - double cb = Math.abs(x2 - x1); - - return Math.hypot(ac, cb); - } - - public double calculateDistanceBetweenPointsWithPoint2D( - double x1, - double y1, - double x2, - double y2) { - - return Point2D.distance(x1, y1, x2, y2); - - } - -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/factorial/Factorial.java b/java-math/src/main/java/com/baeldung/algorithms/factorial/Factorial.java deleted file mode 100644 index 43d2221773..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/factorial/Factorial.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.baeldung.algorithms.factorial; - -import java.math.BigInteger; -import java.util.stream.LongStream; - -import org.apache.commons.math3.util.CombinatoricsUtils; - -import com.google.common.math.BigIntegerMath; - -public class Factorial { - - public long factorialUsingForLoop(int n) { - long fact = 1; - for (int i = 2; i <= n; i++) { - fact = fact * i; - } - return fact; - } - - public long factorialUsingStreams(int n) { - return LongStream.rangeClosed(1, n) - .reduce(1, (long x, long y) -> x * y); - } - - public long factorialUsingRecursion(int n) { - if (n <= 2) { - return n; - } - return n * factorialUsingRecursion(n - 1); - } - - private Long[] factorials = new Long[20]; - - public long factorialUsingMemoize(int n) { - - if (factorials[n] != null) { - return factorials[n]; - } - - if (n <= 2) { - return n; - } - long nthValue = n * factorialUsingMemoize(n - 1); - factorials[n] = nthValue; - return nthValue; - } - - public BigInteger factorialHavingLargeResult(int n) { - BigInteger result = BigInteger.ONE; - for (int i = 2; i <= n; i++) - result = result.multiply(BigInteger.valueOf(i)); - return result; - } - - public long factorialUsingApacheCommons(int n) { - return CombinatoricsUtils.factorial(n); - } - - public BigInteger factorialUsingGuava(int n) { - return BigIntegerMath.factorial(n); - } - -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java b/java-math/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java deleted file mode 100644 index 35d6c8b424..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.algorithms.linesintersection; - -import java.awt.Point; -import java.util.Optional; - -public class LinesIntersectionService { - - public Optional calculateIntersectionPoint(double m1, double b1, double m2, double b2) { - - if (m1 == m2) { - return Optional.empty(); - } - - double x = (b2 - b1) / (m1 - m2); - double y = m1 * x + b1; - - Point point = new Point(); - point.setLocation(x, y); - return Optional.of(point); - } -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/mercator/EllipticalMercator.java b/java-math/src/main/java/com/baeldung/algorithms/mercator/EllipticalMercator.java deleted file mode 100644 index e1c41f9518..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/mercator/EllipticalMercator.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.algorithms.mercator; - -class EllipticalMercator extends Mercator { - - @Override - double yAxisProjection(double input) { - - input = Math.min(Math.max(input, -89.5), 89.5); - double earthDimensionalRateNormalized = 1.0 - Math.pow(RADIUS_MINOR / RADIUS_MAJOR, 2); - - double inputOnEarthProj = Math.sqrt(earthDimensionalRateNormalized) * Math.sin( Math.toRadians(input)); - - inputOnEarthProj = Math.pow(((1.0 - inputOnEarthProj)/(1.0+inputOnEarthProj)), 0.5 * Math.sqrt(earthDimensionalRateNormalized)); - double inputOnEarthProjNormalized = Math.tan(0.5 * ((Math.PI*0.5) - Math.toRadians(input)))/inputOnEarthProj; - return (-1) * RADIUS_MAJOR * Math.log(inputOnEarthProjNormalized); - } - - @Override - double xAxisProjection(double input) { - return RADIUS_MAJOR * Math.toRadians(input); - } -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/mercator/Mercator.java b/java-math/src/main/java/com/baeldung/algorithms/mercator/Mercator.java deleted file mode 100644 index b289b1839d..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/mercator/Mercator.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.baeldung.algorithms.mercator; - -abstract class Mercator { - final static double RADIUS_MAJOR = 6378137.0; - final static double RADIUS_MINOR = 6356752.3142; - - abstract double yAxisProjection(double input); - - abstract double xAxisProjection(double input); -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/mercator/SphericalMercator.java b/java-math/src/main/java/com/baeldung/algorithms/mercator/SphericalMercator.java deleted file mode 100644 index 1be976d82e..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/mercator/SphericalMercator.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.algorithms.mercator; - -public class SphericalMercator extends Mercator { - - @Override - double xAxisProjection(double input) { - return Math.toRadians(input) * RADIUS_MAJOR; - } - - @Override - double yAxisProjection(double input) { - return Math.log(Math.tan(Math.PI / 4 + Math.toRadians(input) / 2)) * RADIUS_MAJOR; - } -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/percentage/PercentageCalculator.java b/java-math/src/main/java/com/baeldung/algorithms/percentage/PercentageCalculator.java deleted file mode 100644 index f69b23146e..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/percentage/PercentageCalculator.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.algorithms.percentage; - -import java.util.Scanner; - -public class PercentageCalculator { - - public double calculatePercentage(double obtained,double total){ - return obtained*100/total; - } - - public static void main(String[] args) { - PercentageCalculator pc = new PercentageCalculator(); - Scanner in = new Scanner(System.in); - System.out.println("Enter obtained marks:"); - double obtained = in.nextDouble(); - System.out.println("Enter total marks:"); - double total =in.nextDouble(); - System.out.println("Percentage obtained :"+pc.calculatePercentage(obtained,total)); - } - -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java b/java-math/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java deleted file mode 100644 index 68b1e7c594..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.baeldung.algorithms.rectanglesoverlap; - -public class Point { - - private int x; - private int y; - - public Point(int x, int y) { - this.x = x; - this.y = y; - } - - public int getX() { - return x; - } - - public void setX(int x) { - this.x = x; - } - - public int getY() { - return y; - } - - public void setY(int y) { - this.y = y; - } - -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java b/java-math/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java deleted file mode 100644 index 38f5edec61..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.algorithms.rectanglesoverlap; - -public class Rectangle { - - private Point bottomLeft; - private Point topRight; - - public Rectangle(Point bottomLeft, Point topRight) { - this.bottomLeft = bottomLeft; - this.topRight = topRight; - } - - public Point getBottomLeft() { - return bottomLeft; - } - - public void setBottomLeft(Point bottomLeft) { - this.bottomLeft = bottomLeft; - } - - public Point getTopRight() { - return topRight; - } - - public void setTopRight(Point topRight) { - this.topRight = topRight; - } - - public boolean isOverlapping(Rectangle other) { - // one rectangle is to the top of the other - if (this.topRight.getY() < other.bottomLeft.getY() || this.bottomLeft.getY() > other.topRight.getY()) { - return false; - } - // one rectangle is to the left of the other - if (this.topRight.getX() < other.bottomLeft.getX() || this.bottomLeft.getX() > other.topRight.getX()) { - return false; - } - return true; - } -} diff --git a/java-math/src/main/java/com/baeldung/algorithms/roundedup/RoundUpToHundred.java b/java-math/src/main/java/com/baeldung/algorithms/roundedup/RoundUpToHundred.java deleted file mode 100644 index 333019e294..0000000000 --- a/java-math/src/main/java/com/baeldung/algorithms/roundedup/RoundUpToHundred.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.baeldung.algorithms.roundedup; - -import java.util.Scanner; - -public class RoundUpToHundred { - - public static void main(String[] args) { - Scanner scanner = new Scanner(System.in); - double input = scanner.nextDouble(); - scanner.close(); - - RoundUpToHundred.round(input); - } - - static long round(double input) { - long i = (long) Math.ceil(input); - return ((i + 99) / 100) * 100; - }; - -} diff --git a/java-math/src/main/java/com/baeldung/matrices/HomemadeMatrix.java b/java-math/src/main/java/com/baeldung/matrices/HomemadeMatrix.java deleted file mode 100644 index 0676250959..0000000000 --- a/java-math/src/main/java/com/baeldung/matrices/HomemadeMatrix.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.baeldung.matrices; - -public class HomemadeMatrix { - public static double[][] multiplyMatrices(double[][] firstMatrix, double[][] secondMatrix) { - double[][] result = new double[firstMatrix.length][secondMatrix[0].length]; - - for (int row = 0; row < result.length; row++) { - for (int col = 0; col < result[row].length; col++) { - result[row][col] = multiplyMatricesCell(firstMatrix, secondMatrix, row, col); - } - } - - return result; - } - - private static double multiplyMatricesCell(double[][] firstMatrix, double[][] secondMatrix, int row, int col) { - double cell = 0; - for (int i = 0; i < secondMatrix.length; i++) { - cell += firstMatrix[row][i] * secondMatrix[i][col]; - } - return cell; - } -} \ No newline at end of file diff --git a/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixMultiplicationBenchmarking.java b/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixMultiplicationBenchmarking.java deleted file mode 100644 index 2ed983f733..0000000000 --- a/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixMultiplicationBenchmarking.java +++ /dev/null @@ -1,121 +0,0 @@ -package com.baeldung.matrices.benchmark; - -import cern.colt.matrix.DoubleFactory2D; -import cern.colt.matrix.DoubleMatrix2D; -import cern.colt.matrix.linalg.Algebra; -import com.baeldung.matrices.HomemadeMatrix; -import org.apache.commons.math3.linear.Array2DRowRealMatrix; -import org.apache.commons.math3.linear.RealMatrix; -import org.ejml.simple.SimpleMatrix; -import org.la4j.Matrix; -import org.la4j.matrix.dense.Basic2DMatrix; -import org.nd4j.linalg.api.ndarray.INDArray; -import org.nd4j.linalg.factory.Nd4j; -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.Mode; -import org.openjdk.jmh.runner.Runner; -import org.openjdk.jmh.runner.options.ChainedOptionsBuilder; -import org.openjdk.jmh.runner.options.OptionsBuilder; - -import java.util.Arrays; -import java.util.Map; -import java.util.concurrent.TimeUnit; -import java.util.stream.Collectors; - -public class BigMatrixMultiplicationBenchmarking { - private static final int DEFAULT_FORKS = 2; - private static final int DEFAULT_WARMUP_ITERATIONS = 5; - private static final int DEFAULT_MEASUREMENT_ITERATIONS = 10; - - public static void main(String[] args) throws Exception { - Map parameters = parseParameters(args); - - ChainedOptionsBuilder builder = new OptionsBuilder() - .include(BigMatrixMultiplicationBenchmarking.class.getSimpleName()) - .mode(Mode.AverageTime) - .forks(forks(parameters)) - .warmupIterations(warmupIterations(parameters)) - .measurementIterations(measurementIterations(parameters)) - .timeUnit(TimeUnit.SECONDS); - - parameters.forEach(builder::param); - - new Runner(builder.build()).run(); - } - - private static Map parseParameters(String[] args) { - return Arrays.stream(args) - .map(arg -> arg.split("=")) - .collect(Collectors.toMap( - arg -> arg[0], - arg -> arg[1] - )); - } - - private static int forks(Map parameters) { - String forks = parameters.remove("forks"); - return parseOrDefault(forks, DEFAULT_FORKS); - } - - private static int warmupIterations(Map parameters) { - String warmups = parameters.remove("warmupIterations"); - return parseOrDefault(warmups, DEFAULT_WARMUP_ITERATIONS); - } - - private static int measurementIterations(Map parameters) { - String measurements = parameters.remove("measurementIterations"); - return parseOrDefault(measurements, DEFAULT_MEASUREMENT_ITERATIONS); - } - - private static int parseOrDefault(String parameter, int defaultValue) { - return parameter != null ? Integer.parseInt(parameter) : defaultValue; - } - - @Benchmark - public Object homemadeMatrixMultiplication(BigMatrixProvider matrixProvider) { - return HomemadeMatrix.multiplyMatrices(matrixProvider.getFirstMatrix(), matrixProvider.getSecondMatrix()); - } - - @Benchmark - public Object ejmlMatrixMultiplication(BigMatrixProvider matrixProvider) { - SimpleMatrix firstMatrix = new SimpleMatrix(matrixProvider.getFirstMatrix()); - SimpleMatrix secondMatrix = new SimpleMatrix(matrixProvider.getSecondMatrix()); - - return firstMatrix.mult(secondMatrix); - } - - @Benchmark - public Object apacheCommonsMatrixMultiplication(BigMatrixProvider matrixProvider) { - RealMatrix firstMatrix = new Array2DRowRealMatrix(matrixProvider.getFirstMatrix()); - RealMatrix secondMatrix = new Array2DRowRealMatrix(matrixProvider.getSecondMatrix()); - - return firstMatrix.multiply(secondMatrix); - } - - @Benchmark - public Object la4jMatrixMultiplication(BigMatrixProvider matrixProvider) { - Matrix firstMatrix = new Basic2DMatrix(matrixProvider.getFirstMatrix()); - Matrix secondMatrix = new Basic2DMatrix(matrixProvider.getSecondMatrix()); - - return firstMatrix.multiply(secondMatrix); - } - - @Benchmark - public Object nd4jMatrixMultiplication(BigMatrixProvider matrixProvider) { - INDArray firstMatrix = Nd4j.create(matrixProvider.getFirstMatrix()); - INDArray secondMatrix = Nd4j.create(matrixProvider.getSecondMatrix()); - - return firstMatrix.mmul(secondMatrix); - } - - @Benchmark - public Object coltMatrixMultiplication(BigMatrixProvider matrixProvider) { - DoubleFactory2D doubleFactory2D = DoubleFactory2D.dense; - - DoubleMatrix2D firstMatrix = doubleFactory2D.make(matrixProvider.getFirstMatrix()); - DoubleMatrix2D secondMatrix = doubleFactory2D.make(matrixProvider.getSecondMatrix()); - - Algebra algebra = new Algebra(); - return algebra.mult(firstMatrix, secondMatrix); - } -} \ No newline at end of file diff --git a/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixProvider.java b/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixProvider.java deleted file mode 100644 index d0f8a03fe3..0000000000 --- a/java-math/src/main/java/com/baeldung/matrices/benchmark/BigMatrixProvider.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.baeldung.matrices.benchmark; - -import org.openjdk.jmh.annotations.Param; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.Setup; -import org.openjdk.jmh.annotations.State; -import org.openjdk.jmh.infra.BenchmarkParams; - -import java.util.Random; -import java.util.stream.DoubleStream; - -@State(Scope.Benchmark) -public class BigMatrixProvider { - @Param({}) - private int matrixSize; - private double[][] firstMatrix; - private double[][] secondMatrix; - - public BigMatrixProvider() {} - - @Setup - public void setup(BenchmarkParams parameters) { - firstMatrix = createMatrix(matrixSize); - secondMatrix = createMatrix(matrixSize); - } - - private double[][] createMatrix(int matrixSize) { - Random random = new Random(); - - double[][] result = new double[matrixSize][matrixSize]; - for (int row = 0; row < result.length; row++) { - for (int col = 0; col < result[row].length; col++) { - result[row][col] = random.nextDouble(); - } - } - return result; - } - - public double[][] getFirstMatrix() { - return firstMatrix; - } - - public double[][] getSecondMatrix() { - return secondMatrix; - } -} \ No newline at end of file diff --git a/java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixMultiplicationBenchmarking.java b/java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixMultiplicationBenchmarking.java deleted file mode 100644 index fdb423e8da..0000000000 --- a/java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixMultiplicationBenchmarking.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.baeldung.matrices.benchmark; - -import cern.colt.matrix.DoubleFactory2D; -import cern.colt.matrix.DoubleMatrix2D; -import cern.colt.matrix.linalg.Algebra; -import com.baeldung.matrices.HomemadeMatrix; -import org.apache.commons.math3.linear.Array2DRowRealMatrix; -import org.apache.commons.math3.linear.RealMatrix; -import org.ejml.simple.SimpleMatrix; -import org.la4j.Matrix; -import org.la4j.matrix.dense.Basic2DMatrix; -import org.nd4j.linalg.api.ndarray.INDArray; -import org.nd4j.linalg.factory.Nd4j; -import org.openjdk.jmh.annotations.Benchmark; -import org.openjdk.jmh.annotations.Mode; -import org.openjdk.jmh.runner.Runner; -import org.openjdk.jmh.runner.options.Options; -import org.openjdk.jmh.runner.options.OptionsBuilder; - -import java.util.concurrent.TimeUnit; - -public class MatrixMultiplicationBenchmarking { - - public static void main(String[] args) throws Exception { - Options opt = new OptionsBuilder() - .include(MatrixMultiplicationBenchmarking.class.getSimpleName()) - .exclude(BigMatrixMultiplicationBenchmarking.class.getSimpleName()) - .mode(Mode.AverageTime) - .forks(2) - .warmupIterations(10) - .measurementIterations(10) - .timeUnit(TimeUnit.MICROSECONDS) - .build(); - - new Runner(opt).run(); - } - - @Benchmark - public Object homemadeMatrixMultiplication(MatrixProvider matrixProvider) { - return HomemadeMatrix.multiplyMatrices(matrixProvider.getFirstMatrix(), matrixProvider.getSecondMatrix()); - } - - @Benchmark - public Object ejmlMatrixMultiplication(MatrixProvider matrixProvider) { - SimpleMatrix firstMatrix = new SimpleMatrix(matrixProvider.getFirstMatrix()); - SimpleMatrix secondMatrix = new SimpleMatrix(matrixProvider.getSecondMatrix()); - - return firstMatrix.mult(secondMatrix); - } - - @Benchmark - public Object apacheCommonsMatrixMultiplication(MatrixProvider matrixProvider) { - RealMatrix firstMatrix = new Array2DRowRealMatrix(matrixProvider.getFirstMatrix()); - RealMatrix secondMatrix = new Array2DRowRealMatrix(matrixProvider.getSecondMatrix()); - - return firstMatrix.multiply(secondMatrix); - } - - @Benchmark - public Object la4jMatrixMultiplication(MatrixProvider matrixProvider) { - Matrix firstMatrix = new Basic2DMatrix(matrixProvider.getFirstMatrix()); - Matrix secondMatrix = new Basic2DMatrix(matrixProvider.getSecondMatrix()); - - return firstMatrix.multiply(secondMatrix); - } - - @Benchmark - public Object nd4jMatrixMultiplication(MatrixProvider matrixProvider) { - INDArray firstMatrix = Nd4j.create(matrixProvider.getFirstMatrix()); - INDArray secondMatrix = Nd4j.create(matrixProvider.getSecondMatrix()); - - return firstMatrix.mmul(secondMatrix); - } - - @Benchmark - public Object coltMatrixMultiplication(MatrixProvider matrixProvider) { - DoubleFactory2D doubleFactory2D = DoubleFactory2D.dense; - - DoubleMatrix2D firstMatrix = doubleFactory2D.make(matrixProvider.getFirstMatrix()); - DoubleMatrix2D secondMatrix = doubleFactory2D.make(matrixProvider.getSecondMatrix()); - - Algebra algebra = new Algebra(); - return algebra.mult(firstMatrix, secondMatrix); - } - -} \ No newline at end of file diff --git a/java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixProvider.java b/java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixProvider.java deleted file mode 100644 index d401ba2ab6..0000000000 --- a/java-math/src/main/java/com/baeldung/matrices/benchmark/MatrixProvider.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.matrices.benchmark; - -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.State; - -@State(Scope.Benchmark) -public class MatrixProvider { - private double[][] firstMatrix; - private double[][] secondMatrix; - - public MatrixProvider() { - firstMatrix = - new double[][] { - new double[] {1d, 5d}, - new double[] {2d, 3d}, - new double[] {1d ,7d} - }; - - secondMatrix = - new double[][] { - new double[] {1d, 2d, 3d, 7d}, - new double[] {5d, 2d, 8d, 1d} - }; - } - - public double[][] getFirstMatrix() { - return firstMatrix; - } - - public double[][] getSecondMatrix() { - return secondMatrix; - } -} \ No newline at end of file diff --git a/java-math/src/main/resources/logback.xml b/java-math/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/java-math/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file diff --git a/java-math/src/test/java/com/baeldung/algorithms/combination/CombinationUnitTest.java b/java-math/src/test/java/com/baeldung/algorithms/combination/CombinationUnitTest.java deleted file mode 100644 index 987b6ddae6..0000000000 --- a/java-math/src/test/java/com/baeldung/algorithms/combination/CombinationUnitTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.baeldung.algorithms.combination; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.util.List; - -import org.junit.Test; - -public class CombinationUnitTest { - - private static final int N = 5; - private static final int R = 3; - private static final int nCr = 10; - - @Test - public void givenSetAndSelectionSize_whenCalculatedUsingSetRecursiveAlgorithm_thenExpectedCount() { - SetRecursiveCombinationGenerator generator = new SetRecursiveCombinationGenerator(); - List selection = generator.generate(N, R); - assertEquals(nCr, selection.size()); - } - - @Test - public void givenSetAndSelectionSize_whenCalculatedUsingSelectionRecursiveAlgorithm_thenExpectedCount() { - SelectionRecursiveCombinationGenerator generator = new SelectionRecursiveCombinationGenerator(); - List selection = generator.generate(N, R); - assertEquals(nCr, selection.size()); - } - - @Test - public void givenSetAndSelectionSize_whenCalculatedUsingIterativeAlgorithm_thenExpectedCount() { - IterativeCombinationGenerator generator = new IterativeCombinationGenerator(); - List selection = generator.generate(N, R); - assertEquals(nCr, selection.size()); - } -} diff --git a/java-math/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java b/java-math/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java deleted file mode 100644 index 784681a807..0000000000 --- a/java-math/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java +++ /dev/null @@ -1,52 +0,0 @@ -package com.baeldung.algorithms.distancebetweenpoints; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public class DistanceBetweenPointsServiceUnitTest { - - private DistanceBetweenPointsService service = new DistanceBetweenPointsService(); - - @Test - public void givenTwoPoints_whenCalculateDistanceByFormula_thenCorrect() { - - double x1 = 3; - double y1 = 4; - double x2 = 7; - double y2 = 1; - - double distance = service.calculateDistanceBetweenPoints(x1, y1, x2, y2); - - assertEquals(distance, 5, 0.001); - - } - - @Test - public void givenTwoPoints_whenCalculateDistanceWithHypot_thenCorrect() { - - double x1 = 3; - double y1 = 4; - double x2 = 7; - double y2 = 1; - - double distance = service.calculateDistanceBetweenPointsWithHypot(x1, y1, x2, y2); - - assertEquals(distance, 5, 0.001); - - } - - @Test - public void givenTwoPoints_whenCalculateDistanceWithPoint2D_thenCorrect() { - - double x1 = 3; - double y1 = 4; - double x2 = 7; - double y2 = 1; - - double distance = service.calculateDistanceBetweenPointsWithPoint2D(x1, y1, x2, y2); - - assertEquals(distance, 5, 0.001); - - } -} diff --git a/java-math/src/test/java/com/baeldung/algorithms/factorial/FactorialUnitTest.java b/java-math/src/test/java/com/baeldung/algorithms/factorial/FactorialUnitTest.java deleted file mode 100644 index c185dba62b..0000000000 --- a/java-math/src/test/java/com/baeldung/algorithms/factorial/FactorialUnitTest.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.baeldung.algorithms.factorial; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.math.BigInteger; - -import org.junit.Before; -import org.junit.Test; - -public class FactorialUnitTest { - - Factorial factorial; - - @Before - public void setup() { - factorial = new Factorial(); - } - - @Test - public void whenCalculatingFactorialUsingForLoop_thenCorrect() { - int n = 5; - - assertThat(factorial.factorialUsingForLoop(n)).isEqualTo(120); - } - - @Test - public void whenCalculatingFactorialUsingStreams_thenCorrect() { - int n = 5; - - assertThat(factorial.factorialUsingStreams(n)).isEqualTo(120); - } - - @Test - public void whenCalculatingFactorialUsingRecursion_thenCorrect() { - int n = 5; - - assertThat(factorial.factorialUsingRecursion(n)).isEqualTo(120); - } - - @Test - public void whenCalculatingFactorialUsingMemoize_thenCorrect() { - int n = 5; - - assertThat(factorial.factorialUsingMemoize(n)).isEqualTo(120); - - n = 6; - - assertThat(factorial.factorialUsingMemoize(n)).isEqualTo(720); - } - - @Test - public void whenCalculatingFactorialHavingLargeResult_thenCorrect() { - int n = 22; - - assertThat(factorial.factorialHavingLargeResult(n)).isEqualTo(new BigInteger("1124000727777607680000")); - } - - @Test - public void whenCalculatingFactorialUsingApacheCommons_thenCorrect() { - int n = 5; - - assertThat(factorial.factorialUsingApacheCommons(n)).isEqualTo(120); - } - - @Test - public void whenCalculatingFactorialUsingGuava_thenCorrect() { - int n = 22; - - assertThat(factorial.factorialUsingGuava(n)).isEqualTo(new BigInteger("1124000727777607680000")); - } - -} diff --git a/java-math/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java b/java-math/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java deleted file mode 100644 index 22371107f3..0000000000 --- a/java-math/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.algorithms.linesintersection; - -import java.awt.Point; -import java.util.Optional; - -import org.junit.Test; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertEquals; - -public class LinesIntersectionServiceUnitTest { - private LinesIntersectionService service = new LinesIntersectionService(); - - @Test - public void givenNotParallelLines_whenCalculatePoint_thenPresent() { - - double m1 = 0; - double b1 = 0; - double m2 = 1; - double b2 = -1; - - Optional point = service.calculateIntersectionPoint(m1, b1, m2, b2); - - assertTrue(point.isPresent()); - assertEquals(point.get().getX(), 1, 0.001); - assertEquals(point.get().getY(), 0, 0.001); - } - - @Test - public void givenParallelLines_whenCalculatePoint_thenEmpty() { - double m1 = 1; - double b1 = 0; - double m2 = 1; - double b2 = -1; - - Optional point = service.calculateIntersectionPoint(m1, b1, m2, b2); - - assertFalse(point.isPresent()); - } -} diff --git a/java-math/src/test/java/com/baeldung/algorithms/mercator/EllipticalMercatorUnitTest.java b/java-math/src/test/java/com/baeldung/algorithms/mercator/EllipticalMercatorUnitTest.java deleted file mode 100644 index 96b644c46c..0000000000 --- a/java-math/src/test/java/com/baeldung/algorithms/mercator/EllipticalMercatorUnitTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.algorithms.mercator; - -import org.junit.Assert; -import org.junit.Test; - - -public class EllipticalMercatorUnitTest { - - @Test - public void giventThatTheInputIs22_whenXAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { - Mercator mercator = new EllipticalMercator(); - double result = mercator.xAxisProjection(22); - Assert.assertEquals(result, 2449028.7974520186, 0.0); - } - - @Test - public void giventThatTheInputIs44_whenYAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { - Mercator mercator = new EllipticalMercator(); - double result = mercator.yAxisProjection(44); - Assert.assertEquals(result, 5435749.887511954, 0.0); - } -} diff --git a/java-math/src/test/java/com/baeldung/algorithms/mercator/SphericalMercatorUnitTest.java b/java-math/src/test/java/com/baeldung/algorithms/mercator/SphericalMercatorUnitTest.java deleted file mode 100644 index 348c6ad3e4..0000000000 --- a/java-math/src/test/java/com/baeldung/algorithms/mercator/SphericalMercatorUnitTest.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.baeldung.algorithms.mercator; - -import org.junit.Assert; -import org.junit.Test; - -public class SphericalMercatorUnitTest { - - @Test - public void giventThatTheInputIs22_whenXAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { - Mercator mercator = new SphericalMercator(); - double result = mercator.xAxisProjection(22); - Assert.assertEquals(result, 2449028.7974520186, 0.0); - } - - @Test - public void giventThatTheInputIs44_whenYAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { - Mercator mercator = new SphericalMercator(); - double result = mercator.yAxisProjection(44); - Assert.assertEquals(result, 5465442.183322753, 0.0); - } -} diff --git a/java-math/src/test/java/com/baeldung/algorithms/percentage/PercentageCalculatorUnitTest.java b/java-math/src/test/java/com/baeldung/algorithms/percentage/PercentageCalculatorUnitTest.java deleted file mode 100644 index e49acc0c4b..0000000000 --- a/java-math/src/test/java/com/baeldung/algorithms/percentage/PercentageCalculatorUnitTest.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.algorithms.percentage; - -import org.junit.Assert; -import org.junit.Test; - -public class PercentageCalculatorUnitTest { - private PercentageCalculator pc = new PercentageCalculator(); - - @Test - public void whenPass2Integers_thenShouldCalculatePercentage(){ - Assert.assertEquals("Result not as expected", - 50.0,pc.calculatePercentage(50,100),0.1); - } - - @Test - public void whenPassObtainedMarksAsDouble_thenShouldCalculatePercentage(){ - Assert.assertEquals("Result not as expected",5.05, - pc.calculatePercentage(50.5,1000),0.1); - } - - @Test - public void whenPassTotalMarksAsDouble_thenShouldCalculatePercentage(){ - Assert.assertEquals("Result not as expected",19.6, - pc.calculatePercentage(5,25.5),0.1); - } - - @Test - public void whenPass2DoubleNumbers_thenShouldCalculatePercentage(){ - Assert.assertEquals("Result not as expected",20, - pc.calculatePercentage(5.5,27.5),0.1); - } - -} diff --git a/java-math/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java b/java-math/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java deleted file mode 100644 index e4bb614b48..0000000000 --- a/java-math/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.algorithms.rectanglesoverlap; - -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertFalse; -import org.junit.Test; - -public class RectangleUnitTest { - - @Test - public void givenTwoOverlappingRectangles_whenisOverlappingCalled_shouldReturnTrue() { - Rectangle rectangle1 = new Rectangle(new Point(2, 1), new Point(4, 3)); - Rectangle rectangle2 = new Rectangle(new Point(1, 1), new Point(6, 4)); - assertTrue(rectangle1.isOverlapping(rectangle2)); - - rectangle1 = new Rectangle(new Point(-5, -2), new Point(2, 3)); - rectangle2 = new Rectangle(new Point(-2, -1), new Point(5, 2)); - assertTrue(rectangle1.isOverlapping(rectangle2)); - - rectangle1 = new Rectangle(new Point(-5, 1), new Point(2, 4)); - rectangle2 = new Rectangle(new Point(-2, -2), new Point(5, 5)); - assertTrue(rectangle1.isOverlapping(rectangle2)); - } - - @Test - public void givenTwoNonOverlappingRectangles_whenisOverlappingCalled_shouldReturnFalse() { - Rectangle rectangle1 = new Rectangle(new Point(-5, 1), new Point(-3, 4)); - Rectangle rectangle2 = new Rectangle(new Point(-2, -2), new Point(5, 5)); - assertFalse(rectangle1.isOverlapping(rectangle2)); - - rectangle1 = new Rectangle(new Point(-5, 1), new Point(3, 4)); - rectangle2 = new Rectangle(new Point(-2, -2), new Point(5, -1)); - assertFalse(rectangle1.isOverlapping(rectangle2)); - - rectangle1 = new Rectangle(new Point(-2, 1), new Point(0, 3)); - rectangle2 = new Rectangle(new Point(3, 1), new Point(5, 4)); - assertFalse(rectangle1.isOverlapping(rectangle2)); - } - -} diff --git a/java-math/src/test/java/com/baeldung/algorithms/roundedup/RoundUpToHundredUnitTest.java b/java-math/src/test/java/com/baeldung/algorithms/roundedup/RoundUpToHundredUnitTest.java deleted file mode 100644 index 5191d65787..0000000000 --- a/java-math/src/test/java/com/baeldung/algorithms/roundedup/RoundUpToHundredUnitTest.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.algorithms.roundedup; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -public class RoundUpToHundredUnitTest { - @Test - public void givenInput_whenRound_thenRoundUpToTheNearestHundred() { - assertEquals("Rounded up to hundred", 100, RoundUpToHundred.round(99)); - assertEquals("Rounded up to three hundred ", 300, RoundUpToHundred.round(200.2)); - assertEquals("Returns same rounded value", 400, RoundUpToHundred.round(400)); - } -} diff --git a/java-math/src/test/java/com/baeldung/matrices/apache/RealMatrixUnitTest.java b/java-math/src/test/java/com/baeldung/matrices/apache/RealMatrixUnitTest.java deleted file mode 100644 index e7d99fbe3e..0000000000 --- a/java-math/src/test/java/com/baeldung/matrices/apache/RealMatrixUnitTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.matrices.apache; - -import org.apache.commons.math3.linear.Array2DRowRealMatrix; -import org.apache.commons.math3.linear.RealMatrix; -import org.junit.jupiter.api.Test; -import org.openjdk.jmh.annotations.*; - -import static org.assertj.core.api.Assertions.assertThat; - -class RealMatrixUnitTest { - - @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { - RealMatrix firstMatrix = new Array2DRowRealMatrix( - new double[][] { - new double[] {1d, 5d}, - new double[] {2d, 3d}, - new double[] {1d ,7d} - } - ); - - RealMatrix secondMatrix = new Array2DRowRealMatrix( - new double[][] { - new double[] {1d, 2d, 3d, 7d}, - new double[] {5d, 2d, 8d, 1d} - } - ); - - RealMatrix expected = new Array2DRowRealMatrix( - new double[][] { - new double[] {26d, 12d, 43d, 12d}, - new double[] {17d, 10d, 30d, 17d}, - new double[] {36d, 16d, 59d, 14d} - } - ); - - RealMatrix actual = firstMatrix.multiply(secondMatrix); - - assertThat(actual).isEqualTo(expected); - } -} diff --git a/java-math/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java b/java-math/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java deleted file mode 100644 index da66cd7d61..0000000000 --- a/java-math/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.baeldung.matrices.colt; - -import cern.colt.matrix.DoubleFactory2D; -import cern.colt.matrix.DoubleMatrix2D; -import cern.colt.matrix.linalg.Algebra; -import org.junit.jupiter.api.Test; -import org.openjdk.jmh.annotations.*; - -import static org.assertj.core.api.Assertions.assertThat; - -class DoubleMatrix2DUnitTest { - - @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { - DoubleFactory2D doubleFactory2D = DoubleFactory2D.dense; - - DoubleMatrix2D firstMatrix = doubleFactory2D.make( - new double[][] { - new double[] {1d, 5d}, - new double[] {2d, 3d}, - new double[] {1d ,7d} - } - ); - - DoubleMatrix2D secondMatrix = doubleFactory2D.make( - new double[][] { - new double[] {1d, 2d, 3d, 7d}, - new double[] {5d, 2d, 8d, 1d} - } - ); - - DoubleMatrix2D expected = doubleFactory2D.make( - new double[][] { - new double[] {26d, 12d, 43d, 12d}, - new double[] {17d, 10d, 30d, 17d}, - new double[] {36d, 16d, 59d, 14d} - } - ); - - Algebra algebra = new Algebra(); - DoubleMatrix2D actual = algebra.mult(firstMatrix, secondMatrix); - - assertThat(actual).isEqualTo(expected); - } - -} \ No newline at end of file diff --git a/java-math/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java b/java-math/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java deleted file mode 100644 index 60381ece63..0000000000 --- a/java-math/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.baeldung.matrices.ejml; - -import org.ejml.simple.SimpleMatrix; -import org.junit.jupiter.api.Test; -import org.openjdk.jmh.annotations.*; - -import static org.assertj.core.api.Assertions.assertThat; - -class SimpleMatrixUnitTest { - - @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { - SimpleMatrix firstMatrix = new SimpleMatrix( - new double[][] { - new double[] {1d, 5d}, - new double[] {2d, 3d}, - new double[] {1d ,7d} - } - ); - - SimpleMatrix secondMatrix = new SimpleMatrix( - new double[][] { - new double[] {1d, 2d, 3d, 7d}, - new double[] {5d, 2d, 8d, 1d} - } - ); - - SimpleMatrix expected = new SimpleMatrix( - new double[][] { - new double[] {26d, 12d, 43d, 12d}, - new double[] {17d, 10d, 30d, 17d}, - new double[] {36d, 16d, 59d, 14d} - } - ); - - SimpleMatrix actual = firstMatrix.mult(secondMatrix); - - assertThat(actual).matches(m -> m.isIdentical(expected, 0d)); - } - -} \ No newline at end of file diff --git a/java-math/src/test/java/com/baeldung/matrices/homemade/HomemadeMatrixUnitTest.java b/java-math/src/test/java/com/baeldung/matrices/homemade/HomemadeMatrixUnitTest.java deleted file mode 100644 index d1a062ee79..0000000000 --- a/java-math/src/test/java/com/baeldung/matrices/homemade/HomemadeMatrixUnitTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.baeldung.matrices.homemade; - -import org.junit.jupiter.api.Test; -import org.openjdk.jmh.annotations.*; - -import static org.assertj.core.api.Assertions.assertThat; - -class HomemadeMatrixUnitTest { - - @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { - double[][] firstMatrix = { - new double[]{1d, 5d}, - new double[]{2d, 3d}, - new double[]{1d, 7d} - }; - - double[][] secondMatrix = { - new double[]{1d, 2d, 3d, 7d}, - new double[]{5d, 2d, 8d, 1d} - }; - - double[][] expected = { - new double[]{26d, 12d, 43d, 12d}, - new double[]{17d, 10d, 30d, 17d}, - new double[]{36d, 16d, 59d, 14d} - }; - - double[][] actual = multiplyMatrices(firstMatrix, secondMatrix); - - assertThat(actual).isEqualTo(expected); - } - - private double[][] multiplyMatrices(double[][] firstMatrix, double[][] secondMatrix) { - double[][] result = new double[firstMatrix.length][secondMatrix[0].length]; - - for (int row = 0; row < result.length; row++) { - for (int col = 0; col < result[row].length; col++) { - result[row][col] = multiplyMatricesCell(firstMatrix, secondMatrix, row, col); - } - } - - return result; - } - - private double multiplyMatricesCell(double[][] firstMatrix, double[][] secondMatrix, int row, int col) { - double cell = 0; - for (int i = 0; i < secondMatrix.length; i++) { - cell += firstMatrix[row][i] * secondMatrix[i][col]; - } - return cell; - } - -} \ No newline at end of file diff --git a/java-math/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java b/java-math/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java deleted file mode 100644 index 01731a3dd5..0000000000 --- a/java-math/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.matrices.la4j; - -import org.junit.jupiter.api.Test; -import org.la4j.Matrix; -import org.la4j.matrix.dense.Basic2DMatrix; -import org.openjdk.jmh.annotations.*; - -import static org.assertj.core.api.Assertions.assertThat; - -class Basic2DMatrixUnitTest { - - @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { - Matrix firstMatrix = new Basic2DMatrix( - new double[][]{ - new double[]{1d, 5d}, - new double[]{2d, 3d}, - new double[]{1d, 7d} - } - ); - - Matrix secondMatrix = new Basic2DMatrix( - new double[][]{ - new double[]{1d, 2d, 3d, 7d}, - new double[]{5d, 2d, 8d, 1d} - } - ); - - Matrix expected = new Basic2DMatrix( - new double[][]{ - new double[]{26d, 12d, 43d, 12d}, - new double[]{17d, 10d, 30d, 17d}, - new double[]{36d, 16d, 59d, 14d} - } - ); - - Matrix actual = firstMatrix.multiply(secondMatrix); - - assertThat(actual).isEqualTo(expected); - } - -} \ No newline at end of file diff --git a/java-math/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java b/java-math/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java deleted file mode 100644 index 72ef60a571..0000000000 --- a/java-math/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.matrices.nd4j; - -import org.junit.jupiter.api.Test; -import org.nd4j.linalg.api.ndarray.INDArray; -import org.nd4j.linalg.factory.Nd4j; -import org.openjdk.jmh.annotations.*; - -import static org.assertj.core.api.Assertions.assertThat; - -class INDArrayUnitTest { - - @Test - void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { - INDArray firstMatrix = Nd4j.create( - new double[][]{ - new double[]{1d, 5d}, - new double[]{2d, 3d}, - new double[]{1d, 7d} - } - ); - - INDArray secondMatrix = Nd4j.create( - new double[][] { - new double[] {1d, 2d, 3d, 7d}, - new double[] {5d, 2d, 8d, 1d} - } - ); - - INDArray expected = Nd4j.create( - new double[][] { - new double[] {26d, 12d, 43d, 12d}, - new double[] {17d, 10d, 30d, 17d}, - new double[] {36d, 16d, 59d, 14d} - } - ); - - INDArray actual = firstMatrix.mmul(secondMatrix); - - assertThat(actual).isEqualTo(expected); - } - -} \ No newline at end of file From 05e0753a9cd40eb33b32430ae2503540bfa06449 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 22 Mar 2020 16:55:04 +0530 Subject: [PATCH 061/130] JAVA-626: Added 3 articles --- .../core-java-lang-math/README.md | 4 ++ .../algorithms/gcd/GCDImplementation.java | 55 +++++++++++++++++++ .../percentage/PercentageCalculator.java | 21 +++++++ .../gcd/GCDImplementationUnitTest.java | 32 +++++++++++ .../logarithm/LogarithmUnitTest.java | 31 +++++++++++ .../PercentageCalculatorUnitTest.java | 33 +++++++++++ 6 files changed, 176 insertions(+) create mode 100644 core-java-modules/core-java-lang-math/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java create mode 100644 core-java-modules/core-java-lang-math/src/main/java/com/baeldung/algorithms/percentage/PercentageCalculator.java create mode 100644 core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java create mode 100644 core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java create mode 100644 core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/percentage/PercentageCalculatorUnitTest.java diff --git a/core-java-modules/core-java-lang-math/README.md b/core-java-modules/core-java-lang-math/README.md index ec97a2ada4..8a822d75fd 100644 --- a/core-java-modules/core-java-lang-math/README.md +++ b/core-java-modules/core-java-lang-math/README.md @@ -10,3 +10,7 @@ - [Basic Calculator in Java](https://www.baeldung.com/java-basic-calculator) - [Overflow and Underflow in Java](https://www.baeldung.com/java-overflow-underflow) - [Obtaining a Power Set of a Set in Java](https://www.baeldung.com/java-power-set-of-a-set) +- [Calculating Logarithms in Java](https://www.baeldung.com/java-logarithms) +- [Finding Greatest Common Divisor in Java](https://www.baeldung.com/java-greatest-common-divisor) +- [Calculate Percentage in Java](https://www.baeldung.com/java-calculate-percentage) +- More articles: [[<-- next]](/../core-java-lang-math-2) diff --git a/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java new file mode 100644 index 0000000000..d4844abd9c --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/algorithms/gcd/GCDImplementation.java @@ -0,0 +1,55 @@ +package com.baeldung.algorithms.gcd; + +public class GCDImplementation { + + public static int gcdByBruteForce(int n1, int n2) { + int gcd = 1; + for (int i = 1; i <= n1 && i <= n2; i++) { + if (n1 % i == 0 && n2 % i == 0) { + gcd = i; + } + } + return gcd; + } + + public static int gcdByEuclidsAlgorithm(int n1, int n2) { + if (n2 == 0) { + return n1; + } + return gcdByEuclidsAlgorithm(n2, n1 % n2); + } + + public static int gcdBySteinsAlgorithm(int n1, int n2) { + if (n1 == 0) { + return n2; + } + + if (n2 == 0) { + return n1; + } + + int n; + for (n = 0; ((n1 | n2) & 1) == 0; n++) { + n1 >>= 1; + n2 >>= 1; + } + + while ((n1 & 1) == 0) { + n1 >>= 1; + } + + do { + while ((n2 & 1) == 0) { + n2 >>= 1; + } + + if (n1 > n2) { + int temp = n1; + n1 = n2; + n2 = temp; + } + n2 = (n2 - n1); + } while (n2 != 0); + return n1 << n; + } +} diff --git a/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/algorithms/percentage/PercentageCalculator.java b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/algorithms/percentage/PercentageCalculator.java new file mode 100644 index 0000000000..f69b23146e --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/main/java/com/baeldung/algorithms/percentage/PercentageCalculator.java @@ -0,0 +1,21 @@ +package com.baeldung.algorithms.percentage; + +import java.util.Scanner; + +public class PercentageCalculator { + + public double calculatePercentage(double obtained,double total){ + return obtained*100/total; + } + + public static void main(String[] args) { + PercentageCalculator pc = new PercentageCalculator(); + Scanner in = new Scanner(System.in); + System.out.println("Enter obtained marks:"); + double obtained = in.nextDouble(); + System.out.println("Enter total marks:"); + double total =in.nextDouble(); + System.out.println("Percentage obtained :"+pc.calculatePercentage(obtained,total)); + } + +} diff --git a/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java new file mode 100644 index 0000000000..d2c91a2eb8 --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/gcd/GCDImplementationUnitTest.java @@ -0,0 +1,32 @@ +package com.baeldung.algorithms.gcd; + +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +public class GCDImplementationUnitTest { + + @Test + public void whenCalculatingGCDByBruteForceMethod_thenCorrect() { + int n1 = 60; + int n2 = 90; + int gcd = GCDImplementation.gcdByBruteForce(n1, n2); + assertThat(gcd).isEqualTo(30); + } + + @Test + public void whenCalculatingGCDByEuclidsAlgorithm_thenCorrect() { + int n1 = 60; + int n2 = 90; + int gcd = GCDImplementation.gcdByEuclidsAlgorithm(n1, n2); + assertThat(gcd).isEqualTo(30); + } + + @Test + public void whenCalculatingGCDBySteinsAlgorithm_thenCorrect() { + int n1 = 60; + int n2 = 90; + int gcd = GCDImplementation.gcdBySteinsAlgorithm(n1, n2); + assertThat(gcd).isEqualTo(30); + } +} diff --git a/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java new file mode 100644 index 0000000000..facad1edc4 --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/logarithm/LogarithmUnitTest.java @@ -0,0 +1,31 @@ +package com.baeldung.algorithms.logarithm; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.Test; + +public class LogarithmUnitTest { + + @Test + public void givenLog10_shouldReturnValidResults() { + assertEquals(Math.log10(100), 2); + assertEquals(Math.log10(1000), 3); + } + + @Test + public void givenLogE_shouldReturnValidResults() { + assertEquals(Math.log(Math.E), 1); + assertEquals(Math.log(10), 2.30258, 0.00001); + } + + @Test + public void givenCustomLog_shouldReturnValidResults() { + assertEquals(customLog(2, 256), 8); + assertEquals(customLog(10, 100), 2); + } + + private static double customLog(double base, double logNumber) { + return Math.log(logNumber) / Math.log(base); + } + +} diff --git a/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/percentage/PercentageCalculatorUnitTest.java b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/percentage/PercentageCalculatorUnitTest.java new file mode 100644 index 0000000000..e49acc0c4b --- /dev/null +++ b/core-java-modules/core-java-lang-math/src/test/java/com/baeldung/algorithms/percentage/PercentageCalculatorUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.algorithms.percentage; + +import org.junit.Assert; +import org.junit.Test; + +public class PercentageCalculatorUnitTest { + private PercentageCalculator pc = new PercentageCalculator(); + + @Test + public void whenPass2Integers_thenShouldCalculatePercentage(){ + Assert.assertEquals("Result not as expected", + 50.0,pc.calculatePercentage(50,100),0.1); + } + + @Test + public void whenPassObtainedMarksAsDouble_thenShouldCalculatePercentage(){ + Assert.assertEquals("Result not as expected",5.05, + pc.calculatePercentage(50.5,1000),0.1); + } + + @Test + public void whenPassTotalMarksAsDouble_thenShouldCalculatePercentage(){ + Assert.assertEquals("Result not as expected",19.6, + pc.calculatePercentage(5,25.5),0.1); + } + + @Test + public void whenPass2DoubleNumbers_thenShouldCalculatePercentage(){ + Assert.assertEquals("Result not as expected",20, + pc.calculatePercentage(5.5,27.5),0.1); + } + +} From 96cfd0af12cf909a57ceecbdb1df8436f0cd83b2 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 22 Mar 2020 16:56:34 +0530 Subject: [PATCH 062/130] JAVA-626 : Added new module, replacement for the retired java-math --- .../core-java-lang-math-2/.gitignore | 4 + .../core-java-lang-math-2/README.md | 16 +++ .../core-java-lang-math-2/pom.xml | 90 +++++++++++++ .../ApacheCommonsCombinationGenerator.java | 29 +++++ .../CombinatoricsLibCombinationGenerator.java | 13 ++ .../GuavaCombinationsGenerator.java | 17 +++ .../IterativeCombinationGenerator.java | 52 ++++++++ ...electionRecursiveCombinationGenerator.java | 53 ++++++++ .../SetRecursiveCombinationGenerator.java | 50 ++++++++ .../DistanceBetweenPointsService.java | 38 ++++++ .../algorithms/factorial/Factorial.java | 63 +++++++++ .../LinesIntersectionService.java | 21 +++ .../mercator/EllipticalMercator.java | 22 ++++ .../algorithms/mercator/Mercator.java | 10 ++ .../mercator/SphericalMercator.java | 14 ++ .../algorithms/rectanglesoverlap/Point.java | 29 +++++ .../rectanglesoverlap/Rectangle.java | 40 ++++++ .../roundedup/RoundUpToHundred.java | 20 +++ .../com/baeldung/matrices/HomemadeMatrix.java | 23 ++++ .../BigMatrixMultiplicationBenchmarking.java | 121 ++++++++++++++++++ .../matrices/benchmark/BigMatrixProvider.java | 46 +++++++ .../MatrixMultiplicationBenchmarking.java | 86 +++++++++++++ .../matrices/benchmark/MatrixProvider.java | 33 +++++ .../src/main/resources/logback.xml | 13 ++ .../combination/CombinationUnitTest.java | 35 +++++ .../DistanceBetweenPointsServiceUnitTest.java | 52 ++++++++ .../factorial/FactorialUnitTest.java | 72 +++++++++++ .../LinesIntersectionServiceUnitTest.java | 40 ++++++ .../mercator/EllipticalMercatorUnitTest.java | 22 ++++ .../mercator/SphericalMercatorUnitTest.java | 21 +++ .../rectanglesoverlap/RectangleUnitTest.java | 39 ++++++ .../roundedup/RoundUpToHundredUnitTest.java | 14 ++ .../matrices/apache/RealMatrixUnitTest.java | 41 ++++++ .../matrices/colt/DoubleMatrix2DUnitTest.java | 46 +++++++ .../matrices/ejml/SimpleMatrixUnitTest.java | 41 ++++++ .../homemade/HomemadeMatrixUnitTest.java | 54 ++++++++ .../matrices/la4j/Basic2DMatrixUnitTest.java | 42 ++++++ .../matrices/nd4j/INDArrayUnitTest.java | 42 ++++++ 38 files changed, 1464 insertions(+) create mode 100644 core-java-modules/core-java-lang-math-2/.gitignore create mode 100644 core-java-modules/core-java-lang-math-2/README.md create mode 100644 core-java-modules/core-java-lang-math-2/pom.xml create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/ApacheCommonsCombinationGenerator.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/CombinatoricsLibCombinationGenerator.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/GuavaCombinationsGenerator.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/IterativeCombinationGenerator.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/SelectionRecursiveCombinationGenerator.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/SetRecursiveCombinationGenerator.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/factorial/Factorial.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/EllipticalMercator.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/Mercator.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/SphericalMercator.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/roundedup/RoundUpToHundred.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/HomemadeMatrix.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/BigMatrixMultiplicationBenchmarking.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/BigMatrixProvider.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/MatrixMultiplicationBenchmarking.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/MatrixProvider.java create mode 100644 core-java-modules/core-java-lang-math-2/src/main/resources/logback.xml create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/combination/CombinationUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/factorial/FactorialUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/mercator/EllipticalMercatorUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/mercator/SphericalMercatorUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/roundedup/RoundUpToHundredUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/apache/RealMatrixUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/homemade/HomemadeMatrixUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java create mode 100644 core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java diff --git a/core-java-modules/core-java-lang-math-2/.gitignore b/core-java-modules/core-java-lang-math-2/.gitignore new file mode 100644 index 0000000000..30b2b7442c --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/.gitignore @@ -0,0 +1,4 @@ +/target/ +.settings/ +.classpath +.project \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/README.md b/core-java-modules/core-java-lang-math-2/README.md new file mode 100644 index 0000000000..f05c8804ba --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/README.md @@ -0,0 +1,16 @@ +## Java Math + +This module contains articles about math in Java. + +### Relevant articles: + +- [Calculate Factorial in Java](https://www.baeldung.com/java-calculate-factorial) +- [Generate Combinations in Java](https://www.baeldung.com/java-combinations-algorithm) +- [Check If Two Rectangles Overlap In Java](https://www.baeldung.com/java-check-if-two-rectangles-overlap) +- [Calculate the Distance Between Two Points in Java](https://www.baeldung.com/java-distance-between-two-points) +- [Find the Intersection of Two Lines in Java](https://www.baeldung.com/java-intersection-of-two-lines) +- [Round Up to the Nearest Hundred](https://www.baeldung.com/java-round-up-nearest-hundred) +- [Convert Latitude and Longitude to a 2D Point in Java](https://www.baeldung.com/java-convert-latitude-longitude) +- [Debugging with Eclipse](https://www.baeldung.com/eclipse-debugging) +- [Matrix Multiplication in Java](https://www.baeldung.com/java-matrix-multiplication) +- More articles: [[<-- prev]](/../core-java-lang-math) diff --git a/core-java-modules/core-java-lang-math-2/pom.xml b/core-java-modules/core-java-lang-math-2/pom.xml new file mode 100644 index 0000000000..92ebcc6a94 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/pom.xml @@ -0,0 +1,90 @@ + + + 4.0.0 + core-java-lang-math-2 + 0.0.1-SNAPSHOT + core-java-lang-math-2 + + + com.baeldung + parent-java + 0.0.1-SNAPSHOT + ../../parent-java + + + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + org.ejml + ejml-all + ${ejml.version} + + + org.nd4j + nd4j-native + ${nd4j.version} + + + org.la4j + la4j + ${la4j.version} + + + colt + colt + ${colt.version} + + + com.google.guava + guava + ${guava.version} + + + org.assertj + assertj-core + ${org.assertj.core.version} + test + + + com.github.dpaukov + combinatoricslib3 + ${combinatoricslib3.version} + + + + org.openjdk.jmh + jmh-generator-annprocess + ${jmh.version} + + + + + + + + org.codehaus.mojo + exec-maven-plugin + ${exec-maven-plugin.version} + + + + + + + 3.6.1 + 3.9.0 + 27.0.1-jre + 3.3.0 + 0.38 + 1.0.0-beta4 + 1.2.0 + 0.6.0 + 1.19 + + + \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/ApacheCommonsCombinationGenerator.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/ApacheCommonsCombinationGenerator.java new file mode 100644 index 0000000000..40142ce940 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/ApacheCommonsCombinationGenerator.java @@ -0,0 +1,29 @@ +package com.baeldung.algorithms.combination; + +import java.util.Arrays; +import java.util.Iterator; + +import org.apache.commons.math3.util.CombinatoricsUtils; + +public class ApacheCommonsCombinationGenerator { + + private static final int N = 6; + private static final int R = 3; + + /** + * Print all combinations of r elements from a set + * @param n - number of elements in set + * @param r - number of elements in selection + */ + public static void generate(int n, int r) { + Iterator iterator = CombinatoricsUtils.combinationsIterator(n, r); + while (iterator.hasNext()) { + final int[] combination = iterator.next(); + System.out.println(Arrays.toString(combination)); + } + } + + public static void main(String[] args) { + generate(N, R); + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/CombinatoricsLibCombinationGenerator.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/CombinatoricsLibCombinationGenerator.java new file mode 100644 index 0000000000..0afdeefb8b --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/CombinatoricsLibCombinationGenerator.java @@ -0,0 +1,13 @@ +package com.baeldung.algorithms.combination; + +import org.paukov.combinatorics3.Generator; + +public class CombinatoricsLibCombinationGenerator { + + public static void main(String[] args) { + Generator.combination(0, 1, 2, 3, 4, 5) + .simple(3) + .stream() + .forEach(System.out::println); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/GuavaCombinationsGenerator.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/GuavaCombinationsGenerator.java new file mode 100644 index 0000000000..d2783881ba --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/GuavaCombinationsGenerator.java @@ -0,0 +1,17 @@ +package com.baeldung.algorithms.combination; + +import java.util.Arrays; +import java.util.Set; + +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Sets; + +public class GuavaCombinationsGenerator { + + public static void main(String[] args) { + + Set> combinations = Sets.combinations(ImmutableSet.of(0, 1, 2, 3, 4, 5), 3); + System.out.println(combinations.size()); + System.out.println(Arrays.toString(combinations.toArray())); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/IterativeCombinationGenerator.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/IterativeCombinationGenerator.java new file mode 100644 index 0000000000..676d2f41e3 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/IterativeCombinationGenerator.java @@ -0,0 +1,52 @@ +package com.baeldung.algorithms.combination; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class IterativeCombinationGenerator { + + private static final int N = 5; + private static final int R = 2; + + /** + * Generate all combinations of r elements from a set + * @param n the number of elements in input set + * @param r the number of elements in a combination + * @return the list containing all combinations + */ + public List generate(int n, int r) { + List combinations = new ArrayList<>(); + int[] combination = new int[r]; + + // initialize with lowest lexicographic combination + for (int i = 0; i < r; i++) { + combination[i] = i; + } + + while (combination[r - 1] < n) { + combinations.add(combination.clone()); + + // generate next combination in lexicographic order + int t = r - 1; + while (t != 0 && combination[t] == n - r + t) { + t--; + } + combination[t]++; + for (int i = t + 1; i < r; i++) { + combination[i] = combination[i - 1] + 1; + } + } + + return combinations; + } + + public static void main(String[] args) { + IterativeCombinationGenerator generator = new IterativeCombinationGenerator(); + List combinations = generator.generate(N, R); + System.out.println(combinations.size()); + for (int[] combination : combinations) { + System.out.println(Arrays.toString(combination)); + } + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/SelectionRecursiveCombinationGenerator.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/SelectionRecursiveCombinationGenerator.java new file mode 100644 index 0000000000..52305b8c2f --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/SelectionRecursiveCombinationGenerator.java @@ -0,0 +1,53 @@ +package com.baeldung.algorithms.combination; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class SelectionRecursiveCombinationGenerator { + + private static final int N = 6; + private static final int R = 3; + + /** + * Generate all combinations of r elements from a set + * @param n - number of elements in input set + * @param r - number of elements to be chosen + * @return the list containing all combinations + */ + public List generate(int n, int r) { + List combinations = new ArrayList<>(); + helper(combinations, new int[r], 0, n - 1, 0); + return combinations; + } + + /** + * Choose elements from set by recursing over elements selected + * @param combinations - List to store generated combinations + * @param data - current combination + * @param start - starting element of remaining set + * @param end - last element of remaining set + * @param index - number of elements chosen so far. + */ + private void helper(List combinations, int data[], int start, int end, int index) { + if (index == data.length) { + int[] combination = data.clone(); + combinations.add(combination); + } else { + int max = Math.min(end, end + 1 - data.length + index); + for (int i = start; i <= max; i++) { + data[index] = i; + helper(combinations, data, i + 1, end, index + 1); + } + } + } + + public static void main(String[] args) { + SelectionRecursiveCombinationGenerator generator = new SelectionRecursiveCombinationGenerator(); + List combinations = generator.generate(N, R); + for (int[] combination : combinations) { + System.out.println(Arrays.toString(combination)); + } + System.out.printf("generated %d combinations of %d items from %d ", combinations.size(), R, N); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/SetRecursiveCombinationGenerator.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/SetRecursiveCombinationGenerator.java new file mode 100644 index 0000000000..a73447b31d --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/combination/SetRecursiveCombinationGenerator.java @@ -0,0 +1,50 @@ +package com.baeldung.algorithms.combination; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class SetRecursiveCombinationGenerator { + + private static final int N = 5; + private static final int R = 2; + + /** + * Generate all combinations of r elements from a set + * @param n - number of elements in set + * @param r - number of elements in selection + * @return the list containing all combinations + */ + public List generate(int n, int r) { + List combinations = new ArrayList<>(); + helper(combinations, new int[r], 0, n-1, 0); + return combinations; + } + + /** + * @param combinations - List to contain the generated combinations + * @param data - List of elements in the selection + * @param start - index of the starting element in the remaining set + * @param end - index of the last element in the set + * @param index - number of elements selected so far + */ + private void helper(List combinations, int data[], int start, int end, int index) { + if (index == data.length) { + int[] combination = data.clone(); + combinations.add(combination); + } else if (start <= end) { + data[index] = start; + helper(combinations, data, start + 1, end, index + 1); + helper(combinations, data, start + 1, end, index); + } + } + + public static void main(String[] args) { + SetRecursiveCombinationGenerator generator = new SetRecursiveCombinationGenerator(); + List combinations = generator.generate(N, R); + for (int[] combination : combinations) { + System.out.println(Arrays.toString(combination)); + } + System.out.printf("generated %d combinations of %d items from %d ", combinations.size(), R, N); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java new file mode 100644 index 0000000000..0c8eb86a38 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsService.java @@ -0,0 +1,38 @@ +package com.baeldung.algorithms.distancebetweenpoints; + +import java.awt.geom.Point2D; + +public class DistanceBetweenPointsService { + + public double calculateDistanceBetweenPoints( + double x1, + double y1, + double x2, + double y2) { + + return Math.sqrt((y2 - y1) * (y2 - y1) + (x2 - x1) * (x2 - x1)); + } + + public double calculateDistanceBetweenPointsWithHypot( + double x1, + double y1, + double x2, + double y2) { + + double ac = Math.abs(y2 - y1); + double cb = Math.abs(x2 - x1); + + return Math.hypot(ac, cb); + } + + public double calculateDistanceBetweenPointsWithPoint2D( + double x1, + double y1, + double x2, + double y2) { + + return Point2D.distance(x1, y1, x2, y2); + + } + +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/factorial/Factorial.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/factorial/Factorial.java new file mode 100644 index 0000000000..43d2221773 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/factorial/Factorial.java @@ -0,0 +1,63 @@ +package com.baeldung.algorithms.factorial; + +import java.math.BigInteger; +import java.util.stream.LongStream; + +import org.apache.commons.math3.util.CombinatoricsUtils; + +import com.google.common.math.BigIntegerMath; + +public class Factorial { + + public long factorialUsingForLoop(int n) { + long fact = 1; + for (int i = 2; i <= n; i++) { + fact = fact * i; + } + return fact; + } + + public long factorialUsingStreams(int n) { + return LongStream.rangeClosed(1, n) + .reduce(1, (long x, long y) -> x * y); + } + + public long factorialUsingRecursion(int n) { + if (n <= 2) { + return n; + } + return n * factorialUsingRecursion(n - 1); + } + + private Long[] factorials = new Long[20]; + + public long factorialUsingMemoize(int n) { + + if (factorials[n] != null) { + return factorials[n]; + } + + if (n <= 2) { + return n; + } + long nthValue = n * factorialUsingMemoize(n - 1); + factorials[n] = nthValue; + return nthValue; + } + + public BigInteger factorialHavingLargeResult(int n) { + BigInteger result = BigInteger.ONE; + for (int i = 2; i <= n; i++) + result = result.multiply(BigInteger.valueOf(i)); + return result; + } + + public long factorialUsingApacheCommons(int n) { + return CombinatoricsUtils.factorial(n); + } + + public BigInteger factorialUsingGuava(int n) { + return BigIntegerMath.factorial(n); + } + +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java new file mode 100644 index 0000000000..35d6c8b424 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/linesintersection/LinesIntersectionService.java @@ -0,0 +1,21 @@ +package com.baeldung.algorithms.linesintersection; + +import java.awt.Point; +import java.util.Optional; + +public class LinesIntersectionService { + + public Optional calculateIntersectionPoint(double m1, double b1, double m2, double b2) { + + if (m1 == m2) { + return Optional.empty(); + } + + double x = (b2 - b1) / (m1 - m2); + double y = m1 * x + b1; + + Point point = new Point(); + point.setLocation(x, y); + return Optional.of(point); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/EllipticalMercator.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/EllipticalMercator.java new file mode 100644 index 0000000000..e1c41f9518 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/EllipticalMercator.java @@ -0,0 +1,22 @@ +package com.baeldung.algorithms.mercator; + +class EllipticalMercator extends Mercator { + + @Override + double yAxisProjection(double input) { + + input = Math.min(Math.max(input, -89.5), 89.5); + double earthDimensionalRateNormalized = 1.0 - Math.pow(RADIUS_MINOR / RADIUS_MAJOR, 2); + + double inputOnEarthProj = Math.sqrt(earthDimensionalRateNormalized) * Math.sin( Math.toRadians(input)); + + inputOnEarthProj = Math.pow(((1.0 - inputOnEarthProj)/(1.0+inputOnEarthProj)), 0.5 * Math.sqrt(earthDimensionalRateNormalized)); + double inputOnEarthProjNormalized = Math.tan(0.5 * ((Math.PI*0.5) - Math.toRadians(input)))/inputOnEarthProj; + return (-1) * RADIUS_MAJOR * Math.log(inputOnEarthProjNormalized); + } + + @Override + double xAxisProjection(double input) { + return RADIUS_MAJOR * Math.toRadians(input); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/Mercator.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/Mercator.java new file mode 100644 index 0000000000..b289b1839d --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/Mercator.java @@ -0,0 +1,10 @@ +package com.baeldung.algorithms.mercator; + +abstract class Mercator { + final static double RADIUS_MAJOR = 6378137.0; + final static double RADIUS_MINOR = 6356752.3142; + + abstract double yAxisProjection(double input); + + abstract double xAxisProjection(double input); +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/SphericalMercator.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/SphericalMercator.java new file mode 100644 index 0000000000..1be976d82e --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/mercator/SphericalMercator.java @@ -0,0 +1,14 @@ +package com.baeldung.algorithms.mercator; + +public class SphericalMercator extends Mercator { + + @Override + double xAxisProjection(double input) { + return Math.toRadians(input) * RADIUS_MAJOR; + } + + @Override + double yAxisProjection(double input) { + return Math.log(Math.tan(Math.PI / 4 + Math.toRadians(input) / 2)) * RADIUS_MAJOR; + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java new file mode 100644 index 0000000000..68b1e7c594 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Point.java @@ -0,0 +1,29 @@ +package com.baeldung.algorithms.rectanglesoverlap; + +public class Point { + + private int x; + private int y; + + public Point(int x, int y) { + this.x = x; + this.y = y; + } + + public int getX() { + return x; + } + + public void setX(int x) { + this.x = x; + } + + public int getY() { + return y; + } + + public void setY(int y) { + this.y = y; + } + +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java new file mode 100644 index 0000000000..38f5edec61 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/rectanglesoverlap/Rectangle.java @@ -0,0 +1,40 @@ +package com.baeldung.algorithms.rectanglesoverlap; + +public class Rectangle { + + private Point bottomLeft; + private Point topRight; + + public Rectangle(Point bottomLeft, Point topRight) { + this.bottomLeft = bottomLeft; + this.topRight = topRight; + } + + public Point getBottomLeft() { + return bottomLeft; + } + + public void setBottomLeft(Point bottomLeft) { + this.bottomLeft = bottomLeft; + } + + public Point getTopRight() { + return topRight; + } + + public void setTopRight(Point topRight) { + this.topRight = topRight; + } + + public boolean isOverlapping(Rectangle other) { + // one rectangle is to the top of the other + if (this.topRight.getY() < other.bottomLeft.getY() || this.bottomLeft.getY() > other.topRight.getY()) { + return false; + } + // one rectangle is to the left of the other + if (this.topRight.getX() < other.bottomLeft.getX() || this.bottomLeft.getX() > other.topRight.getX()) { + return false; + } + return true; + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/roundedup/RoundUpToHundred.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/roundedup/RoundUpToHundred.java new file mode 100644 index 0000000000..333019e294 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/algorithms/roundedup/RoundUpToHundred.java @@ -0,0 +1,20 @@ +package com.baeldung.algorithms.roundedup; + +import java.util.Scanner; + +public class RoundUpToHundred { + + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + double input = scanner.nextDouble(); + scanner.close(); + + RoundUpToHundred.round(input); + } + + static long round(double input) { + long i = (long) Math.ceil(input); + return ((i + 99) / 100) * 100; + }; + +} diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/HomemadeMatrix.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/HomemadeMatrix.java new file mode 100644 index 0000000000..0676250959 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/HomemadeMatrix.java @@ -0,0 +1,23 @@ +package com.baeldung.matrices; + +public class HomemadeMatrix { + public static double[][] multiplyMatrices(double[][] firstMatrix, double[][] secondMatrix) { + double[][] result = new double[firstMatrix.length][secondMatrix[0].length]; + + for (int row = 0; row < result.length; row++) { + for (int col = 0; col < result[row].length; col++) { + result[row][col] = multiplyMatricesCell(firstMatrix, secondMatrix, row, col); + } + } + + return result; + } + + private static double multiplyMatricesCell(double[][] firstMatrix, double[][] secondMatrix, int row, int col) { + double cell = 0; + for (int i = 0; i < secondMatrix.length; i++) { + cell += firstMatrix[row][i] * secondMatrix[i][col]; + } + return cell; + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/BigMatrixMultiplicationBenchmarking.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/BigMatrixMultiplicationBenchmarking.java new file mode 100644 index 0000000000..2ed983f733 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/BigMatrixMultiplicationBenchmarking.java @@ -0,0 +1,121 @@ +package com.baeldung.matrices.benchmark; + +import cern.colt.matrix.DoubleFactory2D; +import cern.colt.matrix.DoubleMatrix2D; +import cern.colt.matrix.linalg.Algebra; +import com.baeldung.matrices.HomemadeMatrix; +import org.apache.commons.math3.linear.Array2DRowRealMatrix; +import org.apache.commons.math3.linear.RealMatrix; +import org.ejml.simple.SimpleMatrix; +import org.la4j.Matrix; +import org.la4j.matrix.dense.Basic2DMatrix; +import org.nd4j.linalg.api.ndarray.INDArray; +import org.nd4j.linalg.factory.Nd4j; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.options.ChainedOptionsBuilder; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +import java.util.Arrays; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import java.util.stream.Collectors; + +public class BigMatrixMultiplicationBenchmarking { + private static final int DEFAULT_FORKS = 2; + private static final int DEFAULT_WARMUP_ITERATIONS = 5; + private static final int DEFAULT_MEASUREMENT_ITERATIONS = 10; + + public static void main(String[] args) throws Exception { + Map parameters = parseParameters(args); + + ChainedOptionsBuilder builder = new OptionsBuilder() + .include(BigMatrixMultiplicationBenchmarking.class.getSimpleName()) + .mode(Mode.AverageTime) + .forks(forks(parameters)) + .warmupIterations(warmupIterations(parameters)) + .measurementIterations(measurementIterations(parameters)) + .timeUnit(TimeUnit.SECONDS); + + parameters.forEach(builder::param); + + new Runner(builder.build()).run(); + } + + private static Map parseParameters(String[] args) { + return Arrays.stream(args) + .map(arg -> arg.split("=")) + .collect(Collectors.toMap( + arg -> arg[0], + arg -> arg[1] + )); + } + + private static int forks(Map parameters) { + String forks = parameters.remove("forks"); + return parseOrDefault(forks, DEFAULT_FORKS); + } + + private static int warmupIterations(Map parameters) { + String warmups = parameters.remove("warmupIterations"); + return parseOrDefault(warmups, DEFAULT_WARMUP_ITERATIONS); + } + + private static int measurementIterations(Map parameters) { + String measurements = parameters.remove("measurementIterations"); + return parseOrDefault(measurements, DEFAULT_MEASUREMENT_ITERATIONS); + } + + private static int parseOrDefault(String parameter, int defaultValue) { + return parameter != null ? Integer.parseInt(parameter) : defaultValue; + } + + @Benchmark + public Object homemadeMatrixMultiplication(BigMatrixProvider matrixProvider) { + return HomemadeMatrix.multiplyMatrices(matrixProvider.getFirstMatrix(), matrixProvider.getSecondMatrix()); + } + + @Benchmark + public Object ejmlMatrixMultiplication(BigMatrixProvider matrixProvider) { + SimpleMatrix firstMatrix = new SimpleMatrix(matrixProvider.getFirstMatrix()); + SimpleMatrix secondMatrix = new SimpleMatrix(matrixProvider.getSecondMatrix()); + + return firstMatrix.mult(secondMatrix); + } + + @Benchmark + public Object apacheCommonsMatrixMultiplication(BigMatrixProvider matrixProvider) { + RealMatrix firstMatrix = new Array2DRowRealMatrix(matrixProvider.getFirstMatrix()); + RealMatrix secondMatrix = new Array2DRowRealMatrix(matrixProvider.getSecondMatrix()); + + return firstMatrix.multiply(secondMatrix); + } + + @Benchmark + public Object la4jMatrixMultiplication(BigMatrixProvider matrixProvider) { + Matrix firstMatrix = new Basic2DMatrix(matrixProvider.getFirstMatrix()); + Matrix secondMatrix = new Basic2DMatrix(matrixProvider.getSecondMatrix()); + + return firstMatrix.multiply(secondMatrix); + } + + @Benchmark + public Object nd4jMatrixMultiplication(BigMatrixProvider matrixProvider) { + INDArray firstMatrix = Nd4j.create(matrixProvider.getFirstMatrix()); + INDArray secondMatrix = Nd4j.create(matrixProvider.getSecondMatrix()); + + return firstMatrix.mmul(secondMatrix); + } + + @Benchmark + public Object coltMatrixMultiplication(BigMatrixProvider matrixProvider) { + DoubleFactory2D doubleFactory2D = DoubleFactory2D.dense; + + DoubleMatrix2D firstMatrix = doubleFactory2D.make(matrixProvider.getFirstMatrix()); + DoubleMatrix2D secondMatrix = doubleFactory2D.make(matrixProvider.getSecondMatrix()); + + Algebra algebra = new Algebra(); + return algebra.mult(firstMatrix, secondMatrix); + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/BigMatrixProvider.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/BigMatrixProvider.java new file mode 100644 index 0000000000..d0f8a03fe3 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/BigMatrixProvider.java @@ -0,0 +1,46 @@ +package com.baeldung.matrices.benchmark; + +import org.openjdk.jmh.annotations.Param; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.infra.BenchmarkParams; + +import java.util.Random; +import java.util.stream.DoubleStream; + +@State(Scope.Benchmark) +public class BigMatrixProvider { + @Param({}) + private int matrixSize; + private double[][] firstMatrix; + private double[][] secondMatrix; + + public BigMatrixProvider() {} + + @Setup + public void setup(BenchmarkParams parameters) { + firstMatrix = createMatrix(matrixSize); + secondMatrix = createMatrix(matrixSize); + } + + private double[][] createMatrix(int matrixSize) { + Random random = new Random(); + + double[][] result = new double[matrixSize][matrixSize]; + for (int row = 0; row < result.length; row++) { + for (int col = 0; col < result[row].length; col++) { + result[row][col] = random.nextDouble(); + } + } + return result; + } + + public double[][] getFirstMatrix() { + return firstMatrix; + } + + public double[][] getSecondMatrix() { + return secondMatrix; + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/MatrixMultiplicationBenchmarking.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/MatrixMultiplicationBenchmarking.java new file mode 100644 index 0000000000..fdb423e8da --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/MatrixMultiplicationBenchmarking.java @@ -0,0 +1,86 @@ +package com.baeldung.matrices.benchmark; + +import cern.colt.matrix.DoubleFactory2D; +import cern.colt.matrix.DoubleMatrix2D; +import cern.colt.matrix.linalg.Algebra; +import com.baeldung.matrices.HomemadeMatrix; +import org.apache.commons.math3.linear.Array2DRowRealMatrix; +import org.apache.commons.math3.linear.RealMatrix; +import org.ejml.simple.SimpleMatrix; +import org.la4j.Matrix; +import org.la4j.matrix.dense.Basic2DMatrix; +import org.nd4j.linalg.api.ndarray.INDArray; +import org.nd4j.linalg.factory.Nd4j; +import org.openjdk.jmh.annotations.Benchmark; +import org.openjdk.jmh.annotations.Mode; +import org.openjdk.jmh.runner.Runner; +import org.openjdk.jmh.runner.options.Options; +import org.openjdk.jmh.runner.options.OptionsBuilder; + +import java.util.concurrent.TimeUnit; + +public class MatrixMultiplicationBenchmarking { + + public static void main(String[] args) throws Exception { + Options opt = new OptionsBuilder() + .include(MatrixMultiplicationBenchmarking.class.getSimpleName()) + .exclude(BigMatrixMultiplicationBenchmarking.class.getSimpleName()) + .mode(Mode.AverageTime) + .forks(2) + .warmupIterations(10) + .measurementIterations(10) + .timeUnit(TimeUnit.MICROSECONDS) + .build(); + + new Runner(opt).run(); + } + + @Benchmark + public Object homemadeMatrixMultiplication(MatrixProvider matrixProvider) { + return HomemadeMatrix.multiplyMatrices(matrixProvider.getFirstMatrix(), matrixProvider.getSecondMatrix()); + } + + @Benchmark + public Object ejmlMatrixMultiplication(MatrixProvider matrixProvider) { + SimpleMatrix firstMatrix = new SimpleMatrix(matrixProvider.getFirstMatrix()); + SimpleMatrix secondMatrix = new SimpleMatrix(matrixProvider.getSecondMatrix()); + + return firstMatrix.mult(secondMatrix); + } + + @Benchmark + public Object apacheCommonsMatrixMultiplication(MatrixProvider matrixProvider) { + RealMatrix firstMatrix = new Array2DRowRealMatrix(matrixProvider.getFirstMatrix()); + RealMatrix secondMatrix = new Array2DRowRealMatrix(matrixProvider.getSecondMatrix()); + + return firstMatrix.multiply(secondMatrix); + } + + @Benchmark + public Object la4jMatrixMultiplication(MatrixProvider matrixProvider) { + Matrix firstMatrix = new Basic2DMatrix(matrixProvider.getFirstMatrix()); + Matrix secondMatrix = new Basic2DMatrix(matrixProvider.getSecondMatrix()); + + return firstMatrix.multiply(secondMatrix); + } + + @Benchmark + public Object nd4jMatrixMultiplication(MatrixProvider matrixProvider) { + INDArray firstMatrix = Nd4j.create(matrixProvider.getFirstMatrix()); + INDArray secondMatrix = Nd4j.create(matrixProvider.getSecondMatrix()); + + return firstMatrix.mmul(secondMatrix); + } + + @Benchmark + public Object coltMatrixMultiplication(MatrixProvider matrixProvider) { + DoubleFactory2D doubleFactory2D = DoubleFactory2D.dense; + + DoubleMatrix2D firstMatrix = doubleFactory2D.make(matrixProvider.getFirstMatrix()); + DoubleMatrix2D secondMatrix = doubleFactory2D.make(matrixProvider.getSecondMatrix()); + + Algebra algebra = new Algebra(); + return algebra.mult(firstMatrix, secondMatrix); + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/MatrixProvider.java b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/MatrixProvider.java new file mode 100644 index 0000000000..d401ba2ab6 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/java/com/baeldung/matrices/benchmark/MatrixProvider.java @@ -0,0 +1,33 @@ +package com.baeldung.matrices.benchmark; + +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.State; + +@State(Scope.Benchmark) +public class MatrixProvider { + private double[][] firstMatrix; + private double[][] secondMatrix; + + public MatrixProvider() { + firstMatrix = + new double[][] { + new double[] {1d, 5d}, + new double[] {2d, 3d}, + new double[] {1d ,7d} + }; + + secondMatrix = + new double[][] { + new double[] {1d, 2d, 3d, 7d}, + new double[] {5d, 2d, 8d, 1d} + }; + } + + public double[][] getFirstMatrix() { + return firstMatrix; + } + + public double[][] getSecondMatrix() { + return secondMatrix; + } +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/main/resources/logback.xml b/core-java-modules/core-java-lang-math-2/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/combination/CombinationUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/combination/CombinationUnitTest.java new file mode 100644 index 0000000000..987b6ddae6 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/combination/CombinationUnitTest.java @@ -0,0 +1,35 @@ +package com.baeldung.algorithms.combination; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.util.List; + +import org.junit.Test; + +public class CombinationUnitTest { + + private static final int N = 5; + private static final int R = 3; + private static final int nCr = 10; + + @Test + public void givenSetAndSelectionSize_whenCalculatedUsingSetRecursiveAlgorithm_thenExpectedCount() { + SetRecursiveCombinationGenerator generator = new SetRecursiveCombinationGenerator(); + List selection = generator.generate(N, R); + assertEquals(nCr, selection.size()); + } + + @Test + public void givenSetAndSelectionSize_whenCalculatedUsingSelectionRecursiveAlgorithm_thenExpectedCount() { + SelectionRecursiveCombinationGenerator generator = new SelectionRecursiveCombinationGenerator(); + List selection = generator.generate(N, R); + assertEquals(nCr, selection.size()); + } + + @Test + public void givenSetAndSelectionSize_whenCalculatedUsingIterativeAlgorithm_thenExpectedCount() { + IterativeCombinationGenerator generator = new IterativeCombinationGenerator(); + List selection = generator.generate(N, R); + assertEquals(nCr, selection.size()); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java new file mode 100644 index 0000000000..784681a807 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/distancebetweenpoints/DistanceBetweenPointsServiceUnitTest.java @@ -0,0 +1,52 @@ +package com.baeldung.algorithms.distancebetweenpoints; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class DistanceBetweenPointsServiceUnitTest { + + private DistanceBetweenPointsService service = new DistanceBetweenPointsService(); + + @Test + public void givenTwoPoints_whenCalculateDistanceByFormula_thenCorrect() { + + double x1 = 3; + double y1 = 4; + double x2 = 7; + double y2 = 1; + + double distance = service.calculateDistanceBetweenPoints(x1, y1, x2, y2); + + assertEquals(distance, 5, 0.001); + + } + + @Test + public void givenTwoPoints_whenCalculateDistanceWithHypot_thenCorrect() { + + double x1 = 3; + double y1 = 4; + double x2 = 7; + double y2 = 1; + + double distance = service.calculateDistanceBetweenPointsWithHypot(x1, y1, x2, y2); + + assertEquals(distance, 5, 0.001); + + } + + @Test + public void givenTwoPoints_whenCalculateDistanceWithPoint2D_thenCorrect() { + + double x1 = 3; + double y1 = 4; + double x2 = 7; + double y2 = 1; + + double distance = service.calculateDistanceBetweenPointsWithPoint2D(x1, y1, x2, y2); + + assertEquals(distance, 5, 0.001); + + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/factorial/FactorialUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/factorial/FactorialUnitTest.java new file mode 100644 index 0000000000..c185dba62b --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/factorial/FactorialUnitTest.java @@ -0,0 +1,72 @@ +package com.baeldung.algorithms.factorial; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.math.BigInteger; + +import org.junit.Before; +import org.junit.Test; + +public class FactorialUnitTest { + + Factorial factorial; + + @Before + public void setup() { + factorial = new Factorial(); + } + + @Test + public void whenCalculatingFactorialUsingForLoop_thenCorrect() { + int n = 5; + + assertThat(factorial.factorialUsingForLoop(n)).isEqualTo(120); + } + + @Test + public void whenCalculatingFactorialUsingStreams_thenCorrect() { + int n = 5; + + assertThat(factorial.factorialUsingStreams(n)).isEqualTo(120); + } + + @Test + public void whenCalculatingFactorialUsingRecursion_thenCorrect() { + int n = 5; + + assertThat(factorial.factorialUsingRecursion(n)).isEqualTo(120); + } + + @Test + public void whenCalculatingFactorialUsingMemoize_thenCorrect() { + int n = 5; + + assertThat(factorial.factorialUsingMemoize(n)).isEqualTo(120); + + n = 6; + + assertThat(factorial.factorialUsingMemoize(n)).isEqualTo(720); + } + + @Test + public void whenCalculatingFactorialHavingLargeResult_thenCorrect() { + int n = 22; + + assertThat(factorial.factorialHavingLargeResult(n)).isEqualTo(new BigInteger("1124000727777607680000")); + } + + @Test + public void whenCalculatingFactorialUsingApacheCommons_thenCorrect() { + int n = 5; + + assertThat(factorial.factorialUsingApacheCommons(n)).isEqualTo(120); + } + + @Test + public void whenCalculatingFactorialUsingGuava_thenCorrect() { + int n = 22; + + assertThat(factorial.factorialUsingGuava(n)).isEqualTo(new BigInteger("1124000727777607680000")); + } + +} diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java new file mode 100644 index 0000000000..22371107f3 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/linesintersection/LinesIntersectionServiceUnitTest.java @@ -0,0 +1,40 @@ +package com.baeldung.algorithms.linesintersection; + +import java.awt.Point; +import java.util.Optional; + +import org.junit.Test; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertEquals; + +public class LinesIntersectionServiceUnitTest { + private LinesIntersectionService service = new LinesIntersectionService(); + + @Test + public void givenNotParallelLines_whenCalculatePoint_thenPresent() { + + double m1 = 0; + double b1 = 0; + double m2 = 1; + double b2 = -1; + + Optional point = service.calculateIntersectionPoint(m1, b1, m2, b2); + + assertTrue(point.isPresent()); + assertEquals(point.get().getX(), 1, 0.001); + assertEquals(point.get().getY(), 0, 0.001); + } + + @Test + public void givenParallelLines_whenCalculatePoint_thenEmpty() { + double m1 = 1; + double b1 = 0; + double m2 = 1; + double b2 = -1; + + Optional point = service.calculateIntersectionPoint(m1, b1, m2, b2); + + assertFalse(point.isPresent()); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/mercator/EllipticalMercatorUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/mercator/EllipticalMercatorUnitTest.java new file mode 100644 index 0000000000..96b644c46c --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/mercator/EllipticalMercatorUnitTest.java @@ -0,0 +1,22 @@ +package com.baeldung.algorithms.mercator; + +import org.junit.Assert; +import org.junit.Test; + + +public class EllipticalMercatorUnitTest { + + @Test + public void giventThatTheInputIs22_whenXAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { + Mercator mercator = new EllipticalMercator(); + double result = mercator.xAxisProjection(22); + Assert.assertEquals(result, 2449028.7974520186, 0.0); + } + + @Test + public void giventThatTheInputIs44_whenYAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { + Mercator mercator = new EllipticalMercator(); + double result = mercator.yAxisProjection(44); + Assert.assertEquals(result, 5435749.887511954, 0.0); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/mercator/SphericalMercatorUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/mercator/SphericalMercatorUnitTest.java new file mode 100644 index 0000000000..348c6ad3e4 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/mercator/SphericalMercatorUnitTest.java @@ -0,0 +1,21 @@ +package com.baeldung.algorithms.mercator; + +import org.junit.Assert; +import org.junit.Test; + +public class SphericalMercatorUnitTest { + + @Test + public void giventThatTheInputIs22_whenXAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { + Mercator mercator = new SphericalMercator(); + double result = mercator.xAxisProjection(22); + Assert.assertEquals(result, 2449028.7974520186, 0.0); + } + + @Test + public void giventThatTheInputIs44_whenYAxisProjectionIsCalled_thenTheResultIsTheCorrectOne() { + Mercator mercator = new SphericalMercator(); + double result = mercator.yAxisProjection(44); + Assert.assertEquals(result, 5465442.183322753, 0.0); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java new file mode 100644 index 0000000000..e4bb614b48 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/rectanglesoverlap/RectangleUnitTest.java @@ -0,0 +1,39 @@ +package com.baeldung.algorithms.rectanglesoverlap; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertFalse; +import org.junit.Test; + +public class RectangleUnitTest { + + @Test + public void givenTwoOverlappingRectangles_whenisOverlappingCalled_shouldReturnTrue() { + Rectangle rectangle1 = new Rectangle(new Point(2, 1), new Point(4, 3)); + Rectangle rectangle2 = new Rectangle(new Point(1, 1), new Point(6, 4)); + assertTrue(rectangle1.isOverlapping(rectangle2)); + + rectangle1 = new Rectangle(new Point(-5, -2), new Point(2, 3)); + rectangle2 = new Rectangle(new Point(-2, -1), new Point(5, 2)); + assertTrue(rectangle1.isOverlapping(rectangle2)); + + rectangle1 = new Rectangle(new Point(-5, 1), new Point(2, 4)); + rectangle2 = new Rectangle(new Point(-2, -2), new Point(5, 5)); + assertTrue(rectangle1.isOverlapping(rectangle2)); + } + + @Test + public void givenTwoNonOverlappingRectangles_whenisOverlappingCalled_shouldReturnFalse() { + Rectangle rectangle1 = new Rectangle(new Point(-5, 1), new Point(-3, 4)); + Rectangle rectangle2 = new Rectangle(new Point(-2, -2), new Point(5, 5)); + assertFalse(rectangle1.isOverlapping(rectangle2)); + + rectangle1 = new Rectangle(new Point(-5, 1), new Point(3, 4)); + rectangle2 = new Rectangle(new Point(-2, -2), new Point(5, -1)); + assertFalse(rectangle1.isOverlapping(rectangle2)); + + rectangle1 = new Rectangle(new Point(-2, 1), new Point(0, 3)); + rectangle2 = new Rectangle(new Point(3, 1), new Point(5, 4)); + assertFalse(rectangle1.isOverlapping(rectangle2)); + } + +} diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/roundedup/RoundUpToHundredUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/roundedup/RoundUpToHundredUnitTest.java new file mode 100644 index 0000000000..5191d65787 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/algorithms/roundedup/RoundUpToHundredUnitTest.java @@ -0,0 +1,14 @@ +package com.baeldung.algorithms.roundedup; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class RoundUpToHundredUnitTest { + @Test + public void givenInput_whenRound_thenRoundUpToTheNearestHundred() { + assertEquals("Rounded up to hundred", 100, RoundUpToHundred.round(99)); + assertEquals("Rounded up to three hundred ", 300, RoundUpToHundred.round(200.2)); + assertEquals("Returns same rounded value", 400, RoundUpToHundred.round(400)); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/apache/RealMatrixUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/apache/RealMatrixUnitTest.java new file mode 100644 index 0000000000..e7d99fbe3e --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/apache/RealMatrixUnitTest.java @@ -0,0 +1,41 @@ +package com.baeldung.matrices.apache; + +import org.apache.commons.math3.linear.Array2DRowRealMatrix; +import org.apache.commons.math3.linear.RealMatrix; +import org.junit.jupiter.api.Test; +import org.openjdk.jmh.annotations.*; + +import static org.assertj.core.api.Assertions.assertThat; + +class RealMatrixUnitTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + RealMatrix firstMatrix = new Array2DRowRealMatrix( + new double[][] { + new double[] {1d, 5d}, + new double[] {2d, 3d}, + new double[] {1d ,7d} + } + ); + + RealMatrix secondMatrix = new Array2DRowRealMatrix( + new double[][] { + new double[] {1d, 2d, 3d, 7d}, + new double[] {5d, 2d, 8d, 1d} + } + ); + + RealMatrix expected = new Array2DRowRealMatrix( + new double[][] { + new double[] {26d, 12d, 43d, 12d}, + new double[] {17d, 10d, 30d, 17d}, + new double[] {36d, 16d, 59d, 14d} + } + ); + + RealMatrix actual = firstMatrix.multiply(secondMatrix); + + assertThat(actual).isEqualTo(expected); + } +} diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java new file mode 100644 index 0000000000..da66cd7d61 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/colt/DoubleMatrix2DUnitTest.java @@ -0,0 +1,46 @@ +package com.baeldung.matrices.colt; + +import cern.colt.matrix.DoubleFactory2D; +import cern.colt.matrix.DoubleMatrix2D; +import cern.colt.matrix.linalg.Algebra; +import org.junit.jupiter.api.Test; +import org.openjdk.jmh.annotations.*; + +import static org.assertj.core.api.Assertions.assertThat; + +class DoubleMatrix2DUnitTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + DoubleFactory2D doubleFactory2D = DoubleFactory2D.dense; + + DoubleMatrix2D firstMatrix = doubleFactory2D.make( + new double[][] { + new double[] {1d, 5d}, + new double[] {2d, 3d}, + new double[] {1d ,7d} + } + ); + + DoubleMatrix2D secondMatrix = doubleFactory2D.make( + new double[][] { + new double[] {1d, 2d, 3d, 7d}, + new double[] {5d, 2d, 8d, 1d} + } + ); + + DoubleMatrix2D expected = doubleFactory2D.make( + new double[][] { + new double[] {26d, 12d, 43d, 12d}, + new double[] {17d, 10d, 30d, 17d}, + new double[] {36d, 16d, 59d, 14d} + } + ); + + Algebra algebra = new Algebra(); + DoubleMatrix2D actual = algebra.mult(firstMatrix, secondMatrix); + + assertThat(actual).isEqualTo(expected); + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java new file mode 100644 index 0000000000..60381ece63 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/ejml/SimpleMatrixUnitTest.java @@ -0,0 +1,41 @@ +package com.baeldung.matrices.ejml; + +import org.ejml.simple.SimpleMatrix; +import org.junit.jupiter.api.Test; +import org.openjdk.jmh.annotations.*; + +import static org.assertj.core.api.Assertions.assertThat; + +class SimpleMatrixUnitTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + SimpleMatrix firstMatrix = new SimpleMatrix( + new double[][] { + new double[] {1d, 5d}, + new double[] {2d, 3d}, + new double[] {1d ,7d} + } + ); + + SimpleMatrix secondMatrix = new SimpleMatrix( + new double[][] { + new double[] {1d, 2d, 3d, 7d}, + new double[] {5d, 2d, 8d, 1d} + } + ); + + SimpleMatrix expected = new SimpleMatrix( + new double[][] { + new double[] {26d, 12d, 43d, 12d}, + new double[] {17d, 10d, 30d, 17d}, + new double[] {36d, 16d, 59d, 14d} + } + ); + + SimpleMatrix actual = firstMatrix.mult(secondMatrix); + + assertThat(actual).matches(m -> m.isIdentical(expected, 0d)); + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/homemade/HomemadeMatrixUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/homemade/HomemadeMatrixUnitTest.java new file mode 100644 index 0000000000..d1a062ee79 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/homemade/HomemadeMatrixUnitTest.java @@ -0,0 +1,54 @@ +package com.baeldung.matrices.homemade; + +import org.junit.jupiter.api.Test; +import org.openjdk.jmh.annotations.*; + +import static org.assertj.core.api.Assertions.assertThat; + +class HomemadeMatrixUnitTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + double[][] firstMatrix = { + new double[]{1d, 5d}, + new double[]{2d, 3d}, + new double[]{1d, 7d} + }; + + double[][] secondMatrix = { + new double[]{1d, 2d, 3d, 7d}, + new double[]{5d, 2d, 8d, 1d} + }; + + double[][] expected = { + new double[]{26d, 12d, 43d, 12d}, + new double[]{17d, 10d, 30d, 17d}, + new double[]{36d, 16d, 59d, 14d} + }; + + double[][] actual = multiplyMatrices(firstMatrix, secondMatrix); + + assertThat(actual).isEqualTo(expected); + } + + private double[][] multiplyMatrices(double[][] firstMatrix, double[][] secondMatrix) { + double[][] result = new double[firstMatrix.length][secondMatrix[0].length]; + + for (int row = 0; row < result.length; row++) { + for (int col = 0; col < result[row].length; col++) { + result[row][col] = multiplyMatricesCell(firstMatrix, secondMatrix, row, col); + } + } + + return result; + } + + private double multiplyMatricesCell(double[][] firstMatrix, double[][] secondMatrix, int row, int col) { + double cell = 0; + for (int i = 0; i < secondMatrix.length; i++) { + cell += firstMatrix[row][i] * secondMatrix[i][col]; + } + return cell; + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java new file mode 100644 index 0000000000..01731a3dd5 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/la4j/Basic2DMatrixUnitTest.java @@ -0,0 +1,42 @@ +package com.baeldung.matrices.la4j; + +import org.junit.jupiter.api.Test; +import org.la4j.Matrix; +import org.la4j.matrix.dense.Basic2DMatrix; +import org.openjdk.jmh.annotations.*; + +import static org.assertj.core.api.Assertions.assertThat; + +class Basic2DMatrixUnitTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + Matrix firstMatrix = new Basic2DMatrix( + new double[][]{ + new double[]{1d, 5d}, + new double[]{2d, 3d}, + new double[]{1d, 7d} + } + ); + + Matrix secondMatrix = new Basic2DMatrix( + new double[][]{ + new double[]{1d, 2d, 3d, 7d}, + new double[]{5d, 2d, 8d, 1d} + } + ); + + Matrix expected = new Basic2DMatrix( + new double[][]{ + new double[]{26d, 12d, 43d, 12d}, + new double[]{17d, 10d, 30d, 17d}, + new double[]{36d, 16d, 59d, 14d} + } + ); + + Matrix actual = firstMatrix.multiply(secondMatrix); + + assertThat(actual).isEqualTo(expected); + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java new file mode 100644 index 0000000000..72ef60a571 --- /dev/null +++ b/core-java-modules/core-java-lang-math-2/src/test/java/com/baeldung/matrices/nd4j/INDArrayUnitTest.java @@ -0,0 +1,42 @@ +package com.baeldung.matrices.nd4j; + +import org.junit.jupiter.api.Test; +import org.nd4j.linalg.api.ndarray.INDArray; +import org.nd4j.linalg.factory.Nd4j; +import org.openjdk.jmh.annotations.*; + +import static org.assertj.core.api.Assertions.assertThat; + +class INDArrayUnitTest { + + @Test + void givenTwoMatrices_whenMultiply_thenMultiplicatedMatrix() { + INDArray firstMatrix = Nd4j.create( + new double[][]{ + new double[]{1d, 5d}, + new double[]{2d, 3d}, + new double[]{1d, 7d} + } + ); + + INDArray secondMatrix = Nd4j.create( + new double[][] { + new double[] {1d, 2d, 3d, 7d}, + new double[] {5d, 2d, 8d, 1d} + } + ); + + INDArray expected = Nd4j.create( + new double[][] { + new double[] {26d, 12d, 43d, 12d}, + new double[] {17d, 10d, 30d, 17d}, + new double[] {36d, 16d, 59d, 14d} + } + ); + + INDArray actual = firstMatrix.mmul(secondMatrix); + + assertThat(actual).isEqualTo(expected); + } + +} \ No newline at end of file From 1aba93f3aa0a02420b955db74ec9e8d698489dd5 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 22 Mar 2020 16:57:48 +0530 Subject: [PATCH 063/130] JAVA-626 : added new module to parent module's pom --- core-java-modules/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 326d4bb1c5..5e7ffa37b9 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -76,6 +76,7 @@ core-java-lang core-java-lang-2 core-java-lang-math + core-java-lang-math-2 core-java-lang-oop core-java-lang-oop-2 core-java-lang-oop-3 From 3e9da83493fcaa099930e0885093248eaf7f9840 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 22 Mar 2020 16:59:20 +0530 Subject: [PATCH 064/130] JAVA-626 : removed retired modules from parent pom --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index a295439951..1c887245db 100644 --- a/pom.xml +++ b/pom.xml @@ -455,8 +455,6 @@ javafx java-jdi java-lite - java-math - java-math-2 java-numbers java-numbers-2 java-numbers-3 From ca2694209b61ecebed3010ef7e8a0b54183d94a2 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 22 Mar 2020 17:01:55 +0530 Subject: [PATCH 065/130] removed retired modules from parent pom --- pom.xml | 2 -- 1 file changed, 2 deletions(-) diff --git a/pom.xml b/pom.xml index 1c887245db..b896d61f91 100644 --- a/pom.xml +++ b/pom.xml @@ -966,8 +966,6 @@ javafx java-jdi java-lite - java-math - java-math-2 java-numbers java-numbers-2 java-numbers-3 From eeb864af710ef4e21386048665ea25bb7b0e29cc Mon Sep 17 00:00:00 2001 From: sergio41 Date: Sun, 22 Mar 2020 14:26:52 +0100 Subject: [PATCH 066/130] [BAEL-3910] Code Upload --- .../src/main/resources/config.properties | 1 + .../stringtoolong/StringTooLongUnitTest.java | 38 +++++++++++++++++++ .../src/test/resources/stringtoolong.txt | 1 + 3 files changed, 40 insertions(+) create mode 100644 core-java-modules/core-java-strings/src/main/resources/config.properties create mode 100644 core-java-modules/core-java-strings/src/test/java/com/baeldung/stringtoolong/StringTooLongUnitTest.java create mode 100644 core-java-modules/core-java-strings/src/test/resources/stringtoolong.txt diff --git a/core-java-modules/core-java-strings/src/main/resources/config.properties b/core-java-modules/core-java-strings/src/main/resources/config.properties new file mode 100644 index 0000000000..8197c13543 --- /dev/null +++ b/core-java-modules/core-java-strings/src/main/resources/config.properties @@ -0,0 +1 @@ +string.too.long= StringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLong diff --git a/core-java-modules/core-java-strings/src/test/java/com/baeldung/stringtoolong/StringTooLongUnitTest.java b/core-java-modules/core-java-strings/src/test/java/com/baeldung/stringtoolong/StringTooLongUnitTest.java new file mode 100644 index 0000000000..4035cadb83 --- /dev/null +++ b/core-java-modules/core-java-strings/src/test/java/com/baeldung/stringtoolong/StringTooLongUnitTest.java @@ -0,0 +1,38 @@ +package com.baeldung.stringtoolong; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.apache.commons.io.IOUtils; +import org.junit.Test; + +public class StringTooLongUnitTest { + @Test + public void whenDeclaringTooLongString_thenCompilationError() { + String stringTooLong = ""; + assertThat(stringTooLong).isNotEmpty(); + } + + @Test + public void whenStoringInFileTooLongString_thenNoCompilationError() throws IOException { + FileInputStream fis = new FileInputStream("src/test/resources/stringtoolong.txt"); + String stringTooLong = IOUtils.toString(fis, "UTF-8"); + assertThat(stringTooLong).isNotEmpty(); + } + + @Test + public void whenStoringInPropertiesString_thenNoCompilationError() throws IOException { + String sValue = null; + try (InputStream input = new FileInputStream("src/main/resources/config.properties")) { + Properties prop = new Properties(); + prop.load(input); + sValue = prop.getProperty("string.too.long"); + } + assertThat(sValue).isNotEmpty(); + } +} + \ No newline at end of file diff --git a/core-java-modules/core-java-strings/src/test/resources/stringtoolong.txt b/core-java-modules/core-java-strings/src/test/resources/stringtoolong.txt new file mode 100644 index 0000000000..6b2649aaa8 --- /dev/null +++ b/core-java-modules/core-java-strings/src/test/resources/stringtoolong.txt @@ -0,0 +1 @@ + StringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLongStringTooLong \ No newline at end of file From abf06202695479623623cef89f8a08b0255f2e2c Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Tue, 17 Mar 2020 00:31:37 +0100 Subject: [PATCH 067/130] [BAEL-3914] java regex: \\s vs \\s+ --- ...ReplaceAllWithWhitespaceRegexUnitTest.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 core-java-modules/core-java-regex/src/test/java/com/baeldung/replaceall/ReplaceAllWithWhitespaceRegexUnitTest.java diff --git a/core-java-modules/core-java-regex/src/test/java/com/baeldung/replaceall/ReplaceAllWithWhitespaceRegexUnitTest.java b/core-java-modules/core-java-regex/src/test/java/com/baeldung/replaceall/ReplaceAllWithWhitespaceRegexUnitTest.java new file mode 100644 index 0000000000..a95d1afd80 --- /dev/null +++ b/core-java-modules/core-java-regex/src/test/java/com/baeldung/replaceall/ReplaceAllWithWhitespaceRegexUnitTest.java @@ -0,0 +1,32 @@ +package com.baeldung.replaceall; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class ReplaceAllWithWhitespaceRegexUnitTest { + private static final String INPUT_STR = "Text With Whitespaces! "; + + @Test + public void givenString_whenReplaceBySingleCharClass_thenGetExpect() { + String expected = "Text___With_____Whitespaces!___"; + String result = INPUT_STR.replaceAll("\\s", "_"); + assertEquals(expected, result); + } + + @Test + public void givenString_whenReplaceBySingleCharClassWithPlus_thenGetExpect() { + String expected = "Text_With_Whitespaces!_"; + String result = INPUT_STR.replaceAll("\\s+", "_"); + assertEquals(expected, result); + } + + @Test + public void givenString_whenRemoveByWhitespace_thenGetSameResult() { + String expected = "TextWithWhitespaces!"; + String result1 = INPUT_STR.replaceAll("\\s", ""); + String result2 = INPUT_STR.replaceAll("\\s+", ""); + assertEquals(expected, result1); + assertEquals(result1, result2); + } +} From 8d83e7cf1bcc4fcf616dbca6b71c9317ab826442 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 22 Mar 2020 22:54:40 +0530 Subject: [PATCH 068/130] JAVA-626 : Updated README description --- core-java-modules/core-java-lang-math-2/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-lang-math-2/README.md b/core-java-modules/core-java-lang-math-2/README.md index f05c8804ba..0e0f1991c4 100644 --- a/core-java-modules/core-java-lang-math-2/README.md +++ b/core-java-modules/core-java-lang-math-2/README.md @@ -1,6 +1,6 @@ -## Java Math +========= -This module contains articles about math in Java. +## Core Java 8 Cookbooks and Examples - Part 2 ### Relevant articles: From bc6ef10c6db2b88235552650f2735fa8a7473235 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 22 Mar 2020 23:38:04 +0530 Subject: [PATCH 069/130] JAVA-4: removed hibernate5-mapping module --- .../hibernate5-mapping/README.md | 11 --- .../hibernate5-mapping/pom.xml | 76 --------------- .../com/baeldung/hibernate/HibernateUtil.java | 96 ------------------- .../main/resources/META-INF/persistence.xml | 18 ---- .../src/main/resources/logback.xml | 13 --- 5 files changed, 214 deletions(-) delete mode 100644 persistence-modules/hibernate5-mapping/README.md delete mode 100644 persistence-modules/hibernate5-mapping/pom.xml delete mode 100644 persistence-modules/hibernate5-mapping/src/main/java/com/baeldung/hibernate/HibernateUtil.java delete mode 100644 persistence-modules/hibernate5-mapping/src/main/resources/META-INF/persistence.xml delete mode 100644 persistence-modules/hibernate5-mapping/src/main/resources/logback.xml diff --git a/persistence-modules/hibernate5-mapping/README.md b/persistence-modules/hibernate5-mapping/README.md deleted file mode 100644 index f18b0b63de..0000000000 --- a/persistence-modules/hibernate5-mapping/README.md +++ /dev/null @@ -1,11 +0,0 @@ -## Hibernate 5 - -This module contains articles about Hibernate 5. - -### Relevant articles: - -- [Dynamic Mapping with Hibernate](http://www.baeldung.com/hibernate-dynamic-mapping) -- [Hibernate Inheritance Mapping](http://www.baeldung.com/hibernate-inheritance) -- [Mapping A Hibernate Query to a Custom Class](https://www.baeldung.com/hibernate-query-to-custom-class) -- [Hibernate – Mapping Date and Time](http://www.baeldung.com/hibernate-date-time) -- [Mapping LOB Data in Hibernate](http://www.baeldung.com/hibernate-lob) \ No newline at end of file diff --git a/persistence-modules/hibernate5-mapping/pom.xml b/persistence-modules/hibernate5-mapping/pom.xml deleted file mode 100644 index 59e0547671..0000000000 --- a/persistence-modules/hibernate5-mapping/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - 4.0.0 - hibernate5-mapping - 0.0.1-SNAPSHOT - hibernate5-mapping - - - com.baeldung - persistence-modules - 1.0.0-SNAPSHOT - - - - - org.hibernate - hibernate-core - ${hibernate.version} - - - org.assertj - assertj-core - ${assertj-core.version} - test - - - com.h2database - h2 - ${h2.version} - - - org.hibernate - hibernate-spatial - ${hibernate.version} - - - org.opengeo - geodb - ${geodb.version} - - - mysql - mysql-connector-java - ${mysql.version} - - - ch.vorburger.mariaDB4j - mariaDB4j - ${mariaDB4j.version} - - - org.hibernate - hibernate-testing - ${hibernate.version} - - - - - - geodb-repo - GeoDB repository - http://repo.boundlessgeo.com/main/ - - - - - 5.3.7.Final - 6.0.6 - 2.2.3 - 3.8.0 - 0.9 - - - diff --git a/persistence-modules/hibernate5-mapping/src/main/java/com/baeldung/hibernate/HibernateUtil.java b/persistence-modules/hibernate5-mapping/src/main/java/com/baeldung/hibernate/HibernateUtil.java deleted file mode 100644 index 28e1af49ed..0000000000 --- a/persistence-modules/hibernate5-mapping/src/main/java/com/baeldung/hibernate/HibernateUtil.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.baeldung.hibernate; - -import java.io.FileInputStream; -import java.io.IOException; -import java.net.URL; -import java.util.Properties; - -import org.apache.commons.lang3.StringUtils; -import org.hibernate.SessionFactory; -import org.hibernate.boot.Metadata; -import org.hibernate.boot.MetadataSources; -import org.hibernate.boot.registry.StandardServiceRegistryBuilder; -import org.hibernate.service.ServiceRegistry; - -import com.baeldung.hibernate.entities.DeptEmployee; -import com.baeldung.hibernate.pojo.Employee; -import com.baeldung.hibernate.pojo.EntityDescription; -import com.baeldung.hibernate.pojo.Phone; -import com.baeldung.hibernate.pojo.TemporalValues; -import com.baeldung.hibernate.pojo.inheritance.Animal; -import com.baeldung.hibernate.pojo.inheritance.Bag; -import com.baeldung.hibernate.pojo.inheritance.Book; -import com.baeldung.hibernate.pojo.inheritance.Car; -import com.baeldung.hibernate.pojo.inheritance.MyEmployee; -import com.baeldung.hibernate.pojo.inheritance.MyProduct; -import com.baeldung.hibernate.pojo.inheritance.Pen; -import com.baeldung.hibernate.pojo.inheritance.Pet; -import com.baeldung.hibernate.pojo.inheritance.Vehicle; - -public class HibernateUtil { - private static String PROPERTY_FILE_NAME; - - public static SessionFactory getSessionFactory() throws IOException { - return getSessionFactory(null); - } - - public static SessionFactory getSessionFactory(String propertyFileName) throws IOException { - PROPERTY_FILE_NAME = propertyFileName; - ServiceRegistry serviceRegistry = configureServiceRegistry(); - return makeSessionFactory(serviceRegistry); - } - - public static SessionFactory getSessionFactoryByProperties(Properties properties) throws IOException { - ServiceRegistry serviceRegistry = configureServiceRegistry(properties); - return makeSessionFactory(serviceRegistry); - } - - private static SessionFactory makeSessionFactory(ServiceRegistry serviceRegistry) { - MetadataSources metadataSources = new MetadataSources(serviceRegistry); - - metadataSources.addPackage("com.baeldung.hibernate.pojo"); - metadataSources.addAnnotatedClass(Employee.class); - metadataSources.addAnnotatedClass(Phone.class); - metadataSources.addAnnotatedClass(EntityDescription.class); - metadataSources.addAnnotatedClass(TemporalValues.class); - metadataSources.addAnnotatedClass(DeptEmployee.class); - metadataSources.addAnnotatedClass(com.baeldung.hibernate.entities.Department.class); - metadataSources.addAnnotatedClass(Animal.class); - metadataSources.addAnnotatedClass(Bag.class); - metadataSources.addAnnotatedClass(Book.class); - metadataSources.addAnnotatedClass(Car.class); - metadataSources.addAnnotatedClass(MyEmployee.class); - metadataSources.addAnnotatedClass(MyProduct.class); - metadataSources.addAnnotatedClass(Pen.class); - metadataSources.addAnnotatedClass(Pet.class); - metadataSources.addAnnotatedClass(Vehicle.class); - - - Metadata metadata = metadataSources.getMetadataBuilder() - .build(); - - return metadata.getSessionFactoryBuilder() - .build(); - - } - - private static ServiceRegistry configureServiceRegistry() throws IOException { - return configureServiceRegistry(getProperties()); - } - - private static ServiceRegistry configureServiceRegistry(Properties properties) throws IOException { - return new StandardServiceRegistryBuilder().applySettings(properties) - .build(); - } - - public static Properties getProperties() throws IOException { - Properties properties = new Properties(); - URL propertiesURL = Thread.currentThread() - .getContextClassLoader() - .getResource(StringUtils.defaultString(PROPERTY_FILE_NAME, "hibernate.properties")); - try (FileInputStream inputStream = new FileInputStream(propertiesURL.getFile())) { - properties.load(inputStream); - } - return properties; - } -} \ No newline at end of file diff --git a/persistence-modules/hibernate5-mapping/src/main/resources/META-INF/persistence.xml b/persistence-modules/hibernate5-mapping/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 474eeb7a44..0000000000 --- a/persistence-modules/hibernate5-mapping/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - Hibernate EntityManager Demo - true - - - - - - - - - - \ No newline at end of file diff --git a/persistence-modules/hibernate5-mapping/src/main/resources/logback.xml b/persistence-modules/hibernate5-mapping/src/main/resources/logback.xml deleted file mode 100644 index 7d900d8ea8..0000000000 --- a/persistence-modules/hibernate5-mapping/src/main/resources/logback.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n - - - - - - - - \ No newline at end of file From a081a6cf6ddbc4af29bd77f2638d28a39f3634f7 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Sun, 22 Mar 2020 23:40:34 +0530 Subject: [PATCH 070/130] JAVA-4: modified README files to add proper descriptions, and https to some links --- persistence-modules/hibernate-annotations/README.md | 4 ++-- persistence-modules/hibernate-enterprise/README.md | 6 +++--- persistence-modules/hibernate-jpa/README.md | 8 ++++---- persistence-modules/hibernate-mapping/README.md | 8 ++++---- persistence-modules/hibernate5/README.md | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/persistence-modules/hibernate-annotations/README.md b/persistence-modules/hibernate-annotations/README.md index 2813dbdda3..393cf82bfd 100644 --- a/persistence-modules/hibernate-annotations/README.md +++ b/persistence-modules/hibernate-annotations/README.md @@ -1,10 +1,10 @@ ## Hibernate Annotations -This module contains articles about Hibernate Annotations. +This module contains articles about Annotations used in Hibernate. ### Relevant Articles: - [Custom Types in Hibernate and the @Type Annotation](https://www.baeldung.com/hibernate-custom-types) - [@JoinColumn Annotation Explained](https://www.baeldung.com/jpa-join-column) - [Difference Between @JoinColumn and mappedBy](https://www.baeldung.com/jpa-joincolumn-vs-mappedby) -- [Hibernate One to Many Annotation Tutorial](http://www.baeldung.com/hibernate-one-to-many) +- [Hibernate One to Many Annotation Tutorial](https://www.baeldung.com/hibernate-one-to-many) - [Hibernate @WhereJoinTable Annotation](https://www.baeldung.com/hibernate-wherejointable) diff --git a/persistence-modules/hibernate-enterprise/README.md b/persistence-modules/hibernate-enterprise/README.md index c48092e6a2..c5606d0970 100644 --- a/persistence-modules/hibernate-enterprise/README.md +++ b/persistence-modules/hibernate-enterprise/README.md @@ -1,11 +1,11 @@ ## Hibernate Enterprise -This module contains articles about Hibernate. +This module contains articles about enterprise concerns such as Multitenancy, Errors, Exceptions, Logging and more in Hibernate. ### Relevant articles: -- [Introduction to Hibernate Spatial](http://www.baeldung.com/hibernate-spatial) -- [A Guide to Multitenancy in Hibernate 5](http://www.baeldung.com/hibernate-5-multitenancy) +- [Introduction to Hibernate Spatial](https://www.baeldung.com/hibernate-spatial) +- [A Guide to Multitenancy in Hibernate 5](https://www.baeldung.com/hibernate-5-multitenancy) - [Hibernate Aggregate Functions](https://www.baeldung.com/hibernate-aggregate-functions) - [Common Hibernate Exceptions](https://www.baeldung.com/hibernate-exceptions) - [Hibernate Error “Not all named parameters have been set”](https://www.baeldung.com/hibernate-error-named-parameters-not-set) diff --git a/persistence-modules/hibernate-jpa/README.md b/persistence-modules/hibernate-jpa/README.md index fb1d46cf9b..d0a253f028 100644 --- a/persistence-modules/hibernate-jpa/README.md +++ b/persistence-modules/hibernate-jpa/README.md @@ -1,13 +1,13 @@ ## Hibernate JPA -This module contains articles about Hibernate JPA. +This module contains articles specific to use of Hibernate as a JPA implementation, such as Locking, Bootstrapping, One-to-One Relationship, Persistence Context, and more. ### Relevant articles: -- [JPA Attribute Converters](http://www.baeldung.com/jpa-attribute-converters) -- [Pessimistic Locking in JPA](http://www.baeldung.com/jpa-pessimistic-locking) +- [JPA Attribute Converters](https://www.baeldung.com/jpa-attribute-converters) +- [Pessimistic Locking in JPA](https://www.baeldung.com/jpa-pessimistic-locking) - [Bootstrapping JPA Programmatically in Java](http://www.baeldung.com/java-bootstrap-jpa) -- [Optimistic Locking in JPA](http://www.baeldung.com/jpa-optimistic-locking) +- [Optimistic Locking in JPA](https://www.baeldung.com/jpa-optimistic-locking) - [Criteria API – An Example of IN Expressions](https://www.baeldung.com/jpa-criteria-api-in-expressions) - [One-to-One Relationship in JPA](https://www.baeldung.com/jpa-one-to-one) - [Enabling Transaction Locks in Spring Data JPA](https://www.baeldung.com/java-jpa-transaction-locks) diff --git a/persistence-modules/hibernate-mapping/README.md b/persistence-modules/hibernate-mapping/README.md index 5ba73f35f3..b5d0cb2f99 100644 --- a/persistence-modules/hibernate-mapping/README.md +++ b/persistence-modules/hibernate-mapping/README.md @@ -7,9 +7,9 @@ This module contains articles about Object-relational Mapping (ORM) with Hiberna - [Persisting Maps with Hibernate](https://www.baeldung.com/hibernate-persisting-maps) - [Difference Between @Size, @Length, and @Column(length=value)](https://www.baeldung.com/jpa-size-length-column-differences) - [Hibernate Validator Specific Constraints](https://www.baeldung.com/hibernate-validator-constraints) -- [Dynamic Mapping with Hibernate](http://www.baeldung.com/hibernate-dynamic-mapping) -- [Hibernate Inheritance Mapping](http://www.baeldung.com/hibernate-inheritance) +- [Dynamic Mapping with Hibernate](https://www.baeldung.com/hibernate-dynamic-mapping) +- [Hibernate Inheritance Mapping](https://www.baeldung.com/hibernate-inheritance) - [Mapping A Hibernate Query to a Custom Class](https://www.baeldung.com/hibernate-query-to-custom-class) -- [Hibernate – Mapping Date and Time](http://www.baeldung.com/hibernate-date-time) -- [Mapping LOB Data in Hibernate](http://www.baeldung.com/hibernate-lob) +- [Hibernate – Mapping Date and Time](https://www.baeldung.com/hibernate-date-time) +- [Mapping LOB Data in Hibernate](https://www.baeldung.com/hibernate-lob) - [FetchMode in Hibernate](https://www.baeldung.com/hibernate-fetchmode) diff --git a/persistence-modules/hibernate5/README.md b/persistence-modules/hibernate5/README.md index b7a254d836..bd437c80eb 100644 --- a/persistence-modules/hibernate5/README.md +++ b/persistence-modules/hibernate5/README.md @@ -4,8 +4,8 @@ This module contains articles about Hibernate 5. Let's not add more articles her ### Relevant articles: -- [An Overview of Identifiers in Hibernate](http://www.baeldung.com/hibernate-identifiers) -- [Hibernate Interceptors](http://www.baeldung.com/hibernate-interceptor) +- [An Overview of Identifiers in Hibernate](https://www.baeldung.com/hibernate-identifiers) +- [Hibernate Interceptors](https://www.baeldung.com/hibernate-interceptor) - [Hibernate Entity Lifecycle](https://www.baeldung.com/hibernate-entity-lifecycle) - [Hibernate 5 Naming Strategy Configuration](https://www.baeldung.com/hibernate-naming-strategy) - [Proxy in Hibernate load() Method](https://www.baeldung.com/hibernate-proxy-load-method) From 0a48cad1c3a034ad1a48e811649148f4670d8f0c Mon Sep 17 00:00:00 2001 From: pazis Date: Mon, 23 Mar 2020 02:05:05 +0000 Subject: [PATCH 071/130] BAEL-3881 --- algorithms-miscellaneous-6/pom.xml | 15 +++++++++ .../gradientdescent/GradientDescent.java | 33 +++++++++++++++++++ .../GradientDescentUnitTest.java | 20 +++++++++++ pom.xml | 2 ++ 4 files changed, 70 insertions(+) create mode 100644 algorithms-miscellaneous-6/pom.xml create mode 100644 algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/gradientdescent/GradientDescent.java create mode 100644 algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/gradientdescent/GradientDescentUnitTest.java diff --git a/algorithms-miscellaneous-6/pom.xml b/algorithms-miscellaneous-6/pom.xml new file mode 100644 index 0000000000..5daa000ea3 --- /dev/null +++ b/algorithms-miscellaneous-6/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + algorithms-miscellaneous-6 + 0.0.1-SNAPSHOT + algorithms-miscellaneous-6 + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/gradientdescent/GradientDescent.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/gradientdescent/GradientDescent.java new file mode 100644 index 0000000000..c5db3a4a06 --- /dev/null +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/gradientdescent/GradientDescent.java @@ -0,0 +1,33 @@ +package com.baeldung.algorithms.gradientdescent; + +import java.util.function.Function; + +public class GradientDescent { + + private final double precision = 0.000001; + + public double findLocalMinimum(Function f, double initialX) { + double stepCoefficient = 0.1; + double previousStep = 1.0; + double currentX = initialX; + double previousX = initialX; + double previousY = f.apply(previousX); + int iter = 100; + + currentX += stepCoefficient * previousY; + + while (previousStep > precision && iter > 0) { + iter--; + double currentY = f.apply(currentX); + if (currentY > previousY) { + stepCoefficient = -stepCoefficient / 2; + } + previousX = currentX; + currentX += stepCoefficient * previousY; + previousY = currentY; + previousStep = StrictMath.abs(currentX - previousX); + } + return currentX; + } + +} diff --git a/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/gradientdescent/GradientDescentUnitTest.java b/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/gradientdescent/GradientDescentUnitTest.java new file mode 100644 index 0000000000..34d3e188f2 --- /dev/null +++ b/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/gradientdescent/GradientDescentUnitTest.java @@ -0,0 +1,20 @@ +package com.baeldung.algorithms.gradientdescent; + +import static org.junit.Assert.assertTrue; + +import java.util.function.Function; + +import org.junit.Test; + +public class GradientDescentUnitTest { + + @Test + public void givenFunction_whenStartingPointIsOne_thenLocalMinimumIsFound() { + Function df = x -> + StrictMath.abs(StrictMath.pow(x, 3)) - (3 * StrictMath.pow(x, 2)) + x; + GradientDescent gd = new GradientDescent(); + double res = gd.findLocalMinimum(df, 1); + assertTrue(res > 1.78); + assertTrue(res < 1.84); + } +} diff --git a/pom.xml b/pom.xml index 15331d8c95..45bdf9747e 100644 --- a/pom.xml +++ b/pom.xml @@ -342,6 +342,7 @@ algorithms-miscellaneous-3 algorithms-miscellaneous-4 algorithms-miscellaneous-5 + algorithms-miscellaneous-6 algorithms-searching algorithms-sorting algorithms-sorting-2 @@ -853,6 +854,7 @@ algorithms-miscellaneous-3 algorithms-miscellaneous-4 algorithms-miscellaneous-5 + algorithms-miscellaneous-6 algorithms-searching algorithms-sorting algorithms-sorting-2 From 9ead49e028f7db5fd5b8bce659c378c9fd5d08e5 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:07:01 +0800 Subject: [PATCH 072/130] Update README.md --- core-java-modules/core-java-9/README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/core-java-modules/core-java-9/README.md b/core-java-modules/core-java-9/README.md index bfd426b9c1..2dbf159750 100644 --- a/core-java-modules/core-java-9/README.md +++ b/core-java-modules/core-java-9/README.md @@ -10,6 +10,3 @@ This module contains articles about Java 9 core features - [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) - [Immutable Set in Java](https://www.baeldung.com/java-immutable-set) - [Immutable ArrayList in Java](https://www.baeldung.com/java-immutable-list) - -Note: also contains part of the code for the article -[How to Filter a Collection in Java](https://www.baeldung.com/java-collection-filtering). From d90933973e6f6c12ab110033b42370c344e68890 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:18:10 +0800 Subject: [PATCH 073/130] Update README.md --- core-java-modules/core-java-arrays/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-modules/core-java-arrays/README.md b/core-java-modules/core-java-arrays/README.md index 42fe3f83a1..9d9db9ab81 100644 --- a/core-java-modules/core-java-arrays/README.md +++ b/core-java-modules/core-java-arrays/README.md @@ -10,7 +10,6 @@ This module contains articles about Java arrays - [Multi-Dimensional Arrays In Java](https://www.baeldung.com/java-jagged-arrays) - [Find Sum and Average in a Java Array](https://www.baeldung.com/java-array-sum-average) - [Arrays in Java: A Reference Guide](https://www.baeldung.com/java-arrays-guide) -- [Read and Write User Input in Java](https://www.baeldung.com/java-console-input-output) - [How to Reverse an Array in Java](http://www.baeldung.com/java-invert-array) - [Sorting Arrays in Java](https://www.baeldung.com/java-sorting-arrays) - [Checking If an Array Is Sorted in Java](https://www.baeldung.com/java-check-sorted-array) From cbf3815f0969390902a352331da268d45b46e16c Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:22:55 +0800 Subject: [PATCH 074/130] Update README.md --- spring-security-modules/spring-security-rest/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/spring-security-modules/spring-security-rest/README.md b/spring-security-modules/spring-security-rest/README.md index f7e91b85dc..26c101d32c 100644 --- a/spring-security-modules/spring-security-rest/README.md +++ b/spring-security-modules/spring-security-rest/README.md @@ -8,12 +8,11 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring The "Learn Spring Security" Classes: http://github.learnspringsecurity.com ### Relevant Articles: -- [Spring REST Service Security](https://www.baeldung.com/2011/10/31/securing-a-restful-web-service-with-spring-security-3-1-part-3/) + - [Setting Up Swagger 2 with a Spring REST API](https://www.baeldung.com/swagger-2-documentation-for-spring-rest-api) - [Custom Error Message Handling for REST API](https://www.baeldung.com/global-error-handler-in-a-spring-rest-api) - [Spring Security Context Propagation with @Async](https://www.baeldung.com/spring-security-async-principal-propagation) - [Servlet 3 Async Support with Spring MVC and Spring Security](https://www.baeldung.com/spring-mvc-async-security) - [Intro to Spring Security Expressions](https://www.baeldung.com/spring-security-expressions) -- [Spring Security for a REST API](https://www.baeldung.com/securing-a-restful-web-service-with-spring-security) - [Spring Security Expressions - hasRole Example](https://www.baeldung.com/spring-security-expressions-basic) - [Error Handling for REST with Spring](https://www.baeldung.com/exception-handling-for-rest-with-spring) From 54a4a3655ef2e949dd18142dbd47ad6413b421e4 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:29:09 +0800 Subject: [PATCH 075/130] Delete README.md --- .../spring-boot-runtime/disabling-console-log4j2/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 spring-boot-modules/spring-boot-runtime/disabling-console-log4j2/README.md diff --git a/spring-boot-modules/spring-boot-runtime/disabling-console-log4j2/README.md b/spring-boot-modules/spring-boot-runtime/disabling-console-log4j2/README.md deleted file mode 100644 index 554f051b41..0000000000 --- a/spring-boot-modules/spring-boot-runtime/disabling-console-log4j2/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Articles: - -- [How to Disable Console Logging in Spring Boot](https://www.baeldung.com/spring-boot-disable-console-logging) From 2a65df46dbf696094ff5e099b1d9ddcb0932f5df Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:32:12 +0800 Subject: [PATCH 076/130] Update README.md --- testing-modules/junit5-migration/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/junit5-migration/README.md b/testing-modules/junit5-migration/README.md index 84e540b466..5cc9db8bd3 100644 --- a/testing-modules/junit5-migration/README.md +++ b/testing-modules/junit5-migration/README.md @@ -5,6 +5,6 @@ This module contains articles about migrating to JUnit 5. The code for the JUnit 4 - JUnit 5 E-book is in `com.baeldung.junit4` and `com.baeldung.junit5`. ### Relevant Articles: -- [JUnit 5 Migration](https://www.baeldung.com/junit-5-migration) + - [A Quick JUnit vs TestNG Comparison](https://www.baeldung.com/junit-vs-testng) - [Assertions in JUnit 4 and JUnit 5](https://www.baeldung.com/junit-assertions) From 9240a08f5a3df45942d640a5381008d331fb0327 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:37:23 +0800 Subject: [PATCH 077/130] Delete README.md --- .../spring-boot-runtime/disabling-console-jul/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 spring-boot-modules/spring-boot-runtime/disabling-console-jul/README.md diff --git a/spring-boot-modules/spring-boot-runtime/disabling-console-jul/README.md b/spring-boot-modules/spring-boot-runtime/disabling-console-jul/README.md deleted file mode 100644 index 554f051b41..0000000000 --- a/spring-boot-modules/spring-boot-runtime/disabling-console-jul/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Articles: - -- [How to Disable Console Logging in Spring Boot](https://www.baeldung.com/spring-boot-disable-console-logging) From 825fd077970bac4924fd7797ba4425d92aae2360 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:42:04 +0800 Subject: [PATCH 078/130] Update README.md --- java-numbers/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/java-numbers/README.md b/java-numbers/README.md index eee6fceab1..8f53006b38 100644 --- a/java-numbers/README.md +++ b/java-numbers/README.md @@ -8,7 +8,6 @@ This module contains articles about numbers in Java. - [BigDecimal and BigInteger in Java](http://www.baeldung.com/java-bigdecimal-biginteger) - [Find All Pairs of Numbers in an Array That Add Up to a Given Sum](http://www.baeldung.com/java-algorithm-number-pairs-sum) - [Java – Random Long, Float, Integer and Double](http://www.baeldung.com/java-generate-random-long-float-integer-double) -- [Using Math.sin with Degrees](https://www.baeldung.com/java-math-sin-degrees) - [A Practical Guide to DecimalFormat](http://www.baeldung.com/java-decimalformat) - [Calculating the nth Root in Java](https://www.baeldung.com/java-nth-root) - [Convert Double to String, Removing Decimal Places](https://www.baeldung.com/java-double-to-string) From eac4d6a71548399ac89810143ec849ab9055e181 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:44:34 +0800 Subject: [PATCH 079/130] Update README.md --- core-java-modules/core-java-lang-syntax/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-modules/core-java-lang-syntax/README.md b/core-java-modules/core-java-lang-syntax/README.md index bef03b98ad..ae0958e961 100644 --- a/core-java-modules/core-java-lang-syntax/README.md +++ b/core-java-modules/core-java-lang-syntax/README.md @@ -5,7 +5,6 @@ This module contains articles about Java syntax ### Relevant Articles: - [The Basics of Java Generics](https://www.baeldung.com/java-generics) - [Java Primitive Conversions](https://www.baeldung.com/java-primitive-conversions) -- [The Java continue and break Keywords](https://www.baeldung.com/java-continue-and-break) - [A Guide to Creating Objects in Java](https://www.baeldung.com/java-initialization) - [A Guide to Java Loops](https://www.baeldung.com/java-loops) - [Varargs in Java](https://www.baeldung.com/java-varargs) From 11f23a2f6b7ac2c75402fe8c203f46d138dac166 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:45:49 +0800 Subject: [PATCH 080/130] Update README.md --- core-java-modules/core-java-lang-syntax/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-modules/core-java-lang-syntax/README.md b/core-java-modules/core-java-lang-syntax/README.md index ae0958e961..f28a675258 100644 --- a/core-java-modules/core-java-lang-syntax/README.md +++ b/core-java-modules/core-java-lang-syntax/README.md @@ -8,7 +8,6 @@ This module contains articles about Java syntax - [A Guide to Creating Objects in Java](https://www.baeldung.com/java-initialization) - [A Guide to Java Loops](https://www.baeldung.com/java-loops) - [Varargs in Java](https://www.baeldung.com/java-varargs) -- [A Guide to Java Enums](https://www.baeldung.com/a-guide-to-java-enums) - [Infinite Loops in Java](https://www.baeldung.com/infinite-loops-java) - [Java Switch Statement](https://www.baeldung.com/java-switch) - [Breaking Out of Nested Loops](https://www.baeldung.com/java-breaking-out-nested-loop) From 6f89368718e8a203566081251831de8ced9c4f68 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:46:45 +0800 Subject: [PATCH 081/130] Update README.md --- core-java-modules/core-java-lang-syntax/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-modules/core-java-lang-syntax/README.md b/core-java-modules/core-java-lang-syntax/README.md index f28a675258..f74fa1b546 100644 --- a/core-java-modules/core-java-lang-syntax/README.md +++ b/core-java-modules/core-java-lang-syntax/README.md @@ -8,7 +8,6 @@ This module contains articles about Java syntax - [A Guide to Creating Objects in Java](https://www.baeldung.com/java-initialization) - [A Guide to Java Loops](https://www.baeldung.com/java-loops) - [Varargs in Java](https://www.baeldung.com/java-varargs) -- [Infinite Loops in Java](https://www.baeldung.com/infinite-loops-java) - [Java Switch Statement](https://www.baeldung.com/java-switch) - [Breaking Out of Nested Loops](https://www.baeldung.com/java-breaking-out-nested-loop) - [Java Do-While Loop](https://www.baeldung.com/java-do-while-loop) From 4084fbf62646d33e60215bbb7cb4d6856006f456 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:48:05 +0800 Subject: [PATCH 082/130] Delete README.md --- bazel/bazelgreeting/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 bazel/bazelgreeting/README.md diff --git a/bazel/bazelgreeting/README.md b/bazel/bazelgreeting/README.md deleted file mode 100644 index 528f797c21..0000000000 --- a/bazel/bazelgreeting/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Articles: - -- [Building Java Applications with Bazel](https://www.baeldung.com/bazel-build-tool) From df6fd3681d43035c71abefdfbfa2acdfaaa25806 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:50:03 +0800 Subject: [PATCH 083/130] Update README.md --- testing-modules/mockito-2/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/testing-modules/mockito-2/README.md b/testing-modules/mockito-2/README.md index d7069949e4..8cd2869524 100644 --- a/testing-modules/mockito-2/README.md +++ b/testing-modules/mockito-2/README.md @@ -3,6 +3,5 @@ - [Mockito’s Java 8 Features](https://www.baeldung.com/mockito-2-java-8) - [Lazy Verification with Mockito 2](https://www.baeldung.com/mockito-2-lazy-verification) - [Mockito Strict Stubbing and The UnnecessaryStubbingException](https://www.baeldung.com/mockito-unnecessary-stubbing-exception) -- [Quick Guide to BDDMockito](https://www.baeldung.com/bdd-mockito) - [Mockito – Using Spies](https://www.baeldung.com/mockito-spy) - [Mockito and Fluent APIs](https://www.baeldung.com/mockito-fluent-apis) From 4cb7ca6472dbc9a5075c3bb1ad257c6498d23a4a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:50:53 +0800 Subject: [PATCH 084/130] Update README.md --- testing-modules/mockito-2/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/testing-modules/mockito-2/README.md b/testing-modules/mockito-2/README.md index 8cd2869524..064366dfd5 100644 --- a/testing-modules/mockito-2/README.md +++ b/testing-modules/mockito-2/README.md @@ -3,5 +3,4 @@ - [Mockito’s Java 8 Features](https://www.baeldung.com/mockito-2-java-8) - [Lazy Verification with Mockito 2](https://www.baeldung.com/mockito-2-lazy-verification) - [Mockito Strict Stubbing and The UnnecessaryStubbingException](https://www.baeldung.com/mockito-unnecessary-stubbing-exception) -- [Mockito – Using Spies](https://www.baeldung.com/mockito-spy) - [Mockito and Fluent APIs](https://www.baeldung.com/mockito-fluent-apis) From 89b01e2908f5671d3da370ef912d00481cb8b052 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:53:56 +0800 Subject: [PATCH 085/130] Update README.md --- spring-boot-modules/spring-boot-custom-starter/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-custom-starter/README.md b/spring-boot-modules/spring-boot-custom-starter/README.md index d74dc222d5..667be7ca40 100644 --- a/spring-boot-modules/spring-boot-custom-starter/README.md +++ b/spring-boot-modules/spring-boot-custom-starter/README.md @@ -1,6 +1,6 @@ ## Spring Boot Custom Starter -This module contains articles about writing [Spring Boot Starters](https://www.baeldung.com/spring-boot-starters). +This module contains articles about writing Spring Boot Starters. ### Relevant Articles: - [Creating a Custom Starter with Spring Boot](https://www.baeldung.com/spring-boot-custom-starter) From b7a00cb1270db6c2c820966bacadae6370358af1 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:55:39 +0800 Subject: [PATCH 086/130] Update README.md --- core-java-modules/core-java-lang-oop-2/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-modules/core-java-lang-oop-2/README.md b/core-java-modules/core-java-lang-oop-2/README.md index 035d464c50..c48a3f5cd9 100644 --- a/core-java-modules/core-java-lang-oop-2/README.md +++ b/core-java-modules/core-java-lang-oop-2/README.md @@ -12,7 +12,6 @@ This module contains articles about Object-oriented programming (OOP) in Java - [Immutable Objects in Java](https://www.baeldung.com/java-immutable-object) - [Inheritance and Composition (Is-a vs Has-a relationship) in Java](https://www.baeldung.com/java-inheritance-composition) - [A Guide to Constructors in Java](https://www.baeldung.com/java-constructors) -- [Composition, Aggregation, and Association in Java](https://www.baeldung.com/java-composition-aggregation-association) - [Static and Default Methods in Interfaces in Java](https://www.baeldung.com/java-static-default-methods) - [Java Copy Constructor](https://www.baeldung.com/java-copy-constructor) - [Abstract Classes in Java](https://www.baeldung.com/java-abstract-class) From 53098cb731ea0d3abcfd9ee65ac7d08ad942140f Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:57:01 +0800 Subject: [PATCH 087/130] Update README.md --- spring-all/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spring-all/README.md b/spring-all/README.md index d71b8569cf..9ad78aa1ee 100644 --- a/spring-all/README.md +++ b/spring-all/README.md @@ -1,7 +1,3 @@ ## Spring All This module contains articles about Spring - -### Relevant Articles: - -- [The @Scheduled Annotation in Spring](https://www.baeldung.com/spring-scheduled-tasks) From 102d8ee3a3a87dc259282697e99b81b8ee319be1 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:58:04 +0800 Subject: [PATCH 088/130] Delete README.md --- .../data-jpa-application/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 spring-boot-modules/spring-boot-config-jpa-error/data-jpa-application/README.md diff --git a/spring-boot-modules/spring-boot-config-jpa-error/data-jpa-application/README.md b/spring-boot-modules/spring-boot-config-jpa-error/data-jpa-application/README.md deleted file mode 100644 index 443ec07183..0000000000 --- a/spring-boot-modules/spring-boot-config-jpa-error/data-jpa-application/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Articles - -- [Unable to Find @SpringBootConfiguration with @DataJpaTest](https://www.baeldung.com/spring-boot-unable-to-find-springbootconfiguration-with-datajpatest) From 27f4e9032f60773403d8f4256ead87f7e3e6cf44 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:59:48 +0800 Subject: [PATCH 089/130] Update README.md --- java-math-2/README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/java-math-2/README.md b/java-math-2/README.md index ca809e8623..7c459cc576 100644 --- a/java-math-2/README.md +++ b/java-math-2/README.md @@ -1,8 +1,3 @@ ## Java Math This module contains articles about math in Java. - -### Relevant articles: - -- [Basic Calculator in Java](https://www.baeldung.com/basic-calculator-in-java) -- More articles: [[<-- prev]](/../java-math) From f0373c1fbb5c17bf0d431389db24b8a6f4491da2 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 19:01:02 +0800 Subject: [PATCH 090/130] Delete README.md --- .../spring-boot-config-jpa-error/data-jpa-library/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 spring-boot-modules/spring-boot-config-jpa-error/data-jpa-library/README.md diff --git a/spring-boot-modules/spring-boot-config-jpa-error/data-jpa-library/README.md b/spring-boot-modules/spring-boot-config-jpa-error/data-jpa-library/README.md deleted file mode 100644 index 4e852f8a90..0000000000 --- a/spring-boot-modules/spring-boot-config-jpa-error/data-jpa-library/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant Articles: - -- [Unable to Find @SpringBootConfiguration with @DataJpaTest](https://www.baeldung.com/spring-boot-unable-to-find-springbootconfiguration-with-datajpatest) From f145d644c9d787a1a4b90c467b73383e818a230c Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Mon, 23 Mar 2020 19:04:46 +0800 Subject: [PATCH 091/130] Update README.md --- .../spring-security-sso/spring-security-sso-kerberos/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/README.md b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/README.md index 0227d9ac70..3aa092edb8 100644 --- a/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/README.md +++ b/spring-security-modules/spring-security-sso/spring-security-sso-kerberos/README.md @@ -1,4 +1,3 @@ ## Relevant articles: -- [Introduction to SPNEGO/Kerberos Authentication in Spring](https://www.baeldung.com/spring-security-kerberos) - [Spring Security Kerberos Integration](https://www.baeldung.com/spring-security-kerberos-integration) From abd46c4349f07b36e279b7fa6fa310ac1ea52a17 Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Mon, 23 Mar 2020 19:58:34 +0530 Subject: [PATCH 092/130] fix integration test cases (#8727) * fix integration test cases * fix integration test cases * used dynamic port in the integration test cases --- spring-5-reactive-client/pom.xml | 4 +- .../reactive/ReactiveIntegrationTest.java | 48 +++++++++++++++---- .../simultaneous/ClientIntegrationTest.java | 9 ++-- 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/spring-5-reactive-client/pom.xml b/spring-5-reactive-client/pom.xml index e3c41f8b84..cc728398f3 100644 --- a/spring-5-reactive-client/pom.xml +++ b/spring-5-reactive-client/pom.xml @@ -92,8 +92,8 @@ com.github.tomakehurst - wiremock - 2.24.1 + wiremock-standalone + 2.26.0 test diff --git a/spring-5-reactive-client/src/test/java/com/baeldung/reactive/ReactiveIntegrationTest.java b/spring-5-reactive-client/src/test/java/com/baeldung/reactive/ReactiveIntegrationTest.java index 394ff42e5f..1d2197a381 100644 --- a/spring-5-reactive-client/src/test/java/com/baeldung/reactive/ReactiveIntegrationTest.java +++ b/spring-5-reactive-client/src/test/java/com/baeldung/reactive/ReactiveIntegrationTest.java @@ -1,37 +1,67 @@ package com.baeldung.reactive; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.configureFor; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; import org.springframework.web.reactive.function.client.ClientResponse; import org.springframework.web.reactive.function.client.WebClient; import com.baeldung.reactive.model.Foo; +import com.github.tomakehurst.wiremock.WireMockServer; import reactor.core.publisher.Mono; +@RunWith(SpringRunner.class) @SpringBootTest public class ReactiveIntegrationTest { private WebClient client; - - @BeforeEach - public void before() { - client = WebClient.create("http://localhost:8080"); + private int singleRequestTime = 1000; + private WireMockServer wireMockServer; + + @Before + public void setup() { + wireMockServer = new WireMockServer(wireMockConfig().dynamicPort()); + wireMockServer.start(); + configureFor("localhost", wireMockServer.port()); + client = WebClient.create("http://localhost:" + wireMockServer.port()); } - // + @After + public void tearDown() { + wireMockServer.stop(); + } @Test public void whenMonoReactiveEndpointIsConsumed_thenCorrectOutput() { - final Mono fooMono = client.get().uri("/foos/123").exchange().log(); + stubFor(get(urlEqualTo("/foo/123")).willReturn(aResponse().withFixedDelay(singleRequestTime) + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody("{\"id\":123, \"name\":\"foo\"}"))); + + final Mono fooMono = client.get().uri("/foo/123").exchange().log(); System.out.println(fooMono.subscribe()); } @Test public void whenFluxReactiveEndpointIsConsumed_thenCorrectOutput() throws InterruptedException { - client.get().uri("/foos") + stubFor(get(urlEqualTo("/foo")).willReturn(aResponse().withFixedDelay(singleRequestTime) + .withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody("{\"id\":1, \"name\":\"foo\"}"))); + + client.get().uri("/foo") .retrieve() .bodyToFlux(Foo.class).log() .subscribe(System.out::println); diff --git a/spring-5-reactive-client/src/test/java/com/baeldung/reactive/webclient/simultaneous/ClientIntegrationTest.java b/spring-5-reactive-client/src/test/java/com/baeldung/reactive/webclient/simultaneous/ClientIntegrationTest.java index d74a64d9c9..43454daf17 100644 --- a/spring-5-reactive-client/src/test/java/com/baeldung/reactive/webclient/simultaneous/ClientIntegrationTest.java +++ b/spring-5-reactive-client/src/test/java/com/baeldung/reactive/webclient/simultaneous/ClientIntegrationTest.java @@ -5,6 +5,7 @@ import org.junit.Before; import org.junit.After; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; import com.github.tomakehurst.wiremock.WireMockServer; @@ -19,15 +20,19 @@ import static org.junit.Assert.assertEquals; @RunWith(SpringRunner.class) @SpringBootTest +@DirtiesContext public class ClientIntegrationTest { private WireMockServer wireMockServer; + private Client client; + @Before public void setup() { - wireMockServer = new WireMockServer(wireMockConfig().port(8089)); + wireMockServer = new WireMockServer(wireMockConfig().dynamicPort()); wireMockServer.start(); configureFor("localhost", wireMockServer.port()); + client = new Client("http://localhost:" + wireMockServer.port()); } @After @@ -52,8 +57,6 @@ public class ClientIntegrationTest { .boxed() .collect(Collectors.toList()); - Client client = new Client("http://localhost:8089"); - // Act long start = System.currentTimeMillis(); List users = client.fetchUsers(userIds) From 1062b4fef65b2d6d54b724c4f46f0b8c36b69b6f Mon Sep 17 00:00:00 2001 From: Karsten Silz <1061209+ksilz@users.noreply.github.com> Date: Mon, 23 Mar 2020 18:17:16 +0000 Subject: [PATCH 093/130] BAEL-3911 (#8939) * Initial version of the code. * Addressed PR comment. --- .../dayofweek/DayOfWeekExtractor.java | 35 +++++++++++++ .../dayofweek/DayOfWeekExtractorUnitTest.java | 52 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 core-java-modules/core-java-date-operations-2/src/main/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractor.java create mode 100644 core-java-modules/core-java-date-operations-2/src/test/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractorUnitTest.java diff --git a/core-java-modules/core-java-date-operations-2/src/main/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractor.java b/core-java-modules/core-java-date-operations-2/src/main/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractor.java new file mode 100644 index 0000000000..b027790e35 --- /dev/null +++ b/core-java-modules/core-java-date-operations-2/src/main/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractor.java @@ -0,0 +1,35 @@ +package com.baeldung.datetime.dayofweek; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.format.TextStyle; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; + +public class DayOfWeekExtractor { + + public static int getDayNumberOld(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + return cal.get(Calendar.DAY_OF_WEEK); + } + + public static String getDayStringOld(Date date, Locale locale ) { + DateFormat formatter = new SimpleDateFormat("EEEE", locale); + return formatter.format(date); + } + + public static int getDayNumberNew(LocalDate date) { + DayOfWeek day = date.getDayOfWeek(); + return day.getValue(); + } + + public static String getDayStringNew(LocalDate date, Locale locale ) { + DayOfWeek day = date.getDayOfWeek(); + return day.getDisplayName(TextStyle.FULL, locale); + } + +} diff --git a/core-java-modules/core-java-date-operations-2/src/test/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractorUnitTest.java b/core-java-modules/core-java-date-operations-2/src/test/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractorUnitTest.java new file mode 100644 index 0000000000..0dfd50dca2 --- /dev/null +++ b/core-java-modules/core-java-date-operations-2/src/test/java/com/baeldung/datetime/dayofweek/DayOfWeekExtractorUnitTest.java @@ -0,0 +1,52 @@ +package com.baeldung.datetime.dayofweek; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.util.Calendar; +import java.util.Locale; + +import org.junit.Test; + +public class DayOfWeekExtractorUnitTest { + + private DateFormat oldDateParser = new SimpleDateFormat("yyyy-MM-dd"); + + @Test + public void givenFeb29_2020_thenOldSaturdayNumber() throws ParseException { + assertThat(DayOfWeekExtractor.getDayNumberOld(oldDateParser.parse("2020-02-29")) == Calendar.SATURDAY); + } + + @Test + public void givenFeb29_2020_and_localeUS_thenOldSaturdayText() throws ParseException { + assertThat("Saturday".equals(DayOfWeekExtractor.getDayStringOld(oldDateParser.parse("2020-02-29"), Locale.US)) ); + } + + @Test + public void givenFeb29_2020_and_localeDE_thenOldSaturdayText() throws ParseException { + assertThat("Samstag".equals(DayOfWeekExtractor.getDayStringOld(oldDateParser.parse("2020-02-29"), Locale.GERMANY)) ); + } + + @Test + public void givenFeb29_2020_thenNewSaturdayNumber() throws ParseException { + assertThat(DayOfWeekExtractor.getDayNumberNew(LocalDate.parse("2020-02-29")) == Calendar.SATURDAY); + } + + @Test + public void givenFeb29_2020_and_localeUS_thenNewSaturdayText() throws ParseException { + assertThat("Saturday".equals(DayOfWeekExtractor.getDayStringOld(oldDateParser.parse("2020-02-29"), Locale.US)) ); + } + + @Test + public void givenFeb29_2020_and_localeDE_thenNewSaturdayText() throws ParseException { + assertThat("Samstag".equals(DayOfWeekExtractor.getDayStringOld(oldDateParser.parse("2020-02-29"), Locale.GERMANY)) ); + } + + +} + + + From 060557608c8a11bdb31e707eedc41e91b2cf9af6 Mon Sep 17 00:00:00 2001 From: Sampada <46674082+sampada07@users.noreply.github.com> Date: Tue, 24 Mar 2020 08:37:48 +0530 Subject: [PATCH 094/130] BAEL-3883: Boruvka's minimum spanning tree, moved code to newer module (#8949) algorithms-miscellaneous-6 --- algorithms-miscellaneous-5/pom.xml | 6 -- .../algorithms/boruvka/BoruvkaMST.java | 61 -------------- .../algorithms/boruvka/DisjointSet.java | 49 ----------- .../com/baeldung/algorithms/boruvka/Edge.java | 40 --------- .../baeldung/algorithms/boruvka/Graph.java | 64 -------------- .../baeldung/algorithms/boruvka/Input.java | 65 -------------- .../com/baeldung/algorithms/boruvka/Tree.java | 63 -------------- .../algorithms/boruvka/BoruvkaUnitTest.java | 48 ----------- algorithms-miscellaneous-6/pom.xml | 12 +++ .../algorithms/boruvka/BoruvkaMST.java | 84 +++++++++++++++++++ .../algorithms/boruvka/UnionFind.java | 39 +++++++++ .../algorithms/boruvka/BoruvkaUnitTest.java | 37 ++++++++ 12 files changed, 172 insertions(+), 396 deletions(-) delete mode 100644 algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/BoruvkaMST.java delete mode 100644 algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/DisjointSet.java delete mode 100644 algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Edge.java delete mode 100644 algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Graph.java delete mode 100644 algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Input.java delete mode 100644 algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Tree.java delete mode 100644 algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/boruvka/BoruvkaUnitTest.java create mode 100644 algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/boruvka/BoruvkaMST.java create mode 100644 algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/boruvka/UnionFind.java create mode 100644 algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/boruvka/BoruvkaUnitTest.java diff --git a/algorithms-miscellaneous-5/pom.xml b/algorithms-miscellaneous-5/pom.xml index f2db71a6da..4131e1791d 100644 --- a/algorithms-miscellaneous-5/pom.xml +++ b/algorithms-miscellaneous-5/pom.xml @@ -41,11 +41,6 @@ guava ${guava.version} - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - org.junit.platform junit-platform-commons @@ -78,7 +73,6 @@ 1.11 3.6.1 28.1-jre - 2.10.2 1.6.0 diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/BoruvkaMST.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/BoruvkaMST.java deleted file mode 100644 index 0f8bc5b296..0000000000 --- a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/BoruvkaMST.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.baeldung.algorithms.boruvka; - -public class BoruvkaMST { - - private static Tree mst = new Tree(); - private static int totalWeight; - - public BoruvkaMST(Graph graph) { - DisjointSet dSet = new DisjointSet(graph.getNodes()); - - // repeat at most log N times or until we have N-1 edges - for (int t = 1; t < graph.getNodes() && mst.getEdgeCount() < graph.getNodes() - 1; t = t + t) { - - // foreach tree in forest, find closest edge - Edge[] closestEdgeArray = new Edge[graph.getNodes()]; - for (Edge edge : graph.getAllEdges()) { - int first = edge.getFirst(); - int second = edge.getSecond(); - int firstParent = dSet.getParent(first); - int secondParent = dSet.getParent(second); - if (firstParent == secondParent) { - continue; // same tree - } - if (closestEdgeArray[firstParent] == null || edge.getWeight() < closestEdgeArray[firstParent].getWeight()) { - closestEdgeArray[firstParent] = edge; - } - if (closestEdgeArray[secondParent] == null || edge.getWeight() < closestEdgeArray[secondParent].getWeight()) { - closestEdgeArray[secondParent] = edge; - } - } - - // add newly discovered edges to MST - for (int i = 0; i < graph.getNodes(); i++) { - Edge edge = closestEdgeArray[i]; - if (edge != null) { - int first = edge.getFirst(); - int second = edge.getSecond(); - // don't add the same edge twice - if (dSet.getParent(first) != dSet.getParent(second)) { - mst.addEdge(edge); - totalWeight += edge.getWeight(); - dSet.union(first, second); - } - } - } - } - } - - public Iterable getMST() { - return mst; - } - - public int getTotalWeight() { - return totalWeight; - } - - public String toString() { - return "MST: " + mst.toString() + " | Total Weight: " + totalWeight; - } - -} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/DisjointSet.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/DisjointSet.java deleted file mode 100644 index 7769686e36..0000000000 --- a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/DisjointSet.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baeldung.algorithms.boruvka; - -import java.util.Arrays; - -public class DisjointSet { - - private int[] nodeParents; - private int[] nodeRanks; - - public DisjointSet(int n) { - nodeParents = new int[n]; - nodeRanks = new int[n]; - for (int i = 0; i < n; i++) { - nodeParents[i] = i; - nodeRanks[i] = 0; - } - } - - public int getParent(int node) { - while (node != nodeParents[node]) { - node = nodeParents[node]; - } - return node; - } - - public void union(int node1, int node2) { - int node1Parent = getParent(node1); - int node2Parent = getParent(node2); - if (node1Parent == node2Parent) { - return; - } - - if (nodeRanks[node1Parent] < nodeRanks[node2Parent]) { - nodeParents[node1Parent] = node2Parent; - } - else if (nodeRanks[node1Parent] > nodeRanks[node2Parent]) { - nodeParents[node2Parent] = node1Parent; - } - else { - nodeParents[node2Parent] = node1Parent; - nodeRanks[node1Parent]++; - } - } - - public String toString() { - return "Parent: " + Arrays.toString(nodeParents) + "Rank: " + Arrays.toString(nodeRanks); - } - -} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Edge.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Edge.java deleted file mode 100644 index 6ee136fc48..0000000000 --- a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Edge.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.algorithms.boruvka; - -public class Edge { - - private final int first; - private final int second; - private final int weight; - - public Edge(int first, int second, int weight) { - this.first = first; - this.second = second; - this.weight = weight; - } - - public double getWeight() { - return weight; - } - - public int getFirst() { - return first; - } - - public int getSecond() { - return second; - } - - public int getOtherNode(int firstNode) { - int secondNode = 0; - if (firstNode == first) - secondNode = second; - else if (firstNode == second) - secondNode = first; - return secondNode; - } - - public String toString() { - return String.format("%d-%d %d", first, second, weight); - } - -} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Graph.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Graph.java deleted file mode 100644 index e899007dfa..0000000000 --- a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Graph.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.baeldung.algorithms.boruvka; - -import java.io.IOException; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; - -public class Graph { - - private int nodes; - private int edges; - private Tree[] trees; - - public Graph(Input jsonGraph) throws JsonParseException, JsonMappingException, IOException { - nodes = jsonGraph.getNodes(); - trees = (Tree[]) new Tree[nodes]; - for (int i = 0; i < nodes; i++) { - trees[i] = new Tree(); - } - - int edgesFromInput = jsonGraph.getEdges(); - for (int i = 0; i < edgesFromInput; i++) { - int first = jsonGraph.getEdgeList() - .get(i) - .getFirst(); - int second = jsonGraph.getEdgeList() - .get(i) - .getSecond(); - int weight = jsonGraph.getEdgeList() - .get(i) - .getWeight(); - Edge edge = new Edge(first, second, weight); - - trees[first].addEdge(edge); - trees[second].addEdge(edge); - edges++; - } - - } - - public int getNodes() { - return nodes; - } - - public int getEdges() { - return edges; - } - - public Iterable iterableTree(int i) { - return trees[i]; - } - - public Iterable getAllEdges() { - Iterable list = new Tree(); - for (int i = 0; i < nodes; i++) { - for (Edge edge : iterableTree(i)) { - if (edge.getOtherNode(i) > i) { - ((Tree) list).addEdge(edge); - } - } - } - return list; - } -} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Input.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Input.java deleted file mode 100644 index b52720d5e9..0000000000 --- a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Input.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.baeldung.algorithms.boruvka; - -import java.util.List; - -public class Input { - private int nodes; - private int edges; - private List edgeList; - - public int getNodes() { - return nodes; - } - - public void setNodes(int nodes) { - this.nodes = nodes; - } - - public int getEdges() { - return edges; - } - - public void setEdges(int edges) { - this.edges = edges; - } - - public List getEdgeList() { - return edgeList; - } - - public void setEdgeList(List edgeList) { - this.edgeList = edgeList; - } - - static class E { - private int first; - private int second; - private int weight; - - public int getFirst() { - return first; - } - - public void setFirst(int first) { - this.first = first; - } - - public int getSecond() { - return second; - } - - public void setSecond(int second) { - this.second = second; - } - - public int getWeight() { - return weight; - } - - public void setWeight(int weight) { - this.weight = weight; - } - - } - -} diff --git a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Tree.java b/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Tree.java deleted file mode 100644 index cc28233e07..0000000000 --- a/algorithms-miscellaneous-5/src/main/java/com/baeldung/algorithms/boruvka/Tree.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.baeldung.algorithms.boruvka; - -import java.util.Iterator; - -public class Tree implements Iterable { - private Node root; - private int edgeCount; - - private static class Node { - private Edge edge; - private Node next; - - public String toString() { - String nextStr = next != null ? next.toString() : ""; - return edge.toString() + " | " + nextStr; - } - } - - public Tree() { - root = null; - edgeCount = 0; - } - - public int getEdgeCount() { - return edgeCount; - } - - public void addEdge(Edge edge) { - Node oldRoot = root; - root = new Node(); - root.edge = edge; - root.next = oldRoot; - edgeCount++; - } - - public String toString() { - String rootStr = root != null ? root.toString() : ""; - return "Tree: " + rootStr + "Size: " + edgeCount; - } - - public Iterator iterator() { - return new LinkedIterator(root); - } - - private class LinkedIterator implements Iterator { - private Node current; - - public LinkedIterator(Node root) { - current = root; - } - - public boolean hasNext() { - return current != null; - } - - public Edge next() { - Edge edge = current.edge; - current = current.next; - return edge; - } - } - -} diff --git a/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/boruvka/BoruvkaUnitTest.java b/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/boruvka/BoruvkaUnitTest.java deleted file mode 100644 index 1d03d2d4d9..0000000000 --- a/algorithms-miscellaneous-5/src/test/java/com/baeldung/algorithms/boruvka/BoruvkaUnitTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.baeldung.algorithms.boruvka; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; - -import org.junit.Before; -import org.junit.Test; - -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class BoruvkaUnitTest { - - private Input input; - private static String INPUT_JSON = "/input.json"; - - @Before - public void convertInputJsonToObject() throws JsonParseException, JsonMappingException, IOException { - ObjectMapper mapper = new ObjectMapper(); - StringBuilder jsonStr = new StringBuilder(); - try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(BoruvkaMST.class.getResourceAsStream(INPUT_JSON)))) { - String line; - while ((line = bufferedReader.readLine()) != null) { - jsonStr.append(line) - .append("\n"); - } - } - - input = mapper.readValue(jsonStr.toString(), Input.class); - - } - - @Test - public void givenInputGraph_whenBoruvkaPerformed_thenMinimumSpanningTree() throws JsonParseException, JsonMappingException, IOException { - Graph graph = new Graph(input); - BoruvkaMST boruvkaMST = new BoruvkaMST(graph); - - Tree mst = (Tree) boruvkaMST.getMST(); - - assertEquals(30, boruvkaMST.getTotalWeight()); - assertEquals(4, mst.getEdgeCount()); - } - -} diff --git a/algorithms-miscellaneous-6/pom.xml b/algorithms-miscellaneous-6/pom.xml index 5daa000ea3..fda9cf10f9 100644 --- a/algorithms-miscellaneous-6/pom.xml +++ b/algorithms-miscellaneous-6/pom.xml @@ -11,5 +11,17 @@ parent-modules 1.0.0-SNAPSHOT + + + + com.google.guava + guava + ${guava.version} + + + + + 28.1-jre + diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/boruvka/BoruvkaMST.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/boruvka/BoruvkaMST.java new file mode 100644 index 0000000000..7dae21648c --- /dev/null +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/boruvka/BoruvkaMST.java @@ -0,0 +1,84 @@ +package com.baeldung.algorithms.boruvka; + +import com.google.common.graph.EndpointPair; +import com.google.common.graph.MutableValueGraph; +import com.google.common.graph.ValueGraphBuilder; + +public class BoruvkaMST { + + private static MutableValueGraph mst = ValueGraphBuilder.undirected() + .build(); + private static int totalWeight; + + public BoruvkaMST(MutableValueGraph graph) { + + int size = graph.nodes().size(); + + UnionFind uf = new UnionFind(size); + + // repeat at most log N times or until we have N-1 edges + for (int t = 1; t < size && mst.edges().size() < size - 1; t = t + t) { + + EndpointPair[] closestEdgeArray = new EndpointPair[size]; + + // foreach tree in graph, find closest edge + for (EndpointPair edge : graph.edges()) { + int u = edge.nodeU(); + int v = edge.nodeV(); + int uParent = uf.find(u); + int vParent = uf.find(v); + if (uParent == vParent) { + continue; // same tree + } + + int weight = graph.edgeValueOrDefault(u, v, 0); + + if (closestEdgeArray[uParent] == null) { + closestEdgeArray[uParent] = edge; + } + if (closestEdgeArray[vParent] == null) { + closestEdgeArray[vParent] = edge; + } + + int uParentWeight = graph.edgeValueOrDefault(closestEdgeArray[uParent].nodeU(), closestEdgeArray[uParent].nodeV(), 0); + int vParentWeight = graph.edgeValueOrDefault(closestEdgeArray[vParent].nodeU(), closestEdgeArray[vParent].nodeV(), 0); + + if (weight < uParentWeight) { + closestEdgeArray[uParent] = edge; + } + if (weight < vParentWeight) { + closestEdgeArray[vParent] = edge; + } + } + + // add newly discovered edges to MST + for (int i = 0; i < size; i++) { + EndpointPair edge = closestEdgeArray[i]; + if (edge != null) { + int u = edge.nodeU(); + int v = edge.nodeV(); + int weight = graph.edgeValueOrDefault(u, v, 0); + // don't add the same edge twice + if (uf.find(u) != uf.find(v)) { + mst.putEdgeValue(u, v, weight); + totalWeight += weight; + uf.union(u, v); + } + } + } + } + } + + public MutableValueGraph getMST() { + return mst; + } + + public int getTotalWeight() { + return totalWeight; + } + + public String toString() { + return "MST: " + mst.toString() + " | Total Weight: " + totalWeight; + } + +} diff --git a/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/boruvka/UnionFind.java b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/boruvka/UnionFind.java new file mode 100644 index 0000000000..33c9c4a4c8 --- /dev/null +++ b/algorithms-miscellaneous-6/src/main/java/com/baeldung/algorithms/boruvka/UnionFind.java @@ -0,0 +1,39 @@ +package com.baeldung.algorithms.boruvka; + +public class UnionFind { + private int[] parents; + private int[] ranks; + + public UnionFind(int n) { + parents = new int[n]; + ranks = new int[n]; + for (int i = 0; i < n; i++) { + parents[i] = i; + ranks[i] = 0; + } + } + + public int find(int u) { + while (u != parents[u]) { + u = parents[u]; + } + return u; + } + + public void union(int u, int v) { + int uParent = find(u); + int vParent = find(v); + if (uParent == vParent) { + return; + } + + if (ranks[uParent] < ranks[vParent]) { + parents[uParent] = vParent; + } else if (ranks[uParent] > ranks[vParent]) { + parents[vParent] = uParent; + } else { + parents[vParent] = uParent; + ranks[uParent]++; + } + } +} diff --git a/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/boruvka/BoruvkaUnitTest.java b/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/boruvka/BoruvkaUnitTest.java new file mode 100644 index 0000000000..e61e1e668d --- /dev/null +++ b/algorithms-miscellaneous-6/src/test/java/com/baeldung/algorithms/boruvka/BoruvkaUnitTest.java @@ -0,0 +1,37 @@ +package com.baeldung.algorithms.boruvka; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.Before; +import org.junit.Test; + +import com.google.common.graph.MutableValueGraph; +import com.google.common.graph.ValueGraphBuilder; + +public class BoruvkaUnitTest { + + private MutableValueGraph graph; + + @Before + public void setup() { + graph = ValueGraphBuilder.undirected() + .build(); + graph.putEdgeValue(0, 1, 8); + graph.putEdgeValue(0, 2, 5); + graph.putEdgeValue(1, 2, 9); + graph.putEdgeValue(1, 3, 11); + graph.putEdgeValue(2, 3, 15); + graph.putEdgeValue(2, 4, 10); + graph.putEdgeValue(3, 4, 7); + } + + @Test + public void givenInputGraph_whenBoruvkaPerformed_thenMinimumSpanningTree() { + BoruvkaMST boruvkaMST = new BoruvkaMST(graph); + MutableValueGraph mst = boruvkaMST.getMST(); + + assertEquals(30, boruvkaMST.getTotalWeight()); + assertEquals(4, mst.edges().size()); + } + +} From ff87d3ecc246a9c8cc3eed792dad0ce44338e54b Mon Sep 17 00:00:00 2001 From: Gang Wu Date: Mon, 23 Mar 2020 22:00:55 -0600 Subject: [PATCH 095/130] BAEL-3069 Remove final keyword, add more empty lines for readability. --- .../src/main/java/com/baeldung/jdbc/EmployeeDAO.java | 2 +- .../src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/EmployeeDAO.java b/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/EmployeeDAO.java index a7adb7933a..b5bf9452ed 100644 --- a/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/EmployeeDAO.java +++ b/persistence-modules/spring-persistence-simple-2/src/main/java/com/baeldung/jdbc/EmployeeDAO.java @@ -9,7 +9,7 @@ import org.springframework.stereotype.Repository; public class EmployeeDAO { private JdbcTemplate jdbcTemplate; - public void setDataSource(final DataSource dataSource) { + public void setDataSource(DataSource dataSource) { jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java b/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java index a64ba9b2f0..71e8fb4263 100644 --- a/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java +++ b/persistence-modules/spring-persistence-simple-2/src/test/java/com/baeldung/jdbc/EmployeeDAOUnitTest.java @@ -27,10 +27,12 @@ public class EmployeeDAOUnitTest { ReflectionTestUtils.setField(employeeDAO, "jdbcTemplate", jdbcTemplate); Mockito.when(jdbcTemplate.queryForObject("SELECT COUNT(*) FROM EMPLOYEE", Integer.class)) .thenReturn(4); + assertEquals(4, employeeDAO.getCountOfEmployees()); Mockito.when(jdbcTemplate.queryForObject(Mockito.anyString(), Mockito.eq(Integer.class))) .thenReturn(3); + assertEquals(3, employeeDAO.getCountOfEmployees()); } @@ -40,8 +42,10 @@ public class EmployeeDAOUnitTest { .addScript("classpath:jdbc/schema.sql") .addScript("classpath:jdbc/test-data.sql") .build(); + EmployeeDAO employeeDAO = new EmployeeDAO(); employeeDAO.setDataSource(dataSource); + assertEquals(4, employeeDAO.getCountOfEmployees()); } } From 147a3fc2d5f8e05e98a288e9fad4d5625368b61a Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 24 Mar 2020 14:49:36 +0800 Subject: [PATCH 096/130] Update README.md --- logging-modules/log-mdc/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/logging-modules/log-mdc/README.md b/logging-modules/log-mdc/README.md index 3841224824..b676d3ba76 100644 --- a/logging-modules/log-mdc/README.md +++ b/logging-modules/log-mdc/README.md @@ -1,8 +1,8 @@ ### Relevant Articles: - TBD -- [Improved Java Logging with Mapped Diagnostic Context (MDC)](http://www.baeldung.com/mdc-in-log4j-2-logback) -- [Java Logging with Nested Diagnostic Context (NDC)](http://www.baeldung.com/java-logging-ndc-log4j) -- [Drools Using Rules from Excel Files](http://www.baeldung.com/drools-excel) +- [Improved Java Logging with Mapped Diagnostic Context (MDC)](https://www.baeldung.com/mdc-in-log4j-2-logback) +- [Java Logging with Nested Diagnostic Context (NDC)](https:www.baeldung.com/java-logging-ndc-log4j) +- [Drools Using Rules from Excel Files](https://www.baeldung.com/drools-excel) ### References From c3976ffa90911b02656325114eaaabfb6912dd54 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 24 Mar 2020 14:53:24 +0800 Subject: [PATCH 097/130] Update README.MD --- spring-boot-modules/spring-boot/README.MD | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot/README.MD b/spring-boot-modules/spring-boot/README.MD index b15ab7dbe5..4f731f2627 100644 --- a/spring-boot-modules/spring-boot/README.MD +++ b/spring-boot-modules/spring-boot/README.MD @@ -26,3 +26,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring Shutdown Callbacks](https://www.baeldung.com/spring-shutdown-callbacks) - [Container Configuration in Spring Boot 2](https://www.baeldung.com/embeddedservletcontainercustomizer-configurableembeddedservletcontainer-spring-boot) - [Validation in Spring Boot](https://www.baeldung.com/spring-boot-bean-validation) +- [Running Setup Data on Startup in Spring](https://www.baeldung.com/running-setup-logic-on-startup-in-spring) From 470575f3ff923831f49abe769223c8b159713ee7 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Tue, 24 Mar 2020 15:05:36 +0800 Subject: [PATCH 098/130] Update README.md --- spring-reactor/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-reactor/README.md b/spring-reactor/README.md index b92478f6fb..f8cf2898f1 100644 --- a/spring-reactor/README.md +++ b/spring-reactor/README.md @@ -4,4 +4,4 @@ This module contains articles about Spring Reactor ## Relevant articles: -- [Introduction to Spring Reactor](https://www.baeldung.com/spring-reactor) +- [Introduction to Project Reactor Bus](https://www.baeldung.com/reactor-bus) From 7ad1542856206c68c8817e28b0cbe9b49196beb9 Mon Sep 17 00:00:00 2001 From: Justin Albano Date: Tue, 24 Mar 2020 19:56:27 -0400 Subject: [PATCH 099/130] BAEL-3587: Added %n new line example. --- .../java/com/baeldung/newline/AddingNewLineToString.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java index f701ab2e45..45de6523f9 100644 --- a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java +++ b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java @@ -38,6 +38,11 @@ public class AddingNewLineToString { System.out.println("6. Using System.getProperty(\"line.separator\")"); rhyme = line1 + System.getProperty("line.separator") + line2; System.out.println(rhyme); + + //6. Using %n + System.out.println("7. Using %n"); + rhyme = "Humpty Dumpty sat on a wall.%nHumpty Dumpty had a great fall."; + System.out.println(rhyme); System.out.println("***HTML to rendered in a browser***"); //1. Line break for HTML using
From f239c41f5fc570c7d3db66f1b5a3c7758905cd13 Mon Sep 17 00:00:00 2001 From: Justin Albano Date: Tue, 24 Mar 2020 19:57:56 -0400 Subject: [PATCH 100/130] BAEL-3587: Corrected mis-numbering in comments. --- .../main/java/com/baeldung/newline/AddingNewLineToString.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java index 45de6523f9..dd8b3a420d 100644 --- a/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java +++ b/core-java-modules/core-java-string-operations/src/main/java/com/baeldung/newline/AddingNewLineToString.java @@ -39,7 +39,7 @@ public class AddingNewLineToString { rhyme = line1 + System.getProperty("line.separator") + line2; System.out.println(rhyme); - //6. Using %n + //7. Using %n System.out.println("7. Using %n"); rhyme = "Humpty Dumpty sat on a wall.%nHumpty Dumpty had a great fall."; System.out.println(rhyme); From 361615f48b960d83b121f83ae6b0afca538054bc Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 25 Mar 2020 10:45:07 +0800 Subject: [PATCH 101/130] Update README.md --- spring-mvc-basics-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-mvc-basics-3/README.md b/spring-mvc-basics-3/README.md index 180cee498b..074c60152c 100644 --- a/spring-mvc-basics-3/README.md +++ b/spring-mvc-basics-3/README.md @@ -12,4 +12,5 @@ This module contains articles about Spring MVC - [Excluding URLs for a Filter in a Spring Web Application](https://www.baeldung.com/spring-exclude-filter) - [Guide to Flash Attributes in a Spring Web Application](https://www.baeldung.com/spring-web-flash-attributes) - [Handling URL Encoded Form Data in Spring REST](https://www.baeldung.com/spring-url-encoded-form-data) +- [Reading HttpServletRequest Multiple Times in Spring](https://www.baeldung.com/spring-reading-httpservletrequest-multiple-times) - More articles: [[<-- prev]](/spring-mvc-basics-2)[[more -->]](/spring-mvc-basics-4) From 6420d62d09f7f5120b4bd2c11668363955256e65 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 25 Mar 2020 10:48:12 +0800 Subject: [PATCH 102/130] Update README.md --- algorithms-miscellaneous-5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/algorithms-miscellaneous-5/README.md b/algorithms-miscellaneous-5/README.md index 87a328e446..6e0de7d64e 100644 --- a/algorithms-miscellaneous-5/README.md +++ b/algorithms-miscellaneous-5/README.md @@ -19,4 +19,5 @@ This module contains articles about algorithms. Some classes of algorithms, e.g. - [Balanced Brackets Algorithm in Java](https://www.baeldung.com/java-balanced-brackets-algorithm) - [Efficiently Merge Sorted Java Sequences](https://www.baeldung.com/java-merge-sorted-sequences) - [Introduction to Greedy Algorithms with Java](https://www.baeldung.com/java-greedy-algorithms) +- [The Caesar Cipher in Java](https://www.baeldung.com/java-caesar-cipher) - More articles: [[<-- prev]](/../algorithms-miscellaneous-4) From f5afce0b95de6621dce734c4a849567a9916a900 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Wed, 25 Mar 2020 10:50:09 +0800 Subject: [PATCH 103/130] Update README.md --- spring-scheduling/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-scheduling/README.md b/spring-scheduling/README.md index bf34fb60de..4ee306c0e0 100644 --- a/spring-scheduling/README.md +++ b/spring-scheduling/README.md @@ -4,4 +4,4 @@ - [Guide to Spring Retry](https://www.baeldung.com/spring-retry) - [How To Do @Async in Spring](https://www.baeldung.com/spring-async) - [Conditionally Enable Scheduled Jobs in Spring](https://www.baeldung.com/spring-scheduled-enabled-conditionally) - +- [Remote Debugging with IntelliJ IDEA](https://www.baeldung.com/intellij-remote-debugging) From 50c9b1c75e20598078473f83e8c92755dbd27eb8 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 Mar 2020 12:07:06 +0530 Subject: [PATCH 104/130] JAVA-626: Updated Next and Prev links in README --- core-java-modules/core-java-lang-math-2/README.md | 2 +- core-java-modules/core-java-lang-math/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-lang-math-2/README.md b/core-java-modules/core-java-lang-math-2/README.md index 0e0f1991c4..9382414245 100644 --- a/core-java-modules/core-java-lang-math-2/README.md +++ b/core-java-modules/core-java-lang-math-2/README.md @@ -13,4 +13,4 @@ - [Convert Latitude and Longitude to a 2D Point in Java](https://www.baeldung.com/java-convert-latitude-longitude) - [Debugging with Eclipse](https://www.baeldung.com/eclipse-debugging) - [Matrix Multiplication in Java](https://www.baeldung.com/java-matrix-multiplication) -- More articles: [[<-- prev]](/../core-java-lang-math) +- More articles: [[<-- Prev]](/../core-java-lang-math) diff --git a/core-java-modules/core-java-lang-math/README.md b/core-java-modules/core-java-lang-math/README.md index 8a822d75fd..834799d6c6 100644 --- a/core-java-modules/core-java-lang-math/README.md +++ b/core-java-modules/core-java-lang-math/README.md @@ -13,4 +13,4 @@ - [Calculating Logarithms in Java](https://www.baeldung.com/java-logarithms) - [Finding Greatest Common Divisor in Java](https://www.baeldung.com/java-greatest-common-divisor) - [Calculate Percentage in Java](https://www.baeldung.com/java-calculate-percentage) -- More articles: [[<-- next]](/../core-java-lang-math-2) +- More articles: [[Next -->]](/../core-java-lang-math-2) From 532d2a32eef22eb85e6c1cb7d03c303ff4361b58 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 Mar 2020 12:10:44 +0530 Subject: [PATCH 105/130] JAVA-626: Updated Next and Prev links in README --- core-java-modules/core-java-lang-math-2/README.md | 2 +- core-java-modules/core-java-lang-math/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-lang-math-2/README.md b/core-java-modules/core-java-lang-math-2/README.md index 9382414245..09039f6ed0 100644 --- a/core-java-modules/core-java-lang-math-2/README.md +++ b/core-java-modules/core-java-lang-math-2/README.md @@ -13,4 +13,4 @@ - [Convert Latitude and Longitude to a 2D Point in Java](https://www.baeldung.com/java-convert-latitude-longitude) - [Debugging with Eclipse](https://www.baeldung.com/eclipse-debugging) - [Matrix Multiplication in Java](https://www.baeldung.com/java-matrix-multiplication) -- More articles: [[<-- Prev]](/../core-java-lang-math) +- More articles: [[<-- Prev]](/core-java-modules/core-java-lang-math) diff --git a/core-java-modules/core-java-lang-math/README.md b/core-java-modules/core-java-lang-math/README.md index 834799d6c6..9295349f82 100644 --- a/core-java-modules/core-java-lang-math/README.md +++ b/core-java-modules/core-java-lang-math/README.md @@ -13,4 +13,4 @@ - [Calculating Logarithms in Java](https://www.baeldung.com/java-logarithms) - [Finding Greatest Common Divisor in Java](https://www.baeldung.com/java-greatest-common-divisor) - [Calculate Percentage in Java](https://www.baeldung.com/java-calculate-percentage) -- More articles: [[Next -->]](/../core-java-lang-math-2) +- More articles: [[Next -->]](/core-java-modules/core-java-lang-math-2) From d2dacc22ba59c48bd3e7d2524d440d694cfb663e Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 Mar 2020 23:06:05 +0530 Subject: [PATCH 106/130] JAVA-625: Moved 3 articles from java-numbers-2 to java-numbers-3 --- .../main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java | 2 -- .../main/java/com/baeldung/numbersinrange/NumbersInARange.java | 0 .../java/com/baeldung/numbersinrange/RandomNumbersInARange.java | 0 .../com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java | 0 .../com/baeldung/numbersinrange/NumbersInARangeUnitTest.java | 0 .../baeldung/numbersinrange/RandomNumbersInARangeUnitTest.java | 0 6 files changed, 2 deletions(-) rename {java-numbers-2 => java-numbers-3}/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java (96%) rename {java-numbers-2 => java-numbers-3}/src/main/java/com/baeldung/numbersinrange/NumbersInARange.java (100%) rename {java-numbers-2 => java-numbers-3}/src/main/java/com/baeldung/numbersinrange/RandomNumbersInARange.java (100%) rename {java-numbers-2 => java-numbers-3}/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java (100%) rename {java-numbers-2 => java-numbers-3}/src/test/java/com/baeldung/numbersinrange/NumbersInARangeUnitTest.java (100%) rename {java-numbers-2 => java-numbers-3}/src/test/java/com/baeldung/numbersinrange/RandomNumbersInARangeUnitTest.java (100%) diff --git a/java-numbers-2/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java b/java-numbers-3/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java similarity index 96% rename from java-numbers-2/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java rename to java-numbers-3/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java index 943fcffa56..616f3ab28f 100644 --- a/java-numbers-2/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java +++ b/java-numbers-3/src/main/java/com/baeldung/fibonacci/FibonacciSeriesUtils.java @@ -1,7 +1,5 @@ package com.baeldung.fibonacci; -import static java.lang.Math.pow; - public class FibonacciSeriesUtils { public static int nthFibonacciTermRecursiveMethod(int n) { diff --git a/java-numbers-2/src/main/java/com/baeldung/numbersinrange/NumbersInARange.java b/java-numbers-3/src/main/java/com/baeldung/numbersinrange/NumbersInARange.java similarity index 100% rename from java-numbers-2/src/main/java/com/baeldung/numbersinrange/NumbersInARange.java rename to java-numbers-3/src/main/java/com/baeldung/numbersinrange/NumbersInARange.java diff --git a/java-numbers-2/src/main/java/com/baeldung/numbersinrange/RandomNumbersInARange.java b/java-numbers-3/src/main/java/com/baeldung/numbersinrange/RandomNumbersInARange.java similarity index 100% rename from java-numbers-2/src/main/java/com/baeldung/numbersinrange/RandomNumbersInARange.java rename to java-numbers-3/src/main/java/com/baeldung/numbersinrange/RandomNumbersInARange.java diff --git a/java-numbers-2/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java b/java-numbers-3/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java similarity index 100% rename from java-numbers-2/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java rename to java-numbers-3/src/test/java/com/baeldung/fibonacci/FibonacciSeriesUtilsUnitTest.java diff --git a/java-numbers-2/src/test/java/com/baeldung/numbersinrange/NumbersInARangeUnitTest.java b/java-numbers-3/src/test/java/com/baeldung/numbersinrange/NumbersInARangeUnitTest.java similarity index 100% rename from java-numbers-2/src/test/java/com/baeldung/numbersinrange/NumbersInARangeUnitTest.java rename to java-numbers-3/src/test/java/com/baeldung/numbersinrange/NumbersInARangeUnitTest.java diff --git a/java-numbers-2/src/test/java/com/baeldung/numbersinrange/RandomNumbersInARangeUnitTest.java b/java-numbers-3/src/test/java/com/baeldung/numbersinrange/RandomNumbersInARangeUnitTest.java similarity index 100% rename from java-numbers-2/src/test/java/com/baeldung/numbersinrange/RandomNumbersInARangeUnitTest.java rename to java-numbers-3/src/test/java/com/baeldung/numbersinrange/RandomNumbersInARangeUnitTest.java From 529720c911fef7de6e2d551b024a431adcf74bdd Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 Mar 2020 23:06:33 +0530 Subject: [PATCH 107/130] JAVA-625: Updated README for both modules --- java-numbers-2/README.md | 3 --- java-numbers-3/README.md | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/java-numbers-2/README.md b/java-numbers-2/README.md index ba9e14965d..48f9acd32d 100644 --- a/java-numbers-2/README.md +++ b/java-numbers-2/README.md @@ -13,7 +13,4 @@ This module contains articles about numbers in Java. - [Binary Numbers in Java](https://www.baeldung.com/java-binary-numbers) - [Finding the Least Common Multiple in Java](https://www.baeldung.com/java-least-common-multiple) - [Binary Numbers in Java](https://www.baeldung.com/java-binary-numbers) -- [Generating Random Numbers in a Range in Java](https://www.baeldung.com/java-generating-random-numbers-in-range) -- [Listing Numbers Within a Range in Java](https://www.baeldung.com/java-listing-numbers-within-a-range) -- [Fibonacci Series in Java](https://www.baeldung.com/java-fibonacci) - More articles: [[<-- prev]](/../java-numbers) diff --git a/java-numbers-3/README.md b/java-numbers-3/README.md index 835b8b0b54..035fc0c789 100644 --- a/java-numbers-3/README.md +++ b/java-numbers-3/README.md @@ -1,5 +1,13 @@ +## Java Number Cookbooks and Examples + +This module contains articles about numbers in Java. + ### Relevant Articles: - [Generating Random Numbers](https://www.baeldung.com/java-generating-random-numbers) - [Convert Double to Long in Java](https://www.baeldung.com/java-convert-double-long) - [Check for null Before Calling Parse in Double.parseDouble](https://www.baeldung.com/java-check-null-parse-double) +- [Generating Random Numbers in a Range in Java](https://www.baeldung.com/java-generating-random-numbers-in-range) +- [Listing Numbers Within a Range in Java](https://www.baeldung.com/java-listing-numbers-within-a-range) +- [Fibonacci Series in Java](https://www.baeldung.com/java-fibonacci) +- More articles: [[<-- prev]](/../java-numbers-2) From 525d960cf02a75ff4300eb6e4ba6bae37e75069f Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 Mar 2020 23:10:20 +0530 Subject: [PATCH 108/130] JAVA-625: Added next link to second module --- java-numbers-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-numbers-2/README.md b/java-numbers-2/README.md index 48f9acd32d..fc852aab19 100644 --- a/java-numbers-2/README.md +++ b/java-numbers-2/README.md @@ -13,4 +13,4 @@ This module contains articles about numbers in Java. - [Binary Numbers in Java](https://www.baeldung.com/java-binary-numbers) - [Finding the Least Common Multiple in Java](https://www.baeldung.com/java-least-common-multiple) - [Binary Numbers in Java](https://www.baeldung.com/java-binary-numbers) -- More articles: [[<-- prev]](/../java-numbers) +- More articles: [[<-- prev]](/../java-numbers) [[next -->]](/../java-numbers-3) From 65dd613fb8c48d1d7e7244e6fb39d4c4353c8d70 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 Mar 2020 23:13:19 +0530 Subject: [PATCH 109/130] JAVA-625: Updated README links --- java-numbers-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-numbers-2/README.md b/java-numbers-2/README.md index fc852aab19..1d996e32cc 100644 --- a/java-numbers-2/README.md +++ b/java-numbers-2/README.md @@ -13,4 +13,4 @@ This module contains articles about numbers in Java. - [Binary Numbers in Java](https://www.baeldung.com/java-binary-numbers) - [Finding the Least Common Multiple in Java](https://www.baeldung.com/java-least-common-multiple) - [Binary Numbers in Java](https://www.baeldung.com/java-binary-numbers) -- More articles: [[<-- prev]](/../java-numbers) [[next -->]](/../java-numbers-3) +- More articles: [[<-- prev]](/java-numbers) [[next -->]](/java-numbers-3) From 9f609d4d84abc8cd68911c96ecdfdb7779dbe701 Mon Sep 17 00:00:00 2001 From: sampadawagde Date: Wed, 25 Mar 2020 23:15:01 +0530 Subject: [PATCH 110/130] JAVA-625: Updated README Prev link --- java-numbers-3/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java-numbers-3/README.md b/java-numbers-3/README.md index 035fc0c789..598acfb927 100644 --- a/java-numbers-3/README.md +++ b/java-numbers-3/README.md @@ -10,4 +10,4 @@ This module contains articles about numbers in Java. - [Generating Random Numbers in a Range in Java](https://www.baeldung.com/java-generating-random-numbers-in-range) - [Listing Numbers Within a Range in Java](https://www.baeldung.com/java-listing-numbers-within-a-range) - [Fibonacci Series in Java](https://www.baeldung.com/java-fibonacci) -- More articles: [[<-- prev]](/../java-numbers-2) +- More articles: [[<-- prev]](/java-numbers-2) From c5ba081f7c1ca22380f69303722802d8e140488a Mon Sep 17 00:00:00 2001 From: Yavuz Tas <12643010+yavuztas@users.noreply.github.com> Date: Thu, 26 Mar 2020 04:23:14 +0100 Subject: [PATCH 111/130] sample codes for article BAEL-3581 (#8942) --- persistence-modules/hibernate-jpa/pom.xml | 8 +- .../entitymanager/getreference/Game.java | 38 ++++ .../entitymanager/getreference/Player.java | 50 +++++ .../src/main/resources/META-INF/create-db.sql | 3 + .../src/main/resources/META-INF/data.sql | 5 + .../src/main/resources/META-INF/drop-db.sql | 2 + .../main/resources/META-INF/persistence.xml | 86 +++++++- .../GetReferenceH2IntegrationTest.java | 194 ++++++++++++++++++ .../GetReferenceMySQLManualTest.java | 185 +++++++++++++++++ .../GetReferencePostgreSQLManualTest.java | 185 +++++++++++++++++ 10 files changed, 754 insertions(+), 2 deletions(-) create mode 100644 persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitymanager/getreference/Game.java create mode 100644 persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitymanager/getreference/Player.java create mode 100644 persistence-modules/hibernate-jpa/src/main/resources/META-INF/create-db.sql create mode 100644 persistence-modules/hibernate-jpa/src/main/resources/META-INF/data.sql create mode 100644 persistence-modules/hibernate-jpa/src/main/resources/META-INF/drop-db.sql create mode 100644 persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferenceH2IntegrationTest.java create mode 100644 persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferenceMySQLManualTest.java create mode 100644 persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferencePostgreSQLManualTest.java diff --git a/persistence-modules/hibernate-jpa/pom.xml b/persistence-modules/hibernate-jpa/pom.xml index 67f40d5017..07b1ee1c51 100644 --- a/persistence-modules/hibernate-jpa/pom.xml +++ b/persistence-modules/hibernate-jpa/pom.xml @@ -81,11 +81,17 @@ jmh-generator-annprocess ${openjdk-jmh.version}
+ + org.postgresql + postgresql + ${postgresql.version} + 5.3.7.Final - 6.0.6 + 8.0.13 + 42.2.11 2.2.3 3.8.0 1.21 diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitymanager/getreference/Game.java b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitymanager/getreference/Game.java new file mode 100644 index 0000000000..1de8de0327 --- /dev/null +++ b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitymanager/getreference/Game.java @@ -0,0 +1,38 @@ +package com.baeldung.hibernate.entitymanager.getreference; + +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Game { + + @Id + private Long id; + + private String name; + + public Game() { + } + + public Game(Long id, String name) { + this.id = id; + this.name = name; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + +} diff --git a/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitymanager/getreference/Player.java b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitymanager/getreference/Player.java new file mode 100644 index 0000000000..459a3a00ad --- /dev/null +++ b/persistence-modules/hibernate-jpa/src/main/java/com/baeldung/hibernate/entitymanager/getreference/Player.java @@ -0,0 +1,50 @@ +package com.baeldung.hibernate.entitymanager.getreference; + +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.ManyToOne; + +@Entity +public class Player { + + @Id + private Long id; + + private String name; + + @ManyToOne + private Game game; + + public Player() { + } + + public Player(Long id, String name) { + this.id = id; + this.name = name; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Game getGame() { + return game; + } + + public void setGame(Game game) { + this.game = game; + } + +} diff --git a/persistence-modules/hibernate-jpa/src/main/resources/META-INF/create-db.sql b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/create-db.sql new file mode 100644 index 0000000000..7074b603f6 --- /dev/null +++ b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/create-db.sql @@ -0,0 +1,3 @@ +create table Game (id bigint not null, name varchar(255), primary key (id)); +create table Player (id bigint not null, name varchar(255), game_id bigint, primary key (id)); +alter table Player add constraint FKohr86afuapoujklti79wo27aa foreign key (game_id) references Game(id); \ No newline at end of file diff --git a/persistence-modules/hibernate-jpa/src/main/resources/META-INF/data.sql b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/data.sql new file mode 100644 index 0000000000..1e83082801 --- /dev/null +++ b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/data.sql @@ -0,0 +1,5 @@ +insert into Game (id, name) values (1, 'Game 1'); +insert into Game (id, name) values (2, 'Game 2'); +insert into Player (game_id, name, id) values (null, 'Player 1', 1); +insert into Player (game_id, name, id) values (null, 'Player 2', 2); +insert into Player (game_id, name, id) values (null, 'Player 3', 3); \ No newline at end of file diff --git a/persistence-modules/hibernate-jpa/src/main/resources/META-INF/drop-db.sql b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/drop-db.sql new file mode 100644 index 0000000000..275324fcae --- /dev/null +++ b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/drop-db.sql @@ -0,0 +1,2 @@ +drop table if exists Player; +drop table if exists Game; \ No newline at end of file diff --git a/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml index 4dfade1af3..c2d5bf59ab 100644 --- a/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml +++ b/persistence-modules/hibernate-jpa/src/main/resources/META-INF/persistence.xml @@ -5,7 +5,7 @@ version="2.0"> Hibernate EntityManager Demo - com.baeldung.hibernate.pojo.Movie + com.baeldung.hibernate.pojo.Movie true @@ -16,4 +16,88 @@ + + + EntityManager getReference persistence unit + com.baeldung.hibernate.entitymanager.getreference.Game + com.baeldung.hibernate.entitymanager.getreference.Player + true + + + + + + + + + + + + + + + + + + + EntityManager getReference persistence unit + com.baeldung.hibernate.entitymanager.getreference.Game + com.baeldung.hibernate.entitymanager.getreference.Player + true + + + + + + + + + + + + + + + + + + + + + + + + + EntityManager getReference persistence unit + com.baeldung.hibernate.entitymanager.getreference.Game + com.baeldung.hibernate.entitymanager.getreference.Player + true + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferenceH2IntegrationTest.java b/persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferenceH2IntegrationTest.java new file mode 100644 index 0000000000..e8e6aeed7c --- /dev/null +++ b/persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferenceH2IntegrationTest.java @@ -0,0 +1,194 @@ +package com.baeldung.hibernate.entitymanager.getreference; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import org.junit.jupiter.api.*; +import org.slf4j.LoggerFactory; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.io.PrintStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class GetReferenceH2IntegrationTest { + + private static EntityManagerFactory entityManagerFactory; + private static EntityManager entityManager; + + private static final PrintStream SystemOut = System.out; + private static OutputStream output; + + @BeforeAll + public static void setup() { + // close some specific loggers so that we can clearly see Hibernate: SQL queries + ((Logger) LoggerFactory.getLogger("org.hibernate.SQL")).setLevel(Level.OFF); + ((Logger) LoggerFactory.getLogger("org.hibernate.type.descriptor.sql")).setLevel(Level.OFF); + ((Logger) LoggerFactory.getLogger("org.hibernate.stat")).setLevel(Level.OFF); + + entityManagerFactory = Persistence.createEntityManagerFactory("com.baeldung.hibernate.entitymanager.game_player_h2"); + entityManager = entityManagerFactory.createEntityManager(); + entityManager.getTransaction().begin(); + + entityManager.persist(new Game(1L, "Game 1")); + entityManager.persist(new Game(2L, "Game 2")); + entityManager.persist(new Player(1L, "Player 1")); + entityManager.persist(new Player(2L, "Player 2")); + entityManager.persist(new Player(3L, "Player 3")); + + entityManager.getTransaction().commit(); + entityManager.clear(); + entityManager.close(); + } + + private void runInTransaction(Runnable task) { + // We create new persistence context for each test method to discard Hibernate first level cache. + // So that we can see the behavior of getReference() method in a non-cached environment. + entityManager = entityManagerFactory.createEntityManager(); + entityManager.getTransaction().begin(); + task.run(); + entityManager.getTransaction().commit(); + // In any case, we use clear() and close() to make all the managed entities detached and cleared. + // So, we can be sure we test always on a clear persistence context. + entityManager.clear(); + entityManager.close(); + } + + @BeforeEach + public void beforeEach() { + // stubbing System.out printStream + output = new ByteArrayOutputStream(); + System.setOut(new PrintStream(output)); + } + + @AfterEach + public void afterEach() { + System.setOut(SystemOut); + // we print to see original output after each test method + System.out.print(output.toString()); + } + + @AfterAll + public static void tearDown() { + entityManagerFactory.close(); + } + + @Test + public void whenUsingFindMethodToUpdateGame_thenExecutesSelectForGame() { + + runInTransaction(() -> { + Game game1 = entityManager.find(Game.class, 1L); + game1.setName("Game Updated 1"); + + entityManager.persist(game1); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select game0_.id as id1_0_0_, game0_.name as name2_0_0_ from Game game0_ where game0_.id=?\n"); + expected.append("Hibernate: update Game set name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingGetReferenceMethodToUpdateGame_thenExecutesSelectForGame() { + + runInTransaction(() -> { + Game game1 = entityManager.getReference(Game.class, 1L); + game1.setName("Game Updated 2"); + + entityManager.persist(game1); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select game0_.id as id1_0_0_, game0_.name as name2_0_0_ from Game game0_ where game0_.id=?\n"); + expected.append("Hibernate: update Game set name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingFindMethodToDeletePlayer_thenExecutesSelectForPlayer() { + + runInTransaction(() -> { + Player player2 = entityManager.find(Player.class, 2L); + entityManager.remove(player2); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: delete from Player where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingGetReferenceMethodToDeletePlayer_thenExecutesSelectForPlayer() { + + runInTransaction(() -> { + Player player3 = entityManager.getReference(Player.class, 3L); + entityManager.remove(player3); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: delete from Player where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingFindMethodToUpdatePlayersGame_thenExecutesSelectForGame() { + + runInTransaction((() -> { + Game game1 = entityManager.find(Game.class, 1L); + + Player player1 = entityManager.find(Player.class, 1L); + player1.setGame(game1); + + entityManager.persist(player1); + })); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select game0_.id as id1_0_0_, game0_.name as name2_0_0_ from Game game0_ where game0_.id=?\n"); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: update Player set game_id=?, name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingGetReferenceMethodToUpdatePlayersGame_thenDoesNotExecuteSelectForGame() { + + runInTransaction(() -> { + Game game2 = entityManager.getReference(Game.class, 2L); + + Player player1 = entityManager.find(Player.class, 1L); + player1.setGame(game2); + + entityManager.persist(player1); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: update Player set game_id=?, name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + +} diff --git a/persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferenceMySQLManualTest.java b/persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferenceMySQLManualTest.java new file mode 100644 index 0000000000..2b7c5e8119 --- /dev/null +++ b/persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferenceMySQLManualTest.java @@ -0,0 +1,185 @@ +package com.baeldung.hibernate.entitymanager.getreference; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import org.junit.jupiter.api.*; +import org.slf4j.LoggerFactory; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.io.PrintStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * We need to have a running MySQL instance and a schema named "baeldung" ready in order to execute this integration test + */ +public class GetReferenceMySQLManualTest { + + private static EntityManagerFactory entityManagerFactory; + private static EntityManager entityManager; + + private static final PrintStream SystemOut = System.out; + private static OutputStream output; + + @BeforeAll + public static void setup() { + // close some specific loggers so that we can clearly see Hibernate: SQL queries + ((Logger) LoggerFactory.getLogger("org.hibernate.SQL")).setLevel(Level.OFF); + ((Logger) LoggerFactory.getLogger("org.hibernate.type.descriptor.sql")).setLevel(Level.OFF); + ((Logger) LoggerFactory.getLogger("org.hibernate.stat")).setLevel(Level.OFF); + + entityManagerFactory = Persistence.createEntityManagerFactory("com.baeldung.hibernate.entitymanager.game_player_mysql"); + } + + private void runInTransaction(Runnable task) { + // We create new persistence context for each test method to discard Hibernate first level cache. + // So that we can see the behavior of getReference() method in a non-cached environment. + entityManager = entityManagerFactory.createEntityManager(); + entityManager.getTransaction().begin(); + task.run(); + entityManager.getTransaction().commit(); + // In any case, we use clear() and close() to make all the managed entities detached and cleared. + // So, we can be sure we test always on a clear persistence context. + entityManager.clear(); + entityManager.close(); + } + + @BeforeEach + public void beforeEach() { + // stubbing System.out printStream + output = new ByteArrayOutputStream(); + System.setOut(new PrintStream(output)); + } + + @AfterEach + public void afterEach() { + System.setOut(SystemOut); + // we print to see original output after each test method + System.out.print(output.toString()); + } + + @AfterAll + public static void tearDown() { + entityManagerFactory.close(); + } + + @Test + public void whenUsingFindMethodToUpdateGame_thenExecutesSelectForGame() { + + runInTransaction(() -> { + Game game1 = entityManager.find(Game.class, 1L); + game1.setName("Game Updated 1"); + + entityManager.persist(game1); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select game0_.id as id1_0_0_, game0_.name as name2_0_0_ from Game game0_ where game0_.id=?\n"); + expected.append("Hibernate: update Game set name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingGetReferenceMethodToUpdateGame_thenExecutesSelectForGame() { + + runInTransaction(() -> { + Game game1 = entityManager.getReference(Game.class, 1L); + game1.setName("Game Updated 2"); + + entityManager.persist(game1); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select game0_.id as id1_0_0_, game0_.name as name2_0_0_ from Game game0_ where game0_.id=?\n"); + expected.append("Hibernate: update Game set name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingFindMethodToDeletePlayer_thenExecutesSelectForPlayer() { + + runInTransaction(() -> { + Player player2 = entityManager.find(Player.class, 2L); + entityManager.remove(player2); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: delete from Player where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingGetReferenceMethodToDeletePlayer_thenExecutesSelectForPlayer() { + + runInTransaction(() -> { + Player player3 = entityManager.getReference(Player.class, 3L); + entityManager.remove(player3); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: delete from Player where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingFindMethodToUpdatePlayersGame_thenExecutesSelectForGame() { + + runInTransaction((() -> { + Game game1 = entityManager.find(Game.class, 1L); + + Player player1 = entityManager.find(Player.class, 1L); + player1.setGame(game1); + + entityManager.persist(player1); + })); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select game0_.id as id1_0_0_, game0_.name as name2_0_0_ from Game game0_ where game0_.id=?\n"); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: update Player set game_id=?, name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingGetReferenceMethodToUpdatePlayersGame_thenDoesNotExecuteSelectForGame() { + + runInTransaction(() -> { + Game game2 = entityManager.getReference(Game.class, 2L); + + Player player1 = entityManager.find(Player.class, 1L); + player1.setGame(game2); + + entityManager.persist(player1); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: update Player set game_id=?, name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + +} diff --git a/persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferencePostgreSQLManualTest.java b/persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferencePostgreSQLManualTest.java new file mode 100644 index 0000000000..17f6b10b8a --- /dev/null +++ b/persistence-modules/hibernate-jpa/src/test/java/com/baeldung/hibernate/entitymanager/getreference/GetReferencePostgreSQLManualTest.java @@ -0,0 +1,185 @@ +package com.baeldung.hibernate.entitymanager.getreference; + +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import org.junit.jupiter.api.*; +import org.slf4j.LoggerFactory; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.io.PrintStream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * We need to have a running PostgreSQL instance in order to execute this integration test + */ +public class GetReferencePostgreSQLManualTest { + + private static EntityManagerFactory entityManagerFactory; + private static EntityManager entityManager; + + private static final PrintStream SystemOut = System.out; + private static OutputStream output; + + @BeforeAll + public static void setup() { + // close some specific loggers so that we can clearly see Hibernate: SQL queries + ((Logger) LoggerFactory.getLogger("org.hibernate.SQL")).setLevel(Level.OFF); + ((Logger) LoggerFactory.getLogger("org.hibernate.type.descriptor.sql")).setLevel(Level.OFF); + ((Logger) LoggerFactory.getLogger("org.hibernate.stat")).setLevel(Level.OFF); + + entityManagerFactory = Persistence.createEntityManagerFactory("com.baeldung.hibernate.entitymanager.game_player_postgresql"); + } + + private void runInTransaction(Runnable task) { + // We create new persistence context for each test method to discard Hibernate first level cache. + // So that we can see the behavior of getReference() method in a non-cached environment. + entityManager = entityManagerFactory.createEntityManager(); + entityManager.getTransaction().begin(); + task.run(); + entityManager.getTransaction().commit(); + // In any case, we use clear() and close() to make all the managed entities detached and cleared. + // So, we can be sure we test always on a clear persistence context. + entityManager.clear(); + entityManager.close(); + } + + @BeforeEach + public void beforeEach() { + // stubbing System.out printStream + output = new ByteArrayOutputStream(); + System.setOut(new PrintStream(output)); + } + + @AfterEach + public void afterEach() { + System.setOut(SystemOut); + // we print to see original output after each test method + System.out.print(output.toString()); + } + + @AfterAll + public static void tearDown() { + entityManagerFactory.close(); + } + + @Test + public void whenUsingFindMethodToUpdateGame_thenExecutesSelectForGame() { + + runInTransaction(() -> { + Game game1 = entityManager.find(Game.class, 1L); + game1.setName("Game Updated 1"); + + entityManager.persist(game1); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select game0_.id as id1_0_0_, game0_.name as name2_0_0_ from Game game0_ where game0_.id=?\n"); + expected.append("Hibernate: update Game set name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingGetReferenceMethodToUpdateGame_thenExecutesSelectForGame() { + + runInTransaction(() -> { + Game game1 = entityManager.getReference(Game.class, 1L); + game1.setName("Game Updated 2"); + + entityManager.persist(game1); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select game0_.id as id1_0_0_, game0_.name as name2_0_0_ from Game game0_ where game0_.id=?\n"); + expected.append("Hibernate: update Game set name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingFindMethodToDeletePlayer_thenExecutesSelectForPlayer() { + + runInTransaction(() -> { + Player player2 = entityManager.find(Player.class, 2L); + entityManager.remove(player2); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: delete from Player where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingGetReferenceMethodToDeletePlayer_thenExecutesSelectForPlayer() { + + runInTransaction(() -> { + Player player3 = entityManager.getReference(Player.class, 3L); + entityManager.remove(player3); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: delete from Player where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingFindMethodToUpdatePlayersGame_thenExecutesSelectForGame() { + + runInTransaction((() -> { + Game game1 = entityManager.find(Game.class, 1L); + + Player player1 = entityManager.find(Player.class, 1L); + player1.setGame(game1); + + entityManager.persist(player1); + })); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select game0_.id as id1_0_0_, game0_.name as name2_0_0_ from Game game0_ where game0_.id=?\n"); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: update Player set game_id=?, name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + + @Test + public void whenUsingGetReferenceMethodToUpdatePlayersGame_thenDoesNotExecuteSelectForGame() { + + runInTransaction(() -> { + Game game2 = entityManager.getReference(Game.class, 2L); + + Player player1 = entityManager.find(Player.class, 1L); + player1.setGame(game2); + + entityManager.persist(player1); + }); + + StringBuilder expected = new StringBuilder(); + expected.append("Hibernate: select "); + expected.append("player0_.id as id1_1_0_, player0_.game_id as game_id3_1_0_, "); + expected.append("player0_.name as name2_1_0_, game1_.id as id1_0_1_, game1_.name as name2_0_1_ "); + expected.append("from Player player0_ left outer join Game game1_ on player0_.game_id=game1_.id where player0_.id=?\n"); + expected.append("Hibernate: update Player set game_id=?, name=? where id=?\n"); + + assertEquals(expected.toString(), output.toString()); + } + +} From 32ff2077a37ab1bea794aaca9eb9a3f566e055c9 Mon Sep 17 00:00:00 2001 From: Graham Cox Date: Thu, 26 Mar 2020 04:31:54 +0000 Subject: [PATCH 112/130] Examples for collection transformations in Kotlin (#8912) --- .../transformations/AssociateUnitTest.kt | 48 +++++++++++++++++ .../transformations/FilterUnitTest.kt | 43 +++++++++++++++ .../transformations/FlattenUnitTest.kt | 21 ++++++++ .../transformations/JoinToUnitTest.kt | 46 ++++++++++++++++ .../transformations/MapUnitTest.kt | 53 +++++++++++++++++++ .../transformations/ReduceUnitTest.kt | 22 ++++++++ .../transformations/ZipUnitTest.kt | 34 ++++++++++++ 7 files changed, 267 insertions(+) create mode 100644 core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/AssociateUnitTest.kt create mode 100644 core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/FilterUnitTest.kt create mode 100644 core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/FlattenUnitTest.kt create mode 100644 core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/JoinToUnitTest.kt create mode 100644 core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/MapUnitTest.kt create mode 100644 core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/ReduceUnitTest.kt create mode 100644 core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/ZipUnitTest.kt diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/AssociateUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/AssociateUnitTest.kt new file mode 100644 index 0000000000..68f7040c4c --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/AssociateUnitTest.kt @@ -0,0 +1,48 @@ +package com.baeldung.collections.transformations + +import org.junit.Assert.assertEquals +import org.junit.Test + +class AssociateUnitTest { + @Test + fun testToMap() { + val input = listOf(Pair("one", 1), Pair("two", 2)) + val map = input.toMap() + assertEquals(mapOf("one" to 1, "two" to 2), map) + } + + @Test + fun testAssociateWith() { + val inputs = listOf("Hi", "there") + val map = inputs.associateWith { k -> k.length } + assertEquals(mapOf("Hi" to 2, "there" to 5), map) + } + + @Test + fun testAssociateBy() { + val inputs = listOf("Hi", "there") + val map = inputs.associateBy { v -> v.length } + assertEquals(mapOf(2 to "Hi", 5 to "there"), map) + } + + @Test + fun testAssociate() { + val inputs = listOf("Hi", "there") + val map = inputs.associate { e -> Pair(e.toUpperCase(), e.reversed()) } + assertEquals(mapOf("HI" to "iH", "THERE" to "ereht"), map) + } + + @Test + fun testAssociateByDuplicateKeys() { + val inputs = listOf("one", "two") + val map = inputs.associateBy { v -> v.length } + assertEquals(mapOf(3 to "two"), map) + } + + @Test + fun testGroupBy() { + val inputs = listOf("one", "two", "three") + val map = inputs.groupBy { v -> v.length } + assertEquals(mapOf(3 to listOf("one", "two"), 5 to listOf("three")), map) + } +} \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/FilterUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/FilterUnitTest.kt new file mode 100644 index 0000000000..591577e4f3 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/FilterUnitTest.kt @@ -0,0 +1,43 @@ +package com.baeldung.collections.transformations + +import org.junit.Assert.assertEquals +import org.junit.Test + +class FilterUnitTest { + @Test + fun testFilterWithLambda() { + val input = listOf(1, 2, 3, 4, 5) + val filtered = input.filter { it <= 3 } + assertEquals(listOf(1, 2, 3), filtered) + } + + @Test + fun testFilterWithMethodReference() { + val input = listOf(1, 2, 3, 4, 5) + val filtered = input.filter(this::isSmall) + assertEquals(listOf(1, 2, 3), filtered) + } + + @Test + fun testFilterNotWithMethodReference() { + val input = listOf(1, 2, 3, 4, 5) + val filtered = input.filterNot(this::isSmall) + assertEquals(listOf(4, 5), filtered) + } + + @Test + fun testFilterIndexed() { + val input = listOf(5, 4, 3, 2, 1) + val filtered = input.filterIndexed { index, element -> index < 3 } + assertEquals(listOf(5, 4, 3), filtered) + } + + @Test + fun testFilterNotNull() { + val nullable: List = listOf("Hello", null, "World") + val nonnull: List = nullable.filterNotNull() + assertEquals(listOf("Hello", "World"), nonnull) + } + + private fun isSmall(i: Int) = i <= 3 +} \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/FlattenUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/FlattenUnitTest.kt new file mode 100644 index 0000000000..69fbceb8e3 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/FlattenUnitTest.kt @@ -0,0 +1,21 @@ +package com.baeldung.collections.transformations + +import org.junit.Assert.assertEquals +import org.junit.Test + +class FlattenUnitTest { + @Test + fun testFlatten() { + val inputs = listOf("one", "two", "three") + val characters = inputs.map(String::toList) + val flattened = characters.flatten(); + assertEquals(listOf('o', 'n', 'e', 't', 'w', 'o', 't', 'h', 'r', 'e', 'e'), flattened) + } + + @Test + fun testFlatMap() { + val inputs = listOf("one", "two", "three") + val characters = inputs.flatMap(String::toList) + assertEquals(listOf('o', 'n', 'e', 't', 'w', 'o', 't', 'h', 'r', 'e', 'e'), characters) + } +} \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/JoinToUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/JoinToUnitTest.kt new file mode 100644 index 0000000000..2ac0cdca50 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/JoinToUnitTest.kt @@ -0,0 +1,46 @@ +package com.baeldung.collections.transformations + +import org.junit.Assert.assertEquals +import org.junit.Test + +class JoinToUnitTest { + @Test + fun testJoinToString() { + val inputs = listOf("Jan", "Feb", "Mar", "Apr", "May") + + val simpleString = inputs.joinToString() + assertEquals("Jan, Feb, Mar, Apr, May", simpleString) + + val detailedString = inputs.joinToString(separator = ",", prefix="Months: ", postfix=".") + assertEquals("Months: Jan,Feb,Mar,Apr,May.", detailedString) + } + + @Test + fun testJoinToStringLimits() { + val inputs = listOf("Jan", "Feb", "Mar", "Apr", "May") + + val simpleString = inputs.joinToString(limit = 3) + assertEquals("Jan, Feb, Mar, ...", simpleString) + } + + @Test + fun testJoinToStringTransform() { + val inputs = listOf("Jan", "Feb", "Mar", "Apr", "May") + + val simpleString = inputs.joinToString(transform = String::toUpperCase) + assertEquals("JAN, FEB, MAR, APR, MAY", simpleString) + } + + @Test + fun testJoinTo() { + val inputs = listOf("Jan", "Feb", "Mar", "Apr", "May") + + val output = StringBuilder() + output.append("My ") + .append(inputs.size) + .append(" elements: ") + inputs.joinTo(output) + + assertEquals("My 5 elements: Jan, Feb, Mar, Apr, May", output.toString()) + } +} \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/MapUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/MapUnitTest.kt new file mode 100644 index 0000000000..e22fcbe903 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/MapUnitTest.kt @@ -0,0 +1,53 @@ +package com.baeldung.collections.transformations + +import org.junit.Assert.assertEquals +import org.junit.Test + +class MapUnitTest { + @Test + fun testMapWithLambda() { + val input = listOf("one", "two", "three") + + val reversed = input.map { it.reversed() } + assertEquals(listOf("eno", "owt", "eerht"), reversed) + + val lengths = input.map { it.length } + assertEquals(listOf(3, 3, 5), lengths) + } + + @Test + fun testMapIndexed() { + val input = listOf(3, 2, 1) + val result = input.mapIndexed { index, value -> index * value } + assertEquals(listOf(0, 2, 2), result) + } + + @Test + fun testMapNotNull() { + val input = listOf(1, 2, 3, 4, 5) + val smallSquares = input.mapNotNull { + if (it <= 3) { + it * it + } else { + null + } + } + assertEquals(listOf(1, 4, 9), smallSquares) + } + + @Test + fun mapMapKeys() { + val inputs = mapOf("one" to 1, "two" to 2, "three" to 3) + + val uppercases = inputs.mapKeys { it.key.toUpperCase() } + assertEquals(mapOf("ONE" to 1, "TWO" to 2, "THREE" to 3), uppercases) + } + + @Test + fun mapMapValues() { + val inputs = mapOf("one" to 1, "two" to 2, "three" to 3) + + val squares = inputs.mapValues { it.value * it.value } + assertEquals(mapOf("one" to 1, "two" to 4, "three" to 9), squares) + } +} \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/ReduceUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/ReduceUnitTest.kt new file mode 100644 index 0000000000..6821b7cdb9 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/ReduceUnitTest.kt @@ -0,0 +1,22 @@ +package com.baeldung.collections.transformations + +import org.junit.Assert.assertEquals +import org.junit.Test + +class ReduceUnitTest { + @Test + fun testJoinToStringAsReduce() { + val inputs = listOf("Jan", "Feb", "Mar", "Apr", "May") + + val result = inputs.reduce { acc, next -> "$acc, $next" } + assertEquals("Jan, Feb, Mar, Apr, May", result) + } + + @Test + fun testFoldToLength() { + val inputs = listOf("Jan", "Feb", "Mar", "Apr", "May") + + val result = inputs.fold(0) { acc, next -> acc + next.length } + assertEquals(15, result) + } +} \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/ZipUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/ZipUnitTest.kt new file mode 100644 index 0000000000..66aeeceef4 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/transformations/ZipUnitTest.kt @@ -0,0 +1,34 @@ +package com.baeldung.collections.transformations + +import org.junit.Assert.assertEquals +import org.junit.Test + +class ZipUnitTest { + @Test + fun testZip() { + val left = listOf("one", "two", "three") + val right = listOf(1, 2, 3) + val zipped = left.zip(right) + assertEquals (listOf(Pair("one", 1), Pair("two", 2), Pair("three", 3)), zipped) + } + + @Test + fun testZipShort() { + val left = listOf("one", "two") + val right = listOf(1, 2, 3) + val zipped = left.zip(right) + assertEquals (listOf(Pair("one", 1), Pair("two", 2)), zipped) + } + + @Test + fun testUnzip() { + val left = listOf("one", "two", "three") + val right = listOf(1, 2, 3) + val zipped = left.zip(right) + + val (newLeft, newRight) = zipped.unzip() + assertEquals(left, newLeft) + assertEquals(right, newRight) + } + +} \ No newline at end of file From 2adb66df0c2fba69e84e0f8dcaa4b0993aa5de94 Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 26 Mar 2020 16:02:49 +0800 Subject: [PATCH 113/130] Update README.md --- java-math-2/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/java-math-2/README.md b/java-math-2/README.md index 7c459cc576..8b13789179 100644 --- a/java-math-2/README.md +++ b/java-math-2/README.md @@ -1,3 +1 @@ -## Java Math -This module contains articles about math in Java. From 2f0fbac05e43d5ad00283998e62f0159a32719ec Mon Sep 17 00:00:00 2001 From: johnA1331 <53036378+johnA1331@users.noreply.github.com> Date: Thu, 26 Mar 2020 16:03:01 +0800 Subject: [PATCH 114/130] Delete README.md --- java-math-2/README.md | 1 - 1 file changed, 1 deletion(-) delete mode 100644 java-math-2/README.md diff --git a/java-math-2/README.md b/java-math-2/README.md deleted file mode 100644 index 8b13789179..0000000000 --- a/java-math-2/README.md +++ /dev/null @@ -1 +0,0 @@ - From 071a86a22358e40c03e17202ecb6e9cc104a78c0 Mon Sep 17 00:00:00 2001 From: Krzysztof Woyke Date: Thu, 26 Mar 2020 15:12:26 +0100 Subject: [PATCH 115/130] JAVA-1098: Add code for the Spring Boot Exit Codes --- .../spring-boot-basic-customization/README.md | 1 + .../event/ExitCodeEventDemoApplication.java | 31 +++++++++++++++++++ ...xitCodeExceptionMapperDemoApplication.java | 31 +++++++++++++++++++ .../ExitCodeGeneratorDemoApplication.java | 22 +++++++++++++ spring-boot-modules/spring-boot/README.MD | 1 - 5 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/event/ExitCodeEventDemoApplication.java create mode 100644 spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exception/ExitCodeExceptionMapperDemoApplication.java create mode 100644 spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/generator/ExitCodeGeneratorDemoApplication.java diff --git a/spring-boot-modules/spring-boot-basic-customization/README.md b/spring-boot-modules/spring-boot-basic-customization/README.md index a3d9f1b1fc..6c067fc5a1 100644 --- a/spring-boot-modules/spring-boot-basic-customization/README.md +++ b/spring-boot-modules/spring-boot-basic-customization/README.md @@ -11,3 +11,4 @@ This module contains articles about Spring Boot customization - [Spring Boot: Configuring a Main Class](https://www.baeldung.com/spring-boot-main-class) - [How to Define a Spring Boot Filter?](https://www.baeldung.com/spring-boot-add-filter) - [Guide to the Favicon in Spring Boot](https://www.baeldung.com/spring-boot-favicon) + - [Spring Boot Exit Codes](https://www.baeldung.com/spring-boot-exit-codes) diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/event/ExitCodeEventDemoApplication.java b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/event/ExitCodeEventDemoApplication.java new file mode 100644 index 0000000000..c28f908fb8 --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/event/ExitCodeEventDemoApplication.java @@ -0,0 +1,31 @@ +package com.baeldung.exitcode.event; + +import org.springframework.boot.ExitCodeEvent; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.event.EventListener; + +@SpringBootApplication +public class ExitCodeEventDemoApplication { + + public static void main(String[] args) { + System.exit( + SpringApplication.exit( + SpringApplication.run(ExitCodeEventDemoApplication.class, args) + ) + ); + } + + @Bean + DemoListener demoListenerBean() { + return new DemoListener(); + } + + private static class DemoListener { + @EventListener + public void exitEvent(ExitCodeEvent event) { + System.out.println("Exit code: " + event.getExitCode()); + } + } +} diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exception/ExitCodeExceptionMapperDemoApplication.java b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exception/ExitCodeExceptionMapperDemoApplication.java new file mode 100644 index 0000000000..44b4ff36f5 --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/exception/ExitCodeExceptionMapperDemoApplication.java @@ -0,0 +1,31 @@ +package com.baeldung.exitcode.exception; + +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.ExitCodeExceptionMapper; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; + +@SpringBootApplication +public class ExitCodeExceptionMapperDemoApplication { + + public static void main(String[] args) { + SpringApplication.run(ExitCodeExceptionMapperDemoApplication.class, args); + } + + @Bean + CommandLineRunner createException() { + return args -> Integer.parseInt("test"); + } + + @Bean + ExitCodeExceptionMapper exitCodeToExceptionMapper() { + return exception -> { + // set exit code based on the exception type + if (exception.getCause() instanceof NumberFormatException) { + return 80; + } + return 1; + }; + } +} diff --git a/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/generator/ExitCodeGeneratorDemoApplication.java b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/generator/ExitCodeGeneratorDemoApplication.java new file mode 100644 index 0000000000..7f7acbe86e --- /dev/null +++ b/spring-boot-modules/spring-boot-basic-customization/src/main/java/com/baeldung/exitcode/generator/ExitCodeGeneratorDemoApplication.java @@ -0,0 +1,22 @@ +package com.baeldung.exitcode.generator; + +import org.springframework.boot.ExitCodeGenerator; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ExitCodeGeneratorDemoApplication implements ExitCodeGenerator { + + public static void main(String[] args) { + System.exit( + SpringApplication.exit( + SpringApplication.run(ExitCodeGeneratorDemoApplication.class, args) + ) + ); + } + + @Override + public int getExitCode() { + return 42; + } +} diff --git a/spring-boot-modules/spring-boot/README.MD b/spring-boot-modules/spring-boot/README.MD index b15ab7dbe5..c95fe51842 100644 --- a/spring-boot-modules/spring-boot/README.MD +++ b/spring-boot-modules/spring-boot/README.MD @@ -22,7 +22,6 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [An Introduction to Kong](https://www.baeldung.com/kong) - [Spring Boot: Configuring a Main Class](https://www.baeldung.com/spring-boot-main-class) - [A Quick Intro to the SpringBootServletInitializer](https://www.baeldung.com/spring-boot-servlet-initializer) -- [Guide to the Favicon in Spring Boot](https://www.baeldung.com/spring-boot-favicon) - [Spring Shutdown Callbacks](https://www.baeldung.com/spring-shutdown-callbacks) - [Container Configuration in Spring Boot 2](https://www.baeldung.com/embeddedservletcontainercustomizer-configurableembeddedservletcontainer-spring-boot) - [Validation in Spring Boot](https://www.baeldung.com/spring-boot-bean-validation) From f03374a805a914dc80da93af1fde0c09e63e8dae Mon Sep 17 00:00:00 2001 From: Konstantinos Karavitis Date: Thu, 26 Mar 2020 19:57:09 +0200 Subject: [PATCH 116/130] [BAEL-3913] Prevent Application / CommandLineRunner classes from executing during JUnit testing (#8920) * kkaravitis@gmail.com hexagonal architecture in java * Removed evaluation article code * Removed evaluation article code * [BAEL-3913] Initial commit for prevent commandline application runner execution during JUnit test article * [BAEL-3913] Fixed broken lines format and reduced the test method names length * [BAEL-3913] Fixed broken lines format --- .../spring-boot-testing/README.md | 1 + .../ApplicationCommandLineRunnerApp.java | 11 +++++ .../ApplicationRunnerTaskExecutor.java | 27 ++++++++++++ .../execution/CommandLineTaskExecutor.java | 26 +++++++++++ .../runner/execution/TaskService.java | 14 ++++++ .../LoadSpringContextIntegrationTest.java | 43 +++++++++++++++++++ .../RunApplicationIntegrationTest.java | 26 +++++++++++ ...icationWithTestProfileIntegrationTest.java | 33 ++++++++++++++ ...tionWithTestPropertiesIntegrationTest.java | 32 ++++++++++++++ 9 files changed, 213 insertions(+) create mode 100644 spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationCommandLineRunnerApp.java create mode 100644 spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationRunnerTaskExecutor.java create mode 100644 spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/CommandLineTaskExecutor.java create mode 100644 spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/TaskService.java create mode 100644 spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/LoadSpringContextIntegrationTest.java create mode 100644 spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationIntegrationTest.java create mode 100644 spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationWithTestProfileIntegrationTest.java create mode 100644 spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationWithTestPropertiesIntegrationTest.java diff --git a/spring-boot-modules/spring-boot-testing/README.md b/spring-boot-modules/spring-boot-testing/README.md index 882e2be766..9bbaf337d7 100644 --- a/spring-boot-modules/spring-boot-testing/README.md +++ b/spring-boot-modules/spring-boot-testing/README.md @@ -13,3 +13,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Setting the Log Level in Spring Boot when Testing](https://www.baeldung.com/spring-boot-testing-log-level) - [Embedded Redis Server with Spring Boot Test](https://www.baeldung.com/spring-embedded-redis) - [Testing Spring Boot @ConfigurationProperties](https://www.baeldung.com/spring-boot-testing-configurationproperties) +- [Prevent ApplicationRunner or CommandLineRunner Beans From Executing During Junit Testing]() diff --git a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationCommandLineRunnerApp.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationCommandLineRunnerApp.java new file mode 100644 index 0000000000..76e18dfd2f --- /dev/null +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationCommandLineRunnerApp.java @@ -0,0 +1,11 @@ +package com.baeldung.prevent.commandline.application.runner.execution; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ApplicationCommandLineRunnerApp { + public static void main(String[] args) { + SpringApplication.run(ApplicationCommandLineRunnerApp.class, args); + } +} diff --git a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationRunnerTaskExecutor.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationRunnerTaskExecutor.java new file mode 100644 index 0000000000..3bf08491bf --- /dev/null +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/ApplicationRunnerTaskExecutor.java @@ -0,0 +1,27 @@ +package com.baeldung.prevent.commandline.application.runner.execution; + +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; + +@Profile("!test") +@ConditionalOnProperty( + prefix = "application.runner", + value = "enabled", + havingValue = "true", + matchIfMissing = true) +@Component +public class ApplicationRunnerTaskExecutor implements ApplicationRunner { + private TaskService taskService; + + public ApplicationRunnerTaskExecutor(TaskService taskService) { + this.taskService = taskService; + } + + @Override + public void run(ApplicationArguments args) throws Exception { + taskService.execute("application runner task"); + } +} diff --git a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/CommandLineTaskExecutor.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/CommandLineTaskExecutor.java new file mode 100644 index 0000000000..38fd3b9c0a --- /dev/null +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/CommandLineTaskExecutor.java @@ -0,0 +1,26 @@ +package com.baeldung.prevent.commandline.application.runner.execution; + +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; + +@Profile("!test") +@ConditionalOnProperty( + prefix = "command.line.runner", + value = "enabled", + havingValue = "true", + matchIfMissing = true) +@Component +public class CommandLineTaskExecutor implements CommandLineRunner { + private TaskService taskService; + + public CommandLineTaskExecutor(TaskService taskService) { + this.taskService = taskService; + } + + @Override + public void run(String... args) throws Exception { + taskService.execute("command line runner task"); + } +} diff --git a/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/TaskService.java b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/TaskService.java new file mode 100644 index 0000000000..dac437e72d --- /dev/null +++ b/spring-boot-modules/spring-boot-testing/src/main/java/com/baeldung/prevent/commandline/application/runner/execution/TaskService.java @@ -0,0 +1,14 @@ +package com.baeldung.prevent.commandline.application.runner.execution; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +@Service +public class TaskService { + private static Logger logger = LoggerFactory.getLogger(TaskService.class); + + public void execute(String task) { + logger.info("do " + task); + } +} diff --git a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/LoadSpringContextIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/LoadSpringContextIntegrationTest.java new file mode 100644 index 0000000000..6698094550 --- /dev/null +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/LoadSpringContextIntegrationTest.java @@ -0,0 +1,43 @@ +package com.baeldung.prevent.commandline.application.runner.execution; + +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.boot.ApplicationRunner; +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer; +import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +import com.baeldung.prevent.commandline.application.runner.execution.ApplicationCommandLineRunnerApp; +import com.baeldung.prevent.commandline.application.runner.execution.TaskService; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +@ExtendWith(SpringExtension.class) +@ContextConfiguration(classes = { ApplicationCommandLineRunnerApp.class }, + initializers = ConfigFileApplicationContextInitializer.class) +public class LoadSpringContextIntegrationTest { + @SpyBean + TaskService taskService; + + @SpyBean + CommandLineRunner commandLineRunner; + + @SpyBean + ApplicationRunner applicationRunner; + + @Test + void whenContextLoads_thenRunnersDoNotRun() throws Exception { + assertNotNull(taskService); + assertNotNull(commandLineRunner); + assertNotNull(applicationRunner); + + verify(taskService, times(0)).execute(any()); + verify(commandLineRunner, times(0)).run(any()); + verify(applicationRunner, times(0)).run(any()); + } +} diff --git a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationIntegrationTest.java new file mode 100644 index 0000000000..26a7339f1d --- /dev/null +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationIntegrationTest.java @@ -0,0 +1,26 @@ +package com.baeldung.prevent.commandline.application.runner.execution; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.SpyBean; + +import com.baeldung.prevent.commandline.application.runner.execution.ApplicationRunnerTaskExecutor; +import com.baeldung.prevent.commandline.application.runner.execution.CommandLineTaskExecutor; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +@SpringBootTest +class RunApplicationIntegrationTest { + @SpyBean + ApplicationRunnerTaskExecutor applicationRunnerTaskExecutor; + @SpyBean + CommandLineTaskExecutor commandLineTaskExecutor; + + @Test + void whenContextLoads_thenRunnersRun() throws Exception { + verify(applicationRunnerTaskExecutor, times(1)).run(any()); + verify(commandLineTaskExecutor, times(1)).run(any()); + } +} diff --git a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationWithTestProfileIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationWithTestProfileIntegrationTest.java new file mode 100644 index 0000000000..333cd2ab91 --- /dev/null +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationWithTestProfileIntegrationTest.java @@ -0,0 +1,33 @@ +package com.baeldung.prevent.commandline.application.runner.execution; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; +import org.springframework.test.context.ActiveProfiles; + +import com.baeldung.prevent.commandline.application.runner.execution.ApplicationRunnerTaskExecutor; +import com.baeldung.prevent.commandline.application.runner.execution.CommandLineTaskExecutor; +import com.baeldung.prevent.commandline.application.runner.execution.TaskService; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; + +@ActiveProfiles("test") +@SpringBootTest +class RunApplicationWithTestProfileIntegrationTest { + @Autowired + private ApplicationContext context; + + @Test + void whenContextLoads_thenRunnersAreNotLoaded() { + assertNotNull(context.getBean(TaskService.class)); + assertThrows(NoSuchBeanDefinitionException.class, + () -> context.getBean(CommandLineTaskExecutor.class), + "CommandLineRunner should not be loaded during this integration test"); + assertThrows(NoSuchBeanDefinitionException.class, + () -> context.getBean(ApplicationRunnerTaskExecutor.class), + "ApplicationRunner should not be loaded during this integration test"); + } +} diff --git a/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationWithTestPropertiesIntegrationTest.java b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationWithTestPropertiesIntegrationTest.java new file mode 100644 index 0000000000..264a06a41e --- /dev/null +++ b/spring-boot-modules/spring-boot-testing/src/test/java/com/baeldung/prevent/commandline/application/runner/execution/RunApplicationWithTestPropertiesIntegrationTest.java @@ -0,0 +1,32 @@ +package com.baeldung.prevent.commandline.application.runner.execution; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; + +import com.baeldung.prevent.commandline.application.runner.execution.ApplicationRunnerTaskExecutor; +import com.baeldung.prevent.commandline.application.runner.execution.CommandLineTaskExecutor; +import com.baeldung.prevent.commandline.application.runner.execution.TaskService; + +@SpringBootTest(properties = { + "command.line.runner.enabled=false", + "application.runner.enabled=false" }) +class RunApplicationWithTestPropertiesIntegrationTest { + @Autowired + private ApplicationContext context; + + @Test + void whenContextLoads_thenRunnersAreNotLoaded() { + assertNotNull(context.getBean(TaskService.class)); + assertThrows(NoSuchBeanDefinitionException.class, + () -> context.getBean(CommandLineTaskExecutor.class), + "CommandLineRunner should not be loaded during this integration test"); + assertThrows(NoSuchBeanDefinitionException.class, + () -> context.getBean(ApplicationRunnerTaskExecutor.class), + "ApplicationRunner should not be loaded during this integration test"); + } +} From c2c26425aa4ed5ea5b17d1f8fd489d1999080471 Mon Sep 17 00:00:00 2001 From: Donato Rimenti Date: Mon, 23 Mar 2020 14:17:54 +0100 Subject: [PATCH 117/130] [JAVA-969] Added JCenter repository for missing springfox dependency --- spring-boot-modules/spring-boot-mvc-2/pom.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-mvc-2/pom.xml b/spring-boot-modules/spring-boot-mvc-2/pom.xml index edebd41986..b6d145c101 100644 --- a/spring-boot-modules/spring-boot-mvc-2/pom.xml +++ b/spring-boot-modules/spring-boot-mvc-2/pom.xml @@ -79,7 +79,11 @@ Spring Milestones https://repo.spring.io/milestone - + + jcenter-snapshots + jcenter + http://oss.jfrog.org/artifactory/oss-snapshot-local/ + From 2ba09756f7fe2efdb8198d4cba4952e1e88a4314 Mon Sep 17 00:00:00 2001 From: Antonio Moreno Date: Tue, 24 Mar 2020 23:43:49 +0000 Subject: [PATCH 118/130] BAEL-3928 Comparing Long values in Java --- .../comparelong/CompareLongUnitTest.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 core-java-modules/core-java-lang-2/src/test/java/com/baeldung/comparelong/CompareLongUnitTest.java diff --git a/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/comparelong/CompareLongUnitTest.java b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/comparelong/CompareLongUnitTest.java new file mode 100644 index 0000000000..ab4ea2b657 --- /dev/null +++ b/core-java-modules/core-java-lang-2/src/test/java/com/baeldung/comparelong/CompareLongUnitTest.java @@ -0,0 +1,53 @@ +package com.baeldung.comparelong; + +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + +public class CompareLongUnitTest { + + @Test + public void givenLongValuesLessThan128_whenUsingReferenceComparater_thenSuccess() { + + Long l1 = 127L; + Long l2 = 127L; + + assertThat(l1 == l2).isTrue(); + } + + @Test + public void givenLongValuesGreaterOrEqualsThan128_whenUsingReferenceComparater_thenFails() { + + Long l1 = 128L; + Long l2 = 128L; + + assertThat(l1 == l2).isFalse(); + } + + @Test + public void givenLongValuesGreaterOrEqualsThan128_whenUsingEquals_thenSuccess() { + + Long l1 = 128L; + Long l2 = 128L; + + assertThat(l1.equals(l2)).isTrue(); + } + + @Test + public void givenLongValuesGreaterOrEqualsThan128_whenUsingComparisonOperator_andLongValue_thenSuccess() { + + Long l1 = 128L; + Long l2 = 128L; + + assertThat(l1.longValue() == l2.longValue()).isTrue(); + } + + @Test + public void givenLongValuesGreaterOrEqualsThan128_whenUsingCasting_thenSuccess() { + + Long l1 = 128L; + Long l2 = 128L; + + assertThat((long) l1 == (long) l2).isTrue(); + } + +} \ No newline at end of file From c6f71e7ac7bae3587fdabcc49329fec817af38e7 Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Thu, 26 Mar 2020 23:00:07 +0100 Subject: [PATCH 119/130] [BAEL-3934]shedlock update --- .../spring-boot-libraries/pom.xml | 8 +++- .../main/java/com/baeldung/Application.java | 15 +++++++ .../java/com/baeldung/boot/Application.java | 14 ------- ...eduler.java => BaeldungTaskScheduler.java} | 5 +-- .../shedlock/SchedulerConfiguration.java | 14 ++++--- .../src/main/resources/application.yml | 6 +++ .../BaeldungTaskSchedulerIntegrationTest.java | 39 +++++++++++++++++++ 7 files changed, 78 insertions(+), 23 deletions(-) create mode 100644 spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/Application.java delete mode 100644 spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/boot/Application.java rename spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/scheduling/shedlock/{TaskScheduler.java => BaeldungTaskScheduler.java} (85%) create mode 100644 spring-boot-modules/spring-boot-libraries/src/main/resources/application.yml create mode 100644 spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/scheduling/shedlock/BaeldungTaskSchedulerIntegrationTest.java diff --git a/spring-boot-modules/spring-boot-libraries/pom.xml b/spring-boot-modules/spring-boot-libraries/pom.xml index e9d955edc0..2b1b1b7d12 100644 --- a/spring-boot-modules/spring-boot-libraries/pom.xml +++ b/spring-boot-modules/spring-boot-libraries/pom.xml @@ -52,7 +52,11 @@ shedlock-provider-jdbc-template ${shedlock.version} - + + com.h2database + h2 + ${h2.version} + net.sourceforge.barbecue @@ -79,6 +83,7 @@ javase ${zxing.version} + @@ -185,6 +190,7 @@ 2.2.4 2.3.2 0.23.0 + 1.4.200 2.1.0 1.5-beta1 2.1 diff --git a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/Application.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/Application.java new file mode 100644 index 0000000000..15422e1065 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/Application.java @@ -0,0 +1,15 @@ +package com.baeldung; + +import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableScheduling; + +@SpringBootApplication +@EnableScheduling +@EnableSchedulerLock(defaultLockAtMostFor = "PT30S") +public class Application { + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/boot/Application.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/boot/Application.java deleted file mode 100644 index cb0d0c1532..0000000000 --- a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/boot/Application.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.boot; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.ApplicationContext; - -@SpringBootApplication -public class Application { - private static ApplicationContext applicationContext; - - public static void main(String[] args) { - applicationContext = SpringApplication.run(Application.class, args); - } -} diff --git a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/scheduling/shedlock/TaskScheduler.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/scheduling/shedlock/BaeldungTaskScheduler.java similarity index 85% rename from spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/scheduling/shedlock/TaskScheduler.java rename to spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/scheduling/shedlock/BaeldungTaskScheduler.java index 060afe660e..cd5f63e962 100644 --- a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/scheduling/shedlock/TaskScheduler.java +++ b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/scheduling/shedlock/BaeldungTaskScheduler.java @@ -5,9 +5,8 @@ import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @Component -class TaskScheduler { - - @Scheduled(cron = "*/15 * * * *") +class BaeldungTaskScheduler { + @Scheduled(cron = "0 0/15 * * * ?") @SchedulerLock(name = "TaskScheduler_scheduledTask", lockAtLeastForString = "PT5M", lockAtMostForString = "PT14M") public void scheduledTask() { System.out.println("Running ShedLock task"); diff --git a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/scheduling/shedlock/SchedulerConfiguration.java b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/scheduling/shedlock/SchedulerConfiguration.java index 74ea39683d..440e1ffc6a 100644 --- a/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/scheduling/shedlock/SchedulerConfiguration.java +++ b/spring-boot-modules/spring-boot-libraries/src/main/java/com/baeldung/scheduling/shedlock/SchedulerConfiguration.java @@ -1,12 +1,16 @@ package com.baeldung.scheduling.shedlock; +import net.javacrumbs.shedlock.core.LockProvider; +import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import net.javacrumbs.shedlock.spring.annotation.EnableSchedulerLock; -import org.springframework.scheduling.annotation.EnableScheduling; + +import javax.sql.DataSource; @Configuration -@EnableScheduling -@EnableSchedulerLock(defaultLockAtMostFor = "PT30S") public class SchedulerConfiguration { - + @Bean + public LockProvider lockProvider(DataSource dataSource) { + return new JdbcTemplateLockProvider(dataSource); + } } \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-libraries/src/main/resources/application.yml b/spring-boot-modules/spring-boot-libraries/src/main/resources/application.yml new file mode 100644 index 0000000000..3477520208 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/main/resources/application.yml @@ -0,0 +1,6 @@ +spring: + datasource: + driverClassName: org.h2.Driver + url: jdbc:h2:mem:shedlock_DB;INIT=CREATE SCHEMA IF NOT EXISTS shedlock;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE + username: sa + password: diff --git a/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/scheduling/shedlock/BaeldungTaskSchedulerIntegrationTest.java b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/scheduling/shedlock/BaeldungTaskSchedulerIntegrationTest.java new file mode 100644 index 0000000000..47f42c133f --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries/src/test/java/com/baeldung/scheduling/shedlock/BaeldungTaskSchedulerIntegrationTest.java @@ -0,0 +1,39 @@ +package com.baeldung.scheduling.shedlock; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import static org.assertj.core.api.Assertions.assertThat; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class BaeldungTaskSchedulerIntegrationTest { + @Autowired + private BaeldungTaskScheduler taskScheduler; + + @Test + public void whenShedLockConfigCorrect_thenSpringCtxtStartsWithoutError() { + // save the old out + PrintStream old = System.out; + + // Create a stream to hold the output for test + ByteArrayOutputStream consoleOutput = new ByteArrayOutputStream(); + PrintStream ps = new PrintStream(consoleOutput); + System.setOut(ps); + //test + taskScheduler.scheduledTask(); + System.out.flush(); + String expected = "Running ShedLock task\n"; + assertThat(consoleOutput.toString()).isEqualTo(expected); + + //restore the old out + System.setOut(old); + } + +} \ No newline at end of file From 1bc12a57df47a42c36097bdbd0cc5247658666b1 Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Sun, 29 Mar 2020 13:16:38 +0430 Subject: [PATCH 120/130] Ignoring a Bad Flaky Test --- .../hibernate/criteria/HibernateCriteriaIntegrationTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java index 31877255b2..7d95e0f342 100644 --- a/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java +++ b/persistence-modules/spring-hibernate-5/src/test/java/com/baeldung/hibernate/criteria/HibernateCriteriaIntegrationTest.java @@ -8,6 +8,7 @@ import java.util.List; import org.hibernate.Session; import org.hibernate.Transaction; +import org.junit.Ignore; import org.junit.Test; import com.baeldung.hibernate.criteria.model.Item; @@ -24,6 +25,7 @@ public class HibernateCriteriaIntegrationTest { final private ApplicationView av = new ApplicationView(); @Test + @Ignore public void testPerformanceOfCriteria() { assertFalse(av.checkIfCriteriaTimeLower()); } From 65e21d3f6a394cbfc34f6c6d8b49d92a02a4aa9e Mon Sep 17 00:00:00 2001 From: Seun Matt Date: Sun, 29 Mar 2020 21:36:54 +0100 Subject: [PATCH 121/130] example code for BAEL-3749 (#8815) * example code for BAEL-3749 * added live test * added live test * improved exception handling in response log filter * propage exception in example code * updated repo with upstream * added example code for BAEL-3293 * updated the example code for BAEL-3749 * updated the example code for BAEL-3749 * updated the example code for BAEL-3749 * updated the example code for BAEL-3749 --- cas/cas-secured-app/pom.xml | 8 +- .../CasSecuredAppApplication.java | 91 ------ .../cassecuredapp/CasSecuredApplication.java | 97 +++++++ .../cassecuredapp/config/SecurityConfig.java | 83 ------ .../config/WebSecurityConfig.java | 79 ++++++ .../controllers/AuthController.java | 29 +- .../controllers/IndexController.java | 8 +- .../controllers/SecuredController.java | 30 ++ .../controllers/SecuredPageController.java | 24 -- .../src/main/resources/application.properties | 3 +- ...CasSecuredApplicationIntegrationTest.java} | 2 +- cas/cas-server/.factorypath | 228 ---------------- cas/cas-server/.gitignore | 7 + cas/cas-server/.mergify.yml | 32 +++ cas/cas-server/.travis.yml | 62 +++++ cas/cas-server/Dockerfile | 40 +++ cas/cas-server/README.md | 151 ++++++---- cas/cas-server/build.cmd | 102 ------- cas/cas-server/build.gradle | 106 +++++++ cas/cas-server/build.sh | 189 ------------- cas/cas-server/docker-build.sh | 10 + cas/cas-server/docker-compose.yml | 7 + cas/cas-server/docker-push.sh | 12 + cas/cas-server/docker-run.sh | 7 + cas/cas-server/etc/cas/config/application.yml | 2 - cas/cas-server/etc/cas/config/cas.properties | 9 +- cas/cas-server/etc/cas/config/log4j2.xml | 120 ++++---- cas/cas-server/etc/cas/saml/.gitkeep | 1 + cas/cas-server/etc/cas/services/.donotdel | 0 cas/cas-server/etc/cas/thekeystore | Bin 0 -> 2266 bytes cas/cas-server/gradle.properties | 28 ++ cas/cas-server/gradle/dockerjib.gradle | 52 ++++ cas/cas-server/gradle/springboot.gradle | 24 ++ cas/cas-server/gradle/tasks.gradle | 258 ++++++++++++++++++ .../gradle/wrapper/gradle-wrapper.properties | 5 + cas/cas-server/gradlew | 188 +++++++++++++ cas/cas-server/gradlew.bat | 100 +++++++ cas/cas-server/maven/maven-wrapper.jar | Bin 71910 -> 0 bytes cas/cas-server/maven/maven-wrapper.properties | 3 - cas/cas-server/mvnw | 234 ---------------- cas/cas-server/mvnw.bat | 174 ------------ cas/cas-server/pom.xml | 208 -------------- cas/cas-server/settings.gradle | 1 + .../src/main/jib/docker/entrypoint.sh | 22 ++ .../src/main/resources/application.properties | 136 +-------- .../src/main/resources/cas.properties | 9 - .../create_test_db_and_users_tbl.sql | 12 +- .../resources/etc/cas/config/application.yml | 2 - .../resources/etc/cas/config/cas.properties | 18 +- .../main/resources/etc/cas/config/log4j2.xml | 117 -------- .../etc/cas/services/casSecuredApp-8900.json | 8 + .../src/main/resources/etc/cas/thekeystore | Bin 2258 -> 2251 bytes .../main/resources/etc/cas/thekeystore.crt | Bin 901 -> 0 bytes cas/cas-server/src/main/resources/log4j2.xml | 117 -------- .../services/casSecuredApp-19991.json | 8 - cas/pom.xml | 23 -- pom.xml | 2 - 57 files changed, 1390 insertions(+), 1898 deletions(-) delete mode 100644 cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredAppApplication.java create mode 100644 cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredApplication.java delete mode 100644 cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/config/SecurityConfig.java create mode 100644 cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/config/WebSecurityConfig.java create mode 100644 cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/SecuredController.java delete mode 100644 cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/SecuredPageController.java rename cas/cas-secured-app/src/test/java/com/baeldung/cassecuredapp/{CasSecuredAppApplicationIntegrationTest.java => CasSecuredApplicationIntegrationTest.java} (84%) delete mode 100644 cas/cas-server/.factorypath mode change 100644 => 100755 cas/cas-server/.gitignore create mode 100644 cas/cas-server/.mergify.yml create mode 100644 cas/cas-server/.travis.yml create mode 100644 cas/cas-server/Dockerfile delete mode 100644 cas/cas-server/build.cmd create mode 100644 cas/cas-server/build.gradle delete mode 100644 cas/cas-server/build.sh create mode 100755 cas/cas-server/docker-build.sh create mode 100644 cas/cas-server/docker-compose.yml create mode 100755 cas/cas-server/docker-push.sh create mode 100755 cas/cas-server/docker-run.sh delete mode 100644 cas/cas-server/etc/cas/config/application.yml create mode 100644 cas/cas-server/etc/cas/saml/.gitkeep create mode 100644 cas/cas-server/etc/cas/services/.donotdel create mode 100644 cas/cas-server/etc/cas/thekeystore create mode 100644 cas/cas-server/gradle.properties create mode 100644 cas/cas-server/gradle/dockerjib.gradle create mode 100644 cas/cas-server/gradle/springboot.gradle create mode 100644 cas/cas-server/gradle/tasks.gradle create mode 100644 cas/cas-server/gradle/wrapper/gradle-wrapper.properties create mode 100755 cas/cas-server/gradlew create mode 100644 cas/cas-server/gradlew.bat delete mode 100644 cas/cas-server/maven/maven-wrapper.jar delete mode 100644 cas/cas-server/maven/maven-wrapper.properties delete mode 100644 cas/cas-server/mvnw delete mode 100644 cas/cas-server/mvnw.bat create mode 100644 cas/cas-server/settings.gradle create mode 100755 cas/cas-server/src/main/jib/docker/entrypoint.sh delete mode 100644 cas/cas-server/src/main/resources/cas.properties delete mode 100644 cas/cas-server/src/main/resources/etc/cas/config/application.yml delete mode 100644 cas/cas-server/src/main/resources/etc/cas/config/log4j2.xml create mode 100644 cas/cas-server/src/main/resources/etc/cas/services/casSecuredApp-8900.json delete mode 100644 cas/cas-server/src/main/resources/etc/cas/thekeystore.crt delete mode 100644 cas/cas-server/src/main/resources/log4j2.xml delete mode 100644 cas/cas-server/src/main/resources/services/casSecuredApp-19991.json diff --git a/cas/cas-secured-app/pom.xml b/cas/cas-secured-app/pom.xml index 8e6f28e3a8..426d65c32b 100644 --- a/cas/cas-secured-app/pom.xml +++ b/cas/cas-secured-app/pom.xml @@ -11,11 +11,15 @@ com.baeldung - parent-boot-1 + parent-boot-2 0.0.1-SNAPSHOT - ../../parent-boot-1 + ../../parent-boot-2 + + 2.2.6.RELEASE + + org.springframework.boot diff --git a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredAppApplication.java b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredAppApplication.java deleted file mode 100644 index 25cbb9bc9b..0000000000 --- a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredAppApplication.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.baeldung.cassecuredapp; - -import org.jasig.cas.client.session.SingleSignOutFilter; -import org.jasig.cas.client.session.SingleSignOutHttpSessionListener; -import org.jasig.cas.client.validation.Cas30ServiceTicketValidator; -import org.jasig.cas.client.validation.TicketValidator; -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Primary; -import org.springframework.context.event.EventListener; -import org.springframework.security.cas.ServiceProperties; -import org.springframework.security.cas.authentication.CasAuthenticationProvider; -import org.springframework.security.cas.web.CasAuthenticationEntryPoint; -import org.springframework.security.core.authority.AuthorityUtils; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.core.userdetails.User; -import org.springframework.security.web.AuthenticationEntryPoint; -import org.springframework.security.web.authentication.logout.LogoutFilter; -import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; - -import javax.servlet.http.HttpSessionEvent; - -@SpringBootApplication -public class CasSecuredAppApplication { - - public static void main(String[] args) { - SpringApplication.run(CasSecuredAppApplication.class, args); - } - - @Bean - public ServiceProperties serviceProperties() { - ServiceProperties serviceProperties = new ServiceProperties(); - serviceProperties.setService("http://localhost:9000/login/cas"); - serviceProperties.setSendRenew(false); - return serviceProperties; - } - - @Bean - @Primary - public AuthenticationEntryPoint authenticationEntryPoint(ServiceProperties sP) { - CasAuthenticationEntryPoint entryPoint = new CasAuthenticationEntryPoint(); - entryPoint.setLoginUrl("https://localhost:6443/cas/login"); - entryPoint.setServiceProperties(sP); - return entryPoint; - } - - @Bean - public TicketValidator ticketValidator() { - return new Cas30ServiceTicketValidator("https://localhost:6443/cas"); - } - - @Bean - public CasAuthenticationProvider casAuthenticationProvider() { - CasAuthenticationProvider provider = new CasAuthenticationProvider(); - provider.setServiceProperties(serviceProperties()); - provider.setTicketValidator(ticketValidator()); - provider.setUserDetailsService((s) -> new User("test@test.com", "smatt", - true, true, true, true, - AuthorityUtils.createAuthorityList("ROLE_ADMIN"))); - provider.setKey("CAS_PROVIDER_LOCALHOST_9000"); - return provider; - } - - - @Bean - public SecurityContextLogoutHandler securityContextLogoutHandler() { - return new SecurityContextLogoutHandler(); - } - - @Bean - public LogoutFilter logoutFilter() { - LogoutFilter logoutFilter = new LogoutFilter( - "https://localhost:6443/cas/logout", securityContextLogoutHandler()); - logoutFilter.setFilterProcessesUrl("/logout/cas"); - return logoutFilter; - } - - @Bean - public SingleSignOutFilter singleSignOutFilter() { - SingleSignOutFilter singleSignOutFilter = new SingleSignOutFilter(); - singleSignOutFilter.setCasServerUrlPrefix("https://localhost:6443/cas"); - singleSignOutFilter.setIgnoreInitConfiguration(true); - return singleSignOutFilter; - } - - @EventListener - public SingleSignOutHttpSessionListener singleSignOutHttpSessionListener(HttpSessionEvent event) { - return new SingleSignOutHttpSessionListener(); - } -} diff --git a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredApplication.java b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredApplication.java new file mode 100644 index 0000000000..4a2c609758 --- /dev/null +++ b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/CasSecuredApplication.java @@ -0,0 +1,97 @@ +package com.baeldung.cassecuredapp; + +import org.jasig.cas.client.session.SingleSignOutFilter; +import org.jasig.cas.client.session.SingleSignOutHttpSessionListener; +import org.jasig.cas.client.validation.Cas30ServiceTicketValidator; +import org.jasig.cas.client.validation.TicketValidator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; +import org.springframework.context.event.EventListener; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.cas.ServiceProperties; +import org.springframework.security.cas.authentication.CasAuthenticationProvider; +import org.springframework.security.cas.web.CasAuthenticationEntryPoint; +import org.springframework.security.cas.web.CasAuthenticationFilter; +import org.springframework.security.core.authority.AuthorityUtils; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; +import org.springframework.security.web.authentication.logout.LogoutFilter; +import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; + +import javax.servlet.http.HttpSessionEvent; + +@SpringBootApplication +public class CasSecuredApplication { + + private static final Logger logger = LoggerFactory.getLogger(CasSecuredApplication.class); + + public static void main(String... args) { + SpringApplication.run(CasSecuredApplication.class, args); + } + + @Bean + public CasAuthenticationFilter casAuthenticationFilter( + AuthenticationManager authenticationManager, + ServiceProperties serviceProperties) throws Exception { + CasAuthenticationFilter filter = new CasAuthenticationFilter(); + filter.setAuthenticationManager(authenticationManager); + filter.setServiceProperties(serviceProperties); + return filter; + } + + @Bean + public ServiceProperties serviceProperties() { + logger.info("service properties"); + ServiceProperties serviceProperties = new ServiceProperties(); + serviceProperties.setService("http://cas-client:8900/login/cas"); + serviceProperties.setSendRenew(false); + return serviceProperties; + } + + @Bean + public TicketValidator ticketValidator() { + return new Cas30ServiceTicketValidator("https://localhost:8443"); + } + + @Bean + public CasAuthenticationProvider casAuthenticationProvider( + TicketValidator ticketValidator, + ServiceProperties serviceProperties) { + CasAuthenticationProvider provider = new CasAuthenticationProvider(); + provider.setServiceProperties(serviceProperties); + provider.setTicketValidator(ticketValidator); + provider.setUserDetailsService( + s -> new User("test@test.com", "Mellon", true, true, true, true, + AuthorityUtils.createAuthorityList("ROLE_ADMIN"))); + provider.setKey("CAS_PROVIDER_LOCALHOST_8900"); + return provider; + } + + + @Bean + public SecurityContextLogoutHandler securityContextLogoutHandler() { + return new SecurityContextLogoutHandler(); + } + + @Bean + public LogoutFilter logoutFilter() { + LogoutFilter logoutFilter = new LogoutFilter("https://localhost:8443/logout", securityContextLogoutHandler()); + logoutFilter.setFilterProcessesUrl("/logout/cas"); + return logoutFilter; + } + + @Bean + public SingleSignOutFilter singleSignOutFilter() { + SingleSignOutFilter singleSignOutFilter = new SingleSignOutFilter(); + singleSignOutFilter.setCasServerUrlPrefix("https://localhost:8443"); + singleSignOutFilter.setLogoutCallbackPath("/exit/cas"); + singleSignOutFilter.setIgnoreInitConfiguration(true); + return singleSignOutFilter; + } + +} diff --git a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/config/SecurityConfig.java b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/config/SecurityConfig.java deleted file mode 100644 index 2eabed49e1..0000000000 --- a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/config/SecurityConfig.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.baeldung.cassecuredapp.config; - -import org.jasig.cas.client.session.SingleSignOutFilter; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.authentication.AuthenticationProvider; -import org.springframework.security.authentication.ProviderManager; -import org.springframework.security.cas.ServiceProperties; -import org.springframework.security.cas.authentication.CasAuthenticationProvider; -import org.springframework.security.cas.web.CasAuthenticationFilter; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.web.AuthenticationEntryPoint; -import org.springframework.security.web.authentication.logout.LogoutFilter; - -import java.util.Arrays; - -@EnableWebSecurity -@Configuration -public class SecurityConfig extends WebSecurityConfigurerAdapter { - - private AuthenticationProvider authenticationProvider; - private AuthenticationEntryPoint authenticationEntryPoint; - private SingleSignOutFilter singleSignOutFilter; - private LogoutFilter logoutFilter; - - @Autowired - public SecurityConfig(CasAuthenticationProvider casAuthenticationProvider, AuthenticationEntryPoint eP, - LogoutFilter lF - , SingleSignOutFilter ssF - ) { - this.authenticationProvider = casAuthenticationProvider; - this.authenticationEntryPoint = eP; - - this.logoutFilter = lF; - this.singleSignOutFilter = ssF; - - } - - @Override - protected void configure(HttpSecurity http) throws Exception { - http - .authorizeRequests() - .regexMatchers("/secured.*", "/login") - .authenticated() - .and() - .authorizeRequests() - .regexMatchers("/") - .permitAll() - .and() - .httpBasic() - .authenticationEntryPoint(authenticationEntryPoint) - .and() - .logout().logoutSuccessUrl("/logout") - .and() - .addFilterBefore(singleSignOutFilter, CasAuthenticationFilter.class) - .addFilterBefore(logoutFilter, LogoutFilter.class); - - } - - @Override - protected void configure(AuthenticationManagerBuilder auth) throws Exception { - auth.authenticationProvider(authenticationProvider); - } - - @Override - protected AuthenticationManager authenticationManager() throws Exception { - return new ProviderManager(Arrays.asList(authenticationProvider)); - } - - @Bean - public CasAuthenticationFilter casAuthenticationFilter(ServiceProperties sP) throws Exception { - CasAuthenticationFilter filter = new CasAuthenticationFilter(); - filter.setServiceProperties(sP); - filter.setAuthenticationManager(authenticationManager()); - return filter; - } - -} diff --git a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/config/WebSecurityConfig.java b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/config/WebSecurityConfig.java new file mode 100644 index 0000000000..b0c3c68387 --- /dev/null +++ b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/config/WebSecurityConfig.java @@ -0,0 +1,79 @@ +package com.baeldung.cassecuredapp.config; + +import org.jasig.cas.client.session.SingleSignOutFilter; +import org.jasig.cas.client.validation.Cas30ServiceTicketValidator; +import org.jasig.cas.client.validation.TicketValidator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; +import org.springframework.security.authentication.AuthenticationManager; +import org.springframework.security.authentication.ProviderManager; +import org.springframework.security.cas.ServiceProperties; +import org.springframework.security.cas.authentication.CasAuthenticationProvider; +import org.springframework.security.cas.web.CasAuthenticationEntryPoint; +import org.springframework.security.cas.web.CasAuthenticationFilter; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.core.authority.AuthorityUtils; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.web.AuthenticationEntryPoint; +import org.springframework.security.web.authentication.logout.LogoutFilter; + +import java.util.Collections; + +@EnableWebSecurity +public class WebSecurityConfig extends WebSecurityConfigurerAdapter { + + private Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class); + private SingleSignOutFilter singleSignOutFilter; + private LogoutFilter logoutFilter; + private CasAuthenticationProvider casAuthenticationProvider; + private ServiceProperties serviceProperties; + + @Autowired + public WebSecurityConfig(SingleSignOutFilter singleSignOutFilter, LogoutFilter logoutFilter, + CasAuthenticationProvider casAuthenticationProvider, + ServiceProperties serviceProperties) { + this.logoutFilter = logoutFilter; + this.singleSignOutFilter = singleSignOutFilter; + this.serviceProperties = serviceProperties; + this.casAuthenticationProvider = casAuthenticationProvider; + } + + + @Override + protected void configure(HttpSecurity http) throws Exception { + http.authorizeRequests().antMatchers( "/secured", "/login").authenticated() + .and() + .exceptionHandling().authenticationEntryPoint(authenticationEntryPoint()) + .and() + .addFilterBefore(singleSignOutFilter, CasAuthenticationFilter.class) + .addFilterBefore(logoutFilter, LogoutFilter.class) + .csrf().ignoringAntMatchers("/exit/cas"); + } + + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + auth.authenticationProvider(casAuthenticationProvider); + } + + @Bean + @Override + protected AuthenticationManager authenticationManager() throws Exception { + return new ProviderManager(Collections.singletonList(casAuthenticationProvider)); + } + + public AuthenticationEntryPoint authenticationEntryPoint() { + CasAuthenticationEntryPoint entryPoint = new CasAuthenticationEntryPoint(); + entryPoint.setLoginUrl("https://localhost:8443/login"); + entryPoint.setServiceProperties(serviceProperties); + return entryPoint; + } + + + +} diff --git a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/AuthController.java b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/AuthController.java index 2c88b74a83..16254c8cbd 100644 --- a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/AuthController.java +++ b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/AuthController.java @@ -1,7 +1,7 @@ package com.baeldung.cassecuredapp.controllers; -import org.apache.log4j.LogManager; -import org.apache.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.web.authentication.logout.CookieClearingLogoutHandler; @@ -13,24 +13,27 @@ import org.springframework.web.bind.annotation.GetMapping; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import static org.springframework.security.web.authentication.rememberme.AbstractRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY; + @Controller public class AuthController { - private Logger logger = LogManager.getLogger(AuthController.class); - - @GetMapping("/logout") - public String logout( - HttpServletRequest request, HttpServletResponse response, SecurityContextLogoutHandler logoutHandler) { - Authentication auth = SecurityContextHolder.getContext().getAuthentication(); - logoutHandler.logout(request, response, auth ); - new CookieClearingLogoutHandler(AbstractRememberMeServices.SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY).logout(request, response, auth); - return "auth/logout"; - } - + private Logger logger = LoggerFactory.getLogger(AuthController.class); @GetMapping("/login") public String login() { + logger.info("/login called"); return "redirect:/secured"; } + + @GetMapping("/logout") + public String logout(HttpServletRequest request, HttpServletResponse response, SecurityContextLogoutHandler logoutHandler) { + Authentication auth = SecurityContextHolder.getContext().getAuthentication(); + CookieClearingLogoutHandler cookieClearingLogoutHandler = new CookieClearingLogoutHandler(SPRING_SECURITY_REMEMBER_ME_COOKIE_KEY); + cookieClearingLogoutHandler.logout(request, response, auth); + logoutHandler.logout(request, response, auth); + return "auth/logout"; + } + } diff --git a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/IndexController.java b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/IndexController.java index 75956cf493..d4800206d4 100644 --- a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/IndexController.java +++ b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/IndexController.java @@ -1,15 +1,19 @@ package com.baeldung.cassecuredapp.controllers; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - @Controller public class IndexController { + private Logger logger = LoggerFactory.getLogger(IndexController.class); + @GetMapping("/") public String index() { + logger.info("Index controller called"); return "index"; } + } diff --git a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/SecuredController.java b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/SecuredController.java new file mode 100644 index 0000000000..0b3ab6199f --- /dev/null +++ b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/SecuredController.java @@ -0,0 +1,30 @@ +package com.baeldung.cassecuredapp.controllers; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class SecuredController { + + private Logger logger = LoggerFactory.getLogger(SecuredController.class); + + @GetMapping("/secured") + public String securedIndex(ModelMap modelMap) { + + logger.info("/secured called"); + + Authentication auth = SecurityContextHolder.getContext() + .getAuthentication(); + + if(auth.getPrincipal() instanceof UserDetails) + modelMap.put("username", ((UserDetails) auth.getPrincipal()).getUsername()); + + return "secure/index"; + } +} diff --git a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/SecuredPageController.java b/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/SecuredPageController.java deleted file mode 100644 index 9a872d1f40..0000000000 --- a/cas/cas-secured-app/src/main/java/com/baeldung/cassecuredapp/controllers/SecuredPageController.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.cassecuredapp.controllers; - -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.stereotype.Controller; -import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -@RequestMapping(value = "/secured") -public class SecuredPageController { - - @GetMapping - public String index(ModelMap modelMap) { - Authentication auth = SecurityContextHolder.getContext().getAuthentication(); - if( auth != null && auth.getPrincipal() != null - && auth.getPrincipal() instanceof UserDetails) { - modelMap.put("username", ((UserDetails) auth.getPrincipal()).getUsername()); - } - return "secure/index"; - } -} diff --git a/cas/cas-secured-app/src/main/resources/application.properties b/cas/cas-secured-app/src/main/resources/application.properties index 99802c632f..f8789997d5 100644 --- a/cas/cas-secured-app/src/main/resources/application.properties +++ b/cas/cas-secured-app/src/main/resources/application.properties @@ -1 +1,2 @@ -server.port=9000 \ No newline at end of file +server.port=8900 +spring.freemarker.suffix=.ftl \ No newline at end of file diff --git a/cas/cas-secured-app/src/test/java/com/baeldung/cassecuredapp/CasSecuredAppApplicationIntegrationTest.java b/cas/cas-secured-app/src/test/java/com/baeldung/cassecuredapp/CasSecuredApplicationIntegrationTest.java similarity index 84% rename from cas/cas-secured-app/src/test/java/com/baeldung/cassecuredapp/CasSecuredAppApplicationIntegrationTest.java rename to cas/cas-secured-app/src/test/java/com/baeldung/cassecuredapp/CasSecuredApplicationIntegrationTest.java index 2f2644e2ea..de13f6665d 100644 --- a/cas/cas-secured-app/src/test/java/com/baeldung/cassecuredapp/CasSecuredAppApplicationIntegrationTest.java +++ b/cas/cas-secured-app/src/test/java/com/baeldung/cassecuredapp/CasSecuredApplicationIntegrationTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class CasSecuredAppApplicationIntegrationTest { +public class CasSecuredApplicationIntegrationTest { @Test public void contextLoads() { diff --git a/cas/cas-server/.factorypath b/cas/cas-server/.factorypath deleted file mode 100644 index 006c761796..0000000000 --- a/cas/cas-server/.factorypath +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cas/cas-server/.gitignore b/cas/cas-server/.gitignore old mode 100644 new mode 100755 index 5304519922..6121b5ea9d --- a/cas/cas-server/.gitignore +++ b/cas/cas-server/.gitignore @@ -2,6 +2,8 @@ !/.project .project .settings +.history +.vscode target/ .idea/ .DS_Store @@ -9,6 +11,11 @@ target/ overlays/ .gradle/ build/ +log/ bin/ +*.war *.iml *.log +tmp/ +./apache-tomcat +apache-tomcat.zip \ No newline at end of file diff --git a/cas/cas-server/.mergify.yml b/cas/cas-server/.mergify.yml new file mode 100644 index 0000000000..4fcbdbe4ac --- /dev/null +++ b/cas/cas-server/.mergify.yml @@ -0,0 +1,32 @@ +# +# Licensed to Apereo under one or more contributor license +# agreements. See the NOTICE file distributed with this work +# for additional information regarding copyright ownership. +# Apereo licenses this file to you under the Apache License, +# Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a +# copy of the License at the following location: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +pull_request_rules: +- name: automatic merge by dependabot + conditions: + - status-success=continuous-integration/travis-ci/pr + - status-success=WIP + - "#changes-requested-reviews-by=0" + - base=master + - label=dependencies + actions: + merge: + method: merge + strict: true + delete_head_branch: \ No newline at end of file diff --git a/cas/cas-server/.travis.yml b/cas/cas-server/.travis.yml new file mode 100644 index 0000000000..8347dd1719 --- /dev/null +++ b/cas/cas-server/.travis.yml @@ -0,0 +1,62 @@ +language: java +sudo: required +dist: trusty +services: + - docker +branches: + only: + - master +before_cache: + - rm -rf $HOME/.gradle/caches/5.*/ + - rm -rf $HOME/.gradle/caches/4.*/ + - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ + - find ~/.gradle/caches/ -name "*.lock" -type f -delete +cache: + bundler: false + cargo: false + directories: + - $HOME/.m2 + - $HOME/.npm/ + - $HOME/.gradle/caches/ + - $HOME/.gradle/wrapper/ +env: + global: + - JAVA_OPTS="-Xms512m -Xmx4048m -Xss128m -XX:ReservedCodeCacheSize=512m -XX:+UseG1GC -Xverify:none -server" + - GRADLE_OPTS="-Xms512m -Xmx1024m -Xss128m -XX:ReservedCodeCacheSize=512m -XX:+UseG1GC -Xverify:none -server" +jdk: +- openjdk11 +before_install: +- echo -e "Configuring Gradle wrapper...\n" +- mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties +- chmod -R 777 ./gradlew +- chmod -R 777 *.sh +install: true +stages: + - build + - validate + - docker +jobs: + include: + - stage: build + script: ./gradlew clean build --stacktrace --no-daemon --refresh-dependencies -Dorg.gradle.internal.http.socketTimeout=600000 -Dorg.gradle.internal.http.connectionTimeout=600000 + name: "Build CAS" + ############################################ + - stage: validate + script: ./gradlew downloadShell + name: "Download CAS Shell" + - stage: validate + script: ./gradlew listTemplateViews + name: "List CAS Template Views" + - stage: validate + script: ./gradlew explodeWar + name: "Unzip CAS Web Application" + ############################################ + - stage: docker + script: ./gradlew build jibDockerBuild --stacktrace --no-daemon --refresh-dependencies + name: "Build Docker Image via Jib" + - stage: docker + script: docker-compose build + name: "Build Docker Image via Docker Compose" + - stage: docker + script: ./docker-build.sh + name: "Build Docker Image" \ No newline at end of file diff --git a/cas/cas-server/Dockerfile b/cas/cas-server/Dockerfile new file mode 100644 index 0000000000..b2f15ef4c3 --- /dev/null +++ b/cas/cas-server/Dockerfile @@ -0,0 +1,40 @@ +FROM adoptopenjdk/openjdk11:alpine-slim AS overlay + +RUN mkdir -p cas-overlay +COPY ./src cas-overlay/src/ +COPY ./gradle/ cas-overlay/gradle/ +COPY ./gradlew ./settings.gradle ./build.gradle ./gradle.properties /cas-overlay/ + +RUN mkdir -p ~/.gradle \ + && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties \ + && echo "org.gradle.configureondemand=true" >> ~/.gradle/gradle.properties \ + && cd cas-overlay \ + && chmod 750 ./gradlew \ + && ./gradlew --version; + +RUN cd cas-overlay \ + && ./gradlew clean build --parallel; + +FROM adoptopenjdk/openjdk11:alpine-jre AS cas + +LABEL "Organization"="Apereo" +LABEL "Description"="Apereo CAS" + +RUN cd / \ + && mkdir -p /etc/cas/config \ + && mkdir -p /etc/cas/services \ + && mkdir -p /etc/cas/saml \ + && mkdir -p cas-overlay; + +COPY etc/cas/ /etc/cas/ +COPY etc/cas/config/ /etc/cas/config/ +COPY etc/cas/services/ /etc/cas/services/ +COPY etc/cas/saml/ /etc/cas/saml/ +COPY --from=overlay cas-overlay/build/libs/cas.war cas-overlay/ + +EXPOSE 8080 8443 + +ENV PATH $PATH:$JAVA_HOME/bin:. + +WORKDIR cas-overlay +ENTRYPOINT ["java", "-server", "-noverify", "-Xmx2048M", "-jar", "cas.war"] diff --git a/cas/cas-server/README.md b/cas/cas-server/README.md index 44cfa2246c..b224738732 100644 --- a/cas/cas-server/README.md +++ b/cas/cas-server/README.md @@ -1,105 +1,146 @@ -CAS Overlay Template -============================ +CAS Overlay Template [![Build Status](https://travis-ci.org/apereo/cas-overlay-template.svg?branch=master)](https://travis-ci.org/apereo/cas-overlay-template) +======================= -Generic CAS WAR overlay to exercise the latest versions of CAS. This overlay could be freely used as a starting template for local CAS war overlays. The CAS services management overlay is available [here](https://github.com/apereo/cas-services-management-overlay). +Generic CAS WAR overlay to exercise the latest versions of CAS. This overlay could be freely used as a starting template for local CAS war overlays. # Versions -```xml -5.3.x +- CAS `6.1.x` +- JDK `11` + +# Overview + +To build the project, use: + +```bash +# Use --refresh-dependencies to force-update SNAPSHOT versions +./gradlew[.bat] clean build ``` -# Requirements - -* JDK 1.8+ - -# Configuration - -The `etc` directory contains the configuration files and directories that need to be copied to `/etc/cas/config`. - -# Build - To see what commands are available to the build script, run: ```bash -./build.sh help +./gradlew[.bat] tasks ``` -To package the final web application, run: +To launch into the CAS command-line shell: ```bash -./build.sh package +./gradlew[.bat] downloadShell runShell ``` -To update `SNAPSHOT` versions run: +To fetch and overlay a CAS resource or view, use: ```bash -./build.sh package -U +./gradlew[.bat] getResource -PresourceName=[resource-name] ``` +To list all available CAS views and templates: + +```bash +./gradlew[.bat] listTemplateViews +``` + +To unzip and explode the CAS web application file and the internal resources jar: + +```bash +./gradlew[.bat] explodeWar +``` + +# Configuration + +- The `etc` directory contains the configuration files and directories that need to be copied to `/etc/cas/config`. + +```bash +./gradlew[.bat] copyCasConfiguration +``` + +- The specifics of the build are controlled using the `gradle.properties` file. + +## Adding Modules + +CAS modules may be specified under the `dependencies` block of the [Gradle build script](build.gradle): + +```gradle +dependencies { + compile "org.apereo.cas:cas-server-some-module:${project.casVersion}" + ... +} +``` + +To collect the list of all project modules and dependencies: + +```bash +./gradlew[.bat] allDependencies +``` + +### Clear Gradle Cache + +If you need to, on Linux/Unix systems, you can delete all the existing artifacts (artifacts and metadata) Gradle has downloaded using: + +```bash +# Only do this when absolutely necessary +rm -rf $HOME/.gradle/caches/ +``` + +Same strategy applies to Windows too, provided you switch `$HOME` to its equivalent in the above command. + # Deployment -- Create a keystore file `thekeystore` under `/etc/cas`. Use the password `changeit` for both the keystore and the key/certificate entries. +- Create a keystore file `thekeystore` under `/etc/cas`. Use the password `changeit` for both the keystore and the key/certificate entries. This can either be done using the JDK's `keytool` utility or via the following command: + +```bash +./gradlew[.bat] createKeystore +``` + - Ensure the keystore is loaded up with keys and certificates of the server. On a successful deployment via the following methods, CAS will be available at: -* `http://cas.server.name:8080/cas` * `https://cas.server.name:8443/cas` ## Executable WAR -Run the CAS web application as an executable WAR. +Run the CAS web application as an executable WAR: ```bash -./build.sh run +./gradlew[.bat] run ``` -## Spring Boot - -Run the CAS web application as an executable WAR via Spring Boot. This is most useful during development and testing. +Debug the CAS web application as an executable WAR: ```bash -./build.sh bootrun +./gradlew[.bat] debug ``` -### Warning! +Run the CAS web application as a *standalone* executable WAR: -Be careful with this method of deployment. `bootRun` is not designed to work with already executable WAR artifacts such that CAS server web application. YMMV. Today, uses of this mode ONLY work when there is **NO OTHER** dependency added to the build script and the `cas-server-webapp` is the only present module. See [this issue](https://github.com/spring-projects/spring-boot/issues/8320) for more info. - - -## Spring Boot App Server Selection - -There is an app.server property in the `pom.xml` that can be used to select a spring boot application server. -It defaults to `-tomcat` but `-jetty` and `-undertow` are supported. - -It can also be set to an empty value (nothing) if you want to deploy CAS to an external application server of your choice. - -```xml --tomcat -``` - -## Windows Build - -If you are building on windows, try `build.cmd` instead of `build.sh`. Arguments are similar but for usage, run: - -``` -build.cmd help +```bash +./gradlew[.bat] clean executable ``` ## External -Deploy resultant `target/cas.war` to a servlet container of choice. +Deploy the binary web application file `cas.war` after a successful build to a servlet container of choice. +## Docker -## Command Line Shell +The following strategies outline how to build and deploy CAS Docker images. -Invokes the CAS Command Line Shell. For a list of commands either use no arguments or use `-h`. To enter the interactive shell use `-sh`. +### Jib + +The overlay embraces the [Jib Gradle Plugin](https://github.com/GoogleContainerTools/jib) to provide easy-to-use out-of-the-box tooling for building CAS docker images. Jib is an open-source Java containerizer from Google that lets Java developers build containers using the tools they know. It is a container image builder that handles all the steps of packaging your application into a container image. It does not require you to write a Dockerfile or have Docker installed, and it is directly integrated into the overlay. ```bash -./build.sh cli +./gradlew build jibDockerBuild ``` -### Relevant Articles: +### Dockerfile -- [CAS SSO With Spring Security](https://www.baeldung.com/spring-security-cas-sso) +You can also use the native Docker tooling and the provided `Dockerfile` to build and run CAS. + +```bash +chmod +x *.sh +./docker-build.sh +./docker-run.sh +``` diff --git a/cas/cas-server/build.cmd b/cas/cas-server/build.cmd deleted file mode 100644 index 2cf9262afe..0000000000 --- a/cas/cas-server/build.cmd +++ /dev/null @@ -1,102 +0,0 @@ -@echo off - -@set JAVA_ARGS=-Xms500m -Xmx1g -@set CAS_DIR=\etc\cas -@set CONFIG_DIR=\etc\cas\config - -@rem Call this script with DNAME and CERT_SUBJ_ALT_NAMES already set to override -@if "%DNAME%" == "" set DNAME=CN=cas.example.org,OU=Example,OU=Org,C=US -@rem List other host names or ip addresses you want in your certificate, may help with host name verification, -@rem if client apps make https connection for ticket validation and compare name in cert (include sub. alt. names) -@rem to name used to access CAS -@if "%CERT_SUBJ_ALT_NAMES%" == "" set CERT_SUBJ_ALT_NAMES=dns:example.org,dns:localhost,dns:%COMPUTERNAME%,ip:127.0.0.1 - -@rem Check for mvn in path, use it if found, otherwise use maven wrapper -@set MAVEN_CMD=mvn -@where /q mvn -@if %ERRORLEVEL% neq 0 set MAVEN_CMD=.\mvnw.bat - -@if "%1" == "" call:help -@if "%1" == "copy" call:copy -@if "%1" == "clean" call:clean %2 %3 %4 -@if "%1" == "package" call:package %2 %3 %4 -@if "%1" == "bootrun" call:bootrun %2 %3 %4 -@if "%1" == "debug" call:debug %2 %3 %4 -@if "%1" == "run" call:run %2 %3 %4 -@if "%1" == "runalone" call:runalone %2 %3 %4 -@if "%1" == "help" call:help -@if "%1" == "gencert" call:gencert -@if "%1" == "cli" call:runcli %2 %3 %4 - -@rem function section starts here -@goto:eof - -:copy - @echo "Creating configuration directory under %CONFIG_DIR%" - if not exist %CONFIG_DIR% mkdir %CONFIG_DIR% - - @echo "Copying configuration files from etc/cas to /etc/cas" - xcopy /S /Y etc\cas\* \etc\cas -@goto:eof - -:help - @echo "Usage: build.bat [copy|clean|package|run|debug|bootrun|gencert|cli] [optional extra args for maven or cli]" - @echo "To get started on a clean system, run "build.bat copy" and "build.bat gencert", then "build.bat run" - @echo "Note that using the copy or gencert arguments will create and/or overwrite the %CAS_DIR% which is outside this project" -@goto:eof - -:clean - call %MAVEN_CMD% clean %1 %2 %3 - exit /B %ERRORLEVEL% -@goto:eof - -:package - call %MAVEN_CMD% clean package -T 5 %1 %2 %3 - exit /B %ERRORLEVEL% -@goto:eof - -:bootrun - call %MAVEN_CMD% clean package spring-boot:run -T 5 %1 %2 %3 - exit /B %ERRORLEVEL% -@goto:eof - -:debug - call:package %1 %2 %3 & java %JAVA_ARGS% -Xdebug -Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n -jar target/cas.war -@goto:eof - -:run - call:package %1 %2 %3 & java %JAVA_ARGS% -jar target/cas.war -@goto:eof - -:runalone - call:package %1 %2 %3 & target/cas.war -@goto:eof - -:gencert - where /q keytool - if ERRORLEVEL 1 ( - @echo Java keytool.exe not found in path. - exit /b 1 - ) else ( - if not exist %CAS_DIR% mkdir %CAS_DIR% - @echo on - @echo Generating self-signed SSL cert for %DNAME% in %CAS_DIR%\thekeystore - keytool -genkeypair -alias cas -keyalg RSA -keypass changeit -storepass changeit -keystore %CAS_DIR%\thekeystore -dname %DNAME% -ext SAN=%CERT_SUBJ_ALT_NAMES% - @echo Exporting cert for use in trust store (used by cas clients) - keytool -exportcert -alias cas -storepass changeit -keystore %CAS_DIR%\thekeystore -file %CAS_DIR%\cas.cer - ) -@goto:eof - -:runcli - for /f %%i in ('call %MAVEN_CMD% -q --non-recursive "-Dexec.executable=cmd" "-Dexec.args=/C echo ${cas.version}" "org.codehaus.mojo:exec-maven-plugin:1.3.1:exec"') do set CAS_VERSION=%%i - @set CAS_VERSION=%CAS_VERSION: =% - @set DOWNLOAD_DIR=target - @set COMMAND_FILE=cas-server-support-shell-%CAS_VERSION%.jar - @if not exist %DOWNLOAD_DIR% mkdir %DOWNLOAD_DIR% - @if not exist %DOWNLOAD_DIR%\%COMMAND_FILE% ( - @call mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:get -DgroupId=org.apereo.cas -DartifactId=cas-server-support-shell -Dversion=%CAS_VERSION% -Dpackaging=jar -DartifactItem.outputDirectory=%DOWNLOAD_DIR% -DartifactItem.destFileName=%COMMAND_FILE% -DremoteRepositories=central::default::http://repo1.maven.apache.org/maven2,snapshots::::https://oss.sonatype.org/content/repositories/snapshots -Dtransitive=false - @call mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.2:copy -Dmdep.useBaseVersion=true -Dartifact=org.apereo.cas:cas-server-support-shell:%CAS_VERSION%:jar -DoutputDirectory=%DOWNLOAD_DIR% - ) - @call java %JAVA_ARGS% -jar %DOWNLOAD_DIR%\%COMMAND_FILE% %1 %2 %3 - -@goto:eof \ No newline at end of file diff --git a/cas/cas-server/build.gradle b/cas/cas-server/build.gradle new file mode 100644 index 0000000000..41381e2d8f --- /dev/null +++ b/cas/cas-server/build.gradle @@ -0,0 +1,106 @@ +buildscript { + repositories { + mavenLocal() + mavenCentral() + jcenter() + maven { url "https://repo.spring.io/libs-milestone" } + maven { url "https://repo.spring.io/libs-snapshot" } + maven { url "https://plugins.gradle.org/m2/" } + } + dependencies { + classpath "de.undercouch:gradle-download-task:${project.gradleDownloadTaskVersion}" + classpath "org.springframework.boot:spring-boot-gradle-plugin:${project.springBootVersion}" + classpath "gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:${project.jibVersion}" + classpath "io.freefair.gradle:maven-plugin:${project.gradleMavenPluginVersion}" + } +} + +repositories { + mavenLocal() + mavenCentral() + jcenter() + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } + maven { url "https://build.shibboleth.net/nexus/content/repositories/releases/" } + maven { url "https://repo.spring.io/milestone/" } + maven { url "https://repo.spring.io/snapshot/" } + maven { url "https://oss.jfrog.org/artifactory/oss-snapshot-local" } +} + +def casServerVersion = project.'cas.version' +def casWebApplicationBinaryName = "cas.war" + +project.ext."casServerVersion" = casServerVersion +project.ext."casWebApplicationBinaryName" = casWebApplicationBinaryName + +apply plugin: "io.freefair.war-overlay" +apply from: rootProject.file("gradle/tasks.gradle") + +apply plugin: "war" +apply plugin: "eclipse" +apply plugin: "idea" + +apply from: rootProject.file("gradle/springboot.gradle") +apply from: rootProject.file("gradle/dockerjib.gradle") + +dependencies { + // Other CAS dependencies/modules may be listed here... + compile "org.apereo.cas:cas-server-support-json-service-registry:${casServerVersion}" + compile "org.apereo.cas:cas-server-support-jdbc:${casServerVersion}" +} + +tasks.findByName("jibDockerBuild") + .dependsOn(copyWebAppIntoJib, copyConfigIntoJib) + .finalizedBy(deleteWebAppFromJib) + +tasks.findByName("jib") + .dependsOn(copyWebAppIntoJib, copyConfigIntoJib) + .finalizedBy(deleteWebAppFromJib) + +configurations.all { + resolutionStrategy { + cacheChangingModulesFor 0, "seconds" + cacheDynamicVersionsFor 0, "seconds" + + preferProjectModules() + + def failIfConflict = project.hasProperty("failOnVersionConflict") && Boolean.valueOf(project.getProperty("failOnVersionConflict")) + if (failIfConflict) { + failOnVersionConflict() + } + } +} + +eclipse { + classpath { + downloadSources = true + downloadJavadoc = true + } +} + +idea { + module { + downloadJavadoc = true + downloadSources = true + } +} + +bootWar { + entryCompression = ZipEntryCompression.STORED + overlays { + // https://docs.freefair.io/gradle-plugins/current/reference/#_io_freefair_war_overlay + // Note: The "excludes" property is only for files in the war dependency. + // If a jar is excluded from the war, it could be brought back into the final war as a dependency + // of non-war dependencies. Those should be excluded via normal gradle dependency exclusions. + cas { + from "org.apereo.cas:cas-server-webapp${project.appServer}:${casServerVersion}@war" + provided = false + //excludes = ["WEB-INF/lib/somejar-1.0*"] + } + } +} + + +wrapper { + distributionType = Wrapper.DistributionType.BIN + gradleVersion = "${project.gradleVersion}" +} diff --git a/cas/cas-server/build.sh b/cas/cas-server/build.sh deleted file mode 100644 index 4d80aa2593..0000000000 --- a/cas/cas-server/build.sh +++ /dev/null @@ -1,189 +0,0 @@ -#!/bin/bash - - -function copy() { - echo -e "Creating configuration directory under /etc/cas" - mkdir -p /etc/cas/config - - echo -e "Copying configuration files from etc/cas to /etc/cas" - cp -rfv etc/cas/* /etc/cas -} - -function help() { - echo "Usage: build.sh [copy|clean|package|run|debug|bootrun|gencert]" - echo " copy: Copy config from ./etc/cas/config to /etc/cas/config" - echo " clean: Clean Maven build directory" - echo " package: Clean and build CAS war" - echo " run: Build and run cas.war via Java (i.e. java -jar target/cas.war)" - echo " runalone: Build and run cas.war on its own as a standalone executable (target/cas.war)" - echo " debug: Run CAS.war and listen for Java debugger on port 5000" - echo " bootrun: Run with maven spring boot plugin" - echo " listviews: List all CAS views that ship with the web application and can be customized in the overlay" - echo " getview: Ask for a view name to be included in the overlay for customizations" - echo " gencert: Create keystore with SSL certificate in location where CAS looks by default" - echo " cli: Run the CAS command line shell and pass commands" -} - -function clean() { - shift - ./mvnw clean "$@" -} - -function package() { - shift - ./mvnw clean package -T 5 "$@" - # copy -} - -function bootrun() { - shift - ./mvnw clean package spring-boot:run -P bootiful -T 5 "$@" -} - -function debug() { - package && java -Xdebug -Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=n -jar target/cas.war -} - -function run() { - package && java -jar target/cas.war -} - -function runalone() { - shift - ./mvnw clean package -P default,exec "$@" - chmod +x target/cas.war - target/cas.war -} - -function listviews() { - shift - explodeapp - find $PWD/target/cas -type f -name "*.html" | xargs -n 1 basename | sort | more -} - -function explodeapp() { - if [ ! -d $PWD/target/cas ];then - echo "Building the CAS web application and exploding the final war file..." - ./mvnw clean package war:exploded "$@" - fi - echo "Exploded the CAS web application file." -} - -function getview() { - shift - explodeapp - echo "Searching for view name $@..." - results=`find $PWD/target/cas -type f -name "*.html" | grep -i "$@"` - echo -e "Found view(s): \n$results" - count=`wc -w <<< "$results"` - if [ "$count" -eq 1 ];then - # echo "Found view $results to include in the overlay" - firststring="target/cas/WEB-INF/classes" - secondstring="src/main/resources" - overlayfile=`echo "${results/$firststring/$secondstring}"` - overlaypath=`dirname "${overlayfile}"` - # echo "Overlay file is $overlayfile to be created at $overlaypath" - mkdir -p $overlaypath - cp $results $overlaypath - echo "Created view at $overlayfile" - ls $overlayfile - else - echo "More than one view file is found. Narrow down the search query..." - fi -} - - -function gencert() { - if [[ ! -d /etc/cas ]] ; then - copy - fi - which keytool - if [[ $? -ne 0 ]] ; then - echo Error: Java JDK \'keytool\' is not installed or is not in the path - exit 1 - fi - # override DNAME and CERT_SUBJ_ALT_NAMES before calling or use dummy values - DNAME="${DNAME:-CN=cas.example.org,OU=Example,OU=Org,C=US}" - CERT_SUBJ_ALT_NAMES="${CERT_SUBJ_ALT_NAMES:-dns:example.org,dns:localhost,ip:127.0.0.1}" - echo "Generating keystore for CAS with DN ${DNAME}" - keytool -genkeypair -alias cas -keyalg RSA -keypass changeit -storepass changeit -keystore /etc/cas/thekeystore -dname ${DNAME} -ext SAN=${CERT_SUBJ_ALT_NAMES} - keytool -exportcert -alias cas -storepass changeit -keystore /etc/cas/thekeystore -file /etc/cas/cas.cer -} - -function cli() { - - CAS_VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${cas.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec 2>/dev/null) - # echo "CAS version: $CAS_VERSION" - JAR_FILE_NAME="cas-server-support-shell-${CAS_VERSION}.jar" - # echo "JAR name: $JAR_FILE_NAME" - JAR_PATH="org/apereo/cas/cas-server-support-shell/${CAS_VERSION}/${JAR_FILE_NAME}" - # echo "JAR path: $JAR_PATH" - - JAR_FILE_LOCAL="$HOME/.m2/repository/$JAR_PATH"; - # echo "Local JAR file path: $JAR_FILE_LOCAL"; - if [ -f "$JAR_FILE_LOCAL" ]; then - # echo "Using JAR file locally at $JAR_FILE_LOCAL" - java -jar $JAR_FILE_LOCAL "$@" - exit 0; - fi - - DOWNLOAD_DIR=./target - COMMAND_FILE="${DOWNLOAD_DIR}/${JAR_FILE_NAME}" - if [ ! -f "$COMMAND_FILE" ]; then - mkdir -p $DOWNLOAD_DIR - ./mvnw org.apache.maven.plugins:maven-dependency-plugin:3.0.2:get -DgroupId=org.apereo.cas -DartifactId=cas-server-support-shell -Dversion=$CAS_VERSION -Dpackaging=jar -DartifactItem.outputDirectory=$DOWNLOAD_DIR -DremoteRepositories=central::default::http://repo1.maven.apache.org/maven2,snapshots::::https://oss.sonatype.org/content/repositories/snapshots -Dtransitive=false - ./mvnw org.apache.maven.plugins:maven-dependency-plugin:3.0.2:copy -Dmdep.useBaseVersion=true -Dartifact=org.apereo.cas:cas-server-support-shell:$CAS_VERSION:jar -DoutputDirectory=$DOWNLOAD_DIR - fi - java -jar $COMMAND_FILE "$@" - exit 0; - -} - -if [ $# -eq 0 ]; then - echo -e "No commands provided. Defaulting to [run]\n" - run - exit 0 -fi - -case "$1" in -"copy") - copy - ;; -"clean") - shift - clean "$@" - ;; -"package") - shift - package "$@" - ;; -"bootrun") - shift - bootrun "$@" - ;; -"debug") - debug "$@" - ;; -"run") - run "$@" - ;; -"runalone") - runalone "$@" - ;; -"listviews") - listviews "$@" - ;; -"gencert") - gencert "$@" - ;; -"getview") - getview "$@" - ;; -"cli") - shift - cli "$@" - ;; -*) - help - ;; -esac diff --git a/cas/cas-server/docker-build.sh b/cas/cas-server/docker-build.sh new file mode 100755 index 0000000000..8f2c2776bf --- /dev/null +++ b/cas/cas-server/docker-build.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +image_tag=(`cat gradle.properties | grep "cas.version" | cut -d= -f2`) + +echo "Building CAS docker image tagged as [$image_tag]" +# read -p "Press [Enter] to continue..." any_key; + +docker build --tag="org.apereo.cas/cas:$image_tag" . \ + && echo "Built CAS image successfully tagged as org.apereo.cas/cas:$image_tag" \ + && docker images "org.apereo.cas/cas:$image_tag" \ No newline at end of file diff --git a/cas/cas-server/docker-compose.yml b/cas/cas-server/docker-compose.yml new file mode 100644 index 0000000000..8f2e6ca7c9 --- /dev/null +++ b/cas/cas-server/docker-compose.yml @@ -0,0 +1,7 @@ +version: '3' +services: + cas: + build: . + ports: + - "8443:8443" + - "8080:8080" \ No newline at end of file diff --git a/cas/cas-server/docker-push.sh b/cas/cas-server/docker-push.sh new file mode 100755 index 0000000000..e04b107212 --- /dev/null +++ b/cas/cas-server/docker-push.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +read -p "Docker username: " docker_user +read -s -p "Docker password: " docker_psw + +echo "$docker_psw" | docker login --username "$docker_user" --password-stdin + +image_tag=(`cat gradle.properties | grep "cas.version" | cut -d= -f2`) + +echo "Pushing CAS docker image tagged as $image_tag to org.apereo.cas/cas..." +docker push org.apereo.cas/cas:"$image_tag" \ + && echo "Pushed org.apereo.cas/cas:$image_tag successfully."; \ No newline at end of file diff --git a/cas/cas-server/docker-run.sh b/cas/cas-server/docker-run.sh new file mode 100755 index 0000000000..f8627859f2 --- /dev/null +++ b/cas/cas-server/docker-run.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +docker stop cas > /dev/null 2>&1 +docker rm cas > /dev/null 2>&1 +image_tag=(`cat gradle.properties | grep "cas.version" | cut -d= -f2`) +docker run -d -p 8080:8080 -p 8443:8443 --name="cas" org.apereo.cas/cas:"${image_tag}" +docker logs -f cas \ No newline at end of file diff --git a/cas/cas-server/etc/cas/config/application.yml b/cas/cas-server/etc/cas/config/application.yml deleted file mode 100644 index be1f7c3edd..0000000000 --- a/cas/cas-server/etc/cas/config/application.yml +++ /dev/null @@ -1,2 +0,0 @@ -info: - description: CAS Configuration \ No newline at end of file diff --git a/cas/cas-server/etc/cas/config/cas.properties b/cas/cas-server/etc/cas/config/cas.properties index 47a1477308..a3be0e1388 100644 --- a/cas/cas-server/etc/cas/config/cas.properties +++ b/cas/cas-server/etc/cas/config/cas.properties @@ -1,7 +1,6 @@ -cas.server.name: https://cas.example.org:8443 -cas.server.prefix: https://cas.example.org:8443/cas - -cas.adminPagesSecurity.ip=127\.0\.0\.1 +cas.server.name=https://cas.example.org:8443 +cas.server.prefix=${cas.server.name}/cas logging.config: file:/etc/cas/config/log4j2.xml -# cas.serviceRegistry.config.location: classpath:/services + +# cas.authn.accept.users= diff --git a/cas/cas-server/etc/cas/config/log4j2.xml b/cas/cas-server/etc/cas/config/log4j2.xml index e688cc0350..685dfab245 100644 --- a/cas/cas-server/etc/cas/config/log4j2.xml +++ b/cas/cas-server/etc/cas/config/log4j2.xml @@ -2,20 +2,26 @@ - - . - - warn + /var/log + + info + warn + info + warn + debug + warn + warn + warn + warn + warn + warn - + - + @@ -23,8 +29,8 @@ - + @@ -33,16 +39,6 @@ - - - - - - - - - @@ -52,52 +48,58 @@ - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/cas/cas-server/etc/cas/saml/.gitkeep b/cas/cas-server/etc/cas/saml/.gitkeep new file mode 100644 index 0000000000..882c99944d --- /dev/null +++ b/cas/cas-server/etc/cas/saml/.gitkeep @@ -0,0 +1 @@ +This directory is references in the Dockerfile so it needs to be here. \ No newline at end of file diff --git a/cas/cas-server/etc/cas/services/.donotdel b/cas/cas-server/etc/cas/services/.donotdel new file mode 100644 index 0000000000..e69de29bb2 diff --git a/cas/cas-server/etc/cas/thekeystore b/cas/cas-server/etc/cas/thekeystore new file mode 100644 index 0000000000000000000000000000000000000000..78f49baf743bc53e74cb67746992be258229c310 GIT binary patch literal 2266 zcmcgtc{J1w7oOkD7#YUW2w6i>BlG^ol6P!l$THbwi=vqO} zmYOk062e%@YtIrw=n$_u-*?XY$M^U5$35ph&%O7Yd!BpGy}Ms`zd|4o=)M8J4R(p_ zyYExV1$Fib4gjRWe}cRSqyhqf0~n|P0B}IyRQMbrXw&-UkX;%=H~+&uQHb3Frx62$ z_ZK7qS)+$zucd0azsOV;vTvu0vLqElCvV!Bz-nJ9z0&irkt8K}> zJrJ0~8>Cg57A~TFKxJviS1W$}L~4=(L-R7?3at^Tsq;scd>n;pKWwh!gk zHC$)eb@&cVlM2zX_W@HEh9*x)v zgKta)@yyS69GS8R`>Z(0YN)IEzQVZ^iDlFD;~52}`o5~x{X!0;0pT&YEiSI}8E*;U z=hN#w;gi$FL-$)IGePw7*< zmNTt?+v_`pF(tYoc73CozG)E;p5DJDwJ}sl^L{c-AVfM3FdF-nd0(@{#`N_#H$=jLe(4bHNWu@5aLK?nlJknSS zu;;hSYCw!P&g=g0h>DA|=talkLx%R|qAzD47Oqr8`8qpGzj2xSa^Qn(uAdbwMsdNq z8RKuxv6h}(9Kj}IsMQqz}-*N4iT_2YBLotQ?S`s7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r4Oh(le*nVg3nK2{TF78IqV$ms7|rn{<-wwG`Ka z!T<H82FI)&Nn30Q)ncWKYf3nUB_0+rRnkXY-@Nbd# zw{2f!0OIJNo^3StQ#U7l<9+9DKVZxlEaJ%$!wJ6 z6y$N8ju9&GIoHjG{`%BfHLvFEghR}L(EF*~33ki6J^q26u&QY?_ulsTmLA~Z?EJ_K z#`Cbk_~lkrrplSv7MNqqO;V5i7h)I!ubXvUEq!K7elbcRf@d1WB|+%te4Vg!V~%mD zKu{0Q3~v%(o|O36HCAaN%H{v`*!faCu~=huy*1>n1`V@gq#)KN;|&`^$Sln(Arrays.asList("-server -noverify -Xmx2048M -XX:+TieredCompilation -XX:TieredStopAtLevel=1".split(" "))) + if (project.hasProperty('args')) { + casRunArgs.addAll(project.args.split('\\s+')) + } + javaexec { + main = "-jar" + jvmArgs = casRunArgs + args = ["build/libs/${casWebApplicationBinaryName}"] + logger.info "Started ${commandLine}" + } + } +} + +task setExecutable(group: "build", description: "Configure the project to run in executable mode") { + doFirst { + project.setProperty("executable", "true") + logger.info "Configuring the project as executable" + } +} + +task executable(type:Exec, group: "build", description: "Run the CAS web application in standalone executable mode") { + dependsOn setExecutable, 'build' + doFirst { + workingDir "." + if (!Os.isFamily(Os.FAMILY_WINDOWS)) { + commandLine "chmod", "+x", bootWar.archivePath + } + logger.info "Running ${bootWar.archivePath}" + commandLine bootWar.archivePath + } +} + +task debug(group: "build", description: "Debug the CAS web application in embedded mode on port 5005") { + dependsOn 'build' + doLast { + logger.info "Debugging process is started in a suspended state, listening on port 5005." + def casArgs = Arrays.asList("-Xmx2048M".split(" ")) + javaexec { + main = "-jar" + jvmArgs = casArgs + debug = true + args = ["build/libs/${casWebApplicationBinaryName}"] + logger.info "Started ${commandLine}" + } + } +} + +task downloadShell(group: "shell", description: "Download CAS shell jar from snapshot or release maven repo") { + doFirst { + mkdir "${project.shellDir}" + } + doLast { + def downloadFile + if (isRunningCasServerSnapshot(casServerVersion)) { + def snapshotDir = "https://oss.sonatype.org/content/repositories/snapshots/org/apereo/cas/cas-server-support-shell/${casServerVersion}/" + def files = new ApacheURLLister().listFiles(new URL(snapshotDir)) + files = files.sort{it.path} + files.each { + if (it.path.endsWith(".jar")) { + downloadFile = it + } + } + } else { + downloadFile = "https://repo1.maven.org/maven2/org/apereo/cas/cas-server-support-shell/${casServerVersion}/cas-server-support-shell-${casServerVersion}.jar" + } + logger.info "Downloading file: ${downloadFile}" + download { + src downloadFile + dest new File("${project.shellDir}", "cas-server-support-shell-${casServerVersion}.jar") + overwrite false + } + } +} + +task runShell(group: "shell", description: "Run the CAS shell") { + dependsOn downloadShell + doLast { + println "Run the following command to launch the shell:\n\tjava -jar ${project.shellDir}/cas-server-support-shell-${casServerVersion}.jar" + } +} + +task debugShell(group: "shell", description: "Run the CAS shell with debug options, wait for debugger on port 5005") { + dependsOn downloadShell + doLast { + println """ + Run the following command to launch the shell:\n\t + java -Xrunjdwp:transport=dt_socket,address=5000,server=y,suspend=y -jar ${project.shellDir}/cas-server-support-shell-${casServerVersion}.jar + """ + } +} + +task showConfiguration(group: "build", description: "Show configurations for each dependency, etc") { + doLast() { + def cfg = project.hasProperty("configuration") ? project.property("configuration") : "compile" + configurations.getByName(cfg).each { println it } + } +} + +task allDependenciesInsight(group: "build", type: DependencyInsightReportTask, description: "Produce insight information for all dependencies") {} + +task allDependencies(group: "build", type: DependencyReportTask, description: "Display a graph of all project dependencies") {} + +task casVersion (group: "build", description: "Display the current CAS version") { + doFirst { + def verbose = project.hasProperty("verbose") && Boolean.valueOf(project.getProperty("verbose")) + if (verbose) { + def out = services.get(StyledTextOutputFactory).create("CAS") + println "******************************************************************" + out.withStyle(Style.Info).println "Apereo CAS $casServerVersion" + out.withStyle(Style.Description).println "Enterprise Single SignOn for all earthlings and beyond" + out.withStyle(Style.SuccessHeader).println "- GitHub: " + out.withStyle(Style.Success).println "https://github.com/apereo/cas" + out.withStyle(Style.SuccessHeader).println "- Docs: " + out.withStyle(Style.Success).println "https://apereo.github.io/cas" + out.withStyle(Style.SuccessHeader).println "- Blog: " + out.withStyle(Style.Success).println "https://apereo.github.io" + println "******************************************************************" + } else { + println casServerVersion + } + } +} + +task createKeystore(group: "build", description: "Create CAS keystore") { + doFirst { + mkdir "/etc/cas" + + def keystorePath = "/etc/cas/thekeystore" + + def dn = "CN=cas.example.org,OU=Example,OU=Org,C=US" + if (project.hasProperty("certificateDn")) { + dn = project.getProperty("certificateDn") + } + def subjectAltName = "dns:example.org,dns:localhost,ip:127.0.0.1" + if (project.hasProperty("certificateSubAltName")) { + subjectAltName = project.getProperty("certificateSubAltName") + } + // this will fail if thekeystore exists and has cert with cas alias already (so delete if you want to recreate) + logger.info "Generating keystore for CAS with DN ${dn}" + exec { + workingDir "." + commandLine "keytool", "-genkeypair", "-alias", "cas", + "-keyalg", "RSA", + "-keypass", "changeit", "-storepass", "changeit", + "-keystore", keystorePath, + "-dname", dn, "-ext", "SAN=${subjectAltName}" + } + logger.info "Exporting cert from keystore..." + exec { + workingDir "." + commandLine "keytool", "-exportcert", "-alias", "cas", + "-storepass", "changeit", "-keystore", keystorePath, + "-file", "/etc/cas/cas.cer" + } + logger.info "Import /etc/cas/cas.cer into your Java truststore (JAVA_HOME/lib/security/cacerts)" + } +} + +task listTemplateViews (group: "build", description: "List all CAS views") { + dependsOn explodeWar + + doFirst { + fileTree(explodedResourcesDir).matching { + include "**/*.html" + } + .collect { it.name } + .toSorted() + .each { println it } + } +} + +task getResource(group: "build", description: "Fetch a CAS resource and move it into the overlay") { + dependsOn explodeWar + + doFirst { + def resourceName = project.getProperty("resourceName") + + def results = fileTree(explodedResourcesDir).matching { + include "**/${resourceName}.*" + } + if (results.isEmpty()) { + println "No resources could be found matching ${resourceName}" + return + } + if (results.size() > 1) { + println "Multiple resources found matching ${resourceName}: ${results}" + return + } + + def fromFile = explodedResourcesDir + def resourcesDir = "src/main/resources" + mkdir resourcesDir + + def resourceFile = results[0].canonicalPath + def toResourceFile = resourceFile.replace(fromFile, resourcesDir) + + def parent = file(toResourceFile).getParent() + mkdir parent + + Files.copy(Paths.get(resourceFile), Paths.get(toResourceFile), StandardCopyOption.REPLACE_EXISTING) + println "Copied file ${resourceFile} to ${toResourceFile}" + } +} + +def isRunningCasServerSnapshot(casServerVersion) { + return "${casServerVersion}".contains("-SNAPSHOT") +} \ No newline at end of file diff --git a/cas/cas-server/gradle/wrapper/gradle-wrapper.properties b/cas/cas-server/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..f04d6a20ae --- /dev/null +++ b/cas/cas-server/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/cas/cas-server/gradlew b/cas/cas-server/gradlew new file mode 100755 index 0000000000..83f2acfdc3 --- /dev/null +++ b/cas/cas-server/gradlew @@ -0,0 +1,188 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/cas/cas-server/gradlew.bat b/cas/cas-server/gradlew.bat new file mode 100644 index 0000000000..24467a141f --- /dev/null +++ b/cas/cas-server/gradlew.bat @@ -0,0 +1,100 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/cas/cas-server/maven/maven-wrapper.jar b/cas/cas-server/maven/maven-wrapper.jar deleted file mode 100644 index 18ba302c65c4f71f57e0daa0ea1b59cb85759b5c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 71910 zcmb@t1#nzTk}fR97BgAQ%wRDyGoytqwpg+xics%_`HC{i2v=+-@jl#e&xheh3KW^#Tga8TMq8G2zD=z{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Vw3tN&OY(EmT} urT>}wuNLyZQ3r#7{{LDW0c!khSzlHH0+_G?%iF*|4PXJr;p \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` -fi - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - local basedir=$(pwd) - local wdir=$(pwd) - while [ "$wdir" != '/' ] ; do - wdir=$(cd "$wdir/.."; pwd) - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-$(find_maven_basedir)} -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS - -WRAPPER_LAUNCHER="org.apache.maven.wrapper.MavenWrapperMain" - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - -classpath \ -"$MAVEN_PROJECTBASEDIR/maven/maven-wrapper.jar" \ - ${WRAPPER_LAUNCHER} "$@" diff --git a/cas/cas-server/mvnw.bat b/cas/cas-server/mvnw.bat deleted file mode 100644 index d391151aa7..0000000000 --- a/cas/cas-server/mvnw.bat +++ /dev/null @@ -1,174 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto chkMHome - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:chkMHome -if not "%M2_HOME%"=="" goto valMHome - -SET "M2_HOME=%~dp0.." -if not "%M2_HOME%"=="" goto valMHome - -echo. -echo Error: M2_HOME not found in your environment. >&2 -echo Please set the M2_HOME variable in your environment to match the >&2 -echo location of the Maven installation. >&2 -echo. -goto error - -:valMHome - -:stripMHome -if not "_%M2_HOME:~-1%"=="_\" goto checkMCmd -set "M2_HOME=%M2_HOME:~0,-1%" -goto stripMHome - -:checkMCmd -if exist "%M2_HOME%\bin\mvn.cmd" goto init - -echo. -echo Error: M2_HOME is set to an invalid directory. >&2 -echo M2_HOME = "%M2_HOME%" >&2 -echo Please set the M2_HOME variable in your environment to match the >&2 -echo location of the Maven installation >&2 -echo. -goto error -@REM ==== END VALIDATION ==== - -:init - -set MAVEN_CMD_LINE_ARGS=%* - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\maven\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% %WRAPPER_LAUNCHER% %MAVEN_CMD_LINE_ARGS% - -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/cas/cas-server/pom.xml b/cas/cas-server/pom.xml index abcf251667..e69de29bb2 100644 --- a/cas/cas-server/pom.xml +++ b/cas/cas-server/pom.xml @@ -1,208 +0,0 @@ - - - 4.0.0 - cas-server - 1.0 - cas-server - war - - - com.baeldung - parent-boot-1 - 0.0.1-SNAPSHOT - ../../parent-boot-1 - - - - - org.apereo.cas - cas-server-support-json-service-registry - ${cas.version} - - - org.apereo.cas - cas-server-support-jdbc - ${cas.version} - - - org.apereo.cas - cas-server-support-jdbc-drivers - ${cas.version} - - - - - - - com.rimerosolutions.maven.plugins - wrapper-maven-plugin - ${wrapper-maven-plugin.version} - - true - MD5 - - - - org.springframework.boot - spring-boot-maven-plugin - - ${mainClassName} - true - ${isExecutable} - WAR - - - - - repackage - - - - - - org.apache.maven.plugins - maven-war-plugin - ${maven-war-plugin.version} - - cas - false - false - - false - ${manifestFileToUse} - - - - org.apereo.cas - cas-server-webapp${app.server} - - - - - - cas - - - - - - true - - default - - - org.apereo.cas - cas-server-webapp${app.server} - ${cas.version} - war - runtime - - - - - - - - false - - exec - - org.apereo.cas.web.CasWebApplication - true - - - - - - com.soebes.maven.plugins - echo-maven-plugin - ${echo-maven-plugin.version} - - - prepare-package - - echo - - - - - - Executable profile to make the generated CAS web application executable. - - - - - - - - - - false - - bootiful - - -tomcat - false - - - - org.apereo.cas - cas-server-webapp${app.server} - ${cas.version} - war - runtime - - - - - - - false - - pgp - - - - com.github.s4u.plugins - pgpverify-maven-plugin - ${pgpverify-maven-plugin.version} - - - - check - - - - - hkp://pool.sks-keyservers.net - ${settings.localRepository}/pgpkeys-cache - test - true - false - - - - - - - - - 5.3.3 - - -tomcat - - org.springframework.boot.loader.WarLauncher - false - ${project.build.directory}/war/work/org.apereo.cas/cas-server-webapp${app.server}/META-INF/MANIFEST.MF - - 0.0.4 - 2.6 - - 0.3.0 - 1.1.0 - - - diff --git a/cas/cas-server/settings.gradle b/cas/cas-server/settings.gradle new file mode 100644 index 0000000000..3ad50900ea --- /dev/null +++ b/cas/cas-server/settings.gradle @@ -0,0 +1 @@ +rootProject.name='cas' \ No newline at end of file diff --git a/cas/cas-server/src/main/jib/docker/entrypoint.sh b/cas/cas-server/src/main/jib/docker/entrypoint.sh new file mode 100755 index 0000000000..a3a0895b04 --- /dev/null +++ b/cas/cas-server/src/main/jib/docker/entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/sh + +#echo -e "\nChecking java..." +#java -version + +#echo -e "\nCreating CAS configuration directories..." +mkdir -p /etc/cas/config +mkdir -p /etc/cas/services + +#echo "Listing provided CAS docker artifacts..." +#ls -R docker/cas + +#echo -e "\nMoving CAS configuration artifacts..." +mv docker/cas/thekeystore /etc/cas 2>/dev/null +mv docker/cas/config/*.* /etc/cas/config 2>/dev/null +mv docker/cas/services/*.* /etc/cas/services 2>/dev/null + +#echo -e "\nListing CAS configuration under /etc/cas..." +#ls -R /etc/cas + +echo -e "\nRunning CAS..." +exec java -Xms512m -Xmx2048M -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -jar docker/cas/war/cas.war diff --git a/cas/cas-server/src/main/resources/application.properties b/cas/cas-server/src/main/resources/application.properties index 7735fcabdc..185532f943 100644 --- a/cas/cas-server/src/main/resources/application.properties +++ b/cas/cas-server/src/main/resources/application.properties @@ -1,134 +1,4 @@ -## -# CAS Server Context Configuration -# -server.context-path=/cas -server.port=6443 - +server.port=8443 +spring.main.allow-bean-definition-overriding=true server.ssl.key-store=classpath:/etc/cas/thekeystore -server.ssl.key-store-password=changeit -server.ssl.key-password=changeit -# server.ssl.ciphers= -# server.ssl.client-auth= -# server.ssl.enabled= -# server.ssl.key-alias= -# server.ssl.key-store-provider= -# server.ssl.key-store-type= -# server.ssl.protocol= -# server.ssl.trust-store= -# server.ssl.trust-store-password= -# server.ssl.trust-store-provider= -# server.ssl.trust-store-type= - -server.max-http-header-size=2097152 -server.use-forward-headers=true -server.connection-timeout=20000 -server.error.include-stacktrace=NEVER - -server.tomcat.max-http-post-size=2097152 -server.tomcat.basedir=build/tomcat -server.tomcat.accesslog.enabled=true -server.tomcat.accesslog.pattern=%t %a "%r" %s (%D ms) -server.tomcat.accesslog.suffix=.log -server.tomcat.max-threads=10 -server.tomcat.port-header=X-Forwarded-Port -server.tomcat.protocol-header=X-Forwarded-Proto -server.tomcat.protocol-header-https-value=https -server.tomcat.remote-ip-header=X-FORWARDED-FOR -server.tomcat.uri-encoding=UTF-8 - -spring.http.encoding.charset=UTF-8 -spring.http.encoding.enabled=true -spring.http.encoding.force=true - -## -#CAS CONFIG LOCATION -# -standalone.config=classpath:/etc/cas/config - - -## -# CAS Cloud Bus Configuration -# -spring.cloud.bus.enabled=false -# spring.cloud.bus.refresh.enabled=true -# spring.cloud.bus.env.enabled=true -# spring.cloud.bus.destination=CasCloudBus -# spring.cloud.bus.ack.enabled=true - -endpoints.enabled=false -endpoints.sensitive=true - -endpoints.restart.enabled=false -endpoints.shutdown.enabled=false - -management.security.enabled=true -management.security.roles=ACTUATOR,ADMIN -management.security.sessions=if_required -management.context-path=/status -management.add-application-context-header=false - -security.basic.authorize-mode=role -security.basic.enabled=false -security.basic.path=/cas/status/** - -## -# CAS Web Application Session Configuration -# -server.session.timeout=300 -server.session.cookie.http-only=true -server.session.tracking-modes=COOKIE - -## -# CAS Thymeleaf View Configuration -# -spring.thymeleaf.encoding=UTF-8 -spring.thymeleaf.cache=true -spring.thymeleaf.mode=HTML -## -# CAS Log4j Configuration -# -# logging.config=file:/etc/cas/log4j2.xml - -server.context-parameters.isLog4jAutoInitializationDisabled=true - -## -# CAS AspectJ Configuration -# -spring.aop.auto=true -spring.aop.proxy-target-class=true - -## -# CAS Authentication Credentials -# -#cas.authn.accept.users=casuser::Mellon -cas.authn.accept.users= -cas.authn.accept.name= - -#CAS Database Authentication Property -cas.authn.jdbc.query[0].sql=SELECT * FROM users WHERE email = ? -cas.authn.jdbc.query[0].url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC -cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQLDialect -cas.authn.jdbc.query[0].user=root -cas.authn.jdbc.query[0].password=1234 -cas.authn.jdbc.query[0].ddlAuto=none -#cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver -cas.authn.jdbc.query[0].driverClass=com.mysql.cj.jdbc.Driver -cas.authn.jdbc.query[0].fieldPassword=password -cas.authn.jdbc.query[0].passwordEncoder.type=NONE - - -## -# CAS Delegated Authentication -# -cas.authn.pac4j.bitbucket.clientName=Bitbucket -cas.authn.pac4j.dropbox.clientName=Dropbox -cas.authn.pac4j.facebook.clientName=Facebook -cas.authn.pac4j.foursquare.clientName=Foursquare -cas.authn.pac4j.github.clientName=Github -cas.authn.pac4j.google.clientName=Google -cas.authn.pac4j.linkedIn.clientName=LinkedIn -cas.authn.pac4j.paypal.clientName=PayPal -cas.authn.pac4j.twitter.clientName=Twitter -cas.authn.pac4j.yahoo.clientName=Yahoo -cas.authn.pac4j.windowsLive.clientName=Windows Live -cas.authn.pac4j.wordpress.clientName=WordPress +server.ssl.key-store-password=changeit \ No newline at end of file diff --git a/cas/cas-server/src/main/resources/cas.properties b/cas/cas-server/src/main/resources/cas.properties deleted file mode 100644 index e39d68f312..0000000000 --- a/cas/cas-server/src/main/resources/cas.properties +++ /dev/null @@ -1,9 +0,0 @@ -cas.server.name: https://localhost:6443 -cas.server.prefix: https://localhost:643/cas - -cas.adminPagesSecurity.ip=127\.0\.0\.1 - -logging.config: file:/etc/cas/config/log4j2.xml - -cas.serviceRegistry.initFromJson=true -cas.serviceRegistry.config.location=classpath:/services \ No newline at end of file diff --git a/cas/cas-server/src/main/resources/create_test_db_and_users_tbl.sql b/cas/cas-server/src/main/resources/create_test_db_and_users_tbl.sql index 79a4a48a82..104b515813 100644 --- a/cas/cas-server/src/main/resources/create_test_db_and_users_tbl.sql +++ b/cas/cas-server/src/main/resources/create_test_db_and_users_tbl.sql @@ -4,13 +4,13 @@ USE `test`; -- Dumping structure for table test.users CREATE TABLE IF NOT EXISTS `users` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `email` varchar(50) DEFAULT NULL, - `password` text DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; + `id` int(11) NOT NULL AUTO_INCREMENT, + `email` varchar(50) DEFAULT NULL, + `password` text DEFAULT NULL, + PRIMARY KEY (`id`) + ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; /*!40000 ALTER TABLE `users` DISABLE KEYS */; INSERT INTO `users` (`id`, `email`, `password`) VALUES - (1, 'test@test.com', 'Mellon'); + (1, 'test@test.com', 'Mellon'); /*!40000 ALTER TABLE `users` ENABLE KEYS */; \ No newline at end of file diff --git a/cas/cas-server/src/main/resources/etc/cas/config/application.yml b/cas/cas-server/src/main/resources/etc/cas/config/application.yml deleted file mode 100644 index be1f7c3edd..0000000000 --- a/cas/cas-server/src/main/resources/etc/cas/config/application.yml +++ /dev/null @@ -1,2 +0,0 @@ -info: - description: CAS Configuration \ No newline at end of file diff --git a/cas/cas-server/src/main/resources/etc/cas/config/cas.properties b/cas/cas-server/src/main/resources/etc/cas/config/cas.properties index 47a1477308..dda939bc1d 100644 --- a/cas/cas-server/src/main/resources/etc/cas/config/cas.properties +++ b/cas/cas-server/src/main/resources/etc/cas/config/cas.properties @@ -1,7 +1,15 @@ -cas.server.name: https://cas.example.org:8443 -cas.server.prefix: https://cas.example.org:8443/cas +cas.serviceRegistry.initFromJson=true +cas.serviceRegistry.json.location=classpath:/etc/cas/services -cas.adminPagesSecurity.ip=127\.0\.0\.1 -logging.config: file:/etc/cas/config/log4j2.xml -# cas.serviceRegistry.config.location: classpath:/services +cas.authn.accept.users= + +cas.authn.jdbc.query[0].sql=SELECT * FROM users WHERE email = ? +cas.authn.jdbc.query[0].url=jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC +cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQLDialect +cas.authn.jdbc.query[0].user=root +cas.authn.jdbc.query[0].password=smattroot +cas.authn.jdbc.query[0].ddlAuto=none +cas.authn.jdbc.query[0].driverClass=com.mysql.cj.jdbc.Driver +cas.authn.jdbc.query[0].fieldPassword=password +cas.authn.jdbc.query[0].passwordEncoder.type=NONE \ No newline at end of file diff --git a/cas/cas-server/src/main/resources/etc/cas/config/log4j2.xml b/cas/cas-server/src/main/resources/etc/cas/config/log4j2.xml deleted file mode 100644 index e688cc0350..0000000000 --- a/cas/cas-server/src/main/resources/etc/cas/config/log4j2.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - . - - warn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cas/cas-server/src/main/resources/etc/cas/services/casSecuredApp-8900.json b/cas/cas-server/src/main/resources/etc/cas/services/casSecuredApp-8900.json new file mode 100644 index 0000000000..5d468945ff --- /dev/null +++ b/cas/cas-server/src/main/resources/etc/cas/services/casSecuredApp-8900.json @@ -0,0 +1,8 @@ +{ + "@class" : "org.apereo.cas.services.RegexRegisteredService", + "serviceId" : "http://cas-client:8900/login/cas", + "name" : "casSecuredApp", + "id" : 8900, + "logoutType" : "BACK_CHANNEL", + "logoutUrl" : "http://cas-client:8900/exit/cas" +} \ No newline at end of file diff --git a/cas/cas-server/src/main/resources/etc/cas/thekeystore b/cas/cas-server/src/main/resources/etc/cas/thekeystore index 77bf895249a044c3320c6dd79003dd108c369c3b..a361bf03f9f77a8356cd0f5369f29e6965aa8cee 100644 GIT binary patch delta 1998 zcmV;<2Qm245z7&O{_Xzl00002000010000100U!Ta{vGVaH)mM2LJ#C0x*IE{xA*( z3M&Qy1OX}n5di@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nah84YXSoS00E;RFdr}-1_MF)$4V2`Yw2hW8Bt0Sg5H1A+ko06Yg34XrD?Zy1U+!O@~)Bod$Kl!rUnqaxD< zWR_x+&Msxq+ce)f%ps5vW+Ll^E|zvJM7OfT{3NRWu%ul2uzr8Suw z<$ggx3Lt2p-uz8|0c5pi4tR!ph2t+T*4&Nhi7N&Z>=_1IX|e<^&Ttza(69=G`_oG0 z%<&l1;f{T=xkF2`>`%t8MqWq^&6sfb5%X)yfL uVDKwZsx%V*r{QPU&xaX{PMP5o7}#G`0IM@1x_B`~7222oaqPh#p0`H$4zQ;H diff --git a/cas/cas-server/src/main/resources/etc/cas/thekeystore.crt b/cas/cas-server/src/main/resources/etc/cas/thekeystore.crt deleted file mode 100644 index 12ef688a08439af5a75accd1cf5d4bedfce3bd9a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 901 zcmXqLVs12OV#-{=%*4pV#FD?sAkl!AjZ>@5qwPB{BO^B}gF&Gow*e;`b0`a&FjG;! zp^$+9h{GYwnUkNKn3IuTTmlng$0EjsMT{GZ7&DTXft)z6p@o5|k%gg&k-4d56p(8P zuimboeq`zQ69QGU z6Ux18*X$`=Te0j~Yv)#ABD-l#nCoa=Ow5c7jEfZwzj*}F0-agOPYL6FZJSWllzuu6ekFzDZOsdn^valvVGIxKPs#KZCDcX zYeU_kr=prmpDb7>sw-|%Se=z}&9U25zH6IWMbl%o^_op?3Rxy<$MX7aCZ$WiS~klz zMVuqVdZC1{SohYqn>=e{f2KaIb9CTR$XIaik8d4g%GNZ#ini+3$NKu$?)1Lw)MgWY zBgqz>xrs&ZT!FOwg$-OSzb|_|eX{+3@#55T5BF@WZVz8{VlBHk?~$$RPMsIJp8r?& zr=;HTe1|iR|J70(dMB;ya4*U<_;WeogLdF56QO_0AEsYF-!9qhH}j#e#Ep0WqPkU< diff --git a/cas/cas-server/src/main/resources/log4j2.xml b/cas/cas-server/src/main/resources/log4j2.xml deleted file mode 100644 index e688cc0350..0000000000 --- a/cas/cas-server/src/main/resources/log4j2.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - . - - warn - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cas/cas-server/src/main/resources/services/casSecuredApp-19991.json b/cas/cas-server/src/main/resources/services/casSecuredApp-19991.json deleted file mode 100644 index 336007e484..0000000000 --- a/cas/cas-server/src/main/resources/services/casSecuredApp-19991.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "@class" : "org.apereo.cas.services.RegexRegisteredService", - "serviceId" : "^http://localhost:9000/login/cas", - "name" : "CAS Spring Secured App", - "description": "This is a Spring App that usses the CAS Server for it's authentication", - "id" : 19991, - "evaluationOrder" : 1 -} \ No newline at end of file diff --git a/cas/pom.xml b/cas/pom.xml index 77fae3b50a..e69de29bb2 100644 --- a/cas/pom.xml +++ b/cas/pom.xml @@ -1,23 +0,0 @@ - - - 4.0.0 - cas - cas - pom - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - .. - - - - cas-secured-app - cas-server - - - diff --git a/pom.xml b/pom.xml index 04a2ce054c..e82390a37e 100644 --- a/pom.xml +++ b/pom.xml @@ -388,7 +388,6 @@ blade bootique - cas cdi checker-plugin @@ -899,7 +898,6 @@ blade bootique - cas cdi checker-plugin From 1734250d97b95af9f44e02cf6933bc22ed1a9355 Mon Sep 17 00:00:00 2001 From: Mona Mohamadinia Date: Mon, 30 Mar 2020 21:44:37 +0430 Subject: [PATCH 122/130] Added the Static Resource Examples (#8786) --- .../src/main/resources/application.properties | 5 ++++- .../src/main/resources/files/about.html | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 spring-boot-modules/spring-boot-mvc-2/src/main/resources/files/about.html diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/resources/application.properties b/spring-boot-modules/spring-boot-mvc-2/src/main/resources/application.properties index 709574239b..7070d4c2f0 100644 --- a/spring-boot-modules/spring-boot-mvc-2/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/resources/application.properties @@ -1 +1,4 @@ -spring.main.allow-bean-definition-overriding=true \ No newline at end of file +spring.main.allow-bean-definition-overriding=true +spring.mvc.static-path-pattern=/content/** +spring.webflux.static-path-pattern=/content/** +spring.resources.static-locations=classpath:/files/,classpath:/static-files \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-mvc-2/src/main/resources/files/about.html b/spring-boot-modules/spring-boot-mvc-2/src/main/resources/files/about.html new file mode 100644 index 0000000000..15df316612 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-2/src/main/resources/files/about.html @@ -0,0 +1,10 @@ + + + + + Hello World! + + +Hello World! + + \ No newline at end of file From 8bfb7df3b2c2463e9ea584bf79c9c19c8ef525ff Mon Sep 17 00:00:00 2001 From: Roman <32590063+oskar9247@users.noreply.github.com> Date: Mon, 30 Mar 2020 22:25:55 +0200 Subject: [PATCH 123/130] BAEL-3822 Spring Boot MVC controller return HTML (#8988) Co-authored-by: Oskar <> --- .../com/baeldung/html/HtmlApplication.java | 12 ++++++++ .../com/baeldung/html/HtmlController.java | 17 +++++++++++ .../com/baeldung/html/HtmlControllerTest.java | 30 +++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 spring-5-mvc/src/main/java/com/baeldung/html/HtmlApplication.java create mode 100644 spring-5-mvc/src/main/java/com/baeldung/html/HtmlController.java create mode 100644 spring-5-mvc/src/test/java/com/baeldung/html/HtmlControllerTest.java diff --git a/spring-5-mvc/src/main/java/com/baeldung/html/HtmlApplication.java b/spring-5-mvc/src/main/java/com/baeldung/html/HtmlApplication.java new file mode 100644 index 0000000000..ad660559c7 --- /dev/null +++ b/spring-5-mvc/src/main/java/com/baeldung/html/HtmlApplication.java @@ -0,0 +1,12 @@ +package com.baeldung.html; + +import org.springframework.boot.*; +import org.springframework.boot.autoconfigure.*; + +@SpringBootApplication +public class HtmlApplication +{ + public static void main(String[] args) { + SpringApplication.run(HtmlApplication.class, args); + } +} diff --git a/spring-5-mvc/src/main/java/com/baeldung/html/HtmlController.java b/spring-5-mvc/src/main/java/com/baeldung/html/HtmlController.java new file mode 100644 index 0000000000..23674d165e --- /dev/null +++ b/spring-5-mvc/src/main/java/com/baeldung/html/HtmlController.java @@ -0,0 +1,17 @@ +package com.baeldung.html; + +import org.springframework.http.*; +import org.springframework.stereotype.*; +import org.springframework.web.bind.annotation.*; + +@Controller +public class HtmlController +{ + @GetMapping(value = "/welcome", produces = MediaType.TEXT_HTML_VALUE) + @ResponseBody + public String welcomeAsHTML() + { + return "\n" + "
Welcome
\n" + + "\n" + "Hello world\n" + "\n" + ""; + } +} diff --git a/spring-5-mvc/src/test/java/com/baeldung/html/HtmlControllerTest.java b/spring-5-mvc/src/test/java/com/baeldung/html/HtmlControllerTest.java new file mode 100644 index 0000000000..8eba4e8cf9 --- /dev/null +++ b/spring-5-mvc/src/test/java/com/baeldung/html/HtmlControllerTest.java @@ -0,0 +1,30 @@ +package com.baeldung.html; + +import org.junit.jupiter.api.*; +import org.springframework.beans.factory.annotation.*; +import org.springframework.boot.test.autoconfigure.web.servlet.*; +import org.springframework.test.web.servlet.*; +import org.springframework.test.web.servlet.request.*; +import static org.junit.jupiter.api.Assertions.*; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; + +@WebMvcTest(HtmlController.class) +class HtmlControllerUnitTest { + + @Autowired + private MockMvc mockMvc; + + private final String expectedHtmlResponse = + "\n" + "
Welcome
\n" + + "\n" + "Hello world\n" + "\n" + ""; + + @Test + void whenGETRequestToCorrectURL_thenReturnCorrectWelcomeMessage() throws Exception { + MvcResult result = mockMvc.perform(MockMvcRequestBuilders.get("/welcome")) + .andExpect(status().isOk()) + .andReturn(); + + String resultDOW = result.getResponse().getContentAsString(); + assertEquals(expectedHtmlResponse, resultDOW); + } +} From 2d5782d4327ed494bef6cc30903abf4bdbf092ec Mon Sep 17 00:00:00 2001 From: Mihai238 Date: Mon, 30 Mar 2020 22:59:12 +0200 Subject: [PATCH 124/130] add guava throwables example (#8984) Co-authored-by: Mihai Lepadat --- .../baeldung/guava/ThrowablesUnitTest.java | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 guava/src/test/java/com/baeldung/guava/ThrowablesUnitTest.java diff --git a/guava/src/test/java/com/baeldung/guava/ThrowablesUnitTest.java b/guava/src/test/java/com/baeldung/guava/ThrowablesUnitTest.java new file mode 100644 index 0000000000..7d33b38a0e --- /dev/null +++ b/guava/src/test/java/com/baeldung/guava/ThrowablesUnitTest.java @@ -0,0 +1,44 @@ +package com.baeldung.guava; + +import com.google.common.base.Throwables; +import org.junit.Test; + +import java.util.function.Supplier; + +public class ThrowablesUnitTest { + + @Test(expected = RuntimeException.class) + public void whenThrowable_shouldWrapItInRuntimeException() throws Exception { + try { + throwThrowable(Throwable::new); + } catch (Throwable t) { + Throwables.propagateIfPossible(t, Exception.class); + throw new RuntimeException(t); + } + } + + @Test(expected = Error.class) + public void whenError_shouldPropagateAsIs() throws Exception { + try { + throwThrowable(Error::new); + } catch (Throwable t) { + Throwables.propagateIfPossible(t, Exception.class); + throw new RuntimeException(t); + } + } + + @Test(expected = Exception.class) + public void whenException_shouldPropagateAsIs() throws Exception { + try { + throwThrowable(Exception::new); + } catch (Throwable t) { + Throwables.propagateIfPossible(t, Exception.class); + throw new RuntimeException(t); + } + } + + private void throwThrowable(Supplier exceptionSupplier) throws Throwable { + throw exceptionSupplier.get(); + } + +} From 2fb2f89bd4d443dbbc5c1205b57e9dcdc6870479 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Mon, 30 Mar 2020 23:06:47 +0200 Subject: [PATCH 125/130] BAEL-3477: Add usage example for the mutable key (#8987) --- .../com/baeldung/map/ProductUnitTest.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/java-collections-maps-2/src/test/java/com/baeldung/map/ProductUnitTest.java b/java-collections-maps-2/src/test/java/com/baeldung/map/ProductUnitTest.java index 2015909870..ba29d5c454 100644 --- a/java-collections-maps-2/src/test/java/com/baeldung/map/ProductUnitTest.java +++ b/java-collections-maps-2/src/test/java/com/baeldung/map/ProductUnitTest.java @@ -3,6 +3,8 @@ package com.baeldung.map; import org.junit.jupiter.api.Test; import java.util.HashMap; +import java.util.Map; +import java.util.Objects; import static org.junit.jupiter.api.Assertions.*; @@ -121,4 +123,52 @@ class ProductUnitTest { assertNull(productsByName.get("E-Bike")); } + @Test + public void givenMutableKeyWhenKeyChangeThenValueNotFound() { + // Given + MutableKey key = new MutableKey("initial"); + + Map items = new HashMap<>(); + items.put(key, "success"); + + // When + key.setName("changed"); + + // Then + assertNull(items.get(key)); + } + + static class MutableKey { + private String name; + + public MutableKey(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MutableKey that = (MutableKey) o; + return Objects.equals(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + } + } From 16e6ddc2e3e8749f26b22be495234ef3ab119e21 Mon Sep 17 00:00:00 2001 From: kwoyke Date: Mon, 30 Mar 2020 23:10:57 +0200 Subject: [PATCH 126/130] BAEL-3060: Cleanup JMXTutorialMainlauncher (#8991) --- .../baeldung/jmx/JMXTutorialMainlauncher.java | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/core-java-modules/core-java-perf/src/main/java/com/baeldung/jmx/JMXTutorialMainlauncher.java b/core-java-modules/core-java-perf/src/main/java/com/baeldung/jmx/JMXTutorialMainlauncher.java index 21044f82c4..e2a60ac384 100644 --- a/core-java-modules/core-java-perf/src/main/java/com/baeldung/jmx/JMXTutorialMainlauncher.java +++ b/core-java-modules/core-java-perf/src/main/java/com/baeldung/jmx/JMXTutorialMainlauncher.java @@ -3,7 +3,12 @@ package com.baeldung.jmx; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.management.*; +import javax.management.InstanceAlreadyExistsException; +import javax.management.MBeanRegistrationException; +import javax.management.MBeanServer; +import javax.management.MalformedObjectNameException; +import javax.management.NotCompliantMBeanException; +import javax.management.ObjectName; import java.lang.management.ManagementFactory; public class JMXTutorialMainlauncher { @@ -11,24 +16,21 @@ public class JMXTutorialMainlauncher { private static final Logger LOG = LoggerFactory.getLogger(JMXTutorialMainlauncher.class); public static void main(String[] args) { - // TODO Auto-generated method stub LOG.debug("This is basic JMX tutorial"); - ObjectName objectName = null; + try { - objectName = new ObjectName("com.baeldung.tutorial:type=basic,name=game"); - } catch (MalformedObjectNameException e) { - e.printStackTrace(); - } - MBeanServer server = ManagementFactory.getPlatformMBeanServer(); - Game gameObj = new Game(); - try { - server.registerMBean(gameObj, objectName); - } catch (InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException e) { + ObjectName objectName = new ObjectName("com.baeldung.tutorial:type=basic,name=game"); + MBeanServer server = ManagementFactory.getPlatformMBeanServer(); + server.registerMBean(new Game(), objectName); + } catch (MalformedObjectNameException | InstanceAlreadyExistsException | + MBeanRegistrationException | NotCompliantMBeanException e) { e.printStackTrace(); } + LOG.debug("Registration for Game mbean with the platform server is successfull"); LOG.debug("Please open jconsole to access Game mbean"); + while (true) { // to ensure application does not terminate } From b2a07b9fdf4ba1183da7dd2294432bf1a414ab9c Mon Sep 17 00:00:00 2001 From: kwoyke Date: Tue, 31 Mar 2020 08:54:14 +0200 Subject: [PATCH 127/130] BAEL-2681: Upgrade core-java-collections-set to Java 11 (#8998) * BAEL-2681: Upgrade core-java-collections-set to Java 11 * BAEL-2681: Comment out core-java-collections-set from the pom.xml --- .../core-java-collections-set/pom.xml | 16 ++++++++++++++++ core-java-modules/pom.xml | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/core-java-modules/core-java-collections-set/pom.xml b/core-java-modules/core-java-collections-set/pom.xml index 8ba1b2400d..c89ba0c091 100644 --- a/core-java-modules/core-java-collections-set/pom.xml +++ b/core-java-modules/core-java-collections-set/pom.xml @@ -34,7 +34,23 @@
+ + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + + 11 + 11 4.3 2.8.5 diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index 5e7ffa37b9..ebdb11925b 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -42,7 +42,7 @@ core-java-collections-list core-java-collections-list-2 core-java-collections-list-3 - core-java-collections-set + core-java-concurrency-2 core-java-concurrency-advanced From 8c69054becc77089a9cc7d27ea7959617e440736 Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Tue, 31 Mar 2020 19:25:52 +0530 Subject: [PATCH 128/130] renamed integration test to manual test (#8934) * renamed integration test to manual test * added comments in manual test case --- ...tegrationTest.java => JGitBugManualTest.java} | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) rename jgit/src/test/java/com/baeldung/jgit/{JGitBugIntegrationTest.java => JGitBugManualTest.java} (67%) diff --git a/jgit/src/test/java/com/baeldung/jgit/JGitBugIntegrationTest.java b/jgit/src/test/java/com/baeldung/jgit/JGitBugManualTest.java similarity index 67% rename from jgit/src/test/java/com/baeldung/jgit/JGitBugIntegrationTest.java rename to jgit/src/test/java/com/baeldung/jgit/JGitBugManualTest.java index ad34890996..bcfe615bc7 100644 --- a/jgit/src/test/java/com/baeldung/jgit/JGitBugIntegrationTest.java +++ b/jgit/src/test/java/com/baeldung/jgit/JGitBugManualTest.java @@ -10,10 +10,18 @@ import org.junit.Test; import java.io.IOException; import static org.junit.Assert.assertNotNull; -/** - * Tests which show issues with JGit that we reported upstream. - */ -public class JGitBugIntegrationTest { +public class JGitBugManualTest { + + /** + * This test case expects one git repository to be present in local file system. + * Currently this test uses the Baeldung repository i.e. the current checkout repository. + * It finds the repository by tracking back and scan file system to find .git folder in + * the file system. + * + * Before running the test case ensure that the .git folder is present. + * + * @throws IOException + */ @Test public void testRevWalkDisposeClosesReader() throws IOException { try (Repository repo = Helper.openJGitRepository()) { From 1e052c5a721be544899a146080b5103f1af2c8d5 Mon Sep 17 00:00:00 2001 From: Amy DeGregorio Date: Tue, 31 Mar 2020 12:02:54 -0400 Subject: [PATCH 129/130] BAEL-3827 Add CSS and JS to Thymeleaf (#8985) * BAEL-3827 Add CSS and JS to Thymeleaf * BAEL-3827 Add integration tests * BAEL-3827 Add new spring-thymeleaf-3 module to the parent pom.xml * BAEL-3827 Add new spring-thymeleaf-3 module to the parent pom.xml in both places --- pom.xml | 2 + spring-thymeleaf-3/README.md | 5 ++ spring-thymeleaf-3/pom.xml | 78 +++++++++++++++++++ .../com/baeldung/thymeleaf/Application.java | 11 +++ .../cssandjs/CssAndJsApplication.java | 11 +++ .../cssandjs/CssAndJsController.java | 15 ++++ .../resources/static/js/cssandjs/actions.js | 7 ++ .../resources/static/styles/cssandjs/main.css | 18 +++++ .../templates/cssandjs/styledPage.html | 20 +++++ .../thymeleaf/ApplicationIntegrationTest.java | 13 ++++ .../CssAndJsControllerIntegrationTest.java | 41 ++++++++++ 11 files changed, 221 insertions(+) create mode 100644 spring-thymeleaf-3/README.md create mode 100644 spring-thymeleaf-3/pom.xml create mode 100644 spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/Application.java create mode 100644 spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsApplication.java create mode 100644 spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsController.java create mode 100644 spring-thymeleaf-3/src/main/resources/static/js/cssandjs/actions.js create mode 100644 spring-thymeleaf-3/src/main/resources/static/styles/cssandjs/main.css create mode 100644 spring-thymeleaf-3/src/main/resources/templates/cssandjs/styledPage.html create mode 100644 spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/ApplicationIntegrationTest.java create mode 100644 spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/cssandjs/CssAndJsControllerIntegrationTest.java diff --git a/pom.xml b/pom.xml index e82390a37e..9f132ca7a8 100644 --- a/pom.xml +++ b/pom.xml @@ -729,6 +729,7 @@ spring-threads spring-thymeleaf spring-thymeleaf-2 + spring-thymeleaf-3 spring-vault spring-vertx @@ -1229,6 +1230,7 @@ spring-thymeleaf spring-thymeleaf-2 + spring-thymeleaf-3 spring-vault spring-vertx diff --git a/spring-thymeleaf-3/README.md b/spring-thymeleaf-3/README.md new file mode 100644 index 0000000000..e1ddd727d7 --- /dev/null +++ b/spring-thymeleaf-3/README.md @@ -0,0 +1,5 @@ +## Spring Thymeleaf 3 + +This module contains articles about Spring with Thymeleaf + +## Relevant Articles: \ No newline at end of file diff --git a/spring-thymeleaf-3/pom.xml b/spring-thymeleaf-3/pom.xml new file mode 100644 index 0000000000..7677e50d79 --- /dev/null +++ b/spring-thymeleaf-3/pom.xml @@ -0,0 +1,78 @@ + + + 4.0.0 + spring-thymeleaf-3 + spring-thymeleaf-3 + war + + + com.baeldung + parent-boot-2 + 0.0.1-SNAPSHOT + ../parent-boot-2 + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + org.springframework.boot + spring-boot-starter-test + test + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + com.baeldung.thymeleaf.cssandjs.CssAndJsApplication + JAR + + + + org.apache.maven.plugins + maven-war-plugin + + + + org.apache.tomcat.maven + tomcat7-maven-plugin + ${tomcat7-maven-plugin.version} + + + tomcat-run + + exec-war-only + + package + + / + false + webapp.jar + utf-8 + + + + + + spring-thymeleaf-3 + + + + 1.8 + 1.8 + 2.2 + + + diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/Application.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/Application.java new file mode 100644 index 0000000000..2ccca82497 --- /dev/null +++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/Application.java @@ -0,0 +1,11 @@ +package com.baeldung.thymeleaf; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } +} diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsApplication.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsApplication.java new file mode 100644 index 0000000000..fc6c142b8b --- /dev/null +++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsApplication.java @@ -0,0 +1,11 @@ +package com.baeldung.thymeleaf.cssandjs; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class CssAndJsApplication { + public static void main(String[] args) { + SpringApplication.run(CssAndJsApplication.class, args); + } +} diff --git a/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsController.java b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsController.java new file mode 100644 index 0000000000..b56a7b468e --- /dev/null +++ b/spring-thymeleaf-3/src/main/java/com/baeldung/thymeleaf/cssandjs/CssAndJsController.java @@ -0,0 +1,15 @@ +package com.baeldung.thymeleaf.cssandjs; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class CssAndJsController { + + @GetMapping("/styled-page") + public String getStyledPage(Model model) { + model.addAttribute("name", "Baeldung Reader"); + return "cssandjs/styledPage"; + } +} diff --git a/spring-thymeleaf-3/src/main/resources/static/js/cssandjs/actions.js b/spring-thymeleaf-3/src/main/resources/static/js/cssandjs/actions.js new file mode 100644 index 0000000000..e192e6358e --- /dev/null +++ b/spring-thymeleaf-3/src/main/resources/static/js/cssandjs/actions.js @@ -0,0 +1,7 @@ +function showAlert() { + alert("The button was clicked!"); +} + +function showName(name) { + alert("Here's the name: " + name); +} \ No newline at end of file diff --git a/spring-thymeleaf-3/src/main/resources/static/styles/cssandjs/main.css b/spring-thymeleaf-3/src/main/resources/static/styles/cssandjs/main.css new file mode 100644 index 0000000000..1f57b4616a --- /dev/null +++ b/spring-thymeleaf-3/src/main/resources/static/styles/cssandjs/main.css @@ -0,0 +1,18 @@ +h2 { + font-family: sans-serif; + font-size: 1.5em; + text-transform: uppercase; +} + +strong { + font-weight: 700; + background-color: yellow; +} + +p { + font-family: sans-serif; +} + +label { + font-weight: 600; +} \ No newline at end of file diff --git a/spring-thymeleaf-3/src/main/resources/templates/cssandjs/styledPage.html b/spring-thymeleaf-3/src/main/resources/templates/cssandjs/styledPage.html new file mode 100644 index 0000000000..12e4fc9227 --- /dev/null +++ b/spring-thymeleaf-3/src/main/resources/templates/cssandjs/styledPage.html @@ -0,0 +1,20 @@ + + + + + Add CSS and JS to Thymeleaf + + + + + +

Carefully Styled Heading

+

+ This is text on which we want to apply very special styling. +

+

+ + + \ No newline at end of file diff --git a/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/ApplicationIntegrationTest.java b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/ApplicationIntegrationTest.java new file mode 100644 index 0000000000..b7cfa140f0 --- /dev/null +++ b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/ApplicationIntegrationTest.java @@ -0,0 +1,13 @@ +package com.baeldung.thymeleaf; + +import org.junit.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class ApplicationIntegrationTest { + + @Test + public void contextLoads() { + + } +} diff --git a/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/cssandjs/CssAndJsControllerIntegrationTest.java b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/cssandjs/CssAndJsControllerIntegrationTest.java new file mode 100644 index 0000000000..365608bd2a --- /dev/null +++ b/spring-thymeleaf-3/src/test/java/com/baeldung/thymeleaf/cssandjs/CssAndJsControllerIntegrationTest.java @@ -0,0 +1,41 @@ +package com.baeldung.thymeleaf.cssandjs; + +import static org.hamcrest.CoreMatchers.containsString; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextConfiguration(classes = CssAndJsApplication.class) +public class CssAndJsControllerIntegrationTest { + @Autowired + private WebApplicationContext context; + + private MockMvc mockMvc; + + @Before + public void setup() { + this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build(); + } + + @Test + public void whenCalledGetStyledPage_thenReturnContent() throws Exception { + this.mockMvc.perform(MockMvcRequestBuilders.get("/styled-page")) + .andExpect(status().isOk()) + .andExpect(view().name("cssandjs/styledPage")) + .andExpect(content().string(containsString("Carefully Styled Heading"))); + } +} From dc5f7efe47ca47050a4e6f5a0534a0fd1bb870be Mon Sep 17 00:00:00 2001 From: Ali Dehghani Date: Tue, 31 Mar 2020 22:04:57 +0430 Subject: [PATCH 130/130] Fixing the False Sharing of the Data.sql File --- .../main/resources/application-lazy-load-no-trans-off.properties | 1 + .../main/resources/application-lazy-load-no-trans-on.properties | 1 + .../src/main/resources/{data.sql => data-trans.sql} | 0 3 files changed, 2 insertions(+) rename persistence-modules/spring-boot-persistence-h2/src/main/resources/{data.sql => data-trans.sql} (100%) diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties index b5fb841685..1055806ecf 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-off.properties @@ -5,6 +5,7 @@ spring.datasource.password= spring.jpa.hibernate.ddl-auto=create-drop spring.h2.console.enabled=true spring.h2.console.path=/h2-console +spring.datasource.data=data-trans.sql logging.level.org.hibernate.SQL=INFO logging.level.org.hibernate.type=TRACE diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties index 04579e1dae..77aacf0d77 100644 --- a/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties +++ b/persistence-modules/spring-boot-persistence-h2/src/main/resources/application-lazy-load-no-trans-on.properties @@ -5,6 +5,7 @@ spring.datasource.password= spring.jpa.hibernate.ddl-auto=create-drop spring.h2.console.enabled=true spring.h2.console.path=/h2-console +spring.datasource.data=data-trans.sql logging.level.org.hibernate.SQL=INFO logging.level.org.hibernate.type=TRACE diff --git a/persistence-modules/spring-boot-persistence-h2/src/main/resources/data.sql b/persistence-modules/spring-boot-persistence-h2/src/main/resources/data-trans.sql similarity index 100% rename from persistence-modules/spring-boot-persistence-h2/src/main/resources/data.sql rename to persistence-modules/spring-boot-persistence-h2/src/main/resources/data-trans.sql