Merge branch 'master' of https://github.com/rvsathe/tutorials
This commit is contained in:
@@ -12,7 +12,8 @@ This module contains articles about Apache Kafka.
|
||||
- [Kafka Connect Example with MQTT and MongoDB](https://www.baeldung.com/kafka-connect-mqtt-mongodb)
|
||||
- [Building a Data Pipeline with Flink and Kafka](https://www.baeldung.com/kafka-flink-data-pipeline)
|
||||
- [Exactly Once Processing in Kafka with Java](https://www.baeldung.com/kafka-exactly-once)
|
||||
- [Custom Serializers in Apache Kafka](https://www.baeldung.com/kafka-custom-serializer)
|
||||
|
||||
|
||||
##### Building the project
|
||||
You can build the project from the command line using: *mvn clean install*, or in an IDE.
|
||||
You can build the project from the command line using: *mvn clean install*, or in an IDE.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,3 +2,4 @@
|
||||
|
||||
- [String API Updates in Java 12](https://www.baeldung.com/java12-string-api)
|
||||
- [New Features in Java 12](https://www.baeldung.com/java-12-new-features)
|
||||
- [Compare the Content of Two Files in Java](https://www.baeldung.com/java-compare-files)
|
||||
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.baeldung.java_16_features.mapmulti;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public class Album {
|
||||
|
||||
private String albumName;
|
||||
private int albumCost;
|
||||
private List<Artist> artists;
|
||||
|
||||
Album(String name, int albumCost, List<Artist> artists) {
|
||||
this.albumName = name;
|
||||
this.artists = artists;
|
||||
this.albumCost = albumCost;
|
||||
}
|
||||
|
||||
public void artistAlbumPairsToMajorLabels(Consumer<Pair<String, String>> consumer) {
|
||||
|
||||
for (Artist artist : artists) {
|
||||
if (artist.isAssociatedMajorLabels()) {
|
||||
String concatLabels = artist.getMajorLabels()
|
||||
.stream()
|
||||
.collect(Collectors.joining(","));
|
||||
consumer.accept(new ImmutablePair<>(artist.getName() + ":" + albumName, concatLabels));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getAlbumName() {
|
||||
return albumName;
|
||||
}
|
||||
|
||||
public int getAlbumCost() {
|
||||
return albumCost;
|
||||
}
|
||||
|
||||
List<Artist> getArtists() {
|
||||
return artists;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return albumName;
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package com.baeldung.java_16_features.mapmulti;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Artist {
|
||||
|
||||
private final String name;
|
||||
private boolean associatedMajorLabels;
|
||||
private List<String> majorLabels;
|
||||
|
||||
Artist(String name, boolean associatedMajorLabels, List<String> majorLabels) {
|
||||
this.name = name;
|
||||
this.associatedMajorLabels = associatedMajorLabels;
|
||||
this.majorLabels = majorLabels;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public boolean isAssociatedMajorLabels() {
|
||||
return associatedMajorLabels;
|
||||
}
|
||||
|
||||
public List<String> getMajorLabels() {
|
||||
return majorLabels;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Artist other = (Artist) obj;
|
||||
return Objects.equals(name, other.name);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
package com.baeldung.java_16_features.mapmulti;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.offset;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class JavaStreamMapMultiUnitTest {
|
||||
|
||||
private static final List<Album> albums = Arrays.asList(new Album("album1", 10, Arrays.asList(new Artist("bob", true, Arrays.asList("label1", "label3")), new Artist("tom", true, Arrays.asList("label2", "label3")))),
|
||||
new Album("album2", 20, Arrays.asList(new Artist("bill", true, Arrays.asList("label2", "label3")), new Artist("tom", true, Arrays.asList("label2", "label4")))));
|
||||
|
||||
@Test
|
||||
public void givenAListOfintegers_whenMapMulti_thenGetListOfOfEvenDoublesPlusPercentage() {
|
||||
|
||||
List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5);
|
||||
double percentage = .01;
|
||||
List<Double> evenDoubles = integers.stream()
|
||||
.<Double> mapMulti((integer, consumer) -> {
|
||||
if (integer % 2 == 0) {
|
||||
consumer.accept((double) integer * (1 + percentage));
|
||||
}
|
||||
})
|
||||
.collect(toList());
|
||||
|
||||
assertThat(evenDoubles).containsAll(Arrays.asList(2.02D, 4.04D));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfintegers_whenFilterMap_thenGetListOfOfEvenDoublesPlusPercentage() {
|
||||
|
||||
List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5);
|
||||
double percentage = .01;
|
||||
List<Double> evenDoubles = integers.stream()
|
||||
.filter(integer -> integer % 2 == 0)
|
||||
.<Double> map(integer -> ((double) integer * (1 + percentage)))
|
||||
.collect(toList());
|
||||
|
||||
assertThat(evenDoubles).containsAll(Arrays.asList(2.02D, 4.04D));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfintegers_whenMapMultiToDouble_thenGetSumOfEvenNumbersAfterApplyPercentage() {
|
||||
|
||||
List<Integer> integers = Arrays.asList(1, 2, 3, 4, 5, 6, 7);
|
||||
double percentage = .01;
|
||||
double sum = integers.stream()
|
||||
.mapMultiToDouble((integer, consumer) -> {
|
||||
if (integer % 2 == 0) {
|
||||
consumer.accept(integer * (1 + percentage));
|
||||
}
|
||||
})
|
||||
.sum();
|
||||
|
||||
assertThat(sum).isEqualTo(12.12, offset(0.001d));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfAlbums_whenFlatMap_thenGetListOfArtistAlbumPairs() {
|
||||
|
||||
List<Pair<String, String>> artistAlbum = albums.stream()
|
||||
.flatMap(album -> album.getArtists()
|
||||
.stream()
|
||||
.map(artist -> new ImmutablePair<String, String>(artist.getName(), album.getAlbumName())))
|
||||
.collect(toList());
|
||||
|
||||
assertThat(artistAlbum).contains(new ImmutablePair<String, String>("bob", "album1"), new ImmutablePair<String,
|
||||
String>("tom", "album1"), new ImmutablePair<String, String>("bill", "album2"), new ImmutablePair<String, String>("tom", "album2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfAlbums_whenMapMulti_thenGetListOfPairsOfArtistAlbum() {
|
||||
|
||||
List<Pair<String, String>> artistAlbum = albums.stream()
|
||||
.<Pair<String, String>> mapMulti((album, consumer) -> {
|
||||
for (Artist artist : album.getArtists()) {
|
||||
consumer.accept(new ImmutablePair<String, String>(artist.getName(), album.getAlbumName()));
|
||||
}
|
||||
})
|
||||
.collect(toList());
|
||||
|
||||
assertThat(artistAlbum).contains(new ImmutablePair<String, String>("bob", "album1"), new ImmutablePair<String, String>("tom", "album1"),
|
||||
new ImmutablePair<String, String>("bill", "album2"), new ImmutablePair<String, String>("tom", "album2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfAlbums_whenFlatMap_thenGetListOfArtistAlbumjPairsBelowGivenCost() {
|
||||
|
||||
int upperCost = 9;
|
||||
List<Pair<String, String>> artistAlbum = albums.stream()
|
||||
.flatMap(album -> album.getArtists()
|
||||
.stream()
|
||||
.filter(artist -> upperCost > album.getAlbumCost())
|
||||
.map(artist -> new ImmutablePair<String, String>(artist.getName(), album.getAlbumName())))
|
||||
.collect(toList());
|
||||
|
||||
assertTrue(artistAlbum.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfAlbums_whenMapMulti_thenGetListOfArtistAlbumPairsBelowGivenCost() {
|
||||
|
||||
int upperCost = 9;
|
||||
List<Pair<String, String>> artistAlbum = albums.stream()
|
||||
.<Pair<String, String>> mapMulti((album, consumer) -> {
|
||||
if (album.getAlbumCost() < upperCost) {
|
||||
for (Artist artist : album.getArtists()) {
|
||||
consumer.accept(new ImmutablePair<String, String>(artist.getName(), album.getAlbumName()));
|
||||
}
|
||||
}
|
||||
})
|
||||
.collect(toList());
|
||||
|
||||
assertTrue(artistAlbum.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAListOfAlbums_whenMapMulti_thenGetPairsOfArtistMajorLabelsUsingMethodReference() {
|
||||
|
||||
List<Pair<String, String>> artistLabels = albums.stream()
|
||||
.mapMulti(Album::artistAlbumPairsToMajorLabels)
|
||||
.collect(toList());
|
||||
|
||||
assertThat(artistLabels).contains(new ImmutablePair<String, String>("bob:album1", "label1,label3"), new ImmutablePair<String, String>("tom:album1", "label2,label3"),
|
||||
new ImmutablePair<String, String>("bill:album2", "label2,label3"), new ImmutablePair<String, String>("tom:album2", "label2,label4"));
|
||||
}
|
||||
}
|
||||
@@ -11,3 +11,4 @@ This module contains articles about parsing and formatting Java date and time ob
|
||||
- [Display All Time Zones With GMT And UTC in Java](http://www.baeldung.com/java-time-zones)
|
||||
- [Convert between String and Timestamp](https://www.baeldung.com/java-string-to-timestamp)
|
||||
- [Convert String to Date in Java](http://www.baeldung.com/java-string-to-date)
|
||||
- [Format a Milliseconds Duration to HH:MM:SS](https://www.baeldung.com/java-ms-to-hhmmss)
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
|
||||
<properties>
|
||||
<commons-validator.version>1.6</commons-validator.version>
|
||||
<joda-time.version>2.10</joda-time.version>
|
||||
<joda-time.version>2.10.10</joda-time.version>
|
||||
<!-- testing -->
|
||||
<assertj.version>3.6.1</assertj.version>
|
||||
<maven.compiler.source>1.9</maven.compiler.source>
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.baeldung.formatduration;
|
||||
|
||||
import org.apache.commons.lang3.time.DurationFormatUtils;
|
||||
import org.joda.time.Period;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
public class FormatDurationUnitTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void givenInterval_WhenFormatInterval_formatDuration() {
|
||||
long HH = TimeUnit.MILLISECONDS.toHours(38114000);
|
||||
long MM = TimeUnit.MILLISECONDS.toMinutes(38114000) % 60;
|
||||
long SS = TimeUnit.MILLISECONDS.toSeconds(38114000) % 60;
|
||||
String timeInHHMMSS = String.format("%02d:%02d:%02d", HH, MM, SS);
|
||||
|
||||
assertThat(timeInHHMMSS).isEqualTo("10:35:14");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenInterval_WhenFormatUsingDuration_formatDuration() {
|
||||
Duration duration = Duration.ofMillis(38114000);
|
||||
long seconds = duration.getSeconds();
|
||||
long HH = seconds / 3600;
|
||||
long MM = (seconds % 3600) / 60;
|
||||
long SS = seconds % 60;
|
||||
String timeInHHMMSS = String.format("%02d:%02d:%02d", HH, MM, SS);
|
||||
assertThat(timeInHHMMSS).isEqualTo("10:35:14");
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void givenInterval_WhenFormatDurationUsingApacheCommons_formatDuration() {
|
||||
assertThat(DurationFormatUtils.formatDuration(38114000, "HH:mm:ss"))
|
||||
.isEqualTo("10:35:14");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenInterval_WhenFormatDurationUsingJodaTime_formatDuration() {
|
||||
org.joda.time.Duration duration = new org.joda.time.Duration(38114000);
|
||||
Period period = duration.toPeriod();
|
||||
long HH = period.getHours();
|
||||
long MM = period.getMinutes();
|
||||
long SS = period.getSeconds();
|
||||
|
||||
String timeInHHMMSS = String.format("%02d:%02d:%02d", HH, MM, SS);
|
||||
assertThat(timeInHHMMSS).isEqualTo("10:35:14");
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -3,5 +3,6 @@
|
||||
This module contains articles about JavaFX.
|
||||
|
||||
### Relevant Articles:
|
||||
-[Introduction to JavaFX](https://www.baeldung.com/javafx)
|
||||
- [Introduction to JavaFX](https://www.baeldung.com/javafx)
|
||||
- [Display Custom Items in JavaFX ListView](https://www.baeldung.com/javafx-listview-display-custom-items)
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
</prerequisites>
|
||||
|
||||
<properties>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
<argLine>-Djava.security.egd=file:/dev/./urandom -Xmx256m</argLine>
|
||||
<assertj.version>3.6.2</assertj.version>
|
||||
<awaitility.version>2.0.0</awaitility.version>
|
||||
@@ -31,6 +30,7 @@
|
||||
<jcache.version>1.0.0</jcache.version>
|
||||
<jhipster.server.version>1.1.0</jhipster.server.version>
|
||||
<jjwt.version>0.7.0</jjwt.version>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
<liquibase-hibernate5.version>3.6</liquibase-hibernate5.version>
|
||||
<liquibase-slf4j.version>2.0.0</liquibase-slf4j.version>
|
||||
<liquibase.version>3.6.2</liquibase.version>
|
||||
@@ -59,14 +59,14 @@
|
||||
|
||||
<sonar.issue.ignore.multicriteria>S3437,UndocumentedApi,BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria>
|
||||
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
recommended by http://fontawesome.io/examples/ -->
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>src/main/webapp/app/**/*.*</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>Web:BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=squid%3AS3437 is ignored, as a JPA-managed field cannot be transient -->
|
||||
<sonar.issue.ignore.multicriteria.S3437.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.S3437.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.S3437.ruleKey>squid:S3437</sonar.issue.ignore.multicriteria.S3437.ruleKey>
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
should be self-explanatory -->
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>squid:UndocumentedApi</sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>
|
||||
@@ -349,7 +349,6 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -365,11 +364,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Spring Cloud -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
@@ -427,7 +421,7 @@
|
||||
<defaultGoal>spring-boot:run</defaultGoal>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
bind to Maven lifecycle -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
@@ -580,14 +574,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Force alphabetical order to have a reproducible build -->
|
||||
<runOrder>alphabetical</runOrder>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
@@ -768,8 +754,8 @@
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
should hot reload automatically! -->
|
||||
<id>cc</id>
|
||||
<build>
|
||||
|
||||
@@ -21,6 +21,8 @@ eureka:
|
||||
instanceId: carapp:${spring.application.instance_id:${random.value}}
|
||||
|
||||
spring:
|
||||
main:
|
||||
banner-mode: "off"
|
||||
application:
|
||||
name: carapp
|
||||
jackson:
|
||||
@@ -37,7 +39,7 @@ spring:
|
||||
database-platform: io.github.jhipster.domain.util.FixedH2Dialect
|
||||
database: H2
|
||||
open-in-view: false
|
||||
show-sql: true
|
||||
show-sql: false
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
naming:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<configuration scan="true">
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
|
||||
<logger name="com.car.app" level="DEBUG"/>
|
||||
<logger name="com.car.app" level="INFO"/>
|
||||
<logger name="org.hibernate" level="WARN"/>
|
||||
<logger name="org.hibernate.ejb.HibernatePersistence" level="OFF"/>
|
||||
<logger name="org.apache.catalina.startup.DigesterFactory" level="OFF"/>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<jcache.version>1.0.0</jcache.version>
|
||||
<jhipster.server.version>1.1.0</jhipster.server.version>
|
||||
<jjwt.version>0.7.0</jjwt.version>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
<liquibase-hibernate5.version>3.6</liquibase-hibernate5.version>
|
||||
<liquibase-slf4j.version>2.0.0</liquibase-slf4j.version>
|
||||
<liquibase.version>3.6.2</liquibase.version>
|
||||
@@ -57,14 +58,14 @@
|
||||
|
||||
<sonar.issue.ignore.multicriteria>S3437,UndocumentedApi,BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria>
|
||||
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
recommended by http://fontawesome.io/examples/ -->
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>src/main/webapp/app/**/*.*</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>Web:BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=squid%3AS3437 is ignored, as a JPA-managed field cannot be transient -->
|
||||
<sonar.issue.ignore.multicriteria.S3437.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.S3437.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.S3437.ruleKey>squid:S3437</sonar.issue.ignore.multicriteria.S3437.ruleKey>
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
should be self-explanatory -->
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>squid:UndocumentedApi</sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>
|
||||
@@ -90,7 +91,6 @@
|
||||
<undertow.version>1.4.10.Final</undertow.version>
|
||||
<validation-api.version>1.1.0.Final</validation-api.version>
|
||||
<yarn.version>v0.21.3</yarn.version>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@@ -345,6 +345,10 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
@@ -359,11 +363,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Spring Cloud -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
@@ -421,7 +420,7 @@
|
||||
<defaultGoal>spring-boot:run</defaultGoal>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
bind to Maven lifecycle -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
@@ -574,14 +573,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Force alphabetical order to have a reproducible build -->
|
||||
<runOrder>alphabetical</runOrder>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
@@ -762,8 +753,8 @@
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
should hot reload automatically! -->
|
||||
<id>cc</id>
|
||||
<build>
|
||||
|
||||
@@ -21,6 +21,8 @@ eureka:
|
||||
instanceId: dealerapp:${spring.application.instance_id:${random.value}}
|
||||
|
||||
spring:
|
||||
main:
|
||||
banner-mode: "off"
|
||||
application:
|
||||
name: dealerapp
|
||||
jackson:
|
||||
@@ -37,7 +39,7 @@ spring:
|
||||
database-platform: io.github.jhipster.domain.util.FixedH2Dialect
|
||||
database: H2
|
||||
open-in-view: false
|
||||
show-sql: true
|
||||
show-sql: false
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
naming:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<configuration scan="true">
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
|
||||
<logger name="com.dealer.app" level="DEBUG"/>
|
||||
<logger name="com.dealer.app" level="INFO"/>
|
||||
<logger name="org.hibernate" level="WARN"/>
|
||||
<logger name="org.hibernate.ejb.HibernatePersistence" level="OFF"/>
|
||||
<logger name="org.apache.catalina.startup.DigesterFactory" level="OFF"/>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
<jcache.version>1.0.0</jcache.version>
|
||||
<jhipster.server.version>1.1.0</jhipster.server.version>
|
||||
<jjwt.version>0.7.0</jjwt.version>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
<liquibase-hibernate5.version>3.6</liquibase-hibernate5.version>
|
||||
<liquibase-slf4j.version>2.0.0</liquibase-slf4j.version>
|
||||
<liquibase.version>3.6.2</liquibase.version>
|
||||
@@ -61,14 +62,14 @@
|
||||
|
||||
<sonar.issue.ignore.multicriteria>S3437,UndocumentedApi,BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria>
|
||||
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
recommended by http://fontawesome.io/examples/ -->
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>src/main/webapp/app/**/*.*</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>Web:BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=squid%3AS3437 is ignored, as a JPA-managed field cannot be transient -->
|
||||
<sonar.issue.ignore.multicriteria.S3437.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.S3437.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.S3437.ruleKey>squid:S3437</sonar.issue.ignore.multicriteria.S3437.ruleKey>
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
should be self-explanatory -->
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>squid:UndocumentedApi</sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>
|
||||
@@ -94,7 +95,6 @@
|
||||
<undertow.version>1.4.10.Final</undertow.version>
|
||||
<validation-api.version>1.1.0.Final</validation-api.version>
|
||||
<yarn.version>v0.21.3</yarn.version>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@@ -383,6 +383,10 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
@@ -397,11 +401,6 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter</artifactId>
|
||||
@@ -463,7 +462,7 @@
|
||||
<defaultGoal>spring-boot:run</defaultGoal>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
bind to Maven lifecycle -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
@@ -632,14 +631,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- Force alphabetical order to have a reproducible build -->
|
||||
<runOrder>alphabetical</runOrder>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
@@ -878,8 +869,8 @@
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
should hot reload automatically! -->
|
||||
<id>cc</id>
|
||||
<build>
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class LogsResourceIntegrationTest {
|
||||
public void changeLogs()throws Exception {
|
||||
LoggerVM logger = new LoggerVM();
|
||||
logger.setLevel("INFO");
|
||||
logger.setName("ROOT");
|
||||
logger.setName("some.test.logger");
|
||||
|
||||
restLogsMockMvc.perform(put("/management/logs")
|
||||
.contentType(TestUtil.APPLICATION_JSON_UTF8)
|
||||
|
||||
+3
-1
@@ -21,6 +21,8 @@ eureka:
|
||||
instanceId: gateway:${spring.application.instance_id:${random.value}}
|
||||
|
||||
spring:
|
||||
main:
|
||||
banner-mode: "off"
|
||||
application:
|
||||
name: gateway
|
||||
autoconfigure:
|
||||
@@ -39,7 +41,7 @@ spring:
|
||||
database-platform: io.github.jhipster.domain.util.FixedH2Dialect
|
||||
database: H2
|
||||
open-in-view: false
|
||||
show-sql: true
|
||||
show-sql: false
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
naming:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<configuration scan="true">
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
|
||||
<logger name="com.gateway" level="DEBUG"/>
|
||||
<logger name="com.gateway" level="INFO"/>
|
||||
<logger name="org.hibernate" level="WARN"/>
|
||||
<logger name="org.hibernate.ejb.HibernatePersistence" level="OFF"/>
|
||||
<logger name="org.apache.catalina.startup.DigesterFactory" level="OFF"/>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<groupId>com.baeldung.jhipster</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
|
||||
<modules>
|
||||
<module>car-app</module>
|
||||
<module>dealer-app</module>
|
||||
|
||||
@@ -277,8 +277,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<!-- security -->
|
||||
<dependency>
|
||||
@@ -297,7 +296,7 @@
|
||||
<defaultGoal>spring-boot:run</defaultGoal>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
<!-- This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. Remove when the m2e plugin can correctly
|
||||
bind to Maven lifecycle -->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
@@ -751,8 +750,8 @@
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
<!-- Profile for doing "continuous compilation" with the Scala Maven plugin. It allows automatic compilation of Java classes as soon as they are saved. To use it, run in
|
||||
3 terminals: - './mvnw -Pcc scala:cc' for continous compilation of your classes - './mvnw -Pcc' for hot reload of Spring boot - 'gulp' for hot reload of the HTML/JavaScript assets Everything
|
||||
should hot reload automatically! -->
|
||||
<id>cc</id>
|
||||
<build>
|
||||
@@ -931,14 +930,14 @@
|
||||
|
||||
<sonar.issue.ignore.multicriteria>S3437,UndocumentedApi,BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria>
|
||||
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=Web%3ABoldAndItalicTagsCheck is ignored. Even if we agree that using the "i" tag is an awful practice, this is what is
|
||||
recommended by http://fontawesome.io/examples/ -->
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>src/main/webapp/app/**/*.*</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>Web:BoldAndItalicTagsCheck</sonar.issue.ignore.multicriteria.BoldAndItalicTagsCheck.ruleKey>
|
||||
<!-- Rule https://sonarqube.com/coding_rules#rule_key=squid%3AS3437 is ignored, as a JPA-managed field cannot be transient -->
|
||||
<sonar.issue.ignore.multicriteria.S3437.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.S3437.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.S3437.ruleKey>squid:S3437</sonar.issue.ignore.multicriteria.S3437.ruleKey>
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
<!-- Rule http://sonarqube.com/coding_rules#rule_key=squid%3AUndocumentedApi is ignored, as we want to follow "clean code" guidelines and classes, methods and arguments names
|
||||
should be self-explanatory -->
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>src/main/java/**/*</sonar.issue.ignore.multicriteria.UndocumentedApi.resourceKey>
|
||||
<sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>squid:UndocumentedApi</sonar.issue.ignore.multicriteria.UndocumentedApi.ruleKey>
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class LogsResourceIntegrationTest {
|
||||
public void changeLogs()throws Exception {
|
||||
LoggerVM logger = new LoggerVM();
|
||||
logger.setLevel("INFO");
|
||||
logger.setName("ROOT");
|
||||
logger.setName("some.test.logger");
|
||||
|
||||
restLogsMockMvc.perform(put("/management/logs")
|
||||
.contentType(TestUtil.APPLICATION_JSON_UTF8)
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
|
||||
spring:
|
||||
main:
|
||||
banner-mode: "off"
|
||||
application:
|
||||
name: baeldung
|
||||
jackson:
|
||||
@@ -31,7 +33,7 @@ spring:
|
||||
database-platform: io.github.jhipster.domain.util.FixedH2Dialect
|
||||
database: H2
|
||||
open-in-view: false
|
||||
show-sql: true
|
||||
show-sql: false
|
||||
hibernate:
|
||||
ddl-auto: none
|
||||
naming:
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<configuration scan="true">
|
||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||
|
||||
<logger name="com.baeldung" level="DEBUG"/>
|
||||
<logger name="com.baeldung" level="INFO"/>
|
||||
<logger name="org.hibernate" level="WARN"/>
|
||||
<logger name="org.hibernate.ejb.HibernatePersistence" level="OFF"/>
|
||||
<logger name="org.apache.catalina.startup.DigesterFactory" level="OFF"/>
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
<?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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>jhipster-uaa</artifactId>
|
||||
<groupId>com.baeldung.jhipster</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.baeldung.jhipster.gateway</groupId>
|
||||
<artifactId>gateway</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
@@ -415,15 +422,6 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven-surefire-plugin.version}</version>
|
||||
<configuration>
|
||||
<!-- Force alphabetical order to have a reproducible build -->
|
||||
<runOrder>alphabetical</runOrder>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
@@ -1010,7 +1008,7 @@
|
||||
</profile>
|
||||
<!-- jhipster-needle-maven-add-profile -->
|
||||
</profiles>
|
||||
|
||||
|
||||
<properties>
|
||||
<lifecycle.mapping.version>1.0.0</lifecycle.mapping.version>
|
||||
<spring.web.version>0.24.0</spring.web.version>
|
||||
@@ -1090,5 +1088,5 @@
|
||||
<sonar.tests>${project.basedir}/src/test/</sonar.tests>
|
||||
|
||||
<!-- jhipster-needle-maven-property -->
|
||||
</properties>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
*
|
||||
* @see WebConfigurer
|
||||
*/
|
||||
public class WebConfigurerTest {
|
||||
public class WebConfigurerUnitTest {
|
||||
|
||||
private WebConfigurer webConfigurer;
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import static springfox.documentation.swagger2.web.Swagger2Controller.DEFAULT_UR
|
||||
/**
|
||||
* Tests SwaggerBasePathRewritingFilter class.
|
||||
*/
|
||||
public class SwaggerBasePathRewritingFilterTest {
|
||||
public class SwaggerBasePathRewritingFilterUnitTest {
|
||||
|
||||
private SwaggerBasePathRewritingFilter filter = new SwaggerBasePathRewritingFilter();
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ import java.util.List;
|
||||
*
|
||||
* @see CookieCollection
|
||||
*/
|
||||
public class CookieCollectionTest {
|
||||
public class CookieCollectionUnitTest {
|
||||
public static final String COOKIE_NAME = "chocolate";
|
||||
public static final String COOKIE_VALUE = "yummy";
|
||||
public static final String BROWNIE_NAME = "brownie";
|
||||
+7
-7
@@ -12,7 +12,7 @@ import org.springframework.security.oauth2.common.OAuth2AccessToken;
|
||||
* Test whether the CookieTokenExtractor can properly extract access tokens from
|
||||
* Cookies and Headers.
|
||||
*/
|
||||
public class CookieTokenExtractorTest {
|
||||
public class CookieTokenExtractorUnitTest {
|
||||
private CookieTokenExtractor cookieTokenExtractor;
|
||||
|
||||
@Before
|
||||
@@ -22,24 +22,24 @@ public class CookieTokenExtractorTest {
|
||||
|
||||
@Test
|
||||
public void testExtractTokenCookie() {
|
||||
MockHttpServletRequest request = OAuth2AuthenticationServiceTest.createMockHttpServletRequest();
|
||||
MockHttpServletRequest request = OAuth2AuthenticationServiceUnitTest.createMockHttpServletRequest();
|
||||
Authentication authentication = cookieTokenExtractor.extract(request);
|
||||
Assert.assertEquals(OAuth2AuthenticationServiceTest.ACCESS_TOKEN_VALUE, authentication.getPrincipal().toString());
|
||||
Assert.assertEquals(OAuth2AuthenticationServiceUnitTest.ACCESS_TOKEN_VALUE, authentication.getPrincipal().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractTokenHeader() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest(HttpMethod.GET.name(), "http://www.test.com");
|
||||
request.addHeader("Authorization", OAuth2AccessToken.BEARER_TYPE + " " + OAuth2AuthenticationServiceTest.ACCESS_TOKEN_VALUE);
|
||||
request.addHeader("Authorization", OAuth2AccessToken.BEARER_TYPE + " " + OAuth2AuthenticationServiceUnitTest.ACCESS_TOKEN_VALUE);
|
||||
Authentication authentication = cookieTokenExtractor.extract(request);
|
||||
Assert.assertEquals(OAuth2AuthenticationServiceTest.ACCESS_TOKEN_VALUE, authentication.getPrincipal().toString());
|
||||
Assert.assertEquals(OAuth2AuthenticationServiceUnitTest.ACCESS_TOKEN_VALUE, authentication.getPrincipal().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractTokenParam() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest(HttpMethod.GET.name(), "http://www.test.com");
|
||||
request.addParameter(OAuth2AccessToken.ACCESS_TOKEN, OAuth2AuthenticationServiceTest.ACCESS_TOKEN_VALUE);
|
||||
request.addParameter(OAuth2AccessToken.ACCESS_TOKEN, OAuth2AuthenticationServiceUnitTest.ACCESS_TOKEN_VALUE);
|
||||
Authentication authentication = cookieTokenExtractor.extract(request);
|
||||
Assert.assertEquals(OAuth2AuthenticationServiceTest.ACCESS_TOKEN_VALUE, authentication.getPrincipal().toString());
|
||||
Assert.assertEquals(OAuth2AuthenticationServiceUnitTest.ACCESS_TOKEN_VALUE, authentication.getPrincipal().toString());
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user