Merge branch 'eugenp:master' into master

This commit is contained in:
Ulisses Lima 2022-07-15 13:11:36 -03:00 committed by GitHub
commit b2d7045e84
439 changed files with 2995 additions and 1328 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
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">
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">
<modelVersion>4.0.0</modelVersion>
<artifactId>akka-modules</artifactId>
<name>akka-modules</name>

View File

@ -8,6 +8,8 @@ import java.util.List;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
class CustomerToDataFrameConverterAppUnitTest {
@ -59,4 +61,9 @@ class CustomerToDataFrameConverterAppUnitTest {
assertEquals( "Male", row2.getAs("gender"));
assertEquals( 1200, (int)row2.getAs("transaction_amount"));
}
@AfterEach
public void cleanup() {
SparkSession.getActiveSession().get().close();
}
}

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
<project xmlns="http://maven.apache.org/POM/4.0.0"
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">
<modelVersion>4.0.0</modelVersion>
@ -59,4 +58,4 @@
</plugins>
</build>
</project>
</project>

View File

@ -19,4 +19,4 @@
<module>cas-secured-app</module>
</modules>
</project>
</project>

View File

@ -17,9 +17,7 @@
<module>core-groovy</module>
<module>core-groovy-2</module>
<module>core-groovy-collections</module>
<module>core-groovy-strings</module>
<module>core-groovy-strings</module>
</modules>
</project>
</project>

View File

