From db34b768900df57418e27296cdba25f5c584cb34 Mon Sep 17 00:00:00 2001 From: eelhazati Date: Sun, 2 Sep 2018 21:15:50 +0100 Subject: [PATCH 01/56] init project --- cdi-portable-extension/flyway-cdi/pom.xml | 38 ++++++++++ .../cdi/extension/FlywayExtension.java | 74 +++++++++++++++++++ .../baeldung/cdi/extension/FlywayType.java | 14 ++++ .../src/main/resources/META-INF/beans.xml | 6 ++ .../javax.enterprise.inject.spi.Extension | 2 + cdi-portable-extension/main-app/pom.xml | 52 +++++++++++++ .../com/baeldung/cdi/extension/MainApp.java | 16 ++++ .../src/main/resources/META-INF/beans.xml | 6 ++ .../db/migration/V1__Create_person_table.sql | 4 + .../resources/db/migration/V2__Add_people.sql | 3 + cdi-portable-extension/pom.xml | 30 ++++++++ pom.xml | 1 + 12 files changed, 246 insertions(+) create mode 100644 cdi-portable-extension/flyway-cdi/pom.xml create mode 100644 cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayExtension.java create mode 100644 cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayType.java create mode 100644 cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/beans.xml create mode 100644 cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension create mode 100644 cdi-portable-extension/main-app/pom.xml create mode 100644 cdi-portable-extension/main-app/src/main/java/com/baeldung/cdi/extension/MainApp.java create mode 100644 cdi-portable-extension/main-app/src/main/resources/META-INF/beans.xml create mode 100644 cdi-portable-extension/main-app/src/main/resources/db/migration/V1__Create_person_table.sql create mode 100644 cdi-portable-extension/main-app/src/main/resources/db/migration/V2__Add_people.sql create mode 100644 cdi-portable-extension/pom.xml diff --git a/cdi-portable-extension/flyway-cdi/pom.xml b/cdi-portable-extension/flyway-cdi/pom.xml new file mode 100644 index 0000000000..9fb781aaab --- /dev/null +++ b/cdi-portable-extension/flyway-cdi/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + + flyway-cdi + + + com.baeldung + cdi-portable-extension + 1.0-SNAPSHOT + + + + + javax.enterprise + cdi-api + 2.0.SP1 + + + org.flywaydb + flyway-core + 5.1.4 + + + org.apache.tomcat + tomcat-jdbc + 8.5.33 + + + javax.annotation + javax.annotation-api + 1.3.2 + + + + diff --git a/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayExtension.java b/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayExtension.java new file mode 100644 index 0000000000..a5019b82c1 --- /dev/null +++ b/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayExtension.java @@ -0,0 +1,74 @@ +package com.baeldung.cdi.extension; + +import org.apache.tomcat.jdbc.pool.DataSource; +import org.flywaydb.core.Flyway; + +import javax.annotation.sql.DataSourceDefinition; +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.event.Observes; +import javax.enterprise.inject.Any; +import javax.enterprise.inject.Default; +import javax.enterprise.inject.literal.InjectLiteral; +import javax.enterprise.inject.spi.*; +import javax.enterprise.util.AnnotationLiteral; + + +/** + * Flyway is now under CDI container like: + * + * @ApplicationScoped + * @FlywayType public class Flyway{ + * @Inject setDataSource(DataSource dataSource){ + * //... + * } + * } + */ + +public class FlywayExtension implements Extension { + + DataSourceDefinition dataSourceDefinition = null; + + public void registerFlywayType(@Observes BeforeBeanDiscovery bbdEvent) { + bbdEvent.addAnnotatedType(Flyway.class, Flyway.class.getName()); + } + + public void detectDataSourceDefinition(@Observes @WithAnnotations(DataSourceDefinition.class) ProcessAnnotatedType patEvent) { + AnnotatedType at = patEvent.getAnnotatedType(); + dataSourceDefinition = at.getAnnotation(DataSourceDefinition.class); + } + + public void processAnnotatedType(@Observes ProcessAnnotatedType patEvent) { + patEvent.configureAnnotatedType() + //Add Scope + .add(ApplicationScoped.Literal.INSTANCE) + //Add Qualifier + .add(new AnnotationLiteral() { + }) + //Decorate setDataSource(DataSource dataSource){} with @Inject + .filterMethods(annotatedMethod -> { + return annotatedMethod.getParameters().size() == 1 && + annotatedMethod.getParameters().get(0).getBaseType().equals(javax.sql.DataSource.class); + }) + .findFirst().get().add(InjectLiteral.INSTANCE); + } + + void afterBeanDiscovery(@Observes AfterBeanDiscovery abdEvent, BeanManager bm) { + abdEvent.addBean() + .types(javax.sql.DataSource.class, DataSource.class) + .qualifiers(new AnnotationLiteral() {}, new AnnotationLiteral() {}) + .scope(ApplicationScoped.class) + .name(DataSource.class.getName()) + .beanClass(DataSource.class) + .createWith(creationalContext -> { + DataSource instance = new DataSource(); + instance.setUrl(dataSourceDefinition.url()); + instance.setDriverClassName(dataSourceDefinition.className()); + return instance; + }); + } + + void runFlywayMigration(@Observes AfterDeploymentValidation adv, BeanManager manager) { + Flyway flyway = manager.createInstance().select(Flyway.class, new AnnotationLiteral() {}).get(); + flyway.migrate(); + } +} diff --git a/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayType.java b/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayType.java new file mode 100644 index 0000000000..7c3a5affa6 --- /dev/null +++ b/cdi-portable-extension/flyway-cdi/src/main/java/com/baeldung/cdi/extension/FlywayType.java @@ -0,0 +1,14 @@ +package com.baeldung.cdi.extension; + +import javax.inject.Qualifier; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.*; + +@Retention(RetentionPolicy.RUNTIME) +@Target({FIELD, METHOD, PARAMETER, TYPE}) +@Qualifier +public @interface FlywayType { +} \ No newline at end of file diff --git a/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/beans.xml b/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000..44959bfa99 --- /dev/null +++ b/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/beans.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension new file mode 100644 index 0000000000..a82dc47714 --- /dev/null +++ b/cdi-portable-extension/flyway-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension @@ -0,0 +1,2 @@ +com.baeldung.cdi.extension.FlywayExtension + diff --git a/cdi-portable-extension/main-app/pom.xml b/cdi-portable-extension/main-app/pom.xml new file mode 100644 index 0000000000..fab9b8bf07 --- /dev/null +++ b/cdi-portable-extension/main-app/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + main-app + jar + + + com.baeldung + cdi-portable-extension + 1.0-SNAPSHOT + + + + + + javax.enterprise + cdi-api + 2.0.SP1 + + + org.jboss.weld.se + weld-se-core + 3.0.5.Final + runtime + + + + com.baeldung + flyway-cdi + 1.0-SNAPSHOT + runtime + + + + com.h2database + h2 + 1.4.197 + runtime + + + + javax.annotation + javax.annotation-api + 1.3.2 + + + + + \ No newline at end of file diff --git a/cdi-portable-extension/main-app/src/main/java/com/baeldung/cdi/extension/MainApp.java b/cdi-portable-extension/main-app/src/main/java/com/baeldung/cdi/extension/MainApp.java new file mode 100644 index 0000000000..1f6c5b43ba --- /dev/null +++ b/cdi-portable-extension/main-app/src/main/java/com/baeldung/cdi/extension/MainApp.java @@ -0,0 +1,16 @@ +package com.baeldung.cdi.extension; + +import javax.annotation.sql.DataSourceDefinition; +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.se.SeContainer; +import javax.enterprise.inject.se.SeContainerInitializer; + +@ApplicationScoped +@DataSourceDefinition(name = "ds", className = "org.h2.Driver", url = "jdbc:h2:mem:testdb") +public class MainApp { + public static void main(String[] args) { + SeContainerInitializer initializer = SeContainerInitializer.newInstance(); + try (SeContainer container = initializer.initialize()) { + } + } +} \ No newline at end of file diff --git a/cdi-portable-extension/main-app/src/main/resources/META-INF/beans.xml b/cdi-portable-extension/main-app/src/main/resources/META-INF/beans.xml new file mode 100644 index 0000000000..44959bfa99 --- /dev/null +++ b/cdi-portable-extension/main-app/src/main/resources/META-INF/beans.xml @@ -0,0 +1,6 @@ + + \ No newline at end of file diff --git a/cdi-portable-extension/main-app/src/main/resources/db/migration/V1__Create_person_table.sql b/cdi-portable-extension/main-app/src/main/resources/db/migration/V1__Create_person_table.sql new file mode 100644 index 0000000000..6bddc7689e --- /dev/null +++ b/cdi-portable-extension/main-app/src/main/resources/db/migration/V1__Create_person_table.sql @@ -0,0 +1,4 @@ +create table PERSON ( + ID int not null, + NAME varchar(100) not null +); diff --git a/cdi-portable-extension/main-app/src/main/resources/db/migration/V2__Add_people.sql b/cdi-portable-extension/main-app/src/main/resources/db/migration/V2__Add_people.sql new file mode 100644 index 0000000000..d8f1d62667 --- /dev/null +++ b/cdi-portable-extension/main-app/src/main/resources/db/migration/V2__Add_people.sql @@ -0,0 +1,3 @@ +insert into PERSON (ID, NAME) values (1, 'Axel'); +insert into PERSON (ID, NAME) values (2, 'Mr. Foo'); +insert into PERSON (ID, NAME) values (3, 'Ms. Bar'); diff --git a/cdi-portable-extension/pom.xml b/cdi-portable-extension/pom.xml new file mode 100644 index 0000000000..66913de84d --- /dev/null +++ b/cdi-portable-extension/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + com.baeldung + cdi-portable-extension + 1.0-SNAPSHOT + pom + + + 1.8 + 1.8 + + + + main-app + flyway-cdi + + + + + javax.enterprise + cdi-api + 2.0.SP1 + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index be6029a946..7088d88cd8 100644 --- a/pom.xml +++ b/pom.xml @@ -597,6 +597,7 @@ spring-reactive-kotlin jnosql spring-boot-angular-ecommerce + cdi-portable-extension From 764dff1bd9c114028d363995d8edfaefa80c5704 Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Sun, 9 Sep 2018 16:10:21 -0400 Subject: [PATCH 02/56] BAEL-8939: Adding a Spring Context test in all Spring Modules (changes for around 20 modules.. work in progress..) --- .../baeldung/SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 15 +++++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 13 +++++++++++++ spring-batch/repository.sqlite | Bin 0 -> 49152 bytes .../baeldung/SpringContextIntegrationTest.java | 12 ++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 13 +++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../baeldung/SpringContextIntegrationTest.java | 17 +++++++++++++++++ ....java => SpringContextIntegrationTest.java} | 2 +- 17 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-5-data-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-5-reactive-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-5-reactive-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-5-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-5-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-amqp-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-apache-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-batch/repository.sqlite create mode 100644 spring-batch/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-bom/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-admin/spring-boot-admin-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-admin/spring-boot-admin-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename spring-boot-bootstrap/src/test/java/org/baeldung/{SpringBootBootstrapApplicationIntegrationTest.java => SpringContextIntegrationTest.java} (83%) diff --git a/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..9dfac2bd9e --- /dev/null +++ b/spring-4/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.flips.ApplicationConfig; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ApplicationConfig.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-5-data-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-data-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..ce4c172960 --- /dev/null +++ b/spring-5-data-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.reactive.Spring5ReactiveApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Spring5ReactiveApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-5-reactive-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-reactive-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..7843a8968d --- /dev/null +++ b/spring-5-reactive-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.reactive.Spring5ReactiveTestApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Spring5ReactiveTestApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-5-reactive-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-reactive-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..2bcd974510 --- /dev/null +++ b/spring-5-reactive-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.reactive.security.SpringSecurity5Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringSecurity5Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-5-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..ce4c172960 --- /dev/null +++ b/spring-5-reactive/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.reactive.Spring5ReactiveApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Spring5ReactiveApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-5-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..967f67e760 --- /dev/null +++ b/spring-5-security/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.dsl.CustomConfigurerApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = CustomConfigurerApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..75b3df4978 --- /dev/null +++ b/spring-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.Spring5Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Spring5Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..ae37e77f86 --- /dev/null +++ b/spring-activiti/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.example.activitiwithspring.ActivitiWithSpringApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ActivitiWithSpringApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-amqp-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-amqp-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..f134074cf8 --- /dev/null +++ b/spring-amqp-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.springamqpsimple.SpringAmqpApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringAmqpApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..cf1ac7de89 --- /dev/null +++ b/spring-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,15 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-apache-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-apache-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..efd0603c76 --- /dev/null +++ b/spring-apache-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,13 @@ +package org.baeldung; + +import org.junit.Test; + +import com.baeldung.camel.main.App; + +public class SpringContextIntegrationTest { + + @Test + public final void testMain() throws Exception { + App.main(null); + } +} diff --git a/spring-batch/repository.sqlite b/spring-batch/repository.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..4456ef63cc28948e07a545a72ec1b63366e9057b GIT binary patch literal 49152 zcmeI*&2QUe90zc_dF$&km>|G}W<^YGv?xpZvbLKha2b%T$wiYx+Y3p`b+oVg} zv1#Jat_%tO2QK^xTtFOl90$aK3kQxIk+^Uf(hmG==fzH3+D>e&)z?Z=`+2b+fBf@f zyUvSxT`n6sw^FTblnic+Imxgr^AX1}40E2IgY;|;r)k9BoS?s~V|=gC^Gt$W7z#gQ z27D{b3Hij=;co}e_Ai9K3Qqd}@Za+NLdh5)aLfhn422@Y!|e7cqqMlL&+wXXwRkNz zQ&h$4u8Cej5qVAIG=4@FIad}p!bxdP%4*^jQQ`86l;M>HZcbd__=1*`vQ#r8W;HIh z-8&eHT)M<=4|gm~oEL?HCgrm3#k!IQ_h^8t(7~HBFc6AdzRYgN98FO*F<*4e&tA{& z^Z}2?beB4CYj&jmP(%>e-FF?WF}FgyF+z@f=e0I`S607An>^=1&2pzZwq7=;aoK__ zJ2zvTQ?KR}t=MP+cY{}itGqHYI+0AqxMmG1B`OjxOCO8rR#8FD&2VvUsamNUwNkla zw3b{HwE5!foY}qW<<$zera$0DI-3>aYWj*^(<@7Q-4S!GRrjb6+qvEsiije+d)8su zv29$K-g$i_oIrXuMWX9ZiT)H6fSDNap@jpkA@rZ^k+5V9h`Jxfpw3D8t{l6(XI5Ux38JbNJu{V@EYI-5T-OZ6d20>Q9lT^>W{{Q2Uuoyr zT}7Oec~vVG@@YDfq}!z49fTE#FQbQeB!xl|o@XDw?}%o1G~{`O&!}FVt(_C}h-|Mp z9H^^}bJ{|lHfFjNCKuY>DuoLjN&h8~seq~}Qua#m1~0efK;UMinb1~xJA69=RL(VO zw&O6JE6_3Cs%DSU!9WxwYd?$Ap`MQA((D2)k+Tj1DOY2?x_aB}rS$f@9|S{@u`%|G z>R#K@V#!$fsW-?9BK4`Qy}sRF*=_3VPTKiYx4SRu*qATa zAN{xcvbi770d`ipQc!s7q)yHW)`&AYld-P7-t@7~cswJ;q33ZBGZ)${VVxB;C+q`Q z-WQCVJI5|qK~lfFP8XKNx_)=dI(UT4T#Lxo+1Rwwb z2tWV=5P$##AOHafKmYm2$0a%#@6!+t;d#%j2o#sio!Vsg-1MaWpxu zPfsP2)6-M>(#q8M=%n6H>&1qDX6S(d0uX=z1Rwwb2tWV=5P$##AOL|QA&~M9XZj9x z{cqm?4~93G@Sovd!#{+-2|uO@3=n_-1Rwwb2tWV=5P$##AOHafytqIl=$q)X-;D46 z0O09>@3Lox`BB}s{l2kArt8yB@A-U}ywc4&Z}s?6j=bil9Zs^oVMj6*wBP^#lnFn5 z@zp|22tWV=5P$##AOHafKmY;|fB*zuiNGW~$gq8ZK;X=op#amv>Q8?A?r-z;`**C@ zzv$a=^0G)@2-6y|)6MID`qDoP5P$##AOHafKmY;|fB*y_009UbV*&gA{}U$s!!cY*BZ5R?CbyMO!&F=TYu*7{SDC5{8~WsuQ}};r%4PDfB*y_009U<00Izz00bZa zf&WinXM(=`es_a;7+o~K`95Kk>TBz|p*`5tqZgyq+G?V{Su0moS8DXzf}d7vYYDsD z68$oA!n|Hi(61G4B!t^rm9<>0tXB+uS+nO6jYn0ZbYHwji4qmMS)-!0L`|o<%Za7x zR>g>3{3Lp(bgz_HFI83(a<#G=jgQ^(uD4mOmyL3@;#Ftj!Zg*IT`w84<#pX$n4*`K zt%a3ZiyDtN*3oSCAy%+Kl4z`!YV@!@_V53l_>rLp1_(d^0uX=z1Rwwb2tWV=5P-mI zFM#X+egDDHb^WhzMnALf|372G&tCgYj0Qpg0uX=z1Rwwb2tWV=5P$##AaF>5AnRw| zU>-KE|E>4`A94;T4gm;200Izz00bZa0SG_<0uX?}Q4nao|DQhmPY( literal 0 HcmV?d00001 diff --git a/spring-batch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-batch/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..c3a9f74759 --- /dev/null +++ b/spring-batch/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,12 @@ +package org.baeldung; + +import org.baeldung.batch.App; +import org.junit.Test; + +public class SpringContextIntegrationTest { + + @Test + public final void testMain() throws Exception { + App.main(null); + } +} diff --git a/spring-bom/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-bom/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6dee4b808e --- /dev/null +++ b/spring-bom/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,13 @@ +package org.baeldung; + +import org.junit.Test; + +import com.baeldung.spring.bom.HelloWorldApp; + +public class SpringContextIntegrationTest { + + @Test + public final void testMain() throws Exception { + HelloWorldApp.main(null); + } +} diff --git a/spring-boot-admin/spring-boot-admin-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-admin/spring-boot-admin-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..1f1fae17bc --- /dev/null +++ b/spring-boot-admin/spring-boot-admin-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.springbootadminclient.SpringBootAdminClientApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootAdminClientApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-admin/spring-boot-admin-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-admin/spring-boot-admin-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..4c151d97df --- /dev/null +++ b/spring-boot-admin/spring-boot-admin-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.springbootadminserver.SpringBootAdminServerApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootAdminServerApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-bootstrap/src/test/java/org/baeldung/SpringBootBootstrapApplicationIntegrationTest.java b/spring-boot-bootstrap/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 83% rename from spring-boot-bootstrap/src/test/java/org/baeldung/SpringBootBootstrapApplicationIntegrationTest.java rename to spring-boot-bootstrap/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 7c54288665..9ae417a546 100644 --- a/spring-boot-bootstrap/src/test/java/org/baeldung/SpringBootBootstrapApplicationIntegrationTest.java +++ b/spring-boot-bootstrap/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class SpringBootBootstrapApplicationIntegrationTest { +public class SpringContextIntegrationTest { @Test public void contextLoads() { From 59bd1c0f3418275ad5a52971702816b58bebeea4 Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Wed, 12 Sep 2018 17:28:47 -0400 Subject: [PATCH 03/56] BAEL-8939: Adding a Spring Context test in all Spring Modules (changes for around 23 more modules.. work in progress..) --- spring-boot-camel/pom.xml | 7 +++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++++ .../SpringContextIntegrationTest.java | 13 ++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../property-exp-custom-config/pom.xml | 8 ++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ spring-cloud/spring-cloud-consul/pom.xml | 8 ++++++++ .../SpringContextIntegrationTest.java | 20 +++++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ spring-cloud/spring-cloud-gateway/pom.xml | 5 +++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ 23 files changed, 349 insertions(+) create mode 100644 spring-boot-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-ctx-fluent/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-keycloak/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-property-exp/property-exp-custom-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-property-exp/property-exp-default-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-vue/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-archaius/basic-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-archaius/extra-configs/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-aws/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-connectors-heroku/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-consul/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-boot-camel/pom.xml b/spring-boot-camel/pom.xml index f04e8e34f7..4d7c8a002e 100644 --- a/spring-boot-camel/pom.xml +++ b/spring-boot-camel/pom.xml @@ -10,6 +10,7 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT + ../parent-boot-1 @@ -38,6 +39,12 @@ spring-boot-starter-web ${spring-boot-starter.version} + + org.springframework.boot + spring-boot-starter-test + ${spring-boot-starter.version} + test + diff --git a/spring-boot-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6eee0abf1e --- /dev/null +++ b/spring-boot-camel/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.camel.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..97debc5b63 --- /dev/null +++ b/spring-boot-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.boot.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-ctx-fluent/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-ctx-fluent/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..c9f7220ab9 --- /dev/null +++ b/spring-boot-ctx-fluent/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,13 @@ +package org.baeldung; + +import org.junit.Test; + +import com.baeldung.parent.App; + +public class SpringContextIntegrationTest { + + @Test + public final void testMain() throws Exception { + App.main(new String[] {}); + } +} diff --git a/spring-boot-keycloak/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-keycloak/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..7367568611 --- /dev/null +++ b/spring-boot-keycloak/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.keycloak.SpringBoot; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBoot.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..2d46b21ba5 --- /dev/null +++ b/spring-boot-logging-log4j2/spring-boot-logging-log4j2-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.springbootlogging.SpringBootLoggingApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootLoggingApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6ed93e8c44 --- /dev/null +++ b/spring-boot-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.springbootmvc.SpringBootMvcApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootMvcApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-property-exp/property-exp-custom-config/pom.xml b/spring-boot-property-exp/property-exp-custom-config/pom.xml index 958a07a86b..d433ab35c2 100644 --- a/spring-boot-property-exp/property-exp-custom-config/pom.xml +++ b/spring-boot-property-exp/property-exp-custom-config/pom.xml @@ -12,6 +12,7 @@ spring-boot-property-exp com.baeldung 0.0.1-SNAPSHOT + ../parent-boot-1 @@ -20,7 +21,14 @@ spring-boot-starter ${spring-boot.version} + + org.springframework.boot + spring-boot-starter-test + ${spring-boot.version} + test + + diff --git a/spring-boot-property-exp/property-exp-custom-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-property-exp/property-exp-custom-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6dd3419d39 --- /dev/null +++ b/spring-boot-property-exp/property-exp-custom-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.propertyexpansion.SpringBootPropertyExpansionApp; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootPropertyExpansionApp.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-property-exp/property-exp-default-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-property-exp/property-exp-default-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6dd3419d39 --- /dev/null +++ b/spring-boot-property-exp/property-exp-default-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.propertyexpansion.SpringBootPropertyExpansionApp; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootPropertyExpansionApp.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-vue/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-vue/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6ed93e8c44 --- /dev/null +++ b/spring-boot-vue/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.springbootmvc.SpringBootMvcApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootMvcApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..e5ebbce1aa --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/additional-sources-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.archaius.additionalsources.AdditionalSourcesSimpleApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = AdditionalSourcesSimpleApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..16542981e8 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/basic-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.archaius.basic.BasicArchaiusApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = BasicArchaiusApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-archaius/extra-configs/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-archaius/extra-configs/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..4c2531f490 --- /dev/null +++ b/spring-cloud/spring-cloud-archaius/extra-configs/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.archaius.extraconfigs.ExtraConfigsApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ExtraConfigsApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-aws/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-aws/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..fcba9c4132 --- /dev/null +++ b/spring-cloud/spring-cloud-aws/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.aws.InstanceProfileAwsApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = InstanceProfileAwsApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-connectors-heroku/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-connectors-heroku/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..a705f18bc6 --- /dev/null +++ b/spring-cloud/spring-cloud-connectors-heroku/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.connectors.heroku.ConnectorsHerokuApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ConnectorsHerokuApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-consul/pom.xml b/spring-cloud/spring-cloud-consul/pom.xml index 8181832bea..6db47593f5 100644 --- a/spring-cloud/spring-cloud-consul/pom.xml +++ b/spring-cloud/spring-cloud-consul/pom.xml @@ -11,6 +11,7 @@ com.baeldung.spring.cloud spring-cloud 1.0.0-SNAPSHOT + ../parent-boot-1 @@ -25,6 +26,13 @@ spring-cloud-starter-consul-config ${spring-cloud-starter-consul.version} + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-cloud/spring-cloud-consul/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-consul/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6290ccc03e --- /dev/null +++ b/spring-cloud/spring-cloud-consul/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,20 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.consul.discovery.DiscoveryClientApplication; +import com.baeldung.spring.cloud.consul.health.ServiceDiscoveryApplication; +import com.baeldung.spring.cloud.consul.properties.DistributedPropertiesApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = { DiscoveryClientApplication.class, ServiceDiscoveryApplication.class, + DistributedPropertiesApplication.class }) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..1c1192cc3f --- /dev/null +++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.springcloudcontractconsumer.SpringCloudContractConsumerApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringCloudContractConsumerApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..2b6703ae5c --- /dev/null +++ b/spring-cloud/spring-cloud-contract/spring-cloud-contract-producer/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.springcloudcontractproducer.SpringCloudContractProducerApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringCloudContractProducerApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-gateway/pom.xml b/spring-cloud/spring-cloud-gateway/pom.xml index 8babbff274..4d8b57d4cf 100644 --- a/spring-cloud/spring-cloud-gateway/pom.xml +++ b/spring-cloud/spring-cloud-gateway/pom.xml @@ -38,6 +38,11 @@ org.springframework.boot spring-boot-starter-webflux + + org.springframework.boot + spring-boot-starter-test + test + org.hibernate diff --git a/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..f2addf5c1a --- /dev/null +++ b/spring-cloud/spring-cloud-gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.GatewayApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = GatewayApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..70c5f46aa1 --- /dev/null +++ b/spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.stream.rabbit.MultipleOutputsServiceApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = MultipleOutputsServiceApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} From b051112a9c8f8dfcf9e64f950325553caa349020 Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Fri, 14 Sep 2018 17:13:23 -0400 Subject: [PATCH 04/56] BAEL-8939: Adding a Spring Context test in all Spring Modules (changes for around 22 more modules.. work in progress..) --- .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ ...java => SpringContextIntegrationTest.java} | 4 ++-- ...java => SpringContextIntegrationTest.java} | 4 ++-- ...java => SpringContextIntegrationTest.java} | 4 ++-- .../SpringContextIntegrationTest.java | 17 ++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++ ...java => SpringContextIntegrationTest.java} | 4 ++-- .../SpringContextIntegrationTest.java | 15 ++++++++++++ .../SpringContextIntegrationTest.java | 23 +++++++++++++++++++ .../spring-swagger-codegen-app/pom.xml | 6 +++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++ .../SpringContextIntegrationTest.java | 22 ++++++++++++++++++ .../SpringContextIntegrationTest.java | 18 +++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ 22 files changed, 307 insertions(+), 8 deletions(-) create mode 100644 spring-security-client/spring-security-thymeleaf-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-client/spring-security-thymeleaf-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-client/spring-security-thymeleaf-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/{test/AuthServerIntegrationTest.java => SpringContextIntegrationTest.java} (88%) rename spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/{test/UiIntegrationTest.java => SpringContextIntegrationTest.java} (88%) rename spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/{test/UiIntegrationTest.java => SpringContextIntegrationTest.java} (88%) create mode 100644 spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-session/spring-session-jdbc/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-session/spring-session-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-sleuth/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename spring-social-login/src/test/java/org/baeldung/{test/ApplicationIntegrationTest.java => SpringContextIntegrationTest.java} (87%) create mode 100644 spring-spel/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-state-machine/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-swagger-codegen/spring-swagger-codegen-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-thymeleaf/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-userservice/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-vertx/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-webflux-amqp/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-security-client/spring-security-thymeleaf-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-thymeleaf-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..66243ef00d --- /dev/null +++ b/spring-security-client/spring-security-thymeleaf-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.config.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-client/spring-security-thymeleaf-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-thymeleaf-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..66243ef00d --- /dev/null +++ b/spring-security-client/spring-security-thymeleaf-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.config.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-client/spring-security-thymeleaf-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-thymeleaf-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..66243ef00d --- /dev/null +++ b/spring-security-client/spring-security-thymeleaf-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.config.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/test/AuthServerIntegrationTest.java b/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 88% rename from spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/test/AuthServerIntegrationTest.java rename to spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 9e2d6feca1..66ee232b10 100644 --- a/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/test/AuthServerIntegrationTest.java +++ b/spring-security-sso/spring-security-sso-auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.test; +package org.baeldung; import org.baeldung.config.AuthorizationServerApplication; import org.junit.Test; @@ -9,7 +9,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = AuthorizationServerApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class AuthServerIntegrationTest { +public class SpringContextIntegrationTest { @Test public void whenLoadApplication_thenSuccess() { diff --git a/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/test/UiIntegrationTest.java b/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 88% rename from spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/test/UiIntegrationTest.java rename to spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 6386eac0b8..2fb0210929 100644 --- a/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/test/UiIntegrationTest.java +++ b/spring-security-sso/spring-security-sso-ui-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.test; +package org.baeldung; import org.baeldung.config.UiApplication; import org.junit.Test; @@ -9,7 +9,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = UiApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class UiIntegrationTest { +public class SpringContextIntegrationTest { @Test public void whenLoadApplication_thenSuccess() { diff --git a/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/test/UiIntegrationTest.java b/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 88% rename from spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/test/UiIntegrationTest.java rename to spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 6386eac0b8..2fb0210929 100644 --- a/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/test/UiIntegrationTest.java +++ b/spring-security-sso/spring-security-sso-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.test; +package org.baeldung; import org.baeldung.config.UiApplication; import org.junit.Test; @@ -9,7 +9,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = UiApplication.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class UiIntegrationTest { +public class SpringContextIntegrationTest { @Test public void whenLoadApplication_thenSuccess() { diff --git a/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..7ec6125f84 --- /dev/null +++ b/spring-security-x509/spring-security-x509-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.security.x509.X509AuthenticationServer; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = X509AuthenticationServer.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..7ec6125f84 --- /dev/null +++ b/spring-security-x509/spring-security-x509-client-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.security.x509.X509AuthenticationServer; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = X509AuthenticationServer.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-session/spring-session-jdbc/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-session/spring-session-jdbc/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..b921f76a0d --- /dev/null +++ b/spring-session/spring-session-jdbc/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.springsessionjdbc.SpringSessionJdbcApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringSessionJdbcApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-session/spring-session-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-session/spring-session-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..a62e728826 --- /dev/null +++ b/spring-session/spring-session-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.session.SessionWebApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SessionWebApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-sleuth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-sleuth/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..ef722ecba0 --- /dev/null +++ b/spring-sleuth/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.session.SleuthWebApp; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SleuthWebApp.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-social-login/src/test/java/org/baeldung/test/ApplicationIntegrationTest.java b/spring-social-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 87% rename from spring-social-login/src/test/java/org/baeldung/test/ApplicationIntegrationTest.java rename to spring-social-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 43aaea18b1..29ed401118 100644 --- a/spring-social-login/src/test/java/org/baeldung/test/ApplicationIntegrationTest.java +++ b/spring-social-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.test; +package org.baeldung; import org.baeldung.config.Application; import org.junit.Test; @@ -9,7 +9,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT) -public class ApplicationIntegrationTest { +public class SpringContextIntegrationTest { @Test public void whenLoadApplication_thenSuccess() { diff --git a/spring-spel/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-spel/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..f394374a94 --- /dev/null +++ b/spring-spel/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,15 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath:applicationContext.xml"}) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-state-machine/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-state-machine/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..72292a5089 --- /dev/null +++ b/spring-state-machine/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,23 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.spring.statemachine.config.ForkJoinStateMachineConfiguration; +import com.baeldung.spring.statemachine.config.HierarchicalStateMachineConfiguration; +import com.baeldung.spring.statemachine.config.JunctionStateMachineConfiguration; +import com.baeldung.spring.statemachine.config.SimpleEnumStateMachineConfiguration; +import com.baeldung.spring.statemachine.config.SimpleStateMachineConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { SimpleStateMachineConfiguration.class, SimpleEnumStateMachineConfiguration.class, + JunctionStateMachineConfiguration.class, HierarchicalStateMachineConfiguration.class, + ForkJoinStateMachineConfiguration.class }) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml index 281ed59857..4d97f9ded6 100644 --- a/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml +++ b/spring-swagger-codegen/spring-swagger-codegen-app/pom.xml @@ -24,6 +24,12 @@ spring-boot-starter-web ${spring.version} + + org.springframework.boot + spring-boot-starter-test + ${spring.version} + test + diff --git a/spring-swagger-codegen/spring-swagger-codegen-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-swagger-codegen/spring-swagger-codegen-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..2143dc7f4d --- /dev/null +++ b/spring-swagger-codegen/spring-swagger-codegen-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.petstore.app.PetStoreApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = PetStoreApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-thymeleaf/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-thymeleaf/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..c7a0b4fc60 --- /dev/null +++ b/spring-thymeleaf/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,22 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import com.baeldung.thymeleaf.config.InitSecurity; +import com.baeldung.thymeleaf.config.WebApp; +import com.baeldung.thymeleaf.config.WebMVCConfig; +import com.baeldung.thymeleaf.config.WebMVCSecurity; + +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextConfiguration(classes = { WebApp.class, WebMVCConfig.class, WebMVCSecurity.class, InitSecurity.class }) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-userservice/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-userservice/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..825b89eb10 --- /dev/null +++ b/spring-userservice/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.baeldung.custom.config.MvcConfig; +import org.baeldung.custom.config.PersistenceDerbyJPAConfig; +import org.baeldung.custom.config.SecSecurityConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = { MvcConfig.class, PersistenceDerbyJPAConfig.class, SecSecurityConfig.class }) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-vertx/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-vertx/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..b1f7b39f7e --- /dev/null +++ b/spring-vertx/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.vertxspring.VertxSpringApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = VertxSpringApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-webflux-amqp/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-webflux-amqp/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..35efff49c2 --- /dev/null +++ b/spring-webflux-amqp/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.spring.amqp.SpringWebfluxAmqpApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringWebfluxAmqpApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..623966373b --- /dev/null +++ b/spring-zuul/spring-zuul-foos-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.config.ResourceServerApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ResourceServerApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..a3d49627e5 --- /dev/null +++ b/spring-zuul/spring-zuul-ui/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.config.UiApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = UiApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} From 375c50e805f35c1cb851be89682112420e142841 Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Sat, 15 Sep 2018 13:57:53 -0400 Subject: [PATCH 05/56] BAEL-8939: Adding a Spring Context test in all Spring Modules (changes for around 21 more modules.. work in progress..) --- spring-rest-embedded-tomcat/pom.xml | 7 ++++++ .../SpringContextIntegrationTest.java | 18 ++++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 19 +++++++++++++++ .../SpringContextIntegrationTest.java | 20 ++++++++++++++++ .../SpringContextIntegrationTest.java | 15 ++++++++++++ .../SpringContextIntegrationTest.java | 22 +++++++++++++++++ .../pom.xml | 8 +++++++ .../SpringContextIntegrationTest.java | 20 ++++++++++++++++ spring-security-mvc-session/pom.xml | 8 +++++++ .../SpringContextIntegrationTest.java | 19 +++++++++++++++ spring-security-mvc-socket/pom.xml | 8 +++++++ .../SpringContextIntegrationTest.java | 24 +++++++++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 21 ++++++++++++++++ 25 files changed, 402 insertions(+) create mode 100644 spring-rest-embedded-tomcat/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-rest-full/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-rest-query-language/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-rest-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-resttemplate/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-acl/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-cache-control/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-client/spring-security-jsp-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-client/spring-security-jsp-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-client/spring-security-jsp-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-client/spring-security-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-core/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-mvc-session/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-openid/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-rest-embedded-tomcat/pom.xml b/spring-rest-embedded-tomcat/pom.xml index 9f6eb0d703..8ccd9645d3 100644 --- a/spring-rest-embedded-tomcat/pom.xml +++ b/spring-rest-embedded-tomcat/pom.xml @@ -58,6 +58,13 @@ httpcore ${httpcore.version} + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-rest-embedded-tomcat/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-embedded-tomcat/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..8b8ff1a322 --- /dev/null +++ b/spring-rest-embedded-tomcat/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.baeldung.embedded.configuration.UserConfiguration; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { UserConfiguration.class }) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-rest-full/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-full/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..35939c992f --- /dev/null +++ b/spring-rest-full/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.spring.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-rest-query-language/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-query-language/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..35939c992f --- /dev/null +++ b/spring-rest-query-language/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.spring.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-rest-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..66243ef00d --- /dev/null +++ b/spring-rest-simple/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.config.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-resttemplate/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-resttemplate/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..3a5a20cfeb --- /dev/null +++ b/spring-resttemplate/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.resttemplate.configuration.RestTemplateConfigurationApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = RestTemplateConfigurationApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-acl/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-acl/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..c7890d79ac --- /dev/null +++ b/spring-security-acl/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.acl.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-cache-control/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-cache-control/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..c047fc6210 --- /dev/null +++ b/spring-security-cache-control/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.cachecontrol.AppRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = AppRunner.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-client/spring-security-jsp-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-jsp-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..66243ef00d --- /dev/null +++ b/spring-security-client/spring-security-jsp-authentication/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.config.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-client/spring-security-jsp-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-jsp-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..66243ef00d --- /dev/null +++ b/spring-security-client/spring-security-jsp-authorize/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.config.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-client/spring-security-jsp-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-jsp-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..66243ef00d --- /dev/null +++ b/spring-security-client/spring-security-jsp-config/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.config.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-client/spring-security-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-client/spring-security-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..66243ef00d --- /dev/null +++ b/spring-security-client/spring-security-mvc/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.config.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-core/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-core/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..5698afa417 --- /dev/null +++ b/spring-security-core/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.app.App; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = App.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..9e74e83a53 --- /dev/null +++ b/spring-security-mvc-custom/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,19 @@ +package org.baeldung; + +import org.baeldung.spring.MvcConfig; +import org.baeldung.spring.SecSecurityConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { MvcConfig.class, SecSecurityConfig.class }) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..a4a85a8fa2 --- /dev/null +++ b/spring-security-mvc-digest-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,20 @@ +package org.baeldung; + +import org.baeldung.spring.ClientConfig; +import org.baeldung.spring.MvcConfig; +import org.baeldung.spring.SecSecurityConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { ClientConfig.class, MvcConfig.class, SecSecurityConfig.class }) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..0b701e9acf --- /dev/null +++ b/spring-security-mvc-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,15 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SampleLDAPApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..46bbc629c7 --- /dev/null +++ b/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,22 @@ +package org.baeldung; + +import org.baeldung.spring.ChannelSecSecurityConfig; +import org.baeldung.spring.MvcConfig; +import org.baeldung.spring.RedirectionSecurityConfig; +import org.baeldung.spring.SecSecurityConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { MvcConfig.class, ChannelSecSecurityConfig.class, RedirectionSecurityConfig.class, + SecSecurityConfig.class }) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-mvc-persisted-remember-me/pom.xml b/spring-security-mvc-persisted-remember-me/pom.xml index 2add895ecb..8b15e658e8 100644 --- a/spring-security-mvc-persisted-remember-me/pom.xml +++ b/spring-security-mvc-persisted-remember-me/pom.xml @@ -133,6 +133,14 @@ guava ${guava.version} + + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..f1df880862 --- /dev/null +++ b/spring-security-mvc-persisted-remember-me/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,20 @@ +package org.baeldung; + +import org.baeldung.spring.MvcConfig; +import org.baeldung.spring.PersistenceConfig; +import org.baeldung.spring.SecurityConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { MvcConfig.class, PersistenceConfig.class, SecurityConfig.class }) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-mvc-session/pom.xml b/spring-security-mvc-session/pom.xml index 7ffbd76aac..85c8475657 100644 --- a/spring-security-mvc-session/pom.xml +++ b/spring-security-mvc-session/pom.xml @@ -113,6 +113,14 @@ metrics-core ${codahale.metrics.version} + + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-security-mvc-session/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-session/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..9e74e83a53 --- /dev/null +++ b/spring-security-mvc-session/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,19 @@ +package org.baeldung; + +import org.baeldung.spring.MvcConfig; +import org.baeldung.spring.SecSecurityConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { MvcConfig.class, SecSecurityConfig.class }) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-mvc-socket/pom.xml b/spring-security-mvc-socket/pom.xml index b7559753b5..365a803705 100644 --- a/spring-security-mvc-socket/pom.xml +++ b/spring-security-mvc-socket/pom.xml @@ -148,6 +148,14 @@ jackson-annotations ${jackson.version} + + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..00202a98cb --- /dev/null +++ b/spring-security-mvc-socket/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,24 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import com.baeldung.springsecuredsockets.config.AppConfig; +import com.baeldung.springsecuredsockets.config.DataStoreConfig; +import com.baeldung.springsecuredsockets.config.SecurityConfig; +import com.baeldung.springsecuredsockets.config.SocketBrokerConfig; +import com.baeldung.springsecuredsockets.config.SocketSecurityConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { AppConfig.class, DataStoreConfig.class, SecurityConfig.class, + SocketBrokerConfig.class, SocketSecurityConfig.class }) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-openid/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-openid/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..79a725dcae --- /dev/null +++ b/spring-security-openid/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.config.SpringOpenidApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringOpenidApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..e56f5d5031 --- /dev/null +++ b/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,21 @@ +package org.baeldung; + +import org.baeldung.client.spring.ClientConfig; +import org.baeldung.spring.SecSecurityConfig; +import org.baeldung.spring.WebConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { ClientConfig.class, SecSecurityConfig.class, + WebConfig.class }, loader = AnnotationConfigContextLoader.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} From 889c52f1c276c6fa372a13ab1cae880b60733cd2 Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Sat, 15 Sep 2018 22:19:20 -0400 Subject: [PATCH 06/56] BAEL-8939: Adding a Spring Context test in all Spring Modules (changes for around 27 more modules.. work in progress..) --- .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 18 ++++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 18 ++++++++++++++ spring-freemarker/pom.xml | 7 ++++++ .../SpringContextIntegrationTest.java | 20 ++++++++++++++++ .../SpringContextIntegrationTest.java | 18 ++++++++++++++ .../SpringContextIntegrationTest.java | 21 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ spring-jersey/pom.xml | 8 +++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ spring-jms/pom.xml | 8 +++++++ .../SpringContextIntegrationTest.java | 15 ++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ spring-mvc-forms-jsp/pom.xml | 6 +++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 18 ++++++++++++++ .../SpringContextIntegrationTest.java | 20 ++++++++++++++++ spring-mvc-webflow/pom.xml | 8 +++++++ .../SpringContextIntegrationTest.java | 19 +++++++++++++++ spring-mvc-xml/pom.xml | 7 ++++++ .../SpringContextIntegrationTest.java | 19 +++++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 16 +++++++++++++ .../SpringContextIntegrationTest.java | 24 +++++++++++++++++++ 33 files changed, 523 insertions(+) create mode 100644 persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-ejb/spring-ejb-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-exceptions/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-freemarker/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-integration/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-jersey/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-jinq/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-jms/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-kafka/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-katharsis/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-mockito/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextIntegrationTest.java create mode 100644 spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextIntegrationTest.java create mode 100644 spring-mvc-java/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-mvc-velocity/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-mvc-webflow/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-mvc-xml/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-quartz/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-reactor/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-rest-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..a81a4eedb1 --- /dev/null +++ b/persistence-modules/spring-hibernate-3/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.baeldung.spring.PersistenceConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..af4618d0f3 --- /dev/null +++ b/persistence-modules/spring-hibernate-5/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.spring.PersistenceConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-ejb/spring-ejb-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-ejb/spring-ejb-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..4d2d83646d --- /dev/null +++ b/spring-ejb/spring-ejb-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.springejbclient.SpringEjbClientApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringEjbClientApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-exceptions/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-exceptions/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..492673b168 --- /dev/null +++ b/spring-exceptions/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.baeldung.spring.config.CoreConfig; +import org.baeldung.spring.config.MvcConfig; +import org.baeldung.spring.config.PersistenceConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { CoreConfig.class, MvcConfig.class, PersistenceConfig.class}) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-freemarker/pom.xml b/spring-freemarker/pom.xml index f0626195fd..4ff57e27f0 100644 --- a/spring-freemarker/pom.xml +++ b/spring-freemarker/pom.xml @@ -44,6 +44,13 @@ freemarker ${freemarker.version} + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-freemarker/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-freemarker/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..ab0e6e8f49 --- /dev/null +++ b/spring-freemarker/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,20 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import com.baeldung.freemarker.config.SpringWebConfig; +import com.baeldung.freemarker.config.WebConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { SpringWebConfig.class, WebConfiguration.class }) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..af4618d0f3 --- /dev/null +++ b/spring-hibernate4/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.spring.PersistenceConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { PersistenceConfig.class }, loader = AnnotationConfigContextLoader.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-integration/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-integration/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..92e80a0903 --- /dev/null +++ b/spring-integration/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,21 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.si.security.MessageConsumer; +import com.baeldung.si.security.SecuredDirectChannel; +import com.baeldung.si.security.SecurityConfig; +import com.baeldung.si.security.SecurityPubSubChannel; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { SecurityConfig.class, SecuredDirectChannel.class, SecurityPubSubChannel.class, + MessageConsumer.class }) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..8eb1589de7 --- /dev/null +++ b/spring-jenkins-pipeline/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.SpringJenkinsPipelineApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringJenkinsPipelineApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-jersey/pom.xml b/spring-jersey/pom.xml index 40dc91a88d..872835177d 100644 --- a/spring-jersey/pom.xml +++ b/spring-jersey/pom.xml @@ -118,6 +118,14 @@ 3.10.0 test + + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-jersey/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jersey/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..21f180854c --- /dev/null +++ b/spring-jersey/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.server.config.RestConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = RestConfig.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-jinq/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jinq/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..ccf774330f --- /dev/null +++ b/spring-jinq/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.jinq.JinqApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = JinqApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-jms/pom.xml b/spring-jms/pom.xml index 949a78b2a1..814875f77b 100644 --- a/spring-jms/pom.xml +++ b/spring-jms/pom.xml @@ -33,6 +33,14 @@ activemq-all ${activemq.version} + + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-jms/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-jms/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..e13809f571 --- /dev/null +++ b/spring-jms/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,15 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations = {"classpath:applicationContext.xml", "classpath:EmbeddedActiveMQ.xml"}) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-kafka/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-kafka/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..40bf86c76f --- /dev/null +++ b/spring-kafka/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.kafka.KafkaApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = KafkaApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-katharsis/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-katharsis/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..48081903b6 --- /dev/null +++ b/spring-katharsis/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..9c233e6562 --- /dev/null +++ b/spring-ldap/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.ldap.javaconfig.AppConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = AppConfig.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-mockito/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mockito/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..7ce9f70302 --- /dev/null +++ b/spring-mockito/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.MocksApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = MocksApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-mvc-forms-jsp/pom.xml b/spring-mvc-forms-jsp/pom.xml index 6c75c9299b..5536314086 100644 --- a/spring-mvc-forms-jsp/pom.xml +++ b/spring-mvc-forms-jsp/pom.xml @@ -63,6 +63,12 @@ jackson-databind ${jackson-databind.version} + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..ff07d04c30 --- /dev/null +++ b/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = ApplicationConfiguration.class) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextIntegrationTest.java b/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..da87a6830a --- /dev/null +++ b/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/listbindingexample/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung.listbindingexample; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.listbindingexample.ListBindingApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {ListBindingApplication.class}) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextIntegrationTest.java b/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..e6b0dbf98c --- /dev/null +++ b/spring-mvc-forms-thymeleaf/src/test/java/org/baeldung/sessionattrs/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung.sessionattrs; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.sessionattrs.SessionAttrsApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {SessionAttrsApplication.class}) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-mvc-java/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-java/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6174dac010 --- /dev/null +++ b/spring-mvc-java/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.app.Application; +import com.baeldung.rss.RssFeedApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {Application.class, RssFeedApplication.class}) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..3649332870 --- /dev/null +++ b/spring-mvc-velocity/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,20 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import com.baeldung.mvc.velocity.spring.config.WebConfig; +import com.baeldung.mvc.velocity.test.config.TestConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { TestConfig.class, WebConfig.class }) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-mvc-webflow/pom.xml b/spring-mvc-webflow/pom.xml index f7070efb94..e1a279a787 100644 --- a/spring-mvc-webflow/pom.xml +++ b/spring-mvc-webflow/pom.xml @@ -52,6 +52,14 @@ log4j-over-slf4j ${org.slf4j.version} + + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-mvc-webflow/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-webflow/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6f028c78d8 --- /dev/null +++ b/spring-mvc-webflow/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,19 @@ +package org.baeldung; + +import org.baeldung.spring.WebFlowConfig; +import org.baeldung.spring.WebMvcConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {WebFlowConfig.class, WebMvcConfig.class}) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-mvc-xml/pom.xml b/spring-mvc-xml/pom.xml index fd33c25241..7187b5c270 100644 --- a/spring-mvc-xml/pom.xml +++ b/spring-mvc-xml/pom.xml @@ -86,6 +86,13 @@ + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-mvc-xml/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-xml/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..ec34abd367 --- /dev/null +++ b/spring-mvc-xml/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,19 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import com.baeldung.spring.ClientWebConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = ClientWebConfig.class) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..615ebd5f4a --- /dev/null +++ b/spring-protobuf/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.protobuf.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-quartz/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-quartz/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..516cc587a7 --- /dev/null +++ b/spring-quartz/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.springquartz.SpringQuartzApp; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringQuartzApp.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-reactor/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-reactor/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..7f906bdbcd --- /dev/null +++ b/spring-reactor/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-rest-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..228d0019bd --- /dev/null +++ b/spring-rest-angular/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.web.main.Application; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..d99dacd331 --- /dev/null +++ b/spring-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,24 @@ +package org.baeldung; + +import org.baeldung.config.MainApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.custom.CustomApplication; +import com.baeldung.produceimage.ImageApplication; +import com.baeldung.propertyeditor.PropertyEditorApplication; +import com.baeldung.responseheaders.ResponseHeadersApplication; +import com.baeldung.web.log.app.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = { CustomApplication.class, ImageApplication.class, PropertyEditorApplication.class, + ResponseHeadersApplication.class, Application.class, com.baeldung.web.upload.app.Application.class, + MainApplication.class}) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} From dd273f664cb94113943b57230cba35cbba8c4d50 Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Sun, 16 Sep 2018 10:15:18 -0400 Subject: [PATCH 07/56] BAEL-8939: Adding a Spring Context test in all Spring Modules (changes for around 15 more modules.. work in progress..) --- .../SpringContextIntegrationTest.java | 16 +++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 20 +++++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ .../SpringContextIntegrationTest.java | 18 +++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ spring-dispatcher-servlet/pom.xml | 6 ++++++ .../SpringContextIntegrationTest.java | 19 ++++++++++++++++++ .../SpringContextIntegrationTest.java | 17 ++++++++++++++++ 14 files changed, 232 insertions(+) create mode 100644 persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 persistence-modules/spring-data-eclipselink/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 persistence-modules/spring-data-solr/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cucumber/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-data-couchbase-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-data-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-dispatcher-servlet/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-drools/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..c5d8de1cc0 --- /dev/null +++ b/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.spring.data.cassandra.config.CassandraConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = CassandraConfig.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..7f906bdbcd --- /dev/null +++ b/persistence-modules/spring-data-dynamodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/persistence-modules/spring-data-eclipselink/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-eclipselink/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..4be5891e3e --- /dev/null +++ b/persistence-modules/spring-data-eclipselink/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.eclipselink.springdata.EclipselinkSpringDataApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = EclipselinkSpringDataApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/persistence-modules/spring-data-solr/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-solr/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..e76967ae8a --- /dev/null +++ b/persistence-modules/spring-data-solr/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.spring.data.solr.config.SolrConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = SolrConfig.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cucumber/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cucumber/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..80efd86f13 --- /dev/null +++ b/spring-cucumber/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.SpringDemoApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringDemoApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-data-couchbase-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-couchbase-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..9c9d58dd0b --- /dev/null +++ b/spring-data-couchbase-2/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,20 @@ +package org.baeldung; + +import org.baeldung.spring.data.couchbase2b.MultiBucketCouchbaseConfig; +import org.baeldung.spring.data.couchbase2b.MultiBucketIntegrationTestConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { MultiBucketCouchbaseConfig.class, MultiBucketIntegrationTestConfig.class }) +@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class }) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6f45039c96 --- /dev/null +++ b/spring-data-elasticsearch/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.spring.data.es.config.Config; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = Config.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..7f906bdbcd --- /dev/null +++ b/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..d28bdcbc89 --- /dev/null +++ b/spring-data-keyvalue/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.data.keyvalue.SpringDataKeyValueApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringDataKeyValueApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..04d549a288 --- /dev/null +++ b/spring-data-mongodb/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.config.MongoConfig; +import com.baeldung.config.SimpleMongoConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { MongoConfig.class, SimpleMongoConfig.class }) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-data-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..0380e3dc2f --- /dev/null +++ b/spring-data-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.SpringDataRestApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringDataRestApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-dispatcher-servlet/pom.xml b/spring-dispatcher-servlet/pom.xml index 4e4346e43b..7ac291740e 100644 --- a/spring-dispatcher-servlet/pom.xml +++ b/spring-dispatcher-servlet/pom.xml @@ -61,6 +61,12 @@ commons-fileupload ${commons-fileupload.version} + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-dispatcher-servlet/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-dispatcher-servlet/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..8a9d3421c2 --- /dev/null +++ b/spring-dispatcher-servlet/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,19 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import com.baeldung.springdispatcherservlet.configuration.AppConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = AppConfig.class) +@WebAppConfiguration +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-drools/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-drools/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..68325682e5 --- /dev/null +++ b/spring-drools/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.spring.drools.service.TaxiFareConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = TaxiFareConfiguration.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} From b96244d685861185c3a02bf34cb3c8f20bf7998a Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Sun, 16 Sep 2018 13:53:36 -0400 Subject: [PATCH 08/56] BAEL-8939: Adding a Spring Context test in all Spring Modules (changes for around 9 more modules.. work in progress..) --- .../SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../SpringContextIntegrationTest.java | 19 +++++++++++++++++++ .../greeter-spring-boot-autoconfigure/pom.xml | 7 +++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++++++ 10 files changed, 162 insertions(+) create mode 100644 spring-boot-angular-ecommerce/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-autoconfiguration/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-custom-starter/greeter-spring-boot-sample-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-h2/spring-boot-h2-database/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-h2/spring-boot-h2-remote-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-boot-jasypt/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-data-rest-querydsl/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-mobile/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-boot-angular-ecommerce/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-angular-ecommerce/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..2fb930b63f --- /dev/null +++ b/spring-boot-angular-ecommerce/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.ecommerce.EcommerceApplicationIntegrationTest; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = EcommerceApplicationIntegrationTest.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-autoconfiguration/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-autoconfiguration/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..136ea2481f --- /dev/null +++ b/spring-boot-autoconfiguration/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,19 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.autoconfiguration.example.AutoconfigurationApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = AutoconfigurationApplication.class) +@EnableJpaRepositories(basePackages = { "com.baeldung.autoconfiguration.example" }) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml index 9c2d85da86..5862bdd6c8 100644 --- a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml +++ b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/pom.xml @@ -40,6 +40,13 @@ ${greeter.version} true + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + diff --git a/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..9c8d825ea4 --- /dev/null +++ b/spring-boot-custom-starter/greeter-spring-boot-autoconfigure/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.greeter.autoconfigure.GreeterAutoConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = GreeterAutoConfiguration.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..23f285238b --- /dev/null +++ b/spring-boot-custom-starter/greeter-spring-boot-sample-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.greeter.sample.GreeterSampleApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = GreeterSampleApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-h2/spring-boot-h2-database/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-h2/spring-boot-h2-database/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..eb33198ac1 --- /dev/null +++ b/spring-boot-h2/spring-boot-h2-database/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.h2db.demo.SpringBootApp; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootApp.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-h2/spring-boot-h2-remote-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-h2/spring-boot-h2-remote-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..f48199d4e8 --- /dev/null +++ b/spring-boot-h2/spring-boot-h2-remote-app/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.h2db.demo.ClientSpringBootApp; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ClientSpringBootApp.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-jasypt/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-jasypt/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..dce3819a26 --- /dev/null +++ b/spring-boot-jasypt/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.jasypt.Main; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Main.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-data-rest-querydsl/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-rest-querydsl/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..7f906bdbcd --- /dev/null +++ b/spring-data-rest-querydsl/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-mobile/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mobile/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..7f906bdbcd --- /dev/null +++ b/spring-mobile/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} From 60d09f21d9b52e44d69cb4cc84414731e078770a Mon Sep 17 00:00:00 2001 From: Corneil du Plessis Date: Sun, 16 Sep 2018 19:54:41 +0200 Subject: [PATCH 09/56] BAEL-2103: Added configuration for Deploying to Google Cloud Platform App Engine. --- spring-boot-bootstrap/pom.xml | 41 +++++++++++++++++-- .../src/main/appengine/app.yaml | 19 +++++++++ .../main/resources/application-gcp.properties | 3 ++ .../src/main/resources/application.properties | 3 +- .../src/main/resources/logback-gcp.xml | 12 ++++++ .../spring-cloud-bootstrap.properties | 1 + 6 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 spring-boot-bootstrap/src/main/appengine/app.yaml create mode 100644 spring-boot-bootstrap/src/main/resources/application-gcp.properties create mode 100644 spring-boot-bootstrap/src/main/resources/logback-gcp.xml create mode 100644 spring-boot-bootstrap/src/main/resources/spring-cloud-bootstrap.properties diff --git a/spring-boot-bootstrap/pom.xml b/spring-boot-bootstrap/pom.xml index c1ce4df6e2..b5bcc587b1 100644 --- a/spring-boot-bootstrap/pom.xml +++ b/spring-boot-bootstrap/pom.xml @@ -78,6 +78,43 @@ + + cloud-gcp + + + org.springframework.cloud + spring-cloud-gcp-starter + 1.0.0.RELEASE + + + org.springframework.cloud + spring-cloud-gcp-starter-sql-mysql + 1.0.0.RELEASE + + + + ${project.name}-gcp + + + src/main/resources + + **/logback.xml + + + + + + com.google.cloud.tools + appengine-maven-plugin + 1.3.2 + + + org.springframework.boot + spring-boot-maven-plugin + + + + cloudfoundry @@ -91,6 +128,7 @@ + ${project.name}-cf src/main/resources @@ -103,9 +141,6 @@ org.springframework.boot spring-boot-maven-plugin - - ${project.name}-cf - org.apache.maven.plugins diff --git a/spring-boot-bootstrap/src/main/appengine/app.yaml b/spring-boot-bootstrap/src/main/appengine/app.yaml new file mode 100644 index 0000000000..a65ec6533a --- /dev/null +++ b/spring-boot-bootstrap/src/main/appengine/app.yaml @@ -0,0 +1,19 @@ +runtime: java +env: flex +runtime_config: + jdk: openjdk8 +env_variables: + SPRING_PROFILES_ACTIVE: "gcp,mysql" +handlers: +- url: /.* + script: this field is required, but ignored +resources: + cpu: 2 + memory_gb: 2 + disk_size_gb: 10 + volumes: + - name: ramdisk1 + volume_type: tmpfs + size_gb: 0.5 +manual_scaling: + instances: 1 diff --git a/spring-boot-bootstrap/src/main/resources/application-gcp.properties b/spring-boot-bootstrap/src/main/resources/application-gcp.properties new file mode 100644 index 0000000000..3dd11eeb8c --- /dev/null +++ b/spring-boot-bootstrap/src/main/resources/application-gcp.properties @@ -0,0 +1,3 @@ +spring.cloud.gcp.sql.instance-connection-name=baeldung-spring-boot-bootstrap:europe-west2:baeldung-spring-boot-bootstrap-db +spring.cloud.gcp.sql.database-name=baeldung_bootstrap_db +spring.cloud.gcp.logging.enabled=true \ No newline at end of file diff --git a/spring-boot-bootstrap/src/main/resources/application.properties b/spring-boot-bootstrap/src/main/resources/application.properties index eee89ca460..d83166d843 100644 --- a/spring-boot-bootstrap/src/main/resources/application.properties +++ b/spring-boot-bootstrap/src/main/resources/application.properties @@ -8,4 +8,5 @@ spring.thymeleaf.suffix=.html server.error.path=/error server.error.whitelabel.enabled=false -spring.jpa.generate-ddl=true \ No newline at end of file +spring.jpa.generate-ddl=true +spring.jpa.hibernate.ddl-auto=update \ No newline at end of file diff --git a/spring-boot-bootstrap/src/main/resources/logback-gcp.xml b/spring-boot-bootstrap/src/main/resources/logback-gcp.xml new file mode 100644 index 0000000000..9a9c1c633d --- /dev/null +++ b/spring-boot-bootstrap/src/main/resources/logback-gcp.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-boot-bootstrap/src/main/resources/spring-cloud-bootstrap.properties b/spring-boot-bootstrap/src/main/resources/spring-cloud-bootstrap.properties new file mode 100644 index 0000000000..6ba0b5ffcc --- /dev/null +++ b/spring-boot-bootstrap/src/main/resources/spring-cloud-bootstrap.properties @@ -0,0 +1 @@ +spring.cloud.appId=baeldung-spring-boot-bootstrap From 474bd359766a4b0ca951788a61ffc431b229e13b Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Mon, 17 Sep 2018 23:02:39 -0400 Subject: [PATCH 10/56] BAEL-8939: Adding a Spring Context test in all Spring Modules (changes for around 29 more modules.. work in progress..) --- .../baeldung/SpringContextIntegrationTest.java} | 8 +++++--- .../baeldung/SpringContextIntegrationTest.java} | 8 +++++--- ...grationTest.java => SpringContextIntegrationTest.java} | 7 ++++--- .../java/org/baeldung/SpringContextIntegrationTest.java} | 7 ++++--- .../java/org/baeldung/SpringContextIntegrationTest.java} | 7 ++++--- ...grationTest.java => SpringContextIntegrationTest.java} | 7 ++++--- .../baeldung/SpringContextIntegrationTest.java} | 6 ++++-- spring-security-react/pom.xml | 8 ++++++++ 8 files changed, 38 insertions(+), 20 deletions(-) rename spring-cloud-bus/spring-cloud-config-client/src/test/java/{com/baeldung/SpringCloudConfigClientLiveTest.java => org/baeldung/SpringContextIntegrationTest.java} (56%) rename spring-cloud-bus/spring-cloud-config-server/src/test/java/{com/baeldung/SpringCloudConfigServerApplicationTests.java => org/baeldung/SpringContextIntegrationTest.java} (56%) rename spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/{spring/cloud/DataFlowShellApplicationIntegrationTest.java => SpringContextIntegrationTest.java} (58%) rename spring-cloud-data-flow/{time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationIntegrationTest.java => log-sink/src/test/java/org/baeldung/SpringContextIntegrationTest.java} (60%) rename spring-cloud-data-flow/{log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationIntegrationTest.java => time-processor/src/test/java/org/baeldung/SpringContextIntegrationTest.java} (58%) rename spring-cloud-data-flow/time-source/src/test/java/org/baeldung/{spring/cloud/TimeSourceApplicationIntegrationTest.java => SpringContextIntegrationTest.java} (59%) rename spring-cloud/spring-cloud-config/client/src/test/java/{com/baeldung/spring/cloud/config/client/ConfigClientLiveTest.java => org/baeldung/SpringContextIntegrationTest.java} (76%) diff --git a/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java b/spring-cloud-bus/spring-cloud-config-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 56% rename from spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java rename to spring-cloud-bus/spring-cloud-config-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 364368713a..c0298daeb1 100644 --- a/spring-cloud-bus/spring-cloud-config-client/src/test/java/com/baeldung/SpringCloudConfigClientLiveTest.java +++ b/spring-cloud-bus/spring-cloud-config-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,13 +1,15 @@ -package com.baeldung; +package org.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import com.baeldung.SpringCloudConfigClientApplication; + @RunWith(SpringRunner.class) -@SpringBootTest -public class SpringCloudConfigClientLiveTest { +@SpringBootTest(classes = SpringCloudConfigClientApplication.class) +public class SpringContextIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationTests.java b/spring-cloud-bus/spring-cloud-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 56% rename from spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationTests.java rename to spring-cloud-bus/spring-cloud-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 3969c7ba2d..c43bb9f067 100644 --- a/spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationTests.java +++ b/spring-cloud-bus/spring-cloud-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,13 +1,15 @@ -package com.baeldung; +package org.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import com.baeldung.SpringCloudConfigServerApplication; + @RunWith(SpringRunner.class) -@SpringBootTest -public class SpringCloudConfigServerApplicationTests { +@SpringBootTest(classes = SpringCloudConfigServerApplication.class) +public class SpringContextIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationIntegrationTest.java b/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 58% rename from spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationIntegrationTest.java rename to spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 5ab3292388..28dbc9a8d8 100644 --- a/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/spring/cloud/DataFlowShellApplicationIntegrationTest.java +++ b/spring-cloud-data-flow/data-flow-shell/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,13 +1,14 @@ -package org.baeldung.spring.cloud; +package org.baeldung; +import org.baeldung.spring.cloud.DataFlowShellApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@SpringBootTest -public class DataFlowShellApplicationIntegrationTest { +@SpringBootTest(classes = DataFlowShellApplication.class) +public class SpringContextIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationIntegrationTest.java b/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 60% rename from spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationIntegrationTest.java rename to spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 9bd0fd8c24..8dc814ddce 100644 --- a/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/spring/cloud/TimeProcessorApplicationIntegrationTest.java +++ b/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,13 +1,14 @@ -package org.baeldung.spring.cloud; +package org.baeldung; +import org.baeldung.spring.cloud.LogSinkApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@SpringBootTest -public class TimeProcessorApplicationIntegrationTest { +@SpringBootTest(classes = LogSinkApplication.class) +public class SpringContextIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationIntegrationTest.java b/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 58% rename from spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationIntegrationTest.java rename to spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/SpringContextIntegrationTest.java index b362d72705..dcfeafa2bb 100644 --- a/spring-cloud-data-flow/log-sink/src/test/java/org/baeldung/spring/cloud/LogSinkApplicationIntegrationTest.java +++ b/spring-cloud-data-flow/time-processor/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,13 +1,14 @@ -package org.baeldung.spring.cloud; +package org.baeldung; +import org.baeldung.spring.cloud.TimeProcessorApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@SpringBootTest -public class LogSinkApplicationIntegrationTest { +@SpringBootTest(classes = TimeProcessorApplication.class) +public class SpringContextIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationIntegrationTest.java b/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 59% rename from spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationIntegrationTest.java rename to spring-cloud-data-flow/time-source/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 6d71a785a3..2c402824f0 100644 --- a/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/spring/cloud/TimeSourceApplicationIntegrationTest.java +++ b/spring-cloud-data-flow/time-source/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,13 +1,14 @@ -package org.baeldung.spring.cloud; +package org.baeldung; +import org.baeldung.spring.cloud.TimeSourceApplication; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@SpringBootTest -public class TimeSourceApplicationIntegrationTest { +@SpringBootTest(classes = TimeSourceApplication.class) +public class SpringContextIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientLiveTest.java b/spring-cloud/spring-cloud-config/client/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 76% rename from spring-cloud/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientLiveTest.java rename to spring-cloud/spring-cloud-config/client/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 9bca369c64..d727772cf9 100644 --- a/spring-cloud/spring-cloud-config/client/src/test/java/com/baeldung/spring/cloud/config/client/ConfigClientLiveTest.java +++ b/spring-cloud/spring-cloud-config/client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,4 +1,4 @@ -package com.baeldung.spring.cloud.config.client; +package org.baeldung; import org.junit.Test; import org.junit.runner.RunWith; @@ -6,10 +6,12 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; +import com.baeldung.spring.cloud.config.client.ConfigClient; + @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(classes = ConfigClient.class) @WebAppConfiguration -public class ConfigClientLiveTest { +public class SpringContextIntegrationTest { @Test public void contextLoads() { } diff --git a/spring-security-react/pom.xml b/spring-security-react/pom.xml index 11ad679128..32817945be 100644 --- a/spring-security-react/pom.xml +++ b/spring-security-react/pom.xml @@ -82,6 +82,14 @@ ${jstl.version} runtime + + + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + From 84af2d6d829c47eda437b490b5657aa15acb1a0d Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Tue, 18 Sep 2018 22:57:03 -0400 Subject: [PATCH 11/56] BAEL-8939: Adding a Spring Context test in all Spring Modules (changes for around 38 more modules) --- .../SpringContextIntegrationTest.java | 16 ++++++++++++ .../SpringContextIntegrationTest.java | 16 ++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 18 +++++++++++++ .../spring-cloud-eureka-client/pom.xml | 18 +++++++++++++ .../feign-rest-consumer/pom.xml | 11 ++++---- .../SpringContextIntegrationTest.java} | 8 +++--- .../SpringContextIntegrationTest.java} | 8 +++--- .../SpringContextIntegrationTest.java | 15 +++++++++++ ...java => SpringContextIntegrationTest.java} | 4 +-- .../SpringContextIntegrationTest.java | 15 +++++++++++ .../SpringContextIntegrationTest.java | 15 +++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java} | 4 +-- .../SpringContextIntegrationTest.java | 18 +++++++++++++ .../SpringContextIntegrationTest.java} | 8 +++--- .../SpringContextIntegrationTest.java | 20 +++++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 25 +++++++++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 18 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 17 +++++++++++++ .../SpringContextIntegrationTest.java | 20 +++++++++++++++ .../SpringContextIntegrationTest.java | 16 ++++++++++++ 40 files changed, 611 insertions(+), 19 deletions(-) create mode 100644 spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-bootstrap/config/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-bootstrap/discovery/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-bootstrap/discovery/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-book/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-bootstrap/svc-rating/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-bootstrap/zipkin/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-config/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/{com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationIntegrationTest.java => org/baeldung/SpringContextIntegrationTest.java} (54%) rename spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/{com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationIntegrationTest.java => org/baeldung/SpringContextIntegrationTest.java} (54%) create mode 100644 spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/{SpringCloudRestConfigIntegrationTest.java => SpringContextIntegrationTest.java} (72%) create mode 100644 spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-ribbon-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename spring-cloud/spring-cloud-security/auth-client/src/test/java/{com/example/springoath2/Springoath2ApplicationTests.java => org/baeldung/SpringContextIntegrationTest.java} (81%) create mode 100644 spring-cloud/spring-cloud-security/auth-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java rename spring-cloud/spring-cloud-security/{auth-resource/src/test/java/com/baeldung/service/personservice/PersonserviceApplicationTests.java => auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java} (64%) create mode 100644 spring-cloud/spring-cloud-stream-starters/twitterhdfs/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-cloud/spring-cloud-zookeeper/Greeting/src/test/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-custom-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-remoting/remoting-amqp/remoting-amqp-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-remoting/remoting-http/remoting-http-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-remoting/remoting-jms/remoting-jms-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-remoting/remoting-rmi/remoting-rmi-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-angular/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-react/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-security-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 spring-vault/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..35b231b5d8 --- /dev/null +++ b/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.spring.cloud.BatchJobApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = BatchJobApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..eb2a5c54ef --- /dev/null +++ b/spring-cloud-data-flow/data-flow-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.spring.cloud.DataFlowServerApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = DataFlowServerApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/config/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-bootstrap/config/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6016788eab --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/config/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.bootstrap.config.ConfigApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ConfigApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-bootstrap/discovery/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..6016788eab --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/discovery/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.bootstrap.config.ConfigApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ConfigApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/discovery/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-bootstrap/discovery/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..1e2db33395 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/discovery/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.bootstrap.discovery.DiscoveryApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = DiscoveryApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..ef3bb5ef95 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/gateway/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.bootstrap.gateway.GatewayApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = GatewayApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/svc-book/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-bootstrap/svc-book/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..0ffc2410e3 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-book/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.bootstrap.svcbook.BookServiceApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = BookServiceApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/svc-rating/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..3589666f17 --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/svc-rating/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.bootstrap.svcrating.RatingServiceApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = RatingServiceApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-bootstrap/zipkin/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-bootstrap/zipkin/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..4403d9e93b --- /dev/null +++ b/spring-cloud/spring-cloud-bootstrap/zipkin/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.bootstrap.zipkin.ZipkinApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ZipkinApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-config/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-config/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..cd30392d4f --- /dev/null +++ b/spring-cloud/spring-cloud-config/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import com.baeldung.spring.cloud.config.server.ConfigServer; + +@RunWith(SpringJUnit4ClassRunner.class) +@SpringBootTest(classes = ConfigServer.class) +@WebAppConfiguration +public class SpringContextIntegrationTest { + @Test + public void contextLoads() { + } +} diff --git a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml index c7822d51ee..8bc51adcab 100644 --- a/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml +++ b/spring-cloud/spring-cloud-eureka/spring-cloud-eureka-client/pom.xml @@ -28,6 +28,24 @@ spring-boot-starter-web ${spring-boot-starter-web.version} + + org.springframework.boot + spring-boot-starter-test + 1.5.10.RELEASE + test + + + org.springframework.boot + spring-boot-test + 1.5.10.RELEASE + test + + + org.springframework + spring-test + 4.0.5.RELEASE + test + diff --git a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml index ce1e1856ed..11b9275b46 100644 --- a/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml +++ b/spring-cloud/spring-cloud-hystrix/feign-rest-consumer/pom.xml @@ -24,33 +24,32 @@ org.springframework.cloud spring-cloud-starter-hystrix - ${spring-cloud-starter-hystrix.version} org.springframework.cloud spring-cloud-starter-hystrix-dashboard - ${spring-cloud-starter-hystrix.version} org.springframework.cloud spring-cloud-starter-feign - ${spring-cloud-starter-feign.version} org.springframework.boot spring-boot-starter-web - ${spring-boot-starter-web.version} org.springframework.boot spring-boot-starter-thymeleaf - ${spring-boot-starter-web.version} org.springframework.boot spring-boot-starter-actuator - ${spring-boot-starter-web.version} + + org.springframework.boot + spring-boot-starter-test + test + diff --git a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationIntegrationTest.java b/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 54% rename from spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationIntegrationTest.java rename to spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 2440b97aaf..ce57cf5052 100644 --- a/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/com/baeldung/spring/cloud/kubernetes/backend/KubernetesBackendApplicationIntegrationTest.java +++ b/spring-cloud/spring-cloud-kubernetes/demo-backend/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,13 +1,15 @@ -package com.baeldung.spring.cloud.kubernetes.backend; +package org.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import com.baeldung.spring.cloud.kubernetes.backend.KubernetesBackendApplication; + @RunWith(SpringRunner.class) -@SpringBootTest -public class KubernetesBackendApplicationIntegrationTest { +@SpringBootTest(classes = KubernetesBackendApplication.class) +public class SpringContextIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationIntegrationTest.java b/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 54% rename from spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationIntegrationTest.java rename to spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 19ad9676cb..f7e9e35540 100644 --- a/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/com/baeldung/spring/cloud/kubernetes/frontend/KubernetesFrontendApplicationIntegrationTest.java +++ b/spring-cloud/spring-cloud-kubernetes/demo-frontend/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,13 +1,15 @@ -package com.baeldung.spring.cloud.kubernetes.frontend; +package org.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import com.baeldung.spring.cloud.kubernetes.frontend.KubernetesFrontendApplication; + @RunWith(SpringRunner.class) -@SpringBootTest -public class KubernetesFrontendApplicationIntegrationTest { +@SpringBootTest(classes = KubernetesFrontendApplication.class) +public class SpringContextIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..24e758ff82 --- /dev/null +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-books-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,15 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = BooksApiApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringCloudRestConfigIntegrationTest.java b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 72% rename from spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringCloudRestConfigIntegrationTest.java rename to spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 8cc30a32ab..28c6e67377 100644 --- a/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringCloudRestConfigIntegrationTest.java +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -6,8 +6,8 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@SpringBootTest -public class SpringCloudRestConfigIntegrationTest { +@SpringBootTest(classes = SpringCloudRestConfigApplication.class) +public class SpringContextIntegrationTest { @Test public void contextLoads() { } diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..e22359a016 --- /dev/null +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-discovery-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,15 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringCloudRestServerApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..07d7db0505 --- /dev/null +++ b/spring-cloud/spring-cloud-rest/spring-cloud-rest-reviews-api/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,15 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = BookReviewsApiApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-ribbon-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-ribbon-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..baa1b12eff --- /dev/null +++ b/spring-cloud/spring-cloud-ribbon-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.ribbon.client.ServerLocationApp; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = ServerLocationApp.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-security/auth-client/src/test/java/com/example/springoath2/Springoath2ApplicationTests.java b/spring-cloud/spring-cloud-security/auth-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 81% rename from spring-cloud/spring-cloud-security/auth-client/src/test/java/com/example/springoath2/Springoath2ApplicationTests.java rename to spring-cloud/spring-cloud-security/auth-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java index ca89575ee0..60a208d6f4 100644 --- a/spring-cloud/spring-cloud-security/auth-client/src/test/java/com/example/springoath2/Springoath2ApplicationTests.java +++ b/spring-cloud/spring-cloud-security/auth-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,4 +1,4 @@ -package com.example.springoath2; +package org.baeldung; import org.junit.Test; import org.junit.runner.RunWith; @@ -9,7 +9,7 @@ import com.baeldung.CloudSite; @RunWith(SpringRunner.class) @SpringBootTest(classes = CloudSite.class) -public class Springoath2ApplicationTests { +public class SpringContextIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud/spring-cloud-security/auth-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-security/auth-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..4d4c312bce --- /dev/null +++ b/spring-cloud/spring-cloud-security/auth-resource/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.Application; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class) +public class SpringContextIntegrationTest { + + @Test + public void contextLoads() { + } + +} diff --git a/spring-cloud/spring-cloud-security/auth-resource/src/test/java/com/baeldung/service/personservice/PersonserviceApplicationTests.java b/spring-cloud/spring-cloud-security/auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java similarity index 64% rename from spring-cloud/spring-cloud-security/auth-resource/src/test/java/com/baeldung/service/personservice/PersonserviceApplicationTests.java rename to spring-cloud/spring-cloud-security/auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java index e0fe7006d9..63a89ac45c 100644 --- a/spring-cloud/spring-cloud-security/auth-resource/src/test/java/com/baeldung/service/personservice/PersonserviceApplicationTests.java +++ b/spring-cloud/spring-cloud-security/auth-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,13 +1,15 @@ -package com.baeldung.service.personservice; +package org.baeldung; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; +import com.baeldung.AuthServer; + @RunWith(SpringRunner.class) -@SpringBootTest -public class PersonserviceApplicationTests { +@SpringBootTest(classes = AuthServer.class) +public class SpringContextIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..3d370e7b48 --- /dev/null +++ b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,20 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.twitterhdfs.aggregate.AggregateApp; +import com.baeldung.twitterhdfs.processor.ProcessorApp; +import com.baeldung.twitterhdfs.sink.SinkApp; +import com.baeldung.twitterhdfs.source.SourceApp; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = {AggregateApp.class, ProcessorApp.class, SinkApp.class, SourceApp.class}) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..4b5aff2db8 --- /dev/null +++ b/spring-cloud/spring-cloud-task/springcloudtaskbatch/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.task.JobConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = JobConfiguration.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..b8dd03d65f --- /dev/null +++ b/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.SpringCloudTaskFinal.SpringCloudTaskSinkApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringCloudTaskSinkApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-cloud/spring-cloud-zookeeper/Greeting/src/test/baeldung/SpringContextIntegrationTest.java b/spring-cloud/spring-cloud-zookeeper/Greeting/src/test/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..0f544b3ed1 --- /dev/null +++ b/spring-cloud/spring-cloud-zookeeper/Greeting/src/test/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.spring.cloud.ribbon.client.ServerLocationApp; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = GreetingApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-custom-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-custom-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..0384c67e26 --- /dev/null +++ b/spring-custom-aop/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,25 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.annotation.servletcomponentscan.SpringBootAnnotatedApp; +import com.baeldung.annotation.servletcomponentscan.SpringBootPlainApp; +import com.baeldung.git.CommitIdApplication; +import com.baeldung.internationalization.InternationalizationApp; +import com.baeldung.intro.App; +import com.baeldung.servlets.ApplicationMain; +import com.baeldung.webjar.WebjarsdemoApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = { SpringBootAnnotatedApp.class, SpringBootPlainApp.class, CommitIdApplication.class, + InternationalizationApp.class, App.class, ApplicationMain.class, Application.class, + WebjarsdemoApplication.class }) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-remoting/remoting-amqp/remoting-amqp-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-amqp/remoting-amqp-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..2de3ed94d1 --- /dev/null +++ b/spring-remoting/remoting-amqp/remoting-amqp-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.client.AmqpClient; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = AmqpClient.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..5dc6d1df75 --- /dev/null +++ b/spring-remoting/remoting-amqp/remoting-amqp-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.server.AmqpServer; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = AmqpServer.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..1aec444aa0 --- /dev/null +++ b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.client.BurlapClient; +import com.baeldung.client.HessianClient; + +@SpringBootTest(classes = {BurlapClient.class, HessianClient.class}) +@RunWith(SpringRunner.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..f1aad1f601 --- /dev/null +++ b/spring-remoting/remoting-hessian-burlap/remoting-hessian-burlap-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.server.Server; + +@SpringBootTest(classes = Server.class) +@RunWith(SpringRunner.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-remoting/remoting-http/remoting-http-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-http/remoting-http-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..f1aad1f601 --- /dev/null +++ b/spring-remoting/remoting-http/remoting-http-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.server.Server; + +@SpringBootTest(classes = Server.class) +@RunWith(SpringRunner.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-remoting/remoting-jms/remoting-jms-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-jms/remoting-jms-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..a94e639dc8 --- /dev/null +++ b/spring-remoting/remoting-jms/remoting-jms-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.client.JmsClient; + +@SpringBootTest(classes = JmsClient.class) +@RunWith(SpringRunner.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..5c9cc5f872 --- /dev/null +++ b/spring-remoting/remoting-jms/remoting-jms-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.server.JmsServer; + +@SpringBootTest(classes = JmsServer.class) +@RunWith(SpringRunner.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..3460792fc6 --- /dev/null +++ b/spring-remoting/remoting-rmi/remoting-rmi-client/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.client.RmiClient; + +@SpringBootTest(classes = RmiClient.class) +@RunWith(SpringRunner.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-remoting/remoting-rmi/remoting-rmi-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-remoting/remoting-rmi/remoting-rmi-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..2063dd5e6e --- /dev/null +++ b/spring-remoting/remoting-rmi/remoting-rmi-server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.server.RmiServer; + +@SpringBootTest(classes = RmiServer.class) +@RunWith(SpringRunner.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-angular/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-angular/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..8c62ac5e91 --- /dev/null +++ b/spring-security-angular/server/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import com.baeldung.springbootsecurityrest.basicauth.SpringBootSecurityApplication; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringBootSecurityApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-react/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-react/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..a921976fc3 --- /dev/null +++ b/spring-security-react/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.baeldung.spring.MvcConfig; +import org.baeldung.spring.SecSecurityConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = { MvcConfig.class, SecSecurityConfig.class }) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-security-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..e2e9f2af2b --- /dev/null +++ b/spring-security-rest/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,20 @@ +package org.baeldung; + +import org.baeldung.spring.ClientWebConfig; +import org.baeldung.spring.SecurityJavaConfig; +import org.baeldung.spring.WebConfig; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextConfiguration(classes = { ClientWebConfig.class, SecurityJavaConfig.class, WebConfig.class }) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-vault/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-vault/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..a2d727ea79 --- /dev/null +++ b/spring-vault/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,16 @@ +package org.baeldung; + +import org.baeldung.springvault.SpringVaultApplication; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SpringVaultApplication.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} From 3101fbe4331c395dd310e9a755524f12a715993b Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Tue, 18 Sep 2018 23:09:20 -0400 Subject: [PATCH 12/56] the maven spring context profile --- pom.xml | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) diff --git a/pom.xml b/pom.xml index 7a7e2d7f64..80351e0a75 100644 --- a/pom.xml +++ b/pom.xml @@ -607,6 +607,155 @@ + + + spring-context + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + 3 + true + + **/*SpringContextIntegrationTest.java + + + + + + + + + parent-boot-1 + parent-boot-2 + parent-spring-4 + parent-spring-5 + parent-java + parent-kotlin + spring-4 + spring-5 + spring-5-data-reactive + spring-5-reactive + spring-5-reactive-security + spring-5-reactive-client + spring-5-mvc + spring-5-security + spring-activiti + spring-akka + spring-amqp + spring-all + spring-amqp-simple + spring-apache-camel + spring-batch + spring-bom + spring-boot + spring-boot-client + spring-boot-keycloak + spring-boot-bootstrap + spring-boot-admin + spring-boot-camel + spring-boot-ops + spring-boot-persistence + spring-boot-security + spring-boot-mvc + spring-boot-vue + spring-boot-logging-log4j2 + spring-cloud-data-flow + spring-cloud + spring-core + spring-cucumber + spring-ejb + spring-ejb/spring-ejb-client + spring-aop + persistence-modules/spring-data-cassandra + spring-data-couchbase-2 + persistence-modules/spring-data-dynamodb + spring-data-elasticsearch + spring-data-jpa + spring-data-keyvalue + spring-data-mongodb + persistence-modules/spring-data-neo4j + persistence-modules/spring-data-redis + spring-data-rest + persistence-modules/spring-data-solr + spring-dispatcher-servlet + spring-exceptions + spring-freemarker + persistence-modules/spring-hibernate-3 + spring-hibernate4 + persistence-modules/spring-hibernate-5 + persistence-modules/spring-data-eclipselink + spring-integration + spring-jenkins-pipeline + spring-jersey + jmeter + spring-jms + spring-jooq + persistence-modules/spring-jpa + spring-kafka + spring-katharsis + spring-ldap + spring-mockito + spring-mvc-forms-jsp + spring-mvc-forms-thymeleaf + spring-mvc-java + spring-mvc-velocity + spring-mvc-webflow + spring-mvc-xml + spring-mvc-kotlin + spring-protobuf + spring-quartz + spring-rest-angular + spring-rest-full + spring-rest-query-language + spring-rest + spring-resttemplate + spring-rest-simple + spring-security-acl + spring-security-cache-control + spring-security-client/spring-security-jsp-authentication + spring-security-client/spring-security-jsp-authorize + spring-security-client/spring-security-jsp-config + spring-security-client/spring-security-mvc + spring-security-client/spring-security-thymeleaf-authentication + spring-security-client/spring-security-thymeleaf-authorize + spring-security-client/spring-security-thymeleaf-config + spring-security-core + spring-security-mvc-boot + spring-security-mvc-custom + spring-security-mvc-digest-auth + spring-security-mvc-ldap + spring-security-mvc-login + spring-security-mvc-persisted-remember-me + spring-security-mvc-session + spring-security-mvc-socket + spring-security-openid + + spring-security-rest-basic-auth + spring-security-rest-custom + spring-security-rest + spring-security-sso + spring-security-x509 + spring-session + spring-sleuth + spring-social-login + spring-spel + spring-state-machine + spring-thymeleaf + spring-userservice + spring-zuul + spring-remoting + spring-reactor + spring-vertx + spring-jinq + spring-rest-embedded-tomcat + + + integration From 214173c0e2d6e9f935f6d592e96d8dd8ad2b236a Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Mon, 24 Sep 2018 10:46:22 +0530 Subject: [PATCH 13/56] BAEL-8959 Fix surefire configs of projects ejb-client, junit5-example, java-remote-debugging and spring projects - Basic pom standardization --- ejb/ejb-remote/pom.xml | 1 - ejb/ejb-session-beans/pom.xml | 1 - 2 files changed, 2 deletions(-) diff --git a/ejb/ejb-remote/pom.xml b/ejb/ejb-remote/pom.xml index fffbbdb1da..dac2fefb84 100755 --- a/ejb/ejb-remote/pom.xml +++ b/ejb/ejb-remote/pom.xml @@ -15,7 +15,6 @@ javax javaee-api - ${javaee-api.version} provided diff --git a/ejb/ejb-session-beans/pom.xml b/ejb/ejb-session-beans/pom.xml index 14ab0790e7..da76169729 100644 --- a/ejb/ejb-session-beans/pom.xml +++ b/ejb/ejb-session-beans/pom.xml @@ -24,7 +24,6 @@ javax javaee-api - ${javaee-api.version} provided From df7794c382ddc27435af58d0aa2b239206869847 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Tue, 25 Sep 2018 01:30:05 +0530 Subject: [PATCH 14/56] [BAEL-9021] - Fixed compilation error and uncommented module in parent pom.xml --- pom.xml | 4 ++-- .../baeldung/spring/mybatis/controller/StudentController.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 4ffd9ba4a4..e978664c46 100644 --- a/pom.xml +++ b/pom.xml @@ -642,7 +642,7 @@ spring-mobile spring-mvc-simple - + spring-mybatis spring-rest-hal-browser spring-rest-shell spring-rest-template @@ -959,7 +959,7 @@ spring-mobile spring-mvc-simple - + spring-mybatis spring-rest-hal-browser spring-rest-shell spring-rest-template diff --git a/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java b/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java index 427613f23f..c1e5579103 100644 --- a/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java +++ b/spring-mybatis/src/main/java/com/baeldung/spring/mybatis/controller/StudentController.java @@ -31,7 +31,7 @@ public class StudentController { @RequestMapping(value = "/signup", method = RequestMethod.POST) public String signup(@Validated @ModelAttribute("student") Student student, BindingResult result, ModelMap model) { - if (studentService.getStudentByUserName(student.getUserName())) { + if (studentService.getStudentByUserName(student.getUserName()) != null) { model.addAttribute("message", "User Name exists. Try another user name"); return "signup"; } else { @@ -50,7 +50,7 @@ public class StudentController { @RequestMapping(value = "/login", method = RequestMethod.POST) public String login(@ModelAttribute("studentLogin") StudentLogin studentLogin, BindingResult result, ModelMap model) { - boolean found = studentService.getStudentByLogin(studentLogin.getUserName(), studentLogin.getPassword()); + boolean found = studentService.getStudentByLogin(studentLogin.getUserName(), studentLogin.getPassword()) != null; if (found) { return "success"; } else { From 183959edfa1330df2c0cc2b52dfd8a5ae9837566 Mon Sep 17 00:00:00 2001 From: Kumar Chandrakant Date: Mon, 24 Sep 2018 22:01:20 +0100 Subject: [PATCH 15/56] Adding files referenced in the mini article for the Jira item BAEL-2225 --- .../java/com/baeldung/map/util/MapMax.java | 96 +++++++++++++++++++ .../com/baeldung/map/util/MapMaxUnitTest.java | 59 ++++++++++++ 2 files changed, 155 insertions(+) create mode 100644 core-java-collections/src/main/java/com/baeldung/map/util/MapMax.java create mode 100644 core-java-collections/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java diff --git a/core-java-collections/src/main/java/com/baeldung/map/util/MapMax.java b/core-java-collections/src/main/java/com/baeldung/map/util/MapMax.java new file mode 100644 index 0000000000..93a98ba6fd --- /dev/null +++ b/core-java-collections/src/main/java/com/baeldung/map/util/MapMax.java @@ -0,0 +1,96 @@ +package com.baeldung.map.util; + +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Optional; + +public class MapMax { + + public > V maxUsingIteration(Map map) { + + Map.Entry maxEntry = null; + + for (Map.Entry entry : map.entrySet()) { + + if (maxEntry == null || entry.getValue() + .compareTo(maxEntry.getValue()) > 0) { + maxEntry = entry; + } + } + + return maxEntry.getValue(); + } + + public > V maxUsingCollectionsMax(Map map) { + + Entry maxEntry = Collections.max(map.entrySet(), new Comparator>() { + public int compare(Entry e1, Entry e2) { + return e1.getValue() + .compareTo(e2.getValue()); + } + }); + + return maxEntry.getValue(); + } + + public > V maxUsingCollectionsMaxAndLambda(Map map) { + + Entry maxEntry = Collections.max(map.entrySet(), (Entry e1, Entry e2) -> e1.getValue() + .compareTo(e2.getValue())); + + return maxEntry.getValue(); + } + + public > V maxUsingCollectionsMaxAndMethodReference(Map map) { + + Entry maxEntry = Collections.max(map.entrySet(), Comparator.comparing(Map.Entry::getValue)); + + return maxEntry.getValue(); + } + + public > V maxUsingStreamAndLambda(Map map) { + + Optional> maxEntry = map.entrySet() + .stream() + .max((Entry e1, Entry e2) -> e1.getValue() + .compareTo(e2.getValue())); + + return maxEntry.get() + .getValue(); + } + + public > V maxUsingStreamAndMethodReference(Map map) { + + Optional> maxEntry = map.entrySet() + .stream() + .max(Comparator.comparing(Map.Entry::getValue)); + + return maxEntry.get() + .getValue(); + } + + public static void main(String[] args) { + + Map map = new HashMap(); + + map.put(1, 3); + map.put(2, 4); + map.put(3, 5); + map.put(4, 6); + map.put(5, 7); + + MapMax mapMax = new MapMax(); + + System.out.println(mapMax.maxUsingIteration(map)); + System.out.println(mapMax.maxUsingCollectionsMax(map)); + System.out.println(mapMax.maxUsingCollectionsMaxAndLambda(map)); + System.out.println(mapMax.maxUsingCollectionsMaxAndMethodReference(map)); + System.out.println(mapMax.maxUsingStreamAndLambda(map)); + System.out.println(mapMax.maxUsingStreamAndMethodReference(map)); + + } + +} diff --git a/core-java-collections/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java b/core-java-collections/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java new file mode 100644 index 0000000000..883265cc8b --- /dev/null +++ b/core-java-collections/src/test/java/com/baeldung/map/util/MapMaxUnitTest.java @@ -0,0 +1,59 @@ +package com.baeldung.map.util; + + + +import static org.junit.Assert.assertEquals; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; + +public class MapMaxUnitTest { + + Map map = null; + MapMax mapMax = null; + + + @Before + public void setupTestData() { + map = new HashMap(); + map.put(23, 12); + map.put(46, 24); + map.put(27, 38); + mapMax = new MapMax(); + } + + @Test + public void givenMap_whenIterated_thenReturnMaxValue() { + assertEquals(new Integer(38), mapMax.maxUsingIteration(map)); + } + + @Test + public void givenMap_whenUsingCollectionsMax_thenReturnMaxValue() { + assertEquals(new Integer(38), mapMax.maxUsingCollectionsMax(map)); + } + + @Test + public void givenMap_whenUsingCollectionsMaxAndLambda_thenReturnMaxValue() { + assertEquals(new Integer(38), mapMax.maxUsingCollectionsMaxAndLambda(map)); + } + + @Test + public void givenMap_whenUsingCollectionsMaxAndMethodReference_thenReturnMaxValue() { + assertEquals(new Integer(38), mapMax.maxUsingCollectionsMaxAndMethodReference(map)); + } + + @Test + public void givenMap_whenUsingStreamAndLambda_thenReturnMaxValue() { + assertEquals(new Integer(38), mapMax.maxUsingStreamAndLambda(map)); + } + + @Test + public void givenMap_whenUsingStreamAndMethodReference_thenReturnMaxValue() { + assertEquals(new Integer(38), mapMax.maxUsingStreamAndMethodReference (map)); + } + + +} From f1546e283e820d5e5fe9fe6c73d9e85742d76c1b Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Mon, 24 Sep 2018 21:52:38 -0400 Subject: [PATCH 16/56] BAEL-8939: The spring context profile --- pom.xml | 127 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 66 insertions(+), 61 deletions(-) diff --git a/pom.xml b/pom.xml index 80351e0a75..8a57899768 100644 --- a/pom.xml +++ b/pom.xml @@ -630,92 +630,94 @@ - parent-boot-1 - parent-boot-2 - parent-spring-4 - parent-spring-5 - parent-java - parent-kotlin - spring-4 spring-5 spring-5-data-reactive spring-5-reactive - spring-5-reactive-security spring-5-reactive-client - spring-5-mvc + spring-5-reactive-security spring-5-security spring-activiti spring-akka - spring-amqp spring-all - spring-amqp-simple + spring-aop spring-apache-camel spring-batch spring-bom - spring-boot - spring-boot-client - spring-boot-keycloak + spring-boot-admin/spring-boot-admin-client + spring-boot-admin/spring-boot-admin-server + spring-boot-bootstrap spring-boot-bootstrap - spring-boot-admin spring-boot-camel - spring-boot-ops - spring-boot-persistence - spring-boot-security + spring-boot-client + spring-boot-custom-starter + greeter-spring-boot-autoconfigure + greeter-spring-boot-sample-app + spring-boot-h2/spring-boot-h2-database + spring-boot-jasypt + spring-boot-keycloak spring-boot-mvc - spring-boot-vue - spring-boot-logging-log4j2 - spring-cloud-data-flow + spring-boot-property-exp/property-exp-custom-config + spring-boot-property-exp/property-exp-default-config + spring-boot-vue spring-cloud - spring-core + spring-cloud/spring-cloud-archaius/basic-config + spring-cloud/spring-cloud-archaius/extra-configs + spring-cloud/spring-cloud-bootstrap/config + spring-cloud/spring-cloud-contract/spring-cloud-contract-consumer + spring-cloud/spring-cloud-contract/spring-cloud-contract-producer + spring-cloud/spring-cloud-gateway + spring-cloud/spring-cloud-kubernetes/demo-backend + spring-cloud/spring-cloud-rest/spring-cloud-rest-config-server + spring-cloud/spring-cloud-ribbon-client + spring-cloud/spring-cloud-security/auth-client + spring-cloud/spring-cloud-security/auth-resource + spring-cloud/spring-cloud-security/auth-server + spring-cloud/spring-cloud-stream/spring-cloud-stream-rabbit + spring-cloud/spring-cloud-task/springcloudtasksink + spring-cloud/spring-cloud-zookeeper + spring-cloud/spring-cloud-bus/spring-cloud-config-server + spring-cloud/spring-cloud-data-flow/log-sink + spring-cloud/spring-cloud-data-flow/time-processor + spring-cloud/spring-cloud-data-flow/time-source spring-cucumber - spring-ejb - spring-ejb/spring-ejb-client - spring-aop - persistence-modules/spring-data-cassandra - spring-data-couchbase-2 - persistence-modules/spring-data-dynamodb - spring-data-elasticsearch - spring-data-jpa spring-data-keyvalue - spring-data-mongodb - persistence-modules/spring-data-neo4j - persistence-modules/spring-data-redis spring-data-rest - persistence-modules/spring-data-solr spring-dispatcher-servlet - spring-exceptions + spring-drools spring-freemarker - persistence-modules/spring-hibernate-3 + spring-hibernate-3 spring-hibernate4 - persistence-modules/spring-hibernate-5 - persistence-modules/spring-data-eclipselink spring-integration spring-jenkins-pipeline spring-jersey - jmeter + spring-jinq spring-jms - spring-jooq - persistence-modules/spring-jpa spring-kafka spring-katharsis spring-ldap + spring-mobile spring-mockito - spring-mvc-forms-jsp spring-mvc-forms-thymeleaf spring-mvc-java spring-mvc-velocity spring-mvc-webflow - spring-mvc-xml - spring-mvc-kotlin spring-protobuf spring-quartz - spring-rest-angular - spring-rest-full - spring-rest-query-language + remoting-hessian-burlap/spring-remoting-hessian-burlap-client + remoting-hessian-burlap/remoting-hessian-burlap-server + spring-reactor + spring-remoting/ + spring-remoting/remoting-http/remoting-http-server + spring-remoting/remoting-jms/remoting-jms-client + spring-remoting/remoting-rmi/remoting-rmi-server spring-rest - spring-resttemplate + spring-rest-angular + spring-rest-embedded-tomcat + spring-rest-full spring-rest-simple + spring-resttemplate spring-security-acl + spring-security-angular spring-security-cache-control spring-security-client/spring-security-jsp-authentication spring-security-client/spring-security-jsp-authorize @@ -729,30 +731,33 @@ spring-security-mvc-custom spring-security-mvc-digest-auth spring-security-mvc-ldap - spring-security-mvc-login spring-security-mvc-persisted-remember-me spring-security-mvc-session spring-security-mvc-socket - spring-security-openid - - spring-security-rest-basic-auth - spring-security-rest-custom spring-security-rest - spring-security-sso - spring-security-x509 - spring-session + spring-security-sso/spring-security-sso-auth-server + spring-security-sso/spring-security-sso-ui + spring-security-sso/spring-security-sso-ui-2 + spring-security-thymeleaf/spring-security-thymeleaf-authentication + spring-security-thymeleaf/spring-security-thymeleaf-authorize + spring-security-thymeleaf/spring-security-thymeleaf-config + spring-security-x509/spring-security-x509-basic-auth + spring-security-x509/spring-security-x509-client-auth + spring-session/spring-session-jdbc spring-sleuth spring-social-login spring-spel spring-state-machine + spring-swagger-codegen/spring-swagger-codegen-app spring-thymeleaf spring-userservice - spring-zuul - spring-remoting - spring-reactor + spring-vault spring-vertx - spring-jinq - spring-rest-embedded-tomcat + spring-zuul/spring-zuul-foos-resource + persistence-modules/spring-data-dynamodb + persistence-modules/spring-data-eclipselink + persistence-modules/spring-data-solr + persistence-modules/spring-hibernate-5 From a160f4d8937443568ee9f5dfe0bb4caefdf1fb10 Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Mon, 24 Sep 2018 22:00:00 -0400 Subject: [PATCH 17/56] BAEL-8939 - Fixed travis build --- spring-boot-camel/pom.xml | 1 - spring-boot-property-exp/property-exp-custom-config/pom.xml | 1 - spring-cloud/spring-cloud-consul/pom.xml | 1 - 3 files changed, 3 deletions(-) diff --git a/spring-boot-camel/pom.xml b/spring-boot-camel/pom.xml index 4d7c8a002e..19a0bec809 100644 --- a/spring-boot-camel/pom.xml +++ b/spring-boot-camel/pom.xml @@ -10,7 +10,6 @@ com.baeldung parent-modules 1.0.0-SNAPSHOT - ../parent-boot-1 diff --git a/spring-boot-property-exp/property-exp-custom-config/pom.xml b/spring-boot-property-exp/property-exp-custom-config/pom.xml index d433ab35c2..ab22c5ad30 100644 --- a/spring-boot-property-exp/property-exp-custom-config/pom.xml +++ b/spring-boot-property-exp/property-exp-custom-config/pom.xml @@ -12,7 +12,6 @@ spring-boot-property-exp com.baeldung 0.0.1-SNAPSHOT - ../parent-boot-1 diff --git a/spring-cloud/spring-cloud-consul/pom.xml b/spring-cloud/spring-cloud-consul/pom.xml index 6db47593f5..2a2714d597 100644 --- a/spring-cloud/spring-cloud-consul/pom.xml +++ b/spring-cloud/spring-cloud-consul/pom.xml @@ -11,7 +11,6 @@ com.baeldung.spring.cloud spring-cloud 1.0.0-SNAPSHOT - ../parent-boot-1 From 229404f87e359c001225404b35102b4c45791ba1 Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Mon, 24 Sep 2018 22:45:48 -0400 Subject: [PATCH 18/56] BAEL-8939: Fixing travis build --- .../baeldung/SpringContextIntegrationTest.java | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 spring-boot-h2/spring-boot-h2-database/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-boot-h2/spring-boot-h2-database/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-h2/spring-boot-h2-database/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index eb33198ac1..0000000000 --- a/spring-boot-h2/spring-boot-h2-database/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.h2db.demo.SpringBootApp; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = SpringBootApp.class) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} From 77148e31d2afd46d2da9ab35ea6c2347b0f5b114 Mon Sep 17 00:00:00 2001 From: KevinGilmore Date: Tue, 25 Sep 2018 07:10:35 -0500 Subject: [PATCH 19/56] BAEL-1980: Update README.md (#5327) * BAEL-1766: Update README * BAEL-1853: add link to article * BAEL-1801: add link to article * Added links back to articles * Add links back to articles * BAEL-1795: Update README * BAEL-1901 and BAEL-1555 add links back to article * BAEL-2026 add link back to article * BAEL-2029: add link back to article * BAEL-1898: Add link back to article * BAEL-2102 and BAEL-2131 Add links back to articles * BAEL-2132 Add link back to article * BAEL-1980: add link back to article --- spring-boot-h2/README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 spring-boot-h2/README.md diff --git a/spring-boot-h2/README.md b/spring-boot-h2/README.md new file mode 100644 index 0000000000..af5f395440 --- /dev/null +++ b/spring-boot-h2/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Access the Same In-Memory H2 Database in Multiple Spring Boot Applications](https://www.baeldung.com/spring-boot-access-h2-database-multiple-apps) From 9799b93a21ea230b7fb00c1152d6481b4f443c1e Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Tue, 25 Sep 2018 21:37:12 +0530 Subject: [PATCH 20/56] BAEL-8960 Fix surefire configs of java security api, java annotations, jenkins, api, jhipster, jni, maven, msf4j, mustache projects - Surefire config fixes, pom standardizations, added packaging pom at jhipster level and jhipster-microservice level --- java-ee-8-security-api/pom.xml | 11 +- jee-7/pom.xml | 1 - jenkins/hello-world/pom.xml | 7 - .../jhipster-microservice/car-app/pom.xml | 22 +- .../jhipster-microservice/dealer-app/pom.xml | 708 ++++++++------- .../jhipster-microservice/gateway-app/pom.xml | 830 +++++++++--------- jhipster/jhipster-microservice/pom.xml | 20 + jhipster/jhipster-monolithic/pom.xml | 7 +- jhipster/pom.xml | 23 + jni/pom.xml | 19 +- ...iveTests.java => JNINativeManualTest.java} | 2 +- jooby/pom.xml | 107 +-- .../jooby/{AppTest.java => AppUnitTest.java} | 2 +- mustache/pom.xml | 87 -- pom.xml | 4 +- 15 files changed, 884 insertions(+), 966 deletions(-) create mode 100644 jhipster/jhipster-microservice/pom.xml create mode 100644 jhipster/pom.xml rename jni/src/test/java/com/baeldung/jni/{JNINativeTests.java => JNINativeManualTest.java} (98%) rename jooby/src/test/java/com/baeldung/jooby/{AppTest.java => AppUnitTest.java} (96%) diff --git a/java-ee-8-security-api/pom.xml b/java-ee-8-security-api/pom.xml index 5490cd40f7..3d235e10a8 100644 --- a/java-ee-8-security-api/pom.xml +++ b/java-ee-8-security-api/pom.xml @@ -3,11 +3,16 @@ 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 - com.baeldung java-ee-8-security-api 1.0-SNAPSHOT pom + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + @@ -53,10 +58,6 @@ - 1.8 - 1.8 - UTF-8 - 9080 9443 diff --git a/jee-7/pom.xml b/jee-7/pom.xml index 08c8b5a068..242fa778c0 100644 --- a/jee-7/pom.xml +++ b/jee-7/pom.xml @@ -2,7 +2,6 @@ 4.0.0 - com.baeldung jee-7 1.0-SNAPSHOT war diff --git a/jenkins/hello-world/pom.xml b/jenkins/hello-world/pom.xml index 5684deaea3..fb2154c7ad 100644 --- a/jenkins/hello-world/pom.xml +++ b/jenkins/hello-world/pom.xml @@ -7,13 +7,6 @@ hpi Hello World Plugin A sample Jenkins Hello World plugin - https://wiki.jenkins-ci.org/display/JENKINS/TODO+Plugin - - - MIT License - http://opensource.org/licenses/MIT - - org.jenkins-ci.plugins diff --git a/jhipster/jhipster-microservice/car-app/pom.xml b/jhipster/jhipster-microservice/car-app/pom.xml index c52def554f..b05979b9c5 100644 --- a/jhipster/jhipster-microservice/car-app/pom.xml +++ b/jhipster/jhipster-microservice/car-app/pom.xml @@ -1,17 +1,15 @@ - + 4.0.0 - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../../../parent-boot-1 + jhipster-microservice + com.baeldung.jhipster + 1.0.0-SNAPSHOT + com.car.app car-app - 0.0.1-SNAPSHOT war car-app @@ -37,9 +35,11 @@ 0.7.0 3.6 2.0.0 + 3.6.2 4.8 jdt_apt 1.1.0.Final + 2.10 1.4.1 3.0.1 yyyyMMddHHmmss @@ -186,12 +186,10 @@ commons-io commons-io - ${commons-io.version} io.dropwizard.metrics metrics-annotation - ${dropwizard-metrics.version} io.dropwizard.metrics @@ -200,17 +198,14 @@ io.dropwizard.metrics metrics-json - ${dropwizard-metrics.version} io.dropwizard.metrics metrics-jvm - ${dropwizard-metrics.version} io.dropwizard.metrics metrics-servlet - ${dropwizard-metrics.version} io.dropwizard.metrics @@ -505,8 +500,6 @@ maven-compiler-plugin ${maven-compiler-plugin.version} - ${maven.compiler.source} - ${maven.compiler.target} org.mapstruct @@ -519,6 +512,7 @@ org.apache.maven.plugins maven-eclipse-plugin + ${maven-eclipse-plugin.version} true true diff --git a/jhipster/jhipster-microservice/dealer-app/pom.xml b/jhipster/jhipster-microservice/dealer-app/pom.xml index a9366e9bd3..803a0f62e6 100644 --- a/jhipster/jhipster-microservice/dealer-app/pom.xml +++ b/jhipster/jhipster-microservice/dealer-app/pom.xml @@ -1,54 +1,113 @@ - + 4.0.0 + + + jhipster-microservice + com.baeldung.jhipster + 1.0.0-SNAPSHOT + + com.dealer.app dealer-app - 0.0.1-SNAPSHOT war dealer-app - - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../../../parent-boot-1 - + + ${maven.version} + + + + -Djava.security.egd=file:/dev/./urandom -Xmx256m + 3.6.2 + 2.0.0 + 2.5 + 3.5 + 0.4.13 + 1.2 + 5.2.8.Final + 2.6.0 + 0.7.9 + 3.21.0-GA + 1.0.0 + 1.1.0 + 0.7.0 + 3.6 + 2.0.0 + 3.6.2 + 4.8 + jdt_apt + 1.1.0.Final + 2.10 + 1.4.1 + 3.0.1 + yyyyMMddHHmmss + 3.0.0 + 3.1.3 + v6.10.0 + + + + + ${project.build.directory}/test-results + 0.0.20 + false + 3.2.2 + 2.12.1 + 3.2 + + src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* + + S3437,UndocumentedApi,BoldAndItalicTagsCheck + + + src/main/webapp/app/**/*.* + Web:BoldAndItalicTagsCheck + + src/main/java/**/* + squid:S3437 + + src/main/java/**/* + squid:UndocumentedApi + + ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + jacoco + + ${project.testresult.directory}/karma + + ${project.testresult.directory}/coverage/report-lcov/lcov.info + + ${project.testresult.directory}/coverage/report-lcov/lcov.info + + ${project.basedir}/src/main/ + ${project.testresult.directory}/surefire-reports + ${project.basedir}/src/test/ + + 2.5.0 + + Camden.SR5 + 2.6.1 + 1.4.10.Final + 1.1.0.Final + v0.21.3 + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + - - io.github.jhipster - jhipster - ${jhipster.server.version} - - - io.dropwizard.metrics - metrics-core - - - io.dropwizard.metrics - metrics-annotation - ${dropwizard-metrics.version} - - - io.dropwizard.metrics - metrics-json - ${dropwizard-metrics.version} - - - io.dropwizard.metrics - metrics-jvm - ${dropwizard-metrics.version} - - - io.dropwizard.metrics - metrics-servlet - ${dropwizard-metrics.version} - - - io.dropwizard.metrics - metrics-servlets - com.fasterxml.jackson.datatype jackson-datatype-hibernate5 @@ -59,11 +118,11 @@ com.fasterxml.jackson.datatype - jackson-datatype-jsr310 + jackson-datatype-json-org com.fasterxml.jackson.datatype - jackson-datatype-json-org + jackson-datatype-jsr310 com.h2database @@ -82,34 +141,12 @@ com.hazelcast hazelcast-spring - - org.awaitility - awaitility - ${awaitility.version} - test - com.jayway.jsonpath json-path test - - io.springfox - springfox-swagger2 - ${springfox.version} - - - org.mapstruct - mapstruct - - - - - io.springfox - springfox-bean-validators - ${springfox.version} - com.mattbertolini liquibase-slf4j @@ -121,16 +158,16 @@ ${metrics-spring.version} - com.codahale.metrics metrics-annotation + com.codahale.metrics - com.codahale.metrics metrics-core + com.codahale.metrics - com.codahale.metrics metrics-healthchecks + com.codahale.metrics @@ -148,12 +185,56 @@ commons-io commons-io - ${commons-io.version} - org.apache.commons - commons-lang3 - ${commons-lang.version} + io.dropwizard.metrics + metrics-annotation + + + io.dropwizard.metrics + metrics-core + + + io.dropwizard.metrics + metrics-json + + + io.dropwizard.metrics + metrics-jvm + + + io.dropwizard.metrics + metrics-servlet + + + io.dropwizard.metrics + metrics-servlets + + + io.github.jhipster + jhipster + ${jhipster.server.version} + + + io.jsonwebtoken + jjwt + ${jjwt.version} + + + io.springfox + springfox-bean-validators + ${springfox.version} + + + io.springfox + springfox-swagger2 + ${springfox.version} + + + mapstruct + org.mapstruct + + javax.cache @@ -163,11 +244,41 @@ mysql mysql-connector-java + + net.logstash.logback + logstash-logback-encoder + ${logstash-logback-encoder.version} + + + logback-core + ch.qos.logback + + + logback-classic + ch.qos.logback + + + logback-access + ch.qos.logback + + + + + org.apache.commons + commons-lang3 + ${commons-lang.version} + org.assertj assertj-core test + + org.awaitility + awaitility + ${awaitility.version} + test + org.hibernate hibernate-envers @@ -216,6 +327,10 @@ org.springframework.boot spring-boot-starter-aop + + org.springframework.boot + spring-boot-starter-cloud-connectors + org.springframework.boot spring-boot-starter-data-jpa @@ -232,16 +347,6 @@ org.springframework.boot spring-boot-starter-security - - org.springframework.security - spring-security-test - test - - - org.springframework.boot - spring-boot-test - test - org.springframework.boot spring-boot-starter-thymeleaf @@ -251,15 +356,15 @@ spring-boot-starter-web - org.springframework.boot spring-boot-starter-tomcat + org.springframework.boot - io.jsonwebtoken - jjwt - ${jjwt.version} + org.springframework.boot + spring-boot-test + test @@ -268,19 +373,31 @@ org.springframework.cloud - spring-cloud-starter-ribbon - - - - io.netty - netty-transport-native-epoll - - + spring-cloud-starter-config + + + org.springframework.cloud + spring-cloud-starter-eureka + + + org.springframework.cloud + spring-cloud-starter-feign org.springframework.cloud spring-cloud-starter-hystrix + + org.springframework.cloud + spring-cloud-starter-ribbon + + + + netty-transport-native-epoll + io.netty + + + org.springframework.cloud spring-cloud-starter-spectator @@ -289,51 +406,51 @@ org.springframework.retry spring-retry - - org.springframework.cloud - spring-cloud-starter-eureka - - - org.springframework.cloud - spring-cloud-starter-config - - - org.springframework.cloud - spring-cloud-starter-feign - - - net.logstash.logback - logstash-logback-encoder - ${logstash-logback-encoder.version} - - - ch.qos.logback - logback-core - - - ch.qos.logback - logback-classic - - - ch.qos.logback - logback-access - - - - - org.springframework.boot - spring-boot-starter-cloud-connectors - org.springframework.security spring-security-data + + org.springframework.security + spring-security-test + test + spring-boot:run + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + prepare-agent + + + + + + + + + + + + com.github.ekryd.sortpom @@ -356,6 +473,22 @@ false + + com.spotify + docker-maven-plugin + ${docker-maven-plugin.version} + + dealerapp + src/main/docker + + + / + ${project.build.directory} + ${project.build.finalName}.war + + + + org.apache.maven.plugins maven-compiler-plugin @@ -373,6 +506,7 @@ org.apache.maven.plugins maven-eclipse-plugin + ${maven-eclipse-plugin.version} true true @@ -479,28 +613,16 @@ - - org.sonarsource.scanner.maven - sonar-maven-plugin - ${sonar-maven-plugin.version} - org.liquibase liquibase-maven-plugin ${liquibase.version} - - src/main/resources/config/liquibase/master.xml - src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml - org.h2.Driver - jdbc:h2:file:./target/h2db/db/dealerapp - - dealerapp - - hibernate:spring:com.dealer.app.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy - true - debug - + + javax.validation + validation-api + ${validation-api.version} + org.javassist javassist @@ -516,12 +638,24 @@ spring-boot-starter-data-jpa ${project.parent.version} - - javax.validation - validation-api - ${validation-api.version} - + + src/main/resources/config/liquibase/master.xml + src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml + org.h2.Driver + jdbc:h2:file:./target/h2db/db/dealerapp + + dealerapp + + hibernate:spring:com.dealer.app.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + true + debug + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${sonar-maven-plugin.version} org.springframework.boot @@ -532,58 +666,8 @@ - - com.spotify - docker-maven-plugin - ${docker-maven-plugin.version} - - dealerapp - src/main/docker - - - / - ${project.build.directory} - ${project.build.finalName}.war - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.jacoco - - jacoco-maven-plugin - - - ${jacoco-maven-plugin.version} - - - prepare-agent - - - - - - - - - - - - @@ -604,24 +688,12 @@ true - - - org.springframework.boot - spring-boot-starter-undertow - - - org.springframework.boot - spring-boot-devtools - true - - org.apache.maven.plugins maven-war-plugin - - + @@ -631,15 +703,20 @@ dev${profile.no-liquibase} - - - prod + + org.springframework.boot + spring-boot-devtools + true + org.springframework.boot spring-boot-starter-undertow + + + prod @@ -655,15 +732,11 @@ org.apache.maven.plugins maven-war-plugin - - + org.springframework.boot spring-boot-maven-plugin - - true - @@ -671,6 +744,9 @@ + + true + @@ -680,56 +756,20 @@ prod${profile.swagger}${profile.no-liquibase} + + + org.springframework.boot + spring-boot-starter-undertow + + cc - - - org.springframework.boot - spring-boot-starter-undertow - - - org.springframework.boot - spring-boot-devtools - true - - - - org.apache.maven.plugins - maven-war-plugin - - src/main/webapp/ - - - - org.springframework.boot - spring-boot-maven-plugin - - true - true - true - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - default-compile - none - - - default-testCompile - none - - - net.alchim31.maven scala-maven-plugin @@ -758,6 +798,37 @@ ${scala.version} + + org.apache.maven.plugins + maven-compiler-plugin + + + default-compile + none + + + default-testCompile + none + + + + + org.apache.maven.plugins + maven-war-plugin + + src/main/webapp/ + + + + org.springframework.boot + spring-boot-maven-plugin + + true + true + true + + + @@ -766,6 +837,17 @@ dev,swagger + + + org.springframework.boot + spring-boot-devtools + true + + + org.springframework.boot + spring-boot-starter-undertow + + @@ -788,12 +870,12 @@ io.prometheus - simpleclient_servlet + simpleclient_dropwizard ${prometheus-simpleclient.version} io.prometheus - simpleclient_dropwizard + simpleclient_servlet ${prometheus-simpleclient.version} @@ -811,96 +893,4 @@ - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - ${maven.version} - - - - -Djava.security.egd=file:/dev/./urandom -Xmx256m - 3.6.2 - 2.0.0 - 2.5 - 3.5 - 0.4.13 - 1.2 - 5.2.8.Final - 2.6.0 - 0.7.9 - 3.21.0-GA - 1.0.0 - 1.1.0 - 0.7.0 - 3.6 - 2.0.0 - 4.8 - jdt_apt - 1.1.0.Final - 1.4.1 - 3.0.1 - yyyyMMddHHmmss - 3.0.0 - 3.1.3 - v6.10.0 - - - - 0.0.20 - - ${project.build.directory}/test-results - false - 3.2.2 - 2.12.1 - 3.2 - - src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* - - S3437,UndocumentedApi,BoldAndItalicTagsCheck - - - src/main/webapp/app/**/*.* - Web:BoldAndItalicTagsCheck - - src/main/java/**/* - squid:S3437 - - src/main/java/**/* - squid:UndocumentedApi - - ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec - ${project.testresult.directory}/coverage/jacoco/jacoco.exec - jacoco - - ${project.testresult.directory}/karma - - ${project.testresult.directory}/coverage/report-lcov/lcov.info - - ${project.testresult.directory}/coverage/report-lcov/lcov.info - - ${project.basedir}/src/main/ - ${project.testresult.directory}/surefire-reports - ${project.basedir}/src/test/ - - 2.5.0 - - Camden.SR5 - 2.6.1 - 1.4.10.Final - 1.1.0.Final - v0.21.3 - - diff --git a/jhipster/jhipster-microservice/gateway-app/pom.xml b/jhipster/jhipster-microservice/gateway-app/pom.xml index 0ae74e11bb..ed0c929027 100644 --- a/jhipster/jhipster-microservice/gateway-app/pom.xml +++ b/jhipster/jhipster-microservice/gateway-app/pom.xml @@ -1,53 +1,136 @@ - + 4.0.0 + + + jhipster-microservice + com.baeldung.jhipster + 1.0.0-SNAPSHOT + + com.gateway gateway-app - 0.0.1-SNAPSHOT war gateway-app - - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../../../parent-boot-1 - + + ${maven.version} + + + + -Djava.security.egd=file:/dev/./urandom -Xmx256m + 3.6.2 + 2.0.0 + 3.6.0 + 1.10 + 2.5 + 3.5 + 0.4.13 + 1.3 + 1.2 + 5.2.8.Final + 2.6.0 + 0.7.9 + 3.21.0-GA + 1.0.0 + 1.1.0 + 0.7.0 + 3.6 + 2.0.0 + 3.6.2 + 4.8 + 1.3.0 + jdt_apt + 1.1.0.Final + 2.10 + 1.4.1 + 3.0.1 + yyyyMMddHHmmss + 3.0.0 + 3.1.3 + v6.10.0 + + + + + ${project.build.directory}/test-results + 0.0.20 + false + 3.2.2 + 2.12.1 + 3.2 + + src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* + + S3437,UndocumentedApi,BoldAndItalicTagsCheck + + + src/main/webapp/app/**/*.* + Web:BoldAndItalicTagsCheck + + src/main/java/**/* + squid:S3437 + + src/main/java/**/* + squid:UndocumentedApi + + ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec + ${project.testresult.directory}/coverage/jacoco/jacoco.exec + jacoco + + ${project.testresult.directory}/karma + + ${project.testresult.directory}/coverage/report-lcov/lcov.info + + ${project.testresult.directory}/coverage/report-lcov/lcov.info + + ${project.basedir}/src/main/ + ${project.testresult.directory}/surefire-reports + ${project.basedir}/src/test/ + + 2.5.0 + + Camden.SR5 + 2.6.1 + 1.4.10.Final + 1.1.0.Final + v0.21.3 + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + - io.github.jhipster - jhipster - ${jhipster.server.version} + com.datastax.cassandra + cassandra-driver-core + + + metrics-core + com.codahale.metrics + + - io.dropwizard.metrics - metrics-core + com.datastax.cassandra + cassandra-driver-extras + ${cassandra-driver.version} - io.dropwizard.metrics - metrics-annotation - ${dropwizard-metrics.version} - - - io.dropwizard.metrics - metrics-json - ${dropwizard-metrics.version} - - - io.dropwizard.metrics - metrics-jvm - ${dropwizard-metrics.version} - - - io.dropwizard.metrics - metrics-servlet - ${dropwizard-metrics.version} - - - io.dropwizard.metrics - metrics-servlets + com.datastax.cassandra + cassandra-driver-mapping com.fasterxml.jackson.datatype @@ -59,11 +142,11 @@ com.fasterxml.jackson.datatype - jackson-datatype-jsr310 + jackson-datatype-json-org com.fasterxml.jackson.datatype - jackson-datatype-json-org + jackson-datatype-jsr310 com.h2database @@ -82,34 +165,12 @@ com.hazelcast hazelcast-spring - - org.awaitility - awaitility - ${awaitility.version} - test - com.jayway.jsonpath json-path test - - io.springfox - springfox-swagger2 - ${springfox.version} - - - org.mapstruct - mapstruct - - - - - io.springfox - springfox-bean-validators - ${springfox.version} - com.mattbertolini liquibase-slf4j @@ -121,16 +182,16 @@ ${metrics-spring.version} - com.codahale.metrics metrics-annotation + com.codahale.metrics - com.codahale.metrics metrics-core + com.codahale.metrics - com.codahale.metrics metrics-healthchecks + com.codahale.metrics @@ -148,17 +209,60 @@ commons-codec commons-codec - ${commons-codec.version} commons-io commons-io - ${commons-io.version} - org.apache.commons - commons-lang3 - ${commons-lang.version} + io.dropwizard.metrics + metrics-annotation + + + io.dropwizard.metrics + metrics-core + + + io.dropwizard.metrics + metrics-json + + + io.dropwizard.metrics + metrics-jvm + + + io.dropwizard.metrics + metrics-servlet + + + io.dropwizard.metrics + metrics-servlets + + + io.github.jhipster + jhipster + ${jhipster.server.version} + + + io.jsonwebtoken + jjwt + ${jjwt.version} + + + io.springfox + springfox-bean-validators + ${springfox.version} + + + io.springfox + springfox-swagger2 + ${springfox.version} + + + mapstruct + org.mapstruct + + javax.cache @@ -173,11 +277,41 @@ lz4 ${lz4.version} + + net.logstash.logback + logstash-logback-encoder + ${logstash-logback-encoder.version} + + + logback-core + ch.qos.logback + + + logback-classic + ch.qos.logback + + + logback-access + ch.qos.logback + + + + + org.apache.commons + commons-lang3 + ${commons-lang.version} + org.assertj assertj-core test + + org.awaitility + awaitility + ${awaitility.version} + test + org.hibernate hibernate-envers @@ -226,6 +360,10 @@ org.springframework.boot spring-boot-starter-aop + + org.springframework.boot + spring-boot-starter-cloud-connectors + org.springframework.boot spring-boot-starter-data-jpa @@ -247,16 +385,6 @@ spring-boot-starter-test test - - org.springframework.security - spring-security-test - test - - - org.springframework.boot - spring-boot-test - test - org.springframework.boot spring-boot-starter-thymeleaf @@ -266,40 +394,15 @@ spring-boot-starter-web - org.springframework.boot spring-boot-starter-tomcat + org.springframework.boot - io.jsonwebtoken - jjwt - ${jjwt.version} - - - - com.datastax.cassandra - cassandra-driver-core - - - com.codahale.metrics - metrics-core - - - - - com.datastax.cassandra - cassandra-driver-extras - ${cassandra-driver.version} - - - com.datastax.cassandra - cassandra-driver-mapping - - - - org.springframework.cloud - spring-cloud-starter-zuul + org.springframework.boot + spring-boot-test + test org.springframework.cloud @@ -307,72 +410,105 @@ org.springframework.cloud - spring-cloud-starter-ribbon - - - - io.netty - netty-transport-native-epoll - - - - - org.springframework.cloud - spring-cloud-starter-hystrix - - - org.springframework.cloud - spring-cloud-starter-spectator - - - org.springframework.retry - spring-retry + spring-cloud-starter-config org.springframework.cloud spring-cloud-starter-eureka - - org.springframework.cloud - spring-cloud-starter-config - org.springframework.cloud spring-cloud-starter-feign - net.logstash.logback - logstash-logback-encoder - ${logstash-logback-encoder.version} + org.springframework.cloud + spring-cloud-starter-hystrix + + + org.springframework.cloud + spring-cloud-starter-ribbon + - ch.qos.logback - logback-core - - - ch.qos.logback - logback-classic - - - ch.qos.logback - logback-access + netty-transport-native-epoll + io.netty - org.springframework.boot - spring-boot-starter-cloud-connectors + org.springframework.cloud + spring-cloud-starter-spectator + + + + org.springframework.cloud + spring-cloud-starter-zuul + + + org.springframework.retry + spring-retry org.springframework.security spring-security-data + + org.springframework.security + spring-security-test + test + spring-boot:run + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco-maven-plugin.version} + + prepare-agent + + + + + + + + + com.github.eirslett + frontend-maven-plugin + ${frontend-maven-plugin.version} + + install-node-and-yarn + yarn + bower + gulp + + + + + + + + + + + + com.github.ekryd.sortpom @@ -395,6 +531,22 @@ false + + com.spotify + docker-maven-plugin + ${docker-maven-plugin.version} + + gateway + src/main/docker + + + / + ${project.build.directory} + ${project.build.finalName}.war + + + + org.apache.maven.plugins maven-compiler-plugin @@ -412,6 +564,7 @@ org.apache.maven.plugins maven-eclipse-plugin + ${maven-eclipse-plugin.version} true true @@ -518,28 +671,16 @@ - - org.sonarsource.scanner.maven - sonar-maven-plugin - ${sonar-maven-plugin.version} - org.liquibase liquibase-maven-plugin ${liquibase.version} - - src/main/resources/config/liquibase/master.xml - src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml - org.h2.Driver - jdbc:h2:file:./target/h2db/db/gateway - - gateway - - hibernate:spring:com.gateway.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy - true - debug - + + javax.validation + validation-api + ${validation-api.version} + org.javassist javassist @@ -555,12 +696,24 @@ spring-boot-starter-data-jpa ${project.parent.version} - - javax.validation - validation-api - ${validation-api.version} - + + src/main/resources/config/liquibase/master.xml + src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml + org.h2.Driver + jdbc:h2:file:./target/h2db/db/gateway + + gateway + + hibernate:spring:com.gateway.domain?dialect=org.hibernate.dialect.H2Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy + true + debug + + + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${sonar-maven-plugin.version} org.springframework.boot @@ -571,74 +724,8 @@ - - com.spotify - docker-maven-plugin - ${docker-maven-plugin.version} - - gateway - src/main/docker - - - / - ${project.build.directory} - ${project.build.finalName}.war - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.jacoco - - jacoco-maven-plugin - - - ${jacoco-maven-plugin.version} - - - prepare-agent - - - - - - - - - com.github.eirslett - frontend-maven-plugin - ${frontend-maven-plugin.version} - - install-node-and-yarn - yarn - bower - gulp - - - - - - - - - - - - @@ -659,17 +746,6 @@ true - - - org.springframework.boot - spring-boot-starter-undertow - - - org.springframework.boot - spring-boot-devtools - true - - @@ -687,48 +763,22 @@ dev${profile.no-liquibase} - - - prod + + org.springframework.boot + spring-boot-devtools + true + org.springframework.boot spring-boot-starter-undertow + + + prod - - maven-clean-plugin - - - - target/www/ - - - - - - org.apache.maven.plugins - maven-war-plugin - - target/www/ - - - - org.springframework.boot - spring-boot-maven-plugin - - true - - - - - build-info - - - - com.github.eirslett frontend-maven-plugin @@ -773,16 +823,47 @@ gulp test + test gulp - test test --no-notification + + maven-clean-plugin + + + + target/www/ + + + + + + org.apache.maven.plugins + maven-war-plugin + + target/www/ + + + + org.springframework.boot + spring-boot-maven-plugin + + + + build-info + + + + + true + + @@ -791,56 +872,20 @@ prod${profile.swagger}${profile.no-liquibase} + + + org.springframework.boot + spring-boot-starter-undertow + + cc - - - org.springframework.boot - spring-boot-starter-undertow - - - org.springframework.boot - spring-boot-devtools - true - - - - org.apache.maven.plugins - maven-war-plugin - - src/main/webapp/ - - - - org.springframework.boot - spring-boot-maven-plugin - - true - true - true - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - default-compile - none - - - default-testCompile - none - - - net.alchim31.maven scala-maven-plugin @@ -869,6 +914,37 @@ ${scala.version} + + org.apache.maven.plugins + maven-compiler-plugin + + + default-compile + none + + + default-testCompile + none + + + + + org.apache.maven.plugins + maven-war-plugin + + src/main/webapp/ + + + + org.springframework.boot + spring-boot-maven-plugin + + true + true + true + + + @@ -877,6 +953,17 @@ dev,swagger + + + org.springframework.boot + spring-boot-devtools + true + + + org.springframework.boot + spring-boot-starter-undertow + + @@ -899,12 +986,12 @@ io.prometheus - simpleclient_servlet + simpleclient_dropwizard ${prometheus-simpleclient.version} io.prometheus - simpleclient_dropwizard + simpleclient_servlet ${prometheus-simpleclient.version} @@ -922,99 +1009,4 @@ - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - ${maven.version} - - - - -Djava.security.egd=file:/dev/./urandom -Xmx256m - 3.6.2 - 2.0.0 - 1.10 - 2.5 - 3.5 - 0.4.13 - 1.3 - 1.2 - 5.2.8.Final - 2.6.0 - 0.7.9 - 3.21.0-GA - 1.0.0 - 1.1.0 - 0.7.0 - 3.6 - 2.0.0 - 4.8 - 1.3.0 - jdt_apt - 1.1.0.Final - 1.4.1 - 3.0.1 - yyyyMMddHHmmss - 3.0.0 - 3.1.3 - v6.10.0 - - - - 0.0.20 - - ${project.build.directory}/test-results - false - 3.2.2 - 2.12.1 - 3.2 - - src/main/webapp/content/**/*.*, src/main/webapp/bower_components/**/*.*, src/main/webapp/i18n/*.js, target/www/**/*.* - - S3437,UndocumentedApi,BoldAndItalicTagsCheck - - - src/main/webapp/app/**/*.* - Web:BoldAndItalicTagsCheck - - src/main/java/**/* - squid:S3437 - - src/main/java/**/* - squid:UndocumentedApi - - ${project.testresult.directory}/coverage/jacoco/jacoco-it.exec - ${project.testresult.directory}/coverage/jacoco/jacoco.exec - jacoco - - ${project.testresult.directory}/karma - - ${project.testresult.directory}/coverage/report-lcov/lcov.info - - ${project.testresult.directory}/coverage/report-lcov/lcov.info - - ${project.basedir}/src/main/ - ${project.testresult.directory}/surefire-reports - ${project.basedir}/src/test/ - - 2.5.0 - - Camden.SR5 - 2.6.1 - 1.4.10.Final - 1.1.0.Final - v0.21.3 - - diff --git a/jhipster/jhipster-microservice/pom.xml b/jhipster/jhipster-microservice/pom.xml new file mode 100644 index 0000000000..4a60e47f87 --- /dev/null +++ b/jhipster/jhipster-microservice/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + jhipster-microservice + pom + JHipster Microservice + + + jhipster + com.baeldung.jhipster + 1.0.0-SNAPSHOT + + + + car-app + dealer-app + gateway-app + + diff --git a/jhipster/jhipster-monolithic/pom.xml b/jhipster/jhipster-monolithic/pom.xml index 9708b83a70..e242668759 100644 --- a/jhipster/jhipster-monolithic/pom.xml +++ b/jhipster/jhipster-monolithic/pom.xml @@ -6,10 +6,9 @@ JHipster Monolithic Application - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../../parent-boot-1 + jhipster + com.baeldung.jhipster + 1.0.0-SNAPSHOT diff --git a/jhipster/pom.xml b/jhipster/pom.xml new file mode 100644 index 0000000000..2bf7bcb233 --- /dev/null +++ b/jhipster/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + com.baeldung.jhipster + jhipster + 1.0.0-SNAPSHOT + pom + JHipster + + + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 + + + + jhipster-monolithic + jhipster-microservice + + + diff --git a/jni/pom.xml b/jni/pom.xml index 274b9b58c3..d4cc409d33 100644 --- a/jni/pom.xml +++ b/jni/pom.xml @@ -1,21 +1,12 @@ 4.0.0 - com.baeldung jni - 0.0.1-SNAPSHOT - - - junit - junit - ${junit.version} - test - - - - - 4.8.1 - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + \ No newline at end of file diff --git a/jni/src/test/java/com/baeldung/jni/JNINativeTests.java b/jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java similarity index 98% rename from jni/src/test/java/com/baeldung/jni/JNINativeTests.java rename to jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java index 42e572d41b..8201945644 100644 --- a/jni/src/test/java/com/baeldung/jni/JNINativeTests.java +++ b/jni/src/test/java/com/baeldung/jni/JNINativeManualTest.java @@ -7,7 +7,7 @@ import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; -public class JNINativeTests { +public class JNINativeManualTest { @Before public void setup() { diff --git a/jooby/pom.xml b/jooby/pom.xml index 2867b7f4b6..83dd650701 100644 --- a/jooby/pom.xml +++ b/jooby/pom.xml @@ -1,60 +1,63 @@ - 4.0.0 - jooby - com.baeldung.jooby - 1.0 - jooby + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + 4.0.0 + jooby + com.baeldung.jooby + 1.0 + jooby - - org.jooby - modules - 1.1.3 - + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + - - - org.jooby - jooby-netty - - - org.jooby - jooby-jedis - ${jooby-jedis.version} - - - ch.qos.logback - logback-classic - - - junit - junit - test - - - io.rest-assured - rest-assured - test - - + + + + org.jooby + modules + ${jooby.version} + pom + + + - - - - org.apache.maven.plugins - maven-shade-plugin - ${maven-shade-plugin.version} - - - + + + org.jooby + jooby-netty + ${jooby.version} + + + org.jooby + jooby-jedis + ${jooby.version} + + + io.rest-assured + rest-assured + test + ${rest-assured.version} + + - - 1.1.3 - com.baeldung.jooby.App - 1.1.3 - - 2.4.3 - + + + + org.apache.maven.plugins + maven-shade-plugin + ${maven-shade-plugin.version} + + + + + + 1.1.3 + 3.1.1 + com.baeldung.jooby.App + 2.4.3 + diff --git a/jooby/src/test/java/com/baeldung/jooby/AppTest.java b/jooby/src/test/java/com/baeldung/jooby/AppUnitTest.java similarity index 96% rename from jooby/src/test/java/com/baeldung/jooby/AppTest.java rename to jooby/src/test/java/com/baeldung/jooby/AppUnitTest.java index af2626c046..ab7388f5f4 100644 --- a/jooby/src/test/java/com/baeldung/jooby/AppTest.java +++ b/jooby/src/test/java/com/baeldung/jooby/AppUnitTest.java @@ -9,7 +9,7 @@ import org.jooby.test.MockRouter; import org.junit.ClassRule; import org.junit.Test; -public class AppTest { +public class AppUnitTest { @ClassRule public static JoobyRule app = new JoobyRule(new App()); diff --git a/mustache/pom.xml b/mustache/pom.xml index d385246182..a276dfbf43 100644 --- a/mustache/pom.xml +++ b/mustache/pom.xml @@ -3,7 +3,6 @@ 4.0.0 mustache - 0.0.1-SNAPSHOT jar mustache @@ -24,10 +23,8 @@ org.assertj assertj-core - ${assertj.version} - log4j log4j @@ -55,13 +52,6 @@ ${datafactory.version} - - junit - junit - ${junit.version} - test - - @@ -73,90 +63,13 @@ - - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*LiveTest.java - **/AutoconfigurationTest.java - - - **/*IntegrationTest.java - **/*IntTest.java - - - - - - - json - - - - - - - - autoconfiguration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*LiveTest.java - **/*IntegrationTest.java - **/*IntTest.java - - - **/AutoconfigurationTest.java - - - - - - - json - - - - - - - - 0.9.2 - 3.7.0 1.2.16 - 4.12 - UTF-8 - 3.7.0 - 2.21.0 0.8 3.3.7 - 1.8 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4ffd9ba4a4..8f6ef4e983 100644 --- a/pom.xml +++ b/pom.xml @@ -398,7 +398,7 @@ javafx jgroups jee-7 - jhipster/jhipster-monolithic + jhipster jjwt jsf json-path @@ -1383,7 +1383,7 @@ parent-kotlin libraries geotools - jhipster/jhipster-monolithic + jhipster testing-modules/gatling spring-boot spring-boot-ops From 9d8b90794e2ae6ed4c189e612d24fdae6277bc89 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Tue, 25 Sep 2018 23:22:58 +0530 Subject: [PATCH 21/56] BAEL-8962 Fix surefire configs of twitterhdfs, spring cloud projects - Surefire config fixes - pom fixes and standardization - test names standardization - added packaging pom at spring-cloud-bus and spring-cloud/spring-cloud-task level --- pom.xml | 7 +- spring-5-data-reactive/pom.xml | 42 ------- spring-cloud-bus/pom.xml | 39 +++++++ .../spring-cloud-config-client/pom.xml | 107 +++++++----------- .../spring-cloud-config-server/pom.xml | 107 +++++++----------- ...nfigServerApplicationIntegrationTest.java} | 2 +- spring-cloud/pom.xml | 1 + .../spring-cloud-config/client/pom.xml | 11 +- .../spring-cloud-config/server/pom.xml | 18 +-- .../twitterhdfs/pom.xml | 11 +- spring-cloud/spring-cloud-task/pom.xml | 46 ++++++++ .../springcloudtaskbatch/pom.xml | 26 +---- .../springcloudtasksink/pom.xml | 40 +------ ...udTaskSinkApplicationIntegrationTest.java} | 2 +- spring-data-keyvalue/pom.xml | 7 -- spring-mustache/pom.xml | 5 - ...ngMustacheApplicationIntegrationTest.java} | 2 +- 17 files changed, 196 insertions(+), 277 deletions(-) create mode 100644 spring-cloud-bus/pom.xml rename spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/{SpringCloudConfigServerApplicationTests.java => SpringCloudConfigServerApplicationIntegrationTest.java} (81%) create mode 100644 spring-cloud/spring-cloud-task/pom.xml rename spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/{SpringCloudTaskSinkApplicationTests.java => SpringCloudTaskSinkApplicationIntegrationTest.java} (97%) rename spring-mustache/src/test/java/com/baeldung/springmustache/{SpringMustacheApplicationTests.java => SpringMustacheApplicationIntegrationTest.java} (94%) diff --git a/pom.xml b/pom.xml index 4ffd9ba4a4..519166ca6e 100644 --- a/pom.xml +++ b/pom.xml @@ -475,6 +475,7 @@ spring-boot-logging-log4j2 spring-cloud-data-flow spring-cloud + spring-cloud-bus spring-core spring-cucumber spring-ejb @@ -640,7 +641,7 @@ spring-data-rest-querydsl spring-mobile - + spring-mustache spring-mvc-simple spring-rest-hal-browser @@ -822,6 +823,7 @@ spring-boot-logging-log4j2 spring-cloud-data-flow spring-cloud + spring-cloud-bus spring-core spring-cucumber spring-ejb @@ -957,7 +959,7 @@ spring-data-rest-querydsl spring-mobile - + spring-mustache spring-mvc-simple spring-rest-hal-browser @@ -1176,6 +1178,7 @@ spring-boot-logging-log4j2 spring-cloud-data-flow spring-cloud + spring-cloud-bus spring-core spring-cucumber spring-ejb diff --git a/spring-5-data-reactive/pom.xml b/spring-5-data-reactive/pom.xml index e4dd454635..b8ba3f12ff 100644 --- a/spring-5-data-reactive/pom.xml +++ b/spring-5-data-reactive/pom.xml @@ -62,28 +62,6 @@ spring-boot-starter-test test - - - org.junit.jupiter - junit-jupiter-api - - - org.junit.jupiter - junit-jupiter-engine - test - - - org.junit.platform - junit-platform-surefire-provider - ${junit.platform.version} - test - - - org.junit.platform - junit-platform-runner - ${junit.platform.version} - test - @@ -175,32 +153,12 @@ - - org.apache.maven.plugins - maven-surefire-plugin - - 3 - true - methods - true - - **/*IntegrationTest.java - **/*IntTest.java - **/*LiveTest.java - - - - UTF-8 - UTF-8 - 1.8 1.2.40 1.2.40 - 1.0.0 - 5.0.2 diff --git a/spring-cloud-bus/pom.xml b/spring-cloud-bus/pom.xml new file mode 100644 index 0000000000..d493c4e984 --- /dev/null +++ b/spring-cloud-bus/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + com.baeldung.spring.cloud + spring-cloud-bus + 1.0.0-SNAPSHOT + pom + + + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../parent-boot-1 + + + + spring-cloud-config-client + spring-cloud-config-server + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud-dependencies.version} + pom + import + + + + + + Brixton.SR7 + + + diff --git a/spring-cloud-bus/spring-cloud-config-client/pom.xml b/spring-cloud-bus/spring-cloud-config-client/pom.xml index bd9fb45587..b2b69303bf 100644 --- a/spring-cloud-bus/spring-cloud-config-client/pom.xml +++ b/spring-cloud-bus/spring-cloud-config-client/pom.xml @@ -1,76 +1,53 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + spring-cloud-config-client + jar - com.baeldung.spring.cloud - spring-cloud-config-client - 0.0.1-SNAPSHOT - jar + spring-cloud-config-client + Demo Spring Cloud Config Client - spring-cloud-config-client - Demo Spring Cloud Config Client + + spring-cloud-bus + com.baeldung.spring.cloud + 1.0.0-SNAPSHOT + - - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../../parent-boot-1 - + + + org.springframework.cloud + spring-cloud-starter-config + + + org.springframework.boot + spring-boot-starter-web + - - - org.springframework.cloud - spring-cloud-starter-config - - - org.springframework.boot - spring-boot-starter-web - + + org.springframework.boot + spring-boot-starter-test + test + - - org.springframework.boot - spring-boot-starter-test - test - + + org.springframework.boot + spring-boot-actuator + - - org.springframework.boot - spring-boot-actuator - + + org.springframework.cloud + spring-cloud-starter-bus-amqp + + - - org.springframework.cloud - spring-cloud-starter-bus-amqp - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - UTF-8 - UTF-8 - 1.8 - Dalston.SR1 - + + + + org.springframework.boot + spring-boot-maven-plugin + + + diff --git a/spring-cloud-bus/spring-cloud-config-server/pom.xml b/spring-cloud-bus/spring-cloud-config-server/pom.xml index 194289ea1e..f50b78ff18 100644 --- a/spring-cloud-bus/spring-cloud-config-server/pom.xml +++ b/spring-cloud-bus/spring-cloud-config-server/pom.xml @@ -1,77 +1,54 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + spring-cloud-config-server + jar - com.baeldung.spring.cloud - spring-cloud-config-server - 0.0.1-SNAPSHOT - jar + spring-cloud-config-server + Demo Spring Cloud Config Server - spring-cloud-config-server - Demo Spring Cloud Config Server + + spring-cloud-bus + com.baeldung.spring.cloud + 1.0.0-SNAPSHOT + - - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../../parent-boot-1 - + + + org.springframework.cloud + spring-cloud-config-server + - - - org.springframework.cloud - spring-cloud-config-server - + + org.springframework.boot + spring-boot-starter-security + - - org.springframework.boot - spring-boot-starter-security - + + org.springframework.boot + spring-boot-starter-test + test + - - org.springframework.boot - spring-boot-starter-test - test - + + org.springframework.cloud + spring-cloud-config-monitor + - - org.springframework.cloud - spring-cloud-config-monitor - + + org.springframework.cloud + spring-cloud-starter-stream-rabbit + + - - org.springframework.cloud - spring-cloud-starter-stream-rabbit - - - - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - - - - - - UTF-8 - UTF-8 - 1.8 - Dalston.SR1 - + + + + org.springframework.boot + spring-boot-maven-plugin + + + diff --git a/spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationTests.java b/spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationIntegrationTest.java similarity index 81% rename from spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationTests.java rename to spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationIntegrationTest.java index 3969c7ba2d..12e0928ad8 100644 --- a/spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationTests.java +++ b/spring-cloud-bus/spring-cloud-config-server/src/test/java/com/baeldung/SpringCloudConfigServerApplicationIntegrationTest.java @@ -7,7 +7,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest -public class SpringCloudConfigServerApplicationTests { +public class SpringCloudConfigServerApplicationIntegrationTest { @Test public void contextLoads() { diff --git a/spring-cloud/pom.xml b/spring-cloud/pom.xml index d0095e9a8a..924ea2be36 100644 --- a/spring-cloud/pom.xml +++ b/spring-cloud/pom.xml @@ -36,6 +36,7 @@ spring-cloud-functions spring-cloud-vault spring-cloud-security + spring-cloud-task diff --git a/spring-cloud/spring-cloud-config/client/pom.xml b/spring-cloud/spring-cloud-config/client/pom.xml index bd8c817256..800a496a82 100644 --- a/spring-cloud/spring-cloud-config/client/pom.xml +++ b/spring-cloud/spring-cloud-config/client/pom.xml @@ -15,18 +15,15 @@ org.springframework.cloud spring-cloud-starter-config - ${spring-cloud-starter-config.version} - + org.springframework.boot spring-boot-starter-web - ${org.springframework.boot.version} - + org.springframework.boot spring-boot-starter-test - ${org.springframework.boot.version} test @@ -40,8 +37,4 @@ - - 1.2.2.RELEASE - 1.4.2.RELEASE - diff --git a/spring-cloud/spring-cloud-config/server/pom.xml b/spring-cloud/spring-cloud-config/server/pom.xml index 61b27244b6..7bbb903cf9 100644 --- a/spring-cloud/spring-cloud-config/server/pom.xml +++ b/spring-cloud/spring-cloud-config/server/pom.xml @@ -15,23 +15,19 @@ org.springframework.cloud spring-cloud-config-server - ${spring-cloud-config-server.version} - + org.springframework.boot spring-boot-starter-security - ${org.springframework.boot.version} - + org.springframework.boot spring-boot-starter-web - ${org.springframework.boot.version} - + org.springframework.boot spring-boot-starter-test - ${org.springframework.boot.version} test @@ -41,14 +37,8 @@ org.springframework.boot spring-boot-maven-plugin - ${org.springframework.boot.version} - + - - 1.2.2.RELEASE - 1.4.2.RELEASE - - diff --git a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml index bf725da5cf..6f582576d8 100644 --- a/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml +++ b/spring-cloud/spring-cloud-stream-starters/twitterhdfs/pom.xml @@ -1,11 +1,11 @@ - - + + 4.0.0 com.baeldung.twitterhdfs twitterhdfs jar - 1.0.0 + 1.0.0-SNAPSHOT twitterhdfs @@ -45,9 +45,6 @@ - UTF-8 - UTF-8 - 1.8 1.3.1.RELEASE diff --git a/spring-cloud/spring-cloud-task/pom.xml b/spring-cloud/spring-cloud-task/pom.xml new file mode 100644 index 0000000000..ef76d464bc --- /dev/null +++ b/spring-cloud/spring-cloud-task/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + com.baeldung.spring.cloud + spring-cloud-task + 1.0.0-SNAPSHOT + pom + + + parent-boot-1 + com.baeldung + 0.0.1-SNAPSHOT + ../../parent-boot-1 + + + + springcloudtaskbatch + springcloudtasksink + + + + + + org.springframework.cloud + spring-cloud-task-dependencies + ${spring-cloud-task.version} + pom + import + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud-dependencies.version} + pom + import + + + + + + Brixton.SR7 + 1.2.2.RELEASE + + + diff --git a/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml b/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml index f97d78099f..89c9318c4e 100644 --- a/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml +++ b/spring-cloud/spring-cloud-task/springcloudtaskbatch/pom.xml @@ -3,14 +3,12 @@ 4.0.0 org.baeldung.cloud springcloudtaskbatch - 0.0.1-SNAPSHOT - springcloudtaskbatch + springcloudtaskbatch - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../../../parent-boot-1 + spring-cloud-task + com.baeldung.spring.cloud + 1.0.0-SNAPSHOT @@ -47,18 +45,6 @@ - - - - org.springframework.cloud - spring-cloud-task-dependencies - ${spring-cloud-task.version} - pom - import - - - - @@ -70,10 +56,6 @@ com.baeldung.TaskDemo - UTF-8 - UTF-8 - 1.8 - 1.2.2.RELEASE diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml index fdcbabdd51..ca0de342a9 100644 --- a/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml +++ b/spring-cloud/spring-cloud-task/springcloudtasksink/pom.xml @@ -2,19 +2,15 @@ 4.0.0 - - com.baeldung SpringCloudTaskSink - 0.0.1-SNAPSHOT jar SpringCloudTaskSink Demo project for Spring Boot - - parent-boot-1 - com.baeldung - 0.0.1-SNAPSHOT - ../../../parent-boot-1 + + spring-cloud-task + com.baeldung.spring.cloud + 1.0.0-SNAPSHOT @@ -36,11 +32,6 @@ spring-boot-starter-test test - - org.springframework.boot - spring-boot-starter-test - test - org.springframework.cloud @@ -49,25 +40,6 @@ - - - - org.springframework.cloud - spring-cloud-task-dependencies - ${spring-cloud-task.version} - pom - import - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - - - @@ -78,11 +50,7 @@ - UTF-8 - UTF-8 - 1.8 1.2.2.RELEASE - Edgware.SR2 1.3.0.RELEASE diff --git a/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationTests.java b/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationIntegrationTest.java similarity index 97% rename from spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationTests.java rename to spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationIntegrationTest.java index 1f47eada14..104c04138e 100644 --- a/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationTests.java +++ b/spring-cloud/spring-cloud-task/springcloudtasksink/src/test/java/com/baeldung/SpringCloudTaskFinal/SpringCloudTaskSinkApplicationIntegrationTest.java @@ -24,7 +24,7 @@ import static org.mockito.Mockito.verify; @RunWith(SpringRunner.class) @SpringBootTest( classes = SpringCloudTaskSinkApplication.class) -public class SpringCloudTaskSinkApplicationTests { +public class SpringCloudTaskSinkApplicationIntegrationTest { @Autowired ApplicationContext context; diff --git a/spring-data-keyvalue/pom.xml b/spring-data-keyvalue/pom.xml index 6ab928303d..edd8967b97 100644 --- a/spring-data-keyvalue/pom.xml +++ b/spring-data-keyvalue/pom.xml @@ -1,9 +1,7 @@ 4.0.0 - com.baeldung spring-data-keyvalue - 1.0 parent-boot-2 @@ -13,7 +11,6 @@ - org.springframework.boot spring-boot-starter @@ -30,8 +27,4 @@ - - 2.0.3.RELEASE - - \ No newline at end of file diff --git a/spring-mustache/pom.xml b/spring-mustache/pom.xml index 4e7a1ba5a3..9e4c528ee0 100644 --- a/spring-mustache/pom.xml +++ b/spring-mustache/pom.xml @@ -3,9 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.baeldung spring-mustache - 0.0.1-SNAPSHOT jar spring-mustache Demo project for Spring Boot @@ -50,9 +48,6 @@ - UTF-8 - UTF-8 - 1.8 3.3.7 0.8 diff --git a/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationTests.java b/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationIntegrationTest.java similarity index 94% rename from spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationTests.java rename to spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationIntegrationTest.java index 9138dfe92b..1eecf58986 100644 --- a/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationTests.java +++ b/spring-mustache/src/test/java/com/baeldung/springmustache/SpringMustacheApplicationIntegrationTest.java @@ -13,7 +13,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) -public class SpringMustacheApplicationTests { +public class SpringMustacheApplicationIntegrationTest { @Autowired private TestRestTemplate restTemplate; From 73cbbd502c103dd766f15b3b86a8741e2764cd78 Mon Sep 17 00:00:00 2001 From: Eugen Paraschiv Date: Tue, 25 Sep 2018 21:09:00 +0300 Subject: [PATCH 22/56] small asciidoctor project fixes --- asciidoctor/pom.xml | 7 ++++--- ...orDemoTest.java => AsciidoctorDemoIntegrationTest.java} | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) rename asciidoctor/src/test/java/com/baeldung/asciidoctor/{AsciidoctorDemoTest.java => AsciidoctorDemoIntegrationTest.java} (89%) diff --git a/asciidoctor/pom.xml b/asciidoctor/pom.xml index 15de5ac913..42ee544eb0 100644 --- a/asciidoctor/pom.xml +++ b/asciidoctor/pom.xml @@ -61,9 +61,10 @@ - 1.5.5 - 1.5.4 - 1.5.0-alpha.11 + 1.5.6 + 1.5.6 + + 1.5.0-alpha.15 1.5.0-alpha.15 diff --git a/asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoTest.java b/asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoIntegrationTest.java similarity index 89% rename from asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoTest.java rename to asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoIntegrationTest.java index 3e312eb059..c4129e6441 100644 --- a/asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoTest.java +++ b/asciidoctor/src/test/java/com/baeldung/asciidoctor/AsciidoctorDemoIntegrationTest.java @@ -3,7 +3,7 @@ package com.baeldung.asciidoctor; import org.junit.Assert; import org.junit.Test; -public class AsciidoctorDemoTest { +public class AsciidoctorDemoIntegrationTest { @Test public void givenString_whenConverting_thenResultingHTMLCode() { From 676fb7c8429dbac59175e7d0fcbedd2c0f7dd27c Mon Sep 17 00:00:00 2001 From: vizsoro Date: Tue, 25 Sep 2018 22:56:14 +0200 Subject: [PATCH 23/56] updated dependencies --- spring-boot-mvc/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml index bf90f8f57c..37d4698f0e 100644 --- a/spring-boot-mvc/pom.xml +++ b/spring-boot-mvc/pom.xml @@ -25,7 +25,7 @@ com.sun.faces jsf-api - 2.2.9 + 2.2.18 org.apache.tomcat.embed @@ -34,7 +34,7 @@ javax.faces javax.faces-api - 2.1 + 2.3 javax.servlet @@ -44,7 +44,7 @@ com.sun.faces jsf-impl - 2.2.8-02 + 2.2.18 From 9d5ad201dd7a9baf96aeab0027c6a85974ae4b1a Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Tue, 25 Sep 2018 21:04:50 -0400 Subject: [PATCH 24/56] Reverting the test failing the travis build due to compilation issue --- .../baeldung/SpringContextIntegrationTest.java | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 spring-mvc-java/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/spring-mvc-java/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-java/src/test/java/org/baeldung/SpringContextIntegrationTest.java deleted file mode 100644 index 6174dac010..0000000000 --- a/spring-mvc-java/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.baeldung; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.test.context.junit4.SpringRunner; - -import com.baeldung.app.Application; -import com.baeldung.rss.RssFeedApplication; - -@RunWith(SpringRunner.class) -@SpringBootTest(classes = {Application.class, RssFeedApplication.class}) -public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } -} From 0edea763ca749975e1998c75434cae8e8682d73c Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Tue, 25 Sep 2018 22:52:38 -0400 Subject: [PATCH 25/56] Fixed the travis build --- .../test/java/org/baeldung/SpringContextIntegrationTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java index ff07d04c30..c1e9b71550 100644 --- a/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-mvc-forms-jsp/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,5 +1,7 @@ package org.baeldung; +import com.baeldung.springmvcforms.configuration.ApplicationConfiguration; + import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; From 618277200b80d93a2e892b3206cc5e8077f95807 Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Tue, 25 Sep 2018 23:31:40 -0400 Subject: [PATCH 26/56] Fixed travis build --- .../springmvcforms/configuration/ApplicationConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-mvc-forms-jsp/src/main/java/com/baeldung/springmvcforms/configuration/ApplicationConfiguration.java b/spring-mvc-forms-jsp/src/main/java/com/baeldung/springmvcforms/configuration/ApplicationConfiguration.java index b8b36df84e..2b2844e0de 100644 --- a/spring-mvc-forms-jsp/src/main/java/com/baeldung/springmvcforms/configuration/ApplicationConfiguration.java +++ b/spring-mvc-forms-jsp/src/main/java/com/baeldung/springmvcforms/configuration/ApplicationConfiguration.java @@ -14,7 +14,7 @@ import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration @EnableWebMvc @ComponentScan(basePackages = {"com.baeldung.springmvcforms", "com.baeldung.jstl"}) -class ApplicationConfiguration implements WebMvcConfigurer { +public class ApplicationConfiguration implements WebMvcConfigurer { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { From 42f4355c18d924f083dff07eb181bdce50aa0fcd Mon Sep 17 00:00:00 2001 From: Eugen Date: Wed, 26 Sep 2018 18:27:27 +0300 Subject: [PATCH 27/56] Update README.md --- asciidoctor/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/asciidoctor/README.md b/asciidoctor/README.md index aafd0bca17..2124907e87 100644 --- a/asciidoctor/README.md +++ b/asciidoctor/README.md @@ -1,5 +1,4 @@ ### Relevant articles -- [Introduction to Asciidoctor](http://www.baeldung.com/introduction-to-asciidoctor) - [Generating a Book with Asciidoctor](http://www.baeldung.com/asciidoctor-book) - [Introduction to Asciidoctor in Java](http://www.baeldung.com/asciidoctor) From c34f132cfef274fbb3689db8e7e2722fa1f67085 Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Thu, 27 Sep 2018 08:54:14 +0530 Subject: [PATCH 28/56] Update pom.xml --- spring-5-data-reactive/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/spring-5-data-reactive/pom.xml b/spring-5-data-reactive/pom.xml index b8ba3f12ff..5c723c6e29 100644 --- a/spring-5-data-reactive/pom.xml +++ b/spring-5-data-reactive/pom.xml @@ -162,3 +162,4 @@ + From 4cbc8d0bac5fb46f06c9dd4b20077e7a1bbeecf5 Mon Sep 17 00:00:00 2001 From: charlesgonzales <39999268+charlesgonzales@users.noreply.github.com> Date: Thu, 27 Sep 2018 15:09:58 +0800 Subject: [PATCH 29/56] To add/fix links (Team Jira BAEL-9015) (#5332) * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.MD * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * Create README.md * Create README.md * Update README.md * Update README.MD * Update README.md * Update README.md * Update README.md * Update README.md --- algorithms/README.md | 4 ++++ core-java-collections/README.md | 4 +++- core-java-io/README.md | 1 + core-java/README.md | 1 + core-kotlin/README.md | 5 ++++- hibernate5/README.md | 1 + java-strings/README.md | 3 +++ jersey/README.md | 1 + jta/README.md | 2 ++ lombok/README.md | 2 ++ optaplanner/README.md | 2 +- ratpack/README.md | 2 +- spring-5-reactive/README.md | 1 + spring-boot-bootstrap/README.md | 1 + spring-boot-security/README.md | 2 ++ spring-boot/README.MD | 1 + spring-data-jpa/README.md | 3 +++ spring-mvc-java/README.md | 2 ++ spring-security-mvc-boot/README.MD | 1 + spring-security-mvc-socket/README.md | 2 +- spring-vault/README.md | 2 ++ 21 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 jta/README.md create mode 100644 spring-vault/README.md diff --git a/algorithms/README.md b/algorithms/README.md index 47ddd7028a..9b3bbcdee5 100644 --- a/algorithms/README.md +++ b/algorithms/README.md @@ -24,3 +24,7 @@ - [Practical Java Examples of the Big O Notation](http://www.baeldung.com/java-algorithm-complexity) - [Find the Middle Element of a Linked List](http://www.baeldung.com/java-linked-list-middle-element) - [An Introduction to the Theory of Big-O Notation](http://www.baeldung.com/big-o-notation) +- [Check If Two Rectangles Overlap In Java](https://www.baeldung.com/java-check-if-two-rectangles-overlap) +- [Calculate the Distance Between Two Points in Java](https://www.baeldung.com/java-distance-between-two-points) +- [Find the Intersection of Two Lines in Java](https://www.baeldung.com/java-intersection-of-two-lines) +- [Check If a String Contains All The Letters of The Alphabet](https://www.baeldung.com/java-string-contains-all-letters) diff --git a/core-java-collections/README.md b/core-java-collections/README.md index f187141712..ca275d7c09 100644 --- a/core-java-collections/README.md +++ b/core-java-collections/README.md @@ -48,4 +48,6 @@ - [Thread Safe LIFO Data Structure Implementations](https://www.baeldung.com/java-lifo-thread-safe) - [Collections.emptyList() vs. New List Instance](https://www.baeldung.com/java-collections-emptylist-new-list) - [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) -- [](https://www.baeldung.com/java-hashset-arraylist-contains-performance) +- [Performance of contains() in a HashSet vs ArrayList](https://www.baeldung.com/java-hashset-arraylist-contains-performance) +- [Get the Key for a Value from a Java Map](https://www.baeldung.com/java-map-key-from-value) +- [Time Complexity of Java Collections](https://www.baeldung.com/java-collections-complexity) diff --git a/core-java-io/README.md b/core-java-io/README.md index 17c93d9739..58e331b6fc 100644 --- a/core-java-io/README.md +++ b/core-java-io/README.md @@ -31,3 +31,4 @@ - [Create a Symbolic Link with Java](http://www.baeldung.com/java-symlink) - [Quick Use of FilenameFilter](http://www.baeldung.com/java-filename-filter) - [Initialize a HashMap in Java](https://www.baeldung.com/java-initialize-hashmap) +- [ Read a File into an ArrayList](https://www.baeldung.com/java-file-to-arraylist) diff --git a/core-java/README.md b/core-java/README.md index ade7f46504..fbfcb1117c 100644 --- a/core-java/README.md +++ b/core-java/README.md @@ -151,3 +151,4 @@ - [ClassCastException: Arrays$ArrayList cannot be cast to ArrayList](https://www.baeldung.com/java-classcastexception-arrays-arraylist) - [Throw Exception in Optional in Java 8](https://www.baeldung.com/java-optional-throw-exception) - [Add a Character to a String at a Given Position](https://www.baeldung.com/java-add-character-to-string) +- [Synthetic Constructs in Java](https://www.baeldung.com/java-synthetic) diff --git a/core-kotlin/README.md b/core-kotlin/README.md index f63451bc02..7d8d5213d1 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -33,4 +33,7 @@ - [Idiomatic Logging in Kotlin](http://www.baeldung.com/kotlin-logging) - [Kotlin Constructors](https://www.baeldung.com/kotlin-constructors) - [Creational Design Patterns in Kotlin: Builder](https://www.baeldung.com/kotlin-builder-pattern) -- [Kotlin Nested and Inner Classes](https://www.baeldung.com/kotlin-inner-classes) \ No newline at end of file +- [Kotlin Nested and Inner Classes](https://www.baeldung.com/kotlin-inner-classes) +- [Kotlin with Ktor](https://www.baeldung.com/kotlin-ktor) +- [Fuel HTTP Library with Kotlin](https://www.baeldung.com/kotlin-fuel) +- [Introduction to Kovenant Library for Kotlin](https://www.baeldung.com/kotlin-kovenant) diff --git a/hibernate5/README.md b/hibernate5/README.md index 8f2f8eb469..b67ab7115f 100644 --- a/hibernate5/README.md +++ b/hibernate5/README.md @@ -14,3 +14,4 @@ - [Bootstrapping JPA Programmatically in Java](http://www.baeldung.com/java-bootstrap-jpa) - [Optimistic Locking in JPA](http://www.baeldung.com/jpa-optimistic-locking) - [Hibernate Entity Lifecycle](https://www.baeldung.com/hibernate-entity-lifecycle) +- [@JoinColumn Annotation Explained](https://www.baeldung.com/jpa-join-column) diff --git a/java-strings/README.md b/java-strings/README.md index 233d986d98..249f1a351a 100644 --- a/java-strings/README.md +++ b/java-strings/README.md @@ -27,3 +27,6 @@ - [Compact Strings in Java 9](http://www.baeldung.com/java-9-compact-string) - [Java Check a String for Lowercase/Uppercase Letter, Special Character and Digit](https://www.baeldung.com/java-lowercase-uppercase-special-character-digit-regex) - [Convert java.util.Date to String](https://www.baeldung.com/java-util-date-to-string) +- [Converting a Stack Trace to a String in Java](https://www.baeldung.com/java-stacktrace-to-string) +- [Sorting a String Alphabetically in Java](https://www.baeldung.com/java-sort-string-alphabetically) +- [Remove Emojis from a Java String](https://www.baeldung.com/java-string-remove-emojis) diff --git a/jersey/README.md b/jersey/README.md index 3121c560cf..1a7b541e92 100644 --- a/jersey/README.md +++ b/jersey/README.md @@ -1,2 +1,3 @@ - [Jersey Filters and Interceptors](http://www.baeldung.com/jersey-filters-interceptors) - [Jersey MVC Support](https://www.baeldung.com/jersey-mvc) +- [Set a Response Body in JAX-RS](https://www.baeldung.com/jax-rs-response) diff --git a/jta/README.md b/jta/README.md new file mode 100644 index 0000000000..445a291c8f --- /dev/null +++ b/jta/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Guide to Java EE JTA](https://www.baeldung.com/jee-jta) diff --git a/lombok/README.md b/lombok/README.md index 1a787e32c7..d12c14416d 100644 --- a/lombok/README.md +++ b/lombok/README.md @@ -1,3 +1,5 @@ ## Relevant Articles: - [Introduction to Project Lombok](http://www.baeldung.com/intro-to-project-lombok) - [Using Lombok’s @Builder Annotation](http://www.baeldung.com/lombok-builder) +- [Using Lombok’s @Getter for Boolean Fields](https://www.baeldung.com/lombok-getter-boolean) +- [Lombok @Builder with Inheritance](https://www.baeldung.com/lombok-builder-inheritance) diff --git a/optaplanner/README.md b/optaplanner/README.md index d793be1f2a..1568a615c0 100644 --- a/optaplanner/README.md +++ b/optaplanner/README.md @@ -1,3 +1,3 @@ ### Relevant articles -- [Guide to OptaPlanner](https://www.baeldung.com/opta-planner) +- [A Guide to OptaPlanner](https://www.baeldung.com/opta-planner) diff --git a/ratpack/README.md b/ratpack/README.md index 02b91da0bd..dded42fab6 100644 --- a/ratpack/README.md +++ b/ratpack/README.md @@ -4,4 +4,4 @@ - [Ratpack Google Guice Integration](http://www.baeldung.com/ratpack-google-guice) - [Ratpack Integration with Spring Boot](http://www.baeldung.com/ratpack-spring-boot) - [Ratpack with Hystrix](http://www.baeldung.com/ratpack-hystrix) - +- [Ratpack HTTP Client](https://www.baeldung.com/ratpack-http-client) diff --git a/spring-5-reactive/README.md b/spring-5-reactive/README.md index 0665eb4f57..7977fd820f 100644 --- a/spring-5-reactive/README.md +++ b/spring-5-reactive/README.md @@ -13,3 +13,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [How to Set a Header on a Response with Spring 5](http://www.baeldung.com/spring-response-header) - [Spring Webflux and CORS](http://www.baeldung.com/spring-webflux-cors) - [Handling Errors in Spring WebFlux](http://www.baeldung.com/spring-webflux-errors) +- [Server-Sent Events in Spring](https://www.baeldung.com/spring-server-sent-events) diff --git a/spring-boot-bootstrap/README.md b/spring-boot-bootstrap/README.md index 519b36ce4f..4b09f11714 100644 --- a/spring-boot-bootstrap/README.md +++ b/spring-boot-bootstrap/README.md @@ -2,3 +2,4 @@ - [Bootstrap a Simple Application using Spring Boot](http://www.baeldung.com/spring-boot-start) - [Spring Boot Dependency Management with a Custom Parent](http://www.baeldung.com/spring-boot-dependency-management-custom-parent) - [Thin JARs with Spring Boot](http://www.baeldung.com/spring-boot-thin-jar) +- [Deploying a Spring Boot Application to Cloud Foundry](https://www.baeldung.com/spring-boot-app-deploy-to-cloud-foundry) diff --git a/spring-boot-security/README.md b/spring-boot-security/README.md index a79e7de610..30a3218672 100644 --- a/spring-boot-security/README.md +++ b/spring-boot-security/README.md @@ -9,3 +9,5 @@ ### Relevant Articles: - [Spring Boot Security Auto-Configuration](http://www.baeldung.com/spring-boot-security-autoconfiguration) +- [Spring Security for Spring Boot Integration Tests](https://www.baeldung.com/spring-security-integration-tests) +- [Introduction to Spring Security Taglibs](https://www.baeldung.com/spring-security-taglibs) diff --git a/spring-boot/README.MD b/spring-boot/README.MD index 54382992d4..192c4f9fed 100644 --- a/spring-boot/README.MD +++ b/spring-boot/README.MD @@ -33,3 +33,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Container Configuration in Spring Boot 2](http://www.baeldung.com/embeddedservletcontainercustomizer-configurableembeddedservletcontainer-spring-boot) - [Introduction to Chaos Monkey](https://www.baeldung.com/spring-boot-chaos-monkey) - [Spring Component Scanning](https://www.baeldung.com/spring-component-scanning) +- [Load Spring Boot Properties From a JSON File](https://www.baeldung.com/spring-boot-json-properties) diff --git a/spring-data-jpa/README.md b/spring-data-jpa/README.md index 20e9d41839..8817020eec 100644 --- a/spring-data-jpa/README.md +++ b/spring-data-jpa/README.md @@ -11,6 +11,9 @@ - [Spring Data Java 8 Support](http://www.baeldung.com/spring-data-java-8) - [A Simple Tagging Implementation with JPA](http://www.baeldung.com/jpa-tagging) - [Spring Data Composable Repositories](https://www.baeldung.com/spring-data-composable-repositories) +- [Auditing with JPA, Hibernate, and Spring Data JPA](https://www.baeldung.com/database-auditing-jpa) +- [Query Entities by Dates and Times with Spring Data JPA](https://www.baeldung.com/spring-data-jpa-query-by-date) +- [DDD Aggregates and @DomainEvents](https://www.baeldung.com/spring-data-ddd) ### Eclipse Config After importing the project into Eclipse, you may see the following error: diff --git a/spring-mvc-java/README.md b/spring-mvc-java/README.md index 44b1d65bc8..3a580202cf 100644 --- a/spring-mvc-java/README.md +++ b/spring-mvc-java/README.md @@ -30,3 +30,5 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [A Quick Example of Spring Websockets’ @SendToUser Annotation](http://www.baeldung.com/spring-websockets-sendtouser) - [Using Spring ResponseEntity to Manipulate the HTTP Response](http://www.baeldung.com/spring-response-entity) - [Using Spring @ResponseStatus to Set HTTP Status Code](http://www.baeldung.com/spring-response-status) +- [Bootstrap a Web Application with Spring 5](https://www.baeldung.com/bootstraping-a-web-application-with-spring-and-java-based-configuration) +- [Spring MVC Tutorial](https://www.baeldung.com/spring-mvc-tutorial) diff --git a/spring-security-mvc-boot/README.MD b/spring-security-mvc-boot/README.MD index eec61f087f..6bd9b9295c 100644 --- a/spring-security-mvc-boot/README.MD +++ b/spring-security-mvc-boot/README.MD @@ -10,3 +10,4 @@ The "REST With Spring" Classes: http://github.learnspringsecurity.com - [Multiple Authentication Providers in Spring Security](http://www.baeldung.com/spring-security-multiple-auth-providers) - [Granted Authority Versus Role in Spring Security](http://www.baeldung.com/spring-security-granted-authority-vs-role) - [Spring Data with Spring Security](https://www.baeldung.com/spring-data-security) +- [Spring Security – Whitelist IP Range](https://www.baeldung.com/spring-security-whitelist-ip-range) diff --git a/spring-security-mvc-socket/README.md b/spring-security-mvc-socket/README.md index 3daf9199e6..6c2ad7b985 100644 --- a/spring-security-mvc-socket/README.md +++ b/spring-security-mvc-socket/README.md @@ -7,4 +7,4 @@ To login, use credentials from the data.sql file in src/main/resource, eg: user/ ### Relevant Articles: - [Intro to Security and WebSockets](http://www.baeldung.com/spring-security-websockets) -- [Spring WebSockets: Specific User Chat](https://www.baeldung.com/spring-websockets-send-message-to-user) +- [Spring WebSockets: Build an User Chat](https://www.baeldung.com/spring-websockets-send-message-to-user) diff --git a/spring-vault/README.md b/spring-vault/README.md new file mode 100644 index 0000000000..8db065a3dd --- /dev/null +++ b/spring-vault/README.md @@ -0,0 +1,2 @@ +### Relevant Articles: +- [Spring Vault](https://www.baeldung.com/spring-vault) From 2224e723fde126f86f0bb62dc426612c1e1baefd Mon Sep 17 00:00:00 2001 From: Mher Baghinyan Date: Thu, 27 Sep 2018 21:02:28 +0400 Subject: [PATCH 30/56] Bael 2053 (#5331) * String performance class * String intern performance * String performance replace * String performance concat * String performance split * String performance convert * String performance comparison * String performance == * String performance check length * String performance * String performance matches * String performance hints * String performance %d * fixing benchmark tests * String performance final * method naming convention fix * renaming class name * remove loops * String performance review checked * remove methods * remove unnecessary class after the merge * Delete pom.xml --- .../baeldung/string/StringPerformance.java | 85 +++++++---- .../string/StringPerformanceHints.java | 133 ------------------ 2 files changed, 59 insertions(+), 159 deletions(-) delete mode 100644 java-strings/src/main/java/com/baeldung/string/StringPerformanceHints.java diff --git a/java-strings/src/main/java/com/baeldung/string/StringPerformance.java b/java-strings/src/main/java/com/baeldung/string/StringPerformance.java index 4873bd320c..3b0c32991c 100644 --- a/java-strings/src/main/java/com/baeldung/string/StringPerformance.java +++ b/java-strings/src/main/java/com/baeldung/string/StringPerformance.java @@ -1,23 +1,43 @@ package com.baeldung.string; +import com.google.common.base.Splitter; import org.apache.commons.lang3.StringUtils; import org.openjdk.jmh.annotations.*; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; +import java.util.ArrayList; import java.util.List; +import java.util.StringTokenizer; import java.util.concurrent.TimeUnit; +import java.util.regex.Pattern; @BenchmarkMode(Mode.SingleShotTime) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Measurement(batchSize = 10000, iterations = 10) -@Warmup(batchSize = 10000, iterations = 10) -public class StringPerformance extends StringPerformanceHints { +@Measurement(batchSize = 100000, iterations = 10) +@Warmup(batchSize = 100000, iterations = 10) +@State(Scope.Thread) +public class StringPerformance { + + protected String baeldung = "baeldung"; + protected String longString = "Hello baeldung, I am a bit longer than other Strings"; + protected String formatString = "hello %s, nice to meet you"; + protected String formatDigit = "%d"; + protected String emptyString = " "; + protected String result = ""; + + protected int sampleNumber = 100; + + protected Pattern spacePattern = Pattern.compile(emptyString); + protected Pattern longPattern = Pattern.compile(longString); + protected List stringSplit = new ArrayList<>(); + protected List stringTokenizer = new ArrayList<>(); @Benchmark public String benchmarkStringDynamicConcat() { - return dynamicConcat(); + result += baeldung; + return result; } @Benchmark @@ -36,27 +56,30 @@ public class StringPerformance extends StringPerformanceHints { @Benchmark public String benchmarkStringConstructor() { - return stringConstructor(); + String result = new String("baeldung"); + return result; } @Benchmark public String benchmarkStringLiteral() { - return stringLiteral(); + String result = "baeldung"; + return result; } @Benchmark public String benchmarkStringFormat_s() { - return stringFormat_s(); + return String.format(formatString, baeldung); } @Benchmark public String benchmarkStringConcat() { - return stringConcat(); + result = result.concat(baeldung); + return result; } @Benchmark public String benchmarkStringIntern() { - return stringIntern(); + return baeldung.intern(); } @Benchmark @@ -71,85 +94,95 @@ public class StringPerformance extends StringPerformanceHints { @Benchmark public List benchmarkGuavaSplitter() { - return guavaSplitter(); + return Splitter.on(" ").trimResults() + .omitEmptyStrings() + .splitToList(longString); } @Benchmark public String [] benchmarkStringSplit() { - return stringSplit(); + return longString.split(emptyString); } @Benchmark public String [] benchmarkStringSplitPattern() { - return stringSplitPattern(); + return spacePattern.split(longString, 0); } @Benchmark public List benchmarkStringTokenizer() { - return stringTokenizer(); + StringTokenizer st = new StringTokenizer(longString); + while (st.hasMoreTokens()) { + stringTokenizer.add(st.nextToken()); + } + return stringTokenizer; } @Benchmark public List benchmarkStringIndexOf() { - return stringIndexOf(); + int pos = 0, end; + while ((end = longString.indexOf(' ', pos)) >= 0) { + stringSplit.add(longString.substring(pos, end)); + pos = end + 1; + } + return stringSplit; } - @Benchmark public String benchmarkIntegerToString() { - return stringIntegerToString(); + return Integer.toString(sampleNumber); } @Benchmark public String benchmarkStringValueOf() { - return stringValueOf(); + return String.valueOf(sampleNumber); } @Benchmark public String benchmarkStringConvertPlus() { - return stringConvertPlus(); + return sampleNumber + ""; } @Benchmark public String benchmarkStringFormat_d() { - return stringFormat_d(); + return String.format(formatDigit, sampleNumber); } @Benchmark public boolean benchmarkStringEquals() { - return stringEquals(); + return longString.equals(baeldung); } @Benchmark public boolean benchmarkStringEqualsIgnoreCase() { - return stringEqualsIgnoreCase(); + return longString.equalsIgnoreCase(baeldung); } @Benchmark public boolean benchmarkStringMatches() { - return stringIsMatch(); + return longString.matches(baeldung); } @Benchmark public boolean benchmarkPrecompiledMatches() { - return precompiledMatches(); + return longPattern.matcher(baeldung).matches(); } @Benchmark public int benchmarkStringCompareTo() { - return stringCompareTo(); + return longString.compareTo(baeldung); } @Benchmark public boolean benchmarkStringIsEmpty() { - return stringIsEmpty(); + return longString.isEmpty(); } @Benchmark public boolean benchmarkStringLengthZero() { - return stringLengthZero(); + return longString.length() == 0; } public static void main(String[] args) throws Exception { diff --git a/java-strings/src/main/java/com/baeldung/string/StringPerformanceHints.java b/java-strings/src/main/java/com/baeldung/string/StringPerformanceHints.java deleted file mode 100644 index 509222136f..0000000000 --- a/java-strings/src/main/java/com/baeldung/string/StringPerformanceHints.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.baeldung.string; - -import com.google.common.base.Splitter; -import org.openjdk.jmh.annotations.Scope; -import org.openjdk.jmh.annotations.State; - -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; -import java.util.regex.Pattern; - -@State(Scope.Thread) -public class StringPerformanceHints { - - protected String baeldung = "baeldung"; - protected String longString = "Hello baeldung, I am a bit longer than other Strings"; - protected String formatString = "hello %s, nice to meet you"; - protected String formatDigit = "%d"; - protected String emptyString = " "; - protected String result = ""; - - protected int sampleNumber = 100; - - protected Pattern spacePattern = Pattern.compile(emptyString); - protected Pattern longPattern = Pattern.compile(longString); - protected List stringSplit = new ArrayList<>(); - protected List stringTokenizer = new ArrayList<>(); - - protected String dynamicConcat() { - result += baeldung; - return result; - } - - protected String stringConstructor() { - return new String(baeldung); - } - - protected String stringLiteral() { - result = baeldung; - return result; - } - - protected String stringFormat_s() { - return String.format(formatString, baeldung); - } - - protected String stringFormat_d() { - return String.format(formatDigit, sampleNumber); - } - - protected String stringConcat() { - result = result.concat(baeldung); - return result; - } - - protected List stringTokenizer() { - StringTokenizer st = new StringTokenizer(longString); - while (st.hasMoreTokens()) { - stringTokenizer.add(st.nextToken()); - } - return stringTokenizer; - } - - protected List stringIndexOf() { - int pos = 0, end; - while ((end = longString.indexOf(' ', pos)) >= 0) { - stringSplit.add(longString.substring(pos, end)); - pos = end + 1; - } - return stringSplit; - } - - protected String stringIntegerToString() { - return Integer.toString(sampleNumber); - } - - protected String stringValueOf() { - return String.valueOf(sampleNumber); - } - - - protected String stringConvertPlus() { - return sampleNumber + ""; - } - - - protected boolean stringEquals() { - return longString.equals(baeldung); - } - - - protected boolean stringEqualsIgnoreCase() { - return longString.equalsIgnoreCase(baeldung); - } - - protected boolean stringIsMatch() { - return longString.matches(baeldung); - } - - protected boolean precompiledMatches() { - return longPattern.matcher(baeldung).matches(); - } - - protected int stringCompareTo() { - return longString.compareTo(baeldung); - } - - protected boolean stringIsEmpty() { - return longString.isEmpty(); - } - - protected boolean stringLengthZero() { - return longString.length() == 0; - } - - protected String [] stringSplitPattern() { - return spacePattern.split(longString, 0); - } - - protected String [] stringSplit() { - return longString.split(emptyString); - } - - protected List guavaSplitter() { - return Splitter.on(" ").trimResults() - .omitEmptyStrings() - .splitToList(longString); - } - - protected String stringIntern() { - return baeldung.intern(); - } -} From d3ad4dcfc2ad1fe818973fbca7d47da80f5e36be Mon Sep 17 00:00:00 2001 From: sachin29aug Date: Thu, 27 Sep 2018 22:52:50 -0400 Subject: [PATCH 31/56] BAEL-9051: Fix failing unit tests --- .../SpringContextIntegrationTest.java | 53 ++++++++++++++++++- .../SpringContextIntegrationTest.java | 18 +++++++ .../SpringContextIntegrationTest.java | 19 +++++++ .../SpringContextIntegrationTest.java | 17 ++++++ .../SpringContextIntegrationTest.java | 4 +- .../MySQLAutoconfiguration.java | 26 ++++++--- .../SpringContextIntegrationTest.java | 6 ++- .../SpringContextIntegrationTest.java | 5 ++ .../com/baeldung/spring/ClientWebConfig.java | 2 + .../SpringContextIntegrationTest.java | 14 ++--- .../SpringContextIntegrationTest.java | 8 +-- 11 files changed, 143 insertions(+), 29 deletions(-) create mode 100644 persistence-modules/spring-data-gemfire/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 persistence-modules/spring-data-neo4j/src/test/java/org/baeldung/SpringContextIntegrationTest.java create mode 100644 persistence-modules/spring-data-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java diff --git a/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java index c5d8de1cc0..46ee3cd368 100644 --- a/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/persistence-modules/spring-data-cassandra/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,16 +1,67 @@ package org.baeldung; +import java.io.IOException; +import java.util.HashMap; + +import org.apache.cassandra.exceptions.ConfigurationException; +import org.apache.thrift.transport.TTransportException; import org.baeldung.spring.data.cassandra.config.CassandraConfig; +import org.baeldung.spring.data.cassandra.model.Book; +import org.cassandraunit.utils.EmbeddedCassandraServerHelper; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cassandra.core.cql.CqlIdentifier; +import org.springframework.data.cassandra.core.CassandraAdminOperations; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import com.datastax.driver.core.Cluster; +import com.datastax.driver.core.Session; + @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = CassandraConfig.class) public class SpringContextIntegrationTest { - @Test + public static final String KEYSPACE_CREATION_QUERY = "CREATE KEYSPACE IF NOT EXISTS testKeySpace " + "WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '3' };"; + + public static final String KEYSPACE_ACTIVATE_QUERY = "USE testKeySpace;"; + + public static final String DATA_TABLE_NAME = "book"; + + @Autowired + private CassandraAdminOperations adminTemplate; + + @BeforeClass + public static void startCassandraEmbedded() throws InterruptedException, TTransportException, ConfigurationException, IOException { + EmbeddedCassandraServerHelper.startEmbeddedCassandra(); + final Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withPort(9142).build(); + final Session session = cluster.connect(); + session.execute(KEYSPACE_CREATION_QUERY); + session.execute(KEYSPACE_ACTIVATE_QUERY); + Thread.sleep(5000); + } + + @Before + public void createTable() throws InterruptedException, TTransportException, ConfigurationException, IOException { + adminTemplate.createTable(true, CqlIdentifier.cqlId(DATA_TABLE_NAME), Book.class, new HashMap()); + } + + @Test public void whenSpringContextIsBootstrapped_thenNoExceptions() { } + + @After + public void dropTable() { + adminTemplate.dropTable(CqlIdentifier.cqlId(DATA_TABLE_NAME)); + } + + @AfterClass + public static void stopCassandraEmbedded() { + EmbeddedCassandraServerHelper.cleanEmbeddedCassandra(); + } } diff --git a/persistence-modules/spring-data-gemfire/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-gemfire/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..2f0557ccc1 --- /dev/null +++ b/persistence-modules/spring-data-gemfire/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,18 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.support.AnnotationConfigContextLoader; + +import com.baeldung.spring.data.gemfire.function.GemfireConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes=GemfireConfiguration.class, loader=AnnotationConfigContextLoader.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/persistence-modules/spring-data-neo4j/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-neo4j/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..ea32ed324b --- /dev/null +++ b/persistence-modules/spring-data-neo4j/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,19 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.spring.data.neo4j.config.MovieDatabaseNeo4jTestConfiguration; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = MovieDatabaseNeo4jTestConfiguration.class) +@ActiveProfiles(profiles = "test") +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/persistence-modules/spring-data-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/persistence-modules/spring-data-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java new file mode 100644 index 0000000000..e093892365 --- /dev/null +++ b/persistence-modules/spring-data-redis/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -0,0 +1,17 @@ +package org.baeldung; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.baeldung.spring.data.redis.config.RedisConfig; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = RedisConfig.class) +public class SpringContextIntegrationTest { + + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } +} diff --git a/spring-boot-angular-ecommerce/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-boot-angular-ecommerce/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 2fb930b63f..4f595916f7 100644 --- a/spring-boot-angular-ecommerce/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-boot-angular-ecommerce/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -5,10 +5,10 @@ import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; -import com.baeldung.ecommerce.EcommerceApplicationIntegrationTest; +import com.baeldung.ecommerce.EcommerceApplication; @RunWith(SpringRunner.class) -@SpringBootTest(classes = EcommerceApplicationIntegrationTest.class) +@SpringBootTest(classes = EcommerceApplication.class) public class SpringContextIntegrationTest { @Test diff --git a/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java b/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java index 4f4f6fb6af..d6fc1836c7 100644 --- a/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java +++ b/spring-boot-autoconfiguration/src/main/java/com/baeldung/autoconfiguration/MySQLAutoconfiguration.java @@ -1,10 +1,27 @@ package com.baeldung.autoconfiguration; +import java.util.Arrays; +import java.util.Properties; + +import javax.persistence.EntityManagerFactory; +import javax.sql.DataSource; + import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureOrder; -import org.springframework.boot.autoconfigure.condition.*; +import org.springframework.boot.autoconfigure.condition.ConditionMessage; import org.springframework.boot.autoconfigure.condition.ConditionMessage.Style; -import org.springframework.context.annotation.*; +import org.springframework.boot.autoconfigure.condition.ConditionOutcome; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnResource; +import org.springframework.boot.autoconfigure.condition.SpringBootCondition; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; import org.springframework.core.Ordered; import org.springframework.core.env.Environment; import org.springframework.core.type.AnnotatedTypeMetadata; @@ -14,11 +31,6 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.util.ClassUtils; -import javax.persistence.EntityManagerFactory; -import javax.sql.DataSource; -import java.util.Arrays; -import java.util.Properties; - @Configuration @ConditionalOnClass(DataSource.class) @AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE) diff --git a/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 35b231b5d8..b87ace74a4 100644 --- a/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-cloud-data-flow/batch-job/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,13 +1,15 @@ package org.baeldung; -import org.baeldung.spring.cloud.BatchJobApplication; +import org.baeldung.spring.cloud.JobConfiguration; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) -@SpringBootTest(classes = BatchJobApplication.class) +@SpringBootTest +@ContextConfiguration(classes = JobConfiguration.class) public class SpringContextIntegrationTest { @Test diff --git a/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 7f906bdbcd..0a60412813 100644 --- a/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-data-jpa/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -2,12 +2,17 @@ package org.baeldung; import org.junit.Test; import org.junit.runner.RunWith; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import com.baeldung.Application; +import com.baeldung.config.PersistenceConfiguration; +import com.baeldung.config.PersistenceProductConfiguration; +import com.baeldung.config.PersistenceUserConfiguration; @RunWith(SpringRunner.class) +@DataJpaTest(excludeAutoConfiguration = {PersistenceConfiguration.class, PersistenceUserConfiguration.class, PersistenceProductConfiguration.class}) @SpringBootTest(classes = Application.class) public class SpringContextIntegrationTest { diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java b/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java index 9752526963..22260fca70 100644 --- a/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java +++ b/spring-mvc-xml/src/main/java/com/baeldung/spring/ClientWebConfig.java @@ -1,11 +1,13 @@ package com.baeldung.spring; +import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @ImportResource("classpath:webMvcConfig.xml") @Configuration +@ComponentScan public class ClientWebConfig implements WebMvcConfigurer { public ClientWebConfig() { diff --git a/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java index 46bbc629c7..1d7f9ae497 100644 --- a/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-security-mvc-login/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,9 +1,5 @@ package org.baeldung; -import org.baeldung.spring.ChannelSecSecurityConfig; -import org.baeldung.spring.MvcConfig; -import org.baeldung.spring.RedirectionSecurityConfig; -import org.baeldung.spring.SecSecurityConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; @@ -11,12 +7,10 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.web.WebAppConfiguration; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { MvcConfig.class, ChannelSecSecurityConfig.class, RedirectionSecurityConfig.class, - SecSecurityConfig.class }) +@ContextConfiguration({ "/RedirectionWebSecurityConfig.xml", "/mvc-servlet.xml" }) @WebAppConfiguration public class SpringContextIntegrationTest { - - @Test - public void whenSpringContextIsBootstrapped_thenNoExceptions() { - } + @Test + public void whenSpringContextIsBootstrapped_thenNoExceptions() { + } } diff --git a/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java b/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java index e56f5d5031..6cf624c179 100644 --- a/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java +++ b/spring-security-rest-basic-auth/src/test/java/org/baeldung/SpringContextIntegrationTest.java @@ -1,18 +1,12 @@ package org.baeldung; -import org.baeldung.client.spring.ClientConfig; -import org.baeldung.spring.SecSecurityConfig; -import org.baeldung.spring.WebConfig; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.support.AnnotationConfigContextLoader; -import org.springframework.test.context.web.WebAppConfiguration; @RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = { ClientConfig.class, SecSecurityConfig.class, - WebConfig.class }, loader = AnnotationConfigContextLoader.class) +@ContextConfiguration({ "/WebSecurityConfig.xml" }) public class SpringContextIntegrationTest { @Test From 33208b0be1c9b7cb8f1d9787a7cd58575a9f5b3e Mon Sep 17 00:00:00 2001 From: Kostiantyn Dobarskyi <29274427+KDobarskyi@users.noreply.github.com> Date: Fri, 28 Sep 2018 07:50:10 +0300 Subject: [PATCH 32/56] BAEL-2127 Chaining Completables in RxJava (#5323) --- rxjava-2/pom.xml | 3 +- .../baeldung/rxjava/CompletableUnitTest.java | 112 ++++++++++++++++++ 2 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 rxjava-2/src/test/java/com/baeldung/rxjava/CompletableUnitTest.java diff --git a/rxjava-2/pom.xml b/rxjava-2/pom.xml index 4c5ea014d7..a18b096b6d 100644 --- a/rxjava-2/pom.xml +++ b/rxjava-2/pom.xml @@ -38,9 +38,8 @@ 3.8.0 - 2.1.3 + 2.2.2 1.7.0 2.0.0 - \ No newline at end of file diff --git a/rxjava-2/src/test/java/com/baeldung/rxjava/CompletableUnitTest.java b/rxjava-2/src/test/java/com/baeldung/rxjava/CompletableUnitTest.java new file mode 100644 index 0000000000..6acda310a5 --- /dev/null +++ b/rxjava-2/src/test/java/com/baeldung/rxjava/CompletableUnitTest.java @@ -0,0 +1,112 @@ +package com.baeldung.rxjava; + +import io.reactivex.Completable; +import io.reactivex.Flowable; +import io.reactivex.Single; +import io.reactivex.observers.DisposableCompletableObserver; +import org.junit.Before; +import org.junit.Test; + +public class CompletableUnitTest { + + Completable first; + Completable second; + Completable error; + Throwable throwable = new RuntimeException(); + + @Before + public void setUpCompletables() { + first = Completable.fromSingle(Single.just(1)); + second = Completable.fromRunnable(() -> {}); + error = Single.error(throwable) + .ignoreElement(); + } + + @Test + public void whenCompletableConstructed_thenCompletedSuccessfully() { + Completable completed = Completable.complete(); + completed.subscribe(new DisposableCompletableObserver() { + @Override + public void onComplete() { + System.out.println("Completed!"); + } + + @Override + public void onError(Throwable e) { + e.printStackTrace(); + } + }); + Flowable flowable = Flowable.just("request received", "user logged in"); + Completable flowableCompletable = Completable.fromPublisher(flowable); + Completable singleCompletable = Single.just(1) + .ignoreElement(); + + completed.andThen(flowableCompletable) + .andThen(singleCompletable) + .test() + .assertComplete(); + } + + @Test + public void whenCombiningCompletables_thenCompletedSuccessfully() { + first.andThen(second) + .test() + .assertComplete(); + } + + @Test + public void whenCombinedWithError_thenCompletedWithError() { + first.andThen(second) + .andThen(error) + .test() + .assertError(throwable); + } + + @Test + public void whenCombinedWithNever_thenDoesNotComplete() { + first.andThen(second) + .andThen(Completable.never()) + .test() + .assertNotComplete(); + } + + @Test + public void whenMergedCompletables_thenCompletedSuccessfully() { + Completable.mergeArray(first, second) + .test() + .assertComplete(); + } + + @Test + public void whenMergedWithError_thenCompletedWithError() { + Completable.mergeArray(first, second, error) + .test() + .assertError(throwable); + } + + @Test + public void whenFlatMaped_thenCompletedSuccessfully() { + Completable allElementsCompletable = Flowable.just("request received", "user logged in") + .flatMapCompletable(message -> Completable + .fromRunnable(() -> System.out.println(message)) + ); + allElementsCompletable + .test() + .assertComplete(); + } + + @Test + public void whenAmbWithNever_thenCompletedSuccessfully() { + Completable.ambArray(first, Completable.never(), second) + .test() + .assertComplete(); + } + + @Test + public void whenAmbWithError_thenCompletedWithError() { + Completable.ambArray(error, first, second) + .test() + .assertError(throwable); + } + +} From 275adabbeed8ed3f1e477c3bddaa8baef0ca39d9 Mon Sep 17 00:00:00 2001 From: vizsoro Date: Fri, 28 Sep 2018 07:39:05 +0200 Subject: [PATCH 33/56] refactor of dependencies --- spring-boot-mvc/pom.xml | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml index 37d4698f0e..e4038f4c98 100644 --- a/spring-boot-mvc/pom.xml +++ b/spring-boot-mvc/pom.xml @@ -21,32 +21,16 @@ org.springframework.boot spring-boot-starter-web - - - com.sun.faces - jsf-api - 2.2.18 - org.apache.tomcat.embed tomcat-embed-jasper + - javax.faces - javax.faces-api - 2.3 + org.glassfish + javax.faces + 2.2.8-30 - - javax.servlet - jstl - 1.2 - - - com.sun.faces - jsf-impl - 2.2.18 - - org.springframework.boot From 3ea0d3f8c904d16fb6b470976f1d6deb831aadda Mon Sep 17 00:00:00 2001 From: Nik Gorylenko Date: Fri, 28 Sep 2018 09:15:43 +0200 Subject: [PATCH 34/56] remove duplicate (#5073) --- testing-modules/junit-5/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/testing-modules/junit-5/README.md b/testing-modules/junit-5/README.md index 40c4e8cde9..836848282b 100644 --- a/testing-modules/junit-5/README.md +++ b/testing-modules/junit-5/README.md @@ -1,7 +1,6 @@ ### Relevant Articles: - [The Basics of JUnit 5 – A Preview](http://www.baeldung.com/junit-5-preview) - [A Guide to JUnit 5](http://www.baeldung.com/junit-5) -- [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests) - [A Guide to @RepeatedTest in Junit 5](http://www.baeldung.com/junit-5-repeated-test) - [Guide to Dynamic Tests in Junit 5](http://www.baeldung.com/junit5-dynamic-tests) - [A Guied to JUnit 5 Extensions](http://www.baeldung.com/junit-5-extensions) From 17b4861863f14f35f57ffb3a85d7df68893d9138 Mon Sep 17 00:00:00 2001 From: Kostiantyn Dobarskyi <29274427+KDobarskyi@users.noreply.github.com> Date: Fri, 28 Sep 2018 10:27:47 +0300 Subject: [PATCH 35/56] BAEL-2127 added link to live article about Completable --- rxjava-2/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rxjava-2/README.md b/rxjava-2/README.md index ccf575757f..78eb6e6428 100644 --- a/rxjava-2/README.md +++ b/rxjava-2/README.md @@ -2,5 +2,6 @@ - [RxJava and Error Handling](http://www.baeldung.com/rxjava-error-handling) - [RxJava 2 – Flowable](http://www.baeldung.com/rxjava-2-flowable) +- [RxJava 2 - Completable](http://www.baeldung.com/rxjava-completable) - [RxJava Maybe](http://www.baeldung.com/rxjava-maybe) -- [Introduction to RxRelay for RxJava](http://www.baeldung.com/rx-relay) \ No newline at end of file +- [Introduction to RxRelay for RxJava](http://www.baeldung.com/rx-relay) From 51914a01e198868037d75e76c6d2ebd359c21c8e Mon Sep 17 00:00:00 2001 From: Siben Nayak Date: Sat, 29 Sep 2018 01:17:10 +0530 Subject: [PATCH 36/56] [BAEL-2032] Operate on an item in a Stream then remove it (#5175) * [BAEL-2032] Operate on an item in a Stream then remove it * Remove the unit test from this package --- .../com/baeldung/stream}/StreamOperateAndRemoveUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename {core-java-collections/src/test/java/com/baeldung/collection => java-streams/src/test/java/com/baeldung/stream}/StreamOperateAndRemoveUnitTest.java (98%) diff --git a/core-java-collections/src/test/java/com/baeldung/collection/StreamOperateAndRemoveUnitTest.java b/java-streams/src/test/java/com/baeldung/stream/StreamOperateAndRemoveUnitTest.java similarity index 98% rename from core-java-collections/src/test/java/com/baeldung/collection/StreamOperateAndRemoveUnitTest.java rename to java-streams/src/test/java/com/baeldung/stream/StreamOperateAndRemoveUnitTest.java index 9f002c89a2..c5aa9a1651 100644 --- a/core-java-collections/src/test/java/com/baeldung/collection/StreamOperateAndRemoveUnitTest.java +++ b/java-streams/src/test/java/com/baeldung/stream/StreamOperateAndRemoveUnitTest.java @@ -1,4 +1,4 @@ -package com.baeldung.collection; +package com.baeldung.stream; import java.util.ArrayList; import java.util.List; From 75c258540e0a8ad55435f07407c54f744e677968 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 29 Sep 2018 09:32:36 +0300 Subject: [PATCH 37/56] remove extra vaadin project --- vaadin-spring/README.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 vaadin-spring/README.md diff --git a/vaadin-spring/README.md b/vaadin-spring/README.md deleted file mode 100644 index 347c92d7b5..0000000000 --- a/vaadin-spring/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Relevant articles - -- [Sample Application with Spring Boot and Vaadin](https://www.baeldung.com/spring-boot-vaadin) From 56c2b9663e70876e8ecaeb62b3a223c9ccf75760 Mon Sep 17 00:00:00 2001 From: Patryk Date: Sat, 29 Sep 2018 10:52:02 +0200 Subject: [PATCH 38/56] BAEL-2165 (#5317) * BAEL-2165: Guide to Passay * BAEL-2165: Guide to Passay #2 * BAEL-2165: Guide to Passay #3 Fixed formatting. --- libraries-security/pom.xml | 10 ++ .../passay/NegativeMatchingRulesUnitTest.java | 149 ++++++++++++++++++ .../passay/PasswordGeneratorUnitTest.java | 50 ++++++ .../passay/PasswordValidatorUnitTest.java | 81 ++++++++++ .../passay/PositiveMatchingRulesUnitTest.java | 76 +++++++++ .../src/test/resources/messages.properties | 2 + 6 files changed, 368 insertions(+) create mode 100644 libraries-security/src/test/java/com/baeldung/passay/NegativeMatchingRulesUnitTest.java create mode 100644 libraries-security/src/test/java/com/baeldung/passay/PasswordGeneratorUnitTest.java create mode 100644 libraries-security/src/test/java/com/baeldung/passay/PasswordValidatorUnitTest.java create mode 100644 libraries-security/src/test/java/com/baeldung/passay/PositiveMatchingRulesUnitTest.java create mode 100644 libraries-security/src/test/resources/messages.properties diff --git a/libraries-security/pom.xml b/libraries-security/pom.xml index a57f029702..3077abc29c 100644 --- a/libraries-security/pom.xml +++ b/libraries-security/pom.xml @@ -38,6 +38,16 @@ ${junit.version} test + + org.passay + passay + 1.3.1 + + + org.cryptacular + cryptacular + 1.2.2 + diff --git a/libraries-security/src/test/java/com/baeldung/passay/NegativeMatchingRulesUnitTest.java b/libraries-security/src/test/java/com/baeldung/passay/NegativeMatchingRulesUnitTest.java new file mode 100644 index 0000000000..5054a5880e --- /dev/null +++ b/libraries-security/src/test/java/com/baeldung/passay/NegativeMatchingRulesUnitTest.java @@ -0,0 +1,149 @@ +package com.baeldung.passay; + +import org.cryptacular.bean.EncodingHashBean; +import org.cryptacular.spec.CodecSpec; +import org.cryptacular.spec.DigestSpec; +import org.junit.Assert; +import org.junit.Test; +import org.passay.DictionaryRule; +import org.passay.DictionarySubstringRule; +import org.passay.DigestHistoryRule; +import org.passay.EnglishSequenceData; +import org.passay.HistoryRule; +import org.passay.IllegalCharacterRule; +import org.passay.IllegalRegexRule; +import org.passay.IllegalSequenceRule; +import org.passay.NumberRangeRule; +import org.passay.PasswordData; +import org.passay.PasswordValidator; +import org.passay.RepeatCharacterRegexRule; +import org.passay.RuleResult; +import org.passay.SourceRule; +import org.passay.UsernameRule; +import org.passay.WhitespaceRule; +import org.passay.dictionary.ArrayWordList; +import org.passay.dictionary.WordListDictionary; + +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +public class NegativeMatchingRulesUnitTest { + + @Test + public void givenDictionaryRules_whenValidatePassword_thenFoundIllegalWordsFromDictionary() { + ArrayWordList arrayWordList = new ArrayWordList(new String[] { "bar", "foobar" }); + + WordListDictionary wordListDictionary = new WordListDictionary(arrayWordList); + + DictionaryRule dictionaryRule = new DictionaryRule(wordListDictionary); + DictionarySubstringRule dictionarySubstringRule = new DictionarySubstringRule(wordListDictionary); + + PasswordValidator passwordValidator = new PasswordValidator(dictionaryRule, dictionarySubstringRule); + RuleResult validate = passwordValidator.validate(new PasswordData("foobar")); + + assertFalse(validate.isValid()); + assertEquals("ILLEGAL_WORD:{matchingWord=foobar}", getDetail(validate, 0)); + assertEquals("ILLEGAL_WORD:{matchingWord=bar}", getDetail(validate, 1)); + } + + @Test + public void givenHistoryRule_whenValidatePassword_thenFoundIllegalWordsFromHistory() { + HistoryRule historyRule = new HistoryRule(); + + PasswordData passwordData = new PasswordData("123"); + passwordData.setPasswordReferences(new PasswordData.HistoricalReference("12345"), new PasswordData.HistoricalReference("1234"), new PasswordData.HistoricalReference("123")); + + PasswordValidator passwordValidator = new PasswordValidator(historyRule); + + RuleResult validate = passwordValidator.validate(passwordData); + + assertFalse(validate.isValid()); + assertEquals("HISTORY_VIOLATION:{historySize=3}", getDetail(validate, 0)); + } + + @Test + public void givenSeveralIllegalRules_whenValidatePassword_thenFoundSeveralIllegalPatterns() { + IllegalCharacterRule illegalCharacterRule = new IllegalCharacterRule(new char[] { 'a' }); + IllegalRegexRule illegalRegexRule = new IllegalRegexRule("\\w{2}\\d{2}"); + IllegalSequenceRule illegalSequenceRule = new IllegalSequenceRule(EnglishSequenceData.Alphabetical, 3, true); + NumberRangeRule numberRangeRule = new NumberRangeRule(1, 10); + WhitespaceRule whitespaceRule = new WhitespaceRule(); + + PasswordValidator passwordValidator = new PasswordValidator(illegalCharacterRule, illegalRegexRule, illegalSequenceRule, numberRangeRule, whitespaceRule); + + RuleResult validate = passwordValidator.validate(new PasswordData("abcd22 ")); + + assertFalse(validate.isValid()); + assertEquals("ILLEGAL_CHAR:{illegalCharacter=a, matchBehavior=contains}", getDetail(validate, 0)); + assertEquals("ILLEGAL_MATCH:{match=cd22, pattern=\\w{2}\\d{2}}", getDetail(validate, 1)); + assertEquals("ILLEGAL_ALPHABETICAL_SEQUENCE:{sequence=abc}", getDetail(validate, 2)); + assertEquals("ILLEGAL_ALPHABETICAL_SEQUENCE:{sequence=bcd}", getDetail(validate, 3)); + assertEquals("ILLEGAL_NUMBER_RANGE:{number=2, matchBehavior=contains}", getDetail(validate, 4)); + assertEquals("ILLEGAL_WHITESPACE:{whitespaceCharacter= , matchBehavior=contains}", getDetail(validate, 5)); + } + + @Test + public void givenSourceRule_whenValidatePassword_thenFoundIllegalWordsFromSource() { + SourceRule sourceRule = new SourceRule(); + + PasswordData passwordData = new PasswordData("password"); + passwordData.setPasswordReferences(new PasswordData.SourceReference("source", "password")); + + PasswordValidator passwordValidator = new PasswordValidator(sourceRule); + RuleResult validate = passwordValidator.validate(passwordData); + + assertFalse(validate.isValid()); + assertEquals("SOURCE_VIOLATION:{source=source}", getDetail(validate, 0)); + } + + @Test + public void givenRepeatCharacterRegexRuleRule_whenValidatePassword_thenFoundIllegalPatternMatches() { + RepeatCharacterRegexRule repeatCharacterRegexRule = new RepeatCharacterRegexRule(3); + + PasswordValidator passwordValidator = new PasswordValidator(repeatCharacterRegexRule); + + RuleResult validate = passwordValidator.validate(new PasswordData("aaabbb")); + + assertFalse(validate.isValid()); + assertEquals("ILLEGAL_MATCH:{match=aaa, pattern=([^\\x00-\\x1F])\\1{2}}", getDetail(validate, 0)); + assertEquals("ILLEGAL_MATCH:{match=bbb, pattern=([^\\x00-\\x1F])\\1{2}}", getDetail(validate, 1)); + } + + @Test + public void givenUserNameRule_whenValidatePassword_thenFoundUserNameInPassword() { + PasswordValidator passwordValidator = new PasswordValidator(new UsernameRule()); + + PasswordData passwordData = new PasswordData("testuser1234"); + passwordData.setUsername("testuser"); + + RuleResult validate = passwordValidator.validate(passwordData); + + assertFalse(validate.isValid()); + assertEquals("ILLEGAL_USERNAME:{username=testuser, matchBehavior=contains}", getDetail(validate, 0)); + } + + @Test + public void givenPasswordAndHashBeanAndEncryptedReferences_whenValidate_thenPasswordValidationShouldPass() { + List historicalReferences = Arrays.asList(new PasswordData.HistoricalReference("SHA256", "2e4551de804e27aacf20f9df5be3e8cd384ed64488b21ab079fb58e8c90068ab")); + PasswordData passwordData = new PasswordData("example!"); + passwordData.setPasswordReferences(historicalReferences); + + EncodingHashBean encodingHashBean = new EncodingHashBean(new CodecSpec("Base64"), new DigestSpec("SHA256"), 1, false); + + PasswordValidator passwordValidator = new PasswordValidator(new DigestHistoryRule(encodingHashBean)); + + RuleResult validate = passwordValidator.validate(passwordData); + + Assert.assertTrue(validate.isValid()); + } + + private String getDetail(RuleResult validate, int i) { + return validate.getDetails() + .get(i) + .toString(); + } + +} diff --git a/libraries-security/src/test/java/com/baeldung/passay/PasswordGeneratorUnitTest.java b/libraries-security/src/test/java/com/baeldung/passay/PasswordGeneratorUnitTest.java new file mode 100644 index 0000000000..ff279e9317 --- /dev/null +++ b/libraries-security/src/test/java/com/baeldung/passay/PasswordGeneratorUnitTest.java @@ -0,0 +1,50 @@ +package com.baeldung.passay; + +import org.junit.Assert; +import org.junit.Test; +import org.passay.CharacterData; +import org.passay.CharacterRule; +import org.passay.EnglishCharacterData; +import org.passay.PasswordGenerator; + +import java.util.stream.Stream; + +public class PasswordGeneratorUnitTest { + + @Test + public void givenDigitsGenerator_whenGeneratingPassword_thenPasswordContainsDigitsHasLength10() { + CharacterRule digits = new CharacterRule(EnglishCharacterData.Digit); + + PasswordGenerator passwordGenerator = new PasswordGenerator(); + String password = passwordGenerator.generatePassword(10, digits); + + Assert.assertTrue(password.length() == 10); + Assert.assertTrue(containsOnlyCharactersFromSet(password, "0123456789")); + } + + @Test + public void givenCustomizedRule_whenGenerating_thenGeneratedPasswordContainsCustomizedCharacters() { + CharacterRule specialCharacterRule = new CharacterRule(new CharacterData() { + @Override + public String getErrorCode() { + return "SAMPLE_ERROR_CODE"; + } + + @Override + public String getCharacters() { + return "ABCxyz123!@#"; + } + }); + + PasswordGenerator passwordGenerator = new PasswordGenerator(); + String password = passwordGenerator.generatePassword(10, specialCharacterRule); + + Assert.assertTrue(containsOnlyCharactersFromSet(password, "ABCxyz123!@#")); + } + + private boolean containsOnlyCharactersFromSet(String password, String setOfCharacters) { + return Stream.of(password.split("")) + .allMatch(it -> setOfCharacters.contains(it)); + } + +} diff --git a/libraries-security/src/test/java/com/baeldung/passay/PasswordValidatorUnitTest.java b/libraries-security/src/test/java/com/baeldung/passay/PasswordValidatorUnitTest.java new file mode 100644 index 0000000000..3fc59a82d5 --- /dev/null +++ b/libraries-security/src/test/java/com/baeldung/passay/PasswordValidatorUnitTest.java @@ -0,0 +1,81 @@ +package com.baeldung.passay; + +import org.junit.Assert; +import org.junit.Test; +import org.passay.LengthRule; +import org.passay.MessageResolver; +import org.passay.PasswordData; +import org.passay.PasswordValidator; +import org.passay.PropertiesMessageResolver; +import org.passay.RuleResult; +import org.passay.RuleResultDetail; +import org.passay.RuleResultMetadata; +import org.passay.WhitespaceRule; + +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.util.Properties; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + +public class PasswordValidatorUnitTest { + + @Test + public void givenPasswordValidatorWithLengthRule_whenValidation_thenTooShortPassword() { + PasswordData passwordData = new PasswordData("1234"); + + PasswordValidator passwordValidator = new PasswordValidator(new LengthRule(5)); + + RuleResult validate = passwordValidator.validate(passwordData); + assertEquals(false, validate.isValid()); + + RuleResultDetail ruleResultDetail = validate.getDetails() + .get(0); + assertEquals("TOO_SHORT", ruleResultDetail.getErrorCode()); + assertEquals(5, ruleResultDetail.getParameters() + .get("minimumLength")); + assertEquals(5, ruleResultDetail.getParameters() + .get("maximumLength")); + + Integer lengthCount = validate.getMetadata() + .getCounts() + .get(RuleResultMetadata.CountCategory.Length); + assertEquals(Integer.valueOf(4), lengthCount); + } + + @Test + public void givenPasswordValidatorWithLengthRule_whenValidation_thenTooLongPassword() { + PasswordData passwordData = new PasswordData("123456"); + + PasswordValidator passwordValidator = new PasswordValidator(new LengthRule(5)); + + RuleResult validate = passwordValidator.validate(passwordData); + assertFalse(validate.isValid()); + Assert.assertEquals("TOO_LONG", validate.getDetails() + .get(0) + .getErrorCode()); + } + + @Test + public void givenPasswordValidatorWithLengthRule_whenValidation_thenCustomizedMeesagesAvailable() throws IOException { + URL resource = this.getClass() + .getClassLoader() + .getResource("messages.properties"); + Properties props = new Properties(); + props.load(new FileInputStream(resource.getPath())); + + MessageResolver resolver = new PropertiesMessageResolver(props); + PasswordValidator validator = new PasswordValidator(resolver, new LengthRule(8, 16), new WhitespaceRule()); + + RuleResult tooShort = validator.validate(new PasswordData("XXXX")); + RuleResult tooLong = validator.validate(new PasswordData("ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ")); + + assertEquals("Password must not contain less characters than 16.", validator.getMessages(tooShort) + .get(0)); + assertEquals("Password must not have more characters than 16.", validator.getMessages(tooLong) + .get(0)); + } + +} diff --git a/libraries-security/src/test/java/com/baeldung/passay/PositiveMatchingRulesUnitTest.java b/libraries-security/src/test/java/com/baeldung/passay/PositiveMatchingRulesUnitTest.java new file mode 100644 index 0000000000..0da1b43335 --- /dev/null +++ b/libraries-security/src/test/java/com/baeldung/passay/PositiveMatchingRulesUnitTest.java @@ -0,0 +1,76 @@ +package com.baeldung.passay; + +import org.junit.Test; +import org.passay.AllowedCharacterRule; +import org.passay.AllowedRegexRule; +import org.passay.CharacterCharacteristicsRule; +import org.passay.CharacterRule; +import org.passay.EnglishCharacterData; +import org.passay.LengthComplexityRule; +import org.passay.LengthRule; +import org.passay.PasswordData; +import org.passay.PasswordValidator; +import org.passay.RuleResult; + +import static org.junit.Assert.*; + +public class PositiveMatchingRulesUnitTest { + + @Test + public void givenPasswordValidationRules_whenValidatingPassword_thenPosswordIsNotValidWithSeveralErrors() { + PasswordValidator passwordValidator = new PasswordValidator(new AllowedCharacterRule(new char[] { 'a', 'b', 'c' }), new AllowedRegexRule("\\d{2}\\w{10}"), new CharacterRule(EnglishCharacterData.LowerCase, 5), new LengthRule(8, 10)); + + RuleResult validate = passwordValidator.validate(new PasswordData("12abc")); + + assertFalse(validate.isValid()); + assertEquals("ALLOWED_CHAR:{illegalCharacter=1, matchBehavior=contains}", getDetail(validate, 0)); + assertEquals("ALLOWED_CHAR:{illegalCharacter=2, matchBehavior=contains}", getDetail(validate, 1)); + assertEquals("ALLOWED_MATCH:{pattern=\\d{2}\\w{10}}", getDetail(validate, 2)); + assertEquals("INSUFFICIENT_LOWERCASE:{" + "minimumRequired=5, matchingCharacterCount=3, " + "validCharacters=abcdefghijklmnopqrstuvwxyz, " + "matchingCharacters=abc}", getDetail(validate, 3)); + assertEquals("TOO_SHORT:{minimumLength=8, maximumLength=10}", getDetail(validate, 4)); + } + + @Test + public void givenRulesForDifferentPasswordLength_whenValidatingTwoDifferentPassword_thenBothOfThemAreInvalid() { + PasswordData shortPassword = new PasswordData("12ab"); + PasswordData longPassword = new PasswordData("1234abcde"); + + LengthComplexityRule lengthComplexityRule = new LengthComplexityRule(); + lengthComplexityRule.addRules("[1,5]", new CharacterRule(EnglishCharacterData.LowerCase, 5)); + lengthComplexityRule.addRules("[6,10]", new AllowedCharacterRule(new char[] { 'a', 'b', 'c', 'd' })); + + PasswordValidator passwordValidator = new PasswordValidator(lengthComplexityRule); + + RuleResult validateShort = passwordValidator.validate(shortPassword); + RuleResult validateLong = passwordValidator.validate(longPassword); + + assertFalse(validateShort.isValid()); + assertFalse(validateLong.isValid()); + + assertEquals("INSUFFICIENT_LOWERCASE:{" + "minimumRequired=5, " + "matchingCharacterCount=2, " + "validCharacters=abcdefghijklmnopqrstuvwxyz, " + "matchingCharacters=ab}", getDetail(validateShort, 0)); + assertEquals("ALLOWED_CHAR:{illegalCharacter=1, matchBehavior=contains}", getDetail(validateLong, 0)); + } + + @Test + public void givenCharacterCharacteristicsRule_whenValidatingPassword_thenItIsInvalidAsItBreaksToManyRules() { + PasswordData shortPassword = new PasswordData(); + shortPassword.setPassword("12345abcde!"); + + CharacterCharacteristicsRule characterCharacteristicsRule = new CharacterCharacteristicsRule(4, new CharacterRule(EnglishCharacterData.LowerCase, 5), new CharacterRule(EnglishCharacterData.UpperCase, 5), new CharacterRule(EnglishCharacterData.Digit), + new CharacterRule(EnglishCharacterData.Special)); + + PasswordValidator passwordValidator = new PasswordValidator(characterCharacteristicsRule); + + RuleResult validate = passwordValidator.validate(shortPassword); + assertFalse(validate.isValid()); + + assertEquals("INSUFFICIENT_UPPERCASE:{" + "minimumRequired=5, " + "matchingCharacterCount=0, " + "validCharacters=ABCDEFGHIJKLMNOPQRSTUVWXYZ, " + "matchingCharacters=}", getDetail(validate, 0)); + assertEquals("INSUFFICIENT_CHARACTERISTICS:{" + "successCount=3, " + "minimumRequired=4, " + "ruleCount=4}", getDetail(validate, 1)); + } + + private String getDetail(RuleResult validate, int i) { + return validate.getDetails() + .get(i) + .toString(); + } +} diff --git a/libraries-security/src/test/resources/messages.properties b/libraries-security/src/test/resources/messages.properties new file mode 100644 index 0000000000..ad0039d71d --- /dev/null +++ b/libraries-security/src/test/resources/messages.properties @@ -0,0 +1,2 @@ +TOO_LONG=Password must not have more characters than %2$s. +TOO_SHORT=Password must not contain less characters than %2$s. \ No newline at end of file From 191b27a8c5d038b30b1febc17619183f352e80a7 Mon Sep 17 00:00:00 2001 From: Vaibhav Sahay Date: Sat, 29 Sep 2018 15:22:22 +0530 Subject: [PATCH 39/56] initial commit --- .../algorithms/mergesort/MergeSort.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 algorithms/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java diff --git a/algorithms/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java b/algorithms/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java new file mode 100644 index 0000000000..0deb48b6a0 --- /dev/null +++ b/algorithms/src/main/java/com/baeldung/algorithms/mergesort/MergeSort.java @@ -0,0 +1,50 @@ +package com.baeldung.algorithms.mergesort; + +public class MergeSort { + + public static void main(String[] args) { + int[] a = { 5, 1, 6, 2, 3, 4 }; + mergeSort(a, a.length); + for (int i = 0; i < a.length; i++) + System.out.println(a[i]); + } + + public static void mergeSort(int[] a, int n) { + if (n < 2) + return; + int mid = n / 2; + int[] l = new int[mid]; + int[] r = new int[n - mid]; + + for (int i = 0; i < mid; i++) { + l[i] = a[i]; + } + for (int i = mid; i < n; i++) { + r[i - mid] = a[i]; + } + mergeSort(l, mid); + mergeSort(r, n - mid); + + merge(a, l, r, mid, n - mid); + } + + public static void merge(int[] a, int[] l, int[] r, int left, int right) { + + int i = 0, j = 0, k = 0; + + while (i < left && j < right) { + + if (l[i] < r[j]) + a[k++] = l[i++]; + else + a[k++] = r[j++]; + + } + + while (i < left) + a[k++] = l[i++]; + + while (j < right) + a[k++] = r[j++]; + } +} From 5db1d97f8f0c8d0f72eced10d672bf77a095ce6a Mon Sep 17 00:00:00 2001 From: Vaibhav Sahay Date: Sat, 29 Sep 2018 15:24:09 +0530 Subject: [PATCH 40/56] initial commit --- .../algorithms/mergesort/MergeSortTest.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java new file mode 100644 index 0000000000..64916fdc08 --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java @@ -0,0 +1,26 @@ +package com.baeldung.algorithms.mergesort; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + + +class MergeSortTest { + + @Test + void positiveTest() { + int[] input = { 5, 1, 6, 2, 3, 4 }; + int[] expected = { 1, 2, 3, 4, 5, 6 }; + MergeSort.mergeSort(input, input.length); + assertArrayEquals(expected, input); + } + + @Test + void negativeTest() { + int[] input = { 5, 1, 6, 2, 3, 4 }; + int[] expected = { 1, 2, 3, 4, 6 ,5}; + MergeSort.mergeSort(input, input.length); + assertArrayEquals(expected, input); + } + +} From d01ab8e3eb3969a3165063467ff008f98c7d2028 Mon Sep 17 00:00:00 2001 From: Vaibhav Sahay Date: Sat, 29 Sep 2018 15:37:34 +0530 Subject: [PATCH 41/56] removed negative test --- .../com/baeldung/algorithms/mergesort/MergeSortTest.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java index 64916fdc08..a367c8eeee 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java @@ -15,12 +15,4 @@ class MergeSortTest { assertArrayEquals(expected, input); } - @Test - void negativeTest() { - int[] input = { 5, 1, 6, 2, 3, 4 }; - int[] expected = { 1, 2, 3, 4, 6 ,5}; - MergeSort.mergeSort(input, input.length); - assertArrayEquals(expected, input); - } - } From 681815d97f4051ec7467d570c8d3cbd4742d6e6b Mon Sep 17 00:00:00 2001 From: Vaibhav Sahay Date: Sat, 29 Sep 2018 15:44:14 +0530 Subject: [PATCH 42/56] Deleted MergeSortTest.java --- .../algorithms/mergesort/MergeSortTest.java | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java deleted file mode 100644 index a367c8eeee..0000000000 --- a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.baeldung.algorithms.mergesort; - -import static org.junit.jupiter.api.Assertions.*; - -import org.junit.jupiter.api.Test; - - -class MergeSortTest { - - @Test - void positiveTest() { - int[] input = { 5, 1, 6, 2, 3, 4 }; - int[] expected = { 1, 2, 3, 4, 5, 6 }; - MergeSort.mergeSort(input, input.length); - assertArrayEquals(expected, input); - } - -} From 6a3eec15e55541876a951543a0e6584f18eb83cc Mon Sep 17 00:00:00 2001 From: Vaibhav Sahay Date: Sat, 29 Sep 2018 16:06:30 +0530 Subject: [PATCH 43/56] Unit test for MergeSort --- .../algorithms/mergesort/MergeSortTest.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java new file mode 100644 index 0000000000..5c304ba7fe --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java @@ -0,0 +1,25 @@ +package com.baeldung.algorithms.mergesort; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class MergeSortTest { + + @Test + void positiveTest() { + int[] input = { 5, 1, 6, 2, 3, 4 }; + int[] expected = { 1, 2, 3, 4, 5, 6 }; + MergeSort.mergeSort(input, input.length); + assertArrayEquals(expected, input); + } + + @Test + void negativeTest() { + int[] input = { 5, 1, 6, 2, 3, 4 }; + int[] expected = { 1, 2, 3, 4, 6, 5 }; + MergeSort.mergeSort(input, input.length); + assertArrayEquals(expected, input); + } + +} From 575dcc38409110819d7af51a8189d8bab475c506 Mon Sep 17 00:00:00 2001 From: Vaibhav Sahay Date: Sat, 29 Sep 2018 16:15:54 +0530 Subject: [PATCH 44/56] Updated the imports --- .../algorithms/mergesort/MergeSortTest.java | 25 ------------------ .../mergesort/MergeSortUnitTest.java | 26 +++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) delete mode 100644 algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java create mode 100644 algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java diff --git a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java deleted file mode 100644 index 5c304ba7fe..0000000000 --- a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.algorithms.mergesort; - -import static org.junit.jupiter.api.Assertions.*; - -import org.junit.jupiter.api.Test; - -class MergeSortTest { - - @Test - void positiveTest() { - int[] input = { 5, 1, 6, 2, 3, 4 }; - int[] expected = { 1, 2, 3, 4, 5, 6 }; - MergeSort.mergeSort(input, input.length); - assertArrayEquals(expected, input); - } - - @Test - void negativeTest() { - int[] input = { 5, 1, 6, 2, 3, 4 }; - int[] expected = { 1, 2, 3, 4, 6, 5 }; - MergeSort.mergeSort(input, input.length); - assertArrayEquals(expected, input); - } - -} diff --git a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java new file mode 100644 index 0000000000..c46bac041f --- /dev/null +++ b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java @@ -0,0 +1,26 @@ +package com.baeldung.algorithms.mergesort; + +import org.junit.Assert; + +import org.junit.Test; + +public class MergeSortUnitTest { + + @Test + public void positiveTest() { + int[] actual = { 5, 1, 6, 2, 3, 4 }; + int[] expected = { 1, 2, 3, 4, 5, 6 }; + MergeSort.mergeSort(actual, actual.length); + Assert.assertArrayEquals(expected, actual); + } + + @Test + public void negativeTest() { + int[] actual = { 5, 1, 6, 2, 3, 4 }; + int[] expected = { 1, 2, 3, 4, 6, 5 }; + MergeSort.mergeSort(actual, actual.length); + Assert.assertArrayEquals(expected, actual); + + } + +} From ea4b5c8636e58a3960d25107dec22b4b0c2fbd92 Mon Sep 17 00:00:00 2001 From: Vaibhav Sahay Date: Sat, 29 Sep 2018 16:19:45 +0530 Subject: [PATCH 45/56] removed negative test --- .../baeldung/algorithms/mergesort/MergeSortUnitTest.java | 9 --------- 1 file changed, 9 deletions(-) diff --git a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java index c46bac041f..5cd14b7bd0 100644 --- a/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java +++ b/algorithms/src/test/java/com/baeldung/algorithms/mergesort/MergeSortUnitTest.java @@ -14,13 +14,4 @@ public class MergeSortUnitTest { Assert.assertArrayEquals(expected, actual); } - @Test - public void negativeTest() { - int[] actual = { 5, 1, 6, 2, 3, 4 }; - int[] expected = { 1, 2, 3, 4, 6, 5 }; - MergeSort.mergeSort(actual, actual.length); - Assert.assertArrayEquals(expected, actual); - - } - } From 33ca802287284180b4ea21bc5a8526c618d940b4 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sat, 29 Sep 2018 14:38:45 +0300 Subject: [PATCH 46/56] update jsf --- spring-boot-mvc/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-mvc/pom.xml b/spring-boot-mvc/pom.xml index 169c9509b5..65d23ebfc6 100644 --- a/spring-boot-mvc/pom.xml +++ b/spring-boot-mvc/pom.xml @@ -27,7 +27,7 @@ org.glassfish javax.faces - 2.2.8-30 + 2.3.7 From 258532c40fb06a81ed754b4591ff619472377e8d Mon Sep 17 00:00:00 2001 From: Alejandro Gervasio Date: Sat, 29 Sep 2018 11:04:18 -0300 Subject: [PATCH 47/56] BAEL-2253 - Difference Between @NotNull, @NotEmpty and @NotBlank Constraints in Bean Validation (#5310) * Initial Commit * Update UserNotBlankUnitTest.java * Update UserNotEmptyUnitTest.java * Update UserNotNullUnitTest.java --- javaxval/pom.xml | 126 ++++++++++-------- .../appplication/Application.java | 14 ++ .../entities/UserNotBlank.java | 22 +++ .../entities/UserNotEmpty.java | 22 +++ .../entities/UserNotNull.java | 22 +++ .../test/UserNotBlankUnitTest.java | 63 +++++++++ .../test/UserNotEmptyUnitTest.java | 54 ++++++++ .../test/UserNotNullUnitTest.java | 54 ++++++++ 8 files changed, 323 insertions(+), 54 deletions(-) create mode 100644 javaxval/src/main/java/org/baeldung/javabeanconstraints/appplication/Application.java create mode 100644 javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotBlank.java create mode 100644 javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotEmpty.java create mode 100644 javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotNull.java create mode 100644 javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotBlankUnitTest.java create mode 100644 javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotEmptyUnitTest.java create mode 100644 javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotNullUnitTest.java diff --git a/javaxval/pom.xml b/javaxval/pom.xml index 7af766261b..63cb4c1d1d 100644 --- a/javaxval/pom.xml +++ b/javaxval/pom.xml @@ -1,55 +1,73 @@ - - 4.0.0 - com.baeldung - javaxval - 0.1-SNAPSHOT - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - - org.hibernate - hibernate-validator-annotation-processor - ${hibernate-validator.version} - - - javax.el - javax.el-api - ${javax.el-api.version} - - - org.glassfish.web - javax.el - ${javax.el.version} - - - org.springframework - spring-context - ${org.springframework.version} - - - org.springframework - spring-test - ${org.springframework.version} - - - - - 2.0.1.Final - 6.0.7.Final - 3.0.0 - 2.2.6 - 5.0.2.RELEASE - - + + 4.0.0 + com.baeldung + javaxval + 0.1-SNAPSHOT + + + com.baeldung + parent-modules + 1.0.0-SNAPSHOT + + + + + javax.validation + validation-api + ${validation-api.version} + + + org.hibernate + hibernate-validator + ${hibernate-validator.version} + + + org.hibernate + hibernate-validator-annotation-processor + ${hibernate-validator.version} + + + javax.el + javax.el-api + ${javax.el-api.version} + + + org.glassfish.web + javax.el + ${javax.el.version} + + + org.springframework + spring-context + ${org.springframework.version} + + + org.springframework + spring-test + ${org.springframework.version} + + + junit + junit + ${junit.version} + test + + + org.assertj + assertj-core + ${assertj.version} + test + + + + + 2.0.1.Final + 6.0.7.Final + 3.0.0 + 2.2.6 + 5.0.2.RELEASE + 4.12 + 3.11.1 + \ No newline at end of file diff --git a/javaxval/src/main/java/org/baeldung/javabeanconstraints/appplication/Application.java b/javaxval/src/main/java/org/baeldung/javabeanconstraints/appplication/Application.java new file mode 100644 index 0000000000..c9f2ab6f98 --- /dev/null +++ b/javaxval/src/main/java/org/baeldung/javabeanconstraints/appplication/Application.java @@ -0,0 +1,14 @@ +package org.baeldung.javabeanconstraints.appplication; + +import javax.validation.Validation; +import javax.validation.Validator; +import org.baeldung.javabeanconstraints.entities.UserNotBlank; + +public class Application { + + public static void main(String[] args) throws Exception { + Validator validator = Validation.buildDefaultValidatorFactory().getValidator(); + UserNotBlank user = new UserNotBlank(" "); + validator.validate(user).stream().forEach(violation -> System.out.println(violation.getMessage())); + } +} diff --git a/javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotBlank.java b/javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotBlank.java new file mode 100644 index 0000000000..2ea6a3af56 --- /dev/null +++ b/javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotBlank.java @@ -0,0 +1,22 @@ +package org.baeldung.javabeanconstraints.entities; + +import javax.validation.constraints.NotBlank; + +public class UserNotBlank { + + @NotBlank(message = "Name is mandatory") + private final String name; + + public UserNotBlank(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + @Override + public String toString() { + return "User{" + "name=" + name + "}"; + } +} diff --git a/javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotEmpty.java b/javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotEmpty.java new file mode 100644 index 0000000000..39e34b63d3 --- /dev/null +++ b/javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotEmpty.java @@ -0,0 +1,22 @@ +package org.baeldung.javabeanconstraints.entities; + +import javax.validation.constraints.NotEmpty; + +public class UserNotEmpty { + + @NotEmpty(message = "Name is mandatory") + private final String name; + + public UserNotEmpty(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + @Override + public String toString() { + return "User{" + "name=" + name + "}"; + } +} diff --git a/javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotNull.java b/javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotNull.java new file mode 100644 index 0000000000..598c9ba9f9 --- /dev/null +++ b/javaxval/src/main/java/org/baeldung/javabeanconstraints/entities/UserNotNull.java @@ -0,0 +1,22 @@ +package org.baeldung.javabeanconstraints.entities; + +import javax.validation.constraints.NotNull; + +public class UserNotNull { + + @NotNull(message = "Name is mandatory") + private final String name; + + public UserNotNull(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + @Override + public String toString() { + return "User{" + "name=" + name + "}"; + } +} diff --git a/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotBlankUnitTest.java b/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotBlankUnitTest.java new file mode 100644 index 0000000000..954833fef1 --- /dev/null +++ b/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotBlankUnitTest.java @@ -0,0 +1,63 @@ +package org.baeldung.javabeanconstraints.test; + +import java.util.Set; +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.Validator; +import static org.assertj.core.api.Assertions.assertThat; +import org.baeldung.javabeanconstraints.entities.UserNotBlank; +import org.junit.BeforeClass; +import org.junit.Test; + +public class UserNotBlankUnitTest { + + private static Validator validator; + + @BeforeClass + public static void setupValidatorInstance() { + validator = Validation.buildDefaultValidatorFactory().getValidator(); + } + + @Test + public void whenNotBlankName_thenNoConstraintViolations() { + UserNotBlank user = new UserNotBlank("John"); + + Set> violations = validator.validate(user); + + assertThat(violations.size()).isEqualTo(0); + } + + @Test + public void whenBlankName_thenOneConstraintViolation() { + UserNotBlank user = new UserNotBlank(" "); + + Set> violations = validator.validate(user); + + assertThat(violations.size()).isEqualTo(1); + } + + @Test + public void whenEmptyName_thenOneConstraintViolation() { + UserNotBlank user = new UserNotBlank(""); + + Set> violations = validator.validate(user); + + assertThat(violations.size()).isEqualTo(1); + } + + @Test + public void whenNullName_thenOneConstraintViolation() { + UserNotBlank user = new UserNotBlank(null); + + Set> violations = validator.validate(user); + + assertThat(violations.size()).isEqualTo(1); + } + + @Test + public void whenToString_thenCorrect() { + UserNotBlank user = new UserNotBlank("John"); + + assertThat(user.toString()).isEqualTo("User{name=John}"); + } +} diff --git a/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotEmptyUnitTest.java b/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotEmptyUnitTest.java new file mode 100644 index 0000000000..c2675ed8b6 --- /dev/null +++ b/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotEmptyUnitTest.java @@ -0,0 +1,54 @@ +package org.baeldung.javabeanconstraints.test; + +import java.util.Set; +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.Validator; +import static org.assertj.core.api.Assertions.assertThat; +import org.baeldung.javabeanconstraints.entities.UserNotEmpty; +import org.junit.BeforeClass; +import org.junit.Test; + +public class UserNotEmptyUnitTest { + + private static Validator validator; + + @BeforeClass + public static void setupValidatorInstance() { + validator = Validation.buildDefaultValidatorFactory().getValidator(); + } + + @Test + public void whenNotEmptyName_thenNoConstraintViolations() { + UserNotEmpty user = new UserNotEmpty("John"); + + Set> violations = validator.validate(user); + + assertThat(violations.size()).isEqualTo(0); + } + + @Test + public void whenEmptyName_thenOneConstraintViolation() { + UserNotEmpty user = new UserNotEmpty(""); + + Set> violations = validator.validate(user); + + assertThat(violations.size()).isEqualTo(1); + } + + @Test + public void whenNullName_thenOneConstraintViolation() { + UserNotEmpty user = new UserNotEmpty(null); + + Set> violations = validator.validate(user); + + assertThat(violations.size()).isEqualTo(1); + } + + @Test + public void whenToString_thenCorrect() { + UserNotEmpty user = new UserNotEmpty("John"); + + assertThat(user.toString()).isEqualTo("User{name=John}"); + } +} diff --git a/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotNullUnitTest.java b/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotNullUnitTest.java new file mode 100644 index 0000000000..3dd1811947 --- /dev/null +++ b/javaxval/src/test/java/org/baeldung/javabeanconstraints/test/UserNotNullUnitTest.java @@ -0,0 +1,54 @@ +package org.baeldung.javabeanconstraints.test; + +import java.util.Set; +import javax.validation.ConstraintViolation; +import javax.validation.Validation; +import javax.validation.Validator; +import static org.assertj.core.api.Assertions.assertThat; +import org.baeldung.javabeanconstraints.entities.UserNotNull; +import org.junit.BeforeClass; +import org.junit.Test; + +public class UserNotNullUnitTest { + + private static Validator validator; + + @BeforeClass + public static void setupValidatorInstance() { + validator = Validation.buildDefaultValidatorFactory().getValidator(); + } + + @Test + public void whenNotNullName_thenNoConstraintViolations() { + UserNotNull user = new UserNotNull("John"); + + Set> violations = validator.validate(user); + + assertThat(violations.size()).isEqualTo(0); + } + + @Test + public void whenNullName_thenOneConstraintViolation() { + UserNotNull user = new UserNotNull(null); + + Set> violations = validator.validate(user); + + assertThat(violations.size()).isEqualTo(1); + } + + @Test + public void whenEmptyName_thenNoConstraintViolations() { + UserNotNull user = new UserNotNull(""); + + Set> violations = validator.validate(user); + + assertThat(violations.size()).isEqualTo(0); + } + + @Test + public void whenToString_thenCorrect() { + UserNotNull user = new UserNotNull("John"); + + assertThat(user.toString()).isEqualTo("User{name=John}"); + } +} From 2af9eb89f18557e566c2b9cdd0218b5a01745b99 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 29 Sep 2018 21:12:21 +0530 Subject: [PATCH 48/56] [BAEL-9017] - Fixed conflicts --- .../{AppTest.java => AppUnitTest.java} | 6 +++--- ...erviceTest.java => MyServiceUnitTest.java} | 4 ++-- ...Test.java => EmployeeServiceUnitTest.java} | 2 +- ...viceTest.java => UserServiceLiveTest.java} | 2 +- ...ateDiffTest.java => DateDiffUnitTest.java} | 2 +- pom.xml | 20 +++++++++---------- .../{AppTest.java => AppLiveTest.java} | 6 +++--- ....java => GroovyConfigurationUnitTest.java} | 2 +- ...st.java => JavaConfigurationUnitTest.java} | 2 +- ...est.java => XmlConfigurationUnitTest.java} | 2 +- .../{AppTest.java => AppUnitTest.java} | 6 +++--- .../pmd/{CntTest.java => CntUnitTest.java} | 2 +- 12 files changed, 28 insertions(+), 28 deletions(-) rename animal-sniffer-mvn-plugin/src/test/java/com/baeldung/{AppTest.java => AppUnitTest.java} (81%) rename guest/log4j2-example/src/test/java/com/stackify/services/{MyServiceTest.java => MyServiceUnitTest.java} (98%) rename guest/logback-example/src/test/java/com/stackify/services/{EmployeeServiceTest.java => EmployeeServiceUnitTest.java} (98%) rename guest/webservices/rest-server/src/test/java/com/stackify/services/{UserServiceTest.java => UserServiceLiveTest.java} (95%) rename java-difference-date/src/test/java/com/baeldung/{DateDiffTest.java => DateDiffUnitTest.java} (98%) rename rest-with-spark-java/src/test/java/com/baeldung/{AppTest.java => AppLiveTest.java} (96%) rename spring-groovy/src/test/java/com/baeldug/groovyconfig/{GroovyConfigurationTest.java => GroovyConfigurationUnitTest.java} (97%) rename spring-groovy/src/test/java/com/baeldug/groovyconfig/{JavaConfigurationTest.java => JavaConfigurationUnitTest.java} (93%) rename spring-groovy/src/test/java/com/baeldug/groovyconfig/{XmlConfigurationTest.java => XmlConfigurationUnitTest.java} (94%) rename spring-groovy/src/test/java/com/baeldug/spring_groovy/{AppTest.java => AppUnitTest.java} (82%) rename static-analysis/src/test/java/com/baeldung/pmd/{CntTest.java => CntUnitTest.java} (92%) diff --git a/animal-sniffer-mvn-plugin/src/test/java/com/baeldung/AppTest.java b/animal-sniffer-mvn-plugin/src/test/java/com/baeldung/AppUnitTest.java similarity index 81% rename from animal-sniffer-mvn-plugin/src/test/java/com/baeldung/AppTest.java rename to animal-sniffer-mvn-plugin/src/test/java/com/baeldung/AppUnitTest.java index 8ecb1bc629..dcfd22ff87 100644 --- a/animal-sniffer-mvn-plugin/src/test/java/com/baeldung/AppTest.java +++ b/animal-sniffer-mvn-plugin/src/test/java/com/baeldung/AppUnitTest.java @@ -7,7 +7,7 @@ import junit.framework.TestSuite; /** * Unit test for simple App. */ -public class AppTest +public class AppUnitTest extends TestCase { /** @@ -15,7 +15,7 @@ public class AppTest * * @param testName name of the test case */ - public AppTest( String testName ) + public AppUnitTest( String testName ) { super( testName ); } @@ -25,7 +25,7 @@ public class AppTest */ public static Test suite() { - return new TestSuite( AppTest.class ); + return new TestSuite( AppUnitTest.class ); } /** diff --git a/guest/log4j2-example/src/test/java/com/stackify/services/MyServiceTest.java b/guest/log4j2-example/src/test/java/com/stackify/services/MyServiceUnitTest.java similarity index 98% rename from guest/log4j2-example/src/test/java/com/stackify/services/MyServiceTest.java rename to guest/log4j2-example/src/test/java/com/stackify/services/MyServiceUnitTest.java index 49e367e45b..bd08225be4 100644 --- a/guest/log4j2-example/src/test/java/com/stackify/services/MyServiceTest.java +++ b/guest/log4j2-example/src/test/java/com/stackify/services/MyServiceUnitTest.java @@ -18,9 +18,9 @@ import org.junit.Test; import com.stackify.models.User; import com.stackify.services.MyService; -public class MyServiceTest { +public class MyServiceUnitTest { - private static final Logger logger = LogManager.getLogger(MyServiceTest.class); + private static final Logger logger = LogManager.getLogger(MyServiceUnitTest.class); @Test public void testService() { diff --git a/guest/logback-example/src/test/java/com/stackify/services/EmployeeServiceTest.java b/guest/logback-example/src/test/java/com/stackify/services/EmployeeServiceUnitTest.java similarity index 98% rename from guest/logback-example/src/test/java/com/stackify/services/EmployeeServiceTest.java rename to guest/logback-example/src/test/java/com/stackify/services/EmployeeServiceUnitTest.java index 187b27e1df..a3051f7087 100644 --- a/guest/logback-example/src/test/java/com/stackify/services/EmployeeServiceTest.java +++ b/guest/logback-example/src/test/java/com/stackify/services/EmployeeServiceUnitTest.java @@ -9,7 +9,7 @@ import com.stackify.models.Employee; import ch.qos.logback.classic.Level; -public class EmployeeServiceTest { +public class EmployeeServiceUnitTest { private static final Logger logger = LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); private EmployeeService employeeService = new EmployeeService(); diff --git a/guest/webservices/rest-server/src/test/java/com/stackify/services/UserServiceTest.java b/guest/webservices/rest-server/src/test/java/com/stackify/services/UserServiceLiveTest.java similarity index 95% rename from guest/webservices/rest-server/src/test/java/com/stackify/services/UserServiceTest.java rename to guest/webservices/rest-server/src/test/java/com/stackify/services/UserServiceLiveTest.java index 064951fbbe..be3992b7f7 100644 --- a/guest/webservices/rest-server/src/test/java/com/stackify/services/UserServiceTest.java +++ b/guest/webservices/rest-server/src/test/java/com/stackify/services/UserServiceLiveTest.java @@ -6,7 +6,7 @@ import io.restassured.RestAssured; import static io.restassured.RestAssured.*; import static org.hamcrest.CoreMatchers.*; -public class UserServiceTest { +public class UserServiceLiveTest { @Test public void whenAddUser_thenGetUserOk() { RestAssured.baseURI = "http://localhost:8080/rest-server"; diff --git a/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java b/java-difference-date/src/test/java/com/baeldung/DateDiffUnitTest.java similarity index 98% rename from java-difference-date/src/test/java/com/baeldung/DateDiffTest.java rename to java-difference-date/src/test/java/com/baeldung/DateDiffUnitTest.java index 4203f7ef38..2c5323be6f 100644 --- a/java-difference-date/src/test/java/com/baeldung/DateDiffTest.java +++ b/java-difference-date/src/test/java/com/baeldung/DateDiffUnitTest.java @@ -14,7 +14,7 @@ import java.util.concurrent.TimeUnit; import static org.junit.Assert.assertEquals; -public class DateDiffTest { +public class DateDiffUnitTest { @Test public void givenTwoDatesBeforeJava8_whenDifferentiating_thenWeGetSix() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy", Locale.ENGLISH); diff --git a/pom.xml b/pom.xml index 495aeb434b..d99832db52 100644 --- a/pom.xml +++ b/pom.xml @@ -1081,8 +1081,8 @@ java-websocket - - + activejdbc + animal-sniffer-mvn-plugin apache-bval apache-shiro @@ -1098,7 +1098,7 @@ dubbo - + java-difference-date jni jooby @@ -1106,13 +1106,13 @@ ratpack - + rest-with-spark-java spring-boot-autoconfiguration spring-boot-custom-starter - + spring-boot-jasypt spring-data-rest-querydsl - + spring-groovy spring-mobile spring-mustache spring-mvc-simple @@ -1123,7 +1123,7 @@ spring-roo spring-security-stormpath sse-jaxrs - + static-analysis stripe @@ -1134,8 +1134,8 @@ - - + + @@ -1151,7 +1151,7 @@ spring-boot-h2/spring-boot-h2-database - + diff --git a/rest-with-spark-java/src/test/java/com/baeldung/AppTest.java b/rest-with-spark-java/src/test/java/com/baeldung/AppLiveTest.java similarity index 96% rename from rest-with-spark-java/src/test/java/com/baeldung/AppTest.java rename to rest-with-spark-java/src/test/java/com/baeldung/AppLiveTest.java index c7b88dd6d1..9e24879767 100644 --- a/rest-with-spark-java/src/test/java/com/baeldung/AppTest.java +++ b/rest-with-spark-java/src/test/java/com/baeldung/AppLiveTest.java @@ -16,16 +16,16 @@ import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; -public class AppTest extends TestCase { +public class AppLiveTest extends TestCase { ObjectMapper mapper = new ObjectMapper(); - public AppTest( String testName ) { + public AppLiveTest( String testName ) { super( testName ); } public static Test suite() { - return new TestSuite( AppTest.class ); + return new TestSuite( AppLiveTest.class ); } public void testApp() throws IOException, ClassNotFoundException { diff --git a/spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationTest.java b/spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationUnitTest.java similarity index 97% rename from spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationTest.java rename to spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationUnitTest.java index 91ca6dbfe9..dbefba5ba5 100644 --- a/spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationTest.java +++ b/spring-groovy/src/test/java/com/baeldug/groovyconfig/GroovyConfigurationUnitTest.java @@ -7,7 +7,7 @@ import java.io.File; import org.junit.Test; import org.springframework.context.support.GenericGroovyApplicationContext; -public class GroovyConfigurationTest { +public class GroovyConfigurationUnitTest { private static final String FILE_NAME = "GroovyBeanConfig.groovy"; private static final String FILE_PATH = "src/main/java/com/baeldug/groovyconfig/"; diff --git a/spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationTest.java b/spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationUnitTest.java similarity index 93% rename from spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationTest.java rename to spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationUnitTest.java index 2d9b1000ff..c1e16f1b62 100644 --- a/spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationTest.java +++ b/spring-groovy/src/test/java/com/baeldug/groovyconfig/JavaConfigurationUnitTest.java @@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; -public class JavaConfigurationTest { +public class JavaConfigurationUnitTest { @Test public void whenJavaConfig_thenCorrectPerson() { diff --git a/spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationTest.java b/spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationUnitTest.java similarity index 94% rename from spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationTest.java rename to spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationUnitTest.java index 3ee724207c..b8d341ee39 100644 --- a/spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationTest.java +++ b/spring-groovy/src/test/java/com/baeldug/groovyconfig/XmlConfigurationUnitTest.java @@ -6,7 +6,7 @@ import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -public class XmlConfigurationTest { +public class XmlConfigurationUnitTest { @Test public void whenXmlConfig_thenCorrectPerson() { diff --git a/spring-groovy/src/test/java/com/baeldug/spring_groovy/AppTest.java b/spring-groovy/src/test/java/com/baeldug/spring_groovy/AppUnitTest.java similarity index 82% rename from spring-groovy/src/test/java/com/baeldug/spring_groovy/AppTest.java rename to spring-groovy/src/test/java/com/baeldug/spring_groovy/AppUnitTest.java index 19eefb6c0f..3d8fa3e2d8 100644 --- a/spring-groovy/src/test/java/com/baeldug/spring_groovy/AppTest.java +++ b/spring-groovy/src/test/java/com/baeldug/spring_groovy/AppUnitTest.java @@ -7,7 +7,7 @@ import junit.framework.TestSuite; /** * Unit test for simple App. */ -public class AppTest +public class AppUnitTest extends TestCase { /** @@ -15,7 +15,7 @@ public class AppTest * * @param testName name of the test case */ - public AppTest( String testName ) + public AppUnitTest( String testName ) { super( testName ); } @@ -25,7 +25,7 @@ public class AppTest */ public static Test suite() { - return new TestSuite( AppTest.class ); + return new TestSuite( AppUnitTest.class ); } /** diff --git a/static-analysis/src/test/java/com/baeldung/pmd/CntTest.java b/static-analysis/src/test/java/com/baeldung/pmd/CntUnitTest.java similarity index 92% rename from static-analysis/src/test/java/com/baeldung/pmd/CntTest.java rename to static-analysis/src/test/java/com/baeldung/pmd/CntUnitTest.java index ed72602f99..cdbf9f6f5e 100644 --- a/static-analysis/src/test/java/com/baeldung/pmd/CntTest.java +++ b/static-analysis/src/test/java/com/baeldung/pmd/CntUnitTest.java @@ -4,7 +4,7 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; -public class CntTest { +public class CntUnitTest { private Cnt service; From aeb17113973b9d216a9cf9c0eb40fb79bc48d957 Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sat, 29 Sep 2018 23:22:40 +0530 Subject: [PATCH 49/56] [BAEL-9018] - Fixed malformed POMs and remaining PMD problems --- apache-avro/pom.xml | 2 +- ...> AvroSerealizerDeSerealizerUnitTest.java} | 2 +- flyway/pom.xml | 1 + ...st.java => FlywayApplicationUnitTest.java} | 2 +- guest/spring-mvc/pom.xml | 2 +- guest/spring-security/pom.xml | 2 +- pom.xml | 32 +++++++++---------- spring-custom-aop/pom.xml | 1 + 8 files changed, 23 insertions(+), 21 deletions(-) rename apache-avro/src/test/java/com/baeldung/avro/util/serealization/{AvroSerealizerDeSerealizerTest.java => AvroSerealizerDeSerealizerUnitTest.java} (98%) rename flyway/src/test/java/com/baeldung/flywaycallbacks/{FlywayApplicationTest.java => FlywayApplicationUnitTest.java} (98%) diff --git a/apache-avro/pom.xml b/apache-avro/pom.xml index 3e3234ff96..ddf5844271 100644 --- a/apache-avro/pom.xml +++ b/apache-avro/pom.xml @@ -6,7 +6,7 @@ com.baeldung apache-avro 0.0.1-SNAPSHOT - Apache Avro + Apache Avro UTF-8 diff --git a/apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerTest.java b/apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerUnitTest.java similarity index 98% rename from apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerTest.java rename to apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerUnitTest.java index ecd15ccbbc..992ea806c3 100644 --- a/apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerTest.java +++ b/apache-avro/src/test/java/com/baeldung/avro/util/serealization/AvroSerealizerDeSerealizerUnitTest.java @@ -13,7 +13,7 @@ import java.util.Objects; import static org.junit.Assert.*; -public class AvroSerealizerDeSerealizerTest { +public class AvroSerealizerDeSerealizerUnitTest { AvroSerealizer serealizer; AvroDeSerealizer deSerealizer; diff --git a/flyway/pom.xml b/flyway/pom.xml index b1cc58af3d..353bbfb1ec 100644 --- a/flyway/pom.xml +++ b/flyway/pom.xml @@ -65,6 +65,7 @@ 5.0.2 5.0.2 + 1.4.195 diff --git a/flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayApplicationTest.java b/flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayApplicationUnitTest.java similarity index 98% rename from flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayApplicationTest.java rename to flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayApplicationUnitTest.java index 5e96fff64d..bf30ce604d 100644 --- a/flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayApplicationTest.java +++ b/flyway/src/test/java/com/baeldung/flywaycallbacks/FlywayApplicationUnitTest.java @@ -16,7 +16,7 @@ import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) @ContextConfiguration(classes = FlywayCallbackTestConfig.class) -public class FlywayApplicationTest { +public class FlywayApplicationUnitTest { private Log log = LogFactory.getLog(getClass()); diff --git a/guest/spring-mvc/pom.xml b/guest/spring-mvc/pom.xml index 42543b5be0..c0ef451605 100644 --- a/guest/spring-mvc/pom.xml +++ b/guest/spring-mvc/pom.xml @@ -12,7 +12,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.0.M5 + 2.0.0.RELEASE diff --git a/guest/spring-security/pom.xml b/guest/spring-security/pom.xml index baca3bce85..8be42ba32b 100644 --- a/guest/spring-security/pom.xml +++ b/guest/spring-security/pom.xml @@ -11,7 +11,7 @@ org.springframework.boot spring-boot-starter-parent - 2.0.0.M6 + 2.0.0.RELEASE diff --git a/pom.xml b/pom.xml index 495aeb434b..d322b71343 100644 --- a/pom.xml +++ b/pom.xml @@ -611,11 +611,11 @@ java-websocket activejdbc - + apache-avro apache-bval apache-shiro apache-spark - + asciidoctor checker-plugin @@ -624,7 +624,7 @@ dagger data-structures dubbo - + flyway @@ -638,7 +638,7 @@ spring-boot-autoconfiguration spring-boot-custom-starter spring-boot-jasypt - + spring-custom-aop spring-data-rest-querydsl spring-mobile @@ -667,8 +667,8 @@ - - + + jenkins/hello-world @@ -1096,9 +1096,9 @@ dagger data-structures dubbo - + flyway - + java-difference-date jni jooby @@ -1106,13 +1106,13 @@ ratpack - + rest-with-spark-java spring-boot-autoconfiguration spring-boot-custom-starter - - + spring-boot-jasypt + spring-custom-aop spring-data-rest-querydsl - + spring-groovy spring-mobile spring-mustache spring-mvc-simple @@ -1123,7 +1123,7 @@ spring-roo spring-security-stormpath sse-jaxrs - + static-analysis stripe @@ -1139,8 +1139,8 @@ - - + + jenkins/hello-world @@ -1151,7 +1151,7 @@ spring-boot-h2/spring-boot-h2-database - + diff --git a/spring-custom-aop/pom.xml b/spring-custom-aop/pom.xml index fd5f87a476..f0b1dbb5ac 100644 --- a/spring-custom-aop/pom.xml +++ b/spring-custom-aop/pom.xml @@ -149,6 +149,7 @@ 3.1.7 8.5.11 18.0 + 8.0.43 From fb34ecb351d966768e14c821adf010952aed6e29 Mon Sep 17 00:00:00 2001 From: hardik-r-shah Date: Sun, 30 Sep 2018 10:14:49 +0530 Subject: [PATCH 50/56] BAEL-2149 initial commit (#5186) * BAEL-2149 initial commit * BAEL-2149 calculate percentage --- .../percentage/PercentageCalculator.java | 21 ++++++++++++ .../PercentageCalculatorUnitTest.java | 33 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 java-numbers/src/main/java/com/baeldung/percentage/PercentageCalculator.java create mode 100644 java-numbers/src/test/java/com/baeldung/percentage/PercentageCalculatorUnitTest.java diff --git a/java-numbers/src/main/java/com/baeldung/percentage/PercentageCalculator.java b/java-numbers/src/main/java/com/baeldung/percentage/PercentageCalculator.java new file mode 100644 index 0000000000..e74de2cc67 --- /dev/null +++ b/java-numbers/src/main/java/com/baeldung/percentage/PercentageCalculator.java @@ -0,0 +1,21 @@ +package com.baeldung.percentage; + +import java.util.Scanner; + +public class PercentageCalculator { + + public double calculatePercentage(double obtained,double total){ + return obtained*100/total; + } + + public static void main(String[] args) { + PercentageCalculator pc = new PercentageCalculator(); + Scanner in = new Scanner(System.in); + System.out.println("Enter obtained marks:"); + double obtained = in.nextDouble(); + System.out.println("Enter total marks:"); + double total =in.nextDouble(); + System.out.println("Percentage obtained :"+pc.calculatePercentage(obtained,total)); + } + +} diff --git a/java-numbers/src/test/java/com/baeldung/percentage/PercentageCalculatorUnitTest.java b/java-numbers/src/test/java/com/baeldung/percentage/PercentageCalculatorUnitTest.java new file mode 100644 index 0000000000..202d4f8112 --- /dev/null +++ b/java-numbers/src/test/java/com/baeldung/percentage/PercentageCalculatorUnitTest.java @@ -0,0 +1,33 @@ +package com.baeldung.percentage; + +import org.junit.Assert; +import org.junit.Test; + +public class PercentageCalculatorUnitTest { + private PercentageCalculator pc = new PercentageCalculator(); + + @Test + public void whenPass2Integers_thenShouldCalculatePercentage(){ + Assert.assertEquals("Result not as expected", + 50.0,pc.calculatePercentage(50,100),0.1); + } + + @Test + public void whenPassObtainedMarksAsDouble_thenShouldCalculatePercentage(){ + Assert.assertEquals("Result not as expected",5.05, + pc.calculatePercentage(50.5,1000),0.1); + } + + @Test + public void whenPassTotalMarksAsDouble_thenShouldCalculatePercentage(){ + Assert.assertEquals("Result not as expected",19.6, + pc.calculatePercentage(5,25.5),0.1); + } + + @Test + public void whenPass2DoubleNumbers_thenShouldCalculatePercentage(){ + Assert.assertEquals("Result not as expected",20, + pc.calculatePercentage(5.5,27.5),0.1); + } + +} From ac15191bf624c7a51454edbd4ff55d7a94692ffe Mon Sep 17 00:00:00 2001 From: amit2103 Date: Sun, 30 Sep 2018 10:42:59 +0530 Subject: [PATCH 51/56] [BAEL-9017] - Uncommented PMD violations from default profile --- pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index d99832db52..9076867362 100644 --- a/pom.xml +++ b/pom.xml @@ -610,7 +610,7 @@ java-websocket activejdbc - + animal-sniffer-mvn-plugin apache-bval apache-shiro @@ -626,7 +626,7 @@ dubbo - + java-difference-date jni jooby @@ -634,13 +634,13 @@ ratpack - + rest-with-spark-java spring-boot-autoconfiguration spring-boot-custom-starter spring-boot-jasypt spring-data-rest-querydsl - + spring-groovy spring-mobile spring-mustache spring-mvc-simple @@ -651,7 +651,7 @@ spring-roo spring-security-stormpath sse-jaxrs - + static-analysis stripe Twitter4J @@ -662,8 +662,8 @@ - - + + @@ -679,7 +679,7 @@ spring-boot-h2/spring-boot-h2-database - + From d475578d3b68d35ae26c90bbb2ede77b71b1874a Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 30 Sep 2018 08:45:49 +0300 Subject: [PATCH 52/56] Update pom.xml --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 97d1b1dff5..8fb43ead16 100644 --- a/pom.xml +++ b/pom.xml @@ -1083,11 +1083,11 @@ java-websocket activejdbc animal-sniffer-mvn-plugin - + apache-avro apache-bval apache-shiro apache-spark - + asciidoctor checker-plugin From 8cff5212f90d44ebc88c999cb235304399012e49 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 30 Sep 2018 11:13:35 +0300 Subject: [PATCH 53/56] update read file test --- .../com/baeldung/file/FileOperationsManualTest.java | 11 ++++++----- core-java-io/src/test/resources/fileTest.txt | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 core-java-io/src/test/resources/fileTest.txt diff --git a/core-java-io/src/test/java/com/baeldung/file/FileOperationsManualTest.java b/core-java-io/src/test/java/com/baeldung/file/FileOperationsManualTest.java index 6a020f5eae..faa6b0ae8d 100644 --- a/core-java-io/src/test/java/com/baeldung/file/FileOperationsManualTest.java +++ b/core-java-io/src/test/java/com/baeldung/file/FileOperationsManualTest.java @@ -15,9 +15,11 @@ import java.io.InputStreamReader; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; +import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.stream.Collectors; import java.util.stream.Stream; import static org.junit.Assert.assertEquals; @@ -50,7 +52,7 @@ public class FileOperationsManualTest { @Test public void givenFileName_whenUsingJarFile_thenFileData() throws IOException { - String expectedData = "BSD License"; + String expectedData = "MIT License"; Class clazz = Matchers.class; InputStream inputStream = clazz.getResourceAsStream("/LICENSE.txt"); @@ -79,7 +81,7 @@ public class FileOperationsManualTest { ClassLoader classLoader = getClass().getClassLoader(); File file = new File(classLoader.getResource("fileTest.txt").getFile()); - String data = FileUtils.readFileToString(file); + String data = FileUtils.readFileToString(file, "UTF-8"); assertEquals(expectedData, data.trim()); } @@ -102,12 +104,11 @@ public class FileOperationsManualTest { Path path = Paths.get(getClass().getClassLoader().getResource("fileTest.txt").toURI()); - StringBuilder data = new StringBuilder(); Stream lines = Files.lines(path); - lines.forEach(line -> data.append(line).append("\n")); + String data = lines.collect(Collectors.joining("\n")); lines.close(); - assertEquals(expectedData, data.toString().trim()); + assertEquals(expectedData, data.trim()); } private String readFromInputStream(InputStream inputStream) throws IOException { diff --git a/core-java-io/src/test/resources/fileTest.txt b/core-java-io/src/test/resources/fileTest.txt new file mode 100644 index 0000000000..ce4bea208b --- /dev/null +++ b/core-java-io/src/test/resources/fileTest.txt @@ -0,0 +1 @@ +Hello World from fileTest.txt!!! \ No newline at end of file From dcf5a40c3fa2f4972b9e119de51a54463e417703 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 30 Sep 2018 11:14:54 +0300 Subject: [PATCH 54/56] remove import --- .../test/java/com/baeldung/file/FileOperationsManualTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core-java-io/src/test/java/com/baeldung/file/FileOperationsManualTest.java b/core-java-io/src/test/java/com/baeldung/file/FileOperationsManualTest.java index faa6b0ae8d..e781489808 100644 --- a/core-java-io/src/test/java/com/baeldung/file/FileOperationsManualTest.java +++ b/core-java-io/src/test/java/com/baeldung/file/FileOperationsManualTest.java @@ -15,7 +15,6 @@ import java.io.InputStreamReader; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; -import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; From 75430b99f2680f71b52e3d339910617c23c9cee1 Mon Sep 17 00:00:00 2001 From: Loredana Crusoveanu Date: Sun, 30 Sep 2018 13:37:09 +0300 Subject: [PATCH 55/56] add calc age test --- .../java/com/baeldung/date/AgeCalculator.java | 32 +++++++++++++++++++ .../baeldung/date/AgeCalculatorUnitTest.java | 31 ++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 java-dates/src/main/java/com/baeldung/date/AgeCalculator.java create mode 100644 java-dates/src/test/java/com/baeldung/date/AgeCalculatorUnitTest.java diff --git a/java-dates/src/main/java/com/baeldung/date/AgeCalculator.java b/java-dates/src/main/java/com/baeldung/date/AgeCalculator.java new file mode 100644 index 0000000000..c031c97dec --- /dev/null +++ b/java-dates/src/main/java/com/baeldung/date/AgeCalculator.java @@ -0,0 +1,32 @@ +package com.baeldung.date; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.Period; +import java.util.Date; +import org.joda.time.Years; + +public class AgeCalculator { + + public int calculateAge(LocalDate birthDate, LocalDate currentDate) { + // validate inputs ... + return Period.between(birthDate, currentDate) + .getYears(); + } + + public int calculateAgeWithJodaTime(org.joda.time.LocalDate birthDate, org.joda.time.LocalDate currentDate) { + // validate inputs ... + Years age = Years.yearsBetween(birthDate, currentDate); + return age.getYears(); + } + + public int calculateAgeWithJava7(Date birthDate, Date currentDate) { + // validate inputs ... + DateFormat formatter = new SimpleDateFormat("yyyyMMdd"); + int d1 = Integer.parseInt(formatter.format(birthDate)); + int d2 = Integer.parseInt(formatter.format(currentDate)); + int age = (d2 - d1) / 10000; + return age; + } +} \ No newline at end of file diff --git a/java-dates/src/test/java/com/baeldung/date/AgeCalculatorUnitTest.java b/java-dates/src/test/java/com/baeldung/date/AgeCalculatorUnitTest.java new file mode 100644 index 0000000000..dcd261337c --- /dev/null +++ b/java-dates/src/test/java/com/baeldung/date/AgeCalculatorUnitTest.java @@ -0,0 +1,31 @@ +package com.baeldung.date; + +import static org.junit.Assert.assertEquals; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.util.Date; +import org.junit.jupiter.api.Test; + +public class AgeCalculatorUnitTest { + AgeCalculator ageCalculator = new AgeCalculator(); + + @Test + public void givenLocalDate_whenCalculateAge_thenOk() { + assertEquals(10, ageCalculator.calculateAge(LocalDate.of(2008, 5, 20), LocalDate.of(2018, 9, 20))); + } + + @Test + public void givenJodaTime_whenCalculateAge_thenOk() { + assertEquals(10, ageCalculator.calculateAgeWithJodaTime(new org.joda.time.LocalDate(2008, 5, 20), new org.joda.time.LocalDate(2018, 9, 20))); + } + + @Test + public void givenDate_whenCalculateAge_thenOk() throws ParseException { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd"); + Date birthDate = sdf.parse("2008-05-20"); + Date currentDate = sdf.parse("2018-09-20"); + assertEquals(10, ageCalculator.calculateAgeWithJava7(birthDate, currentDate)); + } + +} \ No newline at end of file From b4aa279eaa46d627ee8a787d299e7dd9579f0738 Mon Sep 17 00:00:00 2001 From: Shubhra Srivastava Date: Mon, 1 Oct 2018 03:22:49 +0530 Subject: [PATCH 56/56] BALE-2224 Ternary Operator In Java (#5362) --- .../TernaryOperatorUnitTest.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 core-java/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java diff --git a/core-java/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java b/core-java/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java new file mode 100644 index 0000000000..6b292ad8ab --- /dev/null +++ b/core-java/src/test/java/com/baeldung/ternaryoperator/TernaryOperatorUnitTest.java @@ -0,0 +1,43 @@ +package com.baeldung.ternaryoperator; + +import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; + +public class TernaryOperatorUnitTest { + + @Test + public void givenACondition_whenUsingTernaryOperator_thenItEvaluatesConditionAndReturnsAValue() { + int number = 10; + String msg = number > 10 ? "Number is greater than 10" : "Number is less than or equal to 10"; + + assertThat(msg).isEqualTo("Number is less than or equal to 10"); + } + + @Test + public void givenATrueCondition_whenUsingTernaryOperator_thenOnlyExpression1IsEvaluated() { + int exp1 = 0, exp2 = 0; + int result = 12 > 10 ? ++exp1 : ++exp2; + + assertThat(exp1).isEqualTo(1); + assertThat(exp2).isEqualTo(0); + assertThat(result).isEqualTo(1); + } + + @Test + public void givenAFalseCondition_whenUsingTernaryOperator_thenOnlyExpression2IsEvaluated() { + int exp1 = 0, exp2 = 0; + int result = 8 > 10 ? ++exp1 : ++exp2; + + assertThat(exp1).isEqualTo(0); + assertThat(exp2).isEqualTo(1); + assertThat(result).isEqualTo(1); + } + + @Test + public void givenANestedCondition_whenUsingTernaryOperator_thenCorrectValueIsReturned() { + int number = 6; + String msg = number > 10 ? "Number is greater than 10" : number > 5 ? "Number is greater than 5" : "Number is less than or equal to 5"; + + assertThat(msg).isEqualTo("Number is greater than 5"); + } +}