Merge branch 'eugenp:master' into master
This commit is contained in:
commit
47775a2ca7
|
@ -59,6 +59,16 @@
|
|||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons-io.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.gdata</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>1.47.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
package com.baeldung.illegalcharacter;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.apache.commons.io.ByteOrderMark;
|
||||
import org.apache.commons.io.input.BOMInputStream;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.gdata.util.io.base.UnicodeReader;
|
||||
|
||||
public class IllegalCharacterUnitTest {
|
||||
|
||||
final String RESOURCE_FILE_NAME = "bom-file.txt";
|
||||
final InputStream ioStream = this.getClass()
|
||||
.getClassLoader()
|
||||
.getResourceAsStream(RESOURCE_FILE_NAME);
|
||||
final String expected = "Hello world with BOM.";
|
||||
|
||||
@Test
|
||||
public void whenInputFileHasBOM_thenUseInputStream() throws IOException {
|
||||
String line;
|
||||
String actual = "";
|
||||
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(ioStream))) {
|
||||
while ((line = br.readLine()) != null) {
|
||||
actual += line;
|
||||
}
|
||||
}
|
||||
|
||||
assertNotEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenInputFileHasBOM_thenUseInputStreamWithReplace() throws IOException {
|
||||
String line;
|
||||
String actual = "";
|
||||
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(Objects.requireNonNull(ioStream)))) {
|
||||
while ((line = br.readLine()) != null) {
|
||||
actual += line.replace("\uFEFF", "");
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenInputFileHasBOM_thenUseBOMInputStream() throws IOException {
|
||||
String line;
|
||||
String actual = "";
|
||||
|
||||
try (BufferedReader br = new BufferedReader(new InputStreamReader(new BOMInputStream(ioStream, false, ByteOrderMark.UTF_8, ByteOrderMark.UTF_16BE, ByteOrderMark.UTF_16LE, ByteOrderMark.UTF_32BE, ByteOrderMark.UTF_32LE)))) {
|
||||
while ((line = br.readLine()) != null) {
|
||||
actual += line;
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenInputFileHasBOM_thenUseGoogleGdata() throws IOException {
|
||||
char[] actual = new char[21];
|
||||
|
||||
try (Reader r = new UnicodeReader(ioStream, null)) {
|
||||
r.read(actual);
|
||||
}
|
||||
|
||||
assertEquals(expected, String.valueOf(actual));
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
Hello world with BOM.
|
|
@ -3,16 +3,14 @@
|
|||
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>
|
||||
<groupId>com.baeldung.graphql-dgs</groupId>
|
||||
<artifactId>graphql-dgs</artifactId>
|
||||
<version>1.0</version>
|
||||
<name>graphql-dgs</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<groupId>com.baeldung.graphql</groupId>
|
||||
<artifactId>graphql</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencyManagement>
|
||||
|
@ -30,39 +28,22 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<version>2.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<scope>test</scope>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.graphql.dgs.codegen</groupId>
|
||||
<artifactId>graphql-dgs-codegen-client-core</artifactId>
|
||||
<version>5.1.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>2.6.2</version>
|
||||
<version>${graphql-dgs-codegen-client-core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.netflix.graphql.dgs</groupId>
|
||||
<artifactId>graphql-dgs-spring-boot-starter</artifactId>
|
||||
<version>4.9.15</version>
|
||||
<version>${graphql-dgs-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.6.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.github.deweyjose</groupId>
|
||||
<artifactId>graphqlcodegen-maven-plugin</artifactId>
|
||||
|
@ -84,4 +65,9 @@
|
|||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<graphql-dgs-codegen-client-core.version>5.1.14</graphql-dgs-codegen-client-core.version>
|
||||
<graphql-dgs-spring-boot-starter.version>4.9.15</graphql-dgs-spring-boot-starter.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -3,24 +3,17 @@
|
|||
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>
|
||||
<groupId>com.baeldung.graphql</groupId>
|
||||
<artifactId>graphql-error-handling</artifactId>
|
||||
<version>1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>graphql-error-handling</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
<groupId>com.baeldung.graphql</groupId>
|
||||
<artifactId>graphql</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<lombok.version>1.18.18</lombok.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -35,13 +28,13 @@
|
|||
<dependency>
|
||||
<groupId>com.graphql-java</groupId>
|
||||
<artifactId>graphql-spring-boot-starter</artifactId>
|
||||
<version>5.0.2</version>
|
||||
<version>${graphql-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.graphql-java</groupId>
|
||||
<artifactId>graphql-java-tools</artifactId>
|
||||
<version>5.2.4</version>
|
||||
<version>${graphql-java-tools.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -60,38 +53,28 @@
|
|||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<version>2.6.4</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.graphql-java</groupId>
|
||||
<artifactId>graphql-spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<version>5.0.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>3.22.0</version>
|
||||
<scope>test</scope>
|
||||
<version>${graphql-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.skyscreamer</groupId>
|
||||
<artifactId>jsonassert</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<version>${jsonassert.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<properties>
|
||||
<graphql-spring-boot-starter.version>5.0.2</graphql-spring-boot-starter.version>
|
||||
<graphql-java-tools.version>5.2.4</graphql-java-tools.version>
|
||||
<jsonassert.version>1.5.0</jsonassert.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
|
@ -3,16 +3,14 @@
|
|||
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>
|
||||
<groupId>com.baeldung.graphql</groupId>
|
||||
<artifactId>graphql-java</artifactId>
|
||||
<version>1.0</version>
|
||||
<name>graphql-java</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<groupId>com.baeldung.graphql</groupId>
|
||||
<artifactId>graphql</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<repositories>
|
||||
|
@ -44,12 +42,12 @@
|
|||
<dependency>
|
||||
<groupId>com.github.americanexpress.nodes</groupId>
|
||||
<artifactId>nodes</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>${nodes.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.graphql-java</groupId>
|
||||
<artifactId>graphql-java</artifactId>
|
||||
<version>11.0</version>
|
||||
<version>${graphql-java.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.graphql-java</groupId>
|
||||
|
@ -77,16 +75,6 @@
|
|||
<artifactId>jackson-core</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.ratpack</groupId>
|
||||
<artifactId>ratpack-core</artifactId>
|
||||
<version>${ratpack-core.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.americanexpress.nodes</groupId>
|
||||
<artifactId>nodes</artifactId>
|
||||
<version>${nodes.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
|
@ -117,20 +105,10 @@
|
|||
<version>${graphql-java-extended-scalars.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven-compiler-plugin.version}</version>
|
||||
<configuration>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<target>${maven.compiler.target}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
|
@ -169,6 +147,7 @@
|
|||
</build>
|
||||
|
||||
<properties>
|
||||
<graphql-java.version>11.0</graphql-java.version>
|
||||
<graphql-java-tools.version>5.2.4</graphql-java-tools.version>
|
||||
<graphql-java-servlet.version>6.1.3</graphql-java-servlet.version>
|
||||
<graphql-java-annotations.version>3.0.3</graphql-java-annotations.version>
|
||||
|
@ -182,8 +161,6 @@
|
|||
|
||||
<jetty-maven-plugin.version>10.0.7</jetty-maven-plugin.version>
|
||||
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<graphql.java.generator.version>1.18</graphql.java.generator.version>
|
||||
<graphql-java-extended-scalars.version>2022-04-06T00-10-27-a70541e</graphql-java-extended-scalars.version>
|
||||
</properties>
|
||||
|
|
|
@ -2,30 +2,21 @@
|
|||
<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>
|
||||
<groupId>com.baeldung.graphql</groupId>
|
||||
<artifactId>graphql-spqr</artifactId>
|
||||
<version>1.0</version>
|
||||
<name>graphql-java</name>
|
||||
<name>graphql-spqr</name>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-modules</artifactId>
|
||||
<groupId>com.baeldung.graphql</groupId>
|
||||
<artifactId>graphql</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>${spring-boot-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<version>${spring-boot-version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.leangen.graphql</groupId>
|
||||
|
@ -34,18 +25,7 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.6.2</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<spring-boot-version>2.6.2</spring-boot-version>
|
||||
<graphql-spqr-spring-boot-starter-version>0.0.6</graphql-spqr-spring-boot-starter-version>
|
||||
</properties>
|
||||
</project>
|
|
@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@GraphQLApi
|
||||
|
@ -27,8 +28,7 @@ public class BookService implements IBookService {
|
|||
|
||||
@GraphQLQuery(name = "getAllBooks", description = "Get all books")
|
||||
public List<Book> getAllBooks() {
|
||||
return books.stream()
|
||||
.toList();
|
||||
return books.stream().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@GraphQLMutation(name = "addBook")
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
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>
|
||||
<groupId>com.baeldung.graphql</groupId>
|
||||
<artifactId>graphql</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<name>graphql</name>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<parent>
|
||||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
<module>graphql-dgs</module>
|
||||
<module>graphql-error-handling</module>
|
||||
<module>graphql-java</module>
|
||||
<module>graphql-spqr</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
|
@ -88,6 +88,9 @@
|
|||
<module>spring-data-mongodb-reactive</module>
|
||||
<module>spring-data-neo4j</module>
|
||||
<module>spring-data-redis</module>
|
||||
<module>spring-data-rest</module>
|
||||
<module>spring-data-rest-2</module>
|
||||
<module>spring-data-rest-querydsl</module>
|
||||
<module>spring-data-solr</module>
|
||||
<module>spring-hibernate-3</module>
|
||||
<module>spring-hibernate-5</module> <!-- long running -->
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
|
@ -11,7 +11,7 @@
|
|||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
|
@ -13,7 +13,7 @@
|
|||
<groupId>com.baeldung</groupId>
|
||||
<artifactId>parent-boot-2</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<relativePath>../parent-boot-2</relativePath>
|
||||
<relativePath>../../parent-boot-2</relativePath>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
12
pom.xml
12
pom.xml
|
@ -415,8 +415,7 @@
|
|||
<!-- <module>gradle-5</module> --> <!-- Not a maven project -->
|
||||
<!-- <module>gradle-6</module> --> <!-- Not a maven project -->
|
||||
<!-- <module>grails</module> --> <!-- Not a maven project -->
|
||||
<module>graphql/graphql-java</module>
|
||||
<module>graphql/graphql-dgs</module>
|
||||
<module>graphql</module>
|
||||
<module>grpc</module>
|
||||
<module>gson</module>
|
||||
<module>guava-modules</module>
|
||||
|
@ -644,9 +643,6 @@
|
|||
<module>spring-core-5</module>
|
||||
<module>spring-cucumber</module>
|
||||
|
||||
<module>spring-data-rest</module>
|
||||
<module>spring-data-rest-2</module>
|
||||
<module>spring-data-rest-querydsl</module>
|
||||
<module>spring-di</module>
|
||||
<module>spring-di-2</module>
|
||||
<module>spring-di-3</module>
|
||||
|
@ -896,8 +892,7 @@
|
|||
<!-- <module>gradle-5</module> --> <!-- Not a maven project -->
|
||||
<!-- <module>gradle-6</module> --> <!-- Not a maven project -->
|
||||
<!-- <module>grails</module> --> <!-- Not a maven project -->
|
||||
<module>graphql/graphql-java</module>
|
||||
<module>graphql/graphql-dgs</module>
|
||||
<module>graphql</module>
|
||||
<module>grpc</module>
|
||||
<module>gson</module>
|
||||
<module>guava-modules</module>
|
||||
|
@ -1119,9 +1114,6 @@
|
|||
<module>spring-core-5</module>
|
||||
<module>spring-cucumber</module>
|
||||
|
||||
<module>spring-data-rest</module>
|
||||
<module>spring-data-rest-2</module>
|
||||
<module>spring-data-rest-querydsl</module>
|
||||
<module>spring-di</module>
|
||||
<module>spring-di-2</module>
|
||||
<module>spring-di-3</module>
|
||||
|
|
Loading…
Reference in New Issue