@ -11,3 +11,4 @@ This module contains articles about Java 14.
- [Foreign Memory Access API in Java 14](https://www.baeldung.com/java-foreign-memory-access)
- [Java 14 Record Keyword](https://www.baeldung.com/java-record-keyword)
- [New Features in Java 14](https://www.baeldung.com/java-14-new-features)
- [Java 14 Record vs. Lombok](https://www.baeldung.com/java-record-vs-lombok)

View File

@ -4,15 +4,15 @@ import java.util.IntSummaryStatistics;
public class BlogPost {
private String title;
private String author;
private BlogPostType type;
private int likes;
record AuthPostTypesLikes(String author, BlogPostType type, int likes) {};
record PostcountTitlesLikesStats(long postCount, String titles, IntSummaryStatistics likesStats){};
record PostCountTitlesLikesStats(long postCount, String titles, IntSummaryStatistics likesStats){};
record TitlesBoundedSumOfLikes(String titles, int boundedSumOfLikes) {};
public BlogPost(String title, String author, BlogPostType type, int likes) {
this.title = title;
this.author = author;

View File

@ -257,7 +257,7 @@ public class JavaGroupingByCollectorUnitTest {
@Test
public void givenListOfPosts_whenGroupedByAuthor_thenGetAMapUsingCollectingAndThen() {
Map<String, BlogPost.PostcountTitlesLikesStats> postsPerAuthor = posts.stream()
Map<String, BlogPost.PostCountTitlesLikesStats> postsPerAuthor = posts.stream()
.collect(groupingBy(BlogPost::getAuthor, collectingAndThen(toList(), list -> {
long count = list.stream()
.map(BlogPost::getTitle)
@ -267,10 +267,10 @@ public class JavaGroupingByCollectorUnitTest {
.collect(joining(" : "));
IntSummaryStatistics summary = list.stream()
.collect(summarizingInt(BlogPost::getLikes));
return new BlogPost.PostcountTitlesLikesStats(count, titles, summary);
return new BlogPost.PostCountTitlesLikesStats(count, titles, summary);
})));
BlogPost.PostcountTitlesLikesStats result = postsPerAuthor.get("Author 1");
BlogPost.PostCountTitlesLikesStats result = postsPerAuthor.get("Author 1");
assertThat(result.postCount()).isEqualTo(3L);
assertThat(result.titles()).isEqualTo("News item 1 : Programming guide : Tech review 2");
assertThat(result.likesStats().getMax()).isEqualTo(20);
@ -294,7 +294,7 @@ public class JavaGroupingByCollectorUnitTest {
.toUpperCase(),
u1.boundedSumOfLikes() + likes);
}));
BlogPost.TitlesBoundedSumOfLikes result = postsPerAuthor.get("Author 1");
assertThat(result.titles()).isEqualTo("NEWS ITEM 1 : PROGRAMMING GUIDE : TECH REVIEW 2");
assertThat(result.boundedSumOfLikes()).isEqualTo(47);

View File

@ -20,7 +20,7 @@ public class InputStreamToOutputStreamUnitTest {
void copy(InputStream source, OutputStream target) throws IOException {
byte[] buf = new byte[8192];
int length;
while ((length = source.read(buf)) > 0) {
while ((length = source.read(buf)) != -1) {
target.write(buf, 0, length);
}
}

View File

@ -25,4 +25,5 @@
<properties>
<commons-lang.version>2.2</commons-lang.version>
</properties>
</project>

View File

@ -45,18 +45,19 @@
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh-generator.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${apache-commons.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${apache-commons.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<trove4j.version>3.0.2</trove4j.version>
<fastutil.version>8.1.0</fastutil.version>

View File

@ -10,3 +10,5 @@ This module contains articles about JAR files
- [Get Names of Classes Inside a JAR File](https://www.baeldung.com/jar-file-get-class-names)
- [Find All Jars Containing Given Class](https://baeldung.com/find-all-jars-containing-given-class/)
- [Creating JAR Files Programmatically](https://www.baeldung.com/jar-create-programatically)
- [Guide to Creating Jar Executables and Windows Executables from Java](https://www.baeldung.com/jar-windows-executables)
- [Get the Full Path of a JAR File From a Class](https://www.baeldung.com/java-full-path-of-jar-from-class)

View File

@ -5,3 +5,4 @@ This module contains articles about core features in the Java language
### Relevant Articles:
- [Difference Between == and equals() in Java](https://www.baeldung.com/java-equals-method-operator-difference)
- [Advantages and Disadvantages of Using Java Wildcard Imports](https://www.baeldung.com/java-wildcard-imports)

View File

@ -43,7 +43,6 @@
<version>3.23.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>

View File

@ -11,3 +11,4 @@ This module contains articles about string APIs.
- [StringBuilder vs StringBuffer in Java](https://www.baeldung.com/java-string-builder-string-buffer)
- [Generate a Secure Random Password in Java](https://www.baeldung.com/java-generate-secure-password)
- [Getting a Character by Index From a String in Java](https://www.baeldung.com/java-character-at-position)
- [Clearing a StringBuilder or StringBuffer](https://www.baeldung.com/java-clear-stringbuilder-stringbuffer)

View File

@ -7,4 +7,4 @@
- [String equals() Vs contentEquals() in Java](https://www.baeldung.com/java-string-equals-vs-contentequals)
- [Check if a String Ends with a Certain Pattern in Java](https://www.baeldung.com/java-string-ends-pattern)
- [Check if a Character is a Vowel in Java](https://www.baeldung.com/java-check-character-vowel)
- [How to Truncate a String in Java](https://www.baeldung.com/java-truncating-strings)

View File

@ -96,7 +96,23 @@ public class Java8EncodeDecodeUnitTest {
assertNotNull(decodedMime);
}
//
@Test
public void whenEncodedStringHasValidCharacters_thenStringCanBeDecoded() {
final String encodedString = "dGVzdCMkaW5wdXQ+";
final byte[] decodedBytes = Base64.getDecoder().decode(encodedString);
final String decodedString = new String(decodedBytes);
assertNotNull(decodedString);
}
@Test(expected = IllegalArgumentException.class)
public void whenEncodedStringHasInvalidCharacters_thenIllegalArgumentException() {
final String encodedString = "dGVzdCMkaW5wdXQ#";
final byte[] decodedBytes = Base64.getDecoder().decode(encodedString);
final String decodedString = new String(decodedBytes);
assertNotNull(decodedString);
}
private static StringBuilder getMimeBuffer() {
final StringBuilder buffer = new StringBuilder();

View File

@ -33,7 +33,7 @@
<module>core-java-collections-4</module>
<module>core-java-collections-array-list</module>
<module>core-java-collections-conversions</module>
<module>core-java-collections-conversions-2</module>
<module>core-java-collections-conversions-2</module>
<module>core-java-collections-list</module>
<module>core-java-collections-list-2</module>
<module>core-java-collections-list-3</module>
@ -126,7 +126,7 @@
<module>core-java-regex</module>
<module>core-java-regex-2</module>
<module>core-java-uuid</module>
<module>pre-jpms</module>
<module>pre-jpms</module>
</modules>
<dependencyManagement>
@ -146,4 +146,4 @@
</dependencies>
</dependencyManagement>
</project>
</project>

View File

@ -6,7 +6,7 @@
<artifactId>docker-compose</artifactId>
<description>Demo project for Spring Boot and Docker</description>
<parent>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId>
<version>0.0.1-SNAPSHOT</version>
@ -22,7 +22,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View File

@ -22,7 +22,6 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View File

@ -7,7 +7,7 @@
<name>docker-spring-boot</name>
<description>Demo project showing Spring Boot and Docker</description>
<parent>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>parent-boot-2</artifactId>
<version>0.0.1-SNAPSHOT</version>

View File

@ -14,12 +14,6 @@
<relativePath>../parent-boot-2</relativePath>
</parent>
<properties>
<java.version>1.8</java.version>
<feign.version>11.8</feign.version>
<wsdl4j.version>1.6.3</wsdl4j.version>
</properties>
<dependencies>
<dependency>
<groupId>io.github.openfeign</groupId>
@ -121,4 +115,10 @@
</plugins>
</build>
<properties>
<java.version>1.8</java.version>
<feign.version>11.8</feign.version>
<wsdl4j.version>1.6.3</wsdl4j.version>
</properties>
</project>

3
gradle-modules/README.md Normal file
View File

@ -0,0 +1,3 @@
## Gradle Modules
This module contains submodules of Gradle.

View File

@ -1,4 +1,4 @@
rootProject.name='gradle-5-articles'
rootProject.name='gradle-5'
include 'java-exec'
include 'unused-dependencies'
include 'source-sets'

Some files were not shown because too many files have changed in this diff Show More