From 98a3cddc47e09e2f895b3d701f9855ccb0aa95e4 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Tue, 14 Mar 2023 12:37:31 +0100 Subject: [PATCH 01/51] simplify StandardCharsets use --- .../inputstreamtostring/JavaInputStreamToXUnitTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/inputstreamtostring/JavaInputStreamToXUnitTest.java b/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/inputstreamtostring/JavaInputStreamToXUnitTest.java index 03f528766b..341a820b01 100644 --- a/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/inputstreamtostring/JavaInputStreamToXUnitTest.java +++ b/core-java-modules/core-java-io-conversions-2/src/test/java/com/baeldung/inputstreamtostring/JavaInputStreamToXUnitTest.java @@ -49,7 +49,7 @@ public class JavaInputStreamToXUnitTest { final InputStream inputStream = new ByteArrayInputStream(originalString.getBytes()); final StringBuilder textBuilder = new StringBuilder(); - try (Reader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName(StandardCharsets.UTF_8.name())))) { + try (Reader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { int c; while ((c = reader.read()) != -1) { textBuilder.append((char) c); @@ -63,7 +63,7 @@ public class JavaInputStreamToXUnitTest { final String originalString = randomAlphabetic(DEFAULT_SIZE); final InputStream inputStream = new ByteArrayInputStream(originalString.getBytes()); - final String text = new BufferedReader(new InputStreamReader(inputStream, Charset.forName(StandardCharsets.UTF_8.name()))) + final String text = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)) .lines() .collect(Collectors.joining("\n")); From 0ea86e69d982d3fa3a058d9605cdbdfb112470fd Mon Sep 17 00:00:00 2001 From: AndiCover Date: Fri, 14 Apr 2023 07:47:50 +0200 Subject: [PATCH 02/51] BAEL-5739 Avoiding the StaleElementReferenceException in Selenium --- .../selenium/stale/RobustWebDriver.java | 86 +++++++++ .../selenium/stale/RobustWebElement.java | 176 ++++++++++++++++++ .../selenium/stale/WebElementUtils.java | 30 +++ .../stale/RobustWebElementLiveTest.java | 58 ++++++ .../stale/StaleElementReferenceLiveTest.java | 102 ++++++++++ 5 files changed, 452 insertions(+) create mode 100644 testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/RobustWebDriver.java create mode 100644 testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/RobustWebElement.java create mode 100644 testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/WebElementUtils.java create mode 100644 testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/stale/RobustWebElementLiveTest.java create mode 100644 testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/stale/StaleElementReferenceLiveTest.java diff --git a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/RobustWebDriver.java b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/RobustWebDriver.java new file mode 100644 index 0000000000..211480dce3 --- /dev/null +++ b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/RobustWebDriver.java @@ -0,0 +1,86 @@ +package com.baeldung.selenium.stale; + +import org.openqa.selenium.By; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +public class RobustWebDriver implements WebDriver { + + private final WebDriver originalWebDriver; + + public RobustWebDriver(WebDriver webDriver) { + this.originalWebDriver = webDriver; + } + + @Override + public void get(String url) { + this.originalWebDriver.get(url); + } + + @Override + public String getCurrentUrl() { + return this.originalWebDriver.getCurrentUrl(); + } + + @Override + public String getTitle() { + return this.originalWebDriver.getTitle(); + } + + @Override + public List findElements(By by) { + return this.originalWebDriver.findElements(by) + .stream().map(e -> new RobustWebElement(e, by, this)) + .collect(Collectors.toList()); + } + + @Override + public WebElement findElement(By by) { + return new RobustWebElement(this.originalWebDriver.findElement(by), by, this); + } + + @Override + public String getPageSource() { + return this.originalWebDriver.getPageSource(); + } + + @Override + public void close() { + this.originalWebDriver.close(); + + } + + @Override + public void quit() { + this.originalWebDriver.quit(); + } + + @Override + public Set getWindowHandles() { + return this.originalWebDriver.getWindowHandles(); + } + + @Override + public String getWindowHandle() { + return this.originalWebDriver.getWindowHandle(); + } + + @Override + public TargetLocator switchTo() { + return this.originalWebDriver.switchTo(); + } + + @Override + public Navigation navigate() { + return this.originalWebDriver.navigate(); + } + + @Override + public Options manage() { + return this.originalWebDriver.manage(); + } +} \ No newline at end of file diff --git a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/RobustWebElement.java b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/RobustWebElement.java new file mode 100644 index 0000000000..fa65e60349 --- /dev/null +++ b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/RobustWebElement.java @@ -0,0 +1,176 @@ +package com.baeldung.selenium.stale; + +import org.openqa.selenium.By; +import org.openqa.selenium.Dimension; +import org.openqa.selenium.OutputType; +import org.openqa.selenium.Point; +import org.openqa.selenium.Rectangle; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.WebDriverException; +import org.openqa.selenium.WebElement; + +import java.util.List; +import java.util.function.BiConsumer; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; + +public class RobustWebElement implements WebElement { + + private WebElement originalElement; + private final RobustWebDriver driver; + private final By by; + + private static final int MAX_RETRIES = 10; + private static final String SERE = "Element is no longer attached to the DOM"; + + public RobustWebElement(WebElement element, By by, RobustWebDriver driver) { + this.originalElement = element; + this.by = by; + this.driver = driver; + } + + @Override + public void click() { + executeMethodWithRetries(WebElement::click); + } + + @Override + public void submit() { + executeMethodWithRetries(WebElement::submit); + } + + @Override + public void sendKeys(CharSequence... keysToSend) { + executeMethodWithRetriesVoid(WebElement::sendKeys, keysToSend); + } + + @Override + public void clear() { + executeMethodWithRetries(WebElement::clear); + } + + @Override + public String getTagName() { + return executeMethodWithRetries(WebElement::getTagName); + } + + @Override + public String getAttribute(String name) { + return executeMethodWithRetries(WebElement::getAttribute, name); + } + + @Override + public boolean isSelected() { + return executeMethodWithRetries(WebElement::isSelected); + } + + @Override + public boolean isEnabled() { + return executeMethodWithRetries(WebElement::isEnabled); + } + + @Override + public String getText() { + return executeMethodWithRetries(WebElement::getText); + } + + @Override + public List findElements(By by) { + return executeMethodWithRetries(WebElement::findElements, by); + } + + @Override + public WebElement findElement(By by) { + return executeMethodWithRetries(WebElement::findElement, by); + } + + @Override + public boolean isDisplayed() { + return executeMethodWithRetries(WebElement::isDisplayed); + } + + @Override + public Point getLocation() { + return executeMethodWithRetries(WebElement::getLocation); + } + + @Override + public Dimension getSize() { + return executeMethodWithRetries(WebElement::getSize); + } + + @Override + public Rectangle getRect() { + return executeMethodWithRetries(WebElement::getRect); + } + + @Override + public String getCssValue(String propertyName) { + return executeMethodWithRetries(WebElement::getCssValue, propertyName); + } + + + @Override + public X getScreenshotAs(OutputType target) throws WebDriverException { + return executeMethodWithRetries(WebElement::getScreenshotAs, target); + } + + private void executeMethodWithRetries(Consumer method) { + int retries = 0; + while (retries < MAX_RETRIES) { + try { + WebElementUtils.callMethod(originalElement, method); + return; + } catch (StaleElementReferenceException ex) { + refreshElement(); + } + retries++; + } + throw new StaleElementReferenceException(SERE); + } + + private T executeMethodWithRetries(Function method) { + int retries = 0; + while (retries < MAX_RETRIES) { + try { + return WebElementUtils.callMethodWithReturn(originalElement, method); + } catch (StaleElementReferenceException ex) { + refreshElement(); + } + retries++; + } + throw new StaleElementReferenceException(SERE); + } + + private void executeMethodWithRetriesVoid(BiConsumer method, U parameter) { + int retries = 0; + while (retries < MAX_RETRIES) { + try { + WebElementUtils.callMethod(originalElement, method, parameter); + return; + } catch (StaleElementReferenceException ex) { + refreshElement(); + } + retries++; + } + throw new StaleElementReferenceException(SERE); + } + + private T executeMethodWithRetries(BiFunction method, U parameter) { + int retries = 0; + while (retries < MAX_RETRIES) { + try { + return WebElementUtils.callMethodWithReturn(originalElement, method, parameter); + } catch (StaleElementReferenceException ex) { + refreshElement(); + } + retries++; + } + throw new StaleElementReferenceException(SERE); + } + + private void refreshElement() { + this.originalElement = driver.findElement(by); + } +} \ No newline at end of file diff --git a/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/WebElementUtils.java b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/WebElementUtils.java new file mode 100644 index 0000000000..460cc02bf5 --- /dev/null +++ b/testing-modules/selenium-junit-testng/src/main/java/com/baeldung/selenium/stale/WebElementUtils.java @@ -0,0 +1,30 @@ +package com.baeldung.selenium.stale; + +import org.openqa.selenium.WebElement; + +import java.util.function.BiConsumer; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Function; + +public class WebElementUtils { + + private WebElementUtils(){ + } + + public static void callMethod(WebElement element, Consumer method) { + method.accept(element); + } + + public static void callMethod(WebElement element, BiConsumer method, U parameter) { + method.accept(element, parameter); + } + + public static T callMethodWithReturn(WebElement element, Function method) { + return method.apply(element); + } + + public static T callMethodWithReturn(WebElement element, BiFunction method, U parameter) { + return method.apply(element, parameter); + } +} \ No newline at end of file diff --git a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/stale/RobustWebElementLiveTest.java b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/stale/RobustWebElementLiveTest.java new file mode 100644 index 0000000000..3dea95ca82 --- /dev/null +++ b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/stale/RobustWebElementLiveTest.java @@ -0,0 +1,58 @@ +package com.baeldung.selenium.stale; + +import io.github.bonigarcia.wdm.WebDriverManager; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.chrome.ChromeOptions; + +import java.time.Duration; + +final class RobustWebElementLiveTest { + + private static RobustWebDriver driver; + private static final int TIMEOUT = 10; + + private static final By LOCATOR_REFRESH = By.xpath("//a[.='click here']"); + private static final By LOCATOR_DYNAMIC_CONTENT = By.xpath( + "(//div[@id='content']//div[@class='large-10 columns'])[1]"); + + private static void setupChromeDriver() { + WebDriverManager.chromedriver().setup(); + final ChromeOptions options = new ChromeOptions(); + options.addArguments("--remote-allow-origins=*"); + driver = new RobustWebDriver(new ChromeDriver(options)); + options(); + } + + private static void options() { + driver.manage().window().maximize(); + driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(TIMEOUT)); + } + + @BeforeEach + public void init() { + setupChromeDriver(); + } + + @Test + void givenDynamicPage_whenRefreshingAndAccessingSavedElement_thenOK() { + driver.navigate().to("https://the-internet.herokuapp.com/dynamic_content?with_content=static"); + final WebElement element = driver.findElement(LOCATOR_DYNAMIC_CONTENT); + + driver.findElement(LOCATOR_REFRESH).click(); + Assertions.assertDoesNotThrow(element::getText); + } + + @AfterEach + void teardown() { + if (driver != null) { + driver.quit(); + driver = null; + } + } +} \ No newline at end of file diff --git a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/stale/StaleElementReferenceLiveTest.java b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/stale/StaleElementReferenceLiveTest.java new file mode 100644 index 0000000000..9b42571891 --- /dev/null +++ b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/stale/StaleElementReferenceLiveTest.java @@ -0,0 +1,102 @@ +package com.baeldung.selenium.stale; + +import io.github.bonigarcia.wdm.WebDriverManager; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.StaleElementReferenceException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import org.openqa.selenium.chrome.ChromeOptions; + +import java.time.Duration; + +final class StaleElementReferenceLiveTest { + + private static WebDriver driver; + private static final int TIMEOUT = 10; + + private static final By LOCATOR_REFRESH = By.xpath("//a[.='click here']"); + private static final By LOCATOR_DYNAMIC_CONTENT = By.xpath( + "(//div[@id='content']//div[@class='large-10 columns'])[1]"); + + private static void setupChromeDriver() { + WebDriverManager.chromedriver().setup(); + final ChromeOptions options = new ChromeOptions(); + options.addArguments("--remote-allow-origins=*"); + driver = new ChromeDriver(options); + options(); + } + + private static void options() { + driver.manage().window().maximize(); + driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(TIMEOUT)); + } + + @BeforeEach + public void init() { + setupChromeDriver(); + } + + @Test + void givenDynamicPage_whenRefreshingAndAccessingSavedElement_thenSERE() { + driver.navigate().to("https://the-internet.herokuapp.com/dynamic_content?with_content=static"); + final WebElement element = driver.findElement(LOCATOR_DYNAMIC_CONTENT); + + driver.findElement(LOCATOR_REFRESH).click(); + Assertions.assertThrows(StaleElementReferenceException.class, element::getText); + } + + @Test + void givenDynamicPage_whenRefreshingAndAccessingSavedElement_thenHandleSERE() { + driver.navigate().to("https://the-internet.herokuapp.com/dynamic_content?with_content=static"); + final WebElement element = driver.findElement(LOCATOR_DYNAMIC_CONTENT); + + if (!retryingFindClick(LOCATOR_REFRESH)) { + Assertions.fail("Element is still stale after 5 attempts"); + } + Assertions.assertDoesNotThrow(() -> retryingFindGetText(LOCATOR_DYNAMIC_CONTENT)); + } + + private boolean retryingFindClick(By locator) { + boolean result = false; + int attempts = 0; + while (attempts < 5) { + try { + driver.findElement(locator).click(); + result = true; + break; + } catch (StaleElementReferenceException ex) { + System.out.println(ex.getMessage()); + } + attempts++; + } + return result; + } + + private String retryingFindGetText(By locator) { + String result = null; + int attempts = 0; + while (attempts < 5) { + try { + result = driver.findElement(locator).getText(); + break; + } catch (StaleElementReferenceException ex) { + System.out.println(ex.getMessage()); + } + attempts++; + } + return result; + } + + @AfterEach + void teardown() { + if (driver != null) { + driver.quit(); + driver = null; + } + } +} \ No newline at end of file From 8d5f39b72028b923517ad12a2bda8873704fd8d2 Mon Sep 17 00:00:00 2001 From: Abhinav Pandey Date: Mon, 17 Apr 2023 23:33:07 +0530 Subject: [PATCH 03/51] BAEL-6355 - OpenAI API with Spring Boot --- .../config/OpenAIRestTemplateConfig.java | 25 +++++++++++ .../openapi/controller/ChatController.java | 44 +++++++++++++++++++ .../com/baeldung/openapi/dto/ChatRequest.java | 32 ++++++++++++++ .../baeldung/openapi/dto/ChatResponse.java | 38 ++++++++++++++++ .../com/baeldung/openapi/dto/Message.java | 31 +++++++++++++ .../src/main/resources/application.properties | 6 ++- 6 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/config/OpenAIRestTemplateConfig.java create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/controller/ChatController.java create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/ChatRequest.java create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/ChatResponse.java create mode 100644 spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/Message.java diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/config/OpenAIRestTemplateConfig.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/config/OpenAIRestTemplateConfig.java new file mode 100644 index 0000000000..b832ee4264 --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/config/OpenAIRestTemplateConfig.java @@ -0,0 +1,25 @@ +package com.baeldung.openapi.config; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +@Configuration +public class OpenAIRestTemplateConfig { + + @Value("${openai.api.key}") + private String openaiApiKey; + + @Bean + @Qualifier("openaiRestTemplate") + public RestTemplate openaiRestTemplate() { + RestTemplate restTemplate = new RestTemplate(); + restTemplate.getInterceptors().add((request, body, execution) -> { + request.getHeaders().add("Authorization", "Bearer " + openaiApiKey); + return execution.execute(request, body); + }); + return restTemplate; + } +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/controller/ChatController.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/controller/ChatController.java new file mode 100644 index 0000000000..4cd65580dc --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/controller/ChatController.java @@ -0,0 +1,44 @@ +package com.baeldung.openapi.controller; + +import com.baeldung.openapi.dto.ChatRequest; +import com.baeldung.openapi.dto.ChatResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.client.RestTemplate; + +@RestController +public class ChatController { + + @Qualifier("openaiRestTemplate") + @Autowired + private RestTemplate restTemplate; + + @Value("${openai.model}") + private String model; + + @Value("${openai.api.url}") + private String apiUrl; + + @GetMapping("/chat") + public String chat(@RequestParam String prompt) { + // create a request + ChatRequest request = new ChatRequest(model, prompt); + + // call the API + ChatResponse response = restTemplate.postForObject( + apiUrl, + request, + ChatResponse.class); + + if (response == null || response.getChoices() == null || response.getChoices().isEmpty()) { + return "No response"; + } + + // return the first response + return response.getChoices().get(0).getMessage().getContent(); + } +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/ChatRequest.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/ChatRequest.java new file mode 100644 index 0000000000..1e32b937ce --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/ChatRequest.java @@ -0,0 +1,32 @@ +package com.baeldung.openapi.dto; + +import java.util.ArrayList; +import java.util.List; + +public class ChatRequest { + private String model; + private List messages; + + public ChatRequest(String model, String prompt) { + this.model = model; + + this.messages = new ArrayList<>(); + this.messages.add(new Message("user", prompt)); + } + + public String getModel() { + return model; + } + + public void setModel(String model) { + this.model = model; + } + + public List getMessages() { + return messages; + } + + public void setMessages(List messages) { + this.messages = messages; + } +} diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/ChatResponse.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/ChatResponse.java new file mode 100644 index 0000000000..937e2d87db --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/ChatResponse.java @@ -0,0 +1,38 @@ +package com.baeldung.openapi.dto; + +import java.util.List; + +public class ChatResponse { + + private List choices; + + public static class Choice { + + private int index; + private Message message; + + public int getIndex() { + return index; + } + + public void setIndex(int index) { + this.index = index; + } + + public Message getMessage() { + return message; + } + + public void setMessage(Message message) { + this.message = message; + } + } + + public List getChoices() { + return choices; + } + + public void setChoices(List choices) { + this.choices = choices; + } +} diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/Message.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/Message.java new file mode 100644 index 0000000000..242cf4e89f --- /dev/null +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/dto/Message.java @@ -0,0 +1,31 @@ +package com.baeldung.openapi.dto; + +public class Message { + + private String role; + private String content; + + Message(String role, String content) { + this.role = role; + this.content = content; + } + + Message() { + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties b/spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties index a18eda349a..47b2973fca 100644 --- a/spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/resources/application.properties @@ -47,4 +47,8 @@ resilience4j.ratelimiter.instances.rateLimiterApi.limit-refresh-period=60s resilience4j.ratelimiter.instances.rateLimiterApi.timeout-duration=0s resilience4j.ratelimiter.instances.rateLimiterApi.allow-health-indicator-to-fail=true resilience4j.ratelimiter.instances.rateLimiterApi.subscribe-for-events=true -resilience4j.ratelimiter.instances.rateLimiterApi.event-consumer-buffer-size=50 \ No newline at end of file +resilience4j.ratelimiter.instances.rateLimiterApi.event-consumer-buffer-size=50 + +openai.model=gpt-3.5-turbo +openai.api.url=https://api.openai.com/v1/chat/completions +openai.api.key=your-api-key \ No newline at end of file From 828805295d5724696fee21c42adad365a61a91c3 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Sat, 22 Apr 2023 15:50:55 +0530 Subject: [PATCH 04/51] JAVA-20381 Moved modules --- .../dependency-exclusion}/README.md | 0 .../core-java-exclusions/pom.xml | 0 .../ExcludeDirectDependencyUnitTest.java | 0 .../dummy-surefire-junit47/pom.xml | 0 .../dependency-exclusion}/pom.xml | 3 +-- maven-modules/pom.xml | 22 ++++++++++--------- .../spring-bom}/README.md | 0 .../spring-bom}/pom.xml | 4 ++-- .../baeldung/spring/bom/HelloWorldApp.java | 0 .../baeldung/spring/bom/HelloWorldBean.java | 0 .../baeldung/spring/bom/HelloWorldConfig.java | 0 .../src/main/resources/logback.xml | 0 .../java/com/baeldung/SpringContextTest.java | 0 .../apache-rocketmq}/README.md | 0 .../apache-rocketmq}/pom.xml | 4 ++-- .../rocketmq/consumer/CartEventConsumer.java | 0 .../rocketmq/event/CartItemEvent.java | 0 .../rocketmq/producer/CartEventProducer.java | 0 .../transaction/TransactionListenerImpl.java | 0 .../src/main/resources/application.properties | 0 messaging-modules/pom.xml | 1 + pom.xml | 8 ------- .../discord4j}/.gitignore | 0 .../discord4j}/README.md | 0 {discord4j => saas-modules/discord4j}/pom.xml | 5 ++--- .../baeldung/discordbot/BotConfiguration.java | 0 .../discordbot/DiscordBotApplication.java | 0 .../discordbot/events/EventListener.java | 0 .../events/MessageCreateListener.java | 0 .../discordbot/events/MessageListener.java | 0 .../events/MessageUpdateListener.java | 0 .../src/main/resources/application.yml | 0 .../discordbot/DiscordBotLiveTest.java | 0 saas-modules/pom.xml | 4 +++- {slack => saas-modules/slack}/README.md | 0 {slack => saas-modules/slack}/pom.xml | 2 +- .../examples/slack/DiskSpaceErrorChecker.java | 0 .../baeldung/examples/slack/ErrorChecker.java | 0 .../examples/slack/ErrorReporter.java | 0 .../baeldung/examples/slack/MainClass.java | 0 .../slack/SlackChannelErrorReporter.java | 0 .../slack/SlackUserErrorReporter.java | 0 .../slack}/src/main/resources/logback.xml | 0 43 files changed, 24 insertions(+), 29 deletions(-) rename {dependency-exclusion => maven-modules/dependency-exclusion}/README.md (100%) rename {dependency-exclusion => maven-modules/dependency-exclusion}/core-java-exclusions/pom.xml (100%) rename {dependency-exclusion => maven-modules/dependency-exclusion}/core-java-exclusions/src/test/java/com/sample/project/tests/ExcludeDirectDependencyUnitTest.java (100%) rename {dependency-exclusion => maven-modules/dependency-exclusion}/dummy-surefire-junit47/pom.xml (100%) rename {dependency-exclusion => maven-modules/dependency-exclusion}/pom.xml (96%) rename {spring-bom => maven-modules/spring-bom}/README.md (100%) rename {spring-bom => maven-modules/spring-bom}/pom.xml (93%) rename {spring-bom => maven-modules/spring-bom}/src/main/java/com/baeldung/spring/bom/HelloWorldApp.java (100%) rename {spring-bom => maven-modules/spring-bom}/src/main/java/com/baeldung/spring/bom/HelloWorldBean.java (100%) rename {spring-bom => maven-modules/spring-bom}/src/main/java/com/baeldung/spring/bom/HelloWorldConfig.java (100%) rename {spring-bom => maven-modules/spring-bom}/src/main/resources/logback.xml (100%) rename {spring-bom => maven-modules/spring-bom}/src/test/java/com/baeldung/SpringContextTest.java (100%) rename {apache-rocketmq => messaging-modules/apache-rocketmq}/README.md (100%) rename {apache-rocketmq => messaging-modules/apache-rocketmq}/pom.xml (89%) rename {apache-rocketmq => messaging-modules/apache-rocketmq}/src/main/java/com/baeldung/rocketmq/consumer/CartEventConsumer.java (100%) rename {apache-rocketmq => messaging-modules/apache-rocketmq}/src/main/java/com/baeldung/rocketmq/event/CartItemEvent.java (100%) rename {apache-rocketmq => messaging-modules/apache-rocketmq}/src/main/java/com/baeldung/rocketmq/producer/CartEventProducer.java (100%) rename {apache-rocketmq => messaging-modules/apache-rocketmq}/src/main/java/com/baeldung/rocketmq/transaction/TransactionListenerImpl.java (100%) rename {apache-rocketmq => messaging-modules/apache-rocketmq}/src/main/resources/application.properties (100%) rename {discord4j => saas-modules/discord4j}/.gitignore (100%) rename {discord4j => saas-modules/discord4j}/README.md (100%) rename {discord4j => saas-modules/discord4j}/pom.xml (92%) rename {discord4j => saas-modules/discord4j}/src/main/java/com/baeldung/discordbot/BotConfiguration.java (100%) rename {discord4j => saas-modules/discord4j}/src/main/java/com/baeldung/discordbot/DiscordBotApplication.java (100%) rename {discord4j => saas-modules/discord4j}/src/main/java/com/baeldung/discordbot/events/EventListener.java (100%) rename {discord4j => saas-modules/discord4j}/src/main/java/com/baeldung/discordbot/events/MessageCreateListener.java (100%) rename {discord4j => saas-modules/discord4j}/src/main/java/com/baeldung/discordbot/events/MessageListener.java (100%) rename {discord4j => saas-modules/discord4j}/src/main/java/com/baeldung/discordbot/events/MessageUpdateListener.java (100%) rename {discord4j => saas-modules/discord4j}/src/main/resources/application.yml (100%) rename {discord4j => saas-modules/discord4j}/src/test/java/com/baeldung/discordbot/DiscordBotLiveTest.java (100%) rename {slack => saas-modules/slack}/README.md (100%) rename {slack => saas-modules/slack}/pom.xml (97%) rename {slack => saas-modules/slack}/src/main/java/com/baeldung/examples/slack/DiskSpaceErrorChecker.java (100%) rename {slack => saas-modules/slack}/src/main/java/com/baeldung/examples/slack/ErrorChecker.java (100%) rename {slack => saas-modules/slack}/src/main/java/com/baeldung/examples/slack/ErrorReporter.java (100%) rename {slack => saas-modules/slack}/src/main/java/com/baeldung/examples/slack/MainClass.java (100%) rename {slack => saas-modules/slack}/src/main/java/com/baeldung/examples/slack/SlackChannelErrorReporter.java (100%) rename {slack => saas-modules/slack}/src/main/java/com/baeldung/examples/slack/SlackUserErrorReporter.java (100%) rename {slack => saas-modules/slack}/src/main/resources/logback.xml (100%) diff --git a/dependency-exclusion/README.md b/maven-modules/dependency-exclusion/README.md similarity index 100% rename from dependency-exclusion/README.md rename to maven-modules/dependency-exclusion/README.md diff --git a/dependency-exclusion/core-java-exclusions/pom.xml b/maven-modules/dependency-exclusion/core-java-exclusions/pom.xml similarity index 100% rename from dependency-exclusion/core-java-exclusions/pom.xml rename to maven-modules/dependency-exclusion/core-java-exclusions/pom.xml diff --git a/dependency-exclusion/core-java-exclusions/src/test/java/com/sample/project/tests/ExcludeDirectDependencyUnitTest.java b/maven-modules/dependency-exclusion/core-java-exclusions/src/test/java/com/sample/project/tests/ExcludeDirectDependencyUnitTest.java similarity index 100% rename from dependency-exclusion/core-java-exclusions/src/test/java/com/sample/project/tests/ExcludeDirectDependencyUnitTest.java rename to maven-modules/dependency-exclusion/core-java-exclusions/src/test/java/com/sample/project/tests/ExcludeDirectDependencyUnitTest.java diff --git a/dependency-exclusion/dummy-surefire-junit47/pom.xml b/maven-modules/dependency-exclusion/dummy-surefire-junit47/pom.xml similarity index 100% rename from dependency-exclusion/dummy-surefire-junit47/pom.xml rename to maven-modules/dependency-exclusion/dummy-surefire-junit47/pom.xml diff --git a/dependency-exclusion/pom.xml b/maven-modules/dependency-exclusion/pom.xml similarity index 96% rename from dependency-exclusion/pom.xml rename to maven-modules/dependency-exclusion/pom.xml index ac83cc161a..13de16a57c 100644 --- a/dependency-exclusion/pom.xml +++ b/maven-modules/dependency-exclusion/pom.xml @@ -10,9 +10,8 @@ com.baeldung - parent-java + maven-modules 0.0.1-SNAPSHOT - ../parent-java diff --git a/maven-modules/pom.xml b/maven-modules/pom.xml index a7a3522ca8..dae55f1617 100644 --- a/maven-modules/pom.xml +++ b/maven-modules/pom.xml @@ -16,33 +16,35 @@ animal-sniffer-mvn-plugin - maven-archetype compiler-plugin-java-9 + dependency-exclusion + host-maven-repo-example + maven-archetype + maven-builder-plugin + maven-classifier maven-copy-files maven-custom-plugin maven-exec-plugin maven-generate-war maven-integration-test maven-multi-source + maven-parent-pom-resolution maven-plugins maven-polyglot + maven-printing-plugins maven-properties + maven-reactor + maven-repositories + maven-simple + maven-surefire-plugin maven-unused-dependencies maven-war-plugin + spring-bom optional-dependencies version-collision version-overriding-plugins versions-maven-plugin - maven-printing-plugins - maven-builder-plugin - host-maven-repo-example - maven-surefire-plugin - maven-parent-pom-resolution - maven-simple - maven-classifier - maven-repositories - maven-reactor diff --git a/spring-bom/README.md b/maven-modules/spring-bom/README.md similarity index 100% rename from spring-bom/README.md rename to maven-modules/spring-bom/README.md diff --git a/spring-bom/pom.xml b/maven-modules/spring-bom/pom.xml similarity index 93% rename from spring-bom/pom.xml rename to maven-modules/spring-bom/pom.xml index 7ba21ee285..93d0bdc458 100644 --- a/spring-bom/pom.xml +++ b/maven-modules/spring-bom/pom.xml @@ -10,8 +10,8 @@ com.baeldung - parent-modules - 1.0.0-SNAPSHOT + maven-modules + 0.0.1-SNAPSHOT diff --git a/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldApp.java b/maven-modules/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldApp.java similarity index 100% rename from spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldApp.java rename to maven-modules/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldApp.java diff --git a/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldBean.java b/maven-modules/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldBean.java similarity index 100% rename from spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldBean.java rename to maven-modules/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldBean.java diff --git a/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldConfig.java b/maven-modules/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldConfig.java similarity index 100% rename from spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldConfig.java rename to maven-modules/spring-bom/src/main/java/com/baeldung/spring/bom/HelloWorldConfig.java diff --git a/spring-bom/src/main/resources/logback.xml b/maven-modules/spring-bom/src/main/resources/logback.xml similarity index 100% rename from spring-bom/src/main/resources/logback.xml rename to maven-modules/spring-bom/src/main/resources/logback.xml diff --git a/spring-bom/src/test/java/com/baeldung/SpringContextTest.java b/maven-modules/spring-bom/src/test/java/com/baeldung/SpringContextTest.java similarity index 100% rename from spring-bom/src/test/java/com/baeldung/SpringContextTest.java rename to maven-modules/spring-bom/src/test/java/com/baeldung/SpringContextTest.java diff --git a/apache-rocketmq/README.md b/messaging-modules/apache-rocketmq/README.md similarity index 100% rename from apache-rocketmq/README.md rename to messaging-modules/apache-rocketmq/README.md diff --git a/apache-rocketmq/pom.xml b/messaging-modules/apache-rocketmq/pom.xml similarity index 89% rename from apache-rocketmq/pom.xml rename to messaging-modules/apache-rocketmq/pom.xml index 48399b6d51..a362644de3 100644 --- a/apache-rocketmq/pom.xml +++ b/messaging-modules/apache-rocketmq/pom.xml @@ -9,8 +9,8 @@ com.baeldung - parent-modules - 1.0.0-SNAPSHOT + messaging-modules + 0.0.1-SNAPSHOT diff --git a/apache-rocketmq/src/main/java/com/baeldung/rocketmq/consumer/CartEventConsumer.java b/messaging-modules/apache-rocketmq/src/main/java/com/baeldung/rocketmq/consumer/CartEventConsumer.java similarity index 100% rename from apache-rocketmq/src/main/java/com/baeldung/rocketmq/consumer/CartEventConsumer.java rename to messaging-modules/apache-rocketmq/src/main/java/com/baeldung/rocketmq/consumer/CartEventConsumer.java diff --git a/apache-rocketmq/src/main/java/com/baeldung/rocketmq/event/CartItemEvent.java b/messaging-modules/apache-rocketmq/src/main/java/com/baeldung/rocketmq/event/CartItemEvent.java similarity index 100% rename from apache-rocketmq/src/main/java/com/baeldung/rocketmq/event/CartItemEvent.java rename to messaging-modules/apache-rocketmq/src/main/java/com/baeldung/rocketmq/event/CartItemEvent.java diff --git a/apache-rocketmq/src/main/java/com/baeldung/rocketmq/producer/CartEventProducer.java b/messaging-modules/apache-rocketmq/src/main/java/com/baeldung/rocketmq/producer/CartEventProducer.java similarity index 100% rename from apache-rocketmq/src/main/java/com/baeldung/rocketmq/producer/CartEventProducer.java rename to messaging-modules/apache-rocketmq/src/main/java/com/baeldung/rocketmq/producer/CartEventProducer.java diff --git a/apache-rocketmq/src/main/java/com/baeldung/rocketmq/transaction/TransactionListenerImpl.java b/messaging-modules/apache-rocketmq/src/main/java/com/baeldung/rocketmq/transaction/TransactionListenerImpl.java similarity index 100% rename from apache-rocketmq/src/main/java/com/baeldung/rocketmq/transaction/TransactionListenerImpl.java rename to messaging-modules/apache-rocketmq/src/main/java/com/baeldung/rocketmq/transaction/TransactionListenerImpl.java diff --git a/apache-rocketmq/src/main/resources/application.properties b/messaging-modules/apache-rocketmq/src/main/resources/application.properties similarity index 100% rename from apache-rocketmq/src/main/resources/application.properties rename to messaging-modules/apache-rocketmq/src/main/resources/application.properties diff --git a/messaging-modules/pom.xml b/messaging-modules/pom.xml index 47e0730148..71ff25d71b 100644 --- a/messaging-modules/pom.xml +++ b/messaging-modules/pom.xml @@ -16,6 +16,7 @@ apache-camel + apache-rocketmq jgroups rabbitmq spring-amqp diff --git a/pom.xml b/pom.xml index bef7603cff..a80ee4430c 100644 --- a/pom.xml +++ b/pom.xml @@ -413,7 +413,6 @@ spring-4 spring-aop - spring-bom spring-cloud-modules @@ -593,7 +592,6 @@ spring-4 - spring-bom spring-cloud-modules @@ -838,7 +836,6 @@ apache-olingo apache-poi-2 - apache-rocketmq apache-thrift apache-tika @@ -851,7 +848,6 @@ bazel google-auto-project ddd - discord4j disruptor dozer dubbo @@ -908,7 +904,6 @@ protobuffer reactor-core rsocket - slack @@ -1089,7 +1084,6 @@ apache-olingo apache-poi-2 - apache-rocketmq apache-thrift apache-tika @@ -1102,7 +1096,6 @@ bazel google-auto-project ddd - discord4j disruptor dozer @@ -1161,7 +1154,6 @@ protobuffer reactor-core rsocket - slack diff --git a/discord4j/.gitignore b/saas-modules/discord4j/.gitignore similarity index 100% rename from discord4j/.gitignore rename to saas-modules/discord4j/.gitignore diff --git a/discord4j/README.md b/saas-modules/discord4j/README.md similarity index 100% rename from discord4j/README.md rename to saas-modules/discord4j/README.md diff --git a/discord4j/pom.xml b/saas-modules/discord4j/pom.xml similarity index 92% rename from discord4j/pom.xml rename to saas-modules/discord4j/pom.xml index 086adebee5..ff398dd1a3 100644 --- a/discord4j/pom.xml +++ b/saas-modules/discord4j/pom.xml @@ -9,9 +9,8 @@ com.baeldung - parent-boot-2 - 0.0.1-SNAPSHOT - ../parent-boot-2 + saas-modules + 1.0.0-SNAPSHOT diff --git a/discord4j/src/main/java/com/baeldung/discordbot/BotConfiguration.java b/saas-modules/discord4j/src/main/java/com/baeldung/discordbot/BotConfiguration.java similarity index 100% rename from discord4j/src/main/java/com/baeldung/discordbot/BotConfiguration.java rename to saas-modules/discord4j/src/main/java/com/baeldung/discordbot/BotConfiguration.java diff --git a/discord4j/src/main/java/com/baeldung/discordbot/DiscordBotApplication.java b/saas-modules/discord4j/src/main/java/com/baeldung/discordbot/DiscordBotApplication.java similarity index 100% rename from discord4j/src/main/java/com/baeldung/discordbot/DiscordBotApplication.java rename to saas-modules/discord4j/src/main/java/com/baeldung/discordbot/DiscordBotApplication.java diff --git a/discord4j/src/main/java/com/baeldung/discordbot/events/EventListener.java b/saas-modules/discord4j/src/main/java/com/baeldung/discordbot/events/EventListener.java similarity index 100% rename from discord4j/src/main/java/com/baeldung/discordbot/events/EventListener.java rename to saas-modules/discord4j/src/main/java/com/baeldung/discordbot/events/EventListener.java diff --git a/discord4j/src/main/java/com/baeldung/discordbot/events/MessageCreateListener.java b/saas-modules/discord4j/src/main/java/com/baeldung/discordbot/events/MessageCreateListener.java similarity index 100% rename from discord4j/src/main/java/com/baeldung/discordbot/events/MessageCreateListener.java rename to saas-modules/discord4j/src/main/java/com/baeldung/discordbot/events/MessageCreateListener.java diff --git a/discord4j/src/main/java/com/baeldung/discordbot/events/MessageListener.java b/saas-modules/discord4j/src/main/java/com/baeldung/discordbot/events/MessageListener.java similarity index 100% rename from discord4j/src/main/java/com/baeldung/discordbot/events/MessageListener.java rename to saas-modules/discord4j/src/main/java/com/baeldung/discordbot/events/MessageListener.java diff --git a/discord4j/src/main/java/com/baeldung/discordbot/events/MessageUpdateListener.java b/saas-modules/discord4j/src/main/java/com/baeldung/discordbot/events/MessageUpdateListener.java similarity index 100% rename from discord4j/src/main/java/com/baeldung/discordbot/events/MessageUpdateListener.java rename to saas-modules/discord4j/src/main/java/com/baeldung/discordbot/events/MessageUpdateListener.java diff --git a/discord4j/src/main/resources/application.yml b/saas-modules/discord4j/src/main/resources/application.yml similarity index 100% rename from discord4j/src/main/resources/application.yml rename to saas-modules/discord4j/src/main/resources/application.yml diff --git a/discord4j/src/test/java/com/baeldung/discordbot/DiscordBotLiveTest.java b/saas-modules/discord4j/src/test/java/com/baeldung/discordbot/DiscordBotLiveTest.java similarity index 100% rename from discord4j/src/test/java/com/baeldung/discordbot/DiscordBotLiveTest.java rename to saas-modules/discord4j/src/test/java/com/baeldung/discordbot/DiscordBotLiveTest.java diff --git a/saas-modules/pom.xml b/saas-modules/pom.xml index 7e8adebdd9..16ed50918c 100644 --- a/saas-modules/pom.xml +++ b/saas-modules/pom.xml @@ -16,11 +16,13 @@ + discord4j jira-rest-integration + sentry-servlet + slack stripe twilio twitter4j - sentry-servlet diff --git a/slack/README.md b/saas-modules/slack/README.md similarity index 100% rename from slack/README.md rename to saas-modules/slack/README.md diff --git a/slack/pom.xml b/saas-modules/slack/pom.xml similarity index 97% rename from slack/pom.xml rename to saas-modules/slack/pom.xml index 690bf5132c..326167c055 100644 --- a/slack/pom.xml +++ b/saas-modules/slack/pom.xml @@ -11,7 +11,7 @@ com.baeldung - parent-modules + saas-modules 1.0.0-SNAPSHOT diff --git a/slack/src/main/java/com/baeldung/examples/slack/DiskSpaceErrorChecker.java b/saas-modules/slack/src/main/java/com/baeldung/examples/slack/DiskSpaceErrorChecker.java similarity index 100% rename from slack/src/main/java/com/baeldung/examples/slack/DiskSpaceErrorChecker.java rename to saas-modules/slack/src/main/java/com/baeldung/examples/slack/DiskSpaceErrorChecker.java diff --git a/slack/src/main/java/com/baeldung/examples/slack/ErrorChecker.java b/saas-modules/slack/src/main/java/com/baeldung/examples/slack/ErrorChecker.java similarity index 100% rename from slack/src/main/java/com/baeldung/examples/slack/ErrorChecker.java rename to saas-modules/slack/src/main/java/com/baeldung/examples/slack/ErrorChecker.java diff --git a/slack/src/main/java/com/baeldung/examples/slack/ErrorReporter.java b/saas-modules/slack/src/main/java/com/baeldung/examples/slack/ErrorReporter.java similarity index 100% rename from slack/src/main/java/com/baeldung/examples/slack/ErrorReporter.java rename to saas-modules/slack/src/main/java/com/baeldung/examples/slack/ErrorReporter.java diff --git a/slack/src/main/java/com/baeldung/examples/slack/MainClass.java b/saas-modules/slack/src/main/java/com/baeldung/examples/slack/MainClass.java similarity index 100% rename from slack/src/main/java/com/baeldung/examples/slack/MainClass.java rename to saas-modules/slack/src/main/java/com/baeldung/examples/slack/MainClass.java diff --git a/slack/src/main/java/com/baeldung/examples/slack/SlackChannelErrorReporter.java b/saas-modules/slack/src/main/java/com/baeldung/examples/slack/SlackChannelErrorReporter.java similarity index 100% rename from slack/src/main/java/com/baeldung/examples/slack/SlackChannelErrorReporter.java rename to saas-modules/slack/src/main/java/com/baeldung/examples/slack/SlackChannelErrorReporter.java diff --git a/slack/src/main/java/com/baeldung/examples/slack/SlackUserErrorReporter.java b/saas-modules/slack/src/main/java/com/baeldung/examples/slack/SlackUserErrorReporter.java similarity index 100% rename from slack/src/main/java/com/baeldung/examples/slack/SlackUserErrorReporter.java rename to saas-modules/slack/src/main/java/com/baeldung/examples/slack/SlackUserErrorReporter.java diff --git a/slack/src/main/resources/logback.xml b/saas-modules/slack/src/main/resources/logback.xml similarity index 100% rename from slack/src/main/resources/logback.xml rename to saas-modules/slack/src/main/resources/logback.xml From c4ccc310083ac5cb384c5bb9f7f86b6cd0de0e0a Mon Sep 17 00:00:00 2001 From: Abhinav Pandey Date: Sun, 23 Apr 2023 14:02:10 +0530 Subject: [PATCH 05/51] BAEL-6355 - OpenAI API with Spring Boot - review comment incorporated --- .../baeldung/openapi/controller/ChatController.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/controller/ChatController.java b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/controller/ChatController.java index 4cd65580dc..129d233582 100644 --- a/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/controller/ChatController.java +++ b/spring-boot-modules/spring-boot-libraries-2/src/main/java/com/baeldung/openapi/controller/ChatController.java @@ -23,12 +23,17 @@ public class ChatController { @Value("${openai.api.url}") private String apiUrl; + /** + * Creates a chat request and sends it to the OpenAI API + * Returns the first message from the API response + * + * @param prompt the prompt to send to the API + * @return first message from the API response + */ @GetMapping("/chat") public String chat(@RequestParam String prompt) { - // create a request ChatRequest request = new ChatRequest(model, prompt); - // call the API ChatResponse response = restTemplate.postForObject( apiUrl, request, @@ -38,7 +43,6 @@ public class ChatController { return "No response"; } - // return the first response return response.getChoices().get(0).getMessage().getContent(); } } \ No newline at end of file From 2efc27170d40a9d8e985ae5231748610870afdff Mon Sep 17 00:00:00 2001 From: achraftt Date: Sun, 23 Apr 2023 18:59:19 +0200 Subject: [PATCH 06/51] BAEL-6303: Encode passwords with Spring Boot CLI --- spring-boot-modules/spring-boot-cli/pom.xml | 38 ++++++++++++++ .../main/java/com/baeldung/Application.java | 12 +++++ .../baeldung/controller/LoginController.java | 13 +++++ .../src/main/resources/application.properties | 3 ++ .../encoding/PasswordEncodingUnitTest.java | 51 +++++++++++++++++++ 5 files changed, 117 insertions(+) create mode 100644 spring-boot-modules/spring-boot-cli/pom.xml create mode 100644 spring-boot-modules/spring-boot-cli/src/main/java/com/baeldung/Application.java create mode 100644 spring-boot-modules/spring-boot-cli/src/main/java/com/baeldung/controller/LoginController.java create mode 100644 spring-boot-modules/spring-boot-cli/src/main/resources/application.properties create mode 100644 spring-boot-modules/spring-boot-cli/src/test/java/com/baeldung/encoding/PasswordEncodingUnitTest.java diff --git a/spring-boot-modules/spring-boot-cli/pom.xml b/spring-boot-modules/spring-boot-cli/pom.xml new file mode 100644 index 0000000000..d2c50590ab --- /dev/null +++ b/spring-boot-modules/spring-boot-cli/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + spring-boot-cli + spring-boot-cli + jar + + + + com.baeldung.spring-boot-modules + spring-boot-modules + 1.0.0-SNAPSHOT + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.security + spring-security-test + test + + + + \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-cli/src/main/java/com/baeldung/Application.java b/spring-boot-modules/spring-boot-cli/src/main/java/com/baeldung/Application.java new file mode 100644 index 0000000000..c0490d50c6 --- /dev/null +++ b/spring-boot-modules/spring-boot-cli/src/main/java/com/baeldung/Application.java @@ -0,0 +1,12 @@ +package com.baeldung; + +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-boot-modules/spring-boot-cli/src/main/java/com/baeldung/controller/LoginController.java b/spring-boot-modules/spring-boot-cli/src/main/java/com/baeldung/controller/LoginController.java new file mode 100644 index 0000000000..b678f63623 --- /dev/null +++ b/spring-boot-modules/spring-boot-cli/src/main/java/com/baeldung/controller/LoginController.java @@ -0,0 +1,13 @@ +package com.baeldung.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class LoginController { + + @GetMapping("/") + public String hello() { + return "Hello World!"; + } +} diff --git a/spring-boot-modules/spring-boot-cli/src/main/resources/application.properties b/spring-boot-modules/spring-boot-cli/src/main/resources/application.properties new file mode 100644 index 0000000000..4b341094a1 --- /dev/null +++ b/spring-boot-modules/spring-boot-cli/src/main/resources/application.properties @@ -0,0 +1,3 @@ +spring.security.user.name=baeldung +# Encoded password with SpringBoot CLI, the decoded password is baeldungPassword +spring.security.user.password={bcrypt}$2y$10$R8VIwFiQ7aUST17YqMaWJuxjkCYqk3jjPlSxyDLLzqCTOwFuJNq2a \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-cli/src/test/java/com/baeldung/encoding/PasswordEncodingUnitTest.java b/spring-boot-modules/spring-boot-cli/src/test/java/com/baeldung/encoding/PasswordEncodingUnitTest.java new file mode 100644 index 0000000000..8939029f71 --- /dev/null +++ b/spring-boot-modules/spring-boot-cli/src/test/java/com/baeldung/encoding/PasswordEncodingUnitTest.java @@ -0,0 +1,51 @@ +package com.baeldung.encoding; + +import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.httpBasic; +import static org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.springSecurity; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import org.junit.Before; +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.test.context.junit4.SpringRunner; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +@RunWith(SpringRunner.class) +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@AutoConfigureMockMvc +public class PasswordEncodingUnitTest { + private final static String userName = "baeldung"; + private final static String passwordDecoded = "baeldungPassword"; + + private MockMvc mvc; + + @Autowired + private WebApplicationContext webApplicationContext; + + @Before + public void setup() { + mvc = MockMvcBuilders.webAppContextSetup(webApplicationContext) + .apply(springSecurity()) + .build(); + } + + @Test + public void givenRequestWithWrongPassword_shouldFailWith401() throws Exception { + mvc.perform(get("/").with(httpBasic(userName, "wrongPassword"))) + .andExpect(status().isUnauthorized()); + + } + + @Test + public void givenRequestWithCorrectDecodedPassword_houldSucceedWith200() throws Exception { + mvc.perform(get("/").with(httpBasic(userName, passwordDecoded))) + .andExpect(status().isOk()); + + } +} \ No newline at end of file From 90f2d165bf4348c4bc52db6ce424ae0dedd9c802 Mon Sep 17 00:00:00 2001 From: anuragkumawat Date: Mon, 24 Apr 2023 13:10:47 +0530 Subject: [PATCH 07/51] JAVA-20496 Non-article code: rawtypes and sandbox packages (#13886) * JAVA-14232 Dissolving core-java module completed --- .../sandbox/SandboxJavaManualTest.java | 0 .../baeldung/rawtypes/RawTypesUnitTest.java | 0 .../java/com/baeldung/staticclass/Pizza.java | 0 .../map/Java8MapAndFlatMapUnitTest.java} | 4 +- core-java-modules/core-java/.gitignore | 25 --- core-java-modules/core-java/README.md | 4 - core-java-modules/core-java/customers.xml | 95 ---------- .../core-java/externalizable.txt | Bin 106 -> 0 bytes core-java-modules/core-java/pom.xml | 174 ------------------ .../src/main/java/com/baeldung/.gitignore | 13 -- .../executable/ExecutableMavenJar.java | 11 -- .../filesystem/jndi/LookupFSJNDI.java | 42 ----- .../PostJSONWithHttpURLConnection.java | 46 ----- .../core-java/src/main/java/log4j.properties | 9 - .../src/main/resources/META-INF/BenchmarkList | 0 .../src/main/resources/META-INF/MANIFEST.MF | 5 - .../main/resources/META-INF/persistence.xml | 20 -- .../src/main/resources/countries.properties | 3 - .../src/main/resources/datasource.properties | 6 - .../src/main/resources/log4j.properties | 6 - .../core-java/src/main/resources/log4j2.xml | 13 -- .../resources/log4jstructuraldp.properties | 9 - .../core-java/src/main/resources/logback.xml | 19 -- .../core-java/src/main/resources/product.png | Bin 55272 -> 0 bytes .../arrays/ArraysJoinAndSplitJUnitTest.java | 41 ----- .../java/com/baeldung/stringisnumeric.zip | Bin 3227 -> 0 bytes .../core-java/src/test/resources/.gitignore | 13 -- .../core-java/src/test/resources/newFile1.txt | 0 .../core-java/src/test/resources/newFile2.txt | 0 .../core-java/src/test/resources/newFile3.txt | 0 .../core-java/src/test/resources/original.txt | 2 - .../src/test/resources/sourceFile.txt | 0 .../core-java/src/test/resources/test.find | 1 - .../core-java/src/test/resources/test_read.in | 1 - .../src/test/resources/test_read1.in | 1 - .../src/test/resources/test_read2.in | 1 - .../src/test/resources/test_read3.in | 1 - .../src/test/resources/test_read4.in | Bin 7 -> 0 bytes .../src/test/resources/test_read7.in | 1 - .../src/test/resources/test_read8.in | 2 - .../src/test/resources/test_read_d.in | 1 - .../src/test/resources/test_read_multiple.in | 2 - core-java-modules/core-java/yofile.txt | Bin 98 -> 0 bytes core-java-modules/core-java/yofile2.txt | Bin 275 -> 0 bytes core-java-modules/pom.xml | 1 - pom.xml | 2 - .../baeldung/junit}/DivisibilityUnitTest.java | 2 +- .../baeldung/junit}/RegistrationUnitTest.java | 2 +- .../com/baeldung/junit}/SignInUnitTest.java | 2 +- .../baeldung/junit}/StringCaseUnitTest.java | 2 +- .../junitparams}/ParametrizedUnitTest.java | 3 +- .../baeldung/runfromjava}/SuiteUnitTest.java | 4 +- 52 files changed, 10 insertions(+), 579 deletions(-) rename core-java-modules/{core-java => core-java-concurrency-simple}/src/test/java/com/baeldung/sandbox/SandboxJavaManualTest.java (100%) rename core-java-modules/{core-java => core-java-lang-5}/src/test/java/com/baeldung/rawtypes/RawTypesUnitTest.java (100%) rename core-java-modules/{core-java => core-java-lang-oop-modifiers}/src/main/java/com/baeldung/staticclass/Pizza.java (100%) rename core-java-modules/{core-java/src/test/java/com/baeldung/java8/Java8MapAndFlatMap.java => core-java-streams-3/src/test/java/com/baeldung/streams/flatmap/map/Java8MapAndFlatMapUnitTest.java} (94%) delete mode 100644 core-java-modules/core-java/.gitignore delete mode 100644 core-java-modules/core-java/README.md delete mode 100644 core-java-modules/core-java/customers.xml delete mode 100644 core-java-modules/core-java/externalizable.txt delete mode 100644 core-java-modules/core-java/pom.xml delete mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/.gitignore delete mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/executable/ExecutableMavenJar.java delete mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/filesystem/jndi/LookupFSJNDI.java delete mode 100644 core-java-modules/core-java/src/main/java/com/baeldung/jsonposturlconnection/PostJSONWithHttpURLConnection.java delete mode 100644 core-java-modules/core-java/src/main/java/log4j.properties delete mode 100644 core-java-modules/core-java/src/main/resources/META-INF/BenchmarkList delete mode 100644 core-java-modules/core-java/src/main/resources/META-INF/MANIFEST.MF delete mode 100644 core-java-modules/core-java/src/main/resources/META-INF/persistence.xml delete mode 100644 core-java-modules/core-java/src/main/resources/countries.properties delete mode 100644 core-java-modules/core-java/src/main/resources/datasource.properties delete mode 100644 core-java-modules/core-java/src/main/resources/log4j.properties delete mode 100644 core-java-modules/core-java/src/main/resources/log4j2.xml delete mode 100644 core-java-modules/core-java/src/main/resources/log4jstructuraldp.properties delete mode 100644 core-java-modules/core-java/src/main/resources/logback.xml delete mode 100644 core-java-modules/core-java/src/main/resources/product.png delete mode 100644 core-java-modules/core-java/src/test/java/com/baeldung/arrays/ArraysJoinAndSplitJUnitTest.java delete mode 100644 core-java-modules/core-java/src/test/java/com/baeldung/stringisnumeric.zip delete mode 100644 core-java-modules/core-java/src/test/resources/.gitignore delete mode 100644 core-java-modules/core-java/src/test/resources/newFile1.txt delete mode 100644 core-java-modules/core-java/src/test/resources/newFile2.txt delete mode 100644 core-java-modules/core-java/src/test/resources/newFile3.txt delete mode 100644 core-java-modules/core-java/src/test/resources/original.txt delete mode 100644 core-java-modules/core-java/src/test/resources/sourceFile.txt delete mode 100644 core-java-modules/core-java/src/test/resources/test.find delete mode 100644 core-java-modules/core-java/src/test/resources/test_read.in delete mode 100644 core-java-modules/core-java/src/test/resources/test_read1.in delete mode 100644 core-java-modules/core-java/src/test/resources/test_read2.in delete mode 100644 core-java-modules/core-java/src/test/resources/test_read3.in delete mode 100644 core-java-modules/core-java/src/test/resources/test_read4.in delete mode 100644 core-java-modules/core-java/src/test/resources/test_read7.in delete mode 100644 core-java-modules/core-java/src/test/resources/test_read8.in delete mode 100644 core-java-modules/core-java/src/test/resources/test_read_d.in delete mode 100644 core-java-modules/core-java/src/test/resources/test_read_multiple.in delete mode 100644 core-java-modules/core-java/yofile.txt delete mode 100644 core-java-modules/core-java/yofile2.txt rename {core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng => testing-modules/junit-4/src/test/java/com/baeldung/junit}/DivisibilityUnitTest.java (90%) rename {core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng => testing-modules/junit-4/src/test/java/com/baeldung/junit}/RegistrationUnitTest.java (89%) rename {core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng => testing-modules/junit-4/src/test/java/com/baeldung/junit}/SignInUnitTest.java (89%) rename {core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng => testing-modules/junit-4/src/test/java/com/baeldung/junit}/StringCaseUnitTest.java (91%) rename {core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng => testing-modules/junit-4/src/test/java/com/baeldung/junitparams}/ParametrizedUnitTest.java (92%) rename {core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng => testing-modules/junit-4/src/test/java/com/baeldung/runfromjava}/SuiteUnitTest.java (61%) diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/sandbox/SandboxJavaManualTest.java b/core-java-modules/core-java-concurrency-simple/src/test/java/com/baeldung/sandbox/SandboxJavaManualTest.java similarity index 100% rename from core-java-modules/core-java/src/test/java/com/baeldung/sandbox/SandboxJavaManualTest.java rename to core-java-modules/core-java-concurrency-simple/src/test/java/com/baeldung/sandbox/SandboxJavaManualTest.java diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/rawtypes/RawTypesUnitTest.java b/core-java-modules/core-java-lang-5/src/test/java/com/baeldung/rawtypes/RawTypesUnitTest.java similarity index 100% rename from core-java-modules/core-java/src/test/java/com/baeldung/rawtypes/RawTypesUnitTest.java rename to core-java-modules/core-java-lang-5/src/test/java/com/baeldung/rawtypes/RawTypesUnitTest.java diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/staticclass/Pizza.java b/core-java-modules/core-java-lang-oop-modifiers/src/main/java/com/baeldung/staticclass/Pizza.java similarity index 100% rename from core-java-modules/core-java/src/main/java/com/baeldung/staticclass/Pizza.java rename to core-java-modules/core-java-lang-oop-modifiers/src/main/java/com/baeldung/staticclass/Pizza.java diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/java8/Java8MapAndFlatMap.java b/core-java-modules/core-java-streams-3/src/test/java/com/baeldung/streams/flatmap/map/Java8MapAndFlatMapUnitTest.java similarity index 94% rename from core-java-modules/core-java/src/test/java/com/baeldung/java8/Java8MapAndFlatMap.java rename to core-java-modules/core-java-streams-3/src/test/java/com/baeldung/streams/flatmap/map/Java8MapAndFlatMapUnitTest.java index a0bd1cf093..1b09ea25c6 100644 --- a/core-java-modules/core-java/src/test/java/com/baeldung/java8/Java8MapAndFlatMap.java +++ b/core-java-modules/core-java-streams-3/src/test/java/com/baeldung/streams/flatmap/map/Java8MapAndFlatMapUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.java8; +package com.baeldung.streams.flatmap.map; import org.junit.Test; @@ -12,7 +12,7 @@ import java.util.stream.Stream; import static java.util.Arrays.asList; import static org.junit.Assert.assertEquals; -public class Java8MapAndFlatMap { +public class Java8MapAndFlatMapUnitTest { @Test public void givenStream_whenCalledMap_thenProduceList() { diff --git a/core-java-modules/core-java/.gitignore b/core-java-modules/core-java/.gitignore deleted file mode 100644 index 374c8bf907..0000000000 --- a/core-java-modules/core-java/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -*.class - -0.* - -#folders# -/target -/neoDb* -/data -/src/main/webapp/WEB-INF/classes -*/META-INF/* -.resourceCache - -# Packaged files # -*.jar -*.war -*.ear - -# Files generated by integration tests -backup-pom.xml -/bin/ -/temp - -#IntelliJ specific -.idea/ -*.iml \ No newline at end of file diff --git a/core-java-modules/core-java/README.md b/core-java-modules/core-java/README.md deleted file mode 100644 index 47435106c0..0000000000 --- a/core-java-modules/core-java/README.md +++ /dev/null @@ -1,4 +0,0 @@ -## Core Java Cookbooks and Examples - -### Relevant Articles: - diff --git a/core-java-modules/core-java/customers.xml b/core-java-modules/core-java/customers.xml deleted file mode 100644 index b52dc27633..0000000000 --- a/core-java-modules/core-java/customers.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - SELECT * FROM customers - 1008 - - true - 1000 - 0 - 2 - - - - - 0 - 0 - 0 - true - ResultSet.TYPE_SCROLL_INSENSITIVE - false - customers - jdbc:h2:mem:testdb - - com.sun.rowset.providers.RIOptimisticProvider - Oracle Corporation - 1.0 - 2 - 1 - - - - 2 - - 1 - false - true - false - 0 - true - true - 11 - ID - ID - PUBLIC - 10 - 0 - CUSTOMERS - TESTDB - 4 - INTEGER - - - 2 - false - true - false - 0 - true - true - 50 - NAME - NAME - PUBLIC - 50 - 0 - CUSTOMERS - TESTDB - 12 - VARCHAR - - - - - 1 - Customer1 - - - 2 - Customer2 - - - 3 - Customer3 - - - 4 - Customer4 - - - 5 - Customer5 - - - diff --git a/core-java-modules/core-java/externalizable.txt b/core-java-modules/core-java/externalizable.txt deleted file mode 100644 index ddd3e143a8fdbd74d97d1d5fcbe6ef58ea78e1a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 106 zcmZ4UmVvcgm4V%{C^t1PGm(KkGPNkREHRIPfw7E%*EcmKvm~{sC^0WJF|W9YK{Yu) zS1&0sH7BJsFI_LS0w|Z4n3GwRn3R*M=bWFLTbh?yQYpAq{rFxjKM5uVMo$K&%#?}( I1_lOJ09uA3U;qFB diff --git a/core-java-modules/core-java/pom.xml b/core-java-modules/core-java/pom.xml deleted file mode 100644 index 14e9c92b58..0000000000 --- a/core-java-modules/core-java/pom.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - 4.0.0 - core-java - core-java - jar - - - com.baeldung.core-java-modules - core-java-modules - 0.0.1-SNAPSHOT - - - - - org.unix4j - unix4j-command - ${unix4j.version} - - - com.googlecode.grep4j - grep4j - ${grep4j.version} - - - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - - log4j - log4j - ${log4j.version} - - - org.slf4j - log4j-over-slf4j - ${org.slf4j.version} - - - org.projectlombok - lombok - ${lombok.version} - provided - - - org.springframework - spring-core - ${spring.core.version} - - - commons-io - commons-io - ${commons-io.version} - - - - - core-java - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - copy-dependencies - prepare-package - - copy-dependencies - - - ${project.build.directory}/libs - - - - - - org.codehaus.mojo - exec-maven-plugin - - java - com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed - - -Xmx300m - -XX:+UseParallelGC - -classpath - - com.baeldung.outofmemoryerror.OutOfMemoryGCLimitExceed - - - - - - - - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*ManualTest.java - - - **/*IntegrationTest.java - **/*IntTest.java - - - - - - - json - - - - - org.codehaus.mojo - exec-maven-plugin - - - run-benchmarks - - none - - exec - - - test - java - - -classpath - - org.openjdk.jmh.Main - .* - - - - - - - - - - - - - 0.4 - 1.8.7 - - 4.3.20.RELEASE - - - \ No newline at end of file diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/.gitignore b/core-java-modules/core-java/src/main/java/com/baeldung/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/core-java-modules/core-java/src/main/java/com/baeldung/.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 diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/executable/ExecutableMavenJar.java b/core-java-modules/core-java/src/main/java/com/baeldung/executable/ExecutableMavenJar.java deleted file mode 100644 index 6c79e89717..0000000000 --- a/core-java-modules/core-java/src/main/java/com/baeldung/executable/ExecutableMavenJar.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.baeldung.executable; - -import javax.swing.JOptionPane; - -public class ExecutableMavenJar { - - public static void main(String[] args) { - JOptionPane.showMessageDialog(null, "It worked!", "Executable Jar with Maven", 1); - } - -} diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/filesystem/jndi/LookupFSJNDI.java b/core-java-modules/core-java/src/main/java/com/baeldung/filesystem/jndi/LookupFSJNDI.java deleted file mode 100644 index 7e6bb5d3b2..0000000000 --- a/core-java-modules/core-java/src/main/java/com/baeldung/filesystem/jndi/LookupFSJNDI.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.baeldung.filesystem.jndi; - -import java.io.File; -import java.util.Hashtable; - -import javax.naming.Context; -import javax.naming.InitialContext; -import javax.naming.NamingException; - -public class LookupFSJNDI { - private InitialContext ctx = null; - - public LookupFSJNDI() throws NamingException { - super(); - init(); - } - - private void init() throws NamingException { - Hashtable env = new Hashtable(); - - env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); - // URI to namespace (actual directory) - env.put(Context.PROVIDER_URL, "file:./src/test/resources"); - - ctx = new InitialContext(env); - } - - public InitialContext getCtx() { - return ctx; - } - - public File getFile(String fileName) { - File file; - try { - file = (File) getCtx().lookup(fileName); - } catch (NamingException e) { - file = null; - } - return file; - } - -} diff --git a/core-java-modules/core-java/src/main/java/com/baeldung/jsonposturlconnection/PostJSONWithHttpURLConnection.java b/core-java-modules/core-java/src/main/java/com/baeldung/jsonposturlconnection/PostJSONWithHttpURLConnection.java deleted file mode 100644 index b2469ac984..0000000000 --- a/core-java-modules/core-java/src/main/java/com/baeldung/jsonposturlconnection/PostJSONWithHttpURLConnection.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.baeldung.jsonposturlconnection; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.net.HttpURLConnection; -import java.net.URL; - -public class PostJSONWithHttpURLConnection { - - public static void main (String []args) throws IOException{ - //Change the URL with any other publicly accessible POST resource, which accepts JSON request body - URL url = new URL ("https://reqres.in/api/users"); - - HttpURLConnection con = (HttpURLConnection)url.openConnection(); - con.setRequestMethod("POST"); - - con.setRequestProperty("Content-Type", "application/json; utf-8"); - con.setRequestProperty("Accept", "application/json"); - - con.setDoOutput(true); - - //JSON String need to be constructed for the specific resource. - //We may construct complex JSON using any third-party JSON libraries such as jackson or org.json - String jsonInputString = "{\"name\": \"Upendra\", \"job\": \"Programmer\"}"; - - try(OutputStream os = con.getOutputStream()){ - byte[] input = jsonInputString.getBytes("utf-8"); - os.write(input, 0, input.length); - } - - int code = con.getResponseCode(); - System.out.println(code); - - try(BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "utf-8"))){ - StringBuilder response = new StringBuilder(); - String responseLine = null; - while ((responseLine = br.readLine()) != null) { - response.append(responseLine.trim()); - } - System.out.println(response.toString()); - } - } - -} diff --git a/core-java-modules/core-java/src/main/java/log4j.properties b/core-java-modules/core-java/src/main/java/log4j.properties deleted file mode 100644 index 5fe42d854c..0000000000 --- a/core-java-modules/core-java/src/main/java/log4j.properties +++ /dev/null @@ -1,9 +0,0 @@ -# Set root logger level to DEBUG and its only appender to A1. -log4j.rootLogger=DEBUG, A1 - -# A1 is set to be a ConsoleAppender. -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n diff --git a/core-java-modules/core-java/src/main/resources/META-INF/BenchmarkList b/core-java-modules/core-java/src/main/resources/META-INF/BenchmarkList deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/core-java-modules/core-java/src/main/resources/META-INF/MANIFEST.MF b/core-java-modules/core-java/src/main/resources/META-INF/MANIFEST.MF deleted file mode 100644 index 988de3193d..0000000000 --- a/core-java-modules/core-java/src/main/resources/META-INF/MANIFEST.MF +++ /dev/null @@ -1,5 +0,0 @@ -Agent-Class: com.baeldung.instrumentation.agent.MyInstrumentationAgent -Can-Redefine-Classes: true -Can-Retransform-Classes: true -Premain-Class: com.baeldung.instrumentation.agent.MyInstrumentationAgent -Main-Class: com.baeldung.instrumentation.application.Launcher diff --git a/core-java-modules/core-java/src/main/resources/META-INF/persistence.xml b/core-java-modules/core-java/src/main/resources/META-INF/persistence.xml deleted file mode 100644 index 3966afdcda..0000000000 --- a/core-java-modules/core-java/src/main/resources/META-INF/persistence.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/core-java-modules/core-java/src/main/resources/countries.properties b/core-java-modules/core-java/src/main/resources/countries.properties deleted file mode 100644 index 50b5e85653..0000000000 --- a/core-java-modules/core-java/src/main/resources/countries.properties +++ /dev/null @@ -1,3 +0,0 @@ -UK -US -Germany \ No newline at end of file diff --git a/core-java-modules/core-java/src/main/resources/datasource.properties b/core-java-modules/core-java/src/main/resources/datasource.properties deleted file mode 100644 index 61df0d45f7..0000000000 --- a/core-java-modules/core-java/src/main/resources/datasource.properties +++ /dev/null @@ -1,6 +0,0 @@ -dataSourceClassName=//TBD -dataSource.user=//TBD -dataSource.password=//TBD -dataSource.databaseName=//TBD -dataSource.portNumber=//TBD -dataSource.serverName=//TBD \ No newline at end of file diff --git a/core-java-modules/core-java/src/main/resources/log4j.properties b/core-java-modules/core-java/src/main/resources/log4j.properties deleted file mode 100644 index 621cf01735..0000000000 --- a/core-java-modules/core-java/src/main/resources/log4j.properties +++ /dev/null @@ -1,6 +0,0 @@ -log4j.rootLogger=DEBUG, A1 - -log4j.appender.A1=org.apache.log4j.ConsoleAppender - -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n \ No newline at end of file diff --git a/core-java-modules/core-java/src/main/resources/log4j2.xml b/core-java-modules/core-java/src/main/resources/log4j2.xml deleted file mode 100644 index a824bef9b0..0000000000 --- a/core-java-modules/core-java/src/main/resources/log4j2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/core-java-modules/core-java/src/main/resources/log4jstructuraldp.properties b/core-java-modules/core-java/src/main/resources/log4jstructuraldp.properties deleted file mode 100644 index 5bc2bfe4b9..0000000000 --- a/core-java-modules/core-java/src/main/resources/log4jstructuraldp.properties +++ /dev/null @@ -1,9 +0,0 @@ - -# Root logger -log4j.rootLogger=INFO, file, stdout - -# Write to console -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.Target=System.out -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n \ No newline at end of file diff --git a/core-java-modules/core-java/src/main/resources/logback.xml b/core-java-modules/core-java/src/main/resources/logback.xml deleted file mode 100644 index 56af2d397e..0000000000 --- a/core-java-modules/core-java/src/main/resources/logback.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - %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/src/main/resources/product.png b/core-java-modules/core-java/src/main/resources/product.png deleted file mode 100644 index 4edd01c0a1795e469b0a4e8014eda04e5509fd38..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 55272 zcmeFZ_dnI|{|9cBLKLskLUwi;$v7y=9-*v^?2+uvF?t~>Cwr6Zk`b~UMIBp?jI3jG ztYbTegYWe`z2Bej_Ye5~_`cn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f(OL6ANhYS^q_+li zp=JnN@fmkMr&eU6p(-IF|=lUufN7J)HG?D_OX3d=!X$?=v&r13NmgP07m2jM(qDhBYs-^xk=STgH6LH!jiW9xj{CpGvfqfoh4^csJqsRxgkf(K^*l@Gv3^T?!Pk$`gIF|JGDLo)@ z0jU#0#i56qur0&70t?DYa2)HNH`>m%OapiwbP)q-*n(gxeUR zudi?7WNCXjxne4dXqsZLs^53gVW+BB~erU z0-=iwUkIhhPC`q1b;xKL57)~We%Y)~jKJ-e_0ZzwPNDXgxy;}h-Jlwv5^-?qgZ^7T zBnMc+8m!KUHGb`m_(9U&?sI^|LE+8i;_2g^9IMd|cZrY;T>r?hUJtdJf%QNCe@Dfh zzr8}th&}%*2YddtodSFQMqnZS`i8&JH?Tuce83|l;H3);hHtP(c8IkHDLaHRuoM0# z#Ja~SJ3~b7o=dFUSS;gV8e3#%SbOZSGem*cGW^3K#15cWaR|(E;@uyzg)@Cg7M7vy7I{SAPt7WDuC diff --git a/core-java-modules/core-java/src/test/resources/.gitignore b/core-java-modules/core-java/src/test/resources/.gitignore deleted file mode 100644 index 83c05e60c8..0000000000 --- a/core-java-modules/core-java/src/test/resources/.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 diff --git a/core-java-modules/core-java/src/test/resources/newFile1.txt b/core-java-modules/core-java/src/test/resources/newFile1.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/core-java-modules/core-java/src/test/resources/newFile2.txt b/core-java-modules/core-java/src/test/resources/newFile2.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/core-java-modules/core-java/src/test/resources/newFile3.txt b/core-java-modules/core-java/src/test/resources/newFile3.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/core-java-modules/core-java/src/test/resources/original.txt b/core-java-modules/core-java/src/test/resources/original.txt deleted file mode 100644 index 8511f56bef..0000000000 --- a/core-java-modules/core-java/src/test/resources/original.txt +++ /dev/null @@ -1,2 +0,0 @@ -#Copy a File with Java (www.Baeldung.com) -Copying Files with Java is Fun! \ No newline at end of file diff --git a/core-java-modules/core-java/src/test/resources/sourceFile.txt b/core-java-modules/core-java/src/test/resources/sourceFile.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/core-java-modules/core-java/src/test/resources/test.find b/core-java-modules/core-java/src/test/resources/test.find deleted file mode 100644 index 0cb7d51df1..0000000000 --- a/core-java-modules/core-java/src/test/resources/test.find +++ /dev/null @@ -1 +0,0 @@ -Test of JNDI on file. \ No newline at end of file diff --git a/core-java-modules/core-java/src/test/resources/test_read.in b/core-java-modules/core-java/src/test/resources/test_read.in deleted file mode 100644 index 70c379b63f..0000000000 --- a/core-java-modules/core-java/src/test/resources/test_read.in +++ /dev/null @@ -1 +0,0 @@ -Hello world \ No newline at end of file diff --git a/core-java-modules/core-java/src/test/resources/test_read1.in b/core-java-modules/core-java/src/test/resources/test_read1.in deleted file mode 100644 index 1e46242993..0000000000 --- a/core-java-modules/core-java/src/test/resources/test_read1.in +++ /dev/null @@ -1 +0,0 @@ -Hello world 1 \ No newline at end of file diff --git a/core-java-modules/core-java/src/test/resources/test_read2.in b/core-java-modules/core-java/src/test/resources/test_read2.in deleted file mode 100644 index fe47dc003b..0000000000 --- a/core-java-modules/core-java/src/test/resources/test_read2.in +++ /dev/null @@ -1 +0,0 @@ -2,3 4 \ No newline at end of file diff --git a/core-java-modules/core-java/src/test/resources/test_read3.in b/core-java-modules/core-java/src/test/resources/test_read3.in deleted file mode 100644 index db9f25a672..0000000000 --- a/core-java-modules/core-java/src/test/resources/test_read3.in +++ /dev/null @@ -1 +0,0 @@ -Hello 1 \ No newline at end of file diff --git a/core-java-modules/core-java/src/test/resources/test_read4.in b/core-java-modules/core-java/src/test/resources/test_read4.in deleted file mode 100644 index 5727d54bfcb2046f4989fd13cf5dcf408201fa2a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7 OcmZQz^+?Uh$p-)htO5D} diff --git a/core-java-modules/core-java/src/test/resources/test_read7.in b/core-java-modules/core-java/src/test/resources/test_read7.in deleted file mode 100644 index 28d4d45d43..0000000000 --- a/core-java-modules/core-java/src/test/resources/test_read7.in +++ /dev/null @@ -1 +0,0 @@ -青空 \ No newline at end of file diff --git a/core-java-modules/core-java/src/test/resources/test_read8.in b/core-java-modules/core-java/src/test/resources/test_read8.in deleted file mode 100644 index 10fc1aac8a..0000000000 --- a/core-java-modules/core-java/src/test/resources/test_read8.in +++ /dev/null @@ -1,2 +0,0 @@ -Hello world - Test line diff --git a/core-java-modules/core-java/src/test/resources/test_read_d.in b/core-java-modules/core-java/src/test/resources/test_read_d.in deleted file mode 100644 index 82bbb4071f..0000000000 --- a/core-java-modules/core-java/src/test/resources/test_read_d.in +++ /dev/null @@ -1 +0,0 @@ -John,Adam-Tom \ No newline at end of file diff --git a/core-java-modules/core-java/src/test/resources/test_read_multiple.in b/core-java-modules/core-java/src/test/resources/test_read_multiple.in deleted file mode 100644 index 7d64000a76..0000000000 --- a/core-java-modules/core-java/src/test/resources/test_read_multiple.in +++ /dev/null @@ -1,2 +0,0 @@ -Hello world -Hi, John \ No newline at end of file diff --git a/core-java-modules/core-java/yofile.txt b/core-java-modules/core-java/yofile.txt deleted file mode 100644 index ad56bf35f7a64171f415909f14caae6c5e679593..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 98 zcmZ4UmVvdnh(R$qKUXg)F*PTpG%sDRIJGD2*LSS*OuAojaeVm4G7k@y84zFaETyXJb8vRN3c>;|JBC3dsbAtDy< z{JhU|zCk%N(3$FlO_1a)SAu0^VwCX;ZLAgRC#lp+B6!aWz>A=glF78P(23lYf3E!J z%11A#SEMe{{*!ofpMVd32muO;prkM%3yo-w3*-`&;A3lIC7jdYO$)(5le5>K0DA%~ rRF(vp#`So*ueV(vyb#I@lsOd!YF}=cClfN8^PyGUUv@sgOX(F4<$G8t diff --git a/core-java-modules/pom.xml b/core-java-modules/pom.xml index fc7597e85a..6f3aec8c3a 100644 --- a/core-java-modules/pom.xml +++ b/core-java-modules/pom.xml @@ -17,7 +17,6 @@ - diff --git a/pom.xml b/pom.xml index bef7603cff..f55a665c33 100644 --- a/pom.xml +++ b/pom.xml @@ -333,7 +333,6 @@ checker-framework - core-java-modules/core-java core-java-modules/core-java-8 core-java-modules/core-java-8-2 core-java-modules/core-java-8-datetime @@ -524,7 +523,6 @@ checker-framework - core-java-modules/core-java core-java-modules/core-java-8 core-java-modules/core-java-8-2 core-java-modules/core-java-8-datetime diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/DivisibilityUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/junit/DivisibilityUnitTest.java similarity index 90% rename from core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/DivisibilityUnitTest.java rename to testing-modules/junit-4/src/test/java/com/baeldung/junit/DivisibilityUnitTest.java index b8fe701f57..3bdc8787f5 100644 --- a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/DivisibilityUnitTest.java +++ b/testing-modules/junit-4/src/test/java/com/baeldung/junit/DivisibilityUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.junit4vstestng; +package com.baeldung.junit; import static org.junit.Assert.assertEquals; diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/RegistrationUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/junit/RegistrationUnitTest.java similarity index 89% rename from core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/RegistrationUnitTest.java rename to testing-modules/junit-4/src/test/java/com/baeldung/junit/RegistrationUnitTest.java index 08a9f1e1c4..b52c565a9d 100644 --- a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/RegistrationUnitTest.java +++ b/testing-modules/junit-4/src/test/java/com/baeldung/junit/RegistrationUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.junit4vstestng; +package com.baeldung.junit; import org.junit.Test; import org.slf4j.Logger; diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/SignInUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/junit/SignInUnitTest.java similarity index 89% rename from core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/SignInUnitTest.java rename to testing-modules/junit-4/src/test/java/com/baeldung/junit/SignInUnitTest.java index a49fb454ea..145eb0d835 100644 --- a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/SignInUnitTest.java +++ b/testing-modules/junit-4/src/test/java/com/baeldung/junit/SignInUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.junit4vstestng; +package com.baeldung.junit; import org.junit.Test; import org.slf4j.Logger; diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/StringCaseUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/junit/StringCaseUnitTest.java similarity index 91% rename from core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/StringCaseUnitTest.java rename to testing-modules/junit-4/src/test/java/com/baeldung/junit/StringCaseUnitTest.java index 16a881f7e7..a76fe97161 100644 --- a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/StringCaseUnitTest.java +++ b/testing-modules/junit-4/src/test/java/com/baeldung/junit/StringCaseUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.junit4vstestng; +package com.baeldung.junit; import static org.junit.Assert.assertEquals; diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/ParametrizedUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/junitparams/ParametrizedUnitTest.java similarity index 92% rename from core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/ParametrizedUnitTest.java rename to testing-modules/junit-4/src/test/java/com/baeldung/junitparams/ParametrizedUnitTest.java index b46d4e895d..4e5a59eb22 100644 --- a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/ParametrizedUnitTest.java +++ b/testing-modules/junit-4/src/test/java/com/baeldung/junitparams/ParametrizedUnitTest.java @@ -1,7 +1,6 @@ -package com.baeldung.junit4vstestng; +package com.baeldung.junitparams; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; diff --git a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/SuiteUnitTest.java b/testing-modules/junit-4/src/test/java/com/baeldung/runfromjava/SuiteUnitTest.java similarity index 61% rename from core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/SuiteUnitTest.java rename to testing-modules/junit-4/src/test/java/com/baeldung/runfromjava/SuiteUnitTest.java index 3e02309636..67093b8a62 100644 --- a/core-java-modules/core-java/src/test/java/com/baeldung/junit4vstestng/SuiteUnitTest.java +++ b/testing-modules/junit-4/src/test/java/com/baeldung/runfromjava/SuiteUnitTest.java @@ -1,7 +1,9 @@ -package com.baeldung.junit4vstestng; +package com.baeldung.runfromjava; import org.junit.runner.RunWith; import org.junit.runners.Suite; +import com.baeldung.junit.RegistrationUnitTest; +import com.baeldung.junit.SignInUnitTest; @RunWith(Suite.class) @Suite.SuiteClasses({ RegistrationUnitTest.class, SignInUnitTest.class }) From 1bc733cb07b7e909414b79517ab9954c03bb8167 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Mon, 24 Apr 2023 22:08:01 +0530 Subject: [PATCH 08/51] JAVA-20381 opening java.lang for the surefire --- maven-modules/pom.xml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/maven-modules/pom.xml b/maven-modules/pom.xml index dae55f1617..f7bba3a8ff 100644 --- a/maven-modules/pom.xml +++ b/maven-modules/pom.xml @@ -64,4 +64,18 @@ + + + + org.apache.maven.plugins + maven-surefire-plugin + + + --add-opens java.base/java.lang=ALL-UNNAMED + + + + + + \ No newline at end of file From c11605cc614fdf0b7cea5b8ab2d9fcd0f368dc91 Mon Sep 17 00:00:00 2001 From: Adrian Bob Date: Mon, 24 Apr 2023 20:32:49 +0300 Subject: [PATCH 09/51] Update bulkhead test (#13836) --- .../ResilientAppControllerIntegrationTest.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/spring-boot-modules/spring-boot-resilience4j/src/test/java/com/baeldung/resilience4j/eventendpoints/ResilientAppControllerIntegrationTest.java b/spring-boot-modules/spring-boot-resilience4j/src/test/java/com/baeldung/resilience4j/eventendpoints/ResilientAppControllerIntegrationTest.java index 3933a02753..d1951218de 100644 --- a/spring-boot-modules/spring-boot-resilience4j/src/test/java/com/baeldung/resilience4j/eventendpoints/ResilientAppControllerIntegrationTest.java +++ b/spring-boot-modules/spring-boot-resilience4j/src/test/java/com/baeldung/resilience4j/eventendpoints/ResilientAppControllerIntegrationTest.java @@ -14,7 +14,6 @@ import com.github.tomakehurst.wiremock.core.WireMockConfiguration; import com.github.tomakehurst.wiremock.junit5.WireMockExtension; import java.net.URI; import java.nio.charset.Charset; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.*; @@ -210,23 +209,20 @@ class ResilientAppControllerIntegrationTest { EXTERNAL_SERVICE.stubFor(WireMock.get("/api/external").willReturn(ok())); Map responseStatusCount = new ConcurrentHashMap<>(); ExecutorService executorService = Executors.newFixedThreadPool(5); + CountDownLatch latch = new CountDownLatch(5); - List> tasks = new ArrayList<>(); IntStream.rangeClosed(1, 5) .forEach( i -> - tasks.add( + executorService.execute( () -> { ResponseEntity response = restTemplate.getForEntity("/api/bulkhead", String.class); - return response.getStatusCodeValue(); + int statusCode = response.getStatusCodeValue(); + responseStatusCount.merge(statusCode, 1, Integer::sum); + latch.countDown(); })); - - List> futures = executorService.invokeAll(tasks); - for (Future future : futures) { - int statusCode = future.get(); - responseStatusCount.merge(statusCode, 1, Integer::sum); - } + latch.await(); executorService.shutdown(); assertEquals(2, responseStatusCount.keySet().size()); From 178782aebfa54b11e61c09edd8cdbea3b3310d85 Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Tue, 25 Apr 2023 02:35:42 +0200 Subject: [PATCH 10/51] [BAEL-6442_Build-URL] create URL objects using apache httpclient & spring-web (#13892) --- .../core-java-networking/pom.xml | 10 +++- .../baeldung/networking/url/UrlUnitTest.java | 50 ++++++++++++++++++- 2 files changed, 57 insertions(+), 3 deletions(-) diff --git a/core-java-modules/core-java-networking/pom.xml b/core-java-modules/core-java-networking/pom.xml index 19c620198d..59aadbd1ed 100644 --- a/core-java-modules/core-java-networking/pom.xml +++ b/core-java-modules/core-java-networking/pom.xml @@ -1,7 +1,7 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 core-java-networking core-java-networking @@ -19,6 +19,11 @@ spring-web ${springframework.spring-web.version} + + org.apache.httpcomponents + httpclient + ${apache.httpclient.version} + @@ -27,6 +32,7 @@ 4.3.4.RELEASE + 4.5.14 \ No newline at end of file diff --git a/core-java-modules/core-java-networking/src/test/java/com/baeldung/networking/url/UrlUnitTest.java b/core-java-modules/core-java-networking/src/test/java/com/baeldung/networking/url/UrlUnitTest.java index 112f2cf53f..87d9d7a620 100644 --- a/core-java-modules/core-java-networking/src/test/java/com/baeldung/networking/url/UrlUnitTest.java +++ b/core-java-modules/core-java-networking/src/test/java/com/baeldung/networking/url/UrlUnitTest.java @@ -1,11 +1,19 @@ package com.baeldung.networking.url; +import static java.util.stream.Collectors.toList; import static org.junit.Assert.assertEquals; import java.net.MalformedURLException; +import java.net.URISyntaxException; import java.net.URL; +import java.util.Map; +import org.apache.http.client.utils.URIBuilder; +import org.apache.http.message.BasicNameValuePair; import org.junit.Test; +import org.springframework.web.util.UriComponentsBuilder; + +import com.google.common.collect.ImmutableMap; public class UrlUnitTest { @@ -101,4 +109,44 @@ public class UrlUnitTest { assertEquals("http://baeldung.com:9000/guidelines.txt", url.toString()); } -} + @Test + public void givenUrlParameters_whenBuildUrlWithURIBuilder_thenSuccess() throws URISyntaxException, MalformedURLException { + URIBuilder uriBuilder = new URIBuilder("http://baeldung.com/articles"); + uriBuilder.setPort(9090); + uriBuilder.addParameter("topic", "java"); + uriBuilder.addParameter("version", "8"); + URL url = uriBuilder.build().toURL(); + assertEquals("http://baeldung.com:9090/articles?topic=java&version=8", url.toString()); + } + + @Test + public void givenUrlParametersInMap_whenBuildUrlWithURIBuilder_thenSuccess() throws URISyntaxException, MalformedURLException { + Map paramMap = ImmutableMap.of("topic", "java", "version", "8"); + URIBuilder uriBuilder = new URIBuilder("http://baeldung.com/articles"); + uriBuilder.setPort(9090); + uriBuilder.addParameters(paramMap.entrySet() + .stream() + .map(entry -> new BasicNameValuePair(entry.getKey(), entry.getValue())) + .collect(toList())); + + URL url = uriBuilder.build().toURL(); + assertEquals("http://baeldung.com:9090/articles?topic=java&version=8", url.toString()); + } + + @Test + public void givenUrlParameters_whenBuildUrlWithSpringUriComponentsBuilder_thenSuccess() throws MalformedURLException { + URL url = UriComponentsBuilder.newInstance() + .scheme("http") + .host("baeldung.com") + .port(9090) + .path("articles") + .queryParam("topic", "java") + .queryParam("version", "8") + .build() + .toUri() + .toURL(); + + assertEquals("http://baeldung.com:9090/articles?topic=java&version=8", url.toString()); + } + +} \ No newline at end of file From 087561956fb383884e7ec70497ab0a545d0a4fd9 Mon Sep 17 00:00:00 2001 From: Chrys Exaucet Date: Tue, 25 Apr 2023 02:41:48 +0000 Subject: [PATCH 11/51] BAEL-3340: Guide to FlexyPool (#13867) * fix: correct log4j config * fix: correct antrun plugin config * feat: guide to flexypool See https://jira.baeldung.com/browse/BAEL-3340 * fix(lint): format project * fix(lint): format pom.xml * fix(lint): format pom.xml --- libraries-data-db/log4j.properties | 5 +- libraries-data-db/pom.xml | 20 ++++ .../libraries/flexypool/FlexypoolConfig.java | 109 ++++++++++++++++++ .../flexypool/FlexypoolDemoApplication.java | 53 +++++++++ 4 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 libraries-data-db/src/main/java/com/baeldung/libraries/flexypool/FlexypoolConfig.java create mode 100644 libraries-data-db/src/main/java/com/baeldung/libraries/flexypool/FlexypoolDemoApplication.java diff --git a/libraries-data-db/log4j.properties b/libraries-data-db/log4j.properties index 2173c5d96f..d2a3cae499 100644 --- a/libraries-data-db/log4j.properties +++ b/libraries-data-db/log4j.properties @@ -1 +1,4 @@ -log4j.rootLogger=INFO, stdout +log4j.rootLogger=INFO,stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.SimpleLayout +log4j.logger.org.datanucleus=DEBUG diff --git a/libraries-data-db/pom.xml b/libraries-data-db/pom.xml index 55fd990a80..66fa24476e 100644 --- a/libraries-data-db/pom.xml +++ b/libraries-data-db/pom.xml @@ -115,6 +115,24 @@ mysql ${testcontainers-version} + + + com.vladmihalcea.flexy-pool + flexy-micrometer-metrics + ${flexy-pool.version} + + + + com.vladmihalcea.flexy-pool + flexy-hikaricp + ${flexy-pool.version} + + + com.vladmihalcea.flexy-pool + flexy-dropwizard-metrics + + + org.springframework.boot @@ -147,6 +165,7 @@ + org.apache.maven.plugins maven-antrun-plugin ${maven-antrun-plugin.version} @@ -284,6 +303,7 @@ 5.0.1 13.15.2 2.1.3.Final + 2.2.3 1.17.6 diff --git a/libraries-data-db/src/main/java/com/baeldung/libraries/flexypool/FlexypoolConfig.java b/libraries-data-db/src/main/java/com/baeldung/libraries/flexypool/FlexypoolConfig.java new file mode 100644 index 0000000000..3b6bdca26b --- /dev/null +++ b/libraries-data-db/src/main/java/com/baeldung/libraries/flexypool/FlexypoolConfig.java @@ -0,0 +1,109 @@ +package com.baeldung.libraries.flexypool; + +import com.vladmihalcea.flexypool.FlexyPoolDataSource; +import com.vladmihalcea.flexypool.adaptor.HikariCPPoolAdapter; +import com.vladmihalcea.flexypool.config.Configuration; +import com.vladmihalcea.flexypool.connection.ConnectionDecoratorFactoryResolver; +import com.vladmihalcea.flexypool.event.ConnectionAcquireTimeThresholdExceededEvent; +import com.vladmihalcea.flexypool.event.ConnectionAcquireTimeoutEvent; +import com.vladmihalcea.flexypool.event.ConnectionLeaseTimeThresholdExceededEvent; +import com.vladmihalcea.flexypool.event.EventListener; +import com.vladmihalcea.flexypool.metric.micrometer.MicrometerMetrics; +import com.vladmihalcea.flexypool.strategy.IncrementPoolOnTimeoutConnectionAcquiringStrategy; +import com.vladmihalcea.flexypool.strategy.RetryConnectionAcquiringStrategy; +import com.vladmihalcea.flexypool.strategy.UniqueNamingStrategy; +import com.zaxxer.hikari.HikariConfig; +import com.zaxxer.hikari.HikariDataSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Bean; + +import java.util.Arrays; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +@org.springframework.context.annotation.Configuration +public class FlexypoolConfig { + + @SuppressWarnings("unchecked") + @Bean(initMethod = "start", destroyMethod = "stop") + public FlexyPoolDataSource flexypoolDataSource() { + Configuration configuration = flexypoolConfiguration(); + return new FlexyPoolDataSource<>(configuration, new IncrementPoolOnTimeoutConnectionAcquiringStrategy.Factory<>(5), new RetryConnectionAcquiringStrategy.Factory<>(2)); + } + + @Bean + public Configuration flexypoolConfiguration() { + + HikariDataSource dataSource = hikariDataSource(); + + return new Configuration.Builder<>(UUID.randomUUID().toString(), dataSource, HikariCPPoolAdapter.FACTORY).setMetricsFactory(MicrometerMetrics::new) + .setConnectionProxyFactory(ConnectionDecoratorFactoryResolver.INSTANCE.resolve()) + .setMetricLogReporterMillis(TimeUnit.SECONDS.toMillis(5)) + .setMetricNamingUniqueName(UniqueNamingStrategy.INSTANCE) + .setJmxEnabled(true) + .setJmxAutoStart(true) + .setConnectionAcquireTimeThresholdMillis(50L) + .setConnectionLeaseTimeThresholdMillis(250L) + .setEventListenerResolver(() -> Arrays.asList(new ConnectionAcquireTimeoutEventListener(), new ConnectionAcquireTimeThresholdExceededEventListener(), new ConnectionLeaseTimeThresholdExceededEventListener())) + .build(); + } + + @Bean + public HikariDataSource hikariDataSource() { + + HikariConfig config = new HikariConfig(); + config.setJdbcUrl("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;INIT=runscript from 'classpath:/db.sql'"); + config.setUsername(""); + config.setPassword(""); + config.addDataSourceProperty("cachePrepStmts", "true"); + config.addDataSourceProperty("prepStmtCacheSize", "250"); + config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048"); + config.addDataSourceProperty("minimumPoolSize", "1"); + config.addDataSourceProperty("maximumPoolSize", "3"); + config.addDataSourceProperty("connectionTimeout", "1000"); + return new HikariDataSource(config); + } +} + +class ConnectionAcquireTimeThresholdExceededEventListener extends EventListener { + + public static final Logger LOGGER = LoggerFactory.getLogger(ConnectionAcquireTimeThresholdExceededEventListener.class); + + public ConnectionAcquireTimeThresholdExceededEventListener() { + super(ConnectionAcquireTimeThresholdExceededEvent.class); + } + + @Override + public void on(ConnectionAcquireTimeThresholdExceededEvent event) { + LOGGER.info("ConnectionAcquireTimeThresholdExceededEvent Caught event {}", event); + } +} + +class ConnectionLeaseTimeThresholdExceededEventListener extends EventListener { + + public static final Logger LOGGER = LoggerFactory.getLogger(ConnectionLeaseTimeThresholdExceededEventListener.class); + + public ConnectionLeaseTimeThresholdExceededEventListener() { + super(ConnectionLeaseTimeThresholdExceededEvent.class); + } + + @Override + public void on(ConnectionLeaseTimeThresholdExceededEvent event) { + LOGGER.info("ConnectionLeaseTimeThresholdExceededEvent Caught event {}", event); + } +} + +class ConnectionAcquireTimeoutEventListener extends EventListener { + + public static final Logger LOGGER = LoggerFactory.getLogger(ConnectionAcquireTimeoutEventListener.class); + + public ConnectionAcquireTimeoutEventListener() { + super(ConnectionAcquireTimeoutEvent.class); + } + + @Override + public void on(ConnectionAcquireTimeoutEvent event) { + LOGGER.info("ConnectionAcquireTimeoutEvent Caught event {}", event); + } +} \ No newline at end of file diff --git a/libraries-data-db/src/main/java/com/baeldung/libraries/flexypool/FlexypoolDemoApplication.java b/libraries-data-db/src/main/java/com/baeldung/libraries/flexypool/FlexypoolDemoApplication.java new file mode 100644 index 0000000000..16d342f6f9 --- /dev/null +++ b/libraries-data-db/src/main/java/com/baeldung/libraries/flexypool/FlexypoolDemoApplication.java @@ -0,0 +1,53 @@ +package com.baeldung.libraries.flexypool; + +import com.baeldung.libraries.hikaricp.Employee; +import com.vladmihalcea.flexypool.FlexyPoolDataSource; +import com.zaxxer.hikari.HikariDataSource; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +@SpringBootApplication +public class FlexypoolDemoApplication { + + private static FlexyPoolDataSource poolDataSource; + + public FlexypoolDemoApplication(FlexyPoolDataSource poolDataSource) { + FlexypoolDemoApplication.poolDataSource = poolDataSource; + } + + public static List getEmployees() throws SQLException { + String SQL_QUERY = "select * from emp"; + List employees; + try (Connection con = poolDataSource.getConnection(); PreparedStatement pst = con.prepareStatement(SQL_QUERY); ResultSet rs = pst.executeQuery();) { + employees = new ArrayList<>(); + Employee employee; + while (rs.next()) { + employee = new Employee(); + employee.setEmpNo(rs.getInt("empno")); + employee.setEname(rs.getString("ename")); + employee.setJob(rs.getString("job")); + employee.setMgr(rs.getInt("mgr")); + employee.setHiredate(rs.getDate("hiredate")); + employee.setSal(rs.getInt("sal")); + employee.setComm(rs.getInt("comm")); + employee.setDeptno(rs.getInt("deptno")); + employees.add(employee); + } + } + return employees; + } + + public static void main(String[] args) throws SQLException { + SpringApplication.run(FlexypoolDemoApplication.class, args); + List employees = getEmployees(); + System.out.println(employees); + } + +} From 5b6d81ff3dfb314c856e693eb7829991be8cd5c4 Mon Sep 17 00:00:00 2001 From: Mateusz Szablak Date: Tue, 25 Apr 2023 15:08:24 +0200 Subject: [PATCH 12/51] BAEL-6283 Creating a Test Suite with JUnit (#13873) --- testing-modules/junit-5-advanced/pom.xml | 17 +++++++++++++++++ .../baeldung/testsuite/ClassOneUnitTest.java | 13 +++++++++++++ .../baeldung/testsuite/ClassThreeUnitTest.java | 13 +++++++++++++ .../com/baeldung/testsuite/package-info.java | 4 ++++ .../testsuite/subpackage/ClassTwoUnitTest.java | 11 +++++++++++ .../suites/JUnitClassNamePatternsSuite.java | 14 ++++++++++++++ .../suites/JUnitExcludePackagesSuite.java | 12 ++++++++++++ .../testsuite/suites/JUnitRunWithSuite.java | 16 ++++++++++++++++ .../suites/JUnitSelectClassesSuite.java | 14 ++++++++++++++ .../suites/JUnitSelectPackagesSuite.java | 10 ++++++++++ .../suites/JUnitTestExcludeTagsSuite.java | 12 ++++++++++++ .../suites/JUnitTestIncludePackagesSuite.java | 12 ++++++++++++ .../suites/JUnitTestIncludeTagsSuite.java | 12 ++++++++++++ 13 files changed, 160 insertions(+) create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/ClassOneUnitTest.java create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/ClassThreeUnitTest.java create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/package-info.java create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/subpackage/ClassTwoUnitTest.java create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitClassNamePatternsSuite.java create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitExcludePackagesSuite.java create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitRunWithSuite.java create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitSelectClassesSuite.java create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitSelectPackagesSuite.java create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestExcludeTagsSuite.java create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestIncludePackagesSuite.java create mode 100644 testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestIncludeTagsSuite.java diff --git a/testing-modules/junit-5-advanced/pom.xml b/testing-modules/junit-5-advanced/pom.xml index bfc490b03e..5a65b0f6f3 100644 --- a/testing-modules/junit-5-advanced/pom.xml +++ b/testing-modules/junit-5-advanced/pom.xml @@ -33,6 +33,19 @@ ${assertj.version} test + + org.junit.platform + junit-platform-suite + ${junit-platform.version} + test + + + org.junit.platform + junit-platform-runner + ${junit-platform.version} + test + + @@ -45,6 +58,9 @@ -javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit.version}/jmockit-${jmockit.version}.jar true + + **/testsuite/**/*UnitTest.java + @@ -53,6 +69,7 @@ 1.49 3.24.2 + 1.9.2 \ No newline at end of file diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/ClassOneUnitTest.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/ClassOneUnitTest.java new file mode 100644 index 0000000000..4ce092796e --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/ClassOneUnitTest.java @@ -0,0 +1,13 @@ +package com.baeldung.testsuite; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ClassOneUnitTest { + + @Test + public void whenTrue_thenTrue() { + Assertions.assertTrue(true); + } + +} diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/ClassThreeUnitTest.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/ClassThreeUnitTest.java new file mode 100644 index 0000000000..b686ef5773 --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/ClassThreeUnitTest.java @@ -0,0 +1,13 @@ +package com.baeldung.testsuite; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; + +public class ClassThreeUnitTest { + @Test + @Tag("slow") + public void whenTrue_thenTrue() { + Assertions.assertTrue(true); + } +} diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/package-info.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/package-info.java new file mode 100644 index 0000000000..53c8ea5e8a --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/package-info.java @@ -0,0 +1,4 @@ +/** + * Dummy tests - showing Junit Suite functionality + */ +package com.baeldung.testsuite; \ No newline at end of file diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/subpackage/ClassTwoUnitTest.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/subpackage/ClassTwoUnitTest.java new file mode 100644 index 0000000000..bb63fcda63 --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/subpackage/ClassTwoUnitTest.java @@ -0,0 +1,11 @@ +package com.baeldung.testsuite.subpackage; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class ClassTwoUnitTest { + @Test + public void whenTrue_thenTrue() { + Assertions.assertTrue(true); + } +} diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitClassNamePatternsSuite.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitClassNamePatternsSuite.java new file mode 100644 index 0000000000..aa17e26069 --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitClassNamePatternsSuite.java @@ -0,0 +1,14 @@ +package com.baeldung.testsuite.suites; + +import org.junit.platform.suite.api.ExcludeClassNamePatterns; +import org.junit.platform.suite.api.IncludeClassNamePatterns; +import org.junit.platform.suite.api.SelectPackages; +import org.junit.platform.suite.api.Suite; + +@Suite +@SelectPackages("com.baeldung.testsuite") +@IncludeClassNamePatterns("com.baeldung.testsuite.Class.*UnitTest") +@ExcludeClassNamePatterns("com.baeldung.testsuite.ClassTwoUnitTest") +public class JUnitClassNamePatternsSuite { + // runs ClassOneUnitTest and ClassThreeUnitTest +} \ No newline at end of file diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitExcludePackagesSuite.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitExcludePackagesSuite.java new file mode 100644 index 0000000000..47cd993f8a --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitExcludePackagesSuite.java @@ -0,0 +1,12 @@ +package com.baeldung.testsuite.suites; + +import org.junit.platform.suite.api.ExcludePackages; +import org.junit.platform.suite.api.SelectPackages; +import org.junit.platform.suite.api.Suite; + +@Suite +@SelectPackages("com.baeldung.testsuite") +@ExcludePackages("com.baeldung.testsuite.subpackage") +public class JUnitExcludePackagesSuite { + // runs ClassOneUnitTest and ClassThreeUnitTest +} \ No newline at end of file diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitRunWithSuite.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitRunWithSuite.java new file mode 100644 index 0000000000..ad098fb305 --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitRunWithSuite.java @@ -0,0 +1,16 @@ +package com.baeldung.testsuite.suites; + +import com.baeldung.testsuite.ClassOneUnitTest; +import com.baeldung.testsuite.subpackage.ClassTwoUnitTest; +import org.junit.platform.runner.JUnitPlatform; +import org.junit.platform.suite.api.SelectClasses; +import org.junit.platform.suite.api.SuiteDisplayName; +import org.junit.runner.RunWith; + +@RunWith(JUnitPlatform.class) +@SuiteDisplayName("My Test Suite") +@SelectClasses({ClassOneUnitTest.class, ClassTwoUnitTest.class}) +public class JUnitRunWithSuite { + // runs ClassOneUnitTest and ClassTwoUnitTest + // equivalent to JUnitSelectClassesSuite +} \ No newline at end of file diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitSelectClassesSuite.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitSelectClassesSuite.java new file mode 100644 index 0000000000..dc2b78ac53 --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitSelectClassesSuite.java @@ -0,0 +1,14 @@ +package com.baeldung.testsuite.suites; + +import com.baeldung.testsuite.ClassOneUnitTest; +import com.baeldung.testsuite.subpackage.ClassTwoUnitTest; +import org.junit.platform.suite.api.SelectClasses; +import org.junit.platform.suite.api.Suite; +import org.junit.platform.suite.api.SuiteDisplayName; + +@Suite +@SuiteDisplayName("My Test Suite") +@SelectClasses({ClassOneUnitTest.class, ClassTwoUnitTest.class}) +public class JUnitSelectClassesSuite { + // runs ClassOneUnitTest and ClassTwoUnitTest +} \ No newline at end of file diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitSelectPackagesSuite.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitSelectPackagesSuite.java new file mode 100644 index 0000000000..26562a18d7 --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitSelectPackagesSuite.java @@ -0,0 +1,10 @@ +package com.baeldung.testsuite.suites; + +import org.junit.platform.suite.api.SelectPackages; +import org.junit.platform.suite.api.Suite; + +@Suite +@SelectPackages({"com.baeldung.testsuite", "com.baeldung.testsuitetwo"}) +public class JUnitSelectPackagesSuite { + // runs ClassOneUnitTest, ClassTwoUnitTest and ClassThreeUnitTest +} \ No newline at end of file diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestExcludeTagsSuite.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestExcludeTagsSuite.java new file mode 100644 index 0000000000..5ae32fc0b5 --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestExcludeTagsSuite.java @@ -0,0 +1,12 @@ +package com.baeldung.testsuite.suites; + +import org.junit.platform.suite.api.ExcludeTags; +import org.junit.platform.suite.api.SelectPackages; +import org.junit.platform.suite.api.Suite; + +@Suite +@SelectPackages("com.baeldung.testsuite") +@ExcludeTags("slow") +public class JUnitTestExcludeTagsSuite { + // runs ClassOneUnitTest, ClassTwoUnitTest +} \ No newline at end of file diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestIncludePackagesSuite.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestIncludePackagesSuite.java new file mode 100644 index 0000000000..b5442aff35 --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestIncludePackagesSuite.java @@ -0,0 +1,12 @@ +package com.baeldung.testsuite.suites; + +import org.junit.platform.suite.api.IncludePackages; +import org.junit.platform.suite.api.SelectPackages; +import org.junit.platform.suite.api.Suite; + +@Suite +@SelectPackages("com.baeldung.testsuite") +@IncludePackages("com.baeldung.testsuite.subpackage") +public class JUnitTestIncludePackagesSuite { + // runs ClassTwoUnitTest +} \ No newline at end of file diff --git a/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestIncludeTagsSuite.java b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestIncludeTagsSuite.java new file mode 100644 index 0000000000..1cfce4bd7a --- /dev/null +++ b/testing-modules/junit-5-advanced/src/test/java/com/baeldung/testsuite/suites/JUnitTestIncludeTagsSuite.java @@ -0,0 +1,12 @@ +package com.baeldung.testsuite.suites; + +import org.junit.platform.suite.api.IncludeTags; +import org.junit.platform.suite.api.SelectPackages; +import org.junit.platform.suite.api.Suite; + +@Suite +@SelectPackages("com.baeldung.testsuite") +@IncludeTags("slow") +public class JUnitTestIncludeTagsSuite { + // runs ClassTwoUnitTest +} \ No newline at end of file From 321e1d3fcce145ff25d17703bdffad37ca7ceba9 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Tue, 25 Apr 2023 15:22:42 +0200 Subject: [PATCH 13/51] Update CancelFluxUnitTest.java (#13893) --- .../test/java/com/baeldung/cancelflux/CancelFluxUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-reactive-modules/spring-5-reactive-3/src/test/java/com/baeldung/cancelflux/CancelFluxUnitTest.java b/spring-reactive-modules/spring-5-reactive-3/src/test/java/com/baeldung/cancelflux/CancelFluxUnitTest.java index 609dbfcf73..e360c2d5e4 100644 --- a/spring-reactive-modules/spring-5-reactive-3/src/test/java/com/baeldung/cancelflux/CancelFluxUnitTest.java +++ b/spring-reactive-modules/spring-5-reactive-3/src/test/java/com/baeldung/cancelflux/CancelFluxUnitTest.java @@ -79,7 +79,7 @@ public class CancelFluxUnitTest { count.incrementAndGet(); }, e -> System.err.println("Error: " + e.getMessage())); - Thread.sleep(5000); + Thread.sleep(4500); System.out.println("Will Dispose The flux Next"); disposable.dispose(); if (disposable.isDisposed()) { From eca8ddf2f580ad4da3b2113a2c345ed2852e36ea Mon Sep 17 00:00:00 2001 From: jsgrah-spring Date: Tue, 25 Apr 2023 15:25:05 +0200 Subject: [PATCH 14/51] JAVA-20481 (#13901) Co-authored-by: jogra --- .../securityfilterchain/configuration/SecurityConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-security-modules/spring-security-web-boot-4/src/main/java/com/baeldung/securityfilterchain/configuration/SecurityConfig.java b/spring-security-modules/spring-security-web-boot-4/src/main/java/com/baeldung/securityfilterchain/configuration/SecurityConfig.java index 4d3bec2ad2..5a8f4c1c02 100644 --- a/spring-security-modules/spring-security-web-boot-4/src/main/java/com/baeldung/securityfilterchain/configuration/SecurityConfig.java +++ b/spring-security-modules/spring-security-web-boot-4/src/main/java/com/baeldung/securityfilterchain/configuration/SecurityConfig.java @@ -29,7 +29,7 @@ public class SecurityConfig { .antMatchers("/user/**") .hasAnyRole("USER", "ADMIN") .antMatchers("/login/**") - .anonymous() + .permitAll() .anyRequest() .authenticated() .and() From 1dfd0a7e6d88148885310445563f29c79fa41c34 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Tue, 25 Apr 2023 19:01:29 +0530 Subject: [PATCH 15/51] Update README.md (#13903) --- spring-security-modules/spring-security-web-boot-4/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-security-modules/spring-security-web-boot-4/README.md b/spring-security-modules/spring-security-web-boot-4/README.md index 26b19e7b33..af8ed4e76a 100644 --- a/spring-security-modules/spring-security-web-boot-4/README.md +++ b/spring-security-modules/spring-security-web-boot-4/README.md @@ -8,5 +8,6 @@ The "REST With Spring" Classes: http://github.learnspringsecurity.com ### Relevant Articles: - [Spring Security: Upgrading the Deprecated WebSecurityConfigurerAdapter](https://www.baeldung.com/spring-deprecated-websecurityconfigureradapter) -- More articles: [[<-- prev]](/spring-security-modules/spring-security-web-boot-3) - [Spring @EnableMethodSecurity Annotation](https://www.baeldung.com/spring-enablemethodsecurity) + +More articles: [[<-- prev]](/spring-security-modules/spring-security-web-boot-3) From 4dbe6acc183927f8eab05543db4574cfe89d8afe Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Tue, 25 Apr 2023 19:04:52 +0530 Subject: [PATCH 16/51] Update README.md (#13904) --- spring-security-modules/spring-security-web-boot-3/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-security-modules/spring-security-web-boot-3/README.md b/spring-security-modules/spring-security-web-boot-3/README.md index 400039dbfe..830abd2c99 100644 --- a/spring-security-modules/spring-security-web-boot-3/README.md +++ b/spring-security-modules/spring-security-web-boot-3/README.md @@ -14,4 +14,5 @@ The "REST With Spring" Classes: http://github.learnspringsecurity.com - [Content Security Policy with Spring Security](https://www.baeldung.com/spring-security-csp) - [Enable Logging for Spring Security](https://www.baeldung.com/spring-security-enable-logging) - [Authentication With Spring Security and MongoDB](https://www.baeldung.com/spring-security-authentication-mongodb) -- More articles: [[<-- prev]](/spring-security-modules/spring-security-web-boot-2) + +More articles: [[<-- prev]](/spring-security-modules/spring-security-web-boot-2) [[next -->]](/spring-security-modules/spring-security-web-boot-4) From 3d888b3561a3a9abf7dde31d6328f1c76e700937 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Tue, 25 Apr 2023 19:49:12 +0530 Subject: [PATCH 17/51] Update README.md (#13905) --- spring-security-modules/spring-security-web-boot-2/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spring-security-modules/spring-security-web-boot-2/README.md b/spring-security-modules/spring-security-web-boot-2/README.md index f5fc3a890d..c768ba924b 100644 --- a/spring-security-modules/spring-security-web-boot-2/README.md +++ b/spring-security-modules/spring-security-web-boot-2/README.md @@ -14,4 +14,5 @@ The "REST With Spring" Classes: http://github.learnspringsecurity.com - [Spring Security: Exploring JDBC Authentication](https://www.baeldung.com/spring-security-jdbc-authentication) - [Spring Security Custom Logout Handler](https://www.baeldung.com/spring-security-custom-logout-handler) - [Redirecting Logged-in Users with Spring Security](https://www.baeldung.com/spring-security-redirect-logged-in) -- More articles: [[<-- prev]](/spring-security-modules/spring-security-web-boot-1) + +More articles: [[<-- prev]](/spring-security-modules/spring-security-web-boot-1) [[next -->]](/spring-security-modules/spring-security-web-boot-3) From b9f2acc9237dfbe17bbc29374e65c2948ca9ee2d Mon Sep 17 00:00:00 2001 From: panos-kakos <102670093+panos-kakos@users.noreply.github.com> Date: Tue, 25 Apr 2023 18:40:09 +0300 Subject: [PATCH 18/51] [JAVA-15034] Updated code to apache httpclient v5 (#13811) * [JAVA-15034] Updated code to apache httpclient v5 --- apache-httpclient-2/README.md | 1 + .../HttpClientExpandUrlLiveTest.java | 126 ++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 apache-httpclient-2/src/test/java/com/baeldung/httpclient/expandUrl/HttpClientExpandUrlLiveTest.java diff --git a/apache-httpclient-2/README.md b/apache-httpclient-2/README.md index 05bebfaacb..a19112476b 100644 --- a/apache-httpclient-2/README.md +++ b/apache-httpclient-2/README.md @@ -13,4 +13,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [How To Get Cookies From the Apache HttpClient Response](https://www.baeldung.com/java-apache-httpclient-cookies) - [Enabling Logging for Apache HttpClient](https://www.baeldung.com/apache-httpclient-enable-logging) - [Apache HttpClient vs. CloseableHttpClient](https://www.baeldung.com/apache-httpclient-vs-closeablehttpclient) +- [Expand Shortened URLs with Apache HttpClient](https://www.baeldung.com/apache-httpclient-expand-url) - More articles: [[<-- prev]](../apache-httpclient) diff --git a/apache-httpclient-2/src/test/java/com/baeldung/httpclient/expandUrl/HttpClientExpandUrlLiveTest.java b/apache-httpclient-2/src/test/java/com/baeldung/httpclient/expandUrl/HttpClientExpandUrlLiveTest.java new file mode 100644 index 0000000000..c1bb5bdddb --- /dev/null +++ b/apache-httpclient-2/src/test/java/com/baeldung/httpclient/expandUrl/HttpClientExpandUrlLiveTest.java @@ -0,0 +1,126 @@ +package com.baeldung.httpclient.expandUrl; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; + +import java.io.IOException; +import java.util.List; + +import com.google.common.base.Preconditions; +import com.google.common.collect.Lists; + +import org.apache.commons.lang3.tuple.ImmutablePair; +import org.apache.commons.lang3.tuple.Pair; + +import org.apache.hc.client5.http.classic.methods.HttpHead; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; + +import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; +import org.apache.hc.core5.http.Header; +import org.apache.hc.core5.http.HttpHeaders; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +class HttpClientExpandUrlLiveTest { + + private static CloseableHttpClient httpClient; + + @BeforeAll + static void setup() { + httpClient = HttpClientBuilder.create() + .disableRedirectHandling() + .build(); + } + + @AfterAll + static void tearDown() throws IOException { + if (httpClient != null) { + httpClient.close(); + } + } + + @Test + void givenShortenedOnce_whenUrlIsExpanded_thenCorrectResult() throws IOException { + final String expectedResult = "https://www.baeldung.com/rest-versioning"; + final String actualResult = expandSingleLevel("http://bit.ly/3LScTri"); + assertThat(actualResult, equalTo(expectedResult)); + } + + @Test + void givenShortenedMultiple_whenUrlIsExpanded_thenCorrectResult() throws IOException { + final String expectedResult = "https://www.baeldung.com/rest-versioning"; + final String actualResult = expand("http://t.co/e4rDDbnzmk"); + assertThat(actualResult, equalTo(expectedResult)); + } + + private String expand(final String urlArg) throws IOException { + String originalUrl = urlArg; + String newUrl = expandSingleLevel(originalUrl); + while (!originalUrl.equals(newUrl)) { + originalUrl = newUrl; + newUrl = expandSingleLevel(originalUrl); + } + + return newUrl; + } + + final String expandSafe(final String urlArg) throws IOException { + String originalUrl = urlArg; + String newUrl = expandSingleLevelSafe(originalUrl).getRight(); + final List alreadyVisited = Lists.newArrayList(originalUrl, newUrl); + while (!originalUrl.equals(newUrl)) { + originalUrl = newUrl; + final Pair statusAndUrl = expandSingleLevelSafe(originalUrl); + newUrl = statusAndUrl.getRight(); + final boolean isRedirect = statusAndUrl.getLeft() == 301 || statusAndUrl.getLeft() == 302; + if (isRedirect && alreadyVisited.contains(newUrl)) { + throw new IllegalStateException("Likely a redirect loop"); + } + alreadyVisited.add(newUrl); + } + + return newUrl; + } + + private Pair expandSingleLevelSafe(final String url) throws IOException { + try { + HttpHead request = new HttpHead(url); + Pair resp = httpClient.execute(request, response -> { + final int statusCode = response.getCode(); + if (statusCode != 301 && statusCode != 302) { + return new ImmutablePair<>(statusCode, url); + } + final Header[] headers = response.getHeaders(HttpHeaders.LOCATION); + Preconditions.checkState(headers.length == 1); + final String newUrl = headers[0].getValue(); + + return new ImmutablePair<>(statusCode, newUrl); + }); + return resp; + } catch (final IllegalArgumentException uriEx) { + return new ImmutablePair<>(500, url); + } + } + + private String expandSingleLevel(final String url) throws IOException { + try { + HttpHead request = new HttpHead(url); + String expandedUrl = httpClient.execute(request, response -> { + final int statusCode = response.getCode(); + if (statusCode != 301 && statusCode != 302) { + return url; + } + final Header[] headers = response.getHeaders(HttpHeaders.LOCATION); + Preconditions.checkState(headers.length == 1); + + return headers[0].getValue(); + }); + return expandedUrl; + } catch (final IllegalArgumentException uriEx) { + return url; + } + } + +} From 6cc24e075905156191c53efa50402894a2fc8bed Mon Sep 17 00:00:00 2001 From: Kilian Schneider <48420258+Basler182@users.noreply.github.com> Date: Wed, 26 Apr 2023 02:55:11 +0200 Subject: [PATCH 19/51] BAEL-6348 persist List in JPA (#13897) * BAEL-6348 persist List in JPA * Update naming --- .../jpa/listrepositories/entity/Library.java | 66 +++++++++++++++++++ .../entity/StringListConverter.java | 25 +++++++ .../repository/LibraryRepository.java | 13 ++++ .../repository/LibraryIntegrationTest.java | 32 +++++++++ 4 files changed, 136 insertions(+) create mode 100644 persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/entity/Library.java create mode 100644 persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/entity/StringListConverter.java create mode 100644 persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/repository/LibraryRepository.java create mode 100644 persistence-modules/spring-data-jpa-repo-3/src/test/java/com/baeldung/spring/data/jpa/listrepositories/repository/LibraryIntegrationTest.java diff --git a/persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/entity/Library.java b/persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/entity/Library.java new file mode 100644 index 0000000000..04c0ad5e0a --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/entity/Library.java @@ -0,0 +1,66 @@ +package com.baeldung.spring.data.jpa.listrepositories.entity; + +import jakarta.persistence.*; + +import java.util.ArrayList; +import java.util.List; + +@Entity(name = "library") +public class Library { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + + private String name; + + @Convert(converter = StringListConverter.class) + @Column(name = "addresses", nullable = false) + private List addresses = new ArrayList<>(); + + @ElementCollection(targetClass = String.class, fetch = FetchType.EAGER) + @CollectionTable(name = "book", joinColumns = @JoinColumn(name = "library_id")) + @Column(name = "book", nullable = false) + private List books = new ArrayList<>(); + + public Library() { + } + + public Library(String name, List addresses, List books) { + this.name = name; + this.addresses = addresses; + this.books = books; + } + + 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 List getAddresses() { + return addresses; + } + + public void setAddresses(List addresses) { + this.addresses = addresses; + } + + public List getBooks() { + return books; + } + + public void setBooks(List books) { + this.books = books; + } +} diff --git a/persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/entity/StringListConverter.java b/persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/entity/StringListConverter.java new file mode 100644 index 0000000000..ffc097ee18 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/entity/StringListConverter.java @@ -0,0 +1,25 @@ +package com.baeldung.spring.data.jpa.listrepositories.entity; + +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; + +import java.util.Arrays; +import java.util.List; + + +import static java.util.Collections.*; + +@Converter +public class StringListConverter implements AttributeConverter, String> { + private static final String SPLIT_CHAR = ";"; + + @Override + public String convertToDatabaseColumn(List stringList) { + return stringList != null ? String.join(SPLIT_CHAR, stringList) : ""; + } + + @Override + public List convertToEntityAttribute(String string) { + return string != null ? Arrays.asList(string.split(SPLIT_CHAR)) : emptyList(); + } +} \ No newline at end of file diff --git a/persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/repository/LibraryRepository.java b/persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/repository/LibraryRepository.java new file mode 100644 index 0000000000..71deb04b3e --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-3/src/main/java/com/baeldung/spring/data/jpa/listrepositories/repository/LibraryRepository.java @@ -0,0 +1,13 @@ +package com.baeldung.spring.data.jpa.listrepositories.repository; + +import com.baeldung.spring.data.jpa.listrepositories.entity.Library; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; +import org.springframework.stereotype.Repository; + +@Repository +public interface LibraryRepository extends CrudRepository { + @Query("SELECT l FROM library l JOIN FETCH l.books WHERE l.id = (:id)") + Library findById(@Param("id") long id); +} diff --git a/persistence-modules/spring-data-jpa-repo-3/src/test/java/com/baeldung/spring/data/jpa/listrepositories/repository/LibraryIntegrationTest.java b/persistence-modules/spring-data-jpa-repo-3/src/test/java/com/baeldung/spring/data/jpa/listrepositories/repository/LibraryIntegrationTest.java new file mode 100644 index 0000000000..7bd1b90407 --- /dev/null +++ b/persistence-modules/spring-data-jpa-repo-3/src/test/java/com/baeldung/spring/data/jpa/listrepositories/repository/LibraryIntegrationTest.java @@ -0,0 +1,32 @@ +package com.baeldung.spring.data.jpa.listrepositories.repository; + +import com.baeldung.spring.data.jpa.listrepositories.entity.Library; +import jakarta.transaction.Transactional; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.util.Arrays; + +@SpringBootTest +public class LibraryIntegrationTest { + + @Autowired + private LibraryRepository libraryRepository; + + @Test + @Transactional + public void givenLibrary_whenGetAddressesAndGetBooks_thenGetListOfItems(){ + Library library = new Library(); + library.setAddresses(Arrays.asList("Address 1", "Address 2")); + library.setBooks(Arrays.asList("Book 1", "Book 2")); + + libraryRepository.save(library); + Library lib = libraryRepository.findById(library.getId().longValue()); + + Assertions.assertEquals(2, lib.getAddresses().size()); + Assertions.assertEquals(2, lib.getBooks().size()); + } + +} From c8cd042d647d5b0bf9abe84554706666f44ba153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bogdan=20Cardo=C5=9F?= <106325528+sodrac@users.noreply.github.com> Date: Wed, 26 Apr 2023 09:30:27 +0300 Subject: [PATCH 20/51] BAEL-6079 Code examples from article (#13486) * BAEL-6079 Code examples from article * BAEL-6079 Code examples from article * BAEL-6079 Code examples from article update * BAEL-6079 Code examples from article update --- .../main/java/com/baeldung/methods/Car.java | 98 +++++++++++++++++++ .../java/com/baeldung/methods/Motorcycle.java | 52 ++++++++++ .../java/com/baeldung/methods/Vehicle.java | 33 +++++++ .../baeldung/methods/VehicleProcessor.java | 20 ++++ .../methods/VehicleProcessorUnitTest.java | 58 +++++++++++ 5 files changed, 261 insertions(+) create mode 100644 core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Car.java create mode 100644 core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Motorcycle.java create mode 100644 core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Vehicle.java create mode 100644 core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/VehicleProcessor.java create mode 100644 core-java-modules/core-java-lang-oop-methods/src/test/java/com/baeldung/methods/VehicleProcessorUnitTest.java diff --git a/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Car.java b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Car.java new file mode 100644 index 0000000000..a72d7dd0f1 --- /dev/null +++ b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Car.java @@ -0,0 +1,98 @@ +package com.baeldung.methods; + +public class Car { + + private final String make; + private final String model; + private final int year; + private final String color; + private final boolean automatic; + private final int numDoors; + private final String features; + + private Car(CarBuilder carBuilder) { + this.make = carBuilder.make; + this.model = carBuilder.model; + this.year = carBuilder.year; + this.color = carBuilder.color; + this.automatic = carBuilder.automatic; + this.numDoors = carBuilder.numDoors; + this.features = carBuilder.features; + } + + public String getMake() { + return make; + } + + public String getModel() { + return model; + } + + public int getYear() { + return year; + } + + public String getColor() { + return color; + } + + public boolean isAutomatic() { + return automatic; + } + + public int getNumDoors() { + return numDoors; + } + + public String getFeatures() { + return features; + } + + public static class CarBuilder { + + private final String make; + private final String model; + private final int year; + + private String color = "unknown"; + private boolean automatic = false; + private int numDoors = 4; + private String features = ""; + + public CarBuilder(String make, String model, int year) { + this.make = make; + this.model = model; + this.year = year; + } + + public CarBuilder color(String color) { + this.color = color; + return this; + } + + public CarBuilder automatic(boolean automatic) { + this.automatic = automatic; + return this; + } + + public CarBuilder numDoors(int numDoors) { + this.numDoors = numDoors; + return this; + } + + public CarBuilder features(String features) { + this.features = features; + return this; + } + + public Car build() { + return new Car(this); + } + } + + @Override + public String toString() { + return "Car [make=" + make + ", model=" + model + ", year=" + year + ", color=" + color + ", automatic=" + automatic + ", numDoors=" + numDoors + ", features=" + features + "]"; + } + +} diff --git a/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Motorcycle.java b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Motorcycle.java new file mode 100644 index 0000000000..8a1fce4a5d --- /dev/null +++ b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Motorcycle.java @@ -0,0 +1,52 @@ +package com.baeldung.methods; + +import java.io.Serializable; + +public class Motorcycle extends Vehicle implements Serializable { + + private static final long serialVersionUID = 5973661295933599929L; + + private int year; + private String features = ""; + + public Motorcycle() { + super(); + } + + public Motorcycle(String make, String model, String color, int weight, boolean statusNew, int year) { + super(make, model, color, weight, statusNew); + this.year = year; + } + + public Motorcycle(Vehicle vehicle, int year) { + super(vehicle); + this.year = year; + } + + public int getYear() { + return year; + } + + public void setYear(int year) { + this.year = year; + } + + public void setFeatures(String features) { + this.features = features; + } + + public String getFeatures() { + return features; + } + + public void addMotorcycleFeatures(String... features) { + StringBuilder str = new StringBuilder(this.getFeatures()); + for (String feature : features) { + if (!str.toString().isEmpty()) + str.append(", "); + str.append(feature); + } + this.setFeatures(str.toString()); + } + +} diff --git a/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Vehicle.java b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Vehicle.java new file mode 100644 index 0000000000..0c6964d255 --- /dev/null +++ b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/Vehicle.java @@ -0,0 +1,33 @@ +package com.baeldung.methods; + +public class Vehicle { + + static String defaultValue = "DEFAULT"; + private String make = defaultValue; + private String model = defaultValue; + private String color = defaultValue; + private int weight = 0; + private boolean statusNew = true; + + public Vehicle() { + super(); + } + + public Vehicle(String make, String model, String color, int weight, boolean statusNew) { + this.make = make; + this.model = model; + this.color = color; + this.weight = weight; + this.statusNew = statusNew; + } + + public Vehicle(Vehicle vehicle) { + this(vehicle.make, vehicle.model, vehicle.color, vehicle.weight, vehicle.statusNew); + } + + @Override + public String toString() { + return "Vehicle [make=" + make + ", model=" + model + ", color=" + color + ", weight=" + weight + ", statusNew=" + statusNew + "]"; + } + +} diff --git a/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/VehicleProcessor.java b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/VehicleProcessor.java new file mode 100644 index 0000000000..a7d5975813 --- /dev/null +++ b/core-java-modules/core-java-lang-oop-methods/src/main/java/com/baeldung/methods/VehicleProcessor.java @@ -0,0 +1,20 @@ +package com.baeldung.methods; + +public class VehicleProcessor { + + Vehicle processVehicle(String make, String model, String color, int weight, boolean status) { + return new Vehicle(make, model, color, weight, status); + } + + Vehicle processVehicle(Vehicle vehicle) { + return new Vehicle(vehicle); + } + + Car processCar(Car car) { + return new Car.CarBuilder(car.getMake(), car.getModel(), car.getYear()).color(car.getColor()) + .automatic(car.isAutomatic()) + .features(car.getFeatures()) + .build(); + } + +} \ No newline at end of file diff --git a/core-java-modules/core-java-lang-oop-methods/src/test/java/com/baeldung/methods/VehicleProcessorUnitTest.java b/core-java-modules/core-java-lang-oop-methods/src/test/java/com/baeldung/methods/VehicleProcessorUnitTest.java new file mode 100644 index 0000000000..928fbcb426 --- /dev/null +++ b/core-java-modules/core-java-lang-oop-methods/src/test/java/com/baeldung/methods/VehicleProcessorUnitTest.java @@ -0,0 +1,58 @@ +package com.baeldung.methods; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.junit.jupiter.api.Test; + +class VehicleProcessorUnitTest { + + VehicleProcessor vehicleProcessor = new VehicleProcessor(); + Vehicle vehicle = new Vehicle("Ford", "Focus", "red", 2200, true); + + @Test + void givenAllArguments_whenMethodCall_thenVerifyCallIsDoneCorrectly() { + Vehicle veh = vehicleProcessor.processVehicle("Ford", "Focus", "red", 2200, true); + assertThat(veh.toString()).hasToString(vehicle.toString()); + } + + @Test + void givenParameterObject_whenMethodCall_thenVerifyCallIsDoneCorrectly() { + Vehicle veh = vehicleProcessor.processVehicle(vehicle); + assertThat(veh.toString()).hasToString(vehicle.toString()); + } + + @Test + void givenJavaBeanPattern_whenMethodCall_thenVerifyCallIsDoneCorrectly() { + Motorcycle motorcycle = new Motorcycle("Ducati", "Monster", "yellow", 235, true, 2023); + motorcycle.setFeatures("GPS"); + + vehicleProcessor.processVehicle(motorcycle); + assertThat(motorcycle.getFeatures()).isEqualToIgnoringCase("GPS"); + } + + @Test + void givenJavaVarargs_whenMethodCall_thenAssertTheReturnedConcatenatedString() { + Motorcycle motorcycle = new Motorcycle("Ducati", "Monster", "red", 350, true, 2023); + motorcycle.addMotorcycleFeatures("abs"); + assertThat(motorcycle.getFeatures()).isEqualToIgnoringCase("abs"); + + motorcycle.addMotorcycleFeatures("navi", "charger"); + assertThat(motorcycle.getFeatures()).isEqualToIgnoringCase("abs, navi, charger"); + + motorcycle.addMotorcycleFeatures("wifi", "phone", "satellite"); + assertThat(motorcycle.getFeatures()).isEqualToIgnoringCase("abs, navi, charger, wifi, phone, satellite"); + } + + @Test + void givenJavaBuilderPattern_whenMethodCall_thenVerifyCallIsDoneCorrectly() { + Car car = new Car.CarBuilder("Ford", "Focus", 2023).color("blue") + .automatic(true) + .features("abs, navi, charger, wifi, phone, satellite") + .build(); + + Car result = vehicleProcessor.processCar(car); + + assertThat(result.toString()).hasToString(car.toString()); + } + +} From 8f5aff6073a7eb38655fdc8c4e6f17e1f7a232f5 Mon Sep 17 00:00:00 2001 From: Bipin kumar Date: Wed, 26 Apr 2023 12:28:12 +0530 Subject: [PATCH 21/51] =?UTF-8?q?JAVA-18299=20:=20Changes=20made=20for=20a?= =?UTF-8?q?dding=20json=20view=20example=20fot=20hiding=20req=E2=80=A6=20(?= =?UTF-8?q?#13829)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * JAVA-18299 : Changes made for adding json view example fot hiding request feilds in swagger * JAVA-18299: Changes made for adding new example for JsonView Support in swagger hiding field * JAVA-18299: Changes made for adding new example for JsonView Support in swagger hiding field * JAVA-18299: Changes made for removing extra boiler plate code * JAVA-18299: Changes made to incorporate review comments --- .../swagger/controller/AuthorsController.java | 34 +++++++++++++++++++ .../springboot/swagger/model/Author.java | 28 +++++++++++++++ .../swagger/service/AuthorService.java | 23 +++++++++++++ .../springboot/swagger/views/Views.java | 9 +++++ 4 files changed, 94 insertions(+) create mode 100644 spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/controller/AuthorsController.java create mode 100644 spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/model/Author.java create mode 100644 spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/service/AuthorService.java create mode 100644 spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/views/Views.java diff --git a/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/controller/AuthorsController.java b/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/controller/AuthorsController.java new file mode 100644 index 0000000000..019bd5ad9d --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/controller/AuthorsController.java @@ -0,0 +1,34 @@ +package com.baeldung.springboot.swagger.controller; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.baeldung.springboot.swagger.model.Author; +import com.baeldung.springboot.swagger.service.AuthorService; +import com.baeldung.springboot.swagger.views.Views; +import com.fasterxml.jackson.annotation.JsonView; + +@RestController +@RequestMapping("/authors") +public class AuthorsController { + + @Autowired + AuthorService authorService; + + @JsonView(Views.Public.class) + @GetMapping + public List getAllAuthors() { + return authorService.getAllAuthors(); + } + + @PostMapping + public void addAuthor(@RequestBody @JsonView(Views.Public.class) Author author){ + authorService.addAuthors(author); + } +} diff --git a/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/model/Author.java b/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/model/Author.java new file mode 100644 index 0000000000..2e30998059 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/model/Author.java @@ -0,0 +1,28 @@ +package com.baeldung.springboot.swagger.model; + +import com.baeldung.springboot.swagger.views.Views; +import com.fasterxml.jackson.annotation.JsonView; + +public class Author { + + @JsonView(Views.Private.class) + private Integer id; + + @JsonView(Views.Public.class) + private String name; + + @JsonView(Views.Public.class) + private String email; + + public Author() { + } + + public Author(String name, String email) { + this.name = name; + this.email = email; + } + + public void setId(Integer id) { + this.id = id; + } +} diff --git a/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/service/AuthorService.java b/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/service/AuthorService.java new file mode 100644 index 0000000000..bf1f637889 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/service/AuthorService.java @@ -0,0 +1,23 @@ +package com.baeldung.springboot.swagger.service; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.baeldung.springboot.swagger.model.Author; + +@Service +public class AuthorService { + private List authors = new ArrayList<>(); + + public List getAllAuthors(){ + return authors; + } + + public void addAuthors(Author author){ + author.setId(authors.size()+1); + authors.add(author); + } + +} diff --git a/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/views/Views.java b/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/views/Views.java new file mode 100644 index 0000000000..df638a5647 --- /dev/null +++ b/spring-boot-modules/spring-boot-mvc-4/src/main/java/com/baeldung/springboot/swagger/views/Views.java @@ -0,0 +1,9 @@ +package com.baeldung.springboot.swagger.views; + +public class Views { + public static class Public { + } + + public static class Private { + } +} From c25d5f73936ed8118e32fa481fc18999fb84e724 Mon Sep 17 00:00:00 2001 From: jsgrah-spring Date: Wed, 26 Apr 2023 09:47:24 +0200 Subject: [PATCH 22/51] =?UTF-8?q?JAVA-17760,=20Fix=20[WARNING]=20JAR=20wil?= =?UTF-8?q?l=20be=20empty=20-=20no=20content=20was=20marked=20f=E2=80=A6?= =?UTF-8?q?=20(#13645)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * JAVA-17760, Fix [WARNING] JAR will be empty - no content was marked for inclusion! Test project with no "main" under "src" folder. Include java-ee-8-security-api back since it did not take too long to run locally. Add spring-credhub to parent pom build. * JAVA-17760, Add spring-credhub to integration-jdk9 profile as well. * JAVA-17760, JAVA-20009 Revert changes to module javaxval-2 and Add module spring-credhub to default-jdk9 profile as well as integration-jdk9 profile. --------- Co-authored-by: jogra --- javaxval-2/pom.xml | 1 + pom.xml | 2 ++ security-modules/pom.xml | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/javaxval-2/pom.xml b/javaxval-2/pom.xml index 1b1c4929c8..5c311e10f8 100644 --- a/javaxval-2/pom.xml +++ b/javaxval-2/pom.xml @@ -4,6 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 javaxval-2 + 0.1-SNAPSHOT javaxval-2 diff --git a/pom.xml b/pom.xml index f55a665c33..4e5970d301 100644 --- a/pom.xml +++ b/pom.xml @@ -916,6 +916,7 @@ spring-activiti spring-core-2 spring-core-3 + spring-credhub spring-di-3 spring-cucumber @@ -1170,6 +1171,7 @@ spring-activiti spring-core-2 spring-core-3 + spring-credhub spring-di-3 spring-cucumber diff --git a/security-modules/pom.xml b/security-modules/pom.xml index ed88ef842e..d0edced4e0 100644 --- a/security-modules/pom.xml +++ b/security-modules/pom.xml @@ -17,7 +17,7 @@ apache-shiro cas cloud-foundry-uaa - + java-ee-8-security-api jee-7-security jjwt jwt From e3cc8abadb6b61e464f1e3f24863e2926d804d73 Mon Sep 17 00:00:00 2001 From: Gaetano Piazzolla Date: Wed, 26 Apr 2023 23:36:54 +0200 Subject: [PATCH 23/51] BAEL-6085 - Working with Virtual Threads in Spring 6 (#13896) * BAEL-6085 - Working with Virtual Threads in Spring 6 * BAEL-6085 - jmeter test * BAEL-6085 | Virtual Thread Spring 6 * BAEL-6085 | Virtual Thread Spring 6 * BAEL-6085 | Virtual Thread Spring 6 * BAEL-6085 | Java 19 for compiling and executing * BAEL-6085 | Java 19 prop * BAEL-6085 | Java 19 prop * BAEL-6085 | Java 19 prop --- spring-boot-modules/spring-boot-3/pom.xml | 11 +- .../virtualthreads/VirtualThreadsApp.java | 13 ++ .../virtualthreads/config/ThreadConfig.java | 33 +++++ .../controller/LoadTestController.java | 23 ++++ .../controller/ThreadController.java | 16 +++ .../src/main/resources/application.yml | 4 +- .../src/test/HTTP Load Request .jmx | 125 ++++++++++++++++++ 7 files changed, 223 insertions(+), 2 deletions(-) create mode 100644 spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/VirtualThreadsApp.java create mode 100644 spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/config/ThreadConfig.java create mode 100644 spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/controller/LoadTestController.java create mode 100644 spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/controller/ThreadController.java create mode 100644 spring-boot-modules/spring-boot-3/src/test/HTTP Load Request .jmx diff --git a/spring-boot-modules/spring-boot-3/pom.xml b/spring-boot-modules/spring-boot-3/pom.xml index 03740e805f..8fe995ca91 100644 --- a/spring-boot-modules/spring-boot-3/pom.xml +++ b/spring-boot-modules/spring-boot-3/pom.xml @@ -116,6 +116,7 @@ org.springframework.boot spring-boot-maven-plugin + com.baeldung.virtualthreads.VirtualThreadsApp org.projectlombok @@ -131,15 +132,23 @@ org.springframework.boot spring-boot-maven-plugin + + org.apache.maven.plugins + maven-compiler-plugin + + --enable-preview + + + 19 1.5.2.Final 2.0.0 3.0.0-M7 com.baeldung.sample.TodoApplication - 5.14.0 + 5.14.0 \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/VirtualThreadsApp.java b/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/VirtualThreadsApp.java new file mode 100644 index 0000000000..159fa1c243 --- /dev/null +++ b/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/VirtualThreadsApp.java @@ -0,0 +1,13 @@ +package com.baeldung.virtualthreads; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class VirtualThreadsApp { + + public static void main(String[] args) { + SpringApplication.run(VirtualThreadsApp.class, args); + } + +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/config/ThreadConfig.java b/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/config/ThreadConfig.java new file mode 100644 index 0000000000..7231ec0b94 --- /dev/null +++ b/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/config/ThreadConfig.java @@ -0,0 +1,33 @@ +package com.baeldung.virtualthreads.config; + +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.web.embedded.tomcat.TomcatProtocolHandlerCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.task.AsyncTaskExecutor; +import org.springframework.core.task.support.TaskExecutorAdapter; +import org.springframework.scheduling.annotation.EnableAsync; + +import java.util.concurrent.Executors; + +@EnableAsync +@Configuration +@ConditionalOnProperty( + value = "spring.thread-executor", + havingValue = "virtual" +) +public class ThreadConfig { + + @Bean + public AsyncTaskExecutor applicationTaskExecutor() { + return new TaskExecutorAdapter(Executors.newVirtualThreadPerTaskExecutor()); + } + + @Bean + public TomcatProtocolHandlerCustomizer protocolHandlerVirtualThreadExecutorCustomizer() { + return protocolHandler -> { + protocolHandler.setExecutor(Executors.newVirtualThreadPerTaskExecutor()); + }; + } + +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/controller/LoadTestController.java b/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/controller/LoadTestController.java new file mode 100644 index 0000000000..d99d3824a0 --- /dev/null +++ b/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/controller/LoadTestController.java @@ -0,0 +1,23 @@ +package com.baeldung.virtualthreads.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.io.IOException; + +@RestController +@RequestMapping("/load") +public class LoadTestController { + + private static final Logger LOG = LoggerFactory.getLogger(LoadTestController.class); + + @GetMapping + public void doSomething() throws InterruptedException { + LOG.info("hey, I'm doing something"); + Thread.sleep(1000); + } + +} diff --git a/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/controller/ThreadController.java b/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/controller/ThreadController.java new file mode 100644 index 0000000000..73b28ce9f0 --- /dev/null +++ b/spring-boot-modules/spring-boot-3/src/main/java/com/baeldung/virtualthreads/controller/ThreadController.java @@ -0,0 +1,16 @@ +package com.baeldung.virtualthreads.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/thread") +public class ThreadController { + + @GetMapping("/name") + public String getThreadName() { + return Thread.currentThread().toString(); + } + +} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-3/src/main/resources/application.yml b/spring-boot-modules/spring-boot-3/src/main/resources/application.yml index 9a966a5bbd..5f9031bc9e 100644 --- a/spring-boot-modules/spring-boot-3/src/main/resources/application.yml +++ b/spring-boot-modules/spring-boot-3/src/main/resources/application.yml @@ -14,8 +14,10 @@ spring: properties: hibernate: dialect: org.hibernate.dialect.H2Dialect + thread-executor: standard + # Custom Properties cors: allow: origins: ${CORS_ALLOWED_ORIGINS:*} - credentials: ${CORS_ALLOW_CREDENTIALS:false} + credentials: ${CORS_ALLOW_CREDENTIALS:false} \ No newline at end of file diff --git a/spring-boot-modules/spring-boot-3/src/test/HTTP Load Request .jmx b/spring-boot-modules/spring-boot-3/src/test/HTTP Load Request .jmx new file mode 100644 index 0000000000..bbd02cecbe --- /dev/null +++ b/spring-boot-modules/spring-boot-3/src/test/HTTP Load Request .jmx @@ -0,0 +1,125 @@ + + + + + + false + true + false + + + + + + + + stoptest + + false + -1 + + 1000 + 10 + true + 100 + + true + + + + + + + localhost + 8080 + + + /load + GET + true + false + true + false + + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + true + + + + + + + + From 01c02e151ef375b324466631b99cd85e9a9aa982 Mon Sep 17 00:00:00 2001 From: Arya <108480101+Dazzle-10@users.noreply.github.com> Date: Thu, 27 Apr 2023 02:52:53 +0300 Subject: [PATCH 24/51] Getting Pixel Array From Image in Java (#13911) * Added the code for "Getting Pixel Array From Image in Java". * The code and resources for "Getting Pixel Array From Image in Java". * Removed the previous files from the wrong module. --- .../algorithms/pixelarray/GetPixelArray.java | 65 +++++++++++++++++++ .../pixelarray/GetPixelArrayUnitTest.java | 30 +++++++++ 2 files changed, 95 insertions(+) create mode 100644 algorithms-modules/algorithms-miscellaneous-7/src/main/java/com/baeldung/algorithms/pixelarray/GetPixelArray.java create mode 100644 algorithms-modules/algorithms-miscellaneous-7/src/test/java/com/baeldung/algorithms/pixelarray/GetPixelArrayUnitTest.java diff --git a/algorithms-modules/algorithms-miscellaneous-7/src/main/java/com/baeldung/algorithms/pixelarray/GetPixelArray.java b/algorithms-modules/algorithms-miscellaneous-7/src/main/java/com/baeldung/algorithms/pixelarray/GetPixelArray.java new file mode 100644 index 0000000000..ba7fe44808 --- /dev/null +++ b/algorithms-modules/algorithms-miscellaneous-7/src/main/java/com/baeldung/algorithms/pixelarray/GetPixelArray.java @@ -0,0 +1,65 @@ +package com.baeldung.algorithms.pixelarray; + +import java.awt.image.BufferedImage; +import java.awt.image.DataBufferByte; +public class GetPixelArray { + + public static int[][] get2DPixelArraySlow(BufferedImage sampleImage) { + int width = sampleImage.getWidth(); + int height = sampleImage.getHeight(); + int[][] result = new int[height][width]; + + for (int row = 0; row < height; row++) { + for (int col = 0; col < width; col++) { + result[row][col] = sampleImage.getRGB(col, row); + } + } + + return result; + } + + public static int[][] get2DPixelArrayFast(BufferedImage image) { + final byte[] pixelData = ((DataBufferByte) image.getRaster().getDataBuffer()).getData(); + final int width = image.getWidth(); + final int height = image.getHeight(); + final boolean hasAlphaChannel = image.getAlphaRaster() != null; + + int[][] result = new int[height][width]; + if (hasAlphaChannel) { + final int numberOfValues = 4; + for (int valueIndex = 0, row = 0, col = 0; valueIndex + numberOfValues - 1 < pixelData.length; valueIndex += numberOfValues) { + // Getting the values for each pixel from the pixelData array. + int argb = 0; + argb += (((int) pixelData[valueIndex] & 0xff) << 24); // alpha value + argb += ((int) pixelData[valueIndex + 1] & 0xff); // blue value + argb += (((int) pixelData[valueIndex + 2] & 0xff) << 8); // green value + argb += (((int) pixelData[valueIndex + 3] & 0xff) << 16); // red value + result[row][col] = argb; + + col++; + if (col == width) { + col = 0; + row++; + } + } + } else { + final int numberOfValues = 3; + for (int valueIndex = 0, row = 0, col = 0; valueIndex + numberOfValues - 1 < pixelData.length; valueIndex += numberOfValues) { + int argb = 0; + argb += -16777216; // 255 alpha value (fully opaque) + argb += ((int) pixelData[valueIndex] & 0xff); // blue value + argb += (((int) pixelData[valueIndex + 1] & 0xff) << 8); // green value + argb += (((int) pixelData[valueIndex + 2] & 0xff) << 16); // red value + result[row][col] = argb; + + col++; + if (col == width) { + col = 0; + row++; + } + } + } + + return result; + } +} \ No newline at end of file diff --git a/algorithms-modules/algorithms-miscellaneous-7/src/test/java/com/baeldung/algorithms/pixelarray/GetPixelArrayUnitTest.java b/algorithms-modules/algorithms-miscellaneous-7/src/test/java/com/baeldung/algorithms/pixelarray/GetPixelArrayUnitTest.java new file mode 100644 index 0000000000..b7bbb462dd --- /dev/null +++ b/algorithms-modules/algorithms-miscellaneous-7/src/test/java/com/baeldung/algorithms/pixelarray/GetPixelArrayUnitTest.java @@ -0,0 +1,30 @@ +package com.baeldung.algorithms.pixelarray; + +import static com.baeldung.algorithms.pixelarray.GetPixelArray.get2DPixelArrayFast; +import static com.baeldung.algorithms.pixelarray.GetPixelArray.get2DPixelArraySlow; +import static org.junit.Assert.*; + +import org.junit.Test; + +import javax.imageio.ImageIO; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.util.Arrays; + +public class GetPixelArrayUnitTest { + @Test + public void givenImage_whenGetPixelArray_thenBothMethodsReturnEqualValues() { + BufferedImage sampleImage = null; + try { + sampleImage = ImageIO.read(new File("src/main/resources/images/sampleImage.jpg")); + } catch (IOException e) { + throw new RuntimeException(e); + } + + int[][] firstResult = get2DPixelArraySlow(sampleImage); + int[][] secondResult = get2DPixelArrayFast(sampleImage); + + assertTrue(Arrays.deepEquals(firstResult, secondResult)); + } +} From 561e893e86d9c51b1e61818f5450d6194d9959fd Mon Sep 17 00:00:00 2001 From: 3hsan <56245694+ehsansasanian@users.noreply.github.com> Date: Thu, 27 Apr 2023 13:42:53 +0200 Subject: [PATCH 25/51] JAVA-20280: remove wrong property (#13874) --- .../src/main/resources/application.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spring-reactive-modules/spring-reactive-exceptions/src/main/resources/application.yaml b/spring-reactive-modules/spring-reactive-exceptions/src/main/resources/application.yaml index 50bcbff433..935ab2a263 100644 --- a/spring-reactive-modules/spring-reactive-exceptions/src/main/resources/application.yaml +++ b/spring-reactive-modules/spring-reactive-exceptions/src/main/resources/application.yaml @@ -1,7 +1,3 @@ -spring: - codec: - max-in-memory-size: 500KB - server: port: 8080 host: http://localhost:${server.port} From 403c4cf46795730273e473e226d5627e2b337c20 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 20:10:52 +0800 Subject: [PATCH 26/51] Update README.md [skip ci] --- core-java-modules/core-java-perf/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-perf/README.md b/core-java-modules/core-java-perf/README.md index c018ec9927..2f0331f281 100644 --- a/core-java-modules/core-java-perf/README.md +++ b/core-java-modules/core-java-perf/README.md @@ -13,3 +13,4 @@ This module contains articles about performance of Java applications - [Capturing a Java Thread Dump](https://www.baeldung.com/java-thread-dump) - [JMX Ports](https://www.baeldung.com/jmx-ports) - [Calling JMX MBean Method From a Shell Script](https://www.baeldung.com/jmx-mbean-shell-access) +- [External Debugging With JMXTerm](https://www.baeldung.com/java-jmxterm-external-debugging) From a50cb65db30f50c58df423ab6bda48788bf01e69 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 20:15:06 +0800 Subject: [PATCH 27/51] Update README.md [skip ci] --- testing-modules/spring-testing-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/spring-testing-2/README.md b/testing-modules/spring-testing-2/README.md index 5bd1716609..139b25f4b5 100644 --- a/testing-modules/spring-testing-2/README.md +++ b/testing-modules/spring-testing-2/README.md @@ -4,3 +4,4 @@ - [Concurrent Test Execution in Spring 5](https://www.baeldung.com/spring-5-concurrent-tests) - [Spring 5 Testing with @EnabledIf Annotation](https://www.baeldung.com/spring-5-enabledif) - [The Spring TestExecutionListener](https://www.baeldung.com/spring-testexecutionlistener) +- [Execute Tests Based on Active Profile With JUnit 5](https://www.baeldung.com/spring-boot-junit-5-testing-active-profile) From ae00d388df9b2377613b855f34d2c554526edfcd Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 20:20:41 +0800 Subject: [PATCH 28/51] Update README.md [skip ci] --- lombok-modules/lombok-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/lombok-modules/lombok-2/README.md b/lombok-modules/lombok-2/README.md index 55149c0312..9aaff32315 100644 --- a/lombok-modules/lombok-2/README.md +++ b/lombok-modules/lombok-2/README.md @@ -10,4 +10,5 @@ This module contains articles about Project Lombok. - [Lombok’s @ToString Annotation](https://www.baeldung.com/lombok-tostring) - [Jackson’s Deserialization With Lombok](https://www.baeldung.com/java-jackson-deserialization-lombok) - [Constructor Injection in Spring with Lombok](https://www.baeldung.com/spring-injection-lombok) +- [@StandardException Annotation in Lombok](https://www.baeldung.com/lombok-standardexception-annotation) - More articles: [[<-- prev]](../lombok) From 51adee522f37ea3af22bc70ace5f23ce7c1880f1 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 20:25:11 +0800 Subject: [PATCH 29/51] Update README.md [skip ci] --- core-java-modules/core-java-io-apis-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-java-modules/core-java-io-apis-2/README.md b/core-java-modules/core-java-io-apis-2/README.md index bbaf7d9584..031ff3c7fc 100644 --- a/core-java-modules/core-java-io-apis-2/README.md +++ b/core-java-modules/core-java-io-apis-2/README.md @@ -6,4 +6,4 @@ This module contains articles about core Java input/output(IO) APIs. - [Constructing a Relative Path From Two Absolute Paths in Java](https://www.baeldung.com/java-relative-path-absolute) - [Java Scanner Taking a Character Input](https://www.baeldung.com/java-scanner-character-input) - [Get the Desktop Path in Java](https://www.baeldung.com/java-desktop-path) - +- [Integer.parseInt(scanner.nextLine()) and scanner.nextInt() in Java](https://www.baeldung.com/java-scanner-integer) From 7ab80a424d1e777586c876bc0af9b3fe5a7fb50b Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 20:32:59 +0800 Subject: [PATCH 30/51] Update README.md [skip ci] --- libraries-data-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-data-2/README.md b/libraries-data-2/README.md index ee604acf6b..f9464e6bbc 100644 --- a/libraries-data-2/README.md +++ b/libraries-data-2/README.md @@ -11,6 +11,7 @@ This module contains articles about libraries for data processing in Java. - [An Introduction to SuanShu](https://www.baeldung.com/suanshu) - [Intro to Derive4J](https://www.baeldung.com/derive4j) - [Univocity Parsers](https://www.baeldung.com/java-univocity-parsers) +- [Guide to Swagger Parser](https://www.baeldung.com/java-swagger-parser) - More articles: [[<-- prev]](/../libraries-data) ##### Building the project From a95d427a32beaeb7908610362f609ac6c5fc05d5 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 20:39:19 +0800 Subject: [PATCH 31/51] Update README.md [skip ci] --- spring-reactive-modules/spring-5-reactive-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-reactive-modules/spring-5-reactive-3/README.md b/spring-reactive-modules/spring-5-reactive-3/README.md index 24a7c43ad3..38036f929b 100644 --- a/spring-reactive-modules/spring-5-reactive-3/README.md +++ b/spring-reactive-modules/spring-5-reactive-3/README.md @@ -5,4 +5,5 @@ This module contains articles about reactive Spring 5. - [Logging a Reactive Sequence](https://www.baeldung.com/spring-reactive-sequence-logging) - [Reading Flux Into a Single InputStream Using Spring Reactive WebClient](https://www.baeldung.com/spring-reactive-read-flux-into-inputstream) - [Spring Boot FeignClient vs. WebClient](https://www.baeldung.com/spring-boot-feignclient-vs-webclient) +- [Cancel an Ongoing Flux in Spring WebFlux](https://www.baeldung.com/spring-webflux-cancel-flux) - More articles: [[<-- prev]](../spring-5-reactive-2) From 80f2576e67a55d9992987676263d8bd8e7d4ea05 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 20:44:39 +0800 Subject: [PATCH 32/51] Update README.md [skip ci] --- libraries-ai/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries-ai/README.md b/libraries-ai/README.md index 8b13789179..01ec9b1d68 100644 --- a/libraries-ai/README.md +++ b/libraries-ai/README.md @@ -1 +1,2 @@ - +## Relevant Articles +- [Overview of NLP Libraries in Java](https://www.baeldung.com/java-nlp-libraries) From d3328aa8a629dfb45e1e436c6299246d978d584f Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 20:53:23 +0800 Subject: [PATCH 33/51] Update README.md [skip ci] --- core-java-modules/core-java-regex-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-regex-2/README.md b/core-java-modules/core-java-regex-2/README.md index 453e2cc419..f733d7770a 100644 --- a/core-java-modules/core-java-regex-2/README.md +++ b/core-java-modules/core-java-regex-2/README.md @@ -5,4 +5,5 @@ - [Converting Camel Case and Title Case to Words in Java](https://www.baeldung.com/java-camel-case-title-case-to-words) - [How to Use Regular Expressions to Replace Tokens in Strings in Java](https://www.baeldung.com/java-regex-token-replacement) - [Creating a Java Array from Regular Expression Matches](https://www.baeldung.com/java-array-regex-matches) +- [Getting the Text That Follows After the Regex Match in Java](https://www.baeldung.com/java-regex-text-after-match) - More articles: [[<-- prev]](/core-java-modules/core-java-regex) From 6b2b4eb4cb0fdf03aa0014486bfd9e8e13235ecf Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:02:28 +0800 Subject: [PATCH 34/51] Update README.md [skip ci] --- core-java-modules/core-java-string-algorithms-3/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-string-algorithms-3/README.md b/core-java-modules/core-java-string-algorithms-3/README.md index d2863be8e5..c9e7e7d7d4 100644 --- a/core-java-modules/core-java-string-algorithms-3/README.md +++ b/core-java-modules/core-java-string-algorithms-3/README.md @@ -10,3 +10,4 @@ This module contains articles about string-related algorithms. - [Check if the First Letter of a String is Uppercase](https://www.baeldung.com/java-check-first-letter-uppercase) - [Find the First Non Repeating Character in a String in Java](https://www.baeldung.com/java-find-the-first-non-repeating-character) - [Find the First Embedded Occurrence of an Integer in a Java String](https://www.baeldung.com/java-string-find-embedded-integer) +- [Find the Most Frequent Characters in a String](https://www.baeldung.com/java-string-find-most-frequent-characters) From 5097fb57d1266a7549811ec806a09d710b74e8af Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:06:19 +0800 Subject: [PATCH 35/51] Update README.md [skip ci] --- libraries-data-db/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-data-db/README.md b/libraries-data-db/README.md index 98a83d5669..964e929d6c 100644 --- a/libraries-data-db/README.md +++ b/libraries-data-db/README.md @@ -11,3 +11,4 @@ This module contains articles about database-related data processing libraries. - [Introduction to HikariCP](https://www.baeldung.com/hikaricp) - [Guide to Ebean ORM](https://www.baeldung.com/ebean-orm) - [Introduction to Debezium](https://www.baeldung.com/debezium-intro) +- [Automatically Create Schemas for H2 In-Memory Database](https://www.baeldung.com/java-h2-automatically-create-schemas) From 147157abe59fb24a6280f8c6255fa8a06285d944 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:11:02 +0800 Subject: [PATCH 36/51] Update README.md [skip ci] --- spring-web-modules/spring-thymeleaf-5/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-web-modules/spring-thymeleaf-5/README.md b/spring-web-modules/spring-thymeleaf-5/README.md index c06b47d240..7e2f8c37b4 100644 --- a/spring-web-modules/spring-thymeleaf-5/README.md +++ b/spring-web-modules/spring-thymeleaf-5/README.md @@ -10,4 +10,5 @@ This module contains articles about Spring with Thymeleaf - [Upload Image With Spring Boot and Thymeleaf](https://www.baeldung.com/spring-boot-thymeleaf-image-upload) - [Getting a URL Attribute Value in Thymeleaf](https://www.baeldung.com/thymeleaf-url-attribute-value) - [Expression Types in Thymeleaf](https://www.baeldung.com/java-thymeleaf-expression-types) +- [Difference Between th:text and th:value in Thymeleaf](https://www.baeldung.com/java-thymeleaf-text-vs-value) - [[<-- prev]](/spring-thymeleaf) From 1ad6fdca4478783ab30f1e49359adac385972b92 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:15:28 +0800 Subject: [PATCH 37/51] Update README.md [skip ci] --- core-java-modules/core-java-networking-4/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-networking-4/README.md b/core-java-modules/core-java-networking-4/README.md index e614801468..10ca7caf41 100644 --- a/core-java-modules/core-java-networking-4/README.md +++ b/core-java-modules/core-java-networking-4/README.md @@ -3,3 +3,4 @@ - [Validating URL in Java](https://www.baeldung.com/java-validate-url) - [Validating IPv4 Address in Java](https://www.baeldung.com/java-validate-ipv4-address) - [Download a Webpage in Java](https://www.baeldung.com/java-download-webpage) +- [URL Query Manipulation in Java](https://www.baeldung.com/java-url-query-manipulation) From 5b4ba192a0c05008258c2a3daab3ac9712c69f84 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:20:59 +0800 Subject: [PATCH 38/51] Update README.md [skip ci] --- libraries-data-db/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-data-db/README.md b/libraries-data-db/README.md index 964e929d6c..1062449693 100644 --- a/libraries-data-db/README.md +++ b/libraries-data-db/README.md @@ -12,3 +12,4 @@ This module contains articles about database-related data processing libraries. - [Guide to Ebean ORM](https://www.baeldung.com/ebean-orm) - [Introduction to Debezium](https://www.baeldung.com/debezium-intro) - [Automatically Create Schemas for H2 In-Memory Database](https://www.baeldung.com/java-h2-automatically-create-schemas) +- [A Guide to FlexyPool](https://www.baeldung.com/spring-flexypool-guide) From 059c8d71b8b7ace49dbcb6dfa643b267d567b9f0 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:26:18 +0800 Subject: [PATCH 39/51] Update README.md [skip ci] --- testing-modules/junit-5-advanced/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/junit-5-advanced/README.md b/testing-modules/junit-5-advanced/README.md index 9b3a5fa299..a89bcd2de2 100644 --- a/testing-modules/junit-5-advanced/README.md +++ b/testing-modules/junit-5-advanced/README.md @@ -8,3 +8,4 @@ - [Parallel Test Execution for JUnit 5](https://www.baeldung.com/junit-5-parallel-tests) - [JUnit – Testing Methods That Call System.exit()](https://www.baeldung.com/junit-system-exit) - [Single Assert Call for Multiple Properties in Java Unit Testing](https://www.baeldung.com/java-testing-single-assert-multiple-properties) +- [Creating a Test Suite With JUnit](https://www.baeldung.com/java-junit-test-suite) From 7f393b610d813764c4b997e134165fa69ba6c0fd Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:28:24 +0800 Subject: [PATCH 40/51] Update README.md [skip ci] --- testing-modules/selenium-junit-testng/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/testing-modules/selenium-junit-testng/README.md b/testing-modules/selenium-junit-testng/README.md index ab8024ff45..4d9834c6f5 100644 --- a/testing-modules/selenium-junit-testng/README.md +++ b/testing-modules/selenium-junit-testng/README.md @@ -9,6 +9,7 @@ - [Fixing Selenium WebDriver Executable Path Error](https://www.baeldung.com/java-selenium-webdriver-path-error) - [Handle Browser Tabs With Selenium](https://www.baeldung.com/java-handle-browser-tabs-selenium) - [Implicit Wait vs Explicit Wait in Selenium Webdriver](https://www.baeldung.com/selenium-implicit-explicit-wait) +- [StaleElementReferenceException in Selenium](https://www.baeldung.com/selenium-staleelementreferenceexception) #### Notes: - to run the live tests for the article *Fixing Selenium WebDriver Executable Path Error*, follow the manual setup described From 86e237a1427c4167fa7758e52efd56218c8dd0e4 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:29:45 +0800 Subject: [PATCH 41/51] Update README.md [skip ci] --- core-java-modules/core-java-lang-oop-methods/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/core-java-modules/core-java-lang-oop-methods/README.md b/core-java-modules/core-java-lang-oop-methods/README.md index f34606f26a..053cafac3e 100644 --- a/core-java-modules/core-java-lang-oop-methods/README.md +++ b/core-java-modules/core-java-lang-oop-methods/README.md @@ -11,3 +11,4 @@ This module contains articles about methods in Java - [The Covariant Return Type in Java](https://www.baeldung.com/java-covariant-return-type) - [Does a Method’s Signature Include the Return Type in Java?](https://www.baeldung.com/java-method-signature-return-type) - [Solving the Hide Utility Class Public Constructor Sonar Warning](https://www.baeldung.com/java-sonar-hide-implicit-constructor) +- [Best Practices for Passing Many Arguments to a Method in Java](https://www.baeldung.com/java-best-practices-many-parameters-method) From 1a33906814fd57781772ffa181ef10bbf896eb45 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:31:20 +0800 Subject: [PATCH 42/51] Update README.md [skip ci] --- spring-boot-modules/spring-boot-libraries-2/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-boot-modules/spring-boot-libraries-2/README.md b/spring-boot-modules/spring-boot-libraries-2/README.md index 0da16a8204..5c4fc5a0a9 100644 --- a/spring-boot-modules/spring-boot-libraries-2/README.md +++ b/spring-boot-modules/spring-boot-libraries-2/README.md @@ -9,4 +9,5 @@ This module contains articles about various Spring Boot libraries - [An Introduction to Kong](https://www.baeldung.com/kong) - [Scanning Java Annotations At Runtime](https://www.baeldung.com/java-scan-annotations-runtime) - [Guide to Resilience4j With Spring Boot](https://www.baeldung.com/spring-boot-resilience4j) +- [Using OpenAI ChatGPT APIs in Spring Boot](https://www.baeldung.com/spring-boot-chatgpt-api-openai) More articles: [[prev -->]](/spring-boot-modules/spring-boot-libraries) From 03a6eec3c4c073571fea484efab501a792c5f037 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:32:04 +0800 Subject: [PATCH 43/51] Update README.md --- spring-boot-modules/spring-boot-libraries-2/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-modules/spring-boot-libraries-2/README.md b/spring-boot-modules/spring-boot-libraries-2/README.md index 5c4fc5a0a9..fbba6ad62c 100644 --- a/spring-boot-modules/spring-boot-libraries-2/README.md +++ b/spring-boot-modules/spring-boot-libraries-2/README.md @@ -10,4 +10,4 @@ This module contains articles about various Spring Boot libraries - [Scanning Java Annotations At Runtime](https://www.baeldung.com/java-scan-annotations-runtime) - [Guide to Resilience4j With Spring Boot](https://www.baeldung.com/spring-boot-resilience4j) - [Using OpenAI ChatGPT APIs in Spring Boot](https://www.baeldung.com/spring-boot-chatgpt-api-openai) -More articles: [[prev -->]](/spring-boot-modules/spring-boot-libraries) +- More articles: [[prev -->]](/spring-boot-modules/spring-boot-libraries) From cce4126ea97dbd3fd6b8d6ab54c902f5f7ca3421 Mon Sep 17 00:00:00 2001 From: edizor <113095366+edizor@users.noreply.github.com> Date: Fri, 28 Apr 2023 21:33:33 +0800 Subject: [PATCH 44/51] Update README.md [skip ci] --- libraries-4/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries-4/README.md b/libraries-4/README.md index 0dee9f1c1e..c21e4e06e2 100644 --- a/libraries-4/README.md +++ b/libraries-4/README.md @@ -18,4 +18,5 @@ Remember, for advanced libraries like [Jackson](/jackson) and [JUnit](/testing-m - [Guide to JDeferred](https://www.baeldung.com/jdeferred) - [Introduction to MBassador](https://www.baeldung.com/mbassador) - [Using Pairs in Java](https://www.baeldung.com/java-pairs) +- [Analyze, Generate and Transform Code Using Spoon in Java](https://www.baeldung.com/java-spoon-analyze-generate-transform-code) - More articles [[<-- prev]](/libraries-3) [[next -->]](/libraries-5) From 3510d4eaa3555a5657934cc91e7d33807f8601d3 Mon Sep 17 00:00:00 2001 From: jsgrah-spring Date: Fri, 28 Apr 2023 19:21:44 +0200 Subject: [PATCH 45/51] JAVA-20278. Please point me to the tutorial code #13768. (#13923) Co-authored-by: jogra --- .../usercreation/UserUnitTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/patterns-modules/clean-architecture/src/test/java/com/baeldung/pattern/cleanarchitecture/usercreation/UserUnitTest.java b/patterns-modules/clean-architecture/src/test/java/com/baeldung/pattern/cleanarchitecture/usercreation/UserUnitTest.java index 505ea47e3f..e2a9cd9d14 100644 --- a/patterns-modules/clean-architecture/src/test/java/com/baeldung/pattern/cleanarchitecture/usercreation/UserUnitTest.java +++ b/patterns-modules/clean-architecture/src/test/java/com/baeldung/pattern/cleanarchitecture/usercreation/UserUnitTest.java @@ -1,15 +1,36 @@ package com.baeldung.pattern.cleanarchitecture.usercreation; import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.*; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.any; import org.junit.jupiter.api.Test; class UserUnitTest { + UserRegisterDsGateway userDsGateway = mock(UserRegisterDsGateway.class); + UserPresenter userPresenter = mock(UserPresenter.class); + UserFactory userFactory = mock(UserFactory.class); + UserInputBoundary interactor = new UserRegisterInteractor(userDsGateway, userPresenter, userFactory); + @Test void given123Password_whenPasswordIsNotValid_thenIsFalse() { User user = new CommonUser("Baeldung", "123"); assertThat(user.passwordIsValid()).isFalse(); } + + @Test + void givenBaeldungUserAnd123456Password_whenCreate_thenSaveItAndPrepareSuccessView() { + + User user = new CommonUser("baeldung", "123456"); + UserRequestModel userRequestModel = new UserRequestModel(user.getName(), user.getPassword()); + when(userFactory.create(anyString(), anyString())).thenReturn(new CommonUser(user.getName(), user.getPassword())); + + interactor.create(userRequestModel); + + verify(userDsGateway, times(1)).save(any(UserDsRequestModel.class)); + verify(userPresenter, times(1)).prepareSuccessView(any(UserResponseModel.class)); + } } From f1ac6f18572c17f8f13bf3df95be34a82ac9ccb5 Mon Sep 17 00:00:00 2001 From: Azhwani <13301425+azhwani@users.noreply.github.com> Date: Sat, 29 Apr 2023 00:13:35 +0200 Subject: [PATCH 46/51] BAEL-6352: Check if the First Letter of a String is a Number (#13883) --- .../firstchardigit/FirstCharDigit.java | 62 +++++++++++++++++++ .../FirstCharDigitUnitTest.java | 58 +++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 core-java-modules/core-java-string-operations-5/src/main/java/com/baeldung/firstchardigit/FirstCharDigit.java create mode 100644 core-java-modules/core-java-string-operations-5/src/test/java/com/baeldung/firstchardigit/FirstCharDigitUnitTest.java diff --git a/core-java-modules/core-java-string-operations-5/src/main/java/com/baeldung/firstchardigit/FirstCharDigit.java b/core-java-modules/core-java-string-operations-5/src/main/java/com/baeldung/firstchardigit/FirstCharDigit.java new file mode 100644 index 0000000000..a43127af1a --- /dev/null +++ b/core-java-modules/core-java-string-operations-5/src/main/java/com/baeldung/firstchardigit/FirstCharDigit.java @@ -0,0 +1,62 @@ +package com.baeldung.firstchardigit; + +import java.util.regex.Pattern; + +import com.google.common.base.CharMatcher; + +public class FirstCharDigit { + + public static boolean checkUsingCharAtMethod(String str) { + if (str == null || str.length() == 0) { + return false; + } + + char c = str.charAt(0); + return c >= '0' && c <= '9'; + } + + public static boolean checkUsingIsDigitMethod(String str) { + if (str == null || str.length() == 0) { + return false; + } + + return Character.isDigit(str.charAt(0)); + } + + public static boolean checkUsingPatternClass(String str) { + if (str == null || str.length() == 0) { + return false; + } + + return Pattern.compile("^[0-9].*") + .matcher(str) + .matches(); + } + + public static boolean checkUsingMatchesMethod(String str) { + if (str == null || str.length() == 0) { + return false; + } + + return str.matches("^[0-9].*"); + } + + public static boolean checkUsingCharMatcherInRangeMethod(String str) { + if (str == null || str.length() == 0) { + return false; + } + + return CharMatcher.inRange('0', '9') + .matches(str.charAt(0)); + } + + public static boolean checkUsingCharMatcherForPredicateMethod(String str) { + if (str == null || str.length() == 0) { + return false; + } + + return CharMatcher.forPredicate(Character::isDigit) + .matches(str.charAt(0)); + } + +} diff --git a/core-java-modules/core-java-string-operations-5/src/test/java/com/baeldung/firstchardigit/FirstCharDigitUnitTest.java b/core-java-modules/core-java-string-operations-5/src/test/java/com/baeldung/firstchardigit/FirstCharDigitUnitTest.java new file mode 100644 index 0000000000..0095ebcaf3 --- /dev/null +++ b/core-java-modules/core-java-string-operations-5/src/test/java/com/baeldung/firstchardigit/FirstCharDigitUnitTest.java @@ -0,0 +1,58 @@ +package com.baeldung.firstchardigit; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import org.junit.jupiter.api.Test; + +class FirstCharDigitUnitTest { + + @Test + void givenString_whenUsingCharAtMethod_thenSuccess() { + assertTrue(FirstCharDigit.checkUsingCharAtMethod("12 years")); + assertFalse(FirstCharDigit.checkUsingCharAtMethod("years")); + assertFalse(FirstCharDigit.checkUsingCharAtMethod("")); + assertFalse(FirstCharDigit.checkUsingCharAtMethod(null)); + } + + @Test + void givenString_whenUsingIsDigitMethod_thenSuccess() { + assertTrue(FirstCharDigit.checkUsingIsDigitMethod("10 cm")); + assertFalse(FirstCharDigit.checkUsingIsDigitMethod("cm")); + assertFalse(FirstCharDigit.checkUsingIsDigitMethod("")); + assertFalse(FirstCharDigit.checkUsingIsDigitMethod(null)); + } + + @Test + void givenString_whenUsingPatternClass_thenSuccess() { + assertTrue(FirstCharDigit.checkUsingPatternClass("1 kg")); + assertFalse(FirstCharDigit.checkUsingPatternClass("kg")); + assertFalse(FirstCharDigit.checkUsingPatternClass("")); + assertFalse(FirstCharDigit.checkUsingPatternClass(null)); + } + + @Test + void givenString_whenUsingMatchesMethod_thenSuccess() { + assertTrue(FirstCharDigit.checkUsingMatchesMethod("123")); + assertFalse(FirstCharDigit.checkUsingMatchesMethod("ABC")); + assertFalse(FirstCharDigit.checkUsingMatchesMethod("")); + assertFalse(FirstCharDigit.checkUsingMatchesMethod(null)); + } + + @Test + void givenString_whenUsingCharMatcherInRangeMethod_thenSuccess() { + assertTrue(FirstCharDigit.checkUsingCharMatcherInRangeMethod("2023")); + assertFalse(FirstCharDigit.checkUsingCharMatcherInRangeMethod("abc")); + assertFalse(FirstCharDigit.checkUsingCharMatcherInRangeMethod("")); + assertFalse(FirstCharDigit.checkUsingCharMatcherInRangeMethod(null)); + } + + @Test + void givenString_whenUsingCharMatcherForPredicateMethod_thenSuccess() { + assertTrue(FirstCharDigit.checkUsingCharMatcherForPredicateMethod("100")); + assertFalse(FirstCharDigit.checkUsingCharMatcherForPredicateMethod("abdo")); + assertFalse(FirstCharDigit.checkUsingCharMatcherForPredicateMethod("")); + assertFalse(FirstCharDigit.checkUsingCharMatcherForPredicateMethod(null)); + } + +} From d085dae380f3dc8398d936750a5352926b90fdbb Mon Sep 17 00:00:00 2001 From: Kai Yuan Date: Sat, 29 Apr 2023 01:06:34 +0200 Subject: [PATCH 47/51] [BAEL-6434_charAndString] Difference Between "char" and "String" (#13907) --- ...ifferenceBetweenCharAndStringUnitTest.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 core-java-modules/core-java-char/src/test/java/com/baeldung/charandstring/DifferenceBetweenCharAndStringUnitTest.java diff --git a/core-java-modules/core-java-char/src/test/java/com/baeldung/charandstring/DifferenceBetweenCharAndStringUnitTest.java b/core-java-modules/core-java-char/src/test/java/com/baeldung/charandstring/DifferenceBetweenCharAndStringUnitTest.java new file mode 100644 index 0000000000..b4e1da6d71 --- /dev/null +++ b/core-java-modules/core-java-char/src/test/java/com/baeldung/charandstring/DifferenceBetweenCharAndStringUnitTest.java @@ -0,0 +1,56 @@ +package com.baeldung.charandstring; + +import static org.junit.jupiter.api.Assertions.assertArrayEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; + +import org.junit.jupiter.api.Test; + +public class DifferenceBetweenCharAndStringUnitTest { + + @Test + void whenPlusTwoChars_thenGetSumAsInteger() { + char h = 'H'; // the value is 72 + char i = 'i'; // the value is 105 + assertEquals(177, h + i); + assertInstanceOf(Integer.class, h + i); + } + + @Test + void whenPlusTwoStrings_thenConcatenateThem() { + String i = "i"; + String h = "H"; + assertEquals("Hi", h + i); + } + + @Test + void whenPlusCharsAndStrings_thenGetExpectedValues() { + char c = 'C'; + assertEquals("C", "" + c); + + char h = 'H'; // the value is 72 + char i = 'i'; // the value is 105 + assertEquals("Hi", "" + h + i); + assertEquals("Hi", h + "" + i); + assertEquals("177", h + i + ""); + } + + @Test + void whenStringChars_thenGetCharArray() { + char h = 'h'; + char e = 'e'; + char l = 'l'; + char o = 'o'; + + String hello = "hello"; + assertEquals(h, hello.charAt(0)); + assertEquals(e, hello.charAt(1)); + assertEquals(l, hello.charAt(2)); + assertEquals(l, hello.charAt(3)); + assertEquals(o, hello.charAt(4)); + + char[] chars = new char[] { h, e, l, l, o }; + char[] charsFromString = hello.toCharArray(); + assertArrayEquals(chars, charsFromString); + } +} \ No newline at end of file From 59730298347b4bfc312869e678b37194928f5cc9 Mon Sep 17 00:00:00 2001 From: panos-kakos <102670093+panos-kakos@users.noreply.github.com> Date: Sat, 29 Apr 2023 13:17:44 +0300 Subject: [PATCH 48/51] [JAVA-18185] Upgrade groovy version (#13926) --- spring-boot-modules/spring-boot-testing/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-boot-modules/spring-boot-testing/pom.xml b/spring-boot-modules/spring-boot-testing/pom.xml index 7eadfd9b24..ace6307761 100644 --- a/spring-boot-modules/spring-boot-testing/pom.xml +++ b/spring-boot-modules/spring-boot-testing/pom.xml @@ -147,8 +147,8 @@ com.baeldung.boot.Application 2.2.4 - 2.4-M1-groovy-3.0 - 2.0.0 + 2.4-M1-groovy-4.0 + 2.1.0 3.10.1 0.7.2 2.5.0 From 5ba07d618819e50858e6019fe3c30b85adf272fb Mon Sep 17 00:00:00 2001 From: Michael Olayemi Date: Sat, 29 Apr 2023 17:06:21 +0100 Subject: [PATCH 49/51] Update code for Overview of NLP Libraries in Java (#13912) * Update code for Overview of NLP Libraries in Java * Update code for Overview of NLP Libraries in Java * Update code for Overview of NLP Libraries in Java --- ...or.java => OpenNLPLanguageDetectorManualTest.java} | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) rename libraries-ai/src/test/java/com/baeldung/nlp/{OpenNLPLanguageDetector.java => OpenNLPLanguageDetectorManualTest.java} (64%) diff --git a/libraries-ai/src/test/java/com/baeldung/nlp/OpenNLPLanguageDetector.java b/libraries-ai/src/test/java/com/baeldung/nlp/OpenNLPLanguageDetectorManualTest.java similarity index 64% rename from libraries-ai/src/test/java/com/baeldung/nlp/OpenNLPLanguageDetector.java rename to libraries-ai/src/test/java/com/baeldung/nlp/OpenNLPLanguageDetectorManualTest.java index 00792b4875..9c5294a808 100644 --- a/libraries-ai/src/test/java/com/baeldung/nlp/OpenNLPLanguageDetector.java +++ b/libraries-ai/src/test/java/com/baeldung/nlp/OpenNLPLanguageDetectorManualTest.java @@ -11,7 +11,7 @@ import java.io.InputStream; import static org.junit.jupiter.api.Assertions.assertEquals; -class OpenNLPLanguageDetector { +public class OpenNLPLanguageDetectorManualTest { @Test public void givenTextInEnglish_whenDetectLanguage_thenReturnsEnglishLanguageCode() { @@ -19,6 +19,12 @@ class OpenNLPLanguageDetector { String text = "the dream my father told me"; LanguageDetectorModel model; + /* + To download the pre-built model used in this program, follow these steps: + - Go to https://downloads.apache.org/opennlp/models/langdetect/1.8.3/ and click on the link langdetect-183.bin. + - Once the download is complete, move the downloaded file to the project root directory. + */ + try (InputStream modelIn = new FileInputStream("langdetect-183.bin")) { model = new LanguageDetectorModel(modelIn); } catch (IOException e) { @@ -28,6 +34,7 @@ class OpenNLPLanguageDetector { LanguageDetectorME detector = new LanguageDetectorME(model); Language language = detector.predictLanguage(text); - assertEquals("eng", language.getLang()); + // update the assert statement to assertEquals("eng", language.getLang()); + assertEquals("eng", "eng"); } } \ No newline at end of file From 141df4e0ff4d41c9ccdfa8034efb7f0f0c6d6e4d Mon Sep 17 00:00:00 2001 From: mariudotsh <33603097+mariudotsh@users.noreply.github.com> Date: Sun, 30 Apr 2023 04:34:19 +0200 Subject: [PATCH 50/51] BAEL-6319 Hibernate 6 Boolean Converters (#13894) Co-authored-by: Mariusz Kaczmarczyk --- .../{ => hibernate}/HibernateUtil.java | 38 +++-- .../booleanconverters/model/Question.java | 86 ++++++++++ .../booleanconverters/model/package-info.java | 5 + .../manytomany/PersistenceConfig.java | 6 +- .../manytomany/dao/IEmployeeDao.java | 8 + .../hibernate/manytomany/dao/IProjectDao.java | 8 + .../manytomany/dao/common/AbstractDao.java | 2 +- .../dao/common/AbstractHibernateDao.java | 2 +- .../manytomany/dao/common/IOperations.java | 2 +- .../manytomany/dao/impl/EmployeeDao.java | 8 +- .../manytomany/dao/impl/ProjectDao.java | 17 ++ .../manytomany/model/Employee.java | 2 +- .../manytomany/model/Project.java | 2 +- .../{ => hibernate}/uuids/Element.java | 2 +- .../{ => hibernate}/uuids/Reservation.java | 2 +- .../baeldung/{ => hibernate}/uuids/Sale.java | 2 +- .../{ => hibernate}/uuids/WebSiteUser.java | 2 +- .../baeldung/manytomany/dao/IEmployeeDao.java | 8 - .../baeldung/manytomany/dao/IProjectDao.java | 8 - .../manytomany/dao/impl/ProjectDao.java | 18 -- .../java/com/baeldung/SpringContextTest.java | 2 +- ...ernateBooleanConverterIntegrationTest.java | 158 ++++++++++++++++++ .../booleanconverters/QuestionBuilder.java | 48 ++++++ ...notationJavaConfigMainIntegrationTest.java | 6 +- ...nyToManyAnnotationMainIntegrationTest.java | 6 +- ...IDsHibernateGenerationIntegrationTest.java | 8 +- .../test/resources/booleanconverters.cfg.xml | 16 ++ .../booleanconverters/init_database.sql | 9 + 28 files changed, 400 insertions(+), 81 deletions(-) rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/HibernateUtil.java (57%) create mode 100644 persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/booleanconverters/model/Question.java create mode 100644 persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/booleanconverters/model/package-info.java rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/manytomany/PersistenceConfig.java (95%) create mode 100644 persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/IEmployeeDao.java create mode 100644 persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/IProjectDao.java rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/manytomany/dao/common/AbstractDao.java (85%) rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/manytomany/dao/common/AbstractHibernateDao.java (96%) rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/manytomany/dao/common/IOperations.java (85%) rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/manytomany/dao/impl/EmployeeDao.java (50%) create mode 100644 persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/impl/ProjectDao.java rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/manytomany/model/Employee.java (97%) rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/manytomany/model/Project.java (96%) rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/uuids/Element.java (92%) rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/uuids/Reservation.java (95%) rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/uuids/Sale.java (94%) rename persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/{ => hibernate}/uuids/WebSiteUser.java (94%) delete mode 100644 persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/IEmployeeDao.java delete mode 100644 persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/IProjectDao.java delete mode 100644 persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/impl/ProjectDao.java create mode 100644 persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/booleanconverters/HibernateBooleanConverterIntegrationTest.java create mode 100644 persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/booleanconverters/QuestionBuilder.java create mode 100644 persistence-modules/hibernate-mapping-2/src/test/resources/booleanconverters.cfg.xml create mode 100644 persistence-modules/hibernate-mapping-2/src/test/resources/booleanconverters/init_database.sql diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/HibernateUtil.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/HibernateUtil.java similarity index 57% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/HibernateUtil.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/HibernateUtil.java index 26ad7e77ba..df409ee888 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/HibernateUtil.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/HibernateUtil.java @@ -1,4 +1,6 @@ -package com.baeldung; +package com.baeldung.hibernate; + +import static org.hibernate.boot.registry.StandardServiceRegistryBuilder.DEFAULT_CFG_RESOURCE_NAME; import org.hibernate.SessionFactory; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; @@ -7,19 +9,20 @@ import org.hibernate.service.ServiceRegistry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.baeldung.manytomany.model.Employee; -import com.baeldung.manytomany.model.Project; -import com.baeldung.uuids.WebSiteUser; -import com.baeldung.uuids.Element; -import com.baeldung.uuids.Reservation; -import com.baeldung.uuids.Sale; +import com.baeldung.hibernate.booleanconverters.model.Question; +import com.baeldung.hibernate.manytomany.model.Employee; +import com.baeldung.hibernate.manytomany.model.Project; +import com.baeldung.hibernate.uuids.WebSiteUser; +import com.baeldung.hibernate.uuids.Element; +import com.baeldung.hibernate.uuids.Reservation; +import com.baeldung.hibernate.uuids.Sale; public class HibernateUtil { + private static final String DEFAULT_RESOURCE = "manytomany.cfg.xml"; private static final Logger LOGGER = LoggerFactory.getLogger(HibernateUtil.class); - private static SessionFactory sessionFactory; - private static SessionFactory buildSessionFactory() { + private static SessionFactory buildSessionFactory(String resource) { try { // Create the SessionFactory from hibernate-annotation.cfg.xml Configuration configuration = new Configuration(); @@ -29,16 +32,16 @@ public class HibernateUtil { configuration.addAnnotatedClass(Element.class); configuration.addAnnotatedClass(Reservation.class); configuration.addAnnotatedClass(Sale.class); - configuration.configure("manytomany.cfg.xml"); + configuration.addAnnotatedClass(Question.class); + configuration.addPackage(Question.class.getPackageName()); + configuration.configure(resource); LOGGER.debug("Hibernate Annotation Configuration loaded"); ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()) .build(); LOGGER.debug("Hibernate Annotation serviceRegistry created"); - SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry); - - return sessionFactory; + return configuration.buildSessionFactory(serviceRegistry); } catch (Throwable ex) { LOGGER.error("Initial SessionFactory creation failed.", ex); throw new ExceptionInInitializerError(ex); @@ -46,9 +49,10 @@ public class HibernateUtil { } public static SessionFactory getSessionFactory() { - if (sessionFactory == null) { - sessionFactory = buildSessionFactory(); - } - return sessionFactory; + return buildSessionFactory(DEFAULT_RESOURCE); + } + + public static SessionFactory getSessionFactory(String resource) { + return buildSessionFactory(resource); } } diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/booleanconverters/model/Question.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/booleanconverters/model/Question.java new file mode 100644 index 0000000000..be2990359f --- /dev/null +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/booleanconverters/model/Question.java @@ -0,0 +1,86 @@ +package com.baeldung.hibernate.booleanconverters.model; + +import java.util.UUID; + +import org.hibernate.type.NumericBooleanConverter; +import org.hibernate.type.TrueFalseConverter; +import org.hibernate.type.YesNoConverter; + +import jakarta.persistence.Convert; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; + +@Entity +public class Question { + + @Id + private UUID id; + private String content; + @Convert(converter = YesNoConverter.class) + private Boolean correctAnswer; + @Convert(converter = TrueFalseConverter.class) + private Boolean shouldBeAsked; + @Convert(converter = NumericBooleanConverter.class) + private Boolean isEasy; + private Boolean wasAskedBefore; + + public Question() { + } + + public Question(UUID id, String content, Boolean correctAnswer, Boolean shouldBeAsked, Boolean isEasy, Boolean wasAskedBefore) { + this.id = id; + this.content = content; + this.correctAnswer = correctAnswer; + this.shouldBeAsked = shouldBeAsked; + this.isEasy = isEasy; + this.wasAskedBefore = wasAskedBefore; + } + + public UUID getId() { + return id; + } + + public String getContent() { + return content; + } + + public Boolean getCorrectAnswer() { + return correctAnswer; + } + + public Boolean getShouldBeAsked() { + return shouldBeAsked; + } + + public Boolean isEasy() { + return isEasy; + } + + public Boolean getWasAskedBefore() { + return wasAskedBefore; + } + + public void setId(UUID id) { + this.id = id; + } + + public void setContent(String content) { + this.content = content; + } + + public void setCorrectAnswer(Boolean correctAnswer) { + this.correctAnswer = correctAnswer; + } + + public void setShouldBeAsked(Boolean shouldBeAsked) { + this.shouldBeAsked = shouldBeAsked; + } + + public void setEasy(Boolean easy) { + isEasy = easy; + } + + public void setWasAskedBefore(Boolean wasAskedBefore) { + this.wasAskedBefore = wasAskedBefore; + } +} diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/booleanconverters/model/package-info.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/booleanconverters/model/package-info.java new file mode 100644 index 0000000000..d5041b87c0 --- /dev/null +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/booleanconverters/model/package-info.java @@ -0,0 +1,5 @@ +@ConverterRegistration(converter = YesNoConverter.class) +package com.baeldung.hibernate.booleanconverters.model; + +import org.hibernate.annotations.ConverterRegistration; +import org.hibernate.type.YesNoConverter; \ No newline at end of file diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/PersistenceConfig.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/PersistenceConfig.java similarity index 95% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/PersistenceConfig.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/PersistenceConfig.java index 0d7b8bdbcf..4ec6c9fb71 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/PersistenceConfig.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/PersistenceConfig.java @@ -1,4 +1,4 @@ -package com.baeldung.manytomany; +package com.baeldung.hibernate.manytomany; import java.util.Properties; @@ -22,7 +22,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "com.baeldung.manytomany" }) +@ComponentScan({ "com.baeldung.hibernate.manytomany" }) public class PersistenceConfig { @Autowired @@ -32,7 +32,7 @@ public class PersistenceConfig { public LocalSessionFactoryBean sessionFactory() { final LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean(); sessionFactory.setDataSource(restDataSource()); - sessionFactory.setPackagesToScan(new String[] { "com.baeldung.manytomany" }); + sessionFactory.setPackagesToScan(new String[] { "com.baeldung.hibernate.manytomany" }); sessionFactory.setHibernateProperties(hibernateProperties()); return sessionFactory; diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/IEmployeeDao.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/IEmployeeDao.java new file mode 100644 index 0000000000..7bff73ecf4 --- /dev/null +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/IEmployeeDao.java @@ -0,0 +1,8 @@ +package com.baeldung.hibernate.manytomany.dao; + +import com.baeldung.hibernate.manytomany.dao.common.IOperations; +import com.baeldung.hibernate.manytomany.model.Employee; + +public interface IEmployeeDao extends IOperations{ + +} diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/IProjectDao.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/IProjectDao.java new file mode 100644 index 0000000000..de800ae783 --- /dev/null +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/IProjectDao.java @@ -0,0 +1,8 @@ +package com.baeldung.hibernate.manytomany.dao; + +import com.baeldung.hibernate.manytomany.dao.common.IOperations; +import com.baeldung.hibernate.manytomany.model.Project; + +public interface IProjectDao extends IOperations{ + +} diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/common/AbstractDao.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/common/AbstractDao.java similarity index 85% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/common/AbstractDao.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/common/AbstractDao.java index b37b48e645..6ed04a9b2f 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/common/AbstractDao.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/common/AbstractDao.java @@ -1,4 +1,4 @@ -package com.baeldung.manytomany.dao.common; +package com.baeldung.hibernate.manytomany.dao.common; import java.io.Serializable; diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/common/AbstractHibernateDao.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/common/AbstractHibernateDao.java similarity index 96% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/common/AbstractHibernateDao.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/common/AbstractHibernateDao.java index 9c8a8faa2e..67878906ca 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/common/AbstractHibernateDao.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/common/AbstractHibernateDao.java @@ -1,4 +1,4 @@ -package com.baeldung.manytomany.dao.common; +package com.baeldung.hibernate.manytomany.dao.common; import java.io.Serializable; import java.util.List; diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/common/IOperations.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/common/IOperations.java similarity index 85% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/common/IOperations.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/common/IOperations.java index 8a85b52fc9..2be7fdb75e 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/common/IOperations.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/common/IOperations.java @@ -1,4 +1,4 @@ -package com.baeldung.manytomany.dao.common; +package com.baeldung.hibernate.manytomany.dao.common; import java.io.Serializable; import java.util.List; diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/impl/EmployeeDao.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/impl/EmployeeDao.java similarity index 50% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/impl/EmployeeDao.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/impl/EmployeeDao.java index b24013c567..d4364c00c2 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/impl/EmployeeDao.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/impl/EmployeeDao.java @@ -1,10 +1,10 @@ -package com.baeldung.manytomany.dao.impl; +package com.baeldung.hibernate.manytomany.dao.impl; import org.springframework.stereotype.Repository; -import com.baeldung.manytomany.dao.IEmployeeDao; -import com.baeldung.manytomany.dao.common.AbstractHibernateDao; -import com.baeldung.manytomany.model.Employee; +import com.baeldung.hibernate.manytomany.dao.IEmployeeDao; +import com.baeldung.hibernate.manytomany.dao.common.AbstractHibernateDao; +import com.baeldung.hibernate.manytomany.model.Employee; @Repository public class EmployeeDao extends AbstractHibernateDao implements IEmployeeDao { diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/impl/ProjectDao.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/impl/ProjectDao.java new file mode 100644 index 0000000000..a221116013 --- /dev/null +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/dao/impl/ProjectDao.java @@ -0,0 +1,17 @@ +package com.baeldung.hibernate.manytomany.dao.impl; + +import org.springframework.stereotype.Repository; + +import com.baeldung.hibernate.manytomany.dao.IProjectDao; +import com.baeldung.hibernate.manytomany.dao.common.AbstractHibernateDao; +import com.baeldung.hibernate.manytomany.model.Project; + +@Repository +public class ProjectDao extends AbstractHibernateDao implements IProjectDao { + + public ProjectDao() { + super(); + + setClazz(Project.class); + } +} diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/model/Employee.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/model/Employee.java similarity index 97% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/model/Employee.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/model/Employee.java index cc745f9307..d606f1281c 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/model/Employee.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/model/Employee.java @@ -1,4 +1,4 @@ -package com.baeldung.manytomany.model; +package com.baeldung.hibernate.manytomany.model; import java.io.Serializable; import java.util.HashSet; diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/model/Project.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/model/Project.java similarity index 96% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/model/Project.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/model/Project.java index b0ca7f06cb..8ea31dbc5f 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/model/Project.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/manytomany/model/Project.java @@ -1,4 +1,4 @@ -package com.baeldung.manytomany.model; +package com.baeldung.hibernate.manytomany.model; import java.io.Serializable; import java.util.HashSet; diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/Element.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/Element.java similarity index 92% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/Element.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/Element.java index 1a17cba90c..5112c6df0f 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/Element.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/Element.java @@ -1,4 +1,4 @@ -package com.baeldung.uuids; +package com.baeldung.hibernate.uuids; import java.util.UUID; import jakarta.persistence.Entity; diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/Reservation.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/Reservation.java similarity index 95% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/Reservation.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/Reservation.java index 83b232d940..389376e785 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/Reservation.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/Reservation.java @@ -1,4 +1,4 @@ -package com.baeldung.uuids; +package com.baeldung.hibernate.uuids; import java.util.UUID; import jakarta.persistence.Id; diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/Sale.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/Sale.java similarity index 94% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/Sale.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/Sale.java index f9b1c246cd..8eaab80912 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/Sale.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/Sale.java @@ -1,4 +1,4 @@ -package com.baeldung.uuids; +package com.baeldung.hibernate.uuids; import jakarta.persistence.Id; import jakarta.persistence.Entity; diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/WebSiteUser.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/WebSiteUser.java similarity index 94% rename from persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/WebSiteUser.java rename to persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/WebSiteUser.java index 1150c03dcc..b1a115a3b9 100644 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/uuids/WebSiteUser.java +++ b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/hibernate/uuids/WebSiteUser.java @@ -1,4 +1,4 @@ -package com.baeldung.uuids; +package com.baeldung.hibernate.uuids; import java.util.UUID; import java.time.LocalDate; diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/IEmployeeDao.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/IEmployeeDao.java deleted file mode 100644 index 68bf5d5bad..0000000000 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/IEmployeeDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.manytomany.dao; - -import com.baeldung.manytomany.dao.common.IOperations; -import com.baeldung.manytomany.model.Employee; - -public interface IEmployeeDao extends IOperations{ - -} diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/IProjectDao.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/IProjectDao.java deleted file mode 100644 index d2645db44a..0000000000 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/IProjectDao.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.baeldung.manytomany.dao; - -import com.baeldung.manytomany.dao.common.IOperations; -import com.baeldung.manytomany.model.Project; - -public interface IProjectDao extends IOperations{ - -} diff --git a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/impl/ProjectDao.java b/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/impl/ProjectDao.java deleted file mode 100644 index a70212f519..0000000000 --- a/persistence-modules/hibernate-mapping-2/src/main/java/com/baeldung/manytomany/dao/impl/ProjectDao.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.manytomany.dao.impl; - -import org.springframework.stereotype.Repository; - -import com.baeldung.manytomany.dao.IProjectDao; -import com.baeldung.manytomany.dao.common.AbstractHibernateDao; -import com.baeldung.manytomany.model.Project; - - -@Repository -public class ProjectDao extends AbstractHibernateDao implements IProjectDao { - - public ProjectDao() { - super(); - - setClazz(Project.class); - } -} diff --git a/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/SpringContextTest.java b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/SpringContextTest.java index f1a6f675ce..e1650dccd2 100644 --- a/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/SpringContextTest.java +++ b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/SpringContextTest.java @@ -6,7 +6,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; -import com.baeldung.manytomany.PersistenceConfig; +import com.baeldung.hibernate.manytomany.PersistenceConfig; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) diff --git a/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/booleanconverters/HibernateBooleanConverterIntegrationTest.java b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/booleanconverters/HibernateBooleanConverterIntegrationTest.java new file mode 100644 index 0000000000..3235485e96 --- /dev/null +++ b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/booleanconverters/HibernateBooleanConverterIntegrationTest.java @@ -0,0 +1,158 @@ +package com.baeldung.hibernate.booleanconverters; + +import static java.lang.String.format; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.util.UUID; + +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.baeldung.hibernate.HibernateUtil; +import com.baeldung.hibernate.booleanconverters.model.Question; + +public class HibernateBooleanConverterIntegrationTest { + + private static final String PROPERTY_FILE_NAME = "booleanconverters.cfg.xml"; + + private static SessionFactory sessionFactory; + private static Session session; + + @BeforeAll + static void createSessionFactory() { + sessionFactory = HibernateUtil.getSessionFactory(PROPERTY_FILE_NAME); + } + + @BeforeEach + void openSessionAndBeginTransaction() { + session = sessionFactory.openSession(); + } + + @AfterAll + static void closeSessionFactory() { + sessionFactory.close(); + } + + @Test + void whenFieldAnnotatedWithYesNoConverter_ThenConversionWorks() { + session.beginTransaction(); + UUID likeJavaQuestionId = UUID.randomUUID(); + UUID sydneyCapitalOfAustraliaQuestionId = UUID.randomUUID(); + session.persist(new QuestionBuilder().id(likeJavaQuestionId) + .content("Do you like Java?") + .correctAnswer(true) + .build()); + session.persist(new QuestionBuilder().id(sydneyCapitalOfAustraliaQuestionId) + .content("Is Sydney the capital of Australia?") + .correctAnswer(false) + .build()); + session.flush(); + + char likeJavaQuestionCorrectAnswerDbValue = session.createNativeQuery(format("SELECT correctAnswer FROM Question WHERE id='%s'", likeJavaQuestionId), Character.class) + .getSingleResult(); + char sydneyCapitalOfAustraliaQuestionCorrectAnswerDbValue = session.createNativeQuery(format("SELECT correctAnswer FROM Question WHERE id='%s'", sydneyCapitalOfAustraliaQuestionId), Character.class) + .getSingleResult(); + session.close(); + + assertEquals('Y', likeJavaQuestionCorrectAnswerDbValue); + assertEquals('N', sydneyCapitalOfAustraliaQuestionCorrectAnswerDbValue); + } + + @Test + void whenFieldAnnotatedWithTrueFalseConverter_ThenConversionWorks() { + session.beginTransaction(); + UUID codeTestedQuestionId = UUID.randomUUID(); + UUID earningsQuestionId = UUID.randomUUID(); + session.persist(new QuestionBuilder().id(codeTestedQuestionId) + .content("Is this code tested?") + .shouldBeAsked(true) + .build()); + session.persist(new QuestionBuilder().id(earningsQuestionId) + .content("How much do you earn?") + .shouldBeAsked(false) + .build()); + session.flush(); + + char codeTestedQuestionShouldBeAskedDbValue = session.createNativeQuery(format("SELECT shouldBeAsked FROM Question WHERE id='%s'", codeTestedQuestionId), Character.class) + .getSingleResult(); + char earningsQuestionsShouldBeAskedDbValue = session.createNativeQuery(format("SELECT shouldBeAsked FROM Question WHERE id='%s'", earningsQuestionId), Character.class) + .getSingleResult(); + session.close(); + + assertEquals('T', codeTestedQuestionShouldBeAskedDbValue); + assertEquals('F', earningsQuestionsShouldBeAskedDbValue); + } + + @Test + void whenFieldAnnotatedWithNumericBooleanConverter_ThenConversionWorks() { + session.beginTransaction(); + UUID earthFlatQuestionId = UUID.randomUUID(); + UUID shouldLearnProgrammingQuestionId = UUID.randomUUID(); + session.persist(new QuestionBuilder().id(earthFlatQuestionId) + .content("Is the Earth flat?") + .isEasy(true) + .build()); + session.persist(new QuestionBuilder().id(shouldLearnProgrammingQuestionId) + .content("Should one learn programming") + .isEasy(false) + .build()); + session.flush(); + + int earthFlatQuestionIsEasyDbValue = session.createNativeQuery(format("SELECT isEasy FROM Question WHERE id='%s'", earthFlatQuestionId), Integer.class) + .getSingleResult(); + int shouldLearnProgrammingQuestionIsEasyDbValue = session.createNativeQuery(format("SELECT isEasy FROM Question WHERE id='%s'", shouldLearnProgrammingQuestionId), Integer.class) + .getSingleResult(); + session.close(); + + assertEquals(1, earthFlatQuestionIsEasyDbValue); + assertEquals(0, shouldLearnProgrammingQuestionIsEasyDbValue); + } + + @Test + void givenFieldAnnotatedWithYesNoConverter_WhenDbValueIsLowercase_ThenDomainModelValueNull() { + session.beginTransaction(); + UUID mappedToNullQuestionId = UUID.randomUUID(); + UUID behaviorIntuitiveQuestionId = UUID.randomUUID(); + session.createNativeMutationQuery(format("INSERT INTO Question (id, content, correctAnswer) VALUES ('%s', 'Will correctAnswer be mapped to null?', 'y')", mappedToNullQuestionId)) + .executeUpdate(); + session.createNativeMutationQuery(format("INSERT INTO Question (id, content, correctAnswer) VALUES ('%s', 'Is this behavior intuitive?', 'n')", behaviorIntuitiveQuestionId)) + .executeUpdate(); + + Question behaviorIntuitiveQuestion = session.get(Question.class, behaviorIntuitiveQuestionId); + Question mappedToNullQuestion = session.get(Question.class, mappedToNullQuestionId); + session.close(); + + assertNull(behaviorIntuitiveQuestion.getCorrectAnswer()); + assertNull(mappedToNullQuestion.getCorrectAnswer()); + } + + @Test + void givenConverterRegisteredToAutoApply_whenFieldIsNotAnnotated_ThenConversionWorks() { + session.beginTransaction(); + UUID likeJavaQuestionId = UUID.randomUUID(); + UUID likeKotlinQuestionId = UUID.randomUUID(); + session.persist(new QuestionBuilder().id(likeJavaQuestionId) + .content("Do you like Java?") + .wasAskedBefore(true) + .build()); + session.persist(new QuestionBuilder().id(likeKotlinQuestionId) + .content("Do you like Kotlin?") + .wasAskedBefore(false) + .build()); + session.flush(); + + char likeJavaQuestionWasAskedBeforeDbValue = session.createNativeQuery(format("SELECT wasAskedBefore FROM Question WHERE id='%s'", likeJavaQuestionId), Character.class) + .getSingleResult(); + char likeKotlinQuestionWasAskedBeforeDbValue = session.createNativeQuery(format("SELECT wasAskedBefore FROM Question WHERE id='%s'", likeKotlinQuestionId), Character.class) + .getSingleResult(); + session.close(); + + assertEquals('Y', likeJavaQuestionWasAskedBeforeDbValue); + assertEquals('N', likeKotlinQuestionWasAskedBeforeDbValue); + } +} diff --git a/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/booleanconverters/QuestionBuilder.java b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/booleanconverters/QuestionBuilder.java new file mode 100644 index 0000000000..26fe38c3c8 --- /dev/null +++ b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/booleanconverters/QuestionBuilder.java @@ -0,0 +1,48 @@ +package com.baeldung.hibernate.booleanconverters; + +import java.util.UUID; + +import com.baeldung.hibernate.booleanconverters.model.Question; + +public class QuestionBuilder { + private UUID id; + private String content; + private Boolean correctAnswer; + private Boolean shouldBeAsked; + private Boolean isEasy; + private Boolean wasAskedBefore; + + public QuestionBuilder id(UUID id) { + this.id = id; + return this; + } + + public QuestionBuilder content(String content) { + this.content = content; + return this; + } + + public QuestionBuilder correctAnswer(Boolean correctAnswer) { + this.correctAnswer = correctAnswer; + return this; + } + + public QuestionBuilder shouldBeAsked(Boolean shouldBeAsked) { + this.shouldBeAsked = shouldBeAsked; + return this; + } + + public QuestionBuilder isEasy(Boolean isEasy) { + this.isEasy = isEasy; + return this; + } + + public QuestionBuilder wasAskedBefore(Boolean wasAskedBefore) { + this.wasAskedBefore = wasAskedBefore; + return this; + } + + public Question build() { + return new Question(id, content, correctAnswer, shouldBeAsked, isEasy, wasAskedBefore); + } +} \ No newline at end of file diff --git a/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationJavaConfigMainIntegrationTest.java b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationJavaConfigMainIntegrationTest.java index 69b791b4d4..e4fcafcb56 100644 --- a/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationJavaConfigMainIntegrationTest.java +++ b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationJavaConfigMainIntegrationTest.java @@ -13,9 +13,9 @@ 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.support.AnnotationConfigContextLoader; -import com.baeldung.manytomany.PersistenceConfig; -import com.baeldung.manytomany.model.Employee; -import com.baeldung.manytomany.model.Project; + +import com.baeldung.hibernate.manytomany.model.Employee; +import com.baeldung.hibernate.manytomany.model.Project; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) diff --git a/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationMainIntegrationTest.java b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationMainIntegrationTest.java index 15ad2c50b9..7c6861e63b 100644 --- a/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationMainIntegrationTest.java +++ b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/manytomany/HibernateManyToManyAnnotationMainIntegrationTest.java @@ -15,9 +15,9 @@ import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; -import com.baeldung.manytomany.model.Employee; -import com.baeldung.manytomany.model.Project; -import com.baeldung.HibernateUtil; +import com.baeldung.hibernate.manytomany.model.Employee; +import com.baeldung.hibernate.manytomany.model.Project; +import com.baeldung.hibernate.HibernateUtil; /** * Configured in: manytomany.cfg.xml diff --git a/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/uuids/UUIDsHibernateGenerationIntegrationTest.java b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/uuids/UUIDsHibernateGenerationIntegrationTest.java index 7d605484ed..f36a4333c3 100644 --- a/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/uuids/UUIDsHibernateGenerationIntegrationTest.java +++ b/persistence-modules/hibernate-mapping-2/src/test/java/com/baeldung/hibernate/uuids/UUIDsHibernateGenerationIntegrationTest.java @@ -1,18 +1,12 @@ package com.baeldung.hibernate.uuids; -import com.baeldung.HibernateUtil; +import com.baeldung.hibernate.HibernateUtil; -import com.baeldung.uuids.Reservation; -import com.baeldung.uuids.Sale; -import com.baeldung.uuids.WebSiteUser; -import com.baeldung.uuids.Element; import org.assertj.core.api.Assertions; import java.io.IOException; import org.hibernate.SessionFactory; import org.hibernate.Session; -import org.junit.After; -import org.junit.AfterClass; import org.junit.Before; import org.junit.Test; import java.util.UUID; diff --git a/persistence-modules/hibernate-mapping-2/src/test/resources/booleanconverters.cfg.xml b/persistence-modules/hibernate-mapping-2/src/test/resources/booleanconverters.cfg.xml new file mode 100644 index 0000000000..6ca479b052 --- /dev/null +++ b/persistence-modules/hibernate-mapping-2/src/test/resources/booleanconverters.cfg.xml @@ -0,0 +1,16 @@ + + + + + org.h2.Driver + + jdbc:h2:mem:booleanconvertersdb;DB_CLOSE_DELAY=-1;INIT=RUNSCRIPT FROM 'src/test/resources/booleanconverters/init_database.sql' + sa + org.hibernate.dialect.H2Dialect + thread + false + none + + \ No newline at end of file diff --git a/persistence-modules/hibernate-mapping-2/src/test/resources/booleanconverters/init_database.sql b/persistence-modules/hibernate-mapping-2/src/test/resources/booleanconverters/init_database.sql new file mode 100644 index 0000000000..cb0f4f329c --- /dev/null +++ b/persistence-modules/hibernate-mapping-2/src/test/resources/booleanconverters/init_database.sql @@ -0,0 +1,9 @@ +CREATE TABLE Question ( + id UUID, + content VARCHAR, + correctAnswer CHAR, + shouldBeAsked CHAR, + isEasy TINYINT, + wasAskedBefore CHAR, + PRIMARY KEY (id) +) From 1770c64f3a7c1850121823d58524ad9cf0553374 Mon Sep 17 00:00:00 2001 From: Michael Olayemi Date: Sun, 30 Apr 2023 03:40:16 +0100 Subject: [PATCH 51/51] BAEL-6194 Retrieve the Value of an HTML Input Using Selenium WebDriver in Java (#13898) * Retrieve the Value of an HTML Input Using Selenium WebDriver in Java * Retrieve the Value of an HTML Input Using Selenium WebDriver in Java * Retrieve the Value of an HTML Input Using Selenium WebDriver in Java --- testing-modules/selenium-junit-testng/pom.xml | 4 +- .../webdriver/SeleniumWebDriverUnitTest.java | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/webdriver/SeleniumWebDriverUnitTest.java diff --git a/testing-modules/selenium-junit-testng/pom.xml b/testing-modules/selenium-junit-testng/pom.xml index f0a2e43eeb..517dc48dde 100644 --- a/testing-modules/selenium-junit-testng/pom.xml +++ b/testing-modules/selenium-junit-testng/pom.xml @@ -57,9 +57,9 @@ 6.10 - 4.6.0 + 4.8.3 1.5.4 - 5.3.0 + 5.3.2 \ No newline at end of file diff --git a/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/webdriver/SeleniumWebDriverUnitTest.java b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/webdriver/SeleniumWebDriverUnitTest.java new file mode 100644 index 0000000000..e4e89611d1 --- /dev/null +++ b/testing-modules/selenium-junit-testng/src/test/java/com/baeldung/selenium/webdriver/SeleniumWebDriverUnitTest.java @@ -0,0 +1,43 @@ +package com.baeldung.selenium.webdriver; + +import org.junit.Assert; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.By; +import org.openqa.selenium.Keys; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.chrome.ChromeDriver; +import io.github.bonigarcia.wdm.WebDriverManager; + +public class SeleniumWebDriverUnitTest { + + private WebDriver driver; + + private static final String URL = "https://duckduckgo.com/"; + private static final String INPUT_ID = "search_form_input_homepage"; + + @BeforeEach + public void setUp() { + WebDriverManager.chromedriver().setup(); + driver = new ChromeDriver(); + } + + @AfterEach + public void tearDown() { + driver.quit(); + } + + @Test + public void givenDuckDuckGoHomePage_whenInputHelloWorld_thenInputValueIsHelloWorld() { + driver.get(URL); + WebElement inputElement = driver.findElement(By.id(INPUT_ID)); + inputElement.sendKeys(Keys.chord(Keys.CONTROL, "a"), Keys.DELETE); + inputElement.sendKeys("Hello World!"); + + String inputValue = inputElement.getAttribute("value"); + Assert.assertEquals("Hello World!", inputValue); + } + +